diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-04-03 11:30:50 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-04-03 11:30:50 +0200 |
commit | 00adf1d480f94692a625ec2165e0fcc9171c6e2f (patch) | |
tree | 8e45d70039bd5e918ee76d4512a3d6635deb39d7 /system/core/Output.php | |
parent | 3178285527c11d6dbe6a9b03ea3cec162da031fb (diff) |
Some improvements to the additions from pull #1234
Diffstat (limited to 'system/core/Output.php')
-rwxr-xr-x | system/core/Output.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/system/core/Output.php b/system/core/Output.php index 09d74f0c0..01fd1d867 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -220,24 +220,24 @@ class CI_Output { $this->headers[] = array($header, TRUE); return $this; } - + // -------------------------------------------------------------------- - + /** * Get Current Content Type Header - * Return text/html if Content-Type is not set * - * @return string + * @return string 'text/html', if not already set */ public function get_content_type() { - foreach ($this->headers as $header) + for ($i = 0, $c = count($this->headers); $i < $c; $i++) { - if (preg_match('/^Content-Type/', $header[0])) + if (preg_match('/^Content-Type:\s(.+)$/', $this->headers[$i][0], $matches)) { - return str_replace('Content-Type: ', '', $header[0]); + return $matches[1]; } } + return 'text/html'; } |