public function is_cache_configured()
 {
     $cache_configured = true;
     if ($this->is_wp_super_cache_detected()) {
         return $this->is_wp_super_cache_active() && $this->does_wp_super_cache_have_configured_uas() || !$this->is_wp_super_cache_active();
     }
     // Check W3
     if ($this->is_w3_plugin_detected()) {
         $w3_config = new W3_Config(true);
         if ($w3_config) {
             // Check to see if the Page Cache is enabled
             if ($w3_config->get_cache_option('pgcache.enabled')) {
                 // If it's enabled, we need to make sure the user agents have been updated
                 $rejected_user_agents = $w3_config->get_cache_option('pgcache.reject.ua');
                 if (!$this->find_in_array_no_case('iphone', $rejected_user_agents)) {
                     $cache_configured = false;
                 }
                 if (!$cache_configured && ($user_groups = $w3_config->get_array('mobile.rgroups')) && is_array($user_groups) && count($user_groups) > 0) {
                     foreach ($user_groups as $group) {
                         if ($group['enabled'] && $this->find_in_array_no_case('iphone', $group['agents']) && $group['theme'] == '' && $group['redirect'] == '') {
                             $cache_configured = true;
                             add_filter('wptouch_show_mobile_switch_link', '__return_false');
                         }
                     }
                 }
             }
         }
         return $cache_configured;
     }
     if ($this->is_wordfence_detected()) {
         $cache_type = wfConfig::get('cacheType', false);
         if (!$cache_type) {
             $cache_configured = true;
         } else {
             $cookie_set = false;
             $user_agents_set = false;
             $exclusions = wfConfig::get('cacheExclusions', false);
             if ($exclusions) {
                 $exclusions = unserialize($exclusions);
                 if ($exclusions) {
                     foreach ($exclusions as $exclusion) {
                         if ($exclusion['pt'] == 'cc' && ($exclusion['p'] = 'wptouch_switch_toggle')) {
                             $cookie_set = true;
                         } else {
                             if ($exclusion['pt'] == 'uac' && strtolower($exclusion['p']) == 'iphone') {
                                 $user_agents_set = true;
                             }
                         }
                         if ($cookie_set && $user_agents_set) {
                             break;
                         }
                     }
                 }
             }
             $cache_configured = $cookie_set && $user_agents_set;
         }
         return $cache_configured;
     }
     return $cache_configured;
 }
示例#2
0
 /**
  * Bad Behavior support
  * @return void
  */
 function _bad_behavior()
 {
     $bb_file = $this->_config->get_cache_option('pgcache.bad_behavior_path');
     if ($bb_file != '') {
         require_once $bb_file;
     }
 }