function __construct() { $this->_config = w3_instance('W3_Config'); $this->_plugins = array(array('class_name' => 'W3_Plugin_TotalCache', 'enable_options' => null), array('class_name' => 'W3_Plugin_DbCache', 'enable_options' => 'dbcache.enabled'), array('class_name' => 'W3_Plugin_ObjectCache', 'enable_options' => 'objectcache.enabled'), array('class_name' => 'W3_Pro_Plugin_FragmentCache', 'enable_options' => 'fragmentcache.enabled'), array('class_name' => 'W3_Plugin_PgCache', 'enable_options' => 'pgcache.enabled'), array('class_name' => 'W3_Plugin_Cdn', 'enable_options' => 'cdn.enabled'), array('class_name' => 'W3_Plugin_BrowserCache', 'enable_options' => 'browsercache.enabled'), array('class_name' => 'W3_Plugin_Minify', 'enable_options' => 'minify.enabled'), array('class_name' => 'W3_Plugin_Varnish', 'enable_options' => 'varnish.enabled'), array('class_name' => 'W3_Plugin_NewRelic', 'enable_options' => 'newrelic.enabled')); if (w3tc_edge_mode() && (w3_is_pro($this->_config) || w3_is_enterprise()) && w3tc_cdn_supports_realtime_purge($this->_config->get_string('cdn.engine'))) { $this->_plugins[] = array('class_name' => 'W3_Plugin_CdnCache', 'enable_options' => array('cdn.enabled', 'cdncache.enabled')); } if (is_admin()) { $this->_plugins[] = array('class_name' => 'W3_Plugin_TotalCacheAdmin', 'enable_options' => null); $this->_plugins[] = array('class_name' => 'W3_Plugin_PgCacheAdmin', 'enable_options' => 'pgcache.enabled'); $this->_plugins[] = array('class_name' => 'W3_Plugin_MinifyAdmin', 'enable_options' => array('minify.enabled', 'minify.auto')); $this->_plugins[] = array('class_name' => 'W3_Plugin_NewRelicAdmin', 'enable_options' => null); $this->_plugins[] = array('class_name' => 'W3_Widget_Services', 'enable_options' => null); $this->_plugins[] = array('class_name' => 'W3_Widget_SpreadTheWord', 'enable_options' => null); $this->_plugins[] = array('class_name' => 'W3_Widget_News', 'enable_options' => null); $this->_plugins[] = array('class_name' => 'W3_Widget_Forum', 'enable_options' => null); $this->_plugins[] = array('class_name' => 'W3_Widget_MaxCDN', 'enable_options' => array(array('cdn.engine', '==', 'maxcdn'), '||', array('cdn.engine', '!=', 'netdna'))); $this->_plugins[] = array('class_name' => 'W3_Widget_NetDNA', 'enable_options' => array(array('cdn.engine', '==', 'netdna'))); $this->_plugins[] = array('class_name' => 'W3_Widget_NewRelic', 'enable_options' => null); $this->_plugins[] = array('class_name' => 'W3_Widget_PageSpeed', 'enable_options' => 'widget.pagespeed.enabled'); $this->_plugins[] = array('class_name' => 'W3_AdminCompatibility', 'enable_options' => null); if (!(defined('W3TC_PRO') || w3_is_enterprise())) { $this->_plugins[] = array('class_name' => 'W3_Licensing', 'enable_options' => null); } $this->_plugins[] = array('class_name' => 'W3_Plugin_DefaultSettings', 'enable_options' => null); $this->_plugins[] = array('class_name' => 'W3_GeneralActions', 'enable_options' => array('pgcache.enabled', '||', 'varnish.enabled', '||', array('cdn.enabled', 'cdncache.enabled'))); $this->_plugins[] = array('class_name' => 'W3_Plugin_ExtensionsAdmin', 'enable_options' => null); $this->_plugins[] = array('class_name' => 'W3_Plugin_NotificationsAdmin', 'enable_options' => null); } $this->_load_plugins(); register_activation_hook(W3TC_FILE, array(&$this, 'activate')); register_deactivation_hook(W3TC_FILE, array(&$this, 'deactivate')); }
/** * Edge Mode popup notification */ public function edge_nag() { $edge_reminder = $this->_config_admin->get_integer('evaluation.reminder') != 0 && $this->_config_admin->get_integer('evaluation.reminder') < time() && !w3tc_edge_mode(); if ($edge_reminder || w3tc_show_notification('edge_mode_popup')) { ?> <script type="text/javascript">/*<![CDATA[*/ jQuery(function() { w3tc_lightbox_use_edge_mode('<?php echo wp_create_nonce('w3tc'); ?> '); }); /*]]>*/</script> <?php $delay = get_option('w3tc_edge_remainder_period'); if ($delay <= 7 * 24 * 60 * 60) { $delay = 30 * 24 * 60 * 60; } else { if ($delay <= 30 * 24 * 60 * 60) { $delay = 60 * 24 * 60 * 60; } else { $delay = 90 * 24 * 60 * 60; } } update_option('w3tc_edge_remainder_period', $delay); try { $this->_config_admin->set('evaluation.reminder', time() + $delay); $this->_config_admin->save(); } catch (Exception $ex) { } } }
public function admin_init() { if (w3tc_show_extension_notification('wordpress-seo', $this->criteria_match())) { add_action('admin_notices', array($this, 'admin_notices')); } $config = w3_instance('W3_Config'); $groups = $config->get_array('mobile.rgroups'); if (w3tc_edge_mode() && isset($groups['google']) && sizeof($groups['google']['agents']) == 1 && $groups['google']['agents'][0] == 'googlebot') { w3tc_delete_user_agent_group('google'); } }
/** * Page cache tab * * @return void */ function view() { global $wp_rewrite; $feeds = $wp_rewrite->feeds; $feed_key = array_search('feed', $feeds); if ($feed_key !== false) { unset($feeds[$feed_key]); } $default_feed = get_default_feed(); $pgcache_enabled = $this->_config->get_boolean('pgcache.enabled'); $permalink_structure = get_option('permalink_structure'); $varnish_enabled = $this->_config->get_boolean('varnish.enabled'); $cdn_mirror_purge_enabled = w3_is_cdn_mirror($this->_config->get_string('cdn.engine')) && $this->_config->get_string('cdn.engine') != 'mirror' && $this->_config->get_boolean('cdncache.enabled') && w3tc_edge_mode() && w3_is_pro($this->_config) || w3_is_enterprise(); $disable_check_domain = w3_is_multisite() && w3_force_master(); include W3TC_INC_DIR . '/options/pgcache.php'; }
_e('Optimize disk enhanced page and minify disk caching for <acronym title="Network File System">NFS</acronym>', 'w3-total-cache'); ?> </label> <br /><span class="description"><?php _e('Try this option if your hosting environment uses a network based file system for a possible performance improvement.', 'w3-total-cache'); ?> </span> </th> </tr> <?php if (is_network_admin() || !w3_is_multisite()) { ?> <tr id="edge_mode"> <th colspan="2"> <?php if (!w3tc_edge_mode()) { echo '<a href="' . w3_admin_url('admin.php?page=' . $this->_page . '&w3tc_edge_mode_enable') . '"><strong>' . __('Enable Edge mode', 'w3-total-cache') . '</strong></a>'; } else { echo '<a href="' . w3_admin_url('admin.php?page=' . $this->_page . '&w3tc_edge_mode_disable') . '"><strong>' . __('Disable Edge mode', 'w3-total-cache') . '</strong></a>'; } ?> <br /><span class="description"><?php _e('Enable this to try out new functionality under development. Might cause issues on some sites. If you have issues and can\'t access wp-admin, remove "define(\'W3TC_EDGE_MODE\', true);" from your wp-config.php file and edge mode features will be disabled.', 'w3-total-cache'); ?> </span> </th> </tr> <?php } ?> </table>
<?php if (!defined('W3TC')) { die; } include W3TC_INC_DIR . '/options/common/header.php'; ?> <p> <?php echo sprintf(__('The plugin is currently <span class="w3tc-%s">%s</span> in <strong>%s%s</strong> mode.', 'w3-total-cache'), $enabled ? "enabled" : "disabled", $enabled ? __('enabled', 'w3-total-cache') : __('disabled', 'w3-total-cache'), w3_w3tc_release_version($this->_config), w3tc_edge_mode() ? __(' edge', 'w3-total-cache') : ''); ?> </p> <form id="w3tc_dashboard" action="admin.php?page=<?php echo $this->_page; ?> " method="post"> <p> Perform a <input type="button" class="button button-self-test {nonce: '<?php echo wp_create_nonce('w3tc'); ?> '}" value="<?php _e('compatibility check', 'w3-total-cache'); ?> " />, <?php echo $this->nonce_field('w3tc'); ?> <input id="flush_all" class="button" type="submit" name="w3tc_flush_all" value="<?php _e('empty all caches', 'w3-total-cache');
<th colspan="2"> <?php $this->checkbox('cdn.import.external'); ?> <?php w3_e_config_label('cdn.import.external'); ?> </label><br /> <span class="description"><?php _e('Download attachments hosted elsewhere into your media library and deliver them via <acronym title="Content Delivery Network">CDN</acronym>.', 'w3-total-cache'); ?> </span> </th> </tr> <?php if (w3tc_edge_mode() && w3_is_pro($this->_config) || w3_is_enterprise()) { ?> <tr> <th colspan="2"> <?php $this->checkbox('cdncache.enabled', !$cdn_supports_full_page_mirroring); ?> <?php w3_e_config_label('cdncache.enabled'); ?> </label><br/> <span class="description"> <?php echo sprintf(__('Enabling this option allows the <acronym title="Content Delivery Network">CDN</acronym> to handle requests for unauthenticated pages thereby reducing the traffic load on the origin server(s). Purge policies are set on the <a href="%s">Page Cache settings</a> tab.', 'w3-total-cache'), network_admin_url('admin.php?page=w3tc_pgcache#purge_policy')); ?> </span>