/** * 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; }