Plugin Directory

Changeset 3328397


Ignore:
Timestamp:
07/15/2025 04:41:55 PM (9 months ago)
Author:
nosilver4u
Message:

tagging and releasing 4.2.0

Location:
easy-image-optimizer
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • easy-image-optimizer/tags/4.2.0/.travis.yml

    r3150977 r3328397  
    1515
    1616php:
    17   - 8.1
     17  - 8.4
    1818
    1919env:
  • easy-image-optimizer/tags/4.2.0/changelog.txt

    r3262286 r3328397  
     1= 4.2.0 =
     2*Release Date - July 15, 2025*
     3
     4* added: Easy IO support for dynamic cropping (crop=1) on WordPress.com sites
     5* fixed: PHP warnings related to HTML parsing
     6* fixed: PHP warnings when link URLs contain special regex characters
     7
    18= 4.1.0 =
    29*Release Date - March 26, 2025*
  • easy-image-optimizer/tags/4.2.0/classes/class-base.php

    r3262286 r3328397  
    418418        }
    419419        self::$temp_debug = false;
     420    }
     421
     422    /**
     423     * Checks to see if test mode is enabled, and whether the current user is a logged-in admin.
     424     *
     425     * @return bool True if test mode should be effective and prevent optimizations for guest users. False otherwise.
     426     */
     427    public function test_mode_active() {
     428        if (
     429            $this->get_option( $this->prefix . 'test_mode' ) &&
     430            ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) )
     431        ) {
     432            if ( ! empty( $_GET['ewwwio_test_mode'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
     433                return false;
     434            }
     435            return true;
     436        }
     437        return false;
    420438    }
    421439
  • easy-image-optimizer/tags/4.2.0/classes/class-exactdn.php

    r3262286 r3328397  
    279279        if ( \defined( 'EIO_DISABLE_DEEP_INTEGRATION' ) && EIO_DISABLE_DEEP_INTEGRATION ) {
    280280            $this->debug_message( 'deep (image_downsize) integration disabled' );
     281        } elseif ( \defined( 'WPCOMSH_VERSION' ) ) {
     282            $this->debug_message( 'WordPress.com, image_downsize integration disabled for crop=1 functionality' );
    281283        } elseif ( ! \function_exists( '\aq_resize' ) ) {
    282284            \add_filter( 'image_downsize', array( $this, 'filter_image_downsize' ), 10, 3 );
     
    14641466                        if ( \defined( 'EIO_PRESERVE_LINKED_IMAGES' ) && EIO_PRESERVE_LINKED_IMAGES && ! empty( $images['link_url'][ $index ] ) && $this->validate_image_url( $images['link_url'][ $index ] ) ) {
    14651467                            $new_tag = \preg_replace(
    1466                                 '#(href=["|\'])' . $images['link_url'][ $index ] . '(["|\'])#i',
     1468                                '#(href=["|\'])' . preg_quote( $images['link_url'][ $index ], '#' ) . '(["|\'])#i',
    14671469                                '\1' . $this->generate_url(
    14681470                                    $images['link_url'][ $index ],
     
    14771479                        } elseif ( ! empty( $images['link_url'][ $index ] ) && $this->validate_image_url( $images['link_url'][ $index ] ) ) {
    14781480                            $new_tag = \preg_replace(
    1479                                 '#(href=["|\'])' . $images['link_url'][ $index ] . '(["|\'])#i',
     1481                                '#(href=["|\'])' . preg_quote( $images['link_url'][ $index ], '#' ) . '(["|\'])#i',
    14801482                                '\1' . $this->generate_url( $images['link_url'][ $index ], array( 'w' => 2560 ) ) . '\2',
    14811483                                $new_tag,
     
    28052807            }
    28062808
    2807             $url = $source['url'];
     2809            $url  = $source['url'];
     2810            $args = array();
     2811            if ( false !== strpos( $image_src, 'crop=1' ) && false === strpos( $url, 'crop=1' ) ) {
     2812                $args['crop'] = 1;
     2813            }
    28082814
    28092815            list( $width, $height ) = $this->get_dimensions_from_filename( $url );
    28102816            if ( ! $resize_existing && 'w' === $source['descriptor'] && (int) $source['value'] === (int) $width ) {
    28112817                $this->debug_message( "preventing further processing for $url" );
    2812                 $sources[ $i ]['url'] = $this->generate_url( $source['url'] );
     2818                $sources[ $i ]['url'] = $this->generate_url( $source['url'], $args );
    28132819                continue;
    28142820            }
     
    28192825                ) {
    28202826                    $this->debug_message( "preventing further processing for (detected) full-size $url" );
    2821                     $sources[ $i ]['url'] = $this->generate_url( $source['url'] );
     2827                    $sources[ $i ]['url'] = $this->generate_url( $source['url'], $args );
    28222828                    continue;
    28232829                }
     
    42584264        }
    42594265
     4266        // Support WordPress.com crop=1 query parameter.
     4267        if ( \strpos( $image_url, 'crop=1' ) ) {
     4268            $more_args['crop'] = 1;
     4269        }
     4270
    42604271        // Merge given args with the automatic (option-based) args, and also makes sure args is an array if it was previously a string.
    42614272        $args = \wp_parse_args( $args, $more_args );
  • easy-image-optimizer/tags/4.2.0/classes/class-lazy-load.php

    r3262286 r3328397  
    853853                            }
    854854                        } elseif ( ! empty( $bg_image_urls[0] ) ) {
     855                            $webp_image_url = \apply_filters( 'eio_image_url_to_webp', $bg_image_urls[0] );
    855856                            $this->set_attribute( $element, 'data-back', $bg_image_urls[0] );
     857                            if ( $webp_image_url && $webp_image_url !== $bg_image_urls[0] ) {
     858                                $this->set_attribute( $element, 'data-back-webp', $webp_image_url );
     859                            }
    856860                        }
    857861                        $element = \str_replace( $style, $new_style, $element );
  • easy-image-optimizer/tags/4.2.0/classes/class-page-parser.php

    r3055524 r3328397  
    6666        $unquoted_images = array();
    6767
     68        if ( empty( $content ) ) {
     69            return $images;
     70        }
    6871        $unquoted_pattern = '';
    6972        $search_pattern   = '#(?P<img_tag><img\s[^\\\\>]*?>)#is';
     
    128131        $images = array();
    129132
    130         if ( \preg_match_all( '#(?P<noscript_tag><noscript[^>]*?>\s*)(?P<img_tag><img[^>]*?\s+?src\s*=\s*["\'](?P<img_url>[^\s]+?)["\'][^>]*?>){1}(?:\s*</noscript>)?#is', $content, $images ) ) {
     133        if ( ! empty( $content ) && \preg_match_all( '#(?P<noscript_tag><noscript[^>]*?>\s*)(?P<img_tag><img[^>]*?\s+?src\s*=\s*["\'](?P<img_url>[^\s]+?)["\'][^>]*?>){1}(?:\s*</noscript>)?#is', $content, $images ) ) {
    131134            foreach ( $images as $key => $unused ) {
    132135                // Simplify the output as much as possible, mostly for confirming test results.
     
    149152        $this->debug_message( '<b>' . __METHOD__ . '()</b>' );
    150153        $pictures = array();
    151         if ( \preg_match_all( '#(?:<picture[^>]*?>\s*)(?:<source[^>]*?>)+(?:.*?</picture>)?#is', $content, $pictures ) ) {
     154        if ( ! empty( $content ) && \preg_match_all( '#(?:<picture[^>]*?>\s*)(?:<source[^>]*?>)+(?:.*?</picture>)?#is', $content, $pictures ) ) {
    152155            return $pictures[0];
    153156        }
     
    164167        $this->debug_message( '<b>' . __METHOD__ . '()</b>' );
    165168        $styles = array();
    166         if ( \preg_match_all( '#<style[^>]*?>.*?</style>#is', $content, $styles ) ) {
     169        if ( ! empty( $content ) && \preg_match_all( '#<style[^>]*?>.*?</style>#is', $content, $styles ) ) {
    167170            return $styles[0];
    168171        }
     
    216219            return array();
    217220        }
    218         if ( \preg_match_all( '#<' . $tag_name . '\s[^\\\\>]+?>#is', $content, $elements ) ) {
     221        if ( ! empty( $content ) && \preg_match_all( '#<' . $tag_name . '\s[^\\\\>]+?>#is', $content, $elements ) ) {
    219222            return $elements[0];
    220223        }
  • easy-image-optimizer/tags/4.2.0/easy-image-optimizer.php

    r3262286 r3328397  
    1414Description: Easily speed up your website to better connect with your visitors. Properly compress and size/scale images. Includes lazy load and WebP auto-convert.
    1515Author: Exactly WWW
    16 Version: 4.1.0
    17 Requires at least: 6.5
     16Version: 4.2.0
     17Requires at least: 6.6
    1818Requires PHP: 8.1
    1919Author URI: https://ewww.io/
     
    3030    add_action( 'admin_notices', 'easyio_unsupported_php' );
    3131} elseif ( false === strpos( add_query_arg( '', '' ), 'easyio_disable=1' ) ) {
    32     define( 'EASYIO_VERSION', 410 );
     32    define( 'EASYIO_VERSION', 420 );
    3333
    3434    /**
  • easy-image-optimizer/tags/4.2.0/phpcs.ruleset.xml

    r3150977 r3328397  
    1919    <rule ref="WordPress.PHP.NoSilencedErrors">
    2020        <properties>
    21             <property name="customAllowedFunctionsList" type="array" value="ini_get,exif_read_data,ob_end_flush"/>
     21            <property name="customAllowedFunctionsList" type="array">
     22                <element value="ini_get"/>
     23                <element value="exif_read_data"/>
     24                <element value="ob_end_flush"/>
     25            </property>
    2226        </properties>
    2327    </rule>
    2428    <rule ref="WordPress.NamingConventions.ValidVariableName">
    2529        <properties>
    26             <property name="allowed_custom_properties" type="array" value="formatOutput,imgQuality,parentNode,nextSibling,documentElement,imagePath,webimagePath,thumbPath,fileName,Version,Name" />
     30            <property name="allowed_custom_properties" type="array">
     31            <element value="formatOutput"/>
     32            <element value="imgQuality"/>
     33            <element value="parentNode"/>
     34            <element value="nextSibling"/>
     35            <element value="documentElement"/>
     36            <element value="imagePath"/>
     37            <element value="webimagePath"/>
     38            <element value="thumbPath"/>
     39            <element value="fileName"/>
     40            <element value="Version"/>
     41            <element value="Name"/>
     42            </property>
    2743        </properties>
    2844    </rule>
  • easy-image-optimizer/tags/4.2.0/readme.txt

    r3262286 r3328397  
    22Contributors: nosilver4u
    33Tags: image, resize, webp, lazy load, compress
    4 Requires at least: 6.5
    5 Tested up to: 6.7
    6 Requires PHP: 8.1
    7 Stable tag: 4.1.0
     4Tested up to: 6.8
     5Stable tag: 4.2.0
    86License: GPLv3
    97
     
    5755
    5856* If you would like to help translate this plugin in your language, get started here: https://translate.wordpress.org/projects/wp-plugins/easy-image-optimizer/
     57
     58= 4.2.0 =
     59*Release Date - July 15, 2025*
     60
     61* added: Easy IO support for dynamic cropping (crop=1) on WordPress.com sites
     62* fixed: PHP warnings related to HTML parsing
     63* fixed: PHP warnings when link URLs contain special regex characters
    5964
    6065= 4.1.0 =
  • easy-image-optimizer/trunk/.travis.yml

    r3150977 r3328397  
    1515
    1616php:
    17   - 8.1
     17  - 8.4
    1818
    1919env:
  • easy-image-optimizer/trunk/changelog.txt

    r3262286 r3328397  
     1= 4.2.0 =
     2*Release Date - July 15, 2025*
     3
     4* added: Easy IO support for dynamic cropping (crop=1) on WordPress.com sites
     5* fixed: PHP warnings related to HTML parsing
     6* fixed: PHP warnings when link URLs contain special regex characters
     7
    18= 4.1.0 =
    29*Release Date - March 26, 2025*
  • easy-image-optimizer/trunk/classes/class-base.php

    r3262286 r3328397  
    418418        }
    419419        self::$temp_debug = false;
     420    }
     421
     422    /**
     423     * Checks to see if test mode is enabled, and whether the current user is a logged-in admin.
     424     *
     425     * @return bool True if test mode should be effective and prevent optimizations for guest users. False otherwise.
     426     */
     427    public function test_mode_active() {
     428        if (
     429            $this->get_option( $this->prefix . 'test_mode' ) &&
     430            ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) )
     431        ) {
     432            if ( ! empty( $_GET['ewwwio_test_mode'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
     433                return false;
     434            }
     435            return true;
     436        }
     437        return false;
    420438    }
    421439
  • easy-image-optimizer/trunk/classes/class-exactdn.php

    r3262286 r3328397  
    279279        if ( \defined( 'EIO_DISABLE_DEEP_INTEGRATION' ) && EIO_DISABLE_DEEP_INTEGRATION ) {
    280280            $this->debug_message( 'deep (image_downsize) integration disabled' );
     281        } elseif ( \defined( 'WPCOMSH_VERSION' ) ) {
     282            $this->debug_message( 'WordPress.com, image_downsize integration disabled for crop=1 functionality' );
    281283        } elseif ( ! \function_exists( '\aq_resize' ) ) {
    282284            \add_filter( 'image_downsize', array( $this, 'filter_image_downsize' ), 10, 3 );
     
    14641466                        if ( \defined( 'EIO_PRESERVE_LINKED_IMAGES' ) && EIO_PRESERVE_LINKED_IMAGES && ! empty( $images['link_url'][ $index ] ) && $this->validate_image_url( $images['link_url'][ $index ] ) ) {
    14651467                            $new_tag = \preg_replace(
    1466                                 '#(href=["|\'])' . $images['link_url'][ $index ] . '(["|\'])#i',
     1468                                '#(href=["|\'])' . preg_quote( $images['link_url'][ $index ], '#' ) . '(["|\'])#i',
    14671469                                '\1' . $this->generate_url(
    14681470                                    $images['link_url'][ $index ],
     
    14771479                        } elseif ( ! empty( $images['link_url'][ $index ] ) && $this->validate_image_url( $images['link_url'][ $index ] ) ) {
    14781480                            $new_tag = \preg_replace(
    1479                                 '#(href=["|\'])' . $images['link_url'][ $index ] . '(["|\'])#i',
     1481                                '#(href=["|\'])' . preg_quote( $images['link_url'][ $index ], '#' ) . '(["|\'])#i',
    14801482                                '\1' . $this->generate_url( $images['link_url'][ $index ], array( 'w' => 2560 ) ) . '\2',
    14811483                                $new_tag,
     
    28052807            }
    28062808
    2807             $url = $source['url'];
     2809            $url  = $source['url'];
     2810            $args = array();
     2811            if ( false !== strpos( $image_src, 'crop=1' ) && false === strpos( $url, 'crop=1' ) ) {
     2812                $args['crop'] = 1;
     2813            }
    28082814
    28092815            list( $width, $height ) = $this->get_dimensions_from_filename( $url );
    28102816            if ( ! $resize_existing && 'w' === $source['descriptor'] && (int) $source['value'] === (int) $width ) {
    28112817                $this->debug_message( "preventing further processing for $url" );
    2812                 $sources[ $i ]['url'] = $this->generate_url( $source['url'] );
     2818                $sources[ $i ]['url'] = $this->generate_url( $source['url'], $args );
    28132819                continue;
    28142820            }
     
    28192825                ) {
    28202826                    $this->debug_message( "preventing further processing for (detected) full-size $url" );
    2821                     $sources[ $i ]['url'] = $this->generate_url( $source['url'] );
     2827                    $sources[ $i ]['url'] = $this->generate_url( $source['url'], $args );
    28222828                    continue;
    28232829                }
     
    42584264        }
    42594265
     4266        // Support WordPress.com crop=1 query parameter.
     4267        if ( \strpos( $image_url, 'crop=1' ) ) {
     4268            $more_args['crop'] = 1;
     4269        }
     4270
    42604271        // Merge given args with the automatic (option-based) args, and also makes sure args is an array if it was previously a string.
    42614272        $args = \wp_parse_args( $args, $more_args );
  • easy-image-optimizer/trunk/classes/class-lazy-load.php

    r3262286 r3328397  
    853853                            }
    854854                        } elseif ( ! empty( $bg_image_urls[0] ) ) {
     855                            $webp_image_url = \apply_filters( 'eio_image_url_to_webp', $bg_image_urls[0] );
    855856                            $this->set_attribute( $element, 'data-back', $bg_image_urls[0] );
     857                            if ( $webp_image_url && $webp_image_url !== $bg_image_urls[0] ) {
     858                                $this->set_attribute( $element, 'data-back-webp', $webp_image_url );
     859                            }
    856860                        }
    857861                        $element = \str_replace( $style, $new_style, $element );
  • easy-image-optimizer/trunk/classes/class-page-parser.php

    r3055524 r3328397  
    6666        $unquoted_images = array();
    6767
     68        if ( empty( $content ) ) {
     69            return $images;
     70        }
    6871        $unquoted_pattern = '';
    6972        $search_pattern   = '#(?P<img_tag><img\s[^\\\\>]*?>)#is';
     
    128131        $images = array();
    129132
    130         if ( \preg_match_all( '#(?P<noscript_tag><noscript[^>]*?>\s*)(?P<img_tag><img[^>]*?\s+?src\s*=\s*["\'](?P<img_url>[^\s]+?)["\'][^>]*?>){1}(?:\s*</noscript>)?#is', $content, $images ) ) {
     133        if ( ! empty( $content ) && \preg_match_all( '#(?P<noscript_tag><noscript[^>]*?>\s*)(?P<img_tag><img[^>]*?\s+?src\s*=\s*["\'](?P<img_url>[^\s]+?)["\'][^>]*?>){1}(?:\s*</noscript>)?#is', $content, $images ) ) {
    131134            foreach ( $images as $key => $unused ) {
    132135                // Simplify the output as much as possible, mostly for confirming test results.
     
    149152        $this->debug_message( '<b>' . __METHOD__ . '()</b>' );
    150153        $pictures = array();
    151         if ( \preg_match_all( '#(?:<picture[^>]*?>\s*)(?:<source[^>]*?>)+(?:.*?</picture>)?#is', $content, $pictures ) ) {
     154        if ( ! empty( $content ) && \preg_match_all( '#(?:<picture[^>]*?>\s*)(?:<source[^>]*?>)+(?:.*?</picture>)?#is', $content, $pictures ) ) {
    152155            return $pictures[0];
    153156        }
     
    164167        $this->debug_message( '<b>' . __METHOD__ . '()</b>' );
    165168        $styles = array();
    166         if ( \preg_match_all( '#<style[^>]*?>.*?</style>#is', $content, $styles ) ) {
     169        if ( ! empty( $content ) && \preg_match_all( '#<style[^>]*?>.*?</style>#is', $content, $styles ) ) {
    167170            return $styles[0];
    168171        }
     
    216219            return array();
    217220        }
    218         if ( \preg_match_all( '#<' . $tag_name . '\s[^\\\\>]+?>#is', $content, $elements ) ) {
     221        if ( ! empty( $content ) && \preg_match_all( '#<' . $tag_name . '\s[^\\\\>]+?>#is', $content, $elements ) ) {
    219222            return $elements[0];
    220223        }
  • easy-image-optimizer/trunk/easy-image-optimizer.php

    r3262286 r3328397  
    1414Description: Easily speed up your website to better connect with your visitors. Properly compress and size/scale images. Includes lazy load and WebP auto-convert.
    1515Author: Exactly WWW
    16 Version: 4.1.0
    17 Requires at least: 6.5
     16Version: 4.2.0
     17Requires at least: 6.6
    1818Requires PHP: 8.1
    1919Author URI: https://ewww.io/
     
    3030    add_action( 'admin_notices', 'easyio_unsupported_php' );
    3131} elseif ( false === strpos( add_query_arg( '', '' ), 'easyio_disable=1' ) ) {
    32     define( 'EASYIO_VERSION', 410 );
     32    define( 'EASYIO_VERSION', 420 );
    3333
    3434    /**
  • easy-image-optimizer/trunk/phpcs.ruleset.xml

    r3150977 r3328397  
    1919    <rule ref="WordPress.PHP.NoSilencedErrors">
    2020        <properties>
    21             <property name="customAllowedFunctionsList" type="array" value="ini_get,exif_read_data,ob_end_flush"/>
     21            <property name="customAllowedFunctionsList" type="array">
     22                <element value="ini_get"/>
     23                <element value="exif_read_data"/>
     24                <element value="ob_end_flush"/>
     25            </property>
    2226        </properties>
    2327    </rule>
    2428    <rule ref="WordPress.NamingConventions.ValidVariableName">
    2529        <properties>
    26             <property name="allowed_custom_properties" type="array" value="formatOutput,imgQuality,parentNode,nextSibling,documentElement,imagePath,webimagePath,thumbPath,fileName,Version,Name" />
     30            <property name="allowed_custom_properties" type="array">
     31            <element value="formatOutput"/>
     32            <element value="imgQuality"/>
     33            <element value="parentNode"/>
     34            <element value="nextSibling"/>
     35            <element value="documentElement"/>
     36            <element value="imagePath"/>
     37            <element value="webimagePath"/>
     38            <element value="thumbPath"/>
     39            <element value="fileName"/>
     40            <element value="Version"/>
     41            <element value="Name"/>
     42            </property>
    2743        </properties>
    2844    </rule>
  • easy-image-optimizer/trunk/readme.txt

    r3262286 r3328397  
    22Contributors: nosilver4u
    33Tags: image, resize, webp, lazy load, compress
    4 Requires at least: 6.5
    5 Tested up to: 6.7
    6 Requires PHP: 8.1
    7 Stable tag: 4.1.0
     4Tested up to: 6.8
     5Stable tag: 4.2.0
    86License: GPLv3
    97
     
    5755
    5856* If you would like to help translate this plugin in your language, get started here: https://translate.wordpress.org/projects/wp-plugins/easy-image-optimizer/
     57
     58= 4.2.0 =
     59*Release Date - July 15, 2025*
     60
     61* added: Easy IO support for dynamic cropping (crop=1) on WordPress.com sites
     62* fixed: PHP warnings related to HTML parsing
     63* fixed: PHP warnings when link URLs contain special regex characters
    5964
    6065= 4.1.0 =
Note: See TracChangeset for help on using the changeset viewer.