Exemplo n.º 1
0
 /**
  * Runs plugin
  */
 function run()
 {
     add_action('w3tc_flush_all', array($this, 'w3tc_flush_posts'), 1100, 1);
     add_action('w3tc_flush_post', array($this, 'w3tc_flush_post'), 1100, 1);
     add_action('w3tc_flushable_posts', '__return_true', 1100);
     add_action('w3tc_flush_posts', array($this, 'w3tc_flush_posts'), 1100);
     add_action('w3tc_flush_url', array($this, 'w3tc_flush_url'), 1100, 1);
     add_filter('w3tc_admin_bar_menu', array($this, 'w3tc_admin_bar_menu'));
     add_filter('cron_schedules', array($this, 'cron_schedules'));
     $o = Dispatcher::component('PgCache_ContentGrabber');
     add_filter('w3tc_footer_comment', array($o, 'w3tc_footer_comment'));
     add_action('w3tc_usage_statistics_of_request', array($o, 'w3tc_usage_statistics_of_request'), 10, 1);
     add_filter('w3tc_usage_statistics_metrics', array($this, 'w3tc_usage_statistics_metrics'));
     if ($this->_config->get_string('pgcache.engine') == 'file' || $this->_config->get_string('pgcache.engine') == 'file_generic') {
         add_action('w3_pgcache_cleanup', array($this, 'cleanup'));
     }
     add_action('w3_pgcache_prime', array($this, 'prime'));
     Util_AttachToActions::flush_posts_on_actions();
     add_filter('comment_cookie_lifetime', array($this, 'comment_cookie_lifetime'));
     if ($this->_config->get_string('pgcache.engine') == 'file_generic') {
         add_action('wp_logout', array($this, 'on_logout'), 0);
         add_action('wp_login', array($this, 'on_login'), 0);
     }
     if ($this->_config->get_boolean('pgcache.prime.post.enabled', false)) {
         add_action('publish_post', array($this, 'prime_post'), 30);
     }
     if (($this->_config->get_boolean('pgcache.late_init') || $this->_config->get_boolean('pgcache.late_caching')) && !is_admin()) {
         $o = Dispatcher::component('PgCache_ContentGrabber');
         add_action('init', array($o, 'delayed_cache_print'), 99999);
     }
     if (!$this->_config->get_boolean('pgcache.mirrors.enabled') && !Util_Environment::is_wpmu_subdomain()) {
         add_action('init', array($this, 'redirect_on_foreign_domain'));
     }
 }
Exemplo n.º 2
0
 /**
  * Runs plugin
  */
 public function run()
 {
     Util_AttachToActions::flush_posts_on_actions();
     add_action('w3tc_flush_all', array($this, 'varnish_flush'), 2000, 1);
     add_action('w3tc_flush_post', array($this, 'varnish_flush_post'), 2000, 1);
     add_action('w3tc_flushable_posts', '__return_true', 2000);
     add_action('w3tc_flush_posts', array($this, 'varnish_flush'), 2000);
     add_action('w3tc_flush_url', array($this, 'varnish_flush_url'), 2000, 1);
     add_filter('w3tc_admin_bar_menu', array($this, 'w3tc_admin_bar_menu'));
 }
Exemplo n.º 3
0
 /**
  * run code for FSD CDN
  */
 private function run_fsd()
 {
     add_action('w3tc_flush_all', array('\\W3TC\\Cdn_Fsd_CacheFlush', 'w3tc_flush_all'), 3000, 1);
     add_action('w3tc_flush_post', array('\\W3TC\\Cdn_Fsd_CacheFlush', 'w3tc_flush_post'), 3000, 1);
     add_action('w3tc_flushable_posts', '__return_true', 3000);
     add_action('w3tc_flush_posts', array('\\W3TC\\Cdn_Fsd_CacheFlush', 'w3tc_flush_all'), 3000);
     add_action('w3tc_flush_url', array('\\W3TC\\Cdn_Fsd_CacheFlush', 'w3tc_flush_url'), 3000, 1);
     add_filter('w3tc_flush_execute_delayed_operations', array('\\W3TC\\Cdn_Fsd_CacheFlush', 'w3tc_flush_execute_delayed_operations'), 3000);
     Util_AttachToActions::flush_posts_on_actions();
 }
 /**
  * Runs plugin
  */
 function run()
 {
     add_filter('w3tc_config_default_values', array($this, 'w3tc_config_default_values'));
     add_action('wp_set_comment_status', array($this, 'set_comment_status'), 1, 2);
     // priority is important, see do_action call of that action
     add_action('w3tc_flush_all', array($this, 'w3tc_flush_all'), 3000, 1);
     add_filter('w3tc_flush_execute_delayed_operations', array($this, 'w3tc_flush_execute_delayed_operations'), 3000, 1);
     $this->fix_remote_addr();
     // if page caching is enabled on CF - attach to post modifications
     // and flush it
     if ($this->_config->get_boolean(array('cloudflare', 'pagecache'))) {
         Util_AttachToActions::flush_posts_on_actions();
         add_action('w3tc_flush_post', array($this, 'w3tc_flush_xxx'), 3000);
         add_action('w3tc_flushable_posts', '__return_true', 3000);
         add_action('w3tc_flush_posts', array($this, 'w3tc_flush_xxx'), 3000);
     }
 }