summaryrefslogtreecommitdiffstats
path: root/system/core/Output.php
diff options
context:
space:
mode:
authorSongpol Sripaoeiam <sripaoeiam@gmail.com>2012-04-01 06:43:20 +0200
committerSongpol Sripaoeiam <sripaoeiam@gmail.com>2012-04-01 06:43:20 +0200
commit52fe7bb68f9961cdd765dd38e54779ae3b66e586 (patch)
treea0b1b99469e9cc4f5004e9a29af2ffdb4baff95e /system/core/Output.php
parent3396d531e2f3864d06860cdbdf7320bc121f77f1 (diff)
add function get_current_content_type to output class and user manual library
Diffstat (limited to 'system/core/Output.php')
-rwxr-xr-xsystem/core/Output.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/system/core/Output.php b/system/core/Output.php
index 9bf818e88..673ceb0ee 100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -220,6 +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
+ */
+ public function get_current_content_type()
+ {
+ foreach($this->headers as $header){
+ if(preg_match('/^Content-Type/', $header[0])){
+ return str_replace('Content-Type: ', '', $header[0]);
+ }
+ }
+ return 'text/html';
+ }
// --------------------------------------------------------------------