Changeset 3160589
- Timestamp:
- 10/01/2024 10:44:17 AM (18 months ago)
- Location:
- powered-cache
- Files:
-
- 2 added
- 34 edited
- 1 copied
-
tags/3.5.2 (copied) (copied from powered-cache/trunk)
-
tags/3.5.2/includes/classes/Dependencies/MatthiasMullie/Minify/CSS.php (modified) (4 diffs)
-
tags/3.5.2/includes/classes/Dependencies/MatthiasMullie/Minify/JS.php (modified) (1 diff)
-
tags/3.5.2/includes/classes/Dependencies/MatthiasMullie/Minify/Minify.php (modified) (3 diffs)
-
tags/3.5.2/includes/classes/Dependencies/voku/helper/AbstractDomParser.php (modified) (1 diff)
-
tags/3.5.2/includes/classes/Dependencies/voku/helper/AbstractSimpleHtmlDom.php (modified) (2 diffs)
-
tags/3.5.2/includes/classes/Dependencies/voku/helper/HtmlDomHelper.php (modified) (2 diffs)
-
tags/3.5.2/includes/classes/Dependencies/voku/helper/HtmlDomParser.php (modified) (4 diffs)
-
tags/3.5.2/includes/classes/Dependencies/voku/helper/HtmlMin.php (modified) (2 diffs)
-
tags/3.5.2/includes/classes/Dependencies/voku/helper/HtmlMinDomObserverOptimizeAttributes.php (modified) (1 diff)
-
tags/3.5.2/includes/classes/Dependencies/voku/helper/SimpleHtmlDom.php (modified) (2 diffs)
-
tags/3.5.2/includes/classes/Dependencies/voku/helper/SimpleHtmlDomBlank.php (modified) (1 diff)
-
tags/3.5.2/includes/classes/Dependencies/voku/helper/SimpleHtmlDomInterface.php (modified) (1 diff)
-
tags/3.5.2/includes/classes/Dependencies/voku/helper/XmlDomParser.php (modified) (1 diff)
-
tags/3.5.2/includes/compat/loader.php (modified) (1 diff)
-
tags/3.5.2/includes/compat/plugins/clear-cache-for-widgets.php (added)
-
tags/3.5.2/languages/powered-cache.pot (modified) (3 diffs)
-
tags/3.5.2/powered-cache.php (modified) (2 diffs)
-
tags/3.5.2/readme.txt (modified) (2 diffs)
-
trunk/includes/classes/Dependencies/MatthiasMullie/Minify/CSS.php (modified) (4 diffs)
-
trunk/includes/classes/Dependencies/MatthiasMullie/Minify/JS.php (modified) (1 diff)
-
trunk/includes/classes/Dependencies/MatthiasMullie/Minify/Minify.php (modified) (3 diffs)
-
trunk/includes/classes/Dependencies/voku/helper/AbstractDomParser.php (modified) (1 diff)
-
trunk/includes/classes/Dependencies/voku/helper/AbstractSimpleHtmlDom.php (modified) (2 diffs)
-
trunk/includes/classes/Dependencies/voku/helper/HtmlDomHelper.php (modified) (2 diffs)
-
trunk/includes/classes/Dependencies/voku/helper/HtmlDomParser.php (modified) (4 diffs)
-
trunk/includes/classes/Dependencies/voku/helper/HtmlMin.php (modified) (2 diffs)
-
trunk/includes/classes/Dependencies/voku/helper/HtmlMinDomObserverOptimizeAttributes.php (modified) (1 diff)
-
trunk/includes/classes/Dependencies/voku/helper/SimpleHtmlDom.php (modified) (2 diffs)
-
trunk/includes/classes/Dependencies/voku/helper/SimpleHtmlDomBlank.php (modified) (1 diff)
-
trunk/includes/classes/Dependencies/voku/helper/SimpleHtmlDomInterface.php (modified) (1 diff)
-
trunk/includes/classes/Dependencies/voku/helper/XmlDomParser.php (modified) (1 diff)
-
trunk/includes/compat/loader.php (modified) (1 diff)
-
trunk/includes/compat/plugins/clear-cache-for-widgets.php (added)
-
trunk/languages/powered-cache.pot (modified) (3 diffs)
-
trunk/powered-cache.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
powered-cache/tags/3.5.2/includes/classes/Dependencies/MatthiasMullie/Minify/CSS.php
r2940671 r3160589 107 107 * Combine CSS from import statements. 108 108 * 109 * Import statements will be loaded and their content merged into the original110 * file,to save HTTP requests.109 * \@import's will be loaded and their content merged into the original file, 110 * to save HTTP requests. 111 111 * 112 112 * @param string $source The file to combine imports for … … 317 317 318 318 $css = $this->stripWhitespace($css); 319 $css = $this->shortenColors($css); 319 $css = $this->convertLegacyColors($css); 320 $css = $this->cleanupModernColors($css); 321 $css = $this->shortenHEXColors($css); 320 322 $css = $this->shortenZeroes($css); 321 323 $css = $this->shortenFontWeights($css); … … 481 483 482 484 /** 483 * Shorthand hex color codes. 484 * #FF0000 -> #F00. 485 * 486 * @param string $content The CSS content to shorten the hex color codes for 487 * 488 * @return string 489 */ 490 protected function shortenColors($content) 491 { 492 $content = preg_replace('/(?<=[: ])#([0-9a-z])\\1([0-9a-z])\\2([0-9a-z])\\3(?:([0-9a-z])\\4)?(?=[; }])/i', '#$1$2$3$4', $content); 493 494 // remove alpha channel if it's pointless... 495 $content = preg_replace('/(?<=[: ])#([0-9a-z]{6})ff?(?=[; }])/i', '#$1', $content); 496 $content = preg_replace('/(?<=[: ])#([0-9a-z]{3})f?(?=[; }])/i', '#$1', $content); 485 * Shorthand HEX color codes. 486 * #FF0000FF -> #f00 -> red 487 * #FF00FF00 -> transparent. 488 * 489 * @param string $content The CSS content to shorten the HEX color codes for 490 * 491 * @return string 492 */ 493 protected function shortenHexColors($content) 494 { 495 // shorten repeating patterns within HEX .. 496 $content = preg_replace('/(?<=[: ])#([0-9a-f])\\1([0-9a-f])\\2([0-9a-f])\\3(?:([0-9a-f])\\4)?(?=[; }])/i', '#$1$2$3$4', $content); 497 498 // remove alpha channel if it's pointless .. 499 $content = preg_replace('/(?<=[: ])#([0-9a-f]{6})ff(?=[; }])/i', '#$1', $content); 500 $content = preg_replace('/(?<=[: ])#([0-9a-f]{3})f(?=[; }])/i', '#$1', $content); 501 502 // replace `transparent` with shortcut .. 503 $content = preg_replace('/(?<=[: ])#[0-9a-f]{6}00(?=[; }])/i', '#fff0', $content); 497 504 498 505 $colors = array( 506 // make these more readable 507 '#00f' => 'blue', 508 '#dc143c' => 'crimson', 509 '#0ff' => 'cyan', 510 '#8b0000' => 'darkred', 511 '#696969' => 'dimgray', 512 '#ff69b4' => 'hotpink', 513 '#0f0' => 'lime', 514 '#fdf5e6' => 'oldlace', 515 '#87ceeb' => 'skyblue', 516 '#d8bfd8' => 'thistle', 499 517 // we can shorten some even more by replacing them with their color name 500 '#F0FFFF' => 'azure', 501 '#F5F5DC' => 'beige', 502 '#A52A2A' => 'brown', 503 '#FF7F50' => 'coral', 504 '#FFD700' => 'gold', 518 '#f0ffff' => 'azure', 519 '#f5f5dc' => 'beige', 520 '#ffe4c4' => 'bisque', 521 '#a52a2a' => 'brown', 522 '#ff7f50' => 'coral', 523 '#ffd700' => 'gold', 505 524 '#808080' => 'gray', 506 525 '#008000' => 'green', 507 '#4 B0082' => 'indigo',508 '# FFFFF0' => 'ivory',509 '# F0E68C' => 'khaki',510 '# FAF0E6' => 'linen',526 '#4b0082' => 'indigo', 527 '#fffff0' => 'ivory', 528 '#f0e68c' => 'khaki', 529 '#faf0e6' => 'linen', 511 530 '#800000' => 'maroon', 512 531 '#000080' => 'navy', 513 532 '#808000' => 'olive', 514 '#CD853F' => 'peru', 515 '#FFC0CB' => 'pink', 516 '#DDA0DD' => 'plum', 533 '#ffa500' => 'orange', 534 '#da70d6' => 'orchid', 535 '#cd853f' => 'peru', 536 '#ffc0cb' => 'pink', 537 '#dda0dd' => 'plum', 517 538 '#800080' => 'purple', 518 '#F00' => 'red', 519 '#FA8072' => 'salmon', 520 '#A0522D' => 'sienna', 521 '#C0C0C0' => 'silver', 522 '#FFFAFA' => 'snow', 523 '#D2B48C' => 'tan', 524 '#FF6347' => 'tomato', 525 '#EE82EE' => 'violet', 526 '#F5DEB3' => 'wheat', 539 '#f00' => 'red', 540 '#fa8072' => 'salmon', 541 '#a0522d' => 'sienna', 542 '#c0c0c0' => 'silver', 543 '#fffafa' => 'snow', 544 '#d2b48c' => 'tan', 545 '#008080' => 'teal', 546 '#ff6347' => 'tomato', 547 '#ee82ee' => 'violet', 548 '#f5deb3' => 'wheat', 527 549 // or the other way around 528 'WHITE' => '#fff', 529 'BLACK' => '#000', 550 'black' => '#000', 551 'fuchsia' => '#f0f', 552 'magenta' => '#f0f', 553 'white' => '#fff', 554 'yellow' => '#ff0', 555 // and also `transparent` 556 'transparent' => '#fff0', 530 557 ); 531 558 … … 533 560 '/(?<=[: ])(' . implode('|', array_keys($colors)) . ')(?=[; }])/i', 534 561 function ($match) use ($colors) { 535 return $colors[strto upper($match[0])];562 return $colors[strtolower($match[0])]; 536 563 }, 537 564 $content 538 565 ); 566 } 567 568 /** 569 * Convert RGB|HSL color codes. 570 * rgb(255,0,0,.5) -> rgb(255 0 0 / .5). 571 * rgb(255,0,0) -> #f00. 572 * 573 * @param string $content The CSS content to shorten the RGB color codes for 574 * 575 * @return string 576 */ 577 protected function convertLegacyColors($content) 578 { 579 /* 580 https://drafts.csswg.org/css-color/#color-syntax-legacy 581 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb 582 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hsl 583 */ 584 585 // convert legacy color syntax 586 $content = preg_replace('/(rgb)a?\(\s*([0-9]{1,3}%?)\s*,\s*([0-9]{1,3}%?)\s*,\s*([0-9]{1,3}%?)\s*,\s*([0,1]?(?:\.[0-9]*)?)\s*\)/i', '$1($2 $3 $4 / $5)', $content); 587 $content = preg_replace('/(rgb)a?\(\s*([0-9]{1,3}%?)\s*,\s*([0-9]{1,3}%?)\s*,\s*([0-9]{1,3}%?)\s*\)/i', '$1($2 $3 $4)', $content); 588 $content = preg_replace('/(hsl)a?\(\s*([0-9]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9]{1,3}%)\s*,\s*([0-9]{1,3}%)\s*,\s*([0,1]?(?:\.[0-9]*)?)\s*\)/i', '$1($2 $3 $4 / $5)', $content); 589 $content = preg_replace('/(hsl)a?\(\s*([0-9]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9]{1,3}%)\s*,\s*([0-9]{1,3}%)\s*\)/i', '$1($2 $3 $4)', $content); 590 591 // convert `rgb` to `hex` 592 $dec = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])'; 593 return preg_replace_callback( 594 "/rgb\($dec $dec $dec\)/i", 595 function ($match) { 596 return sprintf('#%02x%02x%02x', $match[1], $match[2], $match[3]); 597 }, 598 $content 599 ); 600 } 601 602 /** 603 * Cleanup RGB|HSL|HWB|LCH|LAB 604 * rgb(255 0 0 / 1) -> rgb(255 0 0). 605 * rgb(255 0 0 / 0) -> transparent. 606 * 607 * @param string $content The CSS content to cleanup HSL|HWB|LCH|LAB 608 * 609 * @return string 610 */ 611 protected function cleanupModernColors($content) 612 { 613 /* 614 https://drafts.csswg.org/css-color/#color-syntax-modern 615 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb 616 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch 617 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lab 618 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch 619 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklab 620 */ 621 $tag = '(rgb|hsl|hwb|(?:(?:ok)?(?:lch|lab)))'; 622 623 // remove alpha channel if it's pointless .. 624 $content = preg_replace('/' . $tag . '\(\s*([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+\/\s+1(?:(?:\.\d?)*|00%)?\s*\)/i', '$1($2 $3 $4)', $content); 625 626 // replace `transparent` with shortcut .. 627 $content = preg_replace('/' . $tag . '\(\s*[^\s]+\s+[^\s]+\s+[^\s]+\s+\/\s+0(?:[\.0%]*)?\s*\)/i', '#fff0', $content); 628 629 return $content; 539 630 } 540 631 -
powered-cache/tags/3.5.2/includes/classes/Dependencies/MatthiasMullie/Minify/JS.php
r2940671 r3160589 123 123 protected $operatorsAfter = array(); 124 124 125 /**126 * {@inheritdoc}127 */128 125 public function __construct() 129 126 { -
powered-cache/tags/3.5.2/includes/classes/Dependencies/MatthiasMullie/Minify/Minify.php
r2940671 r3160589 271 271 $callback = function ($match) use ($minifier) { 272 272 $count = count($minifier->extracted); 273 $placeholder = '/*' .$count.'*/';273 $placeholder = '/*' . $count . '*/'; 274 274 $minifier->extracted[$placeholder] = $match[0]; 275 275 … … 495 495 if ( 496 496 // file is elsewhere 497 isset($parsed['host']) ||497 isset($parsed['host']) 498 498 // file responds to queries (may change, or need to bypass cache) 499 isset($parsed['query'])499 || isset($parsed['query']) 500 500 ) { 501 501 return false; 502 502 } 503 503 504 return strlen($path) < PHP_MAXPATHLEN && @is_file($path) && is_readable($path); 504 try { 505 return strlen($path) < PHP_MAXPATHLEN && @is_file($path) && is_readable($path); 506 } 507 // catch openbasedir exceptions which are not caught by @ on is_file() 508 catch (\Exception $e) { 509 return false; 510 } 505 511 } 506 512 … … 535 541 { 536 542 if ( 537 !is_resource($handler) ||538 ($result = @fwrite($handler, $content)) === false ||539 ($result < strlen($content))543 !is_resource($handler) 544 || ($result = @fwrite($handler, $content)) === false 545 || ($result < strlen($content)) 540 546 ) { 541 547 throw new IOException('The file "' . $path . '" could not be written to. Check your disk space and file permissions.'); -
powered-cache/tags/3.5.2/includes/classes/Dependencies/voku/helper/AbstractDomParser.php
r2912480 r3160589 498 498 499 499 if (\strpos($html, 'http') !== false) { 500 501 500 // regEx for e.g.: [https://www.domain.de/foo.php?foobar=1&email=lars%40moelleken.org&guid=test1233312&{{foo}}#foo] 502 501 $regExUrl = '/(\[?\bhttps?:\/\/[^\s<>]+(?:\(\w+\)|[^[:punct:]\s]|\/|}|]))/i'; -
powered-cache/tags/3.5.2/includes/classes/Dependencies/voku/helper/AbstractSimpleHtmlDom.php
r2912480 r3160589 22 22 'innerhtml' => 'innerHtml', 23 23 'innerhtmlkeep' => 'innerHtmlKeep', 24 ]; 25 26 /** 27 * @var string[] 28 */ 29 protected static $stringDomNodes = [ 30 'id', 31 'prefix', 32 'content' 24 33 ]; 25 34 … … 168 177 if ($this->node && \property_exists($this->node, $nameOrig)) { 169 178 // INFO: Cannot assign null to property DOMNode::* of type string 170 if ( $nameOrig === 'prefix' || $nameOrig === 'textContent') {179 if (in_array($nameOrig, self::$stringDomNodes)) { 171 180 $value = (string)$value; 172 181 } 173 182 174 return $this->node->{$nameOrig} = $value; 183 if (!is_null($value)) { 184 return $this->node->{$nameOrig} = $value; 185 } 175 186 } 176 187 -
powered-cache/tags/3.5.2/includes/classes/Dependencies/voku/helper/HtmlDomHelper.php
r2912480 r3160589 7 7 final class HtmlDomHelper 8 8 { 9 10 9 /** 11 10 * @param string $html … … 66 65 67 66 foreach ($attributes as $attributeName => $attributeValue) { 68 $domElement->setAttribute($attributeName, $attributeValue );67 $domElement->setAttribute($attributeName, $attributeValue, true); 69 68 } 70 69 -
powered-cache/tags/3.5.2/includes/classes/Dependencies/voku/helper/HtmlDomParser.php
r2912480 r3160589 76 76 * protected $specialScriptTags = [ 77 77 * 'text/html', 78 * 'text/template', 78 79 * 'text/x-custom-template', 79 80 * 'text/x-handlebars-template' … … 85 86 protected $specialScriptTags = [ 86 87 'text/html', 88 'text/template', 87 89 'text/x-custom-template', 88 90 'text/x-handlebars-template', … … 479 481 480 482 if ($documentFound === false) { 481 482 483 // UTF-8 hack: http://php.net/manual/en/domdocument.loadhtml.php#95251 483 484 $xmlHackUsed = false; … … 1125 1126 '/(?<start>(<script [^>]*type=["\']?(?:' . $tags . ')+[^>]*>))(?<innerContent>.*)(?<end><\/script>)/isU', 1126 1127 function ($matches) { 1127 1128 1128 // Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>], 1129 1129 // because often this looks like non-valid html in the template itself. -
powered-cache/tags/3.5.2/includes/classes/Dependencies/voku/helper/HtmlMin.php
r2912480 r3160589 1652 1652 1653 1653 foreach ($dom->findMulti('*') as $element) { 1654 1655 1654 // ------------------------------------------------------------------------- 1656 1655 // Remove whitespace around tags. [protected html is still protected] … … 1715 1714 } 1716 1715 1717 $ this->protectedChildNodes[$this->protected_tags_counter] = $element->parentNode()->innerHtml();1718 $parentNode = $element->getNode()->parentNode;1719 if ($parentNode !== null) {1716 $parentNode = $element->parentNode(); 1717 if ($parentNode->nodeValue !== null) { 1718 $this->protectedChildNodes[$this->protected_tags_counter] = $parentNode->innerHtml(); 1720 1719 $parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; 1721 1720 } -
powered-cache/tags/3.5.2/includes/classes/Dependencies/voku/helper/HtmlMinDomObserverOptimizeAttributes.php
r3074892 r3160589 59 59 $attrs = []; 60 60 foreach ((array) $attributes as $attrName => $attrValue) { 61 62 61 // ------------------------------------------------------------------------- 63 62 // Remove local domains from attributes. -
powered-cache/tags/3.5.2/includes/classes/Dependencies/voku/helper/SimpleHtmlDom.php
r2912480 r3160589 685 685 * Returns the parent of node. 686 686 * 687 * @return SimpleHtmlDomInterface 688 */ 689 public function parentNode(): SimpleHtmlDomInterface 690 { 691 return new static($this->node->parentNode); 687 * @return SimpleHtmlDomInterface|null 688 */ 689 public function parentNode(): ?SimpleHtmlDomInterface 690 { 691 if ($node = $this->node->parentNode) { 692 return new static($node); 693 } 694 695 return null; 692 696 } 693 697 … … 832 836 $newDocument->getIsDOMDocumentCreatedWithoutHtmlWrapper() 833 837 ) { 834 835 838 // Remove doc-type node. 836 839 if ($newDocument->getDocument()->doctype !== null) { -
powered-cache/tags/3.5.2/includes/classes/Dependencies/voku/helper/SimpleHtmlDomBlank.php
r2912480 r3160589 403 403 * Returns the parent of node. 404 404 * 405 * @return SimpleHtmlDomInterface 406 */ 407 public function parentNode(): SimpleHtmlDomInterface405 * @return SimpleHtmlDomInterface|null 406 */ 407 public function parentNode(): ?SimpleHtmlDomInterface 408 408 { 409 409 return new static(); -
powered-cache/tags/3.5.2/includes/classes/Dependencies/voku/helper/SimpleHtmlDomInterface.php
r2912480 r3160589 325 325 * Returns the parent of node. 326 326 * 327 * @return SimpleHtmlDomInterface 328 */ 329 public function parentNode(): self;327 * @return SimpleHtmlDomInterface|null 328 */ 329 public function parentNode(): ?self; 330 330 331 331 /** -
powered-cache/tags/3.5.2/includes/classes/Dependencies/voku/helper/XmlDomParser.php
r2912480 r3160589 205 205 206 206 if ($documentFound === false) { 207 208 207 // UTF-8 hack: http://php.net/manual/en/domdocument.loadhtml.php#95251 209 208 $xmlHackUsed = false; -
powered-cache/tags/3.5.2/includes/compat/loader.php
r3038477 r3160589 21 21 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/autoptimize.php'; 22 22 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/bj-lazy-load.php'; 23 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/clear-cache-for-widgets.php'; 23 24 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/lazy-load.php'; 24 25 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/rocket-lazy-load.php'; -
powered-cache/tags/3.5.2/languages/powered-cache.pot
r3135643 r3160589 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Powered Cache 3.5. 1\n"5 "Project-Id-Version: Powered Cache 3.5.2\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/powered-cache\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2024- 08-14T14:56:13+00:00\n"12 "POT-Creation-Date: 2024-10-01T10:33:24+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.10.0\n" … … 1601 1601 1602 1602 #. translators: %1$s plugin name, %2$s conflicted feature name (Eg lazyload) 1603 #: includes/compat/loader.php:6 81603 #: includes/compat/loader.php:69 1604 1604 msgid "It seems %1$s is activated on your site. Powered Cache works perfectly fine with %1$s but you cannot use %2$s functionalities that conflic with %1$s plugin unless you deactivate it." 1605 1605 msgstr "" -
powered-cache/tags/3.5.2/powered-cache.php
r3135643 r3160589 4 4 * Plugin URI: https://poweredcache.com 5 5 * Description: Powered Cache is the most powerful caching and performance suite for WordPress, designed to easily improve your PageSpeed and Web Vitals Score. 6 * Version: 3.5. 16 * Version: 3.5.2 7 7 * Requires at least: 5.7 8 8 * Requires PHP: 7.2.5 … … 26 26 27 27 // Useful global constants. 28 define( 'POWERED_CACHE_VERSION', '3.5. 1' );28 define( 'POWERED_CACHE_VERSION', '3.5.2' ); 29 29 define( 'POWERED_CACHE_DB_VERSION', '3.4' ); 30 30 define( 'POWERED_CACHE_PLUGIN_FILE', __FILE__ ); -
powered-cache/tags/3.5.2/readme.txt
r3135643 r3160589 4 4 Requires at least: 5.7 5 5 Tested up to: 6.6 6 Stable tag: 3.5. 16 Stable tag: 3.5.2 7 7 License: GPLv2 (or later) 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 171 171 172 172 == Changelog == 173 174 = 3.5.2 (October 01, 2024) = 175 - [Added] Clear Cache for Me compatibility. 176 - [Updated] Minifier libraries. 177 - Various dependency updates. 173 178 174 179 = 3.5.1 (August 14, 2024) = -
powered-cache/trunk/includes/classes/Dependencies/MatthiasMullie/Minify/CSS.php
r2940671 r3160589 107 107 * Combine CSS from import statements. 108 108 * 109 * Import statements will be loaded and their content merged into the original110 * file,to save HTTP requests.109 * \@import's will be loaded and their content merged into the original file, 110 * to save HTTP requests. 111 111 * 112 112 * @param string $source The file to combine imports for … … 317 317 318 318 $css = $this->stripWhitespace($css); 319 $css = $this->shortenColors($css); 319 $css = $this->convertLegacyColors($css); 320 $css = $this->cleanupModernColors($css); 321 $css = $this->shortenHEXColors($css); 320 322 $css = $this->shortenZeroes($css); 321 323 $css = $this->shortenFontWeights($css); … … 481 483 482 484 /** 483 * Shorthand hex color codes. 484 * #FF0000 -> #F00. 485 * 486 * @param string $content The CSS content to shorten the hex color codes for 487 * 488 * @return string 489 */ 490 protected function shortenColors($content) 491 { 492 $content = preg_replace('/(?<=[: ])#([0-9a-z])\\1([0-9a-z])\\2([0-9a-z])\\3(?:([0-9a-z])\\4)?(?=[; }])/i', '#$1$2$3$4', $content); 493 494 // remove alpha channel if it's pointless... 495 $content = preg_replace('/(?<=[: ])#([0-9a-z]{6})ff?(?=[; }])/i', '#$1', $content); 496 $content = preg_replace('/(?<=[: ])#([0-9a-z]{3})f?(?=[; }])/i', '#$1', $content); 485 * Shorthand HEX color codes. 486 * #FF0000FF -> #f00 -> red 487 * #FF00FF00 -> transparent. 488 * 489 * @param string $content The CSS content to shorten the HEX color codes for 490 * 491 * @return string 492 */ 493 protected function shortenHexColors($content) 494 { 495 // shorten repeating patterns within HEX .. 496 $content = preg_replace('/(?<=[: ])#([0-9a-f])\\1([0-9a-f])\\2([0-9a-f])\\3(?:([0-9a-f])\\4)?(?=[; }])/i', '#$1$2$3$4', $content); 497 498 // remove alpha channel if it's pointless .. 499 $content = preg_replace('/(?<=[: ])#([0-9a-f]{6})ff(?=[; }])/i', '#$1', $content); 500 $content = preg_replace('/(?<=[: ])#([0-9a-f]{3})f(?=[; }])/i', '#$1', $content); 501 502 // replace `transparent` with shortcut .. 503 $content = preg_replace('/(?<=[: ])#[0-9a-f]{6}00(?=[; }])/i', '#fff0', $content); 497 504 498 505 $colors = array( 506 // make these more readable 507 '#00f' => 'blue', 508 '#dc143c' => 'crimson', 509 '#0ff' => 'cyan', 510 '#8b0000' => 'darkred', 511 '#696969' => 'dimgray', 512 '#ff69b4' => 'hotpink', 513 '#0f0' => 'lime', 514 '#fdf5e6' => 'oldlace', 515 '#87ceeb' => 'skyblue', 516 '#d8bfd8' => 'thistle', 499 517 // we can shorten some even more by replacing them with their color name 500 '#F0FFFF' => 'azure', 501 '#F5F5DC' => 'beige', 502 '#A52A2A' => 'brown', 503 '#FF7F50' => 'coral', 504 '#FFD700' => 'gold', 518 '#f0ffff' => 'azure', 519 '#f5f5dc' => 'beige', 520 '#ffe4c4' => 'bisque', 521 '#a52a2a' => 'brown', 522 '#ff7f50' => 'coral', 523 '#ffd700' => 'gold', 505 524 '#808080' => 'gray', 506 525 '#008000' => 'green', 507 '#4 B0082' => 'indigo',508 '# FFFFF0' => 'ivory',509 '# F0E68C' => 'khaki',510 '# FAF0E6' => 'linen',526 '#4b0082' => 'indigo', 527 '#fffff0' => 'ivory', 528 '#f0e68c' => 'khaki', 529 '#faf0e6' => 'linen', 511 530 '#800000' => 'maroon', 512 531 '#000080' => 'navy', 513 532 '#808000' => 'olive', 514 '#CD853F' => 'peru', 515 '#FFC0CB' => 'pink', 516 '#DDA0DD' => 'plum', 533 '#ffa500' => 'orange', 534 '#da70d6' => 'orchid', 535 '#cd853f' => 'peru', 536 '#ffc0cb' => 'pink', 537 '#dda0dd' => 'plum', 517 538 '#800080' => 'purple', 518 '#F00' => 'red', 519 '#FA8072' => 'salmon', 520 '#A0522D' => 'sienna', 521 '#C0C0C0' => 'silver', 522 '#FFFAFA' => 'snow', 523 '#D2B48C' => 'tan', 524 '#FF6347' => 'tomato', 525 '#EE82EE' => 'violet', 526 '#F5DEB3' => 'wheat', 539 '#f00' => 'red', 540 '#fa8072' => 'salmon', 541 '#a0522d' => 'sienna', 542 '#c0c0c0' => 'silver', 543 '#fffafa' => 'snow', 544 '#d2b48c' => 'tan', 545 '#008080' => 'teal', 546 '#ff6347' => 'tomato', 547 '#ee82ee' => 'violet', 548 '#f5deb3' => 'wheat', 527 549 // or the other way around 528 'WHITE' => '#fff', 529 'BLACK' => '#000', 550 'black' => '#000', 551 'fuchsia' => '#f0f', 552 'magenta' => '#f0f', 553 'white' => '#fff', 554 'yellow' => '#ff0', 555 // and also `transparent` 556 'transparent' => '#fff0', 530 557 ); 531 558 … … 533 560 '/(?<=[: ])(' . implode('|', array_keys($colors)) . ')(?=[; }])/i', 534 561 function ($match) use ($colors) { 535 return $colors[strto upper($match[0])];562 return $colors[strtolower($match[0])]; 536 563 }, 537 564 $content 538 565 ); 566 } 567 568 /** 569 * Convert RGB|HSL color codes. 570 * rgb(255,0,0,.5) -> rgb(255 0 0 / .5). 571 * rgb(255,0,0) -> #f00. 572 * 573 * @param string $content The CSS content to shorten the RGB color codes for 574 * 575 * @return string 576 */ 577 protected function convertLegacyColors($content) 578 { 579 /* 580 https://drafts.csswg.org/css-color/#color-syntax-legacy 581 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb 582 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hsl 583 */ 584 585 // convert legacy color syntax 586 $content = preg_replace('/(rgb)a?\(\s*([0-9]{1,3}%?)\s*,\s*([0-9]{1,3}%?)\s*,\s*([0-9]{1,3}%?)\s*,\s*([0,1]?(?:\.[0-9]*)?)\s*\)/i', '$1($2 $3 $4 / $5)', $content); 587 $content = preg_replace('/(rgb)a?\(\s*([0-9]{1,3}%?)\s*,\s*([0-9]{1,3}%?)\s*,\s*([0-9]{1,3}%?)\s*\)/i', '$1($2 $3 $4)', $content); 588 $content = preg_replace('/(hsl)a?\(\s*([0-9]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9]{1,3}%)\s*,\s*([0-9]{1,3}%)\s*,\s*([0,1]?(?:\.[0-9]*)?)\s*\)/i', '$1($2 $3 $4 / $5)', $content); 589 $content = preg_replace('/(hsl)a?\(\s*([0-9]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9]{1,3}%)\s*,\s*([0-9]{1,3}%)\s*\)/i', '$1($2 $3 $4)', $content); 590 591 // convert `rgb` to `hex` 592 $dec = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])'; 593 return preg_replace_callback( 594 "/rgb\($dec $dec $dec\)/i", 595 function ($match) { 596 return sprintf('#%02x%02x%02x', $match[1], $match[2], $match[3]); 597 }, 598 $content 599 ); 600 } 601 602 /** 603 * Cleanup RGB|HSL|HWB|LCH|LAB 604 * rgb(255 0 0 / 1) -> rgb(255 0 0). 605 * rgb(255 0 0 / 0) -> transparent. 606 * 607 * @param string $content The CSS content to cleanup HSL|HWB|LCH|LAB 608 * 609 * @return string 610 */ 611 protected function cleanupModernColors($content) 612 { 613 /* 614 https://drafts.csswg.org/css-color/#color-syntax-modern 615 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb 616 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch 617 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lab 618 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch 619 https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklab 620 */ 621 $tag = '(rgb|hsl|hwb|(?:(?:ok)?(?:lch|lab)))'; 622 623 // remove alpha channel if it's pointless .. 624 $content = preg_replace('/' . $tag . '\(\s*([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+\/\s+1(?:(?:\.\d?)*|00%)?\s*\)/i', '$1($2 $3 $4)', $content); 625 626 // replace `transparent` with shortcut .. 627 $content = preg_replace('/' . $tag . '\(\s*[^\s]+\s+[^\s]+\s+[^\s]+\s+\/\s+0(?:[\.0%]*)?\s*\)/i', '#fff0', $content); 628 629 return $content; 539 630 } 540 631 -
powered-cache/trunk/includes/classes/Dependencies/MatthiasMullie/Minify/JS.php
r2940671 r3160589 123 123 protected $operatorsAfter = array(); 124 124 125 /**126 * {@inheritdoc}127 */128 125 public function __construct() 129 126 { -
powered-cache/trunk/includes/classes/Dependencies/MatthiasMullie/Minify/Minify.php
r2940671 r3160589 271 271 $callback = function ($match) use ($minifier) { 272 272 $count = count($minifier->extracted); 273 $placeholder = '/*' .$count.'*/';273 $placeholder = '/*' . $count . '*/'; 274 274 $minifier->extracted[$placeholder] = $match[0]; 275 275 … … 495 495 if ( 496 496 // file is elsewhere 497 isset($parsed['host']) ||497 isset($parsed['host']) 498 498 // file responds to queries (may change, or need to bypass cache) 499 isset($parsed['query'])499 || isset($parsed['query']) 500 500 ) { 501 501 return false; 502 502 } 503 503 504 return strlen($path) < PHP_MAXPATHLEN && @is_file($path) && is_readable($path); 504 try { 505 return strlen($path) < PHP_MAXPATHLEN && @is_file($path) && is_readable($path); 506 } 507 // catch openbasedir exceptions which are not caught by @ on is_file() 508 catch (\Exception $e) { 509 return false; 510 } 505 511 } 506 512 … … 535 541 { 536 542 if ( 537 !is_resource($handler) ||538 ($result = @fwrite($handler, $content)) === false ||539 ($result < strlen($content))543 !is_resource($handler) 544 || ($result = @fwrite($handler, $content)) === false 545 || ($result < strlen($content)) 540 546 ) { 541 547 throw new IOException('The file "' . $path . '" could not be written to. Check your disk space and file permissions.'); -
powered-cache/trunk/includes/classes/Dependencies/voku/helper/AbstractDomParser.php
r2912480 r3160589 498 498 499 499 if (\strpos($html, 'http') !== false) { 500 501 500 // regEx for e.g.: [https://www.domain.de/foo.php?foobar=1&email=lars%40moelleken.org&guid=test1233312&{{foo}}#foo] 502 501 $regExUrl = '/(\[?\bhttps?:\/\/[^\s<>]+(?:\(\w+\)|[^[:punct:]\s]|\/|}|]))/i'; -
powered-cache/trunk/includes/classes/Dependencies/voku/helper/AbstractSimpleHtmlDom.php
r2912480 r3160589 22 22 'innerhtml' => 'innerHtml', 23 23 'innerhtmlkeep' => 'innerHtmlKeep', 24 ]; 25 26 /** 27 * @var string[] 28 */ 29 protected static $stringDomNodes = [ 30 'id', 31 'prefix', 32 'content' 24 33 ]; 25 34 … … 168 177 if ($this->node && \property_exists($this->node, $nameOrig)) { 169 178 // INFO: Cannot assign null to property DOMNode::* of type string 170 if ( $nameOrig === 'prefix' || $nameOrig === 'textContent') {179 if (in_array($nameOrig, self::$stringDomNodes)) { 171 180 $value = (string)$value; 172 181 } 173 182 174 return $this->node->{$nameOrig} = $value; 183 if (!is_null($value)) { 184 return $this->node->{$nameOrig} = $value; 185 } 175 186 } 176 187 -
powered-cache/trunk/includes/classes/Dependencies/voku/helper/HtmlDomHelper.php
r2912480 r3160589 7 7 final class HtmlDomHelper 8 8 { 9 10 9 /** 11 10 * @param string $html … … 66 65 67 66 foreach ($attributes as $attributeName => $attributeValue) { 68 $domElement->setAttribute($attributeName, $attributeValue );67 $domElement->setAttribute($attributeName, $attributeValue, true); 69 68 } 70 69 -
powered-cache/trunk/includes/classes/Dependencies/voku/helper/HtmlDomParser.php
r2912480 r3160589 76 76 * protected $specialScriptTags = [ 77 77 * 'text/html', 78 * 'text/template', 78 79 * 'text/x-custom-template', 79 80 * 'text/x-handlebars-template' … … 85 86 protected $specialScriptTags = [ 86 87 'text/html', 88 'text/template', 87 89 'text/x-custom-template', 88 90 'text/x-handlebars-template', … … 479 481 480 482 if ($documentFound === false) { 481 482 483 // UTF-8 hack: http://php.net/manual/en/domdocument.loadhtml.php#95251 483 484 $xmlHackUsed = false; … … 1125 1126 '/(?<start>(<script [^>]*type=["\']?(?:' . $tags . ')+[^>]*>))(?<innerContent>.*)(?<end><\/script>)/isU', 1126 1127 function ($matches) { 1127 1128 1128 // Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>], 1129 1129 // because often this looks like non-valid html in the template itself. -
powered-cache/trunk/includes/classes/Dependencies/voku/helper/HtmlMin.php
r2912480 r3160589 1652 1652 1653 1653 foreach ($dom->findMulti('*') as $element) { 1654 1655 1654 // ------------------------------------------------------------------------- 1656 1655 // Remove whitespace around tags. [protected html is still protected] … … 1715 1714 } 1716 1715 1717 $ this->protectedChildNodes[$this->protected_tags_counter] = $element->parentNode()->innerHtml();1718 $parentNode = $element->getNode()->parentNode;1719 if ($parentNode !== null) {1716 $parentNode = $element->parentNode(); 1717 if ($parentNode->nodeValue !== null) { 1718 $this->protectedChildNodes[$this->protected_tags_counter] = $parentNode->innerHtml(); 1720 1719 $parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; 1721 1720 } -
powered-cache/trunk/includes/classes/Dependencies/voku/helper/HtmlMinDomObserverOptimizeAttributes.php
r3074892 r3160589 59 59 $attrs = []; 60 60 foreach ((array) $attributes as $attrName => $attrValue) { 61 62 61 // ------------------------------------------------------------------------- 63 62 // Remove local domains from attributes. -
powered-cache/trunk/includes/classes/Dependencies/voku/helper/SimpleHtmlDom.php
r2912480 r3160589 685 685 * Returns the parent of node. 686 686 * 687 * @return SimpleHtmlDomInterface 688 */ 689 public function parentNode(): SimpleHtmlDomInterface 690 { 691 return new static($this->node->parentNode); 687 * @return SimpleHtmlDomInterface|null 688 */ 689 public function parentNode(): ?SimpleHtmlDomInterface 690 { 691 if ($node = $this->node->parentNode) { 692 return new static($node); 693 } 694 695 return null; 692 696 } 693 697 … … 832 836 $newDocument->getIsDOMDocumentCreatedWithoutHtmlWrapper() 833 837 ) { 834 835 838 // Remove doc-type node. 836 839 if ($newDocument->getDocument()->doctype !== null) { -
powered-cache/trunk/includes/classes/Dependencies/voku/helper/SimpleHtmlDomBlank.php
r2912480 r3160589 403 403 * Returns the parent of node. 404 404 * 405 * @return SimpleHtmlDomInterface 406 */ 407 public function parentNode(): SimpleHtmlDomInterface405 * @return SimpleHtmlDomInterface|null 406 */ 407 public function parentNode(): ?SimpleHtmlDomInterface 408 408 { 409 409 return new static(); -
powered-cache/trunk/includes/classes/Dependencies/voku/helper/SimpleHtmlDomInterface.php
r2912480 r3160589 325 325 * Returns the parent of node. 326 326 * 327 * @return SimpleHtmlDomInterface 328 */ 329 public function parentNode(): self;327 * @return SimpleHtmlDomInterface|null 328 */ 329 public function parentNode(): ?self; 330 330 331 331 /** -
powered-cache/trunk/includes/classes/Dependencies/voku/helper/XmlDomParser.php
r2912480 r3160589 205 205 206 206 if ($documentFound === false) { 207 208 207 // UTF-8 hack: http://php.net/manual/en/domdocument.loadhtml.php#95251 209 208 $xmlHackUsed = false; -
powered-cache/trunk/includes/compat/loader.php
r3038477 r3160589 21 21 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/autoptimize.php'; 22 22 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/bj-lazy-load.php'; 23 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/clear-cache-for-widgets.php'; 23 24 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/lazy-load.php'; 24 25 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/rocket-lazy-load.php'; -
powered-cache/trunk/languages/powered-cache.pot
r3135643 r3160589 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Powered Cache 3.5. 1\n"5 "Project-Id-Version: Powered Cache 3.5.2\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/powered-cache\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2024- 08-14T14:56:13+00:00\n"12 "POT-Creation-Date: 2024-10-01T10:33:24+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.10.0\n" … … 1601 1601 1602 1602 #. translators: %1$s plugin name, %2$s conflicted feature name (Eg lazyload) 1603 #: includes/compat/loader.php:6 81603 #: includes/compat/loader.php:69 1604 1604 msgid "It seems %1$s is activated on your site. Powered Cache works perfectly fine with %1$s but you cannot use %2$s functionalities that conflic with %1$s plugin unless you deactivate it." 1605 1605 msgstr "" -
powered-cache/trunk/powered-cache.php
r3135643 r3160589 4 4 * Plugin URI: https://poweredcache.com 5 5 * Description: Powered Cache is the most powerful caching and performance suite for WordPress, designed to easily improve your PageSpeed and Web Vitals Score. 6 * Version: 3.5. 16 * Version: 3.5.2 7 7 * Requires at least: 5.7 8 8 * Requires PHP: 7.2.5 … … 26 26 27 27 // Useful global constants. 28 define( 'POWERED_CACHE_VERSION', '3.5. 1' );28 define( 'POWERED_CACHE_VERSION', '3.5.2' ); 29 29 define( 'POWERED_CACHE_DB_VERSION', '3.4' ); 30 30 define( 'POWERED_CACHE_PLUGIN_FILE', __FILE__ ); -
powered-cache/trunk/readme.txt
r3135643 r3160589 4 4 Requires at least: 5.7 5 5 Tested up to: 6.6 6 Stable tag: 3.5. 16 Stable tag: 3.5.2 7 7 License: GPLv2 (or later) 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 171 171 172 172 == Changelog == 173 174 = 3.5.2 (October 01, 2024) = 175 - [Added] Clear Cache for Me compatibility. 176 - [Updated] Minifier libraries. 177 - Various dependency updates. 173 178 174 179 = 3.5.1 (August 14, 2024) =
Note: See TracChangeset
for help on using the changeset viewer.