diff options
author | judge <mjnaderi@gmail.com> | 2013-09-12 14:43:43 +0200 |
---|---|---|
committer | judge <mjnaderi@gmail.com> | 2013-09-12 14:43:43 +0200 |
commit | c5768dbab1f026db1bc3aa3908454eaecbc9006c (patch) | |
tree | e9c7c1beb4886696f250edcafb2f4d6b9cde1a3c /system/core/Output.php | |
parent | c7df348233227ecf490ef26795022af6cd26807c (diff) |
Fixed coding style
Diffstat (limited to 'system/core/Output.php')
-rw-r--r-- | system/core/Output.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/system/core/Output.php b/system/core/Output.php index 355a139d5..7c2a64d24 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -852,24 +852,29 @@ class CI_Output { // Remove Javascript inline comments if ($has_tags === TRUE && strpos(strtolower($open_tag), 'script') !== FALSE) { - $lines = preg_split('/((\r?\n)|(\n?\r))/', $output); + $lines = preg_split('/\r?\n|\n?\r/', $output); foreach ($lines as &$line) { $in_string = $in_dstring = FALSE; - $len = strlen($line); - for ($i=0; $i<$len; $i++) + for ($i = 0, $len = strlen($line); $i < $len; $i++) { if ( ! $in_string && ! $in_dstring && substr($line, $i, 2) === '//') { $line = substr($line, 0, $i); break; } + if ($line[$i] === "'" && ! $in_dstring) + { $in_string = ! $in_string; + } elseif ($line[$i] === '"' && ! $in_string) + { $in_dstring = ! $in_dstring; + } } } + $output = implode("\n", $lines); } |