From c4e266b87f39d521ff1002fefa9df809c6b9bd61 Mon Sep 17 00:00:00 2001 From: Darren Hill Date: Tue, 30 Aug 2011 15:40:27 -0400 Subject: Added Session driver with native PHP sessions and original-flavor CI cookie sessions --- system/core/Loader.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'system/core') diff --git a/system/core/Loader.php b/system/core/Loader.php index de0fc06d2..51e6b82ca 100755 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -1174,6 +1174,15 @@ class CI_Loader { } } + // Autoload drivers + if (isset($autoload['drivers'])) + { + foreach ($autoload['drivers'] as $item) + { + $this->driver($item); + } + } + // Autoload models if (isset($autoload['model'])) { @@ -1240,4 +1249,4 @@ class CI_Loader { } /* End of file Loader.php */ -/* Location: ./system/core/Loader.php */ \ No newline at end of file +/* Location: ./system/core/Loader.php */ -- cgit v1.2.3-24-g4f1b From ca3be1d515a68293b64704a9a8346802702dedaa Mon Sep 17 00:00:00 2001 From: Darren Hill Date: Wed, 31 Aug 2011 08:31:18 -0400 Subject: Whitespace cleanup --- system/core/Loader.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'system/core') diff --git a/system/core/Loader.php b/system/core/Loader.php index 51e6b82ca..edf5853f0 100755 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -1177,10 +1177,10 @@ class CI_Loader { // Autoload drivers if (isset($autoload['drivers'])) { - foreach ($autoload['drivers'] as $item) - { - $this->driver($item); - } + foreach ($autoload['drivers'] as $item) + { + $this->driver($item); + } } // Autoload models -- cgit v1.2.3-24-g4f1b From c8efb8033ae775a5c1c840f867def4e6253b3d9a Mon Sep 17 00:00:00 2001 From: "Thor (atiredmachine)" Date: Tue, 24 Jan 2012 13:33:39 -0800 Subject: Output class now sets HTTP headers match caching settings. --- system/core/Output.php | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'system/core') diff --git a/system/core/Output.php b/system/core/Output.php index abd8a0ea9..1f214a0b3 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -466,6 +466,9 @@ class CI_Output { @chmod($cache_path, FILE_WRITE_MODE); log_message('debug', 'Cache file written: '.$cache_path); + + // Send HTTP cache-control headers to browser to match file cache settings. + $this->set_cache_header($_SERVER['REQUEST_TIME'],$expire); } // -------------------------------------------------------------------- @@ -503,13 +506,22 @@ class CI_Output { return FALSE; } - // Has the file expired? If so we'll delete it. - if (time() >= trim(str_replace('TS--->', '', $match[1])) && is_really_writable($cache_path)) + $last_modified = filemtime($cache_path); + $expire = trim(str_replace('TS--->', '', $match[1])); + + // Has the file expired? + if ($_SERVER['REQUEST_TIME'] >= $expire && is_really_writable($cache_path)) { + // If so we'll delete it. @unlink($filepath); log_message('debug', 'Cache file has expired. File deleted.'); return FALSE; } + else + { + // Or else send the HTTP cache control headers. + $this->set_cache_header($last_modified,$expire); + } // Display the cache $this->_display(str_replace($match[0], '', $cache)); @@ -517,6 +529,35 @@ class CI_Output { return TRUE; } + + // -------------------------------------------------------------------- + /** + * Set the HTTP headers to match the server-side file cache settings + * in order to reduce bandwidth. + * + * @param int timestamp of when the page was last modified + * @param int timestamp of when should the requested page expire from cache + * @return void + */ + public function set_cache_header($last_modified,$expiration) + { + $max_age = $expiration - $_SERVER['REQUEST_TIME']; + + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && ($last_modified <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']))) + { + $this->set_status_header(304); + exit; + } + else + { + header('Pragma: public'); + header('Cache-Control: max-age=' . $max_age . ', public'); + header('Expires: '.gmdate('D, d M Y H:i:s', $expiration).' GMT'); + header('Last-modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT'); + } + } + + } /* End of file Output.php */ -- cgit v1.2.3-24-g4f1b From 63678a27864fdd6bb0ed89e6940a1d331121072a Mon Sep 17 00:00:00 2001 From: "Thor (atiredmachine)" Date: Tue, 24 Jan 2012 16:56:01 -0800 Subject: Rudimentary minifying of output. --- system/core/Output.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'system/core') diff --git a/system/core/Output.php b/system/core/Output.php index 1f214a0b3..55a505c34 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -323,6 +323,15 @@ class CI_Output { { $output =& $this->final_output; } + + // -------------------------------------------------------------------- + + // Is minify requested? + if ($CFG->item('minify_output') === TRUE) + { + $output = $this->minify($output); + } + // -------------------------------------------------------------------- @@ -558,6 +567,33 @@ class CI_Output { } + + + // -------------------------------------------------------------------- + /** + * Reduce excessive size of HTML content. + * + * @param string + * @param string + * @return string + */ + public function minify($output,$type='html') + { + switch ($type) + { + case 'html': + + // Replaces multiple spaces with a single space. + $output = preg_replace('!\s{2,}!',' ',$output); + + // ... + break; + } + + return $output; + } + + } /* End of file Output.php */ -- cgit v1.2.3-24-g4f1b From 79db4cdba1a1a80634cd76ab8fc69fce7b1a7ea6 Mon Sep 17 00:00:00 2001 From: "Thor (atiredmachine)" Date: Tue, 24 Jan 2012 20:44:51 -0800 Subject: Improved minifier to restore
 contents, remove even more spaces,
 and process CSS with its own rules.

