diff options
Diffstat (limited to 'plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php')
-rw-r--r-- | plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php index 176e0fd3..2d7996f0 100644 --- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php +++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php @@ -21,9 +21,9 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. + * along with this program. If not, see <https://www.gnu.org/licenses/>. * - * @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License + * @license https://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License * @package csstidy * @author Florian Schmitz (floele at gmail dot com) 2005-2007 * @author Brett Zamir (brettz9 at yahoo dot com) 2007 @@ -308,8 +308,8 @@ class csstidy_optimise { // #aabbcc -> #abc if (strlen($color) == 7) { $color_temp = strtolower($color); - if ($color_temp{0} === '#' && $color_temp{1} == $color_temp{2} && $color_temp{3} == $color_temp{4} && $color_temp{5} == $color_temp{6}) { - $color = '#' . $color{1} . $color{3} . $color{5}; + if ($color_temp[0] === '#' && $color_temp[1] == $color_temp[2] && $color_temp[3] == $color_temp[4] && $color_temp[5] == $color_temp[6]) { + $color = '#' . $color[1] . $color[3] . $color[5]; } } @@ -392,7 +392,7 @@ class csstidy_optimise { */ function AnalyseCssNumber($string) { // most simple checks first - if (strlen($string) == 0 || ctype_alpha($string{0})) { + if (strlen($string) == 0 || ctype_alpha($string[0])) { return false; } @@ -557,22 +557,22 @@ class csstidy_optimise { for ($i = 0, $len = strlen($string); $i < $len; $i++) { switch ($status) { case 'st': - if ($string{$i} == $sep && !csstidy::escaped($string, $i)) { + if ($string[$i] == $sep && !csstidy::escaped($string, $i)) { ++$num; - } elseif ($string{$i} === '"' || $string{$i} === '\'' || $string{$i} === '(' && !csstidy::escaped($string, $i)) { + } elseif ($string[$i] === '"' || $string[$i] === '\'' || $string[$i] === '(' && !csstidy::escaped($string, $i)) { $status = 'str'; - $to = ($string{$i} === '(') ? ')' : $string{$i}; - (isset($output[$num])) ? $output[$num] .= $string{$i} : $output[$num] = $string{$i}; + $to = ($string[$i] === '(') ? ')' : $string[$i]; + (isset($output[$num])) ? $output[$num] .= $string[$i] : $output[$num] = $string[$i]; } else { - (isset($output[$num])) ? $output[$num] .= $string{$i} : $output[$num] = $string{$i}; + (isset($output[$num])) ? $output[$num] .= $string[$i] : $output[$num] = $string[$i]; } break; case 'str': - if ($string{$i} == $to && !csstidy::escaped($string, $i)) { + if ($string[$i] == $to && !csstidy::escaped($string, $i)) { $status = 'st'; } - (isset($output[$num])) ? $output[$num] .= $string{$i} : $output[$num] = $string{$i}; + (isset($output[$num])) ? $output[$num] .= $string[$i] : $output[$num] = $string[$i]; break; } } @@ -626,6 +626,7 @@ class csstidy_optimise { * @todo full CSS 3 compliance */ static function dissolve_short_bg($str_value) { + $have = array(); // don't try to explose background gradient ! if (stripos($str_value, "gradient(")!==FALSE) return array('background'=>$str_value); @@ -669,9 +670,9 @@ class csstidy_optimise { $have['clip'] = true; } elseif (in_array($str_value[$i][$j], $origin, true)) { $return['background-origin'] .= $str_value[$i][$j] . ','; - } elseif ($str_value[$i][$j]{0} === '(') { + } elseif ($str_value[$i][$j][0] === '(') { $return['background-size'] .= substr($str_value[$i][$j], 1, -1) . ','; - } elseif (in_array($str_value[$i][$j], $pos, true) || is_numeric($str_value[$i][$j]{0}) || $str_value[$i][$j]{0} === null || $str_value[$i][$j]{0} === '-' || $str_value[$i][$j]{0} === '.') { + } elseif (in_array($str_value[$i][$j], $pos, true) || is_numeric($str_value[$i][$j][0]) || $str_value[$i][$j][0] === null || $str_value[$i][$j][0] === '-' || $str_value[$i][$j][0] === '.') { $return['background-position'] .= $str_value[$i][$j]; if (!$have['pos']) $return['background-position'] .= ' '; else @@ -784,6 +785,7 @@ class csstidy_optimise { * @see merge_font() */ static function dissolve_short_font($str_value) { + $have = array(); $font_prop_default = & $GLOBALS['csstidy']['font_prop_default']; $font_weight = array('normal', 'bold', 'bolder', 'lighter', 100, 200, 300, 400, 500, 600, 700, 800, 900); $font_variant = array('normal', 'small-caps'); @@ -818,7 +820,7 @@ class csstidy_optimise { } elseif ($have['style'] === false && in_array($str_value[0][$j], $font_style)) { $return['font-style'] = $str_value[0][$j]; $have['style'] = true; - } elseif ($have['size'] === false && (is_numeric($str_value[0][$j]{0}) || $str_value[0][$j]{0} === null || $str_value[0][$j]{0} === '.')) { + } elseif ($have['size'] === false && (is_numeric($str_value[0][$j][0]) || $str_value[0][$j][0] === null || $str_value[0][$j][0] === '.')) { $size = csstidy_optimise::explode_ws('/', trim($str_value[0][$j])); $return['font-size'] = $size[0]; if (isset($size[1])) { @@ -848,7 +850,7 @@ class csstidy_optimise { // Fix for 100 and more font-size if ($have['size'] === false && isset($return['font-weight']) && - is_numeric($return['font-weight']{0})) { + is_numeric($return['font-weight'][0])) { $return['font-size'] = $return['font-weight']; unset($return['font-weight']); } @@ -884,8 +886,8 @@ class csstidy_optimise { $family = trim($family); $len = strlen($family); if (strpos($family, " ") && - !(($family{0} == '"' && $family{$len - 1} == '"') || - ($family{0} == "'" && $family{$len - 1} == "'"))) { + !(($family[0] == '"' && $family[$len - 1] == '"') || + ($family[0] == "'" && $family[$len - 1] == "'"))) { $family = '"' . $family . '"'; } $result_families[] = $family; |