From c5768dbab1f026db1bc3aa3908454eaecbc9006c Mon Sep 17 00:00:00 2001 From: judge Date: Thu, 12 Sep 2013 14:43:43 +0200 Subject: Fixed coding style --- system/core/Output.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'system/core/Output.php') 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); } -- cgit v1.2.3-24-g4f1b