Version Description
- Fix WebP URL conversion
Download this release
Release Info
| Developer | keycdn |
| Plugin | |
| Version | 1.4.9 |
| Comparing to | |
| See all releases | |
Code changes from version 1.4.8 to 1.4.9
- cache-enabler.php +1 -1
- inc/cache_enabler.class.php +8 -9
- inc/cache_enabler_disk.class.php +7 -7
- readme.txt +3 -0
cache-enabler.php
CHANGED
|
@@ -6,7 +6,7 @@ Description: Simple and fast WordPress disk caching plugin.
|
|
| 6 |
Author: KeyCDN
|
| 7 |
Author URI: https://www.keycdn.com
|
| 8 |
License: GPLv2 or later
|
| 9 |
-
Version: 1.4.
|
| 10 |
*/
|
| 11 |
|
| 12 |
/*
|
| 6 |
Author: KeyCDN
|
| 7 |
Author URI: https://www.keycdn.com
|
| 8 |
License: GPLv2 or later
|
| 9 |
+
Version: 1.4.9
|
| 10 |
*/
|
| 11 |
|
| 12 |
/*
|
inc/cache_enabler.class.php
CHANGED
|
@@ -183,7 +183,7 @@ final class Cache_Enabler {
|
|
| 183 |
* Cache Enabler activation and deactivation actions
|
| 184 |
*
|
| 185 |
* @since 1.4.0
|
| 186 |
-
* @change 1.4.
|
| 187 |
*
|
| 188 |
* @param string $action activated or deactivated
|
| 189 |
* @param boolean $network_wide network activated or deactivated
|
|
@@ -209,10 +209,10 @@ final class Cache_Enabler {
|
|
| 209 |
// delete advanced cache settings file
|
| 210 |
Cache_Enabler_Disk::delete_advcache_settings();
|
| 211 |
}
|
| 212 |
-
}
|
| 213 |
|
| 214 |
-
|
| 215 |
-
|
|
|
|
| 216 |
// site activated
|
| 217 |
} else {
|
| 218 |
if ( $action === 'activated') {
|
|
@@ -373,7 +373,7 @@ final class Cache_Enabler {
|
|
| 373 |
* uninstall Cache Enabler
|
| 374 |
*
|
| 375 |
* @since 1.0.0
|
| 376 |
-
* @change 1.4.
|
| 377 |
*/
|
| 378 |
|
| 379 |
public static function on_uninstall() {
|
|
@@ -388,10 +388,9 @@ final class Cache_Enabler {
|
|
| 388 |
switch_to_blog( $blog_id );
|
| 389 |
// uninstall requirements
|
| 390 |
self::_uninstall_backend();
|
|
|
|
|
|
|
| 391 |
}
|
| 392 |
-
|
| 393 |
-
// restore blog
|
| 394 |
-
restore_current_blog();
|
| 395 |
// site
|
| 396 |
} else {
|
| 397 |
// uninstall requirements
|
|
@@ -1928,7 +1927,7 @@ final class Cache_Enabler {
|
|
| 1928 |
* check plugin requirements
|
| 1929 |
*
|
| 1930 |
* @since 1.1.0
|
| 1931 |
-
* @change 1.4.
|
| 1932 |
*/
|
| 1933 |
|
| 1934 |
public static function requirements_check() {
|
| 183 |
* Cache Enabler activation and deactivation actions
|
| 184 |
*
|
| 185 |
* @since 1.4.0
|
| 186 |
+
* @change 1.4.9
|
| 187 |
*
|
| 188 |
* @param string $action activated or deactivated
|
| 189 |
* @param boolean $network_wide network activated or deactivated
|
| 209 |
// delete advanced cache settings file
|
| 210 |
Cache_Enabler_Disk::delete_advcache_settings();
|
| 211 |
}
|
|
|
|
| 212 |
|
| 213 |
+
// restore blog
|
| 214 |
+
restore_current_blog();
|
| 215 |
+
}
|
| 216 |
// site activated
|
| 217 |
} else {
|
| 218 |
if ( $action === 'activated') {
|
| 373 |
* uninstall Cache Enabler
|
| 374 |
*
|
| 375 |
* @since 1.0.0
|
| 376 |
+
* @change 1.4.9
|
| 377 |
*/
|
| 378 |
|
| 379 |
public static function on_uninstall() {
|
| 388 |
switch_to_blog( $blog_id );
|
| 389 |
// uninstall requirements
|
| 390 |
self::_uninstall_backend();
|
| 391 |
+
// restore blog
|
| 392 |
+
restore_current_blog();
|
| 393 |
}
|
|
|
|
|
|
|
|
|
|
| 394 |
// site
|
| 395 |
} else {
|
| 396 |
// uninstall requirements
|
| 1927 |
* check plugin requirements
|
| 1928 |
*
|
| 1929 |
* @since 1.1.0
|
| 1930 |
+
* @change 1.4.8
|
| 1931 |
*/
|
| 1932 |
|
| 1933 |
public static function requirements_check() {
|
inc/cache_enabler_disk.class.php
CHANGED
|
@@ -718,16 +718,16 @@ final class Cache_Enabler_Disk {
|
|
| 718 |
* convert image URL to WebP
|
| 719 |
*
|
| 720 |
* @since 1.0.1
|
| 721 |
-
* @change 1.4.
|
| 722 |
*
|
| 723 |
-
* @param array $matches
|
| 724 |
-
* @return string $conversion
|
| 725 |
*/
|
| 726 |
|
| 727 |
private static function _convert_webp( $matches ) {
|
| 728 |
|
| 729 |
-
$full_match =
|
| 730 |
-
$image_count =
|
| 731 |
|
| 732 |
if ( $image_count > 0 ) {
|
| 733 |
$image_urls = explode( ',', $full_match );
|
|
@@ -735,7 +735,7 @@ final class Cache_Enabler_Disk {
|
|
| 735 |
// remove spaces if there are any
|
| 736 |
$image_url = trim( $image_url, ' ' );
|
| 737 |
// append .webp extension
|
| 738 |
-
$image_url_webp = preg_replace( '/(\.jpe?g|\.png)/', '$1.webp', $image_url );
|
| 739 |
// get WebP image path
|
| 740 |
$image_path_webp = self::_image_path( $image_url_webp );
|
| 741 |
|
|
@@ -744,7 +744,7 @@ final class Cache_Enabler_Disk {
|
|
| 744 |
$image_url = $image_url_webp;
|
| 745 |
} else {
|
| 746 |
// remove default extension
|
| 747 |
-
$image_url_webp = preg_replace( '/(\.jpe?g|\.png)/', '', $image_url_webp );
|
| 748 |
// get WebP image path
|
| 749 |
$image_path_webp = self::_image_path( $image_url_webp );
|
| 750 |
|
| 718 |
* convert image URL to WebP
|
| 719 |
*
|
| 720 |
* @since 1.0.1
|
| 721 |
+
* @change 1.4.9
|
| 722 |
*
|
| 723 |
+
* @param array $matches pattern matches from parsed HTML file
|
| 724 |
+
* @return string $conversion converted image URL(s) to WebP if applicable, default URL(s) otherwise
|
| 725 |
*/
|
| 726 |
|
| 727 |
private static function _convert_webp( $matches ) {
|
| 728 |
|
| 729 |
+
$full_match = $matches[0];
|
| 730 |
+
$image_count = preg_match_all( '/(\.jpe?g|\.png)/i', $full_match );
|
| 731 |
|
| 732 |
if ( $image_count > 0 ) {
|
| 733 |
$image_urls = explode( ',', $full_match );
|
| 735 |
// remove spaces if there are any
|
| 736 |
$image_url = trim( $image_url, ' ' );
|
| 737 |
// append .webp extension
|
| 738 |
+
$image_url_webp = preg_replace( '/(\.jpe?g|\.png)/i', '$1.webp', $image_url );
|
| 739 |
// get WebP image path
|
| 740 |
$image_path_webp = self::_image_path( $image_url_webp );
|
| 741 |
|
| 744 |
$image_url = $image_url_webp;
|
| 745 |
} else {
|
| 746 |
// remove default extension
|
| 747 |
+
$image_url_webp = preg_replace( '/(\.jpe?g|\.png)/i', '', $image_url_webp );
|
| 748 |
// get WebP image path
|
| 749 |
$image_path_webp = self::_image_path( $image_url_webp );
|
| 750 |
|
readme.txt
CHANGED
|
@@ -84,6 +84,9 @@ When combined with Optimus, the WordPress Cache Enabler allows you to easily del
|
|
| 84 |
|
| 85 |
== Changelog ==
|
| 86 |
|
|
|
|
|
|
|
|
|
|
| 87 |
= 1.4.8 =
|
| 88 |
* Update WebP URL conversion (#116)
|
| 89 |
* Update WP-CLI clear subcommand messages (#111)
|
| 84 |
|
| 85 |
== Changelog ==
|
| 86 |
|
| 87 |
+
= 1.4.9 =
|
| 88 |
+
* Fix WebP URL conversion
|
| 89 |
+
|
| 90 |
= 1.4.8 =
|
| 91 |
* Update WebP URL conversion (#116)
|
| 92 |
* Update WP-CLI clear subcommand messages (#111)
|
