/** * Returns debug info * * @param string $page_key * @param boolean $cache * @param string $reason * @param boolean $status * @param double $time * @return string */ function _get_debug_info($page_key, $cache, $reason, $status, $time) { $debug_info = "<!-- W3 Total Cache: Page cache debug info:\r\n"; $debug_info .= sprintf("%s%s\r\n", str_pad('Engine: ', 20), w3_get_engine_name($this->_config->get_string('pgcache.engine'))); $debug_info .= sprintf("%s%s\r\n", str_pad('Key: ', 20), $page_key); $debug_info .= sprintf("%s%s\r\n", str_pad('Caching: ', 20), $cache ? 'enabled' : 'disabled'); if (!$cache) { $debug_info .= sprintf("%s%s\r\n", str_pad('Reject reason: ', 20), $reason); } $debug_info .= sprintf("%s%s\r\n", str_pad('Status: ', 20), $status ? 'cached' : 'not cached'); $debug_info .= sprintf("%s%.3fs\r\n", str_pad('Creation Time: ', 20), $time); $headers = $this->_get_response_headers(); if (count($headers)) { $debug_info .= "Header info:\r\n"; foreach ($headers as $header_name => $header_value) { $debug_info .= sprintf("%s%s\r\n", str_pad($header_name . ': ', 20), $header_value); } } $debug_info .= '-->'; return $debug_info; }
<?php if (!defined('W3TC')) { die; } include W3TC_INC_DIR . '/options/common/header.php'; ?> <form action="admin.php?page=<?php echo $this->_page; ?> " method="post"> <p> Object caching via <strong><?php echo w3_get_engine_name($this->_config->get_string('objectcache.engine')); ?> </strong> is currently <span class="w3tc-<?php if ($objectcache_enabled) { ?> enabled">enabled<?php } else { ?> disabled">disabled<?php } ?> </span>. </p> <p> To rebuild the object cache use the
/** * Returns debug info * * @return string */ function _get_debug_info() { $debug_info = "<!-- W3 Total Cache: Db cache debug info:\r\n"; $debug_info .= sprintf("%s%s\r\n", str_pad('Engine: ', 20), w3_get_engine_name($this->_config->get_string('dbcache.engine'))); $debug_info .= sprintf("%s%d\r\n", str_pad('Total queries: ', 20), $this->query_total); $debug_info .= sprintf("%s%d\r\n", str_pad('Cached queries: ', 20), $this->query_hits); $debug_info .= sprintf("%s%.4f\r\n", str_pad('Total query time: ', 20), $this->time_total); if (count($this->query_stats)) { $debug_info .= "SQL info:\r\n"; $debug_info .= sprintf("%s | %s | %s | % s | %s | %s\r\n", str_pad('#', 5, ' ', STR_PAD_LEFT), str_pad('Time (s)', 8, ' ', STR_PAD_LEFT), str_pad('Caching (Reject reason)', 30, ' ', STR_PAD_BOTH), str_pad('Status', 10, ' ', STR_PAD_BOTH), str_pad('Data size (b)', 13, ' ', STR_PAD_LEFT), 'Query'); foreach ($this->query_stats as $index => $query) { $debug_info .= sprintf("%s | %s | %s | %s | %s | %s\r\n", str_pad($index + 1, 5, ' ', STR_PAD_LEFT), str_pad(round($query['time_total'], 4), 8, ' ', STR_PAD_LEFT), str_pad($query['caching'] ? 'enabled' : sprintf('disabled (%s)', $query['reason']), 30, ' ', STR_PAD_BOTH), str_pad($query['cached'] ? 'cached' : 'not cached', 10, ' ', STR_PAD_BOTH), str_pad($query['data_size'], 13, ' ', STR_PAD_LEFT), w3_escape_comment(trim($query['query']))); } } $debug_info .= '-->'; return $debug_info; }
/** * Output buffering callback * * @param string $buffer * @return string */ function ob_callback($buffer) { global $wpdb; if ($buffer != '') { if (w3_is_database_error($buffer)) { status_header(503); } else { if (w3_can_print_comment($buffer)) { /** * Add footer comment */ $date = date_i18n('Y-m-d H:i:s'); $host = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'; if (w3_is_preview_mode()) { $buffer .= "\r\n<!-- W3 Total Cache used in preview mode -->"; } if ($this->_config->get_string('common.support') != '' || $this->_config->get_boolean('common.tweeted')) { $buffer .= sprintf("\r\n<!-- Served from: %s @ %s by W3 Total Cache -->", w3_escape_comment($host), $date); } else { $strings = array(); if ($this->_config->get_boolean('minify.enabled') && !$this->_config->get_boolean('minify.debug')) { $w3_plugin_minify = w3_instance('W3_Plugin_Minify'); $strings[] = sprintf(__('Minified using %s%s', 'w3-total-cache'), w3_get_engine_name($this->_config->get_string('minify.engine')), $w3_plugin_minify->minify_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_minify->minify_reject_reason) : ''); } if ($this->_config->get_boolean('pgcache.enabled') && !$this->_config->get_boolean('pgcache.debug')) { $w3_pgcache = w3_instance('W3_PgCache'); $strings[] = sprintf(__('Page Caching using %s%s', 'w3-total-cache'), w3_get_engine_name($this->_config->get_string('pgcache.engine')), $w3_pgcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_pgcache->cache_reject_reason) : ''); } if ($this->_config->get_boolean('dbcache.enabled') && !$this->_config->get_boolean('dbcache.debug')) { /** * @var W3_DbCache $db */ $db = w3_instance('W3_DbCache'); $append = ($reason = $db->get_reject_reason()) ? sprintf(' (%s)', $reason) : ''; if ($db->query_hits) { $strings[] = sprintf(__('Database Caching %d/%d queries in %.3f seconds using %s%s', 'w3-total-cache'), $db->query_hits, $db->query_total, $db->time_total, w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append); } else { $strings[] = sprintf(__('Database Caching using %s%s', 'w3-total-cache'), w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append); } } if (w3_is_dbcluster()) { $db_cluster = w3_instance('W3_Enterprise_DbCluster'); $strings[] = $db_cluster->status_message(); } if ($this->_config->get_boolean('objectcache.enabled') && !$this->_config->get_boolean('objectcache.debug')) { /** * @var W3_ObjectCache $w3_objectcache */ $w3_objectcache = w3_instance('W3_ObjectCache'); $append = ($reason = $w3_objectcache->get_reject_reason()) ? sprintf(' (%s)', $reason) : ''; $strings[] = sprintf(__('Object Caching %d/%d objects using %s%s', 'w3-total-cache'), $w3_objectcache->cache_hits, $w3_objectcache->cache_total, w3_get_engine_name($this->_config->get_string('objectcache.engine')), $append); } if (w3_is_pro($this->_config) || w3_is_enterprise($this->_config)) { if ($this->_config->get_boolean('fragmentcache.enabled') && !$this->_config->get_boolean('fragmentcache.debug')) { $w3_fragmentcache = w3_instance('W3_Pro_FragmentCache'); $append = $w3_fragmentcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_fragmentcache->cache_reject_reason) : ''; $strings[] = sprintf(__('Fragment Caching %d/%d fragments using %s%s', 'w3-total-cache'), $w3_fragmentcache->cache_hits, $w3_fragmentcache->cache_total, w3_get_engine_name($this->_config->get_string('fragmentcache.engine')), $append); } } if ($this->_config->get_boolean('cdn.enabled') && !$this->_config->get_boolean('cdn.debug')) { $w3_plugin_cdn = w3_instance('W3_Plugin_Cdn'); $w3_plugin_cdncommon = w3_instance('W3_Plugin_CdnCommon'); $cdn = $w3_plugin_cdncommon->get_cdn(); $via = $cdn->get_via(); $strings[] = sprintf(__('Content Delivery Network via %s%s', 'w3-total-cache'), $via ? $via : 'N/A', $w3_plugin_cdn->cdn_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_cdn->cdn_reject_reason) : ''); } if ($this->_config->get_boolean('newrelic.enabled')) { $w3_newrelic = w3_instance('W3_Plugin_NewRelic'); $append = $w3_newrelic->newrelic_reject_reason != '' ? sprintf(' (%s)', $w3_newrelic->newrelic_reject_reason) : ''; $strings[] = sprintf(__("Application Monitoring using New Relic%s", 'w3-total-cache'), $append); } $buffer .= "\r\n<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/\r\n"; if (count($strings)) { $buffer .= "\r\n" . implode("\r\n", $strings) . "\r\n"; } $buffer .= sprintf("\r\n Served from: %s @ %s by W3 Total Cache -->", w3_escape_comment($host), $date); } if ($this->is_debugging()) { if ($this->_config->get_boolean('dbcache.enabled') && $this->_config->get_boolean('dbcache.debug')) { $db = w3_instance('W3_DbCache'); $buffer .= "\r\n\r\n" . $db->_get_debug_info(); } if ($this->_config->get_boolean('objectcache.enabled') && $this->_config->get_boolean('objectcache.debug')) { $w3_objectcache = w3_instance('W3_ObjectCache'); $buffer .= "\r\n\r\n" . $w3_objectcache->_get_debug_info(); } if (w3_is_pro($this->_config) || w3_is_enterprise($this->_config)) { if ($this->_config->get_boolean('fragmentcache.enabled') && $this->_config->get_boolean('fragmentcache.debug')) { $w3_fragmentcache = w3_instance('W3_Pro_FragmentCache'); $buffer .= "\r\n\r\n" . $w3_fragmentcache->_get_debug_info(); } } } } $buffer = w3tc_do_ob_callbacks(array('minify', 'newrelic', 'cdn', 'browsercache', 'pagecache'), $buffer); } } return $buffer; }
<?php if (!defined('W3TC')) { die; } include W3TC_INC_DIR . '/options/common/header.php'; ?> <p> Content Delivery Network support via <strong><?php echo w3_get_engine_name($this->_config->get_string('cdn.engine')); ?> </strong> is currently <span class="w3tc-<?php if ($cdn_enabled) { ?> enabled">enabled<?php } else { ?> disabled">disabled<?php } ?> </span>. </p> <?php if ($cdn_mirror) { ?> <p> Maximize <acronym title="Content Delivery Network">CDN</acronym> usage by <input id="cdn_rename_domain" class="button {nonce: '<?php
/** * Output buffering callback * * @param string $buffer * @return string */ function ob_callback($buffer) { global $wpdb; if ($buffer != '' && w3_is_xml($buffer)) { $date = date('Y-m-d H:i:s'); $host = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'; if ($this->is_supported()) { $buffer .= sprintf("\r\n<!-- Served from: %s @ %s by W3 Total Cache -->", $host, $date); } else { $buffer .= "\r\n<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/\r\n\r\n"; if ($this->_config->get_boolean('minify.enabled')) { require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php'; $w3_plugin_minify =& W3_Plugin_Minify::instance(); $buffer .= sprintf("Minified using %s%s\r\n", w3_get_engine_name($this->_config->get_string('minify.engine')), $w3_plugin_minify->minify_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_minify->minify_reject_reason) : ''); } if ($this->_config->get_boolean('pgcache.enabled')) { require_once W3TC_LIB_W3_DIR . '/PgCache.php'; $w3_pgcache =& W3_PgCache::instance(); $buffer .= sprintf("Page Caching using %s%s\r\n", w3_get_engine_name($this->_config->get_string('pgcache.engine')), $w3_pgcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_pgcache->cache_reject_reason) : ''); } if ($this->_config->get_boolean('dbcache.enabled') && is_a($wpdb, 'W3_Db')) { $append = is_user_logged_in() ? ' (user is logged in)' : ''; if ($wpdb->query_hits) { $buffer .= sprintf("Database Caching %d/%d queries in %.3f seconds using %s%s\r\n", $wpdb->query_hits, $wpdb->query_total, $wpdb->time_total, w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append); } else { $buffer .= sprintf("Database Caching using %s%s\r\n", w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append); } } if ($this->_config->get_boolean('cdn.enabled')) { require_once W3TC_LIB_W3_DIR . '/Plugin/Cdn.php'; $w3_plugin_cdn =& W3_Plugin_Cdn::instance(); $cdn =& $w3_plugin_cdn->get_cdn(); $via = $cdn->get_via(); $buffer .= sprintf("Content Delivery Network via %s%s\r\n", $via ? $via : 'N/A', $w3_plugin_cdn->cdn_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_cdn->cdn_reject_reason) : ''); } $buffer .= sprintf("\r\nServed from: %s @ %s -->", $host, $date); } } return $buffer; }
/** * Returns debug info * * @return string */ function _get_debug_info() { $debug_info = "<!-- W3 Total Cache: Fragment Cache debug info:\r\n"; $debug_info .= sprintf("%s%s\r\n", str_pad('Engine: ', 20), w3_get_engine_name($this->_config->get_string('fragmentcache.engine'))); $debug_info .= sprintf("%s%s\r\n", str_pad('Caching: ', 20), $this->_caching ? 'enabled' : 'disabled'); if (!$this->_caching) { $debug_info .= sprintf("%s%s\r\n", str_pad('Reject reason: ', 20), $this->cache_reject_reason); } $debug_info .= sprintf("%s%d\r\n", str_pad('Total calls: ', 20), $this->cache_total); $debug_info .= sprintf("%s%d\r\n", str_pad('Cache hits: ', 20), $this->cache_hits); $debug_info .= sprintf("%s%d\r\n", str_pad('Cache misses: ', 20), $this->cache_misses); $debug_info .= sprintf("%s%.4f\r\n", str_pad('Total time: ', 20), $this->time_total); $debug_info .= "W3TC Fragment Cache info:\r\n"; $debug_info .= sprintf("%s | %s | %s | %s | %s | %s| %s| %s\r\n", str_pad('#', 5, ' ', STR_PAD_LEFT), str_pad('Status', 15, ' ', STR_PAD_BOTH), str_pad('Source', 15, ' ', STR_PAD_BOTH), str_pad('Data size (b)', 13, ' ', STR_PAD_LEFT), str_pad('Query time (s)', 14, ' ', STR_PAD_LEFT), str_pad('Group', 14, ' ', STR_PAD_LEFT), str_pad('Accessible', 10, ' ', STR_PAD_LEFT), 'Transient ID'); foreach ($this->debug_info as $index => $debug) { list($fragment_group, $fragment_group_expiration) = $this->_fragment_group($debug['id']); $debug_info .= sprintf("%s | %s | %s | %s | %s | %s| %s| %s\r\n", str_pad($index + 1, 5, ' ', STR_PAD_LEFT), str_pad($debug['cached'] ? 'cached' : 'not cached', 15, ' ', STR_PAD_BOTH), str_pad($debug['internal'] ? 'internal' : 'persistent', 15, ' ', STR_PAD_BOTH), str_pad($debug['data_size'], 13, ' ', STR_PAD_LEFT), str_pad(round($debug['time'], 4), 14, ' ', STR_PAD_LEFT), str_pad($fragment_group, 14, ' ', STR_PAD_LEFT), str_pad($debug['group'] == 'transient' ? 'site' : 'network', 10, ' ', STR_PAD_LEFT), $debug['id']); } $debug_info .= '-->'; return $debug_info; }
<?php if (!defined('W3TC')) { die; } include W3TC_INC_DIR . '/options/common/header.php'; ?> <form action="admin.php?page=<?php echo $this->_page; ?> " method="post"> <p> <?php echo sprintf(__('Object caching via %1$s is currently %2$s', 'w3-total-cache'), '<strong>' . w3_get_engine_name($this->_config->get_string('objectcache.engine')) . '</strong>', '<span class="w3tc-' . ($objectcache_enabled ? 'enabled">' . __('enabled', 'w3-total-cache') : 'disabled">' . __('disabled', 'w3-total-cache')) . '</span>'); ?> </p> <p> To rebuild the object cache use the <?php echo $this->nonce_field('w3tc'); ?> <input type="submit" name="w3tc_flush_objectcache" value="<?php _e('empty cache', 'w3-total-cache'); ?> "<?php if (!$objectcache_enabled) { ?> disabled="disabled"<?php } ?>
<?php if (!defined('W3TC')) { die; } include W3TC_INC_DIR . '/options/common/header.php'; ?> <p> <?php echo sprintf(__('Content Delivery Network support via %1$s is currently %2$s.', 'w3-total-cache'), '<strong>' . w3_get_engine_name($this->_config->get_string('cdn.engine')) . '</strong>', '<span class="w3tc-' . ($cdn_enabled ? 'enabled">' . __('enabled', 'w3-total-cache') : 'disabled">' . __('disabled', 'w3-total-cache')) . '</span>'); ?> </p> <form id="w3tc_cdn" action="admin.php?page=<?php echo $this->_page; ?> " method="post"> <p> <?php if ($cdn_mirror) { ?> Maximize <acronym title="Content Delivery Network">CDN</acronym> usage by <input id="cdn_rename_domain" class="button {nonce: '<?php echo wp_create_nonce('w3tc'); ?> '}" type="button" value="modify attachment URLs" /> or <input id="cdn_import_library" class="button {nonce: '<?php echo wp_create_nonce('w3tc'); ?> '}" type="button" value="importing attachments into the Media Library" />. <?php if (w3_can_cdn_purge($cdn_engine)) {
/** * Returns debug info */ function get_debug_info() { $group = $this->get_group(); $debug_info = "<!-- W3 Total Cache: Minify debug info:\r\n"; $debug_info .= sprintf("%s%s\r\n", str_pad('Engine: ', 20), w3_get_engine_name($this->_config->get_string('minify.engine'))); $debug_info .= sprintf("%s%s\r\n", str_pad('Group: ', 20), $group); require_once W3TC_LIB_W3_DIR . '/Minify.php'; $w3_minify =& W3_Minify::instance(); $css_groups = $w3_minify->get_groups($group, 'css'); if (count($css_groups)) { $debug_info .= "Stylesheet info:\r\n"; $debug_info .= sprintf("%s | %s | % s | %s\r\n", str_pad('Location', 15, ' ', STR_PAD_BOTH), str_pad('Last modified', 19, ' ', STR_PAD_BOTH), str_pad('Size', 12, ' ', STR_PAD_LEFT), 'Path'); foreach ($css_groups as $css_group => $css_files) { foreach ($css_files as $css_file => $css_file_path) { if (is_a($css_file_path, 'Minify_Source')) { $css_file_path = $css_file_path->filepath; $css_file_info = sprintf('%s (%s)', $css_file, $css_file_path); } else { $css_file_info = $css_file; $css_file_path = ABSPATH . ltrim($css_file_path, '/\\'); } $debug_info .= sprintf("%s | %s | % s | %s\r\n", str_pad($css_group, 15, ' ', STR_PAD_BOTH), str_pad(date('Y-m-d H:i:s', filemtime($css_file_path)), 19, ' ', STR_PAD_BOTH), str_pad(filesize($css_file_path), 12, ' ', STR_PAD_LEFT), $css_file_info); } } } $js_groups = $w3_minify->get_groups($group, 'js'); if (count($js_groups)) { $debug_info .= "JavaScript info:\r\n"; $debug_info .= sprintf("%s | %s | % s | %s\r\n", str_pad('Location', 15, ' ', STR_PAD_BOTH), str_pad('Last modified', 19, ' ', STR_PAD_BOTH), str_pad('Size', 12, ' ', STR_PAD_LEFT), 'Path'); foreach ($js_groups as $js_group => $js_files) { foreach ($js_files as $js_file => $js_file_path) { if (is_a($js_file_path, 'Minify_Source')) { $js_file_path = $js_file_path->filepath; $js_file_info = sprintf('%s (%s)', $js_file, $js_file_path); } else { $js_file_path = $js_file_info = ABSPATH . ltrim($js_file, '/\\'); } $debug_info .= sprintf("%s | %s | % s | %s\r\n", str_pad($js_group, 15, ' ', STR_PAD_BOTH), str_pad(date('Y-m-d H:i:s', filemtime($js_file_path)), 19, ' ', STR_PAD_BOTH), str_pad(filesize($js_file_path), 12, ' ', STR_PAD_LEFT), $js_file_info); } } } $debug_info .= '-->'; return $debug_info; }
/** * Output buffering callback * * @param string $buffer * @return string */ function ob_callback(&$buffer) { global $wpdb; if ($buffer != '' && w3_is_xml($buffer)) { if (w3_is_database_error($buffer)) { @header('HTTP/1.1 503 Service Unavailable'); } else { /** * Replace links for preview mode */ if (w3_is_preview_mode() && isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] != W3TC_POWERED_BY) { $domain_url_regexp = w3_get_domain_url_regexp(); $buffer = preg_replace_callback('~(href|src|action)=([\'"])(' . $domain_url_regexp . ')?(/[^\'"]*)~', array(&$this, 'link_replace_callback'), $buffer); } /** * Add footer comment */ $date = date_i18n('Y-m-d H:i:s'); $host = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'; if ($this->is_supported()) { $buffer .= sprintf("\r\n<!-- Served from: %s @ %s by W3 Total Cache -->", w3_escape_comment($host), $date); } else { $strings = array(); if ($this->_config->get_boolean('minify.enabled') && !$this->_config->get_boolean('minify.debug')) { require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php'; $w3_plugin_minify =& W3_Plugin_Minify::instance(); $strings[] = sprintf("Minified using %s%s", w3_get_engine_name($this->_config->get_string('minify.engine')), $w3_plugin_minify->minify_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_minify->minify_reject_reason) : ''); } if ($this->_config->get_boolean('pgcache.enabled') && !$this->_config->get_boolean('pgcache.debug')) { require_once W3TC_LIB_W3_DIR . '/PgCache.php'; $w3_pgcache =& W3_PgCache::instance(); $strings[] = sprintf("Page Caching using %s%s", w3_get_engine_name($this->_config->get_string('pgcache.engine')), $w3_pgcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_pgcache->cache_reject_reason) : ''); } if ($this->_config->get_boolean('dbcache.enabled') && !$this->_config->get_boolean('dbcache.debug') && is_a($wpdb, 'W3_Db')) { $append = is_user_logged_in() ? ' (user is logged in)' : ''; if ($wpdb->query_hits) { $strings[] = sprintf("Database Caching %d/%d queries in %.3f seconds using %s%s", $wpdb->query_hits, $wpdb->query_total, $wpdb->time_total, w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append); } else { $strings[] = sprintf("Database Caching using %s%s", w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append); } } if ($this->_config->get_boolean('objectcache.enabled') && !$this->_config->get_boolean('objectcache.debug')) { require_once W3TC_LIB_W3_DIR . '/ObjectCache.php'; $w3_objectcache =& W3_ObjectCache::instance(); $strings[] = sprintf("Object Caching %d/%d objects using %s", $w3_objectcache->cache_hits, $w3_objectcache->cache_total, w3_get_engine_name($this->_config->get_string('objectcache.engine'))); } if ($this->_config->get_boolean('cdn.enabled') && !$this->_config->get_boolean('cdn.debug')) { require_once W3TC_LIB_W3_DIR . '/Plugin/Cdn.php'; $w3_plugin_cdn =& W3_Plugin_Cdn::instance(); $cdn =& $w3_plugin_cdn->get_cdn(); $via = $cdn->get_via(); $strings[] = sprintf("Content Delivery Network via %s%s", $via ? $via : 'N/A', $w3_plugin_cdn->cdn_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_cdn->cdn_reject_reason) : ''); } $buffer .= "\r\n<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/\r\n"; if (count($strings)) { $buffer .= "\r\n" . implode("\r\n", $strings) . "\r\n"; } $buffer .= sprintf("\r\nServed from: %s @ %s -->", w3_escape_comment($host), $date); } } } return $buffer; }
<?php if (!defined('W3TC')) { die; } include W3TC_INC_DIR . '/options/common/header.php'; ?> <form action="admin.php?page=<?php echo $this->_page; ?> " method="post"> <p> Fragment caching via <strong><?php echo w3_get_engine_name($this->_config->get_string('fragmentcache.engine')); ?> </strong> is currently <span class="w3tc-<?php if ($fragmentcache_enabled) { ?> enabled">enabled<?php } else { ?> disabled">disabled<?php } ?> </span>. </p> <p> <?php
'; <?php } ?> <?php } ?> /*]]>*/</script> <form action="admin.php?page=<?php echo $this->_page; ?> " method="post"> <p> <?php echo sprintf(__('Minify via %s is currently %s.', 'w3-total-cache'), w3_get_engine_name($this->_config->get_string('minify.engine')), '<span class="w3tc-' . ($minify_enabled ? 'enabled">' . __('enabled', 'w3-total-cache') : 'disabled">' . __('disabled', 'w3-total-cache')) . '</span>'); ?> </p> <p> <?php echo sprintf(__('To rebuild the minify cache use the %s operation.', 'w3-total-cache'), $this->nonce_field('w3tc') . '<input type="submit" name="w3tc_flush_minify" value="' . __('empty cache', 'w3-total-cache') . '"' . disabled($minify_enabled, false, false) . ' class="button" />'); ?> <?php if (!$auto) { ?> <?php _e('Get minify hints using the', 'w3-total-cache'); ?> <input type="button" class="button button-minify-recommendations {nonce: '<?php echo wp_create_nonce('w3tc'); ?>
/** * Output buffering callback * * @param string $buffer * @return string */ function ob_callback(&$buffer) { global $wpdb; if ($buffer != '' && w3_is_xml($buffer)) { if (w3_is_database_error($buffer)) { status_header(503); } else { /** * Replace links for preview mode */ if (w3_is_preview_mode() && isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] != W3TC_POWERED_BY) { $domain_url_regexp = w3_get_domain_url_regexp(); $buffer = preg_replace_callback('~(href|src|action)=([\'"])(' . $domain_url_regexp . ')?(/[^\'"]*)~', array(&$this, 'link_replace_callback'), $buffer); } /** * Add footer comment */ $date = date_i18n('Y-m-d H:i:s'); $host = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'; if ($this->_config->get_string('common.support') != '' || $this->_config->get_boolean('common.tweeted')) { $buffer .= sprintf("\r\n<!-- Served from: %s @ %s by W3 Total Cache -->", w3_escape_comment($host), $date); } else { $strings = array(); if ($this->_config->get_boolean('minify.enabled') && !$this->_config->get_boolean('minify.debug')) { $w3_plugin_minify = w3_instance('W3_Plugin_Minify'); $strings[] = sprintf("Minified using %s%s", w3_get_engine_name($this->_config->get_string('minify.engine')), $w3_plugin_minify->minify_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_minify->minify_reject_reason) : ''); } if ($this->_config->get_boolean('pgcache.enabled') && !$this->_config->get_boolean('pgcache.debug')) { $w3_pgcache = w3_instance('W3_PgCache'); $strings[] = sprintf("Page Caching using %s%s", w3_get_engine_name($this->_config->get_string('pgcache.engine')), $w3_pgcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_pgcache->cache_reject_reason) : ''); } if ($this->_config->get_boolean('dbcache.enabled') && !$this->_config->get_boolean('dbcache.debug')) { $db = w3_instance('W3_DbCache'); $append = !is_null($db->cache_reject_reason) ? sprintf(' (%s)', $db->cache_reject_reason) : ''; if ($db->query_hits) { $strings[] = sprintf("Database Caching %d/%d queries in %.3f seconds using %s%s", $db->query_hits, $db->query_total, $db->time_total, w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append); } else { $strings[] = sprintf("Database Caching using %s%s", w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append); } } if (w3_is_dbcluster()) { $db_cluster = w3_instance('W3_Enterprise_DbCluster'); $strings[] = $db_cluster->status_message(); } if ($this->_config->get_boolean('objectcache.enabled') && !$this->_config->get_boolean('objectcache.debug')) { $w3_objectcache = w3_instance('W3_ObjectCache'); $append = $w3_objectcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_objectcache->cache_reject_reason) : ''; $strings[] = sprintf("Object Caching %d/%d objects using %s%s", $w3_objectcache->cache_hits, $w3_objectcache->cache_total, w3_get_engine_name($this->_config->get_string('objectcache.engine')), $append); } if ($this->_config->get_boolean('fragmentcache.enabled') && !$this->_config->get_boolean('fragmentcache.debug')) { $w3_fragmentcache = w3_instance('W3_Pro_FragmentCache'); $append = $w3_fragmentcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_fragmentcache->cache_reject_reason) : ''; $strings[] = sprintf("Fragment Caching %d/%d fragments using %s%s", $w3_fragmentcache->cache_hits, $w3_fragmentcache->cache_total, w3_get_engine_name($this->_config->get_string('fragmentcache.engine')), $append); } if ($this->_config->get_boolean('cdn.enabled') && !$this->_config->get_boolean('cdn.debug')) { $w3_plugin_cdn = w3_instance('W3_Plugin_Cdn'); $w3_plugin_cdncommon = w3_instance('W3_Plugin_CdnCommon'); $cdn =& $w3_plugin_cdncommon->get_cdn(); $via = $cdn->get_via(); $strings[] = sprintf("Content Delivery Network via %s%s", $via ? $via : 'N/A', $w3_plugin_cdn->cdn_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_cdn->cdn_reject_reason) : ''); } if ($this->_config->get_boolean('newrelic.enabled')) { $w3_newrelic = w3_instance('W3_Plugin_NewRelic'); $append = $w3_newrelic->newrelic_reject_reason != '' ? sprintf(' (%s)', $w3_newrelic->newrelic_reject_reason) : ''; $strings[] = sprintf(__("Application Monitoring using New Relic%s", 'w3-total-cache'), $append); } $buffer .= "\r\n<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/\r\n"; if (count($strings)) { $buffer .= "\r\n" . implode("\r\n", $strings) . "\r\n"; } $buffer .= sprintf("\r\n Served from: %s @ %s by W3 Total Cache -->", w3_escape_comment($host), $date); } if ($this->is_debugging()) { if ($this->_config->get_boolean('dbcache.enabled') && $this->_config->get_boolean('dbcache.debug')) { $db = w3_instance('W3_DbCache'); $buffer .= "\r\n\r\n" . $db->_get_debug_info(); } if ($this->_config->get_boolean('objectcache.enabled') && $this->_config->get_boolean('objectcache.debug')) { $w3_objectcache = w3_instance('W3_ObjectCache'); $buffer .= "\r\n\r\n" . $w3_objectcache->_get_debug_info(); } if ($this->_config->get_boolean('fragmentcache.enabled') && $this->_config->get_boolean('fragmentcache.debug')) { $w3_fragmentcache = w3_instance('W3_Pro_FragmentCache'); $buffer .= "\r\n\r\n" . $w3_fragmentcache->_get_debug_info(); } } } } return $buffer; }
<?php if (!defined('W3TC')) { die; } include W3TC_INC_DIR . '/options/common/header.php'; ?> <form action="admin.php?page=<?php echo $this->_page; ?> " method="post"> <p> <?php echo sprintf(__('Database caching via %s is currently %s.', 'w3-total-cache'), w3_get_engine_name($this->_config->get_string('dbcache.engine')), '<span class="w3tc-' . ($dbcache_enabled ? 'enabled">' . __('enabled', 'w3-total-cache') : 'disabled">' . __('disabled', 'w3-total-cache')) . '</span>'); ?> </p> <p> <?php _e('To rebuild the database cache use the', 'w3-total-cache'); ?> <?php echo $this->nonce_field('w3tc'); ?> <input type="submit" name="w3tc_flush_dbcache" value="<?php _e('empty cache', 'w3-total-cache'); ?> "<?php if (!$dbcache_enabled) { ?> disabled="disabled"<?php
/** * Returns debug info * * @return string */ function _get_debug_info() { $debug_info = "<!-- W3 Total Cache: Object Cache debug info:\r\n"; $debug_info .= sprintf("%s%s\r\n", str_pad('Engine: ', 20), w3_get_engine_name($this->_config->get_string('objectcache.engine'))); $debug_info .= sprintf("%s%s\r\n", str_pad('Caching: ', 20), $this->_caching ? 'enabled' : 'disabled'); if (!$this->_caching) { $debug_info .= sprintf("%s%s\r\n", str_pad('Reject reason: ', 20), $this->_cache_reject_reason); } $debug_info .= sprintf("%s%d\r\n", str_pad('Total calls: ', 20), $this->cache_total); $debug_info .= sprintf("%s%d\r\n", str_pad('Cache hits: ', 20), $this->cache_hits); $debug_info .= sprintf("%s%d\r\n", str_pad('Cache misses: ', 20), $this->cache_misses); $debug_info .= sprintf("%s%.4f\r\n", str_pad('Total time: ', 20), $this->time_total); $debug_info .= "W3TC Object Cache info:\r\n"; $debug_info .= sprintf("%s | %s | %s | %s | %s | %s\r\n", str_pad('#', 5, ' ', STR_PAD_LEFT), str_pad('Status', 15, ' ', STR_PAD_BOTH), str_pad('Source', 15, ' ', STR_PAD_BOTH), str_pad('Data size (b)', 13, ' ', STR_PAD_LEFT), str_pad('Query time (s)', 14, ' ', STR_PAD_LEFT), 'ID:Group'); foreach ($this->debug_info as $index => $debug) { $debug_info .= sprintf("%s | %s | %s | %s | %s | %s\r\n", str_pad($index + 1, 5, ' ', STR_PAD_LEFT), str_pad($debug['cached'] ? 'cached' : 'not cached', 15, ' ', STR_PAD_BOTH), str_pad($debug['internal'] ? 'internal' : 'persistent', 15, ' ', STR_PAD_BOTH), str_pad($debug['data_size'], 13, ' ', STR_PAD_LEFT), str_pad(round($debug['time'], 4), 14, ' ', STR_PAD_LEFT), sprintf('%s:%s', $debug['id'], $debug['group'])); } $debug_info .= '-->'; return $debug_info; }
/** * Returns debug info * * @return string */ function get_debug_info() { $debug_info = "<!-- W3 Total Cache: Minify debug info:\r\n"; $debug_info .= sprintf("%s%s\r\n", str_pad('Engine: ', 20), w3_get_engine_name($this->_config->get_string('minify.engine'))); $debug_info .= sprintf("%s%s\r\n", str_pad('Theme: ', 20), $this->get_theme()); $debug_info .= sprintf("%s%s\r\n", str_pad('Template: ', 20), $this->get_template()); if ($this->minify_reject_reason) { $debug_info .= sprintf("%s%s\r\n", str_pad('Reject reason: ', 20), $this->minify_reject_reason); } if ($this->error) { $debug_info .= sprintf("%s%s\r\n", str_pad('Errors: ', 20), $this->error); } if (count($this->replaced_styles)) { $debug_info .= "\r\nReplaced CSS files:\r\n"; foreach ($this->replaced_styles as $index => $file) { $debug_info .= sprintf("%d. %s\r\n", $index + 1, w3_escape_comment($file)); } } if (count($this->replaced_scripts)) { $debug_info .= "\r\nReplaced JavaScript files:\r\n"; foreach ($this->replaced_scripts as $index => $file) { $debug_info .= sprintf("%d. %s\r\n", $index + 1, w3_escape_comment($file)); } } $debug_info .= '-->'; return $debug_info; }
'; <?php } ?> <?php } ?> /*]]>*/</script> <form action="admin.php?page=<?php echo $this->_page; ?> " method="post"> <p> <?php sprintf(__('%s is currently %s.', 'w3-total-cache'), '<strong>' . w3_get_engine_name($this->_config->get_string('minify.engine')) . '</strong>', $minify_enabled ? 'enabled">' . __('enabled', 'w3-total-cache') : 'disabled">' . __('disabled', 'w3-total-cache') . '</span>'); ?> </p> <p> <?php sprintf(__('To rebuild the minify cache use the %s operation.', 'w3-total-cache'), $this->nonce_field('w3tc') . '<input type="submit" name="w3tc_flush_minify" value="' . __('empty cache', 'w3-total-cache') . '"' . disabled($minify_enabled, false, false) . ' class="button" />'); ?> <?php _e('To rebuild the minify cache use the', 'w3-total-cache'); ?> <?php echo $this->nonce_field('w3tc'); ?> <input type="submit" name="w3tc_flush_minify" value="<?php _e('empty cache', 'w3-total-cache'); ?>