-
Notifications
You must be signed in to change notification settings - Fork 2
/
pojo-shortcodes.php
98 lines (81 loc) · 2.57 KB
/
pojo-shortcodes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/*
Plugin Name: Pojo Shortcodes
Plugin URI: http://pojo.me/
Description: ...
Author: Pojo Team
Author URI: http://pojo.me/
Version: 1.0.0
Text Domain: pojo-shortcodes
Domain Path: /languages/
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
define( 'POJO_SHORTCODES__FILE__', __FILE__ );
define( 'POJO_SHORTCODES_BASE', plugin_basename( POJO_SHORTCODES__FILE__ ) );
define( 'POJO_SHORTCODES_URL', plugins_url( '/', POJO_SHORTCODES__FILE__ ) );
define( 'POJO_SHORTCODES_PATH', plugin_dir_path( POJO_SHORTCODES__FILE__ ) . '/' );
define( 'POJO_SHORTCODES_ASSETS_PATH', plugin_dir_path( POJO_SHORTCODES__FILE__ ) . 'assets/' );
define( 'POJO_SHORTCODES_ASSETS_URL', POJO_SHORTCODES_URL . 'assets/' );
final class Pojo_Shortcodes {
/**
* @var Pojo_Shortcodes The one true Pojo_Shortcodes
* @since 1.0.0
*/
private static $_instance = null;
/**
* @var Pojo_Shortcodes_Manager
*/
public $manager;
public function load_textdomain() {
load_plugin_textdomain( 'pojo-shortcodes', false, basename( dirname( __FILE__ ) ) . '/languages' );
}
/**
* Throw error on object clone
*
* The whole idea of the singleton design pattern is that there is a single
* object therefore, we don't want the object to be cloned.
*
* @since 1.0.0
* @return void
*/
public function __clone() {
// Cloning instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'pojo-shortcodes' ), '1.0.0' );
}
/**
* Disable unserializing of the class
*
* @since 1.0.0
* @return void
*/
public function __wakeup() {
// Unserializing instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'pojo-shortcodes' ), '1.0.0' );
}
/**
* @return Pojo_Shortcodes
*/
public static function instance() {
if ( is_null( self::$_instance ) )
self::$_instance = new Pojo_Shortcodes();
return self::$_instance;
}
public function bootstrap() {
// This plugin for Pojo Themes..
// TODO: Add notice for non-pojo theme
if ( ! class_exists( 'Pojo_Core' ) )
return;
add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ), 100 );
include( POJO_SHORTCODES_PATH . 'includes/class-pojo-shortcodes-manager.php' );
$this->manager = new Pojo_Shortcodes_Manager();
}
public function enqueue_scripts() {
wp_enqueue_style( 'pojo-shortcodes', POJO_SHORTCODES_ASSETS_URL . 'css/front.css' );
}
private function __construct() {
add_action( 'init', array( &$this, 'bootstrap' ) );
add_action( 'plugins_loaded', array( &$this, 'load_textdomain' ) );
}
}
Pojo_Shortcodes::instance();
// EOF