function w3tc_footer_comment($strings)
 {
     $strings[] = sprintf(__('Minified using %s%s', 'w3-total-cache'), Cache::engine_name($this->_config->get_string('minify.engine')), $this->minify_reject_reason != '' ? sprintf(' (%s)', $this->minify_reject_reason) : '');
     if ($this->_config->get_boolean('minify.debug')) {
         $strings[] = "Minify debug info:";
         $strings[] = sprintf("%s%s", str_pad('Engine: ', 20), Cache::engine_name($this->_config->get_string('minify.engine')));
         $strings[] = sprintf("%s%s", str_pad('Theme: ', 20), $this->get_theme());
         $strings[] = sprintf("%s%s", str_pad('Template: ', 20), $this->get_template());
         if ($this->minify_reject_reason) {
             $strings[] = sprintf("%s%s", str_pad('Reject reason: ', 20), $this->minify_reject_reason);
         }
         if ($this->error) {
             $strings[] = sprintf("%s%s", str_pad('Errors: ', 20), $this->error);
         }
         if (count($this->replaced_styles)) {
             $strings[] = "Replaced CSS files:";
             foreach ($this->replaced_styles as $index => $file) {
                 $strings[] = sprintf("%d. %s", $index + 1, Util_Content::escape_comment($file));
             }
         }
         if (count($this->replaced_scripts)) {
             $strings[] = "Replaced JavaScript files:";
             foreach ($this->replaced_scripts as $index => $file) {
                 $strings[] = sprintf("%d. %s\r\n", $index + 1, Util_Content::escape_comment($file));
             }
         }
     }
     return $strings;
 }
 /**
  * Output buffering callback
  *
  * @param string  $buffer
  * @return string
  */
 function ob_callback($buffer)
 {
     global $wpdb;
     global $w3_late_caching_succeeded;
     if ($w3_late_caching_succeeded) {
         return $buffer;
     }
     if (Util_Content::is_database_error($buffer)) {
         status_header(503);
     } else {
         if (Util_Content::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 (Util_Environment::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 -->", Util_Content::escape_comment($host), $date);
             } else {
                 $strings = array();
                 $strings = apply_filters('w3tc_footer_comment', $strings);
                 $buffer .= "\r\n<!-- Performance optimized by W3 Total Cache. Learn more: https://www.w3-edge.com/products/\r\n";
                 if (count($strings)) {
                     $buffer .= "\r\n" . Util_Content::escape_comment(implode("\r\n", $strings)) . "\r\n";
                 }
                 $buffer .= sprintf("\r\n Served from: %s @ %s by W3 Total Cache -->", Util_Content::escape_comment($host), $date);
             }
         }
         $buffer = Util_Bus::do_ob_callbacks(array('minify', 'newrelic', 'cdn', 'browsercache', 'pagecache'), $buffer);
     }
     return $buffer;
 }
Beispiel #3
0
 function get_replaced_urls()
 {
     $strings = array();
     if (count($this->_replaced_urls)) {
         $strings[] = "Replaced URLs:";
         foreach ($this->_replaced_urls as $old_url => $new_url) {
             $strings[] = sprintf("%s => %s", Util_Content::escape_comment($old_url), Util_Content::escape_comment($new_url));
         }
     }
     return $strings;
 }
 /**
  * Returns debug info
  *
  * @param boolean $cache
  * @param string  $reason
  * @param boolean $status
  * @param double  $time
  * @return string
  */
 public function w3tc_footer_comment($strings)
 {
     $strings[] = sprintf(__('Page Caching using %s%s', 'w3-total-cache'), Cache::engine_name($this->_config->get_string('pgcache.engine')), $this->cache_reject_reason != '' ? sprintf(' (%s)', $this->cache_reject_reason) : '');
     if ($this->_debug) {
         $time_total = Util_Debug::microtime() - $this->_time_start;
         $engine = $this->_config->get_string('pgcache.engine');
         $strings[] = "Page cache debug info:";
         $strings[] = sprintf("%s%s", str_pad('Engine: ', 20), Cache::engine_name($engine));
         $strings[] = sprintf("%s%s", str_pad('Cache key: ', 20), $this->_page_key);
         if ($this->cache_reject_reason != '') {
             $strings[] = sprintf("%s%s", str_pad('Reject reason: ', 20), $this->cache_reject_reason);
         }
         $strings[] = sprintf("%s%.3fs", str_pad('Creation Time: ', 20), time());
         $headers = $this->_get_response_headers();
         if (count($headers)) {
             $strings[] = "Header info:";
             foreach ($headers as $header_name => $header_value) {
                 $strings[] = sprintf("%s%s", str_pad($header_name . ': ', 20), Util_Content::escape_comment($header_value));
             }
         }
     }
     return $strings;
 }