Example #1
0
 /**
  * Run plugin
  */
 function run()
 {
     add_filter('cron_schedules', array(&$this, 'cron_schedules'));
     $cdn_engine = $this->_config->get_string('cdn.engine');
     if (!w3_is_cdn_mirror($cdn_engine)) {
         add_action('delete_attachment', array(&$this, 'delete_attachment'));
         add_filter('update_attached_file', array(&$this, 'update_attached_file'));
         add_filter('wp_update_attachment_metadata', array(&$this, 'update_attachment_metadata'));
         add_action('w3_cdn_cron_queue_process', array(&$this, 'cron_queue_process'));
         add_action('w3_cdn_cron_upload', array(&$this, 'cron_upload'));
         add_action('switch_theme', array(&$this, 'switch_theme'));
         add_filter('update_feedback', array(&$this, 'update_feedback'));
     }
     if (is_admin()) {
         add_action('w3tc_saving_options-w3tc_cdn', array($this, 'change_canonical_header'), 0, 0);
         add_filter('w3tc_module_is_running-cdn', array($this, 'cdn_is_running'));
     }
     /**
      * Start rewrite engine
      */
     if ($this->can_cdn()) {
         w3tc_add_ob_callback('cdn', array($this, 'ob_callback'));
     }
     if (is_admin() && w3_can_cdn_purge($cdn_engine)) {
         add_filter('media_row_actions', array(&$this, 'media_row_actions'), 0, 2);
     }
 }
Example #2
0
 function run()
 {
     if (defined('DOING_CRON') && DOING_CRON) {
         $this->background_task();
     }
     add_action('init', array($this, 'init'));
     /**
      * Start output buffering
      */
     w3tc_add_ob_callback('newrelic', array($this, 'ob_callback'));
 }
Example #3
0
 /**
  * Runs plugin
  */
 function run()
 {
     if ($this->_config->get_boolean('browsercache.html.w3tc')) {
         add_action('send_headers', array(&$this, 'send_headers'));
     }
     if (!$this->_config->get_boolean('browsercache.html.etag')) {
         add_filter('wp_headers', array(&$this, 'filter_wp_headers'), 0, 2);
     }
     if ($this->can_ob()) {
         w3tc_add_ob_callback('browsercache', array($this, 'ob_callback'));
     }
 }
Example #4
0
 /**
  * Runs plugin
  */
 function run()
 {
     add_filter('cron_schedules', array(&$this, 'cron_schedules'));
     if ($this->_config->get_string('minify.engine') == 'file') {
         add_action('w3_minify_cleanup', array(&$this, 'cleanup'));
     }
     /**
      * Start minify
      */
     if ($this->can_minify()) {
         w3tc_add_ob_callback('minify', array($this, 'ob_callback'));
     }
     if (!is_admin()) {
         $dispatcher = w3_instance('W3_Dispatcher');
         if ($dispatcher->send_minify_headers($this->_config)) {
             add_action('send_headers', array(&$this, 'send_headers'));
         }
     }
 }
Example #5
0
 /**
  * Run plugin
  */
 function run()
 {
     add_filter('cron_schedules', array(&$this, 'cron_schedules'));
     $cdn_engine = $this->_config->get_string('cdn.engine');
     if (!w3_is_cdn_mirror($cdn_engine)) {
         add_action('delete_attachment', array(&$this, 'delete_attachment'));
         add_filter('update_attached_file', array(&$this, 'update_attached_file'));
         add_filter('wp_update_attachment_metadata', array(&$this, 'update_attachment_metadata'));
         add_action('w3_cdn_cron_queue_process', array(&$this, 'cron_queue_process'));
         add_action('w3_cdn_cron_upload', array(&$this, 'cron_upload'));
         add_action('switch_theme', array(&$this, 'switch_theme'));
         add_filter('update_feedback', array(&$this, 'update_feedback'));
     }
     /**
      * Start rewrite engine
      */
     if ($this->can_cdn()) {
         w3tc_add_ob_callback('cdn', array($this, 'ob_callback'));
     }
 }
Example #6
0
 /**
  * Do cache logic
  */
 function process()
 {
     /**
      * Skip caching for some pages
      */
     switch (true) {
         case defined('DONOTCACHEPAGE'):
         case defined('DOING_AJAX'):
         case defined('DOING_CRON'):
         case defined('APP_REQUEST'):
         case defined('XMLRPC_REQUEST'):
         case defined('WP_ADMIN'):
         case defined('SHORTINIT') && SHORTINIT:
             return;
     }
     /*
      * Legacy mode with 0.9.2.3 version of /wp-content add-ins
      */
     if (isset($this->_legacy)) {
         $redirect = w3_instance('W3_Redirect');
         $redirect->process();
     }
     /**
      * Do page cache logic
      */
     if ($this->_debug) {
         $this->_time_start = w3_microtime();
     }
     $this->_caching = $this->_can_cache();
     global $w3_late_init;
     /**
      * @var W3_Dispatcher $dispatcher
      */
     $dispatcher = w3_instance('W3_Dispatcher');
     $dispatcher->set_newrelic_appname($this->_config);
     if ($this->_caching) {
         $this->_cached_data = $this->_extract_cached_page();
         if ($this->_cached_data) {
             if ($this->_late_init) {
                 $w3_late_init = true;
                 return;
             } else {
                 $this->process_cached_page($this->_cached_data);
                 exit;
             }
         } else {
             $this->_late_init = false;
         }
     } else {
         $this->_late_init = false;
     }
     $w3_late_init = $this->_late_init;
     /**
      * Start output buffering
      */
     w3tc_add_ob_callback('pagecache', array($this, 'ob_callback'));
 }