---
 system/core/Output.php | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

(limited to 'system/core')

diff --git a/system/core/Output.php b/system/core/Output.php
index 55a505c34..bb39a7f31 100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -582,12 +582,45 @@ class CI_Output {
 		switch ($type)
 		{
 			case 'html':
+			
+				// Keep track of 
 tags as they were before processing.
+				// We'll want to return them to this state later.
+				preg_match_all('{}msU',$output,$pres_clean);
+
+				// Keep track of 
 tags as they were before processing.
+				// We'll want to return them to this state later.
+				preg_match_all('{}msU',$output,$style_clean);
 				
+				// Run }msU',$output,$style_clean);
-				
-				// Run }msU',$output,$style_clean);
 				foreach ($style_clean[0] as $s)
 				{
-					$output = str_replace($s, $this->minify($s,'css'), $output);
+					$output = str_replace($s, $this->minify($s,'text/css'), $output);
 				}
 
 				// Replace multiple spaces with a single space.
@@ -614,7 +614,7 @@ class CI_Output {
 			break;
 			
 			
-			case 'css':
+			case 'text/css':
 			
 				// Remove spaces around curly brackets, colons, and semi-colons
 				$output = preg_replace('!\s*(:|;|}|{)\s*!','$1',$output);
-- 
cgit v1.2.3-24-g4f1b


From 5de117549f69465a1ce0f2e128428d9adadd8a6d Mon Sep 17 00:00:00 2001
From: "Thor (atiredmachine)" 
Date: Tue, 24 Jan 2012 22:08:36 -0800
Subject: Strips out HTML comments.

---
 system/core/Output.php | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'system/core')

diff --git a/system/core/Output.php b/system/core/Output.php
index 47c00acd8..8992fc1f1 100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -600,6 +600,9 @@ class CI_Output {
 				// Replace multiple spaces with a single space.
 				$output = preg_replace('!\s{2,}!',"\n",$output);
 				
+				// Remove comments (non-MSIE conditionals)
+				$output = preg_replace('{\s*\s*}msU','',$output);
+
 				// Remove spaces around block-level elements.
 				$output = preg_replace('{\s*()\s*}', '$1', $output);
 
-- 
cgit v1.2.3-24-g4f1b


From f59ec6fe4fab3bd5ff71d920e13f983454a9fb65 Mon Sep 17 00:00:00 2001
From: "Thor (atiredmachine)" 
Date: Tue, 24 Jan 2012 22:19:14 -0800
Subject: Logs 'debug' message that shows how much % was shaved off.

---
 system/core/Output.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'system/core')

diff --git a/system/core/Output.php b/system/core/Output.php
index 8992fc1f1..c95f551ec 100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -582,7 +582,9 @@ class CI_Output {
 		switch ($type)
 		{
 			case 'text/html':
-			
+
+				$size_before = strlen($output);
+
 				// Keep track of 
  and }msU',$output,$textareas_clean);
+				preg_match_all('{}msU', $output, $pres_clean);
+				preg_match_all('{}msU', $output, $codes_clean);
+				preg_match_all('{}msU', $output, $textareas_clean);
 
 				// Minify the CSS in all the }msU',$output,$style_clean);
+				preg_match_all('{}msU', $output, $style_clean);
 				foreach ($style_clean[0] as $s)
 				{
 					$output = str_replace($s, $this->minify($s,'text/css'), $output);
 				}
 
 				// Replace multiple spaces with a single space.
-				$output = preg_replace('!\s{2,}!',"\n",$output);
+				$output = preg_replace('!\s{2,}!', "\n", $output);
 				
 				// Remove comments (non-MSIE conditionals)
-				$output = preg_replace('{\s*\s*}msU','',$output);
+				$output = preg_replace('{\s*\s*}msU', '', $output);
 
 				// Remove spaces around block-level elements.
 				$output = preg_replace('{\s*()\s*}', '$1', $output);
 
 				// Replace mangled 
 etc. tags with unprocessed ones.
-				preg_match_all('{}msU',$output,$pres_messed);
-				preg_match_all('{}msU',$output,$codes_messed);
-				preg_match_all('{}msU',$output,$textareas_messed);
-				$output = str_replace($pres_messed[0],$pres_clean[0],$output);
-				$output = str_replace($codes_messed[0],$codes_clean[0],$output);
-				$output = str_replace($textareas_messed[0],$textareas_clean[0],$output);
+				preg_match_all('{}msU', $output, $pres_messed);
+				preg_match_all('{}msU', $output, $codes_messed);
+				preg_match_all('{}msU', $output, $textareas_messed);
+				$output = str_replace($pres_messed[0], $pres_clean[0], $output);
+				$output = str_replace($codes_messed[0], $codes_clean[0], $output);
+				$output = str_replace($textareas_messed[0], $textareas_clean[0], $output);
 				
 				$size_after = strlen($output);
 				$savings_percent = round(100 - ($size_after / $size_before * 100));
@@ -640,10 +635,10 @@ class CI_Output {
 			case 'text/css':
 			
 				// Remove spaces around curly brackets, colons, and semi-colons
-				$output = preg_replace('!\s*(:|;|}|{)\s*!','$1',$output);
+				$output = preg_replace('!\s*(:|;|}|{)\s*!', '$1', $output);
 				
 				// Replace spaces with line breaks to limit line lengths
-				$output = preg_replace('!\s+!',"\n",$output);
+				$output = preg_replace('!\s+!', "\n", $output);
 
 			break;
 		}
-- 
cgit v1.2.3-24-g4f1b


From 5c078ceeb926119fc3b4e55ca7c33ff2d1a207cd Mon Sep 17 00:00:00 2001
From: "Thor (atiredmachine)" 
Date: Thu, 26 Jan 2012 17:18:35 -0800
Subject: Added javascript. Improved based on comments.

---
 system/core/Output.php | 74 +++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 55 insertions(+), 19 deletions(-)

(limited to 'system/core')

diff --git a/system/core/Output.php b/system/core/Output.php
index 9bc02fc84..c4eba30bb 100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -593,12 +593,12 @@ class CI_Output {
 
 				$size_before = strlen($output);
 
-				// Keep track of 
  and }msU', $output, $textareas_clean);
+				preg_match_all('{}msU', $output, $javascript_clean);
 
 				// Minify the CSS in all the }msU', $output, $style_clean);
@@ -606,39 +606,75 @@ class CI_Output {
 				{
 					$output = str_replace($s, $this->minify($s,'text/css'), $output);
 				}
+				
+				// Minify the javascript in }msU', $output, $javascript_messed);
+					$output = str_replace($javascript_messed[0], $javascript_mini, $output);
+				}
+				
+				$size_removed = $size_before - strlen($output);
+				$savings_percent = round(($size_removed / $size_before * 100));
+
+				log_message('debug', 'Minifier shaved '.($size_removed / 1000).'KB ('.$savings_percent.'%) off final HTML output.');
 
 			break;
 			
 			
 			case 'text/css':
 			
-				// Remove spaces around curly brackets, colons, and semi-colons
-				$output = preg_replace('!\s*(:|;|}|{)\s*!', '$1', $output);
-				
-				// Replace spaces with line breaks to limit line lengths
-				$output = preg_replace('!\s+!', "\n", $output);
+				//Remove CSS comments
+				$output = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $output);
+			
+				// Remove spaces around curly brackets, colons,
+				// semi-colons, parenthesis, commas
+				$output = preg_replace('!\s*(:|;|,|}|{|\(|\))\s*!', '$1', $output);
+
+			break;
+			
+			
+			case 'text/javascript':
+
+				// Replace multiple spaces with a single newline.
+				$output = preg_replace('!\s{2,}!',"\n", $output);
+
+				// Remove excessive newlines.
+				$output = preg_replace('!(;|{|})\n!','$1', $output);
 
 			break;
 		}
-- 
cgit v1.2.3-24-g4f1b


From 6c5992da5cf3579a29079b0aae3e9ba0700fda5c Mon Sep 17 00:00:00 2001
From: "Thor (atiredmachine)" 
Date: Thu, 26 Jan 2012 18:45:57 -0800
Subject: Removed javascript for now...

---
 system/core/Output.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'system/core')

