summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/core/Output.php32
-rw-r--r--system/core/Security.php6
2 files changed, 14 insertions, 24 deletions
diff --git a/system/core/Output.php b/system/core/Output.php
index 2793d4132..9367e3b43 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -710,9 +710,7 @@ class CI_Output {
{
case 'text/html':
- $size_before = strlen($output);
-
- if ($size_before === 0)
+ if (($size_before = strlen($output)) === 0)
{
return '';
}
@@ -792,7 +790,6 @@ class CI_Output {
return $output;
}
-
// --------------------------------------------------------------------
/**
@@ -805,8 +802,8 @@ class CI_Output {
* the string initially and saved without stripping whitespace to preserve
* the tags and any associated properties if tags are present
*
- * @param string $output Output to minify
- * @param bool $has_tags specify if the output has style or script tags
+ * @param string $output Output to minify
+ * @param bool $has_tags Specify if the output has style or script tags
* @return string Minified output
*/
protected function _minify_script_style($output, $has_tags = FALSE)
@@ -827,15 +824,14 @@ class CI_Output {
}
// Remove CSS comments
- $output = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $output);
+ $output = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!i', '', $output);
// Remove spaces around curly brackets, colons,
// semi-colons, parenthesis, commas
- $output = preg_replace('!\s*(:|;|,|}|{|\(|\))\s*!', '$1', $output);
+ $output = preg_replace('!\s*(:|;|,|}|{|\(|\))\s*!i', '$1', $output);
// Remove spaces
- $in_string = FALSE;
- $in_dstring = FALSE;
+ $in_string = $in_dstring = FALSE;
$array_output = str_split($output);
foreach ($array_output as $key => $value)
{
@@ -851,25 +847,19 @@ class CI_Output {
{
$in_string = ! $in_string;
}
-
- if ($value === '"')
+ elseif ($value === '"')
{
$in_dstring = ! $in_dstring;
}
}
- $output = implode($array_output);
-
// Remove breaklines and tabs
- $output = preg_replace('/[\r\n\t]/', '', $output);
+ $output = preg_replace('/[\r\n\t]/', '', implode($array_output));
// Put the opening and closing tags back if applicable
- if (isset($open_tag))
- {
- $output = $open_tag.$output.$closing_tag;
- }
-
- return $output;
+ return isset($open_tag)
+ ? $open_tag.$output.$closing_tag
+ : $output;
}
}
diff --git a/system/core/Security.php b/system/core/Security.php
index 5ae8e653c..7c929b6ca 100644
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -534,7 +534,7 @@ class CI_Security {
$str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str, -1, $matches);
$str = preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str, -1, $matches1);
}
- while($matches OR $matches1);
+ while ($matches OR $matches1);
return $str;
}
@@ -671,8 +671,8 @@ class CI_Security {
{
$str = preg_replace('/(<?)(\/?[^><]+?)([^A-Za-z<>\-])(.*?)('.implode('|', $attribs).')(.*?)([\s><]?)([><]*)/i', '$1$2 $4$6$7$8', $str, -1, $count);
}
-
- } while ($count);
+ }
+ while ($count);
return $str;
}