diff options
author | Andrew Podner <a.podner@me.com> | 2012-12-28 14:30:43 +0100 |
---|---|---|
committer | Andrew Podner <a.podner@me.com> | 2012-12-28 14:30:43 +0100 |
commit | 96b9501f42ac773c9ec4fcda2a6ecabe72222365 (patch) | |
tree | 0798611fa615344b7aa72bf1f990eba4a4f6051c | |
parent | ae8c2d9d2644727bb347495a917bf437798596b4 (diff) |
issue #2092 : code refinements
-rw-r--r-- | system/core/Output.php | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/system/core/Output.php b/system/core/Output.php index 769ec1915..b6f69fd88 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -840,11 +840,9 @@ class CI_Output { $output = preg_replace('!\s*(:|;|,|}|{|\(|\))\s*!i', '$1', $output); // Replace tabs with spaces - $output = preg_replace('/\t/', ' ', $output); - // Replace carriage returns & multiple new lines with single new line // and trim any leading or trailing whitespace - $output = trim(preg_replace(array('/\r/', '/\n+/'), "\n", $output)); + $output = trim(preg_replace(array('/\t+/', '/\r/', '/\n+/'), array(' ', "\n", "\n"), $output)); // Remove spaces when safe to do so. $in_string = $in_dstring = $prev = FALSE; @@ -900,10 +898,10 @@ class CI_Output { $next_char = substr($output, $position[1] - $removed_lf + 1, 1); $prev_char = substr($output, $position[1] - $removed_lf - 1, 1); if ( ! ctype_print($next_char) && ! ctype_print($prev_char) - && ! preg_match('/^[\x20-\x7f]*$/D', $next_char) && ! preg_match('/^[\x20-\x7f]*$/D', $prev_char)) + && ! preg_match('/^[\x20-\x7f]*$/D', $next_char) + && ! preg_match('/^[\x20-\x7f]*$/D', $prev_char)) { - $output = substr_replace($output, '', $position[1] - $removed_lf, 1); - $removed_lf++; + $output = substr_replace($output, '', $position[1] - $removed_lf++, 1); } } } |