PluginProbe
Plugin Groups / 1.2.1
Plugin Groups v1.2.1
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.2.1, at classes/class-plugin-groups.php

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