diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-04-03 11:16:57 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-04-03 11:16:57 +0200 |
commit | 3178285527c11d6dbe6a9b03ea3cec162da031fb (patch) | |
tree | 3c8079150f9d0b34da9ba461cbf98e80174a555d /system/core/Output.php | |
parent | 5589fe1c84375534ad4ee1e7adfbb52e4953a5b9 (diff) | |
parent | cc0e4152502c368c0f4aa9be0af6b921ef106b81 (diff) |
Merge pull request #1234 from obiconbig/develop
add function get_content_type to output class
Diffstat (limited to 'system/core/Output.php')
-rwxr-xr-x | system/core/Output.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/system/core/Output.php b/system/core/Output.php index 9bf818e88..09d74f0c0 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -220,6 +220,26 @@ 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 + */ + public function get_content_type() + { + foreach ($this->headers as $header) + { + if (preg_match('/^Content-Type/', $header[0])) + { + return str_replace('Content-Type: ', '', $header[0]); + } + } + return 'text/html'; + } // -------------------------------------------------------------------- |