public function admin_print_scripts_w3tc_general() { $state = Dispatcher::config_state(); if (!$state->get_boolean('minify.hide_minify_help') && !Util_Environment::is_w3tc_edge($this->_config) && !Util_Environment::is_w3tc_enterprise($this->_config)) { wp_enqueue_script('w3tc-minify-help', plugins_url('Minify_GeneralPage_View_ShowHelp.js', W3TC_FILE), array(), W3TC_VERSION); } }
<?php if (!Util_Environment::is_w3tc_pro($config)) { ?> <?php include W3TC_INC_OPTIONS_DIR . '/edd/buy.php'; } ?> <?php switch ($page) { case 'w3tc_general': $anchors = array(array('id' => 'general', 'text' => __('General', 'w3-total-cache')), array('id' => 'page_cache', 'text' => __('Page Cache', 'w3-total-cache')), array('id' => 'minify', 'text' => 'Minify'), array('id' => 'system_opcache', 'text' => __('Opcode Cache', 'w3-total-cache')), array('id' => 'database_cache', 'text' => __('Database Cache', 'w3-total-cache')), array('id' => 'object_cache', 'text' => __('Object Cache', 'w3-total-cache'))); if (Util_Environment::is_w3tc_pro($config)) { $anchors[] = array('id' => 'fragment_cache', 'text' => __('Fragment Cache', 'w3-total-cache')); } $anchors = array_merge($anchors, array(array('id' => 'browser_cache', 'text' => __('Browser Cache', 'w3-total-cache')), array('id' => 'cdn', 'text' => __('<abbr title="Content Delivery Network">CDN</abbr>', 'w3-total-cache')), array('id' => 'reverse_proxy', 'text' => __('Reverse Proxy', 'w3-total-cache')))); if (Util_Environment::is_w3tc_enterprise()) { $anchors[] = array('id' => 'amazon_sns', 'text' => __('Amazon <abbr title="Simple Notification Service">SNS</abbr>', 'w3-total-cache')); } $anchors[] = array('id' => 'monitoring', 'text' => __('Monitoring', 'w3-total-cache')); if ($licensing_visible) { array('id' => 'licensing', 'text' => __('Licensing', 'w3-total-cache')); } $link_attrs = array_merge($anchors, $custom_areas, array(array('id' => 'miscellaneous', 'text' => __('Miscellaneous', 'w3-total-cache')), array('id' => 'debug', 'text' => __('Debug', 'w3-total-cache')), array('id' => 'settings', 'text' => __('Import / Export Settings', 'w3-total-cache')))); $links = array(); foreach ($link_attrs as $link) { $links[] = "<a href=\"#{$link['id']}\">{$link['text']}</a>"; } $links[] = '<a href="#" class="button-self-test">Compatibility Test</a>'; ?> <p id="w3tc-options-menu"> <?php
function __construct() { $c = Dispatcher::config(); $plugins = array(); $plugins[] = new Generic_Plugin(); if ($c->get_boolean('dbcache.enabled')) { $plugins[] = new DbCache_Plugin(); } if ($c->get_boolean('objectcache.enabled')) { $plugins[] = new ObjectCache_Plugin(); } if ($c->get_boolean('pgcache.enabled')) { $plugins[] = new PgCache_Plugin(); } if ($c->get_boolean('cdn.enabled')) { $plugins[] = new Cdn_Plugin(); } if ($c->get_boolean('browsercache.enabled')) { $plugins[] = new BrowserCache_Plugin(); } if ($c->get_boolean('minify.enabled')) { $plugins[] = new Minify_Plugin(); } if ($c->get_boolean('varnish.enabled')) { $plugins[] = new Varnish_Plugin(); } if ($c->get_boolean('stats.enabled')) { $plugins[] = new UsageStatistics_Plugin(); } if (is_admin()) { $plugins[] = new Generic_Plugin_Admin(); $plugins[] = new BrowserCache_Plugin_Admin(); $plugins[] = new DbCache_Plugin_Admin(); $plugins[] = new ObjectCache_Plugin_Admin(); $plugins[] = new PgCache_Plugin_Admin(); $plugins[] = new Minify_Plugin_Admin(); $plugins[] = new Generic_Plugin_WidgetServices(); $plugins[] = new Generic_WidgetSpreadTheWord_Plugin(); $plugins[] = new Generic_Plugin_WidgetNews(); $plugins[] = new Generic_Plugin_WidgetForum(); $plugins[] = new SystemOpCache_Plugin_Admin(); $plugins[] = new Cdn_Plugin_Admin(); if ($c->get_string('cdn.engine') == 'highwinds') { } else { if ($c->get_string('cdn.engine') != 'netdna') { $plugins[] = new Cdn_Plugin_WidgetMaxCdn(); } else { $plugins[] = new Cdn_Plugin_WidgetNetDna(); } } if ($c->get_boolean('widget.pagespeed.enabled')) { $plugins[] = new PageSpeed_Plugin_Widget(); } $plugins[] = new Generic_Plugin_AdminCompatibility(); if (!(defined('W3TC_PRO') || Util_Environment::is_w3tc_enterprise())) { $plugins[] = new Licensing_Plugin_Admin(); } if ($c->get_boolean('pgcache.enabled') || $c->get_boolean('varnish.enabled')) { $plugins[] = new Generic_Plugin_AdminRowActions(); } $plugins[] = new Extensions_Plugin_Admin(); $plugins[] = new Generic_Plugin_AdminNotifications(); $plugins[] = new UsageStatistics_Plugin_Admin(); } $this->_loaded_plugins = $plugins; register_activation_hook(W3TC_FILE, array($this, 'activate')); register_deactivation_hook(W3TC_FILE, array($this, 'deactivate')); }
/** * Send support request action * * @return void */ function w3tc_support_send_details() { $c = Dispatcher::config(); $post = array(); foreach ($_GET as $p => $v) { $post[$p] = $v; } $post['user_agent'] = $_SERVER['HTTP_USER_AGENT']; $post['version'] = W3TC_VERSION; $license_level = 'community'; if (Util_Environment::is_w3tc_pro($c)) { $license_level = 'pro'; } elseif (Util_Environment::is_w3tc_enterprise($c)) { $license_level = 'enterprise'; } $post['license_level'] = $license_level . ' ' . $c->get_string('plugin.license_key'); /** * Add attachments */ $attachments = array(); $attach_files = array(Util_Environment::wp_config_path(), Util_Rule::get_pgcache_rules_core_path(), Util_Rule::get_pgcache_rules_cache_path(), Util_Rule::get_browsercache_rules_cache_path(), Util_Rule::get_browsercache_rules_no404wp_path(), Util_Rule::get_minify_rules_core_path(), Util_Rule::get_minify_rules_cache_path()); /** * Attach config files */ if ($handle = opendir(W3TC_CONFIG_DIR)) { while (($entry = @readdir($handle)) !== false) { if ($entry == '.' || $entry == '..' || $entry == 'index.html') { continue; } $attach_file[] = W3TC_CONFIG_DIR . '/' . $entry; } closedir($handle); } foreach ($attach_files as $attach_file) { if ($attach_file && file_exists($attach_file) && !in_array($attach_file, $attachments)) { $attachments[] = array('filename' => basename($attach_file), 'content' => file_get_contents($attach_file)); } } /** * Attach server info */ $server_info = print_r($this->get_server_info(), true); $server_info = str_replace("\n", "\r\n", $server_info); $attachments[] = array('filename' => 'server_info.txt', 'content' => $server_info); /** * Attach phpinfo */ ob_start(); phpinfo(); $php_info = ob_get_contents(); ob_end_clean(); $attachments[] = array('filename' => 'php_info.html', 'content' => $php_info); /** * Attach self-test */ ob_start(); $this->self_test(); $self_test = ob_get_contents(); ob_end_clean(); $attachments[] = array('filename' => 'self_test.html', 'content' => $self_test); $post['attachments'] = $attachments; $response = wp_remote_post(W3TC_SUPPORT_REQUEST_URL, array('body' => $post, 'timeout' => $c->get_integer('timelimit.email_send'))); if (!is_wp_error($response)) { $result = $response['response']['code'] == 200 && $response['body'] == 'ok'; } else { $result = false; } echo $result ? 'ok' : 'error'; }
/** * Save support us action * * @return void */ function w3tc_config_save_support_us() { $support = Util_Request::get_string('support'); $tweeted = Util_Request::get_boolean('tweeted'); $signmeup = Util_Request::get_boolean('signmeup'); $track_usage = Util_Request::get_boolean('track_usage'); $this->_config->set('common.support', $support); $this->_config->set('common.tweeted', $tweeted); if ($track_usage) { $this->_config->set('common.track_usage', true); } if ($signmeup) { if (Util_Environment::is_w3tc_enterprise($this->_config)) { $license = 'enterprise'; } elseif (Util_Environment::is_w3tc_pro($this->_config)) { $license = 'pro'; } else { $license = 'community'; } $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL); wp_remote_post(W3TC_MAILLINGLIST_SIGNUP_URL, array('body' => array('email' => $email, 'license' => $license))); } $this->_config->save(); Generic_AdminLinks::link_update($this->_config); Util_Admin::redirect(array('w3tc_note' => 'config_save')); }
/** * * * @param Config $config * @return bool */ public static function is_w3tc_pro($config = null) { $result = $config->get_string('plugin.type') == 'pro' || $config->get_string('plugin.type') == 'pro_dev' || Util_Environment::is_w3tc_enterprise($config) || defined('W3TC_PRO') && W3TC_PRO; return $result; }