Changeset 2661602
- Timestamp:
- 01/21/2022 10:32:18 PM (4 years ago)
- Location:
- debloat
- Files:
-
- 16 edited
- 1 copied
-
tags/1.1.8 (copied) (copied from debloat/trunk)
-
tags/1.1.8/inc/optimize-css/optimize-css.php (modified) (1 diff)
-
tags/1.1.8/inc/optimize-css/stylesheet.php (modified) (4 diffs)
-
tags/1.1.8/inc/plugin.php (modified) (1 diff)
-
tags/1.1.8/readme.txt (modified) (2 diffs)
-
tags/1.1.8/vendor/autoload.php (modified) (1 diff)
-
tags/1.1.8/vendor/composer/autoload_real.php (modified) (3 diffs)
-
tags/1.1.8/vendor/composer/autoload_static.php (modified) (2 diffs)
-
tags/1.1.8/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/inc/optimize-css/optimize-css.php (modified) (1 diff)
-
trunk/inc/optimize-css/stylesheet.php (modified) (4 diffs)
-
trunk/inc/plugin.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (3 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
debloat/tags/1.1.8/inc/optimize-css/optimize-css.php
r2586653 r2661602 223 223 $stylesheets = []; 224 224 225 $nodes = $this->dom->xpath->query("//link[@rel='stylesheet']"); 226 foreach ($nodes as $node) { 227 /** @var \DOMElement $node */ 228 $elements[] = $node; 229 230 if (!$node->hasAttributes()) { 231 continue; 232 } 233 234 $url = $node->getAttribute('href'); 235 if (!$url) { 236 continue; 237 } 238 239 $sheet = new Stylesheet($node->getAttribute('id'), $url); 240 $sheet->media = $node->getAttribute('media'); 241 225 // Note: Can't use DOM parser as htmlentities in the URLs will be removed and 226 // replacing won't be possible later. 227 preg_match_all('#<link[^>]*stylesheet[^>]*>#Usi', $this->html, $matches); 228 229 foreach ($matches[0] as $sheet) { 230 $sheet = Stylesheet::from_tag($sheet); 242 231 $stylesheets[] = $sheet; 243 232 } -
debloat/tags/1.1.8/inc/optimize-css/stylesheet.php
r2586653 r2661602 2 2 3 3 namespace Sphere\Debloat\OptimizeCss; 4 4 5 use Sphere\Debloat\Base\Asset; 6 use Sphere\Debloat\Util; 5 7 6 8 /** … … 69 71 { 70 72 $this->id = $id; 71 $this->url = $url;72 73 $this->orig_url = $url; 74 75 // Cleaned URL. 76 $this->url = html_entity_decode($url); 73 77 74 78 if (!$this->id) { … … 78 82 $this->is_google_fonts = stripos($this->url, 'fonts.googleapis.com/css') !== false; 79 83 } 84 85 /** 86 * Factory method: Create an instance provided an HTML tag. 87 * 88 * @param string $tag 89 * @return boolean|self 90 */ 91 public static function from_tag(string $tag) 92 { 93 $attrs = Util\parse_attrs($tag); 94 95 if (!isset($attrs['href'])) { 96 return false; 97 } 98 99 $sheet = new self($attrs['id'] ?? '', $attrs['href']); 100 $sheet->media = $attrs['media'] ?? ''; 101 102 return $sheet; 103 } 80 104 81 105 public function render() … … 141 165 return ''; 142 166 } 167 168 unset($attrs['rel']); 143 169 144 170 return sprintf( -
debloat/tags/1.1.8/inc/plugin.php
r2659670 r2661602 23 23 * Plugin version 24 24 */ 25 const VERSION = '1.1. 7';25 const VERSION = '1.1.8'; 26 26 27 27 public static $instance; -
debloat/tags/1.1.8/readme.txt
r2659670 r2661602 5 5 Tested up to: 5.8 6 6 Requires PHP: 7.1 7 Stable tag: 1.1. 77 Stable tag: 1.1.8 8 8 License: GPLv2 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 43 43 == Changelog == 44 44 45 = 1.1.8 = 46 * Fixed: Google Fonts inline feature when additional parameters present in URL. 47 * Improved: Strip unnecessary rel=stylesheet in inline styles. 48 45 49 = 1.1.7 = 46 50 * Added: Option to defer inline scripts - useful if some dependent inline scripts not registered using WordPress enqueues. -
debloat/tags/1.1.8/vendor/autoload.php
r2659670 r2661602 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit b5165a72e4e7a49504d364a6f407b6f9::getLoader();7 return ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762::getLoader(); -
debloat/tags/1.1.8/vendor/composer/autoload_real.php
r2659670 r2661602 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit b5165a72e4e7a49504d364a6f407b6f95 class ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit b5165a72e4e7a49504d364a6f407b6f9', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit b5165a72e4e7a49504d364a6f407b6f9', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit b5165a72e4e7a49504d364a6f407b6f9::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInitfb42188779ae2a20c09a1098f300d762::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; -
debloat/tags/1.1.8/vendor/composer/autoload_static.php
r2659670 r2661602 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit b5165a72e4e7a49504d364a6f407b6f97 class ComposerStaticInitfb42188779ae2a20c09a1098f300d762 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 89 89 { 90 90 return \Closure::bind(function () use ($loader) { 91 $loader->prefixLengthsPsr4 = ComposerStaticInit b5165a72e4e7a49504d364a6f407b6f9::$prefixLengthsPsr4;92 $loader->prefixDirsPsr4 = ComposerStaticInit b5165a72e4e7a49504d364a6f407b6f9::$prefixDirsPsr4;93 $loader->classMap = ComposerStaticInit b5165a72e4e7a49504d364a6f407b6f9::$classMap;91 $loader->prefixLengthsPsr4 = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$prefixLengthsPsr4; 92 $loader->prefixDirsPsr4 = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$prefixDirsPsr4; 93 $loader->classMap = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$classMap; 94 94 95 95 }, null, ClassLoader::class); -
debloat/tags/1.1.8/vendor/composer/installed.php
r2659670 r2661602 1 1 <?php return array( 2 2 'root' => array( 3 'pretty_version' => '1.1. 7',4 'version' => '1.1. 7.0',3 'pretty_version' => '1.1.8', 4 'version' => '1.1.8.0', 5 5 'type' => 'library', 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => ' 8bfb016c965ea75dac44eae5acc4933e91b3ee21',8 'reference' => '1146e233d19c045a191d3a04e2af69ec61e87700', 9 9 'name' => '__root__', 10 10 'dev' => true, … … 12 12 'versions' => array( 13 13 '__root__' => array( 14 'pretty_version' => '1.1. 7',15 'version' => '1.1. 7.0',14 'pretty_version' => '1.1.8', 15 'version' => '1.1.8.0', 16 16 'type' => 'library', 17 17 'install_path' => __DIR__ . '/../../', 18 18 'aliases' => array(), 19 'reference' => ' 8bfb016c965ea75dac44eae5acc4933e91b3ee21',19 'reference' => '1146e233d19c045a191d3a04e2af69ec61e87700', 20 20 'dev_requirement' => false, 21 21 ), -
debloat/trunk/inc/optimize-css/optimize-css.php
r2586653 r2661602 223 223 $stylesheets = []; 224 224 225 $nodes = $this->dom->xpath->query("//link[@rel='stylesheet']"); 226 foreach ($nodes as $node) { 227 /** @var \DOMElement $node */ 228 $elements[] = $node; 229 230 if (!$node->hasAttributes()) { 231 continue; 232 } 233 234 $url = $node->getAttribute('href'); 235 if (!$url) { 236 continue; 237 } 238 239 $sheet = new Stylesheet($node->getAttribute('id'), $url); 240 $sheet->media = $node->getAttribute('media'); 241 225 // Note: Can't use DOM parser as htmlentities in the URLs will be removed and 226 // replacing won't be possible later. 227 preg_match_all('#<link[^>]*stylesheet[^>]*>#Usi', $this->html, $matches); 228 229 foreach ($matches[0] as $sheet) { 230 $sheet = Stylesheet::from_tag($sheet); 242 231 $stylesheets[] = $sheet; 243 232 } -
debloat/trunk/inc/optimize-css/stylesheet.php
r2586653 r2661602 2 2 3 3 namespace Sphere\Debloat\OptimizeCss; 4 4 5 use Sphere\Debloat\Base\Asset; 6 use Sphere\Debloat\Util; 5 7 6 8 /** … … 69 71 { 70 72 $this->id = $id; 71 $this->url = $url;72 73 $this->orig_url = $url; 74 75 // Cleaned URL. 76 $this->url = html_entity_decode($url); 73 77 74 78 if (!$this->id) { … … 78 82 $this->is_google_fonts = stripos($this->url, 'fonts.googleapis.com/css') !== false; 79 83 } 84 85 /** 86 * Factory method: Create an instance provided an HTML tag. 87 * 88 * @param string $tag 89 * @return boolean|self 90 */ 91 public static function from_tag(string $tag) 92 { 93 $attrs = Util\parse_attrs($tag); 94 95 if (!isset($attrs['href'])) { 96 return false; 97 } 98 99 $sheet = new self($attrs['id'] ?? '', $attrs['href']); 100 $sheet->media = $attrs['media'] ?? ''; 101 102 return $sheet; 103 } 80 104 81 105 public function render() … … 141 165 return ''; 142 166 } 167 168 unset($attrs['rel']); 143 169 144 170 return sprintf( -
debloat/trunk/inc/plugin.php
r2659670 r2661602 23 23 * Plugin version 24 24 */ 25 const VERSION = '1.1. 7';25 const VERSION = '1.1.8'; 26 26 27 27 public static $instance; -
debloat/trunk/readme.txt
r2659670 r2661602 5 5 Tested up to: 5.8 6 6 Requires PHP: 7.1 7 Stable tag: 1.1. 77 Stable tag: 1.1.8 8 8 License: GPLv2 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 43 43 == Changelog == 44 44 45 = 1.1.8 = 46 * Fixed: Google Fonts inline feature when additional parameters present in URL. 47 * Improved: Strip unnecessary rel=stylesheet in inline styles. 48 45 49 = 1.1.7 = 46 50 * Added: Option to defer inline scripts - useful if some dependent inline scripts not registered using WordPress enqueues. -
debloat/trunk/vendor/autoload.php
r2659670 r2661602 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit b5165a72e4e7a49504d364a6f407b6f9::getLoader();7 return ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762::getLoader(); -
debloat/trunk/vendor/composer/autoload_real.php
r2659670 r2661602 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit b5165a72e4e7a49504d364a6f407b6f95 class ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit b5165a72e4e7a49504d364a6f407b6f9', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit b5165a72e4e7a49504d364a6f407b6f9', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit b5165a72e4e7a49504d364a6f407b6f9::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInitfb42188779ae2a20c09a1098f300d762::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; -
debloat/trunk/vendor/composer/autoload_static.php
r2659670 r2661602 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit b5165a72e4e7a49504d364a6f407b6f97 class ComposerStaticInitfb42188779ae2a20c09a1098f300d762 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 89 89 { 90 90 return \Closure::bind(function () use ($loader) { 91 $loader->prefixLengthsPsr4 = ComposerStaticInit b5165a72e4e7a49504d364a6f407b6f9::$prefixLengthsPsr4;92 $loader->prefixDirsPsr4 = ComposerStaticInit b5165a72e4e7a49504d364a6f407b6f9::$prefixDirsPsr4;93 $loader->classMap = ComposerStaticInit b5165a72e4e7a49504d364a6f407b6f9::$classMap;91 $loader->prefixLengthsPsr4 = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$prefixLengthsPsr4; 92 $loader->prefixDirsPsr4 = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$prefixDirsPsr4; 93 $loader->classMap = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$classMap; 94 94 95 95 }, null, ClassLoader::class); -
debloat/trunk/vendor/composer/installed.php
r2659670 r2661602 1 1 <?php return array( 2 2 'root' => array( 3 'pretty_version' => '1.1. 7',4 'version' => '1.1. 7.0',3 'pretty_version' => '1.1.8', 4 'version' => '1.1.8.0', 5 5 'type' => 'library', 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => ' 8bfb016c965ea75dac44eae5acc4933e91b3ee21',8 'reference' => '1146e233d19c045a191d3a04e2af69ec61e87700', 9 9 'name' => '__root__', 10 10 'dev' => true, … … 12 12 'versions' => array( 13 13 '__root__' => array( 14 'pretty_version' => '1.1. 7',15 'version' => '1.1. 7.0',14 'pretty_version' => '1.1.8', 15 'version' => '1.1.8.0', 16 16 'type' => 'library', 17 17 'install_path' => __DIR__ . '/../../', 18 18 'aliases' => array(), 19 'reference' => ' 8bfb016c965ea75dac44eae5acc4933e91b3ee21',19 'reference' => '1146e233d19c045a191d3a04e2af69ec61e87700', 20 20 'dev_requirement' => false, 21 21 ),
Note: See TracChangeset
for help on using the changeset viewer.