diff --git a/system/core/Output.php b/system/core/Output.php
index c4eba30bb..d8c230968 100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -670,11 +670,11 @@ class CI_Output {
 			
 			case 'text/javascript':
 
-				// Replace multiple spaces with a single newline.
-				$output = preg_replace('!\s{2,}!',"\n", $output);
+				// Replace multiple whitespace characters with a single newline.
+				//$output = preg_replace('!\s{2,}!',"\n", $output);
 
 				// Remove excessive newlines.
-				$output = preg_replace('!(;|{|})\n!','$1', $output);
+				//$output = preg_replace('!(;|{|})\n!','$1', $output);
 
 			break;
 		}
-- 
cgit v1.2.3-24-g4f1b


From 1b8d0ef6491b77375bb068711bc5e10fe4ca4b8f Mon Sep 17 00:00:00 2001
From: Thor 
Date: Sat, 28 Jan 2012 01:48:04 -0800
Subject: Fixed some spaces.

---
 system/core/Output.php | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

(limited to 'system/core')

diff --git a/system/core/Output.php b/system/core/Output.php
index d8c230968..468274002 100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -604,17 +604,17 @@ class CI_Output {
 				preg_match_all('{}msU', $output, $style_clean);
 				foreach ($style_clean[0] as $s)
 				{
-					$output = str_replace($s, $this->minify($s,'text/css'), $output);
+					$output = str_replace($s, $this->minify($s, 'text/css'), $output);
 				}
 				
 				// Minify the javascript in }msU', $output, $javascript_messed);
 					$output = str_replace($javascript_messed[0], $javascript_mini, $output);
 				}
