Plugin Directory

Changeset 2661602


Ignore:
Timestamp:
01/21/2022 10:32:18 PM (4 years ago)
Author:
asadkn
Message:

Update to version 1.1.8 from GitHub

Location:
debloat
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • debloat/tags/1.1.8/inc/optimize-css/optimize-css.php

    r2586653 r2661602  
    223223        $stylesheets = [];
    224224
    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);
    242231            $stylesheets[] = $sheet;
    243232        }
  • debloat/tags/1.1.8/inc/optimize-css/stylesheet.php

    r2586653 r2661602  
    22
    33namespace Sphere\Debloat\OptimizeCss;
     4
    45use Sphere\Debloat\Base\Asset;
     6use Sphere\Debloat\Util;
    57
    68/**
     
    6971    {
    7072        $this->id = $id;
    71         $this->url = $url;
    7273        $this->orig_url = $url;
     74
     75        // Cleaned URL.
     76        $this->url = html_entity_decode($url);
    7377
    7478        if (!$this->id) {
     
    7882        $this->is_google_fonts = stripos($this->url, 'fonts.googleapis.com/css') !== false;
    7983    }
     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    }
    80104
    81105    public function render()
     
    141165                return '';
    142166            }
     167
     168            unset($attrs['rel']);
    143169
    144170            return sprintf(
  • debloat/tags/1.1.8/inc/plugin.php

    r2659670 r2661602  
    2323     * Plugin version
    2424     */
    25     const VERSION = '1.1.7';
     25    const VERSION = '1.1.8';
    2626
    2727    public static $instance;
  • debloat/tags/1.1.8/readme.txt

    r2659670 r2661602  
    55Tested up to: 5.8
    66Requires PHP: 7.1
    7 Stable tag: 1.1.7
     7Stable tag: 1.1.8
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    4343== Changelog ==
    4444
     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
    4549= 1.1.7 =
    4650* 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  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitb5165a72e4e7a49504d364a6f407b6f9::getLoader();
     7return ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762::getLoader();
  • debloat/tags/1.1.8/vendor/composer/autoload_real.php

    r2659670 r2661602  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitb5165a72e4e7a49504d364a6f407b6f9
     5class ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitb5165a72e4e7a49504d364a6f407b6f9', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitb5165a72e4e7a49504d364a6f407b6f9', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInitb5165a72e4e7a49504d364a6f407b6f9::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInitfb42188779ae2a20c09a1098f300d762::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • debloat/tags/1.1.8/vendor/composer/autoload_static.php

    r2659670 r2661602  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitb5165a72e4e7a49504d364a6f407b6f9
     7class ComposerStaticInitfb42188779ae2a20c09a1098f300d762
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    8989    {
    9090        return \Closure::bind(function () use ($loader) {
    91             $loader->prefixLengthsPsr4 = ComposerStaticInitb5165a72e4e7a49504d364a6f407b6f9::$prefixLengthsPsr4;
    92             $loader->prefixDirsPsr4 = ComposerStaticInitb5165a72e4e7a49504d364a6f407b6f9::$prefixDirsPsr4;
    93             $loader->classMap = ComposerStaticInitb5165a72e4e7a49504d364a6f407b6f9::$classMap;
     91            $loader->prefixLengthsPsr4 = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$prefixLengthsPsr4;
     92            $loader->prefixDirsPsr4 = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$prefixDirsPsr4;
     93            $loader->classMap = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$classMap;
    9494
    9595        }, null, ClassLoader::class);
  • debloat/tags/1.1.8/vendor/composer/installed.php

    r2659670 r2661602  
    11<?php return array(
    22    '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',
    55        'type' => 'library',
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => '8bfb016c965ea75dac44eae5acc4933e91b3ee21',
     8        'reference' => '1146e233d19c045a191d3a04e2af69ec61e87700',
    99        'name' => '__root__',
    1010        'dev' => true,
     
    1212    'versions' => array(
    1313        '__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',
    1616            'type' => 'library',
    1717            'install_path' => __DIR__ . '/../../',
    1818            'aliases' => array(),
    19             'reference' => '8bfb016c965ea75dac44eae5acc4933e91b3ee21',
     19            'reference' => '1146e233d19c045a191d3a04e2af69ec61e87700',
    2020            'dev_requirement' => false,
    2121        ),
  • debloat/trunk/inc/optimize-css/optimize-css.php

    r2586653 r2661602  
    223223        $stylesheets = [];
    224224
    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);
    242231            $stylesheets[] = $sheet;
    243232        }
  • debloat/trunk/inc/optimize-css/stylesheet.php

    r2586653 r2661602  
    22
    33namespace Sphere\Debloat\OptimizeCss;
     4
    45use Sphere\Debloat\Base\Asset;
     6use Sphere\Debloat\Util;
    57
    68/**
     
    6971    {
    7072        $this->id = $id;
    71         $this->url = $url;
    7273        $this->orig_url = $url;
     74
     75        // Cleaned URL.
     76        $this->url = html_entity_decode($url);
    7377
    7478        if (!$this->id) {
     
    7882        $this->is_google_fonts = stripos($this->url, 'fonts.googleapis.com/css') !== false;
    7983    }
     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    }
    80104
    81105    public function render()
     
    141165                return '';
    142166            }
     167
     168            unset($attrs['rel']);
    143169
    144170            return sprintf(
  • debloat/trunk/inc/plugin.php

    r2659670 r2661602  
    2323     * Plugin version
    2424     */
    25     const VERSION = '1.1.7';
     25    const VERSION = '1.1.8';
    2626
    2727    public static $instance;
  • debloat/trunk/readme.txt

    r2659670 r2661602  
    55Tested up to: 5.8
    66Requires PHP: 7.1
    7 Stable tag: 1.1.7
     7Stable tag: 1.1.8
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    4343== Changelog ==
    4444
     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
    4549= 1.1.7 =
    4650* Added: Option to defer inline scripts - useful if some dependent inline scripts not registered using WordPress enqueues.
  • debloat/trunk/vendor/autoload.php

    r2659670 r2661602  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitb5165a72e4e7a49504d364a6f407b6f9::getLoader();
     7return ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762::getLoader();
  • debloat/trunk/vendor/composer/autoload_real.php

    r2659670 r2661602  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitb5165a72e4e7a49504d364a6f407b6f9
     5class ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitb5165a72e4e7a49504d364a6f407b6f9', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitb5165a72e4e7a49504d364a6f407b6f9', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitfb42188779ae2a20c09a1098f300d762', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInitb5165a72e4e7a49504d364a6f407b6f9::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInitfb42188779ae2a20c09a1098f300d762::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • debloat/trunk/vendor/composer/autoload_static.php

    r2659670 r2661602  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitb5165a72e4e7a49504d364a6f407b6f9
     7class ComposerStaticInitfb42188779ae2a20c09a1098f300d762
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    8989    {
    9090        return \Closure::bind(function () use ($loader) {
    91             $loader->prefixLengthsPsr4 = ComposerStaticInitb5165a72e4e7a49504d364a6f407b6f9::$prefixLengthsPsr4;
    92             $loader->prefixDirsPsr4 = ComposerStaticInitb5165a72e4e7a49504d364a6f407b6f9::$prefixDirsPsr4;
    93             $loader->classMap = ComposerStaticInitb5165a72e4e7a49504d364a6f407b6f9::$classMap;
     91            $loader->prefixLengthsPsr4 = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$prefixLengthsPsr4;
     92            $loader->prefixDirsPsr4 = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$prefixDirsPsr4;
     93            $loader->classMap = ComposerStaticInitfb42188779ae2a20c09a1098f300d762::$classMap;
    9494
    9595        }, null, ClassLoader::class);
  • debloat/trunk/vendor/composer/installed.php

    r2659670 r2661602  
    11<?php return array(
    22    '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',
    55        'type' => 'library',
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => '8bfb016c965ea75dac44eae5acc4933e91b3ee21',
     8        'reference' => '1146e233d19c045a191d3a04e2af69ec61e87700',
    99        'name' => '__root__',
    1010        'dev' => true,
     
    1212    'versions' => array(
    1313        '__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',
    1616            'type' => 'library',
    1717            'install_path' => __DIR__ . '/../../',
    1818            'aliases' => array(),
    19             'reference' => '8bfb016c965ea75dac44eae5acc4933e91b3ee21',
     19            'reference' => '1146e233d19c045a191d3a04e2af69ec61e87700',
    2020            'dev_requirement' => false,
    2121        ),
Note: See TracChangeset for help on using the changeset viewer.