Benchmark Timer Patch output plain text
| From: | Alexander Schilling | Date: | Mon, 20 Oct 2003 08:20:08 +0000 |
| Subject: | Benchmark Timer Patch output plain text | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-22838@lists.php.net to get a copy of this message | ||
Hello,
I need the Benchmark_Timer class to output plain text instead of html on a
Webserver. Because of tghe autodetect, this isn't possible.
I changed the behaviour of getOutput by adding an optional parameter called
$http. But maybe I should rename it into $output_html to give a better
meaning. See the diff at the end
Maybe this is helpfull for others, too. So please check to include it in the
next Benchmark release.
Best regards
Alexander
File: Benchmark/Timer.php
=====================
109c109
< function getOutput()
---
> function getOutput($http=null)
111,118c111,120
< if (function_exists('version_compare') &&
< version_compare(phpversion(), '4.1', 'ge'))
< {
< $http = isset($_SERVER['SERVER_PROTOCOL']);
< } else {
< global $HTTP_SERVER_VARS;
< $http = isset($HTTP_SERVER_VARS['SERVER_PROTOCOL']);
< }
---
> if (!isset($http)) {
> if (function_exists('version_compare') &&
> version_compare(phpversion(), '4.1', 'ge'))
> {
> $http = isset($_SERVER['SERVER_PROTOCOL']);
> } else {
> global $HTTP_SERVER_VARS;
> $http = isset($HTTP_SERVER_VARS['SERVER_PROTOCOL']);
> }
> }