PluginProbe
Plugin Groups / 1.0.3
Plugin Groups v1.0.3
trunk 1.0.3 1.1.0 1.2.1 1.2.2 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.9 3.0.0
plugin-groups / classes / class-plugin-groups.php

class-plugin-groups.php in Plugin Groups 1.0.3, at classes/class-plugin-groups.php

150 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Groups.
4 *
5 * @package Plugin_Groups
6 * @author David Cramer <david@digilab.co.za>
7 * @license GPL-2.0+
8 * @link
9 * @copyright 2015 David Cramer <david@digilab.co.za>
10 */
11
12 /**
13 * Plugin class.
14 * @package Plugin_Groups
15 * @author David Cramer <david@digilab.co.za>
16 */
17 class Plugin_Groups {
18
19 /**
20 * The slug for this plugin
21 *
22 * @since 0.0.1
23 *
24 * @var string
25 */
26 protected $plugin_slug = 'plugin-groups';
27
28 /**
29 * Holds class isntance
30 *
31 * @since 0.0.1
32 *
33 * @var object|Plugin_Groups
34 */
35 protected static $instance = null;
36
37 /**
38 * Holds the option screen prefix
39 *
40 * @since 0.0.1
41 *
42 * @var string
43 */
44 protected $plugin_screen_hook_suffix = null;
45
46 /**
47 * Initialize the plugin by setting localization, filters, and administration functions.
48 *
49 * @since 0.0.1
50 *
51 * @access private
52 */
53 private function __construct() {
54
55 // Load plugin text domain
56 add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
57
58 // Activate plugin when new blog is added
59 add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
60
61 // Load admin style sheet and JavaScript.
62 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_stylescripts' ) );
63
64
65 }
66
67
68 /**
69 * Return an instance of this class.
70 *
71 * @since 0.0.1
72 *
73 * @return object|Plugin_Groups A single instance of this class.
74 */
75 public static function get_instance() {
76
77 // If the single instance hasn't been set, set it now.
78 if ( null == self::$instance ) {
79 self::$instance = new self;
80 }
81
82 return self::$instance;
83 }
84
85 /**
86 * Load the plugin text domain for translation.
87 *
88 * @since 0.0.1
89 */
90 public function load_plugin_textdomain() {
91
92 load_plugin_textdomain( $this->plugin_slug, FALSE, basename( PLORG_PATH ) . '/languages');
93
94 }
95
96 /**
97 * Register and enqueue admin-specific style sheet.
98 *
99 * @since 0.0.1
100 *
101 * @return null
102 */
103 public function enqueue_admin_stylescripts() {
104
105 $screen = get_current_screen();
106
107 if( !is_object( $screen ) ){
108 return;
109 }
110
111
112
113 if( false !== strpos( $screen->base, 'plugin_groups' ) ){
114
115 wp_enqueue_style( 'plugin_groups-core-style', PLORG_URL . '/assets/css/styles.css' );
116 wp_enqueue_style( 'plugin_groups-baldrick-modals', PLORG_URL . '/assets/css/modals.css' );
117 wp_enqueue_script( 'plugin_groups-wp-baldrick', PLORG_URL . '/assets/js/wp-baldrick-full.js', array( 'jquery' ) , false, true );
118 wp_enqueue_script( 'jquery-ui-autocomplete' );
119 wp_enqueue_script( 'jquery-ui-sortable' );
120 wp_enqueue_style( 'plugin_groups-codemirror-style', PLORG_URL . '/assets/css/codemirror.css' );
121 wp_enqueue_script( 'plugin_groups-codemirror-script', PLORG_URL . '/assets/js/codemirror.js', array( 'jquery' ) , false );
122 wp_enqueue_script( 'plugin_groups-core-script', PLORG_URL . '/assets/js/scripts.js', array( 'plugin_groups-wp-baldrick' ) , false );
123 wp_enqueue_style( 'wp-color-picker' );
124 wp_enqueue_script( 'wp-color-picker' );
125 wp_enqueue_style( 'plugin_groups-select2-style', PLORG_URL . 'assets/css/select2.css' );
126 wp_enqueue_script( 'plugin_groups-select2-script', PLORG_URL . 'assets/js/select2.min.js', array( 'jquery' ) , false, true );
127 }
128
129
130 }
131
132
133
134 }
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150