timer_stop() public method

Defined here because timer_stop() calls number_format_i18n()
public timer_stop ( $display, $precision = 3 )
Esempio n. 1
0
 if ($batcache->cache_control && isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
     $since = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
     if ($batcache->cache['time'] == $since) {
         header('Last-Modified: ' . $_SERVER['HTTP_IF_MODIFIED_SINCE'], true, 304);
         exit;
     }
 }
 // Use the batcache save time for Last-Modified so we can issue "304 Not Modified"
 if ($batcache->cache_control) {
     header('Last-Modified: ' . date('r', $batcache->cache['time']), true);
     header('Cache-Control: max-age=' . ($batcache->max_age - time() + $batcache->cache['time']) . ', must-revalidate', true);
 }
 // Add some debug info just before </head>
 if ($batcache->debug) {
     if (false !== ($tag_position = strpos($batcache->cache['output'], '</head>'))) {
         $tag = "<!--\n\tgenerated " . (time() - $batcache->cache['time']) . " seconds ago\n\tgenerated in " . $batcache->cache['timer'] . " seconds\n\tserved from batcache in " . $batcache->timer_stop(false, 3) . " seconds\n\texpires in " . ($batcache->max_age - time() + $batcache->cache['time']) . " seconds\n-->\n";
         $batcache->cache['output'] = substr($batcache->cache['output'], 0, $tag_position) . $tag . substr($batcache->cache['output'], $tag_position);
     }
 }
 if (!empty($batcache->cache['headers'])) {
     foreach ($batcache->cache['headers'] as $k => $v) {
         header("{$k}: {$v}", true);
     }
 }
 if (!empty($batcache->headers)) {
     foreach ($batcache->headers as $k => $v) {
         if (is_array($v)) {
             header("{$v[0]}: {$v[1]}", false);
         } else {
             header("{$k}: {$v}", true);
         }
Esempio n. 2
0
     }
     if ($batcache->cache['time'] == $since) {
         header('Cache-Control: max-age=' . ($batcache->max_age - time() + $batcache->cache['time']) . ', must-revalidate', true);
         header('Last-Modified: ' . $_SERVER['HTTP_IF_MODIFIED_SINCE'], true, 304);
         exit;
     }
 }
 // Use the batcache save time for Last-Modified so we can issue "304 Not Modified"
 if ($batcache->cache_control) {
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $batcache->cache['time']) . ' GMT', true);
     header('Cache-Control: max-age=' . ($batcache->max_age - time() + $batcache->cache['time']) . ', must-revalidate', true);
 }
 // Add some debug info just before </head>
 if ($batcache->debug) {
     if (false !== ($tag_position = strpos($batcache->cache['output'], '</head>'))) {
         $tag = "<!--\n\tgenerated " . (time() - $batcache->cache['time']) . " seconds ago\n\tgenerated in " . $batcache->cache['timer'] . " seconds\n\tserved from batcache in " . $batcache->timer_stop(false, 3) . " seconds\n\texpires in " . ($batcache->max_age - time() + $batcache->cache['time']) . " seconds\n-->\n";
         $batcache->cache['output'] = substr($batcache->cache['output'], 0, $tag_position) . $tag . substr($batcache->cache['output'], $tag_position);
     }
 }
 if ($batcache->debug_header) {
     header(sprintf("X-batcache: Cached, generated in %ums, expires in %us (%us TTL), served in %ums", $batcache->cache['timer'] * 1000, $batcache->max_age - time() + $batcache->cache['time'], $batcache->max_age, $batcache->timer_stop(false, 3) * 1000), true);
 }
 if (!empty($batcache->cache['headers'])) {
     foreach ($batcache->cache['headers'] as $k => $v) {
         header("{$k}: {$v}", true);
     }
 }
 if (!empty($batcache->headers)) {
     foreach ($batcache->headers as $k => $v) {
         if (is_array($v)) {
             header("{$v[0]}: {$v[1]}", false);