/modules/manage.php

  1. <?php 
  2. /** 
  3. * Module Name: Manage 
  4. * Module Description: Manage all your sites from a centralized place, https://wordpress.com/sites. 
  5. * Jumpstart Description: Helps you remotely manage plugins, turn on automated updates, and more from <a href="https://wordpress.com/plugins/" target="_blank">wordpress.com</a>. 
  6. * Sort Order: 1 
  7. * Recommendation Order: 3 
  8. * First Introduced: 3.4 
  9. * Requires Connection: Yes 
  10. * Auto Activate: No 
  11. * Module Tags: Centralized Management, Recommended 
  12. * Feature: Recommended, Jumpstart 
  13. * Additional Search Queries: manage, management, remote 
  14. */ 
  15.  
  16. add_action( 'jetpack_activate_module_manage', array( Jetpack::init(), 'toggle_module_on_wpcom' ) ); 
  17. add_action( 'jetpack_deactivate_module_manage', array( Jetpack::init(), 'toggle_module_on_wpcom' ) ); 
  18. add_action( 'customize_register', 'add_wpcom_to_allowed_redirect_hosts' ); 
  19.  
  20. // Add wordpress.com to the safe redirect whitelist if the Manage module is enabled 
  21. // so the customizer can `return` to wordpress.com if invoked from there. 
  22. function add_wpcom_to_allowed_redirect_hosts( $domains ) { 
  23. if ( Jetpack::is_module_active( 'manage' ) ) { 
  24. add_filter( 'allowed_redirect_hosts', 'allow_wpcom_domain' ); 
  25.  
  26. // Return $domains, with 'wordpress.com' appended. 
  27. function allow_wpcom_domain( $domains ) { 
  28. if ( empty( $domains ) ) { 
  29. $domains = array(); 
  30. $domains[] = 'wordpress.com'; 
  31. return array_unique( $domains ); 
  32.  
  33. // Re add sync for non public posts when the optin is selected in Calypso. 
  34. // This will only work if you have manage enabled as well. 
  35. if ( Jetpack_Options::get_option( 'sync_non_public_post_stati' ) ) { 
  36. $sync_options = array( 
  37. 'post_types' => get_post_types( array( 'public' => true ) ),  
  38. 'post_stati' => get_post_stati(),  
  39. ); 
  40. Jetpack_Sync::sync_posts( __FILE__, $sync_options ); 
  41.  
  42. Jetpack::module_configuration_screen( 'manage', 'jetpack_manage_config_screen' ); 
  43. function jetpack_manage_config_screen() { 
  44. include ( JETPACK__PLUGIN_DIR . 'modules/manage/confirm-admin.php' ); 
.