@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | public function __construct($raise_php_limits = TRUE) |
| 44 | 44 | { |
| 45 | 45 | // Set suggested PHP limits |
| 46 | - $this->memory_limit = 128 * 1048576; // 128MB in bytes |
|
| 46 | + $this->memory_limit = 128*1048576; // 128MB in bytes |
|
| 47 | 47 | $this->max_execution_time = 60; // 1 min |
| 48 | - $this->pcre_backtrack_limit = 1000 * 1000; |
|
| 49 | - $this->pcre_recursion_limit = 500 * 1000; |
|
| 48 | + $this->pcre_backtrack_limit = 1000*1000; |
|
| 49 | + $this->pcre_recursion_limit = 500*1000; |
|
| 50 | 50 | |
| 51 | 51 | $this->raise_php_limits = (bool) $raise_php_limits; |
| 52 | 52 | } |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | $comment_found = $this->str_slice($css, $start_index + 2, $end_index); |
| 85 | 85 | $this->comments[] = $comment_found; |
| 86 | - $comment_preserve_string = self::COMMENT . (count($this->comments) - 1) . '___'; |
|
| 87 | - $css = $this->str_slice($css, 0, $start_index + 2) . $comment_preserve_string . $this->str_slice($css, $end_index); |
|
| 86 | + $comment_preserve_string = self::COMMENT.(count($this->comments) - 1).'___'; |
|
| 87 | + $css = $this->str_slice($css, 0, $start_index + 2).$comment_preserve_string.$this->str_slice($css, $end_index); |
|
| 88 | 88 | // Set correct start_index: Fixes issue #2528130 |
| 89 | 89 | $start_index = $end_index + 2 + strlen($comment_preserve_string) - strlen($comment_found); |
| 90 | 90 | } |
@@ -137,14 +137,14 @@ discard block |
||
| 137 | 137 | $css_chunks[$i] = $this->minify($css_chunks[$i], $linebreak_pos); |
| 138 | 138 | // Keep the first @charset at-rule found |
| 139 | 139 | if (empty($charset) && preg_match($charset_regexp, $css_chunks[$i], $matches)) { |
| 140 | - $charset = strtolower($matches[1]) . $matches[2]; |
|
| 140 | + $charset = strtolower($matches[1]).$matches[2]; |
|
| 141 | 141 | } |
| 142 | 142 | // Delete all @charset at-rules |
| 143 | 143 | $css_chunks[$i] = preg_replace($charset_regexp, '', $css_chunks[$i]); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // Update the first chunk and push the charset to the top of the file. |
| 147 | - $css_chunks[0] = $charset . $css_chunks[0]; |
|
| 147 | + $css_chunks[0] = $charset.$css_chunks[0]; |
|
| 148 | 148 | |
| 149 | 149 | return implode('', $css_chunks); |
| 150 | 150 | } |
@@ -219,17 +219,17 @@ discard block |
||
| 219 | 219 | for ($i = 0, $max = count($this->comments); $i < $max; $i++) { |
| 220 | 220 | |
| 221 | 221 | $token = $this->comments[$i]; |
| 222 | - $placeholder = '/' . self::COMMENT . $i . '___/'; |
|
| 222 | + $placeholder = '/'.self::COMMENT.$i.'___/'; |
|
| 223 | 223 | |
| 224 | 224 | // ! in the first position of the comment means preserve |
| 225 | 225 | // so push to the preserved tokens keeping the ! |
| 226 | 226 | if (substr($token, 0, 1) === '!') { |
| 227 | 227 | $this->preserved_tokens[] = $token; |
| 228 | - $token_tring = self::TOKEN . (count($this->preserved_tokens) - 1) . '___'; |
|
| 228 | + $token_tring = self::TOKEN.(count($this->preserved_tokens) - 1).'___'; |
|
| 229 | 229 | $css = preg_replace($placeholder, $token_tring, $css, 1); |
| 230 | 230 | // Preserve new lines for /*! important comments |
| 231 | - $css = preg_replace('/\s*[\n\r\f]+\s*(\/\*'. $token_tring .')/S', self::NL.'$1', $css); |
|
| 232 | - $css = preg_replace('/('. $token_tring .'\*\/)\s*[\n\r\f]+\s*/', '$1'.self::NL, $css); |
|
| 231 | + $css = preg_replace('/\s*[\n\r\f]+\s*(\/\*'.$token_tring.')/S', self::NL.'$1', $css); |
|
| 232 | + $css = preg_replace('/('.$token_tring.'\*\/)\s*[\n\r\f]+\s*/', '$1'.self::NL, $css); |
|
| 233 | 233 | continue; |
| 234 | 234 | } |
| 235 | 235 | |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | // shorten that to /*\*/ and the next one to /**/ |
| 238 | 238 | if (substr($token, (strlen($token) - 1), 1) === '\\') { |
| 239 | 239 | $this->preserved_tokens[] = '\\'; |
| 240 | - $css = preg_replace($placeholder, self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1); |
|
| 240 | + $css = preg_replace($placeholder, self::TOKEN.(count($this->preserved_tokens) - 1).'___', $css, 1); |
|
| 241 | 241 | $i = $i + 1; // attn: advancing the loop |
| 242 | 242 | $this->preserved_tokens[] = ''; |
| 243 | - $css = preg_replace('/' . self::COMMENT . $i . '___/', self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1); |
|
| 243 | + $css = preg_replace('/'.self::COMMENT.$i.'___/', self::TOKEN.(count($this->preserved_tokens) - 1).'___', $css, 1); |
|
| 244 | 244 | continue; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | if ($start_index > 2) { |
| 252 | 252 | if (substr($css, $start_index - 3, 1) === '>') { |
| 253 | 253 | $this->preserved_tokens[] = ''; |
| 254 | - $css = preg_replace($placeholder, self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1); |
|
| 254 | + $css = preg_replace($placeholder, self::TOKEN.(count($this->preserved_tokens) - 1).'___', $css, 1); |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // in all other cases kill the comment |
| 260 | - $css = preg_replace('/\/\*' . $this->str_slice($placeholder, 1, -1) . '\*\//', '', $css, 1); |
|
| 260 | + $css = preg_replace('/\/\*'.$this->str_slice($placeholder, 1, -1).'\*\//', '', $css, 1); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $css = preg_replace('/\s+/', ' ', $css); |
| 266 | 266 | |
| 267 | 267 | // preserve flex, keeping percentage even if 0 |
| 268 | - $css = preg_replace_callback('/flex\s?:\s?((?:[0-9 ]*)\s?(?:px|em|auto|%)?(?:calc\(.*\))?)/i',array($this, 'replace_flex'),$css); |
|
| 268 | + $css = preg_replace_callback('/flex\s?:\s?((?:[0-9 ]*)\s?(?:px|em|auto|%)?(?:calc\(.*\))?)/i', array($this, 'replace_flex'), $css); |
|
| 269 | 269 | |
| 270 | 270 | // Fix IE7 issue on matrix filters which browser accept whitespaces between Matrix parameters |
| 271 | 271 | $css = preg_replace_callback('/\s*filter\:\s*progid:DXImageTransform\.Microsoft\.Matrix\(([^\)]+)\)/', array($this, 'preserve_old_IE_specific_matrix_definition'), $css); |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $css = preg_replace('/\!important/i', ' !important', $css); |
| 304 | 304 | |
| 305 | 305 | // bring back the colon |
| 306 | - $css = preg_replace('/' . self::CLASSCOLON . '/', ':', $css); |
|
| 306 | + $css = preg_replace('/'.self::CLASSCOLON.'/', ':', $css); |
|
| 307 | 307 | |
| 308 | 308 | // retain space for special IE6 cases |
| 309 | 309 | $css = preg_replace_callback('/\:first\-(line|letter)(\{|,)/i', array($this, 'lowercase_pseudo_first'), $css); |
@@ -376,20 +376,20 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | // Find a fraction that is used for Opera's -o-device-pixel-ratio query |
| 378 | 378 | // Add token to add the "\" back in later |
| 379 | - $css = preg_replace('/\(([a-z\-]+):([0-9]+)\/([0-9]+)\)/i', '($1:$2'. self::QUERY_FRACTION .'$3)', $css); |
|
| 379 | + $css = preg_replace('/\(([a-z\-]+):([0-9]+)\/([0-9]+)\)/i', '($1:$2'.self::QUERY_FRACTION.'$3)', $css); |
|
| 380 | 380 | |
| 381 | 381 | // Remove empty rules. |
| 382 | 382 | $css = preg_replace('/[^\};\{\/]+\{\}/S', '', $css); |
| 383 | 383 | |
| 384 | 384 | // Add "/" back to fix Opera -o-device-pixel-ratio query |
| 385 | - $css = preg_replace('/'. self::QUERY_FRACTION .'/', '/', $css); |
|
| 385 | + $css = preg_replace('/'.self::QUERY_FRACTION.'/', '/', $css); |
|
| 386 | 386 | |
| 387 | 387 | // Replace multiple semi-colons in a row by a single one |
| 388 | 388 | // See SF bug #1980989 |
| 389 | 389 | $css = preg_replace('/;;+/', ';', $css); |
| 390 | 390 | |
| 391 | 391 | // Restore new lines for /*! important comments |
| 392 | - $css = preg_replace('/'. self::NL .'/', "\n", $css); |
|
| 392 | + $css = preg_replace('/'.self::NL.'/', "\n", $css); |
|
| 393 | 393 | |
| 394 | 394 | // Lowercase all uppercase properties |
| 395 | 395 | $css = preg_replace_callback('/(\{|\;)([A-Z\-]+)(\:)/', array($this, 'lowercase_properties'), $css); |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | while ($i < strlen($css)) { |
| 404 | 404 | $i++; |
| 405 | 405 | if ($css[$i - 1] === '}' && $i - $start_index > $linebreak_pos) { |
| 406 | - $css = $this->str_slice($css, 0, $i) . "\n" . $this->str_slice($css, $i); |
|
| 406 | + $css = $this->str_slice($css, 0, $i)."\n".$this->str_slice($css, $i); |
|
| 407 | 407 | $start_index = $i; |
| 408 | 408 | } |
| 409 | 409 | } |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | // restore preserved comments and strings in reverse order |
| 413 | 413 | for ($i = count($this->preserved_tokens) - 1; $i >= 0; $i--) { |
| 414 | - $css = preg_replace('/' . self::TOKEN . $i . '___/', $this->preserved_tokens[$i], $css, 1); |
|
| 414 | + $css = preg_replace('/'.self::TOKEN.$i.'___/', $this->preserved_tokens[$i], $css, 1); |
|
| 415 | 415 | // $css.=$this->preserved_tokens[$i]; |
| 416 | 416 | } |
| 417 | 417 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $terminator = ')'; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - while ($found_terminator === FALSE && $end_index+1 <= $max_index) { |
|
| 455 | + while ($found_terminator === FALSE && $end_index + 1 <= $max_index) { |
|
| 456 | 456 | $end_index = $this->index_of($css, $terminator, $end_index + 1); |
| 457 | 457 | |
| 458 | 458 | // endIndex == 0 doesn't really apply here |
@@ -469,12 +469,12 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | if ($found_terminator) { |
| 471 | 471 | $token = $this->str_slice($css, $start_index, $end_index); |
| 472 | - if (strpos($token,"<svg")===false && strpos($token,'svg+xml')===false) { |
|
| 472 | + if (strpos($token, "<svg") === false && strpos($token, 'svg+xml') === false) { |
|
| 473 | 473 | $token = preg_replace('/\s+/', '', $token); |
| 474 | 474 | } |
| 475 | 475 | $this->preserved_tokens[] = $token; |
| 476 | 476 | |
| 477 | - $preserver = 'url(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___)'; |
|
| 477 | + $preserver = 'url('.self::TOKEN.(count($this->preserved_tokens) - 1).'___)'; |
|
| 478 | 478 | $sb[] = $preserver; |
| 479 | 479 | |
| 480 | 480 | $append_index = $end_index + 1; |
@@ -536,16 +536,16 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | if ($is_filter) { |
| 538 | 538 | // Restore, maintain case, otherwise filter will break |
| 539 | - $sb[] = $m[1] . '#' . $m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7]; |
|
| 539 | + $sb[] = $m[1].'#'.$m[2].$m[3].$m[4].$m[5].$m[6].$m[7]; |
|
| 540 | 540 | } else { |
| 541 | 541 | if (strtolower($m[2]) == strtolower($m[3]) && |
| 542 | 542 | strtolower($m[4]) == strtolower($m[5]) && |
| 543 | 543 | strtolower($m[6]) == strtolower($m[7])) { |
| 544 | 544 | // Compress. |
| 545 | - $hex = '#' . strtolower($m[3] . $m[5] . $m[7]); |
|
| 545 | + $hex = '#'.strtolower($m[3].$m[5].$m[7]); |
|
| 546 | 546 | } else { |
| 547 | 547 | // Non compressible color, restore but lower case. |
| 548 | - $hex = '#' . strtolower($m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7]); |
|
| 548 | + $hex = '#'.strtolower($m[2].$m[3].$m[4].$m[5].$m[6].$m[7]); |
|
| 549 | 549 | } |
| 550 | 550 | // replace Hex colors to short safe color names |
| 551 | 551 | $sb[] = array_key_exists($hex, $short_safe) ? $short_safe[$hex] : $hex; |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | // one, maybe more? put'em back then |
| 575 | 575 | if (($pos = $this->index_of($match, self::COMMENT)) >= 0) { |
| 576 | 576 | for ($i = 0, $max = count($this->comments); $i < $max; $i++) { |
| 577 | - $match = preg_replace('/' . self::COMMENT . $i . '___/', $this->comments[$i], $match, 1); |
|
| 577 | + $match = preg_replace('/'.self::COMMENT.$i.'___/', $this->comments[$i], $match, 1); |
|
| 578 | 578 | } |
| 579 | 579 | } |
| 580 | 580 | |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | $match = preg_replace('/progid\:DXImageTransform\.Microsoft\.Alpha\(Opacity\=/i', 'alpha(opacity=', $match); |
| 583 | 583 | |
| 584 | 584 | $this->preserved_tokens[] = $match; |
| 585 | - return $quote . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . $quote; |
|
| 585 | + return $quote.self::TOKEN.(count($this->preserved_tokens) - 1).'___'.$quote; |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | private function replace_colon($matches) |
@@ -592,34 +592,34 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | private function replace_calc($matches) |
| 594 | 594 | { |
| 595 | - $this->preserved_tokens[] = preg_replace('/\)([\+\-]{1})/',') $1',preg_replace('/([\+\-]{1})\(/','$1 (',trim(preg_replace('/\s*([\*\/\(\),])\s*/', '$1', $matches[2])))); |
|
| 596 | - return 'calc('. self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')'; |
|
| 595 | + $this->preserved_tokens[] = preg_replace('/\)([\+\-]{1})/', ') $1', preg_replace('/([\+\-]{1})\(/', '$1 (', trim(preg_replace('/\s*([\*\/\(\),])\s*/', '$1', $matches[2])))); |
|
| 596 | + return 'calc('.self::TOKEN.(count($this->preserved_tokens) - 1).'___'.')'; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | private function replace_flex($matches) |
| 600 | 600 | { |
| 601 | 601 | $this->preserved_tokens[] = trim($matches[1]); |
| 602 | - return 'flex:'.self::TOKEN . (count($this->preserved_tokens) - 1) . '___'; |
|
| 602 | + return 'flex:'.self::TOKEN.(count($this->preserved_tokens) - 1).'___'; |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | private function preserve_old_IE_specific_matrix_definition($matches) |
| 606 | 606 | { |
| 607 | 607 | $this->preserved_tokens[] = $matches[1]; |
| 608 | - return 'filter:progid:DXImageTransform.Microsoft.Matrix(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')'; |
|
| 608 | + return 'filter:progid:DXImageTransform.Microsoft.Matrix('.self::TOKEN.(count($this->preserved_tokens) - 1).'___'.')'; |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | private function replace_keyframe_zero($matches) |
| 612 | 612 | { |
| 613 | - return $matches[1] . preg_replace('/0(\{|,[^\)\{]+\{)/', '0%$1', $matches[2]) . $matches[3]; |
|
| 613 | + return $matches[1].preg_replace('/0(\{|,[^\)\{]+\{)/', '0%$1', $matches[2]).$matches[3]; |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | private function rgb_to_hex($matches) |
| 617 | 617 | { |
| 618 | 618 | // Support for percentage values rgb(100%, 0%, 45%); |
| 619 | - if ($this->index_of($matches[1], '%') >= 0){ |
|
| 619 | + if ($this->index_of($matches[1], '%') >= 0) { |
|
| 620 | 620 | $rgbcolors = explode(',', str_replace('%', '', $matches[1])); |
| 621 | 621 | for ($i = 0; $i < count($rgbcolors); $i++) { |
| 622 | - $rgbcolors[$i] = $this->round_number(floatval($rgbcolors[$i]) * 2.55); |
|
| 622 | + $rgbcolors[$i] = $this->round_number(floatval($rgbcolors[$i])*2.55); |
|
| 623 | 623 | } |
| 624 | 624 | } else { |
| 625 | 625 | $rgbcolors = explode(',', $matches[1]); |
@@ -632,11 +632,11 @@ discard block |
||
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | // Fix for issue #2528093 |
| 635 | - if (!preg_match('/[\s\,\);\}]/', $matches[2])){ |
|
| 636 | - $matches[2] = ' ' . $matches[2]; |
|
| 635 | + if (!preg_match('/[\s\,\);\}]/', $matches[2])) { |
|
| 636 | + $matches[2] = ' '.$matches[2]; |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - return '#' . implode('', $rgbcolors) . $matches[2]; |
|
| 639 | + return '#'.implode('', $rgbcolors).$matches[2]; |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | private function hsl_to_hex($matches) |
@@ -647,18 +647,18 @@ discard block |
||
| 647 | 647 | $l = floatval($values[2]); |
| 648 | 648 | |
| 649 | 649 | // Wrap and clamp, then fraction! |
| 650 | - $h = ((($h % 360) + 360) % 360) / 360; |
|
| 651 | - $s = $this->clamp_number($s, 0, 100) / 100; |
|
| 652 | - $l = $this->clamp_number($l, 0, 100) / 100; |
|
| 650 | + $h = ((($h%360) + 360)%360)/360; |
|
| 651 | + $s = $this->clamp_number($s, 0, 100)/100; |
|
| 652 | + $l = $this->clamp_number($l, 0, 100)/100; |
|
| 653 | 653 | |
| 654 | 654 | if ($s == 0) { |
| 655 | - $r = $g = $b = $this->round_number(255 * $l); |
|
| 655 | + $r = $g = $b = $this->round_number(255*$l); |
|
| 656 | 656 | } else { |
| 657 | - $v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l); |
|
| 658 | - $v1 = (2 * $l) - $v2; |
|
| 659 | - $r = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h + (1/3))); |
|
| 660 | - $g = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h)); |
|
| 661 | - $b = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h - (1/3))); |
|
| 657 | + $v2 = $l < 0.5 ? $l*(1 + $s) : ($l + $s) - ($s*$l); |
|
| 658 | + $v1 = (2*$l) - $v2; |
|
| 659 | + $r = $this->round_number(255*$this->hue_to_rgb($v1, $v2, $h + (1/3))); |
|
| 660 | + $g = $this->round_number(255*$this->hue_to_rgb($v1, $v2, $h)); |
|
| 661 | + $b = $this->round_number(255*$this->hue_to_rgb($v1, $v2, $h - (1/3))); |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | return $this->rgb_to_hex(array('', $r.','.$g.','.$b, $matches[2])); |
@@ -666,27 +666,27 @@ discard block |
||
| 666 | 666 | |
| 667 | 667 | private function lowercase_pseudo_first($matches) |
| 668 | 668 | { |
| 669 | - return ':first-'. strtolower($matches[1]) .' '. $matches[2]; |
|
| 669 | + return ':first-'.strtolower($matches[1]).' '.$matches[2]; |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | private function lowercase_directives($matches) |
| 673 | 673 | { |
| 674 | - return '@'. strtolower($matches[1]); |
|
| 674 | + return '@'.strtolower($matches[1]); |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | private function lowercase_pseudo_elements($matches) |
| 678 | 678 | { |
| 679 | - return ':'. strtolower($matches[1]); |
|
| 679 | + return ':'.strtolower($matches[1]); |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | private function lowercase_common_functions($matches) |
| 683 | 683 | { |
| 684 | - return ':'. strtolower($matches[1]) .'('; |
|
| 684 | + return ':'.strtolower($matches[1]).'('; |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | private function lowercase_common_functions_values($matches) |
| 688 | 688 | { |
| 689 | - return $matches[1] . strtolower($matches[2]); |
|
| 689 | + return $matches[1].strtolower($matches[2]); |
|
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | private function lowercase_properties($matches) |
@@ -701,9 +701,9 @@ discard block |
||
| 701 | 701 | private function hue_to_rgb($v1, $v2, $vh) |
| 702 | 702 | { |
| 703 | 703 | $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh); |
| 704 | - if ($vh * 6 < 1) return $v1 + ($v2 - $v1) * 6 * $vh; |
|
| 705 | - if ($vh * 2 < 1) return $v2; |
|
| 706 | - if ($vh * 3 < 2) return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6; |
|
| 704 | + if ($vh*6 < 1) return $v1 + ($v2 - $v1)*6*$vh; |
|
| 705 | + if ($vh*2 < 1) return $v2; |
|
| 706 | + if ($vh*3 < 2) return $v1 + ($v2 - $v1)*((2/3) - $vh)*6; |
|
| 707 | 707 | return $v1; |
| 708 | 708 | } |
| 709 | 709 | |
@@ -778,9 +778,9 @@ discard block |
||
| 778 | 778 | { |
| 779 | 779 | if (is_string($size)) { |
| 780 | 780 | switch (substr($size, -1)) { |
| 781 | - case 'M': case 'm': return (int) $size * 1048576; |
|
| 782 | - case 'K': case 'k': return (int) $size * 1024; |
|
| 783 | - case 'G': case 'g': return (int) $size * 1073741824; |
|
| 781 | + case 'M': case 'm': return (int) $size*1048576; |
|
| 782 | + case 'K': case 'k': return (int) $size*1024; |
|
| 783 | + case 'G': case 'g': return (int) $size*1073741824; |
|
| 784 | 784 | } |
| 785 | 785 | } |
| 786 | 786 | |