Skip to content

Commit

Permalink
issue bcit-ci#2092 : code refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPodner committed Dec 28, 2012
1 parent ae8c2d9 commit 96b9501
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions system/core/Output.php
Expand Up @@ -840,11 +840,9 @@ protected function _minify_script_style($output, $has_tags = FALSE)
$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;
Expand Down Expand Up @@ -900,10 +898,10 @@ protected function _minify_script_style($output, $has_tags = FALSE)
$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);
}
}
}
Expand Down

0 comments on commit 96b9501

Please sign in to comment.