Changeset 3328397
- Timestamp:
- 07/15/2025 04:41:55 PM (9 months ago)
- Location:
- easy-image-optimizer
- Files:
-
- 18 edited
- 1 copied
-
tags/4.2.0 (copied) (copied from easy-image-optimizer/trunk)
-
tags/4.2.0/.travis.yml (modified) (1 diff)
-
tags/4.2.0/changelog.txt (modified) (1 diff)
-
tags/4.2.0/classes/class-base.php (modified) (1 diff)
-
tags/4.2.0/classes/class-exactdn.php (modified) (6 diffs)
-
tags/4.2.0/classes/class-lazy-load.php (modified) (1 diff)
-
tags/4.2.0/classes/class-page-parser.php (modified) (5 diffs)
-
tags/4.2.0/easy-image-optimizer.php (modified) (2 diffs)
-
tags/4.2.0/phpcs.ruleset.xml (modified) (1 diff)
-
tags/4.2.0/readme.txt (modified) (2 diffs)
-
trunk/.travis.yml (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/classes/class-base.php (modified) (1 diff)
-
trunk/classes/class-exactdn.php (modified) (6 diffs)
-
trunk/classes/class-lazy-load.php (modified) (1 diff)
-
trunk/classes/class-page-parser.php (modified) (5 diffs)
-
trunk/easy-image-optimizer.php (modified) (2 diffs)
-
trunk/phpcs.ruleset.xml (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easy-image-optimizer/tags/4.2.0/.travis.yml
r3150977 r3328397 15 15 16 16 php: 17 - 8. 117 - 8.4 18 18 19 19 env: -
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 1 8 = 4.1.0 = 2 9 *Release Date - March 26, 2025* -
easy-image-optimizer/tags/4.2.0/classes/class-base.php
r3262286 r3328397 418 418 } 419 419 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; 420 438 } 421 439 -
easy-image-optimizer/tags/4.2.0/classes/class-exactdn.php
r3262286 r3328397 279 279 if ( \defined( 'EIO_DISABLE_DEEP_INTEGRATION' ) && EIO_DISABLE_DEEP_INTEGRATION ) { 280 280 $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' ); 281 283 } elseif ( ! \function_exists( '\aq_resize' ) ) { 282 284 \add_filter( 'image_downsize', array( $this, 'filter_image_downsize' ), 10, 3 ); … … 1464 1466 if ( \defined( 'EIO_PRESERVE_LINKED_IMAGES' ) && EIO_PRESERVE_LINKED_IMAGES && ! empty( $images['link_url'][ $index ] ) && $this->validate_image_url( $images['link_url'][ $index ] ) ) { 1465 1467 $new_tag = \preg_replace( 1466 '#(href=["|\'])' . $images['link_url'][ $index ]. '(["|\'])#i',1468 '#(href=["|\'])' . preg_quote( $images['link_url'][ $index ], '#' ) . '(["|\'])#i', 1467 1469 '\1' . $this->generate_url( 1468 1470 $images['link_url'][ $index ], … … 1477 1479 } elseif ( ! empty( $images['link_url'][ $index ] ) && $this->validate_image_url( $images['link_url'][ $index ] ) ) { 1478 1480 $new_tag = \preg_replace( 1479 '#(href=["|\'])' . $images['link_url'][ $index ]. '(["|\'])#i',1481 '#(href=["|\'])' . preg_quote( $images['link_url'][ $index ], '#' ) . '(["|\'])#i', 1480 1482 '\1' . $this->generate_url( $images['link_url'][ $index ], array( 'w' => 2560 ) ) . '\2', 1481 1483 $new_tag, … … 2805 2807 } 2806 2808 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 } 2808 2814 2809 2815 list( $width, $height ) = $this->get_dimensions_from_filename( $url ); 2810 2816 if ( ! $resize_existing && 'w' === $source['descriptor'] && (int) $source['value'] === (int) $width ) { 2811 2817 $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 ); 2813 2819 continue; 2814 2820 } … … 2819 2825 ) { 2820 2826 $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 ); 2822 2828 continue; 2823 2829 } … … 4258 4264 } 4259 4265 4266 // Support WordPress.com crop=1 query parameter. 4267 if ( \strpos( $image_url, 'crop=1' ) ) { 4268 $more_args['crop'] = 1; 4269 } 4270 4260 4271 // Merge given args with the automatic (option-based) args, and also makes sure args is an array if it was previously a string. 4261 4272 $args = \wp_parse_args( $args, $more_args ); -
easy-image-optimizer/tags/4.2.0/classes/class-lazy-load.php
r3262286 r3328397 853 853 } 854 854 } elseif ( ! empty( $bg_image_urls[0] ) ) { 855 $webp_image_url = \apply_filters( 'eio_image_url_to_webp', $bg_image_urls[0] ); 855 856 $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 } 856 860 } 857 861 $element = \str_replace( $style, $new_style, $element ); -
easy-image-optimizer/tags/4.2.0/classes/class-page-parser.php
r3055524 r3328397 66 66 $unquoted_images = array(); 67 67 68 if ( empty( $content ) ) { 69 return $images; 70 } 68 71 $unquoted_pattern = ''; 69 72 $search_pattern = '#(?P<img_tag><img\s[^\\\\>]*?>)#is'; … … 128 131 $images = array(); 129 132 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 ) ) { 131 134 foreach ( $images as $key => $unused ) { 132 135 // Simplify the output as much as possible, mostly for confirming test results. … … 149 152 $this->debug_message( '<b>' . __METHOD__ . '()</b>' ); 150 153 $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 ) ) { 152 155 return $pictures[0]; 153 156 } … … 164 167 $this->debug_message( '<b>' . __METHOD__ . '()</b>' ); 165 168 $styles = array(); 166 if ( \preg_match_all( '#<style[^>]*?>.*?</style>#is', $content, $styles ) ) {169 if ( ! empty( $content ) && \preg_match_all( '#<style[^>]*?>.*?</style>#is', $content, $styles ) ) { 167 170 return $styles[0]; 168 171 } … … 216 219 return array(); 217 220 } 218 if ( \preg_match_all( '#<' . $tag_name . '\s[^\\\\>]+?>#is', $content, $elements ) ) {221 if ( ! empty( $content ) && \preg_match_all( '#<' . $tag_name . '\s[^\\\\>]+?>#is', $content, $elements ) ) { 219 222 return $elements[0]; 220 223 } -
easy-image-optimizer/tags/4.2.0/easy-image-optimizer.php
r3262286 r3328397 14 14 Description: Easily speed up your website to better connect with your visitors. Properly compress and size/scale images. Includes lazy load and WebP auto-convert. 15 15 Author: Exactly WWW 16 Version: 4. 1.017 Requires at least: 6. 516 Version: 4.2.0 17 Requires at least: 6.6 18 18 Requires PHP: 8.1 19 19 Author URI: https://ewww.io/ … … 30 30 add_action( 'admin_notices', 'easyio_unsupported_php' ); 31 31 } elseif ( false === strpos( add_query_arg( '', '' ), 'easyio_disable=1' ) ) { 32 define( 'EASYIO_VERSION', 4 10 );32 define( 'EASYIO_VERSION', 420 ); 33 33 34 34 /** -
easy-image-optimizer/tags/4.2.0/phpcs.ruleset.xml
r3150977 r3328397 19 19 <rule ref="WordPress.PHP.NoSilencedErrors"> 20 20 <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> 22 26 </properties> 23 27 </rule> 24 28 <rule ref="WordPress.NamingConventions.ValidVariableName"> 25 29 <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> 27 43 </properties> 28 44 </rule> -
easy-image-optimizer/tags/4.2.0/readme.txt
r3262286 r3328397 2 2 Contributors: nosilver4u 3 3 Tags: 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 4 Tested up to: 6.8 5 Stable tag: 4.2.0 8 6 License: GPLv3 9 7 … … 57 55 58 56 * 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 59 64 60 65 = 4.1.0 = -
easy-image-optimizer/trunk/.travis.yml
r3150977 r3328397 15 15 16 16 php: 17 - 8. 117 - 8.4 18 18 19 19 env: -
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 1 8 = 4.1.0 = 2 9 *Release Date - March 26, 2025* -
easy-image-optimizer/trunk/classes/class-base.php
r3262286 r3328397 418 418 } 419 419 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; 420 438 } 421 439 -
easy-image-optimizer/trunk/classes/class-exactdn.php
r3262286 r3328397 279 279 if ( \defined( 'EIO_DISABLE_DEEP_INTEGRATION' ) && EIO_DISABLE_DEEP_INTEGRATION ) { 280 280 $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' ); 281 283 } elseif ( ! \function_exists( '\aq_resize' ) ) { 282 284 \add_filter( 'image_downsize', array( $this, 'filter_image_downsize' ), 10, 3 ); … … 1464 1466 if ( \defined( 'EIO_PRESERVE_LINKED_IMAGES' ) && EIO_PRESERVE_LINKED_IMAGES && ! empty( $images['link_url'][ $index ] ) && $this->validate_image_url( $images['link_url'][ $index ] ) ) { 1465 1467 $new_tag = \preg_replace( 1466 '#(href=["|\'])' . $images['link_url'][ $index ]. '(["|\'])#i',1468 '#(href=["|\'])' . preg_quote( $images['link_url'][ $index ], '#' ) . '(["|\'])#i', 1467 1469 '\1' . $this->generate_url( 1468 1470 $images['link_url'][ $index ], … … 1477 1479 } elseif ( ! empty( $images['link_url'][ $index ] ) && $this->validate_image_url( $images['link_url'][ $index ] ) ) { 1478 1480 $new_tag = \preg_replace( 1479 '#(href=["|\'])' . $images['link_url'][ $index ]. '(["|\'])#i',1481 '#(href=["|\'])' . preg_quote( $images['link_url'][ $index ], '#' ) . '(["|\'])#i', 1480 1482 '\1' . $this->generate_url( $images['link_url'][ $index ], array( 'w' => 2560 ) ) . '\2', 1481 1483 $new_tag, … … 2805 2807 } 2806 2808 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 } 2808 2814 2809 2815 list( $width, $height ) = $this->get_dimensions_from_filename( $url ); 2810 2816 if ( ! $resize_existing && 'w' === $source['descriptor'] && (int) $source['value'] === (int) $width ) { 2811 2817 $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 ); 2813 2819 continue; 2814 2820 } … … 2819 2825 ) { 2820 2826 $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 ); 2822 2828 continue; 2823 2829 } … … 4258 4264 } 4259 4265 4266 // Support WordPress.com crop=1 query parameter. 4267 if ( \strpos( $image_url, 'crop=1' ) ) { 4268 $more_args['crop'] = 1; 4269 } 4270 4260 4271 // Merge given args with the automatic (option-based) args, and also makes sure args is an array if it was previously a string. 4261 4272 $args = \wp_parse_args( $args, $more_args ); -
easy-image-optimizer/trunk/classes/class-lazy-load.php
r3262286 r3328397 853 853 } 854 854 } elseif ( ! empty( $bg_image_urls[0] ) ) { 855 $webp_image_url = \apply_filters( 'eio_image_url_to_webp', $bg_image_urls[0] ); 855 856 $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 } 856 860 } 857 861 $element = \str_replace( $style, $new_style, $element ); -
easy-image-optimizer/trunk/classes/class-page-parser.php
r3055524 r3328397 66 66 $unquoted_images = array(); 67 67 68 if ( empty( $content ) ) { 69 return $images; 70 } 68 71 $unquoted_pattern = ''; 69 72 $search_pattern = '#(?P<img_tag><img\s[^\\\\>]*?>)#is'; … … 128 131 $images = array(); 129 132 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 ) ) { 131 134 foreach ( $images as $key => $unused ) { 132 135 // Simplify the output as much as possible, mostly for confirming test results. … … 149 152 $this->debug_message( '<b>' . __METHOD__ . '()</b>' ); 150 153 $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 ) ) { 152 155 return $pictures[0]; 153 156 } … … 164 167 $this->debug_message( '<b>' . __METHOD__ . '()</b>' ); 165 168 $styles = array(); 166 if ( \preg_match_all( '#<style[^>]*?>.*?</style>#is', $content, $styles ) ) {169 if ( ! empty( $content ) && \preg_match_all( '#<style[^>]*?>.*?</style>#is', $content, $styles ) ) { 167 170 return $styles[0]; 168 171 } … … 216 219 return array(); 217 220 } 218 if ( \preg_match_all( '#<' . $tag_name . '\s[^\\\\>]+?>#is', $content, $elements ) ) {221 if ( ! empty( $content ) && \preg_match_all( '#<' . $tag_name . '\s[^\\\\>]+?>#is', $content, $elements ) ) { 219 222 return $elements[0]; 220 223 } -
easy-image-optimizer/trunk/easy-image-optimizer.php
r3262286 r3328397 14 14 Description: Easily speed up your website to better connect with your visitors. Properly compress and size/scale images. Includes lazy load and WebP auto-convert. 15 15 Author: Exactly WWW 16 Version: 4. 1.017 Requires at least: 6. 516 Version: 4.2.0 17 Requires at least: 6.6 18 18 Requires PHP: 8.1 19 19 Author URI: https://ewww.io/ … … 30 30 add_action( 'admin_notices', 'easyio_unsupported_php' ); 31 31 } elseif ( false === strpos( add_query_arg( '', '' ), 'easyio_disable=1' ) ) { 32 define( 'EASYIO_VERSION', 4 10 );32 define( 'EASYIO_VERSION', 420 ); 33 33 34 34 /** -
easy-image-optimizer/trunk/phpcs.ruleset.xml
r3150977 r3328397 19 19 <rule ref="WordPress.PHP.NoSilencedErrors"> 20 20 <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> 22 26 </properties> 23 27 </rule> 24 28 <rule ref="WordPress.NamingConventions.ValidVariableName"> 25 29 <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> 27 43 </properties> 28 44 </rule> -
easy-image-optimizer/trunk/readme.txt
r3262286 r3328397 2 2 Contributors: nosilver4u 3 3 Tags: 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 4 Tested up to: 6.8 5 Stable tag: 4.2.0 8 6 License: GPLv3 9 7 … … 57 55 58 56 * 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 59 64 60 65 = 4.1.0 =
Note: See TracChangeset
for help on using the changeset viewer.