diff options
Diffstat (limited to 'system/core/Output.php')
-rw-r--r-- | system/core/Output.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/system/core/Output.php b/system/core/Output.php index ec82ae7e8..355a139d5 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -850,23 +850,27 @@ class CI_Output { $output = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!i', '', $output); // Remove Javascript inline comments - if ($has_tags === TRUE && strpos(strtolower($open_tag), 'script') !== FALSE) { - $lines = preg_split('/((\r?\n)|(\n?\r))/',$output); - foreach ($lines as &$line){ + if ($has_tags === TRUE && strpos(strtolower($open_tag), 'script') !== FALSE) + { + $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++){ - if ( ! $in_string && ! $in_dstring && substr($line,$i,2) === '//'){ - $line = substr($line,0,$i); + for ($i=0; $i<$len; $i++) + { + if ( ! $in_string && ! $in_dstring && substr($line, $i, 2) === '//') + { + $line = substr($line, 0, $i); break; } - if ( $line[$i]==="'" && ! $in_dstring ) + if ($line[$i] === "'" && ! $in_dstring) $in_string = ! $in_string; - else if ( $line[$i]==='"' && ! $in_string ) + elseif ($line[$i] === '"' && ! $in_string) $in_dstring = ! $in_dstring; } } - $output = implode("\n",$lines); + $output = implode("\n", $lines); } // Remove spaces around curly brackets, colons, |