PluginProbe
Module Control for Jetpack / 1.3
Module Control for Jetpack v1.3
1.7.4 1.7.3 trunk 0.4 1.0 1.2 1.3 1.4 1.4.1 1.4.2 1.5 1.6 1.7 1.7.1 1.7.2
jetpack-module-control / jetpack-module-control.php

jetpack-module-control.php in Module Control for Jetpack 1.3, at jetpack-module-control.php

718 lines 22.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Plugin Name: Module Control for Jetpack
4 * Plugin URI: http://status301.net/wordpress-plugins/jetpack-module-control/
5 * Description: This plugin brings additional control over Jetpack modules. You can blacklist / remove individual modules, prevent auto-activation or allow activation without a WordPress.com account.
6 * Author: RavanH
7 * Author URI: http://status301.net/
8 * Network: true
9 * Text Domain: jetpack-mc
10 * Domain Path: /languages/
11 * License: GPL2+
12 * Version: 1.3
13 */
14
15 /*
16 * ROADMAP
17 *
18 * version 2.0
19 * Replace "Prevent the Jetpack plugin from auto-activating (new) modules" with
20 * finer grained "Select which modules to auto-activate"
21 * see http://jeremy.hu/customize-the-list-of-modules-available-in-jetpack/
22 * function jeherve_auto_activate_stats() {
23 return array( 'stats' );
24 }
25 add_filter( 'jetpack_get_default_modules', 'jeherve_auto_activate_stats' );
26 *
27 * TO CONSIDER
28 *
29 * Make blacklist or whitelist optional
30 *
31 * Option to disable JUMPSTART with "Jetpack_Options::update_option( 'jumpstart', 'jumpstart_dismissed' );" ??
32 * or do we need to go through apply_filters( 'jetpack_module_feature' ...
33 * If we want to be able to select which modules should appear in Jumpstart later!
34 *
35 * Can we disable Debug link in the footer menu? No...
36 *
37 * Option to "force_deactivate" (same as blacklist?) as described on https://github.com/Automattic/jetpack/issues/1452
38 *
39 */
40
41
42 /**
43 * Jetpack Module Control Class
44 *
45 * since 0.1
46 */
47 class Jetpack_Module_Control {
48
49 /**
50 * The single instance.
51 * @var object
52 * @access private
53 * @since 0.1
54 */
55 private static $instance = null;
56
57 /**
58 * The plugins basename.
59 * @var string
60 * @access private
61 * @since 0.1
62 */
63 private static $plugin_basename = null;
64
65 /**
66 * Current plugin version.
67 * @since 0.1
68 * @var string
69 */
70 public $version = '1.2';
71
72 /**
73 * Available modules array
74 * @since 0.1
75 * @access private
76 * @var array
77 */
78 private static $modules = null;
79
80 /**
81 * Know modules array with names
82 * @since 0.2
83 * @access private
84 * @var array
85 */
86 private static $known_modules = array(
87 'after-the-deadline' => array( 'name' => 'Spelling and Grammar',
88 'requires_connection' => true
89 ),
90 'carousel' => array( 'name' => 'Carousel',
91 'requires_connection' => false
92 ),
93 'comments' => array( 'name' => 'Jetpack Comments',
94 'requires_connection' => true
95 ),
96 'contact-form' => array( 'name' => 'Contact Form',
97 'requires_connection' => false
98 ),
99 'custom-content-types' => array( 'name' => 'Custom Content Types',
100 'requires_connection' => false
101 ),
102 'custom-css' => array( 'name' => 'Custom CSS',
103 'requires_connection' => false
104 ),
105 'enhanced-distribution' => array( 'name' => 'Enhanced Distribution',
106 'requires_connection' => true
107 ),
108 'gravatar-hovercards' => array( 'name' => 'Gravatar Hovercards',
109 'requires_connection' => false
110 ),
111 'infinite-scroll' => array( 'name' => 'Infinite Scroll',
112 'requires_connection' => false
113 ),
114 'json-api' => array( 'name' => 'JSON API',
115 'requires_connection' => true
116 ),
117 'latex' => array( 'name' => 'Beautiful Math',
118 'requires_connection' => false
119 ),
120 'likes' => array( 'name' => 'Likes',
121 'requires_connection' => true
122 ),
123 'manage' => array( 'name' => 'Manage',
124 'requires_connection' => true
125 ),
126 'markdown' => array( 'name' => 'Markdown',
127 'requires_connection' => false
128 ),
129 'minileven' => array( 'name' => 'Mobile Theme',
130 'requires_connection' => false
131 ),
132 'monitor' => array( 'name' => 'Monitor',
133 'requires_connection' => true
134 ),
135 'notes' => array( 'name' => 'Notifications',
136 'requires_connection' => true
137 ),
138 'omnisearch' => array( 'name' => 'Omnisearch',
139 'requires_connection' => false
140 ),
141 'photon' => array( 'name' => 'Photon',
142 'requires_connection' => true
143 ),
144 'post-by-email' => array( 'name' => 'Post by Email',
145 'requires_connection' => true
146 ),
147 'protect' => array( 'name' => 'Protect',
148 'requires_connection' => true
149 ),
150 'publicize' => array( 'name' => 'Publicize',
151 'requires_connection' => true
152 ),
153 'related-posts' => array( 'name' => 'Related Posts',
154 'requires_connection' => true
155 ),
156 'sharedaddy' => array( 'name' => 'Sharing',
157 'requires_connection' => false
158 ),
159 'shortcodes' => array( 'name' => 'Shortcode Embeds',
160 'requires_connection' => false
161 ),
162 'shortlinks' => array( 'name' => 'WP.me Shortlinks',
163 'requires_connection' => true
164 ),
165 'site-icon' => array( 'name' => 'Site Icon',
166 'requires_connection' => false
167 ),
168 'sso' => array( 'name' => 'Jetpack Single Sign On',
169 'requires_connection' => true
170 ),
171 'stats' => array( 'name' => 'WordPress.com Stats',
172 'requires_connection' => true
173 ),
174 'subscriptions' => array( 'name' => 'Subscriptions',
175 'requires_connection' => true
176 ),
177 'tiled-gallery' => array( 'name' => 'Tiled Galleries',
178 'requires_connection' => false
179 ),
180 'vaultpress' => array( 'name' => 'VaultPress',
181 'requires_connection' => false
182 ),
183 'verification-tools' => array( 'name' => 'Site Verification',
184 'requires_connection' => false
185 ),
186 'videopress' => array( 'name' => 'VideoPress',
187 'requires_connection' => true
188 ),
189 'widget-visibility' => array( 'name' => 'Widget Visibility',
190 'requires_connection' => false
191 ),
192 'widgets' => array( 'name' => 'Extra Sidebar Widgets',
193 'requires_connection' => false
194 )
195 );
196
197 /**
198 * Know modules array with dashicons
199 * @since 0.3
200 * @access private
201 * @var array
202 */
203 private static $known_modules_icons = array(
204 'after-the-deadline' => 'edit',
205 'carousel' => 'camera',
206 'comments' => 'format-chat',
207 'contact-form' => 'feedback',
208 'custom-content-types' => 'media-default',
209 'custom-css' => 'admin-appearance',
210 'enhanced-distribution' => 'share',
211 'gravatar-hovercards' => 'id', // not available
212 'infinite-scroll' => 'star-filled',
213 'json-api' => 'share-alt',
214 'latex' => 'star-filled',
215 'likes' => 'star-filled',
216 'manage' => 'wordpress-alt',
217 'markdown' => 'editor-code',
218 'minileven' => 'smartphone',
219 'monitor' => 'flag',
220 'notes' => 'admin-comments',
221 'omnisearch' => 'search',
222 'photon' => 'visibility',
223 'post-by-email' => 'email',
224 'protect' => 'lock',
225 'publicize' => 'share',
226 'related-posts' => 'update',
227 'sharedaddy' => 'share-alt',
228 'shortcodes' => 'text',
229 'shortlinks' => 'admin-links',
230 'site-icon' => 'admin-site',
231 'sso' => 'wordpress-alt',
232 'stats' => 'wordpress-alt',
233 'subscriptions' => 'email',
234 'tiled-gallery' => 'schedule', // not available. maybe tagcloud ?
235 'vaultpress' => 'shield-alt', // not availabe
236 'verification-tools' => 'clipboard', // maybe yes
237 'videopress' => 'controls-play',
238 'widget-visibility' => 'welcome-widgets-menus',
239 'widgets' => 'welcome-widgets-menus'
240 );
241
242 /**
243 * Default dashicon
244 * @since 1.0
245 * @access private
246 * @var string
247 */
248 private static $default_icon = 'star-empty';
249
250 /**
251 * Return Jetpack available modules
252 * @since 0.1
253 * @return array
254 */
255
256 private function get_available_modules() {
257 if ( null === self::$modules ) {
258 if ( class_exists('Jetpack') ) {
259 //remove_filter( 'jetpack_get_available_modules', array($this, 'blacklist') ); // remove filter useless here because of bug in Jetpack
260 $modules = array();
261 foreach ( Jetpack::get_available_modules() as $slug ) {
262 $module = Jetpack::get_module( $slug );
263 if ( $module )
264 $modules[$slug] = $module;
265 }
266 self::$modules = $modules;
267 //add_filter( 'jetpack_get_available_modules', array($this, 'blacklist') );
268 } else {
269 self::$modules = self::$known_modules;
270 }
271 }
272 return self::$modules;
273 }
274
275 /**
276 * Return plugin basename
277 *
278 * @since 0.1
279 *
280 * @return string Plugin basename
281 */
282
283 private function plugin_basename() {
284 if ( null === self::$plugin_basename ) {
285 self::$plugin_basename = plugin_basename( __FILE__ );
286 }
287 return self::$plugin_basename;
288 }
289
290 /**
291 * MANUAL CONTROL
292 */
293
294 /**
295 * Adds the Manual Control option
296 *
297 * @since 0.1
298 * @see get_site_option(), checked(), disabled()
299 *
300 * @uses jetpack_mc_manual_control network option
301 * @echo Html Checkbox input field for jetpack_mc_manual_control option
302 * @return void
303 */
304
305 public function manual_control_settings() {
306
307 $cws_manual_control = class_exists('CWS_Manual_Control_for_Jetpack_Plugin') ? true : false;
308 $option = $cws_manual_control ? '1' : get_site_option('jetpack_mc_manual_control');
309 $disabled = $cws_manual_control || ( defined('JETPACK_MC_LOCKDOWN') && JETPACK_MC_LOCKDOWN ) ? true : false;
310
311 ?>
312 <label>
313 <input type='checkbox' name='jetpack_mc_manual_control' value='1'
314 <?php checked( $option, '1' ); ?>
315 <?php disabled( $disabled ); ?>>
316 <?php _e('Prevent the Jetpack plugin from auto-activating (new) modules.','jetpack-mc'); ?>
317 </label>
318 <p class="description"><?php echo sprintf( __('Note: The module %s will always be auto-activated.','jetpack-mc'), _x('Protect','Module Name','jetpack') ); ?></p>
319 <?php
320
321 } // END manual_control_settings()
322
323 /**
324 * Activates Manual Control by returning an empty array on module auto-activation.
325 * First modelled after Manual Control for Jetpack by Mark Jaquith http://coveredwebservices.com/
326 * To be converted to allow selected modules instead of all or none.
327 *
328 * @since 0.1
329 * @see add_filter()
330 */
331
332 public function manual_control( $modules ) {
333
334 return get_site_option('jetpack_mc_manual_control', false) ? array() : $modules;
335
336 } // END manual_control()
337
338 /**
339 * DEVELOPMENT MODE
340 */
341
342 /**
343 * Adds the Jetpack Without WordPress.com option
344 *
345 * @since 1.0
346 * @see get_site_option(), checked(), disabled()
347 *
348 * @echo Html Checkbox input field for jetpack_mc_development_mode option
349 * @return void
350 */
351
352 public function development_mode_settings() {
353
354 $forced = is_plugin_active('slimjetpack/slimjetpack.php') || is_plugin_active('unplug-jetpack/unplug-jetpack.php') || ( defined('JETPACK_DEV_DEBUG') && JETPACK_DEV_DEBUG ) ? true : false;
355 $option = $forced ? '1' : get_site_option('jetpack_mc_development_mode');
356 $disabled = $forced || ( defined('JETPACK_MC_LOCKDOWN') && JETPACK_MC_LOCKDOWN ) ? true : false;
357
358 ?>
359 <label>
360 <input type='checkbox' name='jetpack_mc_development_mode' value='1'
361 <?php checked( $option, '1' ); ?>
362 <?php disabled( $disabled ); ?>>
363 <?php _e('Allow activating Jetpack modules without a WordPress.com connection.','jetpack-mc'); ?>
364 </label>
365 <p class="description"><?php _e('By forcing Jetpack into development mode, modules are used without a WordPress.com account. All modules that require a WordPress.com connection will be unavailable. These modules are marked with an asterisk (*) below. The admin message about Jetpack running in development mode will be hidden.','jetpack-mc'); ?></p>
366 <?php
367
368 } // END development_mode_settings()
369
370 /**
371 * Activates Development Mode by returning true on jetpack_development_mode filter.
372 * Based on http://jeremy.hu/customize-the-list-of-modules-available-in-jetpack/
373 *
374 * @since 1.0
375 * @see add_filter()
376 */
377
378 public function development_mode() {
379
380 return get_site_option('jetpack_mc_development_mode', false) ? true : false;
381
382 } // END development_mode()
383
384 /**
385 * ADMIN NOTICES
386 */
387
388 /**
389 * Disables Centralized Site Management banner by returning false on can_display_jetpack_manage_notice filter.
390 *
391 * @since 0.1
392 * @see add_filter()
393 */
394
395 private function no_manage_notice() {
396
397 $blacklist = get_site_option('jetpack_mc_blacklist', array() );
398
399 if ( in_array('manage', (array)$blacklist ) )
400 add_filter( 'can_display_jetpack_manage_notice', '__return_false' );
401
402 } // END no_manage_notice()
403
404 /**
405 * Disables Centralized Site Management banner by returning false on can_display_jetpack_manage_notice filter.
406 *
407 * @since 0.1
408 * @see add_filter()
409 */
410 private function no_dev_notice() {
411
412 if ( get_site_option('jetpack_mc_development_mode', false) && class_exists('Jetpack') )
413 remove_action( 'jetpack_notices', array( Jetpack::init(), 'show_development_mode_notice' ) );
414
415 } // END no_dev_notice()
416
417 /**
418 * BLACKLIST
419 */
420
421 /**
422 * Adds a checkmark list of modules to blacklist
423 *
424 * @since 0.1
425 * @see get_site_option(), checked()
426 *
427 * @uses jetpack_mc_blacklist network option
428 * @echo Html Checkbox input field table for jetpack_mc_blacklist option
429 */
430
431 public function blacklist_settings() {
432
433 $blacklist = get_site_option( 'jetpack_mc_blacklist', array() );
434
435 $dev_mode = get_site_option( 'jetpack_mc_development_mode' );
436
437 $modules = $this->get_available_modules();
438 asort($modules);
439
440 $icons = self::$known_modules_icons;
441
442 $lockdown = defined('JETPACK_MC_LOCKDOWN') ? JETPACK_MC_LOCKDOWN : false;
443
444 ?>
445 <fieldset><legend class="screen-reader-text"><span><?php _e('Blacklist Modules','jetpack-mc'); ?></span></legend>
446 <?php
447 foreach ( $modules as $slug => $module ) {
448 $icon = isset($icons[$slug]) ? $icons[$slug] : self::$default_icon;
449 ?>
450 <label>
451 <input type='checkbox' name='jetpack_mc_blacklist[]' value='<?php echo $slug; ?>'
452 <?php checked( in_array($slug,(array)$blacklist), true ); ?>
453 <?php disabled( $lockdown ); ?>>
454 <span class="dashicons dashicons-<?php echo $icon; ?>"></span> <?php _ex( $module['name'], 'Module Name', 'jetpack' ) ?>
455 </label><?php echo !empty($module['requires_connection']) && true === $module['requires_connection'] ? ' <a href="#jmc-note-1" style="text-decoration:none" title="' . __('Requires a WordPress.com connection','jetpack-mc') . '">*</a>' : ''; ?><br>
456 <?php
457 }
458 ?>
459 <aside role="note" id="jmc-note-1"><p class="description"><?php _e('*) Modules marked with an asterisk require a WordPress.com connection. They will be unavailable if Jetpack is forced into development mode.','jetpack-mc'); ?></p></aside>
460 </fieldset>
461 <?php
462
463 } // END blacklist_settings()
464
465 /**
466 * Blacklist Jetpack modules
467 * Modelled after ParhamG's blacklist_jetpack_modules.php https://gist.github.com/ParhamG/6494979
468 *
469 * @since 0.1
470 * @param $modules
471 *
472 * @return Array Allowed modules after unsetting blacklisted modules from all modules array
473 */
474
475 public function blacklist ( $modules ) {
476
477 $blacklist = get_site_option('jetpack_mc_blacklist');
478
479 foreach ( (array)$blacklist as $mod ) {
480 if ( isset( $modules[$mod] ) ) {
481 unset( $modules[$mod] );
482 }
483 }
484
485 return $modules;
486
487 } // END blacklist()
488
489 /**
490 * ADMIN
491 */
492
493 /**
494 * Initiate plugins admin stuff
495 *
496 * @since 0.1
497 */
498
499 public function admin_init(){
500
501 $this->no_manage_notice();
502
503 $this->no_dev_notice();
504
505 if ( is_plugin_active_for_network( $this->plugin_basename() ) ) {
506
507 add_filter( 'network_admin_plugin_action_links_' . $this->plugin_basename(), array($this, 'add_action_link') );
508
509 // Add settings to Network Settings
510 // thanks to http://zao.is/2013/07/adding-settings-to-network-settings-for-wordpress-multisite/
511 if ( is_network_admin() ) {
512 add_filter( 'wpmu_options', array( $this, 'show_network_settings' ) );
513 if ( defined('JETPACK_MC_LOCKDOWN') && JETPACK_MC_LOCKDOWN ) {
514 // do not add action to save network settings
515 } else {
516 add_action( 'update_wpmu_options', array( $this, 'save_network_settings' ) );
517 }
518 }
519
520 } else {
521
522 add_filter( 'plugin_action_links_' . $this->plugin_basename(), array($this, 'add_action_link') );
523
524 // Do regular register/add_settings stuff in 'general' settings on options-general.php
525 $settings = 'general';
526
527 add_settings_section('jetpack-mc', '<a name="jetpack-mc"></a>' . __('Jetpack Module Control','jetpack-mc'), array($this, 'add_settings_section'), $settings);
528
529 // register settings
530 if ( defined('JETPACK_MC_LOCKDOWN') && JETPACK_MC_LOCKDOWN ) {
531 // do not register settings to prevent them being updated
532 } else {
533 register_setting( $settings, 'jetpack_mc_manual_control' ); // sanitize_callback 'boolval' ?
534 register_setting( $settings, 'jetpack_mc_development_mode' ); // sanitize_callback 'boolval' ?
535 register_setting( $settings, 'jetpack_mc_blacklist', 'array_values' );
536 }
537
538 // add settings fields
539 add_settings_field( 'jetpack_mc_manual_control', __('Manual Control','jetpack-mc'), array($this, 'manual_control_settings'), $settings, 'jetpack-mc' ); // array('label_for' => 'elementid')
540 add_settings_field( 'jetpack_mc_development_mode', __('Development Mode','jetpack-mc'), array($this, 'development_mode_settings'), $settings, 'jetpack-mc' ); // array('label_for' => 'elementid')
541 add_settings_field( 'jetpack_mc_blacklist', __('Blacklist Modules','jetpack-mc'), array($this, 'blacklist_settings'), $settings, 'jetpack-mc' );
542
543 }
544
545 }
546
547 /**
548 * Saves the network settings
549 *
550 * @since 0.2
551 */
552 public function save_network_settings() {
553
554 $posted_settings = array(
555 'jetpack_mc_manual_control' => '',
556 'jetpack_mc_development_mode' => '',
557 'jetpack_mc_blacklist' => ''
558 );
559
560 isset( $_POST['jetpack_mc_manual_control'] ) && $posted_settings['jetpack_mc_manual_control'] = '1';
561
562 isset( $_POST['jetpack_mc_development_mode'] ) && $posted_settings['jetpack_mc_development_mode'] = '1';
563
564 isset( $_POST['jetpack_mc_blacklist'] ) && is_array( $_POST['jetpack_mc_blacklist'] ) && $posted_settings['jetpack_mc_blacklist'] = array_values( $_POST['jetpack_mc_blacklist'] );
565
566 foreach( $posted_settings as $name => $value )
567 update_site_option( $name, $value );
568
569 }
570
571 /**
572 * Prints the network settings
573 *
574 * @since 0.2
575 */
576 public function show_network_settings() {
577
578 ?>
579 <h3><a name="jetpack-mc"></a><?php _e('Jetpack Module Control','jetpack-mc'); ?></h3>
580 <?php
581 $this->add_settings_section('');
582 ?>
583 <table class="form-table">
584 <tbody>
585 <tr>
586 <th scope="row"><?php _e('Manual Control','jetpack-mc'); ?></th>
587 <td>
588 <?php
589 $this->manual_control_settings();
590 ?>
591 </td>
592 </tr>
593 <tr>
594 <th scope="row"><?php _e('Development Mode','jetpack-mc'); ?></th>
595 <td>
596 <?php
597 $this->development_mode_settings();
598 ?>
599 </td>
600 </tr>
601 <tr>
602 <th scope="row"><?php _e('Blacklist Modules','jetpack-mc'); ?></th>
603 <td>
604 <?php
605 $this->blacklist_settings();
606 ?>
607 </td>
608 </tr>
609 </tbody>
610 </table>
611 <?php
612 }
613
614 /**
615 * Echos a settings section header
616 *
617 * @since 0.1
618 *
619 * @param $option (unused)
620 * @echo Html
621 */
622 public function add_settings_section( $option ) {
623 echo '<p><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ravanhagen%40gmail%2ecom&item_name=Jetpack%20Module%20Control&item_number='
624 . $this->version
625 . '&no_shipping=0&tax=0&charset=UTF%2d8&currency_code=EUR" title="'
626 . __('Donate to keep plugin development going!','jetpack-mc')
627 . '"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" style="border:none;float:right;margin:5px 0 0 10px" alt="'
628 . __('Donate to keep plugin development going!','jetpack-mc') . '" width="92" height="26" /></a>'
629 . sprintf(__('The options in this section are provided by %s.','jetpack-mc'),'<strong><a href="http://status301.net/wordpress-plugins/jetpack-module-control/">'
630 . __('Jetpack Module Control','jetpack-mc') . ' ' . $this->version . '</a></strong>') . ' '
631 . __('This plugin brings additional control over Jetpack modules. You can blacklist / remove individual modules, prevent auto-activation or allow activation without a WordPress.com account.','jetpack-mc') . ' '
632 . sprintf(__('These settings can be locked down by adding %s to your wp-config.php file.','jetpack-mc'),'<code>define(\'JETPACK_MC_LOCKDOWN\', true);</code>')
633 . '</p>';
634
635 } // END add_setting_section()
636
637 /**
638 * Adds an action link on the Plugins page
639 *
640 * @since 0.1
641 * @see is_plugin_active_for_network(), admin_url(), network_admin_url()
642 *
643 * @param array $links Plugin de/activation and deletion links
644 * @return array Plugin links plus Settings link
645 */
646 public function add_action_link( $links ) {
647 $settings_link = is_plugin_active_for_network( $this->plugin_basename() ) ?
648 '<a href="' . network_admin_url('settings.php#jetpack-mc') . '">' . translate('Network Settings') . '</a>' :
649 '<a href="' . admin_url('options-general.php#jetpack-mc') . '">' . translate('Settings') . '</a>';
650 return array_merge(
651 array( 'settings' => $settings_link ),
652 $links
653 );
654 return $links;
655 }
656
657 /**
658 * Routines to execute on plugins_loaded
659 *
660 * We need to add our jetpack_get_available_modules filter
661 * AFTER running get_available_modules() because of bug in Jetpack
662 * https://github.com/Automattic/jetpack/issues/2026
663 * https://github.com/Automattic/jetpack/pull/2027
664 *
665 * @since 0.1
666 */
667 public function plugins_loaded() {
668 global $pagenow;
669
670 // only need translations on admin page
671 if ( is_admin() ) {
672 load_plugin_textdomain( 'jetpack-mc', false, dirname( $this->plugin_basename() ) . '/languages/' );
673
674 // populate jetpack modules list before filter is added
675 if ( in_array( $pagenow, array( 'options-general.php', 'settings.php' ) ) )
676 $this->get_available_modules();
677 }
678
679 add_filter( 'jetpack_get_default_modules', array( $this, 'manual_control' ), 99 );
680 add_filter( 'jetpack_development_mode', array( $this, 'development_mode' ) );
681 add_filter( 'jetpack_get_available_modules', array( $this, 'blacklist' ) );
682 }
683
684 /**
685 * Getter method for retrieving single object instance.
686 *
687 * @since 0.1
688 *
689 * @return Jetpack_Module_Control|null instance object
690 */
691 public static function instance() {
692 if(is_null(self::$instance)) {
693 self::$instance = new self();
694 }
695 return self::$instance;
696 } // End instance ()
697
698 /**
699 * Constructor
700 *
701 * @since 0.1
702 */
703 private function __construct() {
704 add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ), 0 );
705 add_action( 'admin_init', array($this,'admin_init'), 11 );
706 }
707
708 /**
709 * Cloning
710 *
711 * @since 0.1
712 */
713 private function __clone() { }
714
715 }
716
717 Jetpack_Module_Control::instance();
718