/** * Dashboard tab */ function view() { w3_require_once(W3TC_INC_DIR . '/functions/widgets.php'); /** * @var $module_status W3_ModuleStatus */ $module_status = w3_instance('W3_ModuleStatus'); w3tc_dashboard_setup(); global $current_user; $config_master = $this->_config_master; $browsercache_enabled = $module_status->is_enabled('browsercache'); $cloudflare_enabled = $module_status->is_enabled('cloudflare'); $enabled = $module_status->plugin_is_enabled(); $can_empty_memcache = $module_status->can_empty_memcache(); $can_empty_opcode = $module_status->can_empty_opcode(); $can_empty_apc_system = $module_status->can_empty_apc_system(); $can_empty_file = $module_status->can_empty_file(); $can_empty_varnish = $module_status->can_empty_varnish(); $cdn_enabled = $module_status->is_enabled('cdn'); $cdn_mirror_purge = w3_cdn_can_purge_all($module_status->get_module_engine('cdn')); if ($cloudflare_enabled && $this->_config->get_string('cloudflare.email') && $this->_config->get_string('cloudflare.key')) { $can_empty_cloudflare = true; } else { $can_empty_cloudflare = false; } // Required for Update Media Query String button $browsercache_update_media_qs = $this->_config->get_boolean('browsercache.cssjs.replace') || $this->_config->get_boolean('browsercache.other.replace'); include W3TC_INC_DIR . '/options/dashboard.php'; }
/** * General tab * * @return void */ function view() { w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php'); global $current_user; $config_master = $this->_config_master; /** * @var $modules W3_ModuleStatus */ $modules = w3_instance('W3_ModuleStatus'); $pgcache_enabled = $modules->is_enabled('pgcache'); $dbcache_enabled = $modules->is_enabled('dbcache'); $objectcache_enabled = $modules->is_enabled('objectcache'); $browsercache_enabled = $modules->is_enabled('browsercache'); $minify_enabled = $modules->is_enabled('minify'); $cdn_enabled = $modules->is_enabled('cdn'); $varnish_enabled = $modules->is_enabled('varnish'); $fragmentcache_enabled = $modules->is_enabled('fragmentcache'); $enabled = $modules->plugin_is_enabled(); $enabled_checkbox = $modules->all_modules_enabled(); $check_rules = w3_can_check_rules(); $check_apc = function_exists('apc_store'); $check_eaccelerator = function_exists('eaccelerator_put'); $check_xcache = function_exists('xcache_set'); $check_wincache = function_exists('wincache_ucache_set'); $check_curl = function_exists('curl_init'); $check_memcached = class_exists('Memcache'); $check_ftp = function_exists('ftp_connect'); $check_tidy = class_exists('tidy'); $disc_enhanced_enabled = !(!$check_rules || !$this->is_master() && w3_is_network() && $config_master->get_string('pgcache.engine') != 'file_generic'); $can_empty_file = $modules->can_empty_file(); $can_empty_varnish = $modules->can_empty_varnish(); $cdn_mirror_purge = w3_cdn_can_purge_all($modules->get_module_engine('cdn')); $file_nfs = $this->_config->get_boolean('pgcache.file.nfs') || $this->_config->get_boolean('minify.file.nfs'); $file_locking = $this->_config->get_boolean('dbcache.file.locking') || $this->_config->get_boolean('objectcache.file.locking') || $this->_config->get_boolean('pgcache.file.locking') || $this->_config->get_boolean('minify.file.locking'); w3_require_once(W3TC_LIB_NEWRELIC_DIR . '/NewRelicWrapper.php'); $newrelic_conf_appname = NewRelicWrapper::get_wordpress_appname($this->_config, $this->_config_master, false); $newrelic_applications = array(); $nerser = w3_instance('W3_NewRelicService'); $new_relic_installed = $nerser->module_is_enabled(); $new_relic_running = true; if ($this->_config->get_boolean('newrelic.enabled')) { $new_relic_configured = $this->_config->get_string('newrelic.api_key') && $this->_config->get_string('newrelic.account_id'); $newrelic_prefix = ''; if ($new_relic_configured) { if (w3_is_network()) { $newrelic_prefix = $this->_config->get_string('newrelic.appname_prefix'); } try { $newrelic_applications = $nerser->get_applications(); } catch (Exception $ex) { } $newrelic_application = $this->_config->get_string('newrelic.application_id'); } } $licensing_visible = (!w3_is_multisite() || is_network_admin()) && !ini_get('w3tc.license_key') && get_transient('w3tc_license_status') != 'host_valid'; $custom_areas = apply_filters("{$this->_page}_anchors", array()); include W3TC_INC_DIR . '/options/general.php'; }
/** * CDN tab * * @return void */ function view() { w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php'); $cdn_enabled = $this->_config->get_boolean('cdn.enabled'); $cdn_engine = $this->_config->get_string('cdn.engine'); $cdn_mirror = w3_is_cdn_mirror($cdn_engine); $cdn_mirror_purge_all = w3_cdn_can_purge_all($cdn_engine); $cdn_common = w3_instance('W3_Plugin_CdnCommon'); $cdn = $cdn_common->get_cdn(); $cdn_supports_header = $cdn->headers_support() == W3TC_CDN_HEADER_MIRRORING; $cdn_supports_full_page_mirroring = $cdn->supports_full_page_mirroring(); $minify_enabled = $this->_config->get_boolean('minify.enabled') && $this->_config->get_boolean('minify.rewrite') && (!$this->_config->get_boolean('minify.auto') || w3_is_cdn_mirror($this->_config->get_string('cdn.engine'))); $cookie_domain = $this->get_cookie_domain(); $set_cookie_domain = $this->is_cookie_domain_enabled(); // Required for Update Media Query String button $browsercache_enabled = $this->_config->get_boolean('browsercache.enabled'); $browsercache_update_media_qs = $this->_config->get_boolean('browsercache.cssjs.replace') || $this->_config->get_boolean('browsercache.other.replace'); if (in_array($cdn_engine, array('netdna', 'maxcdn'))) { $pull_zones = array(); $authorization_key = $this->_config->get_string("cdn.{$cdn_engine}.authorization_key"); $zone_id = $this->_config->get_integer("cdn.{$cdn_engine}.zone_id"); $alias = $consumerkey = $consumersecret = ''; if ($authorization_key) { $keys = explode('+', $authorization_key); if (sizeof($keys) == 3) { list($alias, $consumerkey, $consumersecret) = $keys; } } $authorized = $authorization_key != '' && $alias && $consumerkey && $consumersecret; $have_zone = $zone_id != 0; if ($authorized) { w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNA.php'); try { $api = new NetDNA($alias, $consumerkey, $consumersecret); $pull_zones = $api->get_zones_by_url(w3_get_home_url()); } catch (Exception $ex) { w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php'); w3_e_error_box('<p>There is an error with your CDN settings: ' . $ex->getMessage() . '</p>'); } } } include W3TC_INC_DIR . '/options/cdn.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); } } }
/** * General tab * * @return void */ function view() { global $current_user; $config_master = $this->_config_master; /** * @var $modules W3_ModuleStatus */ $modules = w3_instance('W3_ModuleStatus'); $pgcache_enabled = $modules->is_enabled('pgcache'); $dbcache_enabled = $modules->is_enabled('dbcache'); $objectcache_enabled = $modules->is_enabled('objectcache'); $browsercache_enabled = $modules->is_enabled('browsercache'); $minify_enabled = $modules->is_enabled('minify'); $cdn_enabled = $modules->is_enabled('cdn'); $cloudflare_enabled = $modules->is_enabled('cloudflare'); $varnish_enabled = $modules->is_enabled('varnish'); $fragmentcache_enabled = $modules->is_enabled('fragmentcache'); $enabled = $modules->plugin_is_enabled(); $enabled_checkbox = $modules->all_modules_enabled(); $check_rules = w3_can_check_rules(); $check_apc = function_exists('apc_store'); $check_eaccelerator = function_exists('eaccelerator_put'); $check_xcache = function_exists('xcache_set'); $check_wincache = function_exists('wincache_ucache_set'); $check_curl = function_exists('curl_init'); $check_memcached = class_exists('Memcache'); $check_ftp = function_exists('ftp_connect'); $check_tidy = class_exists('tidy'); $disc_enhanced_enabled = !(!$check_rules || !$this->is_master() && w3_is_network() && $config_master->get_string('pgcache.engine') != 'file_generic'); $can_empty_file = $modules->can_empty_file(); $can_empty_varnish = $modules->can_empty_varnish(); $cdn_mirror_purge = w3_cdn_can_purge_all($modules->get_module_engine('cdn')); $cloudflare_signup_email = ''; $cloudflare_signup_user = ''; if (is_a($current_user, 'WP_User')) { if ($current_user->user_email) { $cloudflare_signup_email = $current_user->user_email; } if ($current_user->user_login && $current_user->user_login != 'admin') { $cloudflare_signup_user = $current_user->user_login; } } /** * @var $w3_cloudflare W3_CloudFlare */ $w3_cloudflare = w3_instance('W3_CloudFlare'); $cf_options = $w3_cloudflare->get_options(); $cloudflare_seclvls = $cf_options['sec_lvl']; $cloudflare_devmodes = $cf_options['dev_mode']; $cloudflare_rocket_loaders = $cf_options['async']; $cloudflare_minifications = $cf_options['minify']; $cloudflare_seclvl = 'med'; $cloudflare_devmode_expire = 0; $cloudflare_devmode = 0; $cloudflare_rocket_loader = 0; $cloudflare_minify = 0; if ($cloudflare_enabled && $this->_config->get_string('cloudflare.email') && $this->_config->get_string('cloudflare.key')) { $settings = $w3_cloudflare->get_settings(); $cloudflare_seclvl = $settings['sec_lvl']; $cloudflare_devmode_expire = $settings['devmode']; $cloudflare_rocket_loader = $settings['async']; $cloudflare_devmode = $cloudflare_devmode_expire ? 1 : 0; $cloudflare_minify = $settings['minify']; $can_empty_cloudflare = true; } else { $can_empty_cloudflare = false; } $file_nfs = $this->_config->get_boolean('pgcache.file.nfs') || $this->_config->get_boolean('minify.file.nfs'); $file_locking = $this->_config->get_boolean('dbcache.file.locking') || $this->_config->get_boolean('objectcache.file.locking') || $this->_config->get_boolean('pgcache.file.locking') || $this->_config->get_boolean('minify.file.locking'); w3_require_once(W3TC_LIB_NEWRELIC_DIR . '/NewRelicWrapper.php'); $newrelic_conf_appname = NewRelicWrapper::get_wordpress_appname($this->_config, $this->_config_master, false); $newrelic_applications = array(); $nerser = w3_instance('W3_NewRelicService'); $new_relic_installed = $nerser->module_is_enabled(); $new_relic_running = true; if ($this->_config->get_boolean('newrelic.enabled')) { $new_relic_configured = $this->_config->get_string('newrelic.api_key') && $this->_config->get_string('newrelic.account_id'); $newrelic_prefix = ''; if ($new_relic_configured) { if (w3_is_network()) { $newrelic_prefix = $this->_config->get_string('newrelic.appname_prefix'); } try { $newrelic_applications = $nerser->get_applications(); } catch (Exception $ex) { } $newrelic_application = $this->_config->get_string('newrelic.application_id'); } } $licensing_visible = (!w3_is_multisite() || is_network_admin()) && !ini_get('w3tc.license_key') && get_transient('w3tc_license_status') != 'host_valid'; include W3TC_INC_DIR . '/options/general.php'; }
/** * CDN tab * * @return void */ function options_cdn() { $cdn_enabled = $this->_config->get_boolean('cdn.enabled'); $cdn_engine = $this->_config->get_string('cdn.engine'); $cdn_mirror = w3_is_cdn_mirror($cdn_engine); $cdn_mirror_purge_all = w3_cdn_can_purge_all($this->_config->get_string('cdn.engine')); $cdn_common = w3_instance('W3_Plugin_CdnCommon'); $cdn = $cdn_common->get_cdn(); $cdn_supports_header = $cdn->headers_support() == W3TC_CDN_HEADER_MIRRORING; $cdn_supports_full_page_mirroring = $cdn->supports_full_page_mirroring(); $minify_enabled = W3TC_PHP5 && $this->_config->get_boolean('minify.enabled') && $this->_config->get_boolean('minify.rewrite') && (!$this->_config->get_boolean('minify.auto') || w3_is_cdn_mirror($this->_config->get_string('cdn.engine'))); $cookie_domain = $this->get_cookie_domain(); $set_cookie_domain = $this->is_cookie_domain_enabled(); // Required for Update Media Query String button $browsercache_enabled = $this->_config->get_boolean('browsercache.enabled'); $browsercache_update_media_qs = $this->_config->get_boolean('browsercache.cssjs.replace') || $this->_config->get_boolean('browsercache.other.replace'); include W3TC_INC_DIR . '/options/cdn.php'; }