PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.0.2
Shortcodes and extra features for Phlox theme v1.0.2
2.17.22 2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / public / class-auxels.php
auxin-elements / public Last commit date
assets 10 years ago includes 10 years ago templates 10 years ago class-auxels.php 10 years ago
class-auxels.php
290 lines
1 <?php
2 /**
3 * Auxin Elements.
4 *
5 * @echo HEADER
6 */
7
8 if ( ! class_exists( 'AUXELS' ) ) :
9
10
11
12 class AUXELS {
13
14 /**
15 * Unique identifier for your plugin.
16 *
17 * The variable name is used as the text domain when internationalizing strings of text.
18 *
19 * @since 1.0.0
20 *
21 * @var string
22 */
23 protected $plugin_slug = 'auxin-elements';
24
25 /**
26 * Instance of this class.
27 *
28 * @since 1.0.0
29 *
30 * @var object
31 */
32 protected static $instance = null;
33
34
35 /**
36 * Instance of Admin class.
37 *
38 * @since 1.0.0
39 *
40 * @var object
41 */
42 public $admin = null;
43
44
45
46 /**
47 * Initialize the plugin
48 *
49 * @since 1.0.0
50 */
51 private function __construct() {
52
53 $this->includes();
54
55 add_action( 'init', array( $this, 'init' ) );
56
57 // Activate plugin when new blog is added
58 add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
59
60 // Loaded action
61 do_action( 'auxels_loaded' );
62 }
63
64
65 /**
66 *
67 * @return [type] [description]
68 */
69 private function includes() {
70
71 // load common functionalities
72 include_once( AUXELS_INC_DIR . '/index.php' );
73
74
75 // Dashboard and Administrative Functionality
76 if ( is_admin() ) {
77
78 // Load AJAX spesific codes on demand
79 if ( defined('DOING_AJAX') && DOING_AJAX ){
80
81 }
82
83 // Load admin spesific codes
84 else {
85 $this->admin = include( AUXELS_ADMIN_DIR . '/class-auxels-admin.php' );
86 }
87
88 // Load Frontend Functionality
89 } else {
90 include 'includes/class-auxels-frontend-assets.php';
91 }
92
93 }
94
95
96 /**
97 * Init the plugin when WordPress Initialises.
98 *
99 * @return void
100 */
101 public function init(){
102
103 // @deprecate version 5.0
104 global $wp_version;
105 if ( version_compare( $wp_version, '4.6', '<' ) ) {
106 // Load plugin text domain
107 $this->load_plugin_textdomain();
108 }
109
110 }
111
112
113 /**
114 * Return an instance of this class.
115 *
116 * @since 1.0.0
117 *
118 * @return object A single instance of this class.
119 */
120 public static function get_instance() {
121
122 // If the single instance hasn't been set, set it now.
123 if ( null == self::$instance ) {
124 self::$instance = new self;
125 }
126
127 return self::$instance;
128 }
129
130
131 /**
132 * Fired when the plugin is activated.
133 *
134 * @since 1.0.0
135 *
136 * @param boolean $network_wide True if WPMU superadmin uses
137 * "Network Activate" action, false if
138 * WPMU is disabled or plugin is
139 * activated on an individual blog.
140 */
141 public static function activate( $network_wide ) {
142
143 if ( function_exists( 'is_multisite' ) && is_multisite() ) {
144
145 if ( $network_wide ) {
146
147 // Get all blog ids
148 $blog_ids = self::get_blog_ids();
149
150 foreach ( $blog_ids as $blog_id ) {
151
152 switch_to_blog( $blog_id );
153 self::single_activate();
154 }
155
156 restore_current_blog();
157
158 } else {
159 self::single_activate();
160 }
161
162 } else {
163 self::single_activate();
164 }
165
166 }
167
168
169 /**
170 * Fired when the plugin is deactivated.
171 *
172 * @since 1.0.0
173 *
174 * @param boolean $network_wide True if WPMU superadmin uses
175 * "Network Deactivate" action, false if
176 * WPMU is disabled or plugin is
177 * deactivated on an individual blog.
178 */
179 public static function deactivate( $network_wide ) {
180
181 if ( function_exists( 'is_multisite' ) && is_multisite() ) {
182
183 if ( $network_wide ) {
184
185 // Get all blog ids
186 $blog_ids = self::get_blog_ids();
187
188 foreach ( $blog_ids as $blog_id ) {
189
190 switch_to_blog( $blog_id );
191 self::single_deactivate();
192
193 }
194
195 restore_current_blog();
196
197 } else {
198 self::single_deactivate();
199 }
200
201 } else {
202 self::single_deactivate();
203 }
204
205 }
206
207
208 /**
209 * Fired for each blog when the plugin is activated.
210 *
211 * @since 1.0.0
212 */
213 private static function single_activate() {
214
215 do_action( 'auxels_activated', get_current_blog_id() );
216 }
217
218
219 /**
220 * Fired for each blog when the plugin is deactivated.
221 *
222 * @since 1.0.0
223 */
224 private static function single_deactivate() {
225 do_action( 'auxels_deactivated' );
226 }
227
228
229 /**
230 * Fired when a new site is activated with a WPMU environment.
231 *
232 * @since 1.0.0
233 *
234 * @param int $blog_id ID of the new blog.
235 */
236 public function activate_new_site( $blog_id ) {
237
238 if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
239 return;
240 }
241
242 switch_to_blog( $blog_id );
243 self::single_activate();
244 restore_current_blog();
245
246 }
247
248 /**
249 * Get all blog ids of blogs in the current network that are:
250 * - not archived
251 * - not spam
252 * - not deleted
253 *
254 * @since 1.0.0
255 *
256 * @return array|false The blog ids, false if no matches.
257 */
258 private static function get_blog_ids() {
259
260 global $wpdb;
261
262 // get an array of blog ids
263 $sql = "SELECT blog_id FROM $wpdb->blogs
264 WHERE archived = '0' AND spam = '0'
265 AND deleted = '0'";
266
267 return $wpdb->get_col( $sql );
268
269 }
270
271
272 /**
273 * Load the plugin text domain for translation.
274 *
275 * @since 1.0.0
276 */
277 public function load_plugin_textdomain() {
278
279 $locale = apply_filters( 'plugin_locale', get_locale(), AUXELS_TEXT_DOMAIN );
280 load_textdomain( AUXELS_TEXT_DOMAIN, trailingslashit( WP_LANG_DIR ) . AUXELS_TEXT_DOMAIN . '/' . AUXELS_TEXT_DOMAIN . '-' . $locale . '.mo' );
281 load_plugin_textdomain( AUXELS_TEXT_DOMAIN, FALSE, basename( AUXELS_DIR ) . '/languages/' );
282 }
283
284 }
285
286 endif;
287
288 function AUXELS(){ return AUXELS::get_instance(); }
289 AUXELS();
290