class.jetpack-sync-module-wp-super-cache.php
| 1 | <?php |
| 2 | |
| 3 | class Jetpack_Sync_Module_WP_Super_Cache extends Jetpack_Sync_Module { |
| 4 | |
| 5 | public function __construct() { |
| 6 | add_filter( 'jetpack_sync_constants_whitelist', array( $this, 'add_wp_super_cache_constants_whitelist' ), 10 ); |
| 7 | add_filter( 'jetpack_sync_callable_whitelist', array( $this, 'add_wp_super_cache_callable_whitelist' ), 10 ); |
| 8 | } |
| 9 | |
| 10 | static $wp_super_cache_constants = array( |
| 11 | 'WPLOCKDOWN', |
| 12 | 'WPSC_DISABLE_COMPRESSION', |
| 13 | 'WPSC_DISABLE_LOCKING', |
| 14 | 'WPSC_DISABLE_HTACCESS_UPDATE', |
| 15 | 'ADVANCEDCACHEPROBLEM', |
| 16 | ); |
| 17 | |
| 18 | static $wp_super_cache_callables = array( |
| 19 | 'wp_super_cache_globals' => array( 'Jetpack_Sync_Module_WP_Super_Cache', 'get_wp_super_cache_globals' ), |
| 20 | ); |
| 21 | |
| 22 | public function name() { |
| 23 | return 'wp-super-cache'; |
| 24 | } |
| 25 | |
| 26 | public static function get_wp_super_cache_globals() { |
| 27 | global $wp_cache_mod_rewrite; |
| 28 | global $cache_enabled; |
| 29 | global $super_cache_enabled; |
| 30 | global $ossdlcdn; |
| 31 | global $cache_rebuild_files; |
| 32 | global $wp_cache_mobile; |
| 33 | global $wp_super_cache_late_init; |
| 34 | global $wp_cache_anon_only; |
| 35 | global $wp_cache_not_logged_in; |
| 36 | global $wp_cache_clear_on_post_edit; |
| 37 | global $wp_cache_mobile_enabled; |
| 38 | global $wp_super_cache_debug; |
| 39 | global $cache_max_time; |
| 40 | global $wp_cache_refresh_single_only; |
| 41 | global $wp_cache_mfunc_enabled; |
| 42 | global $wp_supercache_304; |
| 43 | global $wp_cache_no_cache_for_get; |
| 44 | global $wp_cache_mutex_disabled; |
| 45 | global $cache_jetpack; |
| 46 | global $cache_domain_mapping; |
| 47 | |
| 48 | return array( |
| 49 | 'wp_cache_mod_rewrite' => $wp_cache_mod_rewrite, |
| 50 | 'cache_enabled' => $cache_enabled, |
| 51 | 'super_cache_enabled' => $super_cache_enabled, |
| 52 | 'ossdlcdn' => $ossdlcdn, |
| 53 | 'cache_rebuild_files' => $cache_rebuild_files, |
| 54 | 'wp_cache_mobile' => $wp_cache_mobile, |
| 55 | 'wp_super_cache_late_init' => $wp_super_cache_late_init, |
| 56 | 'wp_cache_anon_only' => $wp_cache_anon_only, |
| 57 | 'wp_cache_not_logged_in' => $wp_cache_not_logged_in, |
| 58 | 'wp_cache_clear_on_post_edit' => $wp_cache_clear_on_post_edit, |
| 59 | 'wp_cache_mobile_enabled' => $wp_cache_mobile_enabled, |
| 60 | 'wp_super_cache_debug' => $wp_super_cache_debug, |
| 61 | 'cache_max_time' => $cache_max_time, |
| 62 | 'wp_cache_refresh_single_only' => $wp_cache_refresh_single_only, |
| 63 | 'wp_cache_mfunc_enabled' => $wp_cache_mfunc_enabled, |
| 64 | 'wp_supercache_304' => $wp_supercache_304, |
| 65 | 'wp_cache_no_cache_for_get' => $wp_cache_no_cache_for_get, |
| 66 | 'wp_cache_mutex_disabled' => $wp_cache_mutex_disabled, |
| 67 | 'cache_jetpack' => $cache_jetpack, |
| 68 | 'cache_domain_mapping' => $cache_domain_mapping, |
| 69 | ); |
| 70 | } |
| 71 | |
| 72 | public function add_wp_super_cache_constants_whitelist( $list ) { |
| 73 | return array_merge( $list, self::$wp_super_cache_constants ); |
| 74 | } |
| 75 | |
| 76 | public function add_wp_super_cache_callable_whitelist( $list ) { |
| 77 | return array_merge( $list, self::$wp_super_cache_callables ); |
| 78 | } |
| 79 | } |
| 80 |