/** * 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); } }
</p> <?php } else { ?> <p> Prepare the <acronym title="Content Delivery Network">CDN</acronym> by: <input id="cdn_import_library" class="button {nonce: '<?php echo wp_create_nonce('w3tc'); ?> '}" type="button" value="importing attachments into the Media Library" />. Check <input id="cdn_queue" class="button {nonce: '<?php echo wp_create_nonce('w3tc'); ?> '}" type="button" value="unsuccessful file transfers" /> if some objects appear to be missing. <?php if (w3_can_cdn_purge($cdn_engine)) { ?> <input id="cdn_purge" class="button {nonce: '<?php echo wp_create_nonce('w3tc'); ?> '}" type="button" value="Purge" /> objects from the <acronym title="Content Delivery Network">CDN</acronym> if needed. <?php } ?> <input id="cdn_rename_domain" class="button {nonce: '<?php echo wp_create_nonce('w3tc'); ?> '}" type="button" value="Modify attachment URLs" /> if the domain name of your site has ever changed. </p> <?php }
/** * Admin bar menu * * @return void */ function admin_bar_menu() { global $wp_admin_bar; if (current_user_can('manage_options')) { /** * @var $modules W3_ModuleStatus */ $modules = w3_instance('W3_ModuleStatus'); $can_empty_memcache = $modules->can_empty_memcache(); $can_empty_opcode = $modules->can_empty_opcode(); $can_empty_file = $modules->can_empty_file(); $can_empty_varnish = $modules->can_empty_varnish(); $browsercache_update_media_qs = $this->_config->get_boolean('browsercache.cssjs.replace') || $this->_config->get_boolean('browsercache.other.replace'); //$cdn_enabled = $modules->is_enabled('cdn'); $cdn_engine = $modules->get_module_engine('cdn'); $cdn_mirror = w3_is_cdn_mirror($cdn_engine); $menu_items = array(array('id' => 'w3tc', 'title' => __('Performance', 'w3-total-cache'), 'href' => admin_url('admin.php?page=w3tc_dashboard'))); if ($modules->is_enabled('pgcache') && w3_detect_post_id() && (!defined('DOING_AJAX') || !DOING_AJAX)) { $menu_items[] = array('id' => 'w3tc-pgcache-purge-post', 'parent' => 'w3tc', 'title' => __('Purge From Cache', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_pgcache_purge_post&post_id=' . w3_detect_post_id()), 'w3tc')); } if ($can_empty_file && ($can_empty_opcode || $can_empty_memcache)) { $menu_items[] = array('id' => 'w3tc-flush-file', 'parent' => 'w3tc-empty-caches', 'title' => __('Empty Disc Cache(s)', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_file'), 'w3tc')); } if ($can_empty_opcode && ($can_empty_file || $can_empty_memcache)) { $menu_items[] = array('id' => 'w3tc-flush-opcode', 'parent' => 'w3tc-empty-caches', 'title' => __('Empty Opcode Cache', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_opcode'), 'w3tc')); } if ($can_empty_memcache && ($can_empty_file || $can_empty_opcode)) { $menu_items[] = array('id' => 'w3tc-flush-memcached', 'parent' => 'w3tc-empty-caches', 'title' => __('Empty Memcached Cache(s)', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_memcached'), 'w3tc')); } if ($modules->is_enabled('browsercache') && $browsercache_update_media_qs) { $menu_items[] = array('id' => 'w3tc-update-media-qs', 'parent' => 'w3tc', 'title' => __('Update Media Query String', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_browser_cache'), 'w3tc')); } if ($modules->plugin_is_enabled()) { $menu_items[] = array('id' => 'w3tc-empty-caches', 'parent' => 'w3tc', 'title' => __('Empty All Caches', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_all'), 'w3tc')); $menu_items[] = array('id' => 'w3tc-modules', 'parent' => 'w3tc', 'title' => __('Empty Modules', 'w3-total-cache')); } if ($modules->is_enabled('pgcache')) { $menu_items[] = array('id' => 'w3tc-flush-pgcache', 'parent' => 'w3tc-modules', 'title' => __('Empty Page Cache', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_pgcache'), 'w3tc')); } if ($modules->is_enabled('minify')) { $menu_items[] = array('id' => 'w3tc-flush-minify', 'parent' => 'w3tc-modules', 'title' => __('Empty Minify Cache', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_minify'), 'w3tc')); } if ($modules->is_enabled('dbcache')) { $menu_items[] = array('id' => 'w3tc-flush-dbcache', 'parent' => 'w3tc-modules', 'title' => __('Empty Database Cache', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_dbcache'), 'w3tc')); } if ($modules->is_enabled('objectcache')) { $menu_items[] = array('id' => 'w3tc-flush-objectcache', 'parent' => 'w3tc-modules', 'title' => __('Empty Object Cache', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_objectcache'), 'w3tc')); } if (w3_is_pro($this->_config) || w3_is_enterprise($this->_config)) { if ($modules->is_enabled('fragmentcache')) { $menu_items[] = array('id' => 'w3tc-flush-fragmentcache', 'parent' => 'w3tc-modules', 'title' => __('Empty Fragment Cache', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_fragmentcache'), 'w3tc')); } } if ($modules->is_enabled('varnish')) { $menu_items[] = array('id' => 'w3tc-flush-varnish', 'parent' => 'w3tc-modules', 'title' => __('Purge Varnish Cache', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_dashboard&w3tc_flush_varnish'), 'w3tc')); } if ($modules->is_enabled('cdn')) { if (w3_can_cdn_purge($cdn_engine)) { $menu_items[] = array('id' => 'w3tc-cdn-purge', 'parent' => 'w3tc', 'title' => __('Purge CDN', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_cdn&w3tc_cdn_purge'), 'w3tc'), 'meta' => array('onclick' => "w3tc_popupadmin_bar(this.href); return false")); } if (w3_cdn_can_purge_all($cdn_engine)) { $menu_items[] = array('id' => 'w3tc-cdn-purge-full', 'parent' => 'w3tc', 'title' => __('Purge CDN Completely', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_cdn&w3tc_flush_cdn'), 'w3tc')); } if (!$cdn_mirror) { $menu_items[] = array('id' => 'w3tc-cdn-queue', 'parent' => 'w3tc', 'title' => __('Unsuccessful file transfers', 'w3-total-cache'), 'href' => wp_nonce_url(admin_url('admin.php?page=w3tc_cdn&w3tc_cdn_queue'), 'w3tc'), 'meta' => array('onclick' => "w3tc_popupadmin_bar(this.href); return false")); } } $menu_items = array_merge($menu_items, array(array('id' => 'w3tc-faq', 'parent' => 'w3tc', 'title' => __('FAQ', 'w3-total-cache'), 'href' => admin_url('admin.php?page=w3tc_faq')), array('id' => 'w3tc-support', 'parent' => 'w3tc', 'title' => __('<span style="color: red; background: none;">Support</span>', 'w3-total-cache'), 'href' => admin_url('admin.php?page=w3tc_support')))); foreach ($menu_items as $menu_item) { $wp_admin_bar->add_menu($menu_item); } } }
?> >Self-hosted / File Transfer Protocol Upload</option> </optgroup> </select><br /> <span class="description">Select the <acronym title="Content Delivery Network">CDN</acronym> type you wish to use.</span> </td> </tr> </table> <p class="submit"> <?php echo $this->nonce_field('w3tc'); ?> <input type="submit" name="w3tc_save_options" class="w3tc-button-save button-primary" value="Save all settings" /> <input id="cdn_purge" type="button" value="Purge cache"<?php if (!$cdn_enabled || !w3_can_cdn_purge($this->_config->get_string('cdn.engine'))) { ?> disabled="disabled"<?php } ?> class="button" /> </p> <?php echo $this->postbox_footer(); ?> <?php echo $this->postbox_header('Varnish'); ?> <table class="form-table"> <tr>
/** * Runs plugin * * @return void */ function run() { register_activation_hook(W3TC_FILE, array(&$this, 'activate')); register_deactivation_hook(W3TC_FILE, array(&$this, 'deactivate')); add_action('admin_init', array(&$this, 'admin_init')); add_action('admin_menu', array(&$this, 'admin_menu')); add_action('admin_bar_menu', array(&$this, 'admin_bar_menu'), 150); add_filter('contextual_help_list', array(&$this, 'contextual_help_list')); add_filter('plugin_action_links_' . W3TC_FILE, array(&$this, 'plugin_action_links')); add_filter('favorite_actions', array(&$this, 'favorite_actions')); add_action('init', array(&$this, 'init')); add_action('in_plugin_update_message-' . W3TC_FILE, array(&$this, 'in_plugin_update_message')); if ($this->_config->get_boolean('widget.latest.enabled') || $this->_config->get_boolean('widget.pagespeed.enabled')) { add_action('wp_dashboard_setup', array(&$this, 'wp_dashboard_setup')); } if ($this->_config->get_boolean('pgcache.enabled') || $this->_config->get_boolean('minify.enabled')) { add_filter('pre_update_option_active_plugins', array(&$this, 'pre_update_option_active_plugins')); } if ($this->_config->get_boolean('cdn.enabled') && w3_can_cdn_purge($this->_config->get_string('cdn.engine'))) { add_filter('media_row_actions', array(&$this, 'media_row_actions'), 0, 2); } if ($this->_config->get_boolean('pgcache.enabled')) { add_filter('post_row_actions', array(&$this, 'post_row_actions'), 0, 2); add_filter('page_row_actions', array(&$this, 'page_row_actions'), 0, 2); } if (isset($_REQUEST['w3tc_theme']) && isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == W3TC_POWERED_BY) { add_filter('template', array(&$this, 'template_preview')); add_filter('stylesheet', array(&$this, 'stylesheet_preview')); } elseif ($this->_config->get_boolean('mobile.enabled') || $this->_config->get_boolean('referrer.enabled')) { add_filter('template', array(&$this, 'template')); add_filter('stylesheet', array(&$this, 'stylesheet')); } /** * CloudFlare support */ if ($this->_config->get_boolean('cloudflare.enabled')) { add_action('wp_set_comment_status', array(&$this, 'cloudflare_set_comment_status'), 1, 2); require_once W3TC_LIB_W3_DIR . '/CloudFlare.php'; $w3_cloudflare =& new W3_CloudFlare(); $w3_cloudflare->fix_remote_addr(); } if ($this->_config->get_string('common.support') == 'footer') { add_action('wp_footer', array(&$this, 'footer')); } if ($this->can_ob()) { ob_start(array(&$this, 'ob_callback')); } /** * Run DbCache plugin */ require_once W3TC_LIB_W3_DIR . '/Plugin/DbCache.php'; $w3_plugin_dbcache =& W3_Plugin_DbCache::instance(); $w3_plugin_dbcache->run(); /** * Run ObjectCache plugin */ require_once W3TC_LIB_W3_DIR . '/Plugin/ObjectCache.php'; $w3_plugin_objectcache =& W3_Plugin_ObjectCache::instance(); $w3_plugin_objectcache->run(); /** * Run PgCache plugin */ require_once W3TC_LIB_W3_DIR . '/Plugin/PgCache.php'; $w3_plugin_pgcache =& W3_Plugin_PgCache::instance(); $w3_plugin_pgcache->run(); /** * Run CDN plugin */ require_once W3TC_LIB_W3_DIR . '/Plugin/Cdn.php'; $w3_plugin_cdn =& W3_Plugin_Cdn::instance(); $w3_plugin_cdn->run(); /** * Run BrowserCache plugin */ require_once W3TC_LIB_W3_DIR . '/Plugin/BrowserCache.php'; $w3_plugin_browsercache =& W3_Plugin_BrowserCache::instance(); $w3_plugin_browsercache->run(); /** * Run Minify plugin */ if (W3TC_PHP5) { require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php'; $w3_plugin_minify =& W3_Plugin_Minify::instance(); $w3_plugin_minify->run(); } }
/** * Runs plugin * * @return void */ function run() { $this->_request_types = array('bug_report' => __('Submit a Bug Report', 'w3-total-cache'), 'new_feature' => __('Suggest a New Feature', 'w3-total-cache'), 'email_support' => __('Less than 15 Minute Email Support Response (M-F 9AM - 5PM EDT): $75 USD', 'w3-total-cache'), 'phone_support' => __('Less than 15 Minute Phone Support Response (M-F 9AM - 5PM EDT): $150 USD', 'w3-total-cache'), 'plugin_config' => __('Professional Plugin Configuration: Starting @ $100 USD', 'w3-total-cache'), 'theme_config' => __('Theme Performance Optimization & Plugin Configuration: Starting @ $150 USD', 'w3-total-cache'), 'linux_config' => __('Linux Server Optimization & Plugin Configuration: Starting @ $200 USD', 'w3-total-cache')); $this->_config_admin = w3_instance('W3_ConfigAdmin'); add_action('admin_init', array(&$this, 'admin_init')); add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); add_action('admin_head', array(&$this, 'admin_head')); // Trigger a config cache refresh when adding 'home' add_action('add_option_home', array(&$this, 'refresh_config_cache')); // Trigger a config cache refresh when updating 'home' add_action('update_option_home', array(&$this, 'refresh_config_cache')); if (is_network_admin()) { add_action('network_admin_menu', array(&$this, 'admin_menu')); } else { add_action('admin_menu', array(&$this, 'admin_menu')); } add_filter('contextual_help_list', array(&$this, 'contextual_help_list')); add_filter('plugin_action_links_' . W3TC_FILE, array(&$this, 'plugin_action_links')); add_filter('favorite_actions', array(&$this, 'favorite_actions')); add_action('in_plugin_update_message-' . W3TC_FILE, array(&$this, 'in_plugin_update_message')); if ($this->_config->get_boolean('pgcache.enabled') || $this->_config->get_boolean('minify.enabled')) { add_filter('pre_update_option_active_plugins', array(&$this, 'pre_update_option_active_plugins')); } if ($this->_config->get_boolean('cdn.enabled') && w3_can_cdn_purge($this->_config->get_string('cdn.engine'))) { add_filter('media_row_actions', array(&$this, 'media_row_actions'), 0, 2); } if ($this->_config->get_boolean('pgcache.enabled') || $this->_config->get_boolean('varnish.enabled') || $this->_config->get_boolean('cdn.enabled') && $this->_config->get_boolean('cdncache.enabled')) { add_filter('post_row_actions', array(&$this, 'post_row_actions'), 0, 2); add_filter('page_row_actions', array(&$this, 'page_row_actions'), 0, 2); add_action('post_submitbox_start', array(&$this, 'post_submitbox_start')); } }
/** * Runs plugin * * @return void */ function run() { register_activation_hook(W3TC_FILE, array(&$this, 'activate')); register_deactivation_hook(W3TC_FILE, array(&$this, 'deactivate')); add_action('admin_init', array(&$this, 'admin_init')); add_action('admin_menu', array(&$this, 'admin_menu')); add_filter('contextual_help_list', array(&$this, 'contextual_help_list')); add_filter('plugin_action_links_' . W3TC_FILE, array(&$this, 'plugin_action_links')); add_filter('favorite_actions', array(&$this, 'favorite_actions')); add_action('in_plugin_update_message-' . W3TC_FILE, array(&$this, 'in_plugin_update_message')); if ($this->_config->get_boolean('widget.latest.enabled') || $this->_config->get_boolean('widget.pagespeed.enabled')) { add_action('nxt_dashboard_setup', array(&$this, 'nxt_dashboard_setup')); } if ($this->_config->get_boolean('pgcache.enabled') || $this->_config->get_boolean('minify.enabled')) { add_filter('pre_update_option_active_plugins', array(&$this, 'pre_update_option_active_plugins')); } if ($this->_config->get_boolean('cdn.enabled') && w3_can_cdn_purge($this->_config->get_string('cdn.engine'))) { add_filter('media_row_actions', array(&$this, 'media_row_actions'), 0, 2); } if ($this->_config->get_boolean('pgcache.enabled')) { add_filter('post_row_actions', array(&$this, 'post_row_actions'), 0, 2); add_filter('page_row_actions', array(&$this, 'page_row_actions'), 0, 2); } }
/** * Runs plugin * * @return void */ function run() { if (!$this->_config->own_config_exists()) { try { $this->update(); } catch (Exception $ex) { } } $this->_config_admin = w3_instance('W3_ConfigAdmin'); register_activation_hook(W3TC_FILE, array(&$this, 'activate')); register_deactivation_hook(W3TC_FILE, array(&$this, 'deactivate')); add_action('admin_init', array(&$this, 'admin_init')); add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); add_action('admin_head', array(&$this, 'admin_head')); // Trigger a config cache refresh when adding 'home' add_action('add_option_home', array(&$this, 'refresh_config_cache')); // Trigger a config cache refresh when updating 'home' add_action('update_option_home', array(&$this, 'refresh_config_cache')); if (is_network_admin()) { add_action('network_admin_menu', array(&$this, 'admin_menu')); } else { add_action('admin_menu', array(&$this, 'admin_menu')); } add_filter('contextual_help_list', array(&$this, 'contextual_help_list')); add_filter('plugin_action_links_' . W3TC_FILE, array(&$this, 'plugin_action_links')); add_filter('favorite_actions', array(&$this, 'favorite_actions')); add_action('in_plugin_update_message-' . W3TC_FILE, array(&$this, 'in_plugin_update_message')); if ($this->_config->get_boolean('pgcache.enabled') || $this->_config->get_boolean('minify.enabled')) { add_filter('pre_update_option_active_plugins', array(&$this, 'pre_update_option_active_plugins')); } if ($this->_config->get_boolean('cdn.enabled') && w3_can_cdn_purge($this->_config->get_string('cdn.engine'))) { add_filter('media_row_actions', array(&$this, 'media_row_actions'), 0, 2); } if ($this->_config->get_boolean('pgcache.enabled') || $this->_config->get_boolean('varnish.enabled') || $this->_config->get_boolean('cdn.enabled') && $this->_config->get_boolean('cdncache.enabled')) { add_filter('post_row_actions', array(&$this, 'post_row_actions'), 0, 2); add_filter('page_row_actions', array(&$this, 'page_row_actions'), 0, 2); add_action('post_submitbox_start', array(&$this, 'post_submitbox_start')); } }