-				
+
 				$size_removed = $size_before - strlen($output);
 				$savings_percent = round(($size_removed / $size_before * 100));
 
 				log_message('debug', 'Minifier shaved '.($size_removed / 1000).'KB ('.$savings_percent.'%) off final HTML output.');
 
 			break;
-			
-			
+
 			case 'text/css':
-			
+
 				//Remove CSS comments
 				$output = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $output);
-			
+
 				// Remove spaces around curly brackets, colons,
 				// semi-colons, parenthesis, commas
 				$output = preg_replace('!\s*(:|;|,|}|{|\(|\))\s*!', '$1', $output);
 
 			break;
-			
-			
+
 			case 'text/javascript':
 
 				// Currently leaves JavaScript untouched.
 			break;
+
+			default: break;
 		}
-		
+
 		return $output;
 	}
 
-
 }
 
 /* End of file Output.php */
-/* Location: ./system/core/Output.php */
+/* Location: ./system/core/Output.php */
\ No newline at end of file
-- 
cgit v1.2.3-24-g4f1b


From f512b73bc78760198a5409f2c4da71fe749b1301 Mon Sep 17 00:00:00 2001
From: Alex Bilbie 
Date: Sat, 16 Jun 2012 11:15:19 +0100
Subject: Spelling fixes - `wether` to `whether`

