From 47b673324f06236264ca64f8c3155aab51762609 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 6 Jun 2012 15:58:05 +0300 Subject: Add a second parameter (charset) to CI_Output::set_content_type() + fix for issue #666 --- system/core/Output.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'system/core/Output.php') diff --git a/system/core/Output.php b/system/core/Output.php index 09656711b..0bf982289 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -200,7 +200,7 @@ class CI_Output { * @param string extension of the file we're outputting * @return void */ - public function set_content_type($mime_type) + public function set_content_type($mime_type, $charset = NULL) { if (strpos($mime_type, '/') === FALSE) { @@ -218,7 +218,13 @@ class CI_Output { } } - $header = 'Content-Type: '.$mime_type; + if (empty($charset)) + { + $charset = config_item('charset'); + } + + $header = 'Content-Type: '.$mime_type + .(empty($charset) ? NULL : '; charset='.strtolower($charset)); $this->headers[] = array($header, TRUE); return $this; -- cgit v1.2.3-24-g4f1b From c839d28f4230dce0c658338f267b821cc16490a2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jun 2012 14:35:27 +0300 Subject: Remove some unnecessary function_exists() checks and some minor improvements --- system/core/Output.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/core/Output.php') diff --git a/system/core/Output.php b/system/core/Output.php index 0bf982289..5588ffe8e 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -370,7 +370,7 @@ class CI_Output { if ($this->parse_exec_vars === TRUE) { - $memory = function_exists('memory_get_usage') ? round(memory_get_usage()/1024/1024, 2).'MB' : '0'; + $memory = round(memory_get_usage() / 1024 / 1024, 2).'MB'; $output = str_replace(array('{elapsed_time}', '{memory_usage}'), array($elapsed, $memory), $output); } -- cgit v1.2.3-24-g4f1b