Interestingly `wether` means a castrated ram in old English
---
 system/core/Hooks.php  | 4 ++--
 system/core/Output.php | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'system/core')

diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index 29fd88201..afbf4b453 100644
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -39,7 +39,7 @@
 class CI_Hooks {
 
 	/**
-	 * Determines wether hooks are enabled
+	 * Determines whether hooks are enabled
 	 *
 	 * @var bool
 	 */
@@ -53,7 +53,7 @@ class CI_Hooks {
 	public $hooks =	array();
 
 	/**
-	 * Determines wether hook is in progress, used to prevent infinte loops
+	 * Determines whether hook is in progress, used to prevent infinte loops
 	 *
 	 * @var bool
 	 */
diff --git a/system/core/Output.php b/system/core/Output.php
index 570d4ebc9..ed294f116 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -74,7 +74,7 @@ class CI_Output {
 	protected $mime_type		= 'text/html';
 
 	/**
-	 * Determines wether profiler is enabled
+	 * Determines whether profiler is enabled
 	 *
 	 * @var book
 	 */
-- 
cgit v1.2.3-24-g4f1b


From 1764dd7d4ab6e6e5c799eaa9ce007fce48fa0b63 Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Sat, 16 Jun 2012 18:48:19 +0300
Subject: Fix issue #938 + some related improvements

---
 system/core/Config.php | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

(limited to 'system/core')

diff --git a/system/core/Config.php b/system/core/Config.php
index 3de1bcb96..656382716 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -225,12 +225,12 @@ class CI_Config {
 	 * Site URL
 	 * Returns base_url . index_page [. uri_string]
 	 *
-	 * @param	string	the URI string
+	 * @param	mixed	the URI string or an array of segments
 	 * @return	string
 	 */
 	public function site_url($uri = '')
 	{
-		if ($uri === '')
+		if (empty($uri))
 		{
 			return $this->slash_item('base_url').$this->item('index_page');
 		}
@@ -240,10 +240,12 @@ class CI_Config {
 			$suffix = ($this->item('url_suffix') === FALSE) ? '' : $this->item('url_suffix');
 			return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix;
 		}
-		else
+		elseif (is_array($uri) OR strpos($uri, '?') === FALSE)
 		{
-			return $this->slash_item('base_url').$this->item('index_page').'?'.$this->_uri_string($uri);
+			$uri = '?'.$this->_uri_string($uri);
 		}
+
+		return $this->slash_item('base_url').$this->item('index_page').$uri;
 	}
 
 	// -------------------------------------------------------------
@@ -280,15 +282,7 @@ class CI_Config {
 		}
 		elseif (is_array($uri))
 		{
-			$i = 0;
-			$str = '';
-			foreach ($uri as $key => $val)
-			{
-				$prefix = ($i === 0) ? '' : '&';
-				$str .= $prefix.$key.'='.$val;
-				$i++;
-			}
-			return $str;
+			return http_build_query($uri);
 		}
 
 		return $uri;
-- 
cgit v1.2.3-24-g4f1b


From 95d78cf4f78c0fb685a789c280d106ab242318ef Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Sat, 16 Jun 2012 19:54:33 +0300
Subject: Fix issue #999

---
 system/core/Config.php | 18 +++++++++++++++---
 system/core/URI.php    |  6 ++++--
 2 files changed, 19 insertions(+), 5 deletions(-)

(limited to 'system/core')

diff --git a/system/core/Config.php b/system/core/Config.php
index 656382716..4b4e5a7ba 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -235,14 +235,26 @@ class CI_Config {
 			return $this->slash_item('base_url').$this->item('index_page');
 		}
 
+		$uri = $this->_uri_string($uri);
+
 		if ($this->item('enable_query_strings') === FALSE)
 		{
 			$suffix = ($this->item('url_suffix') === FALSE) ? '' : $this->item('url_suffix');
-			return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix;
+
+			if ($suffix !== '' && ($offset = strpos($uri, '?')) !== FALSE)
+			{
+				$uri = substr($uri, 0, $offset).$suffix.substr($uri, $offset);
+			}
+			else
+			{
+				$uri .= $suffix;
+			}
+
+			return $this->slash_item('base_url').$this->slash_item('index_page').$uri;
 		}
-		elseif (is_array($uri) OR strpos($uri, '?') === FALSE)
+		elseif (strpos($uri, '?') === FALSE)
 		{
-			$uri = '?'.$this->_uri_string($uri);
+			$uri = '?'.$uri;
 		}
 
 		return $this->slash_item('base_url').$this->item('index_page').$uri;
diff --git a/system/core/URI.php b/system/core/URI.php
index 208d311a5..6a8b1a5ac 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -302,9 +302,11 @@ class CI_URI {
 	 */
 	public function _remove_url_suffix()
 	{
-		if  ($this->config->item('url_suffix') !== '')
+		$suffix = (string) $this->config->item('url_suffix');
+
+		if ($suffix !== '' && ($offset = strrpos($this->uri_string, $suffix)) !== FALSE)
 		{
-			$this->uri_string = preg_replace('|'.preg_quote($this->config->item('url_suffix')).'$|', '', $this->uri_string);
+			$this->uri_string = substr_replace($this->uri_string, '', $offset, strlen($suffix));
 		}
 	}
 
-- 
cgit v1.2.3-24-g4f1b


From 3b6af434b13168828429d06aae7699f6f9537a87 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon 
Date: Thu, 21 Jun 2012 09:21:17 -0500
Subject: Replaced block tag minification regex with a less greedy solution.

---
 system/core/Output.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'system/core')

diff --git a/system/core/Output.php b/system/core/Output.php
index ed294f116..4fdf18f14 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -652,7 +652,7 @@ class CI_Output {
 				$output = preg_replace('{\s*\s*}msU', '', $output);
 
 				// Remove spaces around block-level elements.
-				$output = preg_replace('{\s*()\s+}msU', '$1', $output);
+				$output = preg_replace('/\s*(<\/?(html|head|title|meta|script|link|style|body|h[1-6]|div|p|br)[^>]*>)\s*/is', '$1', $output);
 
 				// Replace mangled 
 etc. tags with unprocessed ones.
 
-- 
cgit v1.2.3-24-g4f1b


From 7a744a8ba8f07ba1ec3a48f1d5de641b4025ce20 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon 
Date: Sat, 23 Jun 2012 17:21:00 +0100
Subject: If there is no output then no need to try minifying it

---
 system/core/Output.php | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'system/core')

diff --git a/system/core/Output.php b/system/core/Output.php
index 4fdf18f14..5ec8c4bc0 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -625,6 +625,11 @@ class CI_Output {
 
 				$size_before = strlen($output);
 
+				if ($size_before === 0)
+				{
+					return '';
+				}
+
 				// Find all the 
,,