Version Description
- added: API keys can be used to auto-register sites for Easy IO, including sub-keys
- changed: expose legacy resize dimensions with removal option
- fixed: Lazy Load not using EWWWIO_CONTENT_DIR
- fixed: Easy IO Premium/WebP compression disabled incorrectly when in Easy Mode
- fixed: JS WebP body script throws error if wp_head script missing
- fixed: Lazy Load Auto-scale adds query parameters to SVG images
- fixed: JS WebP and Lazy Load prevent image loading in GiveWP iframe
- fixed: Auto Scale crops too much for object-* images in Oxygen
- fixed: trailing space on image URL handled incorrectly
- updated: Gifsicle to version 1.93 and Pngquant to 2.17
- removed: free binaries for SunOS, may use free cloud-based JPG compression instead
Download this release
Release Info
Developer | nosilver4u |
Plugin | EWWW Image Optimizer |
Version | 6.7.0 |
Comparing to | |
See all releases |
Code changes from version 6.6.0 to 6.7.0
- .travis.yml +7 -6
- binaries/gifsicle-fbsd +0 -0
- binaries/gifsicle-linux +0 -0
- binaries/gifsicle-mac +0 -0
- binaries/optipng-fbsd +0 -0
- binaries/pngquant-fbsd +0 -0
- binaries/pngquant-linux +0 -0
- binaries/pngquant-mac +0 -0
- binaries/pngquant.exe +0 -0
- bulk.php +1 -1
- changelog.txt +13 -0
- classes/class-eio-base.php +8 -0
- classes/class-eio-js-webp.php +7 -3
- classes/class-eio-lazy-load.php +12 -13
- classes/class-ewwwio-media-background-process.php +5 -1
- classes/class-ewwwio-tracking.php +15 -2
- classes/class-exactdn.php +16 -10
- common.php +296 -78
- ewww-image-optimizer.php +2 -2
- includes/eio-settings.js +108 -18
- includes/jquery-ui-1.10.1.custom.css +8 -0
- includes/lazysizes-post.js +41 -5
- includes/lazysizes.min.js +1 -1
- readme.txt +15 -2
- tests/test-optimize.php +1 -1
- unique.php +48 -9
.travis.yml
CHANGED
@@ -22,7 +22,7 @@ services:
|
|
22 |
|
23 |
env:
|
24 |
- WP_VERSION=latest WP_MULTISITE=0
|
25 |
-
- WP_VERSION=5.
|
26 |
|
27 |
jobs:
|
28 |
include:
|
@@ -35,14 +35,15 @@ before_script:
|
|
35 |
- export PATH="$HOME/.config/composer/vendor/bin:$PATH"
|
36 |
- phpenv config-rm xdebug.ini
|
37 |
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
|
|
|
38 |
- |
|
39 |
-
if [[ $
|
40 |
-
composer global
|
41 |
-
|
42 |
-
composer global require
|
|
|
43 |
fi
|
44 |
- |
|
45 |
-
- composer global require squizlabs/php_codesniffer:3.5.0 wp-coding-standards/wpcs dealerdirect/phpcodesniffer-composer-installer phpcompatibility/phpcompatibility-wp yoast/phpunit-polyfills
|
46 |
|
47 |
script:
|
48 |
- if [[ "$WPSNIFF" == "1" ]]; then phpcs --standard=phpcs.ruleset.xml --extensions=php .; fi
|
22 |
|
23 |
env:
|
24 |
- WP_VERSION=latest WP_MULTISITE=0
|
25 |
+
- WP_VERSION=5.8 WP_MULTISITE=0
|
26 |
|
27 |
jobs:
|
28 |
include:
|
35 |
- export PATH="$HOME/.config/composer/vendor/bin:$PATH"
|
36 |
- phpenv config-rm xdebug.ini
|
37 |
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
|
38 |
+
- composer global require phpunit/phpunit ^7 yoast/phpunit-polyfills
|
39 |
- |
|
40 |
+
if [[ "$WPSNIFF" == "1" ]]; then
|
41 |
+
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
|
42 |
+
composer global require wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp
|
43 |
+
composer global require dealerdirect/phpcodesniffer-composer-installer
|
44 |
+
phpcs -i
|
45 |
fi
|
46 |
- |
|
|
|
47 |
|
48 |
script:
|
49 |
- if [[ "$WPSNIFF" == "1" ]]; then phpcs --standard=phpcs.ruleset.xml --extensions=php .; fi
|
binaries/gifsicle-fbsd
CHANGED
Binary file
|
binaries/gifsicle-linux
CHANGED
Binary file
|
binaries/gifsicle-mac
CHANGED
Binary file
|
binaries/optipng-fbsd
CHANGED
Binary file
|
binaries/pngquant-fbsd
CHANGED
Binary file
|
binaries/pngquant-linux
CHANGED
Binary file
|
binaries/pngquant-mac
CHANGED
Binary file
|
binaries/pngquant.exe
CHANGED
Binary file
|
bulk.php
CHANGED
@@ -1439,7 +1439,7 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
|
|
1439 |
continue;
|
1440 |
} else {
|
1441 |
if ( $smart_reopt ) {
|
1442 |
-
ewwwio_debug_message( "smart re-opt found level mismatch for $file_path, db says " . $already_optimized['level'] . " vs. current $compression_level" );
|
1443 |
} else {
|
1444 |
ewwwio_debug_message( "mismatch found for $file_path, db says " . $already_optimized['image_size'] . " vs. current $image_size" );
|
1445 |
}
|
1439 |
continue;
|
1440 |
} else {
|
1441 |
if ( $smart_reopt ) {
|
1442 |
+
ewwwio_debug_message( "smart re-opt found level mismatch (or needs resizing) for $file_path, db says " . $already_optimized['level'] . " vs. current $compression_level" );
|
1443 |
} else {
|
1444 |
ewwwio_debug_message( "mismatch found for $file_path, db says " . $already_optimized['image_size'] . " vs. current $image_size" );
|
1445 |
}
|
changelog.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 6.6.0 =
|
2 |
* added: AVIF support via Easy IO, enable on site management at ewww.io
|
3 |
* added: sharpening setting to improve WP resizing via ImageMagick and WebP conversion
|
1 |
+
= 6.7.0 =
|
2 |
+
* added: API keys can be used to auto-register sites for Easy IO, including sub-keys
|
3 |
+
* changed: expose legacy resize dimensions with removal option
|
4 |
+
* fixed: Lazy Load not using EWWWIO_CONTENT_DIR
|
5 |
+
* fixed: Easy IO Premium/WebP compression disabled incorrectly when in Easy Mode
|
6 |
+
* fixed: JS WebP body script throws error if wp_head script missing
|
7 |
+
* fixed: Lazy Load Auto-scale adds query parameters to SVG images
|
8 |
+
* fixed: JS WebP and Lazy Load prevent image loading in GiveWP iframe
|
9 |
+
* fixed: Auto Scale crops too much for object-* images in Oxygen
|
10 |
+
* fixed: trailing space on image URL handled incorrectly
|
11 |
+
* updated: Gifsicle to version 1.93 and Pngquant to 2.17
|
12 |
+
* removed: free binaries for SunOS, may use free cloud-based JPG compression instead
|
13 |
+
|
14 |
= 6.6.0 =
|
15 |
* added: AVIF support via Easy IO, enable on site management at ewww.io
|
16 |
* added: sharpening setting to improve WP resizing via ImageMagick and WebP conversion
|
classes/class-eio-base.php
CHANGED
@@ -142,6 +142,14 @@ if ( ! class_exists( 'EIO_Base' ) ) {
|
|
142 |
* @return string The full path to a writable plugin resource folder.
|
143 |
*/
|
144 |
function set_content_dir( $sub_folder ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
$content_dir = WP_CONTENT_DIR . $sub_folder;
|
146 |
if ( ! is_writable( WP_CONTENT_DIR ) || ! empty( $_ENV['PANTHEON_ENVIRONMENT'] ) ) {
|
147 |
$upload_dir = wp_get_upload_dir();
|
142 |
* @return string The full path to a writable plugin resource folder.
|
143 |
*/
|
144 |
function set_content_dir( $sub_folder ) {
|
145 |
+
if (
|
146 |
+
defined( 'EWWWIO_CONTENT_DIR' ) &&
|
147 |
+
trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'ewww' ) !== EWWWIO_CONTENT_DIR
|
148 |
+
) {
|
149 |
+
$content_dir = EWWWIO_CONTENT_DIR;
|
150 |
+
$this->content_url = str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, $content_dir );
|
151 |
+
return $content_dir;
|
152 |
+
}
|
153 |
$content_dir = WP_CONTENT_DIR . $sub_folder;
|
154 |
if ( ! is_writable( WP_CONTENT_DIR ) || ! empty( $_ENV['PANTHEON_ENVIRONMENT'] ) ) {
|
155 |
$upload_dir = wp_get_upload_dir();
|
classes/class-eio-js-webp.php
CHANGED
@@ -199,6 +199,9 @@ class EIO_JS_Webp extends EIO_Page_Parser {
|
|
199 |
if ( false !== strpos( $uri, '?fl_builder' ) ) {
|
200 |
return false;
|
201 |
}
|
|
|
|
|
|
|
202 |
if ( '/print/' === substr( $uri, -7 ) ) {
|
203 |
return false;
|
204 |
}
|
@@ -387,6 +390,7 @@ class EIO_JS_Webp extends EIO_Page_Parser {
|
|
387 |
|
388 |
$body_tags = $this->get_elements_from_html( $buffer, 'body' );
|
389 |
$body_webp_script = '<script data-cfasync="false" data-no-defer="1">if(ewww_webp_supported){document.body.classList.add("webp-support");}</script>';
|
|
|
390 |
if ( $this->is_iterable( $body_tags ) && ! empty( $body_tags[0] ) && false !== strpos( $body_tags[0], '<body' ) ) {
|
391 |
// Add the WebP script right after the opening tag.
|
392 |
$buffer = str_replace( $body_tags[0], $body_tags[0] . "\n" . $body_webp_script, $buffer );
|
@@ -406,7 +410,7 @@ class EIO_JS_Webp extends EIO_Page_Parser {
|
|
406 |
if ( ! $this->validate_tag( $image ) ) {
|
407 |
continue;
|
408 |
}
|
409 |
-
$file = $images['img_url'][ $index ];
|
410 |
ewwwio_debug_message( "parsing an image: $file" );
|
411 |
if ( strpos( $image, 'jetpack-lazy-image' ) && $this->validate_image_url( $file ) ) {
|
412 |
$new_image = $image;
|
@@ -543,7 +547,7 @@ class EIO_JS_Webp extends EIO_Page_Parser {
|
|
543 |
if ( strpos( $image, 'data-src=' ) && strpos( $image, 'data-srcset=' ) && strpos( $image, 'lazyload' ) ) {
|
544 |
// EWWW IO Lazy Load.
|
545 |
$new_image = $image;
|
546 |
-
$real_file = $this->get_attribute( $new_image, 'data-src' );
|
547 |
ewwwio_debug_message( "checking webp for Lazy Load data-src: $real_file" );
|
548 |
if ( $this->validate_image_url( $real_file ) ) {
|
549 |
ewwwio_debug_message( 'found webp for Lazy Load' );
|
@@ -571,7 +575,7 @@ class EIO_JS_Webp extends EIO_Page_Parser {
|
|
571 |
if ( ! $this->validate_tag( $image ) ) {
|
572 |
continue;
|
573 |
}
|
574 |
-
$file = $this->get_attribute( $image, 'src' );
|
575 |
if ( ( empty( $file ) || strpos( $image, 'R0lGODlhAQABAIAAAAAAAP' ) ) && strpos( $image, ' data-srcset=' ) && strpos( $this->get_attribute( $image, 'class' ), 'lazyload' ) ) {
|
576 |
$new_image = $image;
|
577 |
$srcset = $this->get_attribute( $new_image, 'data-srcset' );
|
199 |
if ( false !== strpos( $uri, '?fl_builder' ) ) {
|
200 |
return false;
|
201 |
}
|
202 |
+
if ( false !== strpos( $uri, '?giveDonationFormInIframe' ) ) {
|
203 |
+
return false;
|
204 |
+
}
|
205 |
if ( '/print/' === substr( $uri, -7 ) ) {
|
206 |
return false;
|
207 |
}
|
390 |
|
391 |
$body_tags = $this->get_elements_from_html( $buffer, 'body' );
|
392 |
$body_webp_script = '<script data-cfasync="false" data-no-defer="1">if(ewww_webp_supported){document.body.classList.add("webp-support");}</script>';
|
393 |
+
$body_webp_script = '<script data=cfasync="false" data-no-defer="1">if(typeof ewww_webp_supported==="undefined"){var ewww_webp_supported=!1}if(ewww_webp_supported){document.body.classList.add("webp-support")}</script>';
|
394 |
if ( $this->is_iterable( $body_tags ) && ! empty( $body_tags[0] ) && false !== strpos( $body_tags[0], '<body' ) ) {
|
395 |
// Add the WebP script right after the opening tag.
|
396 |
$buffer = str_replace( $body_tags[0], $body_tags[0] . "\n" . $body_webp_script, $buffer );
|
410 |
if ( ! $this->validate_tag( $image ) ) {
|
411 |
continue;
|
412 |
}
|
413 |
+
$file = trim( $images['img_url'][ $index ] );
|
414 |
ewwwio_debug_message( "parsing an image: $file" );
|
415 |
if ( strpos( $image, 'jetpack-lazy-image' ) && $this->validate_image_url( $file ) ) {
|
416 |
$new_image = $image;
|
547 |
if ( strpos( $image, 'data-src=' ) && strpos( $image, 'data-srcset=' ) && strpos( $image, 'lazyload' ) ) {
|
548 |
// EWWW IO Lazy Load.
|
549 |
$new_image = $image;
|
550 |
+
$real_file = trim( $this->get_attribute( $new_image, 'data-src' ) );
|
551 |
ewwwio_debug_message( "checking webp for Lazy Load data-src: $real_file" );
|
552 |
if ( $this->validate_image_url( $real_file ) ) {
|
553 |
ewwwio_debug_message( 'found webp for Lazy Load' );
|
575 |
if ( ! $this->validate_tag( $image ) ) {
|
576 |
continue;
|
577 |
}
|
578 |
+
$file = trim( $this->get_attribute( $image, 'src' ) );
|
579 |
if ( ( empty( $file ) || strpos( $image, 'R0lGODlhAQABAIAAAAAAAP' ) ) && strpos( $image, ' data-srcset=' ) && strpos( $this->get_attribute( $image, 'class' ), 'lazyload' ) ) {
|
580 |
$new_image = $image;
|
581 |
$srcset = $this->get_attribute( $new_image, 'data-srcset' );
|
classes/class-eio-lazy-load.php
CHANGED
@@ -232,6 +232,9 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
232 |
if ( false !== strpos( $uri, '?fl_builder' ) ) {
|
233 |
return false;
|
234 |
}
|
|
|
|
|
|
|
235 |
if ( '/print/' === substr( $uri, -7 ) ) {
|
236 |
return false;
|
237 |
}
|
@@ -466,6 +469,7 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
466 |
$this->debug_message( "possible replacement at $position" );
|
467 |
$images_processed++;
|
468 |
if ( $images_processed <= $above_the_fold ) {
|
|
|
469 |
continue;
|
470 |
}
|
471 |
if ( empty( $replacement['orig'] ) || empty( $replacement['lazy'] ) ) {
|
@@ -492,12 +496,6 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
492 |
function parse_img_tag( $image, $file = '' ) {
|
493 |
$this->debug_message( '<b>' . __METHOD__ . '()</b>' );
|
494 |
global $exactdn;
|
495 |
-
if ( ! $file ) {
|
496 |
-
$file = $this->get_attribute( $image, 'src' );
|
497 |
-
}
|
498 |
-
$file = str_replace( '&', '&', esc_url( $file ) );
|
499 |
-
$this->set_attribute( $image, 'data-src', $file, true );
|
500 |
-
$srcset = $this->get_attribute( $image, 'srcset' );
|
501 |
|
502 |
if (
|
503 |
! empty( $_POST['action'] ) && // phpcs:ignore WordPress.Security.NonceVerification
|
@@ -515,6 +513,13 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
515 |
return $image;
|
516 |
}
|
517 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
$physical_width = false;
|
519 |
$physical_height = false;
|
520 |
$width_attr = $this->get_attribute( $image, 'width' );
|
@@ -566,13 +571,6 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
566 |
$placeholder_types[] = 'siip';
|
567 |
}
|
568 |
|
569 |
-
if ( // This isn't super helpful. It makes PIIPs that don't help with auto-scaling.
|
570 |
-
false && ( ! $physical_width || ! $physical_height ) &&
|
571 |
-
$width_attr && is_numeric( $width_attr ) && $height_attr && is_numeric( $height_attr )
|
572 |
-
) {
|
573 |
-
$physical_width = $width_attr;
|
574 |
-
$physical_height = $height_attr;
|
575 |
-
}
|
576 |
foreach ( $placeholder_types as $placeholder_type ) {
|
577 |
switch ( $placeholder_type ) {
|
578 |
case 'lqip':
|
@@ -961,6 +959,7 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
961 |
'owl-lazy',
|
962 |
'preload-me',
|
963 |
'skip-lazy',
|
|
|
964 |
'timthumb.php?',
|
965 |
'wpcf7_captcha/',
|
966 |
),
|
232 |
if ( false !== strpos( $uri, '?fl_builder' ) ) {
|
233 |
return false;
|
234 |
}
|
235 |
+
if ( false !== strpos( $uri, '?giveDonationFormInIframe' ) ) {
|
236 |
+
return false;
|
237 |
+
}
|
238 |
if ( '/print/' === substr( $uri, -7 ) ) {
|
239 |
return false;
|
240 |
}
|
469 |
$this->debug_message( "possible replacement at $position" );
|
470 |
$images_processed++;
|
471 |
if ( $images_processed <= $above_the_fold ) {
|
472 |
+
$this->debug_message( 'image above fold threshold' );
|
473 |
continue;
|
474 |
}
|
475 |
if ( empty( $replacement['orig'] ) || empty( $replacement['lazy'] ) ) {
|
496 |
function parse_img_tag( $image, $file = '' ) {
|
497 |
$this->debug_message( '<b>' . __METHOD__ . '()</b>' );
|
498 |
global $exactdn;
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
|
500 |
if (
|
501 |
! empty( $_POST['action'] ) && // phpcs:ignore WordPress.Security.NonceVerification
|
513 |
return $image;
|
514 |
}
|
515 |
|
516 |
+
if ( ! $file ) {
|
517 |
+
$file = $this->get_attribute( $image, 'src' );
|
518 |
+
}
|
519 |
+
$file = str_replace( '&', '&', esc_url( trim( $file ) ) );
|
520 |
+
$this->set_attribute( $image, 'data-src', $file, true );
|
521 |
+
$srcset = $this->get_attribute( $image, 'srcset' );
|
522 |
+
|
523 |
$physical_width = false;
|
524 |
$physical_height = false;
|
525 |
$width_attr = $this->get_attribute( $image, 'width' );
|
571 |
$placeholder_types[] = 'siip';
|
572 |
}
|
573 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
foreach ( $placeholder_types as $placeholder_type ) {
|
575 |
switch ( $placeholder_type ) {
|
576 |
case 'lqip':
|
959 |
'owl-lazy',
|
960 |
'preload-me',
|
961 |
'skip-lazy',
|
962 |
+
'soliloquy-image',
|
963 |
'timthumb.php?',
|
964 |
'wpcf7_captcha/',
|
965 |
),
|
classes/class-ewwwio-media-background-process.php
CHANGED
@@ -672,7 +672,11 @@ class EWWWIO_Test_Async_Handler extends WP_Async_Request {
|
|
672 |
ewwwio_debug_message( 'wrong item received, not enabling background opt' );
|
673 |
return;
|
674 |
}
|
675 |
-
|
|
|
|
|
|
|
|
|
676 |
}
|
677 |
}
|
678 |
global $ewwwio_test_async;
|
672 |
ewwwio_debug_message( 'wrong item received, not enabling background opt' );
|
673 |
return;
|
674 |
}
|
675 |
+
ewwwio_debug_message( 'setting background option to true' );
|
676 |
+
$success = ewww_image_optimizer_set_option( 'ewww_image_optimizer_background_optimization', true );
|
677 |
+
if ( $success ) {
|
678 |
+
ewwwio_debug_message( 'hurrah, async enabled!' );
|
679 |
+
}
|
680 |
}
|
681 |
}
|
682 |
global $ewwwio_test_async;
|
classes/class-ewwwio-tracking.php
CHANGED
@@ -99,8 +99,21 @@ class EWWWIO_Tracking {
|
|
99 |
if ( ! function_exists( 'ewww_image_optimizer_aux_images_table_count_pending' ) ) {
|
100 |
require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'aux-optimize.php' );
|
101 |
}
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
$data['nextgen'] = class_exists( 'EWWW_Nextgen' ) ? true : false;
|
106 |
$data['nextcellent'] = class_exists( 'EWWW_Nextcellent' ) ? true : false;
|
99 |
if ( ! function_exists( 'ewww_image_optimizer_aux_images_table_count_pending' ) ) {
|
100 |
require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'aux-optimize.php' );
|
101 |
}
|
102 |
+
if (
|
103 |
+
ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ||
|
104 |
+
! ewww_image_optimizer_os_supported() ||
|
105 |
+
( defined( 'EWWW_IMAGE_OPTIMIZER_NOEXEC' ) && EWWW_IMAGE_OPTIMIZER_NOEXEC )
|
106 |
+
) {
|
107 |
+
$total_images = 0;
|
108 |
+
$total_savings = 0;
|
109 |
+
} else {
|
110 |
+
$total_images = ewww_image_optimizer_aux_images_table_count();
|
111 |
+
$total_sizes = ewww_image_optimizer_savings();
|
112 |
+
$total_savings = $total_sizes[1] - $total_sizes[0];
|
113 |
+
}
|
114 |
+
|
115 |
+
$data['images_optimized'] = $total_images;
|
116 |
+
$data['bytes_saved'] = $total_savings;
|
117 |
|
118 |
$data['nextgen'] = class_exists( 'EWWW_Nextgen' ) ? true : false;
|
119 |
$data['nextcellent'] = class_exists( 'EWWW_Nextcellent' ) ? true : false;
|
classes/class-exactdn.php
CHANGED
@@ -950,8 +950,8 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
950 |
$fullsize_url = false;
|
951 |
|
952 |
// Identify image source.
|
953 |
-
$src = $images['img_url'][ $index ];
|
954 |
-
$src_orig = $images['img_url'][ $index ];
|
955 |
if ( is_string( $src ) ) {
|
956 |
$this->debug_message( $src );
|
957 |
} else {
|
@@ -993,7 +993,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
993 |
}
|
994 |
// Support Lazy Load plugins.
|
995 |
// Don't modify $tag yet as we need unmodified version later.
|
996 |
-
$lazy_load_src = $this->get_attribute( $images['img_tag'][ $index ], 'data-lazy-src' );
|
997 |
if ( $lazy_load_src ) {
|
998 |
$placeholder_src = $src;
|
999 |
$placeholder_src_orig = $src;
|
@@ -1004,7 +1004,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
1004 |
$srcset_fill = true;
|
1005 |
}
|
1006 |
// Must be a legacy Jetpack thing as far as I can tell, no matches found in any currently installed plugins.
|
1007 |
-
$lazy_load_src = $this->get_attribute( $images['img_tag'][ $index ], 'data-lazy-original' );
|
1008 |
if ( ! $lazy && $lazy_load_src ) {
|
1009 |
$placeholder_src = $src;
|
1010 |
$placeholder_src_orig = $src;
|
@@ -1013,7 +1013,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
1013 |
$lazy = true;
|
1014 |
}
|
1015 |
if ( ! $lazy && strpos( $images['img_tag'][ $index ], 'a3-lazy-load/assets/images/lazy_placeholder' ) ) {
|
1016 |
-
$lazy_load_src = $this->get_attribute( $images['img_tag'][ $index ], 'data-src' );
|
1017 |
}
|
1018 |
if (
|
1019 |
! $lazy &&
|
@@ -1037,7 +1037,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
1037 |
$srcset_fill = true;
|
1038 |
}
|
1039 |
if ( ! $lazy && strpos( $images['img_tag'][ $index ], 'revslider/admin/assets/images/dummy' ) ) {
|
1040 |
-
$lazy_load_src = $this->get_attribute( $images['img_tag'][ $index ], 'data-lazyload' );
|
1041 |
}
|
1042 |
if ( ! $lazy && $lazy_load_src ) {
|
1043 |
$placeholder_src = $src;
|
@@ -1343,7 +1343,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
1343 |
}
|
1344 |
|
1345 |
// Cleanup ExactDN URL.
|
1346 |
-
$exactdn_url = str_replace( '&', '&', esc_url( $exactdn_url ) );
|
1347 |
// Supplant the original source value with our ExactDN URL.
|
1348 |
$this->debug_message( "replacing $src_orig with $exactdn_url" );
|
1349 |
if ( $is_relative ) {
|
@@ -1357,7 +1357,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
1357 |
$placeholder_src = $this->generate_url( $placeholder_src );
|
1358 |
|
1359 |
if ( $placeholder_src !== $placeholder_src_orig ) {
|
1360 |
-
$new_tag = str_replace( $placeholder_src_orig, str_replace( '&', '&', esc_url( $placeholder_src ) ), $new_tag );
|
1361 |
}
|
1362 |
|
1363 |
unset( $placeholder_src );
|
@@ -1442,7 +1442,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
1442 |
// If Lazy Load is in use, pass placeholder image through ExactDN.
|
1443 |
$placeholder_src = $this->generate_url( $placeholder_src );
|
1444 |
if ( $placeholder_src !== $placeholder_src_orig ) {
|
1445 |
-
$new_tag = str_replace( $placeholder_src_orig, str_replace( '&', '&', esc_url( $placeholder_src ) ), $new_tag );
|
1446 |
// Replace original tag with modified version.
|
1447 |
$content = str_replace( $tag, $new_tag, $content );
|
1448 |
}
|
@@ -1857,6 +1857,9 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
1857 |
if ( ! empty( $_REQUEST['action'] ) && 'alm_get_posts' === $_REQUEST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
|
1858 |
return true;
|
1859 |
}
|
|
|
|
|
|
|
1860 |
if ( ! empty( $_POST['action'] ) && 'eddvbugm_viewport_downloads' === $_POST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
|
1861 |
return true;
|
1862 |
}
|
@@ -2686,7 +2689,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
2686 |
add_filter( 'exactdn_skip_image', '__return_true', PHP_INT_MAX ); // This skips existing srcset indices.
|
2687 |
add_filter( 'exactdn_srcset_multipliers', '__return_false', PHP_INT_MAX ); // This one skips the additional multipliers.
|
2688 |
} elseif ( is_string( $route ) && false !== strpos( $route, 'wp/v2/media/' ) && ! empty( $request['context'] ) && 'view' === $request['context'] ) {
|
2689 |
-
$this->debug_message( 'REST API media endpoint
|
2690 |
// We don't want ExactDN urls anywhere near the editor, so disable everything we can.
|
2691 |
add_filter( 'exactdn_override_image_downsize', '__return_true', PHP_INT_MAX );
|
2692 |
add_filter( 'exactdn_skip_image', '__return_true', PHP_INT_MAX ); // This skips existing srcset indices.
|
@@ -3105,6 +3108,9 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
3105 |
if ( strpos( $image_url, 'public/images/spacer.' ) ) {
|
3106 |
return array();
|
3107 |
}
|
|
|
|
|
|
|
3108 |
if ( '.svg' === substr( $image_url, -4 ) ) {
|
3109 |
return array();
|
3110 |
}
|
950 |
$fullsize_url = false;
|
951 |
|
952 |
// Identify image source.
|
953 |
+
$src = trim( $images['img_url'][ $index ] );
|
954 |
+
$src_orig = $images['img_url'][ $index ]; // Don't trim, because we'll use it for search/replacement later.
|
955 |
if ( is_string( $src ) ) {
|
956 |
$this->debug_message( $src );
|
957 |
} else {
|
993 |
}
|
994 |
// Support Lazy Load plugins.
|
995 |
// Don't modify $tag yet as we need unmodified version later.
|
996 |
+
$lazy_load_src = trim( $this->get_attribute( $images['img_tag'][ $index ], 'data-lazy-src' ) );
|
997 |
if ( $lazy_load_src ) {
|
998 |
$placeholder_src = $src;
|
999 |
$placeholder_src_orig = $src;
|
1004 |
$srcset_fill = true;
|
1005 |
}
|
1006 |
// Must be a legacy Jetpack thing as far as I can tell, no matches found in any currently installed plugins.
|
1007 |
+
$lazy_load_src = trim( $this->get_attribute( $images['img_tag'][ $index ], 'data-lazy-original' ) );
|
1008 |
if ( ! $lazy && $lazy_load_src ) {
|
1009 |
$placeholder_src = $src;
|
1010 |
$placeholder_src_orig = $src;
|
1013 |
$lazy = true;
|
1014 |
}
|
1015 |
if ( ! $lazy && strpos( $images['img_tag'][ $index ], 'a3-lazy-load/assets/images/lazy_placeholder' ) ) {
|
1016 |
+
$lazy_load_src = trim( $this->get_attribute( $images['img_tag'][ $index ], 'data-src' ) );
|
1017 |
}
|
1018 |
if (
|
1019 |
! $lazy &&
|
1037 |
$srcset_fill = true;
|
1038 |
}
|
1039 |
if ( ! $lazy && strpos( $images['img_tag'][ $index ], 'revslider/admin/assets/images/dummy' ) ) {
|
1040 |
+
$lazy_load_src = trim( $this->get_attribute( $images['img_tag'][ $index ], 'data-lazyload' ) );
|
1041 |
}
|
1042 |
if ( ! $lazy && $lazy_load_src ) {
|
1043 |
$placeholder_src = $src;
|
1343 |
}
|
1344 |
|
1345 |
// Cleanup ExactDN URL.
|
1346 |
+
$exactdn_url = str_replace( '&', '&', esc_url( trim( $exactdn_url ) ) );
|
1347 |
// Supplant the original source value with our ExactDN URL.
|
1348 |
$this->debug_message( "replacing $src_orig with $exactdn_url" );
|
1349 |
if ( $is_relative ) {
|
1357 |
$placeholder_src = $this->generate_url( $placeholder_src );
|
1358 |
|
1359 |
if ( $placeholder_src !== $placeholder_src_orig ) {
|
1360 |
+
$new_tag = str_replace( $placeholder_src_orig, str_replace( '&', '&', esc_url( trim( $placeholder_src ) ) ), $new_tag );
|
1361 |
}
|
1362 |
|
1363 |
unset( $placeholder_src );
|
1442 |
// If Lazy Load is in use, pass placeholder image through ExactDN.
|
1443 |
$placeholder_src = $this->generate_url( $placeholder_src );
|
1444 |
if ( $placeholder_src !== $placeholder_src_orig ) {
|
1445 |
+
$new_tag = str_replace( $placeholder_src_orig, str_replace( '&', '&', esc_url( trim( $placeholder_src ) ) ), $new_tag );
|
1446 |
// Replace original tag with modified version.
|
1447 |
$content = str_replace( $tag, $new_tag, $content );
|
1448 |
}
|
1857 |
if ( ! empty( $_REQUEST['action'] ) && 'alm_get_posts' === $_REQUEST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
|
1858 |
return true;
|
1859 |
}
|
1860 |
+
if ( ! empty( $_POST['action'] ) && 'do_filter_products' === $_POST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
|
1861 |
+
return true;
|
1862 |
+
}
|
1863 |
if ( ! empty( $_POST['action'] ) && 'eddvbugm_viewport_downloads' === $_POST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
|
1864 |
return true;
|
1865 |
}
|
2689 |
add_filter( 'exactdn_skip_image', '__return_true', PHP_INT_MAX ); // This skips existing srcset indices.
|
2690 |
add_filter( 'exactdn_srcset_multipliers', '__return_false', PHP_INT_MAX ); // This one skips the additional multipliers.
|
2691 |
} elseif ( is_string( $route ) && false !== strpos( $route, 'wp/v2/media/' ) && ! empty( $request['context'] ) && 'view' === $request['context'] ) {
|
2692 |
+
$this->debug_message( 'REST API media endpoint, could be editor, we may never know...' );
|
2693 |
// We don't want ExactDN urls anywhere near the editor, so disable everything we can.
|
2694 |
add_filter( 'exactdn_override_image_downsize', '__return_true', PHP_INT_MAX );
|
2695 |
add_filter( 'exactdn_skip_image', '__return_true', PHP_INT_MAX ); // This skips existing srcset indices.
|
3108 |
if ( strpos( $image_url, 'public/images/spacer.' ) ) {
|
3109 |
return array();
|
3110 |
}
|
3111 |
+
if ( strpos( $image_url, '/images/default/blank.gif' ) ) {
|
3112 |
+
return array();
|
3113 |
+
}
|
3114 |
if ( '.svg' === substr( $image_url, -4 ) ) {
|
3115 |
return array();
|
3116 |
}
|
common.php
CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
exit;
|
15 |
}
|
16 |
|
17 |
-
define( 'EWWW_IMAGE_OPTIMIZER_VERSION',
|
18 |
|
19 |
// Initialize a couple globals.
|
20 |
$eio_debug = '';
|
@@ -154,10 +154,6 @@ add_action( 'admin_menu', 'ewww_image_optimizer_admin_menu', 60 );
|
|
154 |
add_action( 'network_admin_menu', 'ewww_image_optimizer_network_admin_menu' );
|
155 |
// Handle the bulk actions from the media library.
|
156 |
add_filter( 'handle_bulk_actions-upload', 'ewww_image_optimizer_bulk_action_handler', 10, 3 );
|
157 |
-
// Adds scripts to ajaxify the one-click actions on the media library, and register tooltips for conversion links.
|
158 |
-
add_action( 'admin_enqueue_scripts', 'ewww_image_optimizer_media_scripts' );
|
159 |
-
// Adds scripts for the EWWW IO settings page.
|
160 |
-
add_action( 'admin_enqueue_scripts', 'ewww_image_optimizer_settings_script' );
|
161 |
// Enables scheduled optimization via wp-cron.
|
162 |
add_action( 'ewww_image_optimizer_auto', 'ewww_image_optimizer_auto' );
|
163 |
// Correct records for files renamed by MFR.
|
@@ -174,6 +170,8 @@ add_action( 'wp_ajax_ewww_exactdn_activate', 'ewww_image_optimizer_exactdn_activ
|
|
174 |
add_action( 'wp_ajax_ewww_exactdn_activate_site', 'ewww_image_optimizer_exactdn_activate_site_ajax' );
|
175 |
// AJAX action hook to register a specific site with Easy IO.
|
176 |
add_action( 'wp_ajax_ewww_exactdn_register_site', 'ewww_image_optimizer_exactdn_register_site_ajax' );
|
|
|
|
|
177 |
// AJAX action hook for inserting WebP rewrite rules into .htaccess.
|
178 |
add_action( 'wp_ajax_ewww_webp_rewrite', 'ewww_image_optimizer_webp_rewrite' );
|
179 |
// AJAX action hook for removing WebP rewrite rules from .htaccess.
|
@@ -221,9 +219,12 @@ add_action( 'admin_action_ewww_image_optimizer_download_debug_log', 'ewww_image_
|
|
221 |
// Non-AJAX handler to apply 6.2 current_timestamp db upgrade.
|
222 |
add_action( 'admin_action_ewww_image_optimizer_620_upgrade', 'ewww_image_optimizer_620_upgrade' );
|
223 |
// Check if WebP option was turned off and is now enabled.
|
224 |
-
|
225 |
// Check Scheduled Opt option has just been disabled and clear the queues/stop the process.
|
226 |
-
|
|
|
|
|
|
|
227 |
// Makes sure to flush out any scheduled jobs on deactivation.
|
228 |
register_deactivation_hook( EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE, 'ewww_image_optimizer_network_deactivate' );
|
229 |
// add_action( 'shutdown', 'ewwwio_memory_output' );.
|
@@ -947,6 +948,14 @@ function ewww_image_optimizer_upgrade() {
|
|
947 |
ewwwio_debug_message( 'removing old version of pngout' );
|
948 |
ewwwio_delete_file( EWWW_IMAGE_OPTIMIZER_TOOL_PATH . '/pngout-static' );
|
949 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
950 |
if ( get_option( 'ewww_image_optimizer_version' ) && ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_review_time' ) ) {
|
951 |
$review_time = rand( time(), time() + 51 * DAY_IN_SECONDS );
|
952 |
add_option( 'ewww_image_optimizer_review_time', $review_time, '', false );
|
@@ -1116,6 +1125,10 @@ function ewww_image_optimizer_admin_init() {
|
|
1116 |
register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_webp_rewrite_exclude', 'ewww_image_optimizer_exclude_paths_sanitize' );
|
1117 |
ewww_image_optimizer_exec_init();
|
1118 |
ewww_image_optimizer_cron_setup( 'ewww_image_optimizer_auto' );
|
|
|
|
|
|
|
|
|
1119 |
// Queue the function that contains custom styling for our progressbars.
|
1120 |
add_action( 'admin_enqueue_scripts', 'ewww_image_optimizer_progressbar_style' );
|
1121 |
if ( false !== strpos( add_query_arg( null, null ), 'site-new.php' ) ) {
|
@@ -1969,55 +1982,22 @@ function ewww_image_optimizer_migrate_option_queue_to_table() {
|
|
1969 |
/**
|
1970 |
* Checks to see if the WebP conversion was just enabled.
|
1971 |
*
|
1972 |
-
* @param mixed $new_value The new value, in this case it will be boolean usually.
|
1973 |
* @param mixed $old_value The old value, also a boolean generally.
|
1974 |
-
* @
|
1975 |
*/
|
1976 |
-
function ewww_image_optimizer_webp_maybe_enabled( $
|
1977 |
if ( ! empty( $new_value ) && (bool) $new_value !== (bool) $old_value ) {
|
1978 |
update_option( 'ewww_image_optimizer_webp_enabled', true );
|
1979 |
}
|
1980 |
-
return $new_value;
|
1981 |
-
}
|
1982 |
-
|
1983 |
-
/**
|
1984 |
-
* Checks if a plugin is offloading media to cloud storage and removing local copies.
|
1985 |
-
*
|
1986 |
-
* @return bool True if a plugin is removing local files, false otherwise..
|
1987 |
-
*/
|
1988 |
-
function ewww_image_optimizer_cloud_based_media() {
|
1989 |
-
if ( class_exists( 'Amazon_S3_And_CloudFront' ) ) {
|
1990 |
-
global $as3cf;
|
1991 |
-
if ( is_object( $as3cf ) && $as3cf->get_setting( 'serve-from-s3' ) && $as3cf->get_setting( 'remove-local-file' ) ) {
|
1992 |
-
return true;
|
1993 |
-
}
|
1994 |
-
}
|
1995 |
-
if ( class_exists( 'S3_Uploads' ) && function_exists( 's3_uploads_enabled' ) && s3_uploads_enabled() ) {
|
1996 |
-
return true;
|
1997 |
-
}
|
1998 |
-
if ( class_exists( 'S3_Uploads\Plugin' ) && function_exists( 'S3_Uploads\enabled' ) && \S3_Uploads\enabled() ) {
|
1999 |
-
return true;
|
2000 |
-
}
|
2001 |
-
if ( class_exists( 'wpCloud\StatelessMedia\EWWW' ) && function_exists( 'ud_get_stateless_media' ) ) {
|
2002 |
-
$sm = ud_get_stateless_media();
|
2003 |
-
if ( method_exists( $sm, 'get' ) ) {
|
2004 |
-
$sm_mode = $sm->get( 'sm.mode' );
|
2005 |
-
if ( 'disabled' !== $sm_mode ) {
|
2006 |
-
return true;
|
2007 |
-
}
|
2008 |
-
}
|
2009 |
-
}
|
2010 |
-
return false;
|
2011 |
}
|
2012 |
|
2013 |
/**
|
2014 |
* Checks to see if Scheduled Optimization was just disabled.
|
2015 |
*
|
2016 |
-
* @param mixed $new_value The new value, in this case it will be boolean usually.
|
2017 |
* @param mixed $old_value The old value, also a boolean generally.
|
2018 |
-
* @
|
2019 |
*/
|
2020 |
-
function
|
2021 |
if ( empty( $new_value ) && (bool) $new_value !== (bool) $old_value ) {
|
2022 |
global $ewwwio_image_background;
|
2023 |
if ( ! class_exists( 'WP_Background_Process' ) ) {
|
@@ -2026,7 +2006,24 @@ function ewww_image_optimizer_scheduled_optimizaton_changed( $new_value, $old_va
|
|
2026 |
$ewwwio_image_background->cancel_process();
|
2027 |
update_option( 'ewwwio_stop_scheduled_scan', true, false );
|
2028 |
}
|
2029 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2030 |
}
|
2031 |
|
2032 |
/**
|
@@ -2466,6 +2463,36 @@ function ewww_image_optimizer_notice_reoptimization() {
|
|
2466 |
}
|
2467 |
}
|
2468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2469 |
/**
|
2470 |
* Loads the class to extend WP_Image_Editor for automatic optimization of generated images.
|
2471 |
*
|
@@ -5178,8 +5205,7 @@ function ewww_image_optimizer_register_site_post() {
|
|
5178 |
'timeout' => 60,
|
5179 |
'sslverify' => false,
|
5180 |
'body' => array(
|
5181 |
-
'
|
5182 |
-
'token' => $key,
|
5183 |
'site_url' => $site_url,
|
5184 |
),
|
5185 |
)
|
@@ -5187,6 +5213,134 @@ function ewww_image_optimizer_register_site_post() {
|
|
5187 |
return $result;
|
5188 |
}
|
5189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5190 |
/**
|
5191 |
* Sanitizes an API key for the cloud service.
|
5192 |
*
|
@@ -7811,7 +7965,11 @@ function ewww_image_optimizer_resize_upload( $file ) {
|
|
7811 |
do_action( 'ewww_image_optimizer_image_resized', $file, $new_file );
|
7812 |
ewwwio_debug_message( "after resizing: $new_size" );
|
7813 |
// Use PEL to get the exif (if Remove Meta is unchecked) and GD is in use, so we can save it to the new image.
|
7814 |
-
if (
|
|
|
|
|
|
|
|
|
7815 |
ewwwio_debug_message( 'manually copying metadata for GD' );
|
7816 |
try {
|
7817 |
$old_jpeg = new PelJpeg( $file );
|
@@ -7896,9 +8054,6 @@ function ewww_image_optimizer_get_orientation( $file, $type ) {
|
|
7896 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
7897 |
if ( function_exists( 'exif_read_data' ) && 'image/jpeg' === $type && ewwwio_is_readable( $file ) ) {
|
7898 |
$exif = @exif_read_data( $file );
|
7899 |
-
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_debug' ) && ewww_image_optimizer_function_exists( 'print_r' ) ) {
|
7900 |
-
ewwwio_debug_message( print_r( $exif, true ) );
|
7901 |
-
}
|
7902 |
if ( is_array( $exif ) && array_key_exists( 'Orientation', $exif ) ) {
|
7903 |
return $exif['Orientation'];
|
7904 |
}
|
@@ -9719,7 +9874,9 @@ function ewww_image_optimizer_custom_column( $column_name, $id, $meta = null ) {
|
|
9719 |
// Get a human readable filesize.
|
9720 |
$file_size = ewww_image_optimizer_size_format( filesize( $file_path ) );
|
9721 |
}
|
9722 |
-
if ( ! defined( 'EWWW_IMAGE_OPTIMIZER_JPEGTRAN' ) ) {
|
|
|
|
|
9723 |
ewww_image_optimizer_tool_init();
|
9724 |
ewww_image_optimizer_notice_utils( 'quiet' );
|
9725 |
}
|
@@ -10790,6 +10947,9 @@ function ewww_image_optimizer_settings_script( $hook ) {
|
|
10790 |
if ( 'settings_page_ewww-image-optimizer-options' !== $hook ) {
|
10791 |
return;
|
10792 |
}
|
|
|
|
|
|
|
10793 |
add_filter( 'admin_footer_text', 'ewww_image_optimizer_footer_review_text' );
|
10794 |
if (
|
10795 |
! ewww_image_optimizer_get_option( 'ewww_image_optimizer_wizard_complete' ) &&
|
@@ -10821,6 +10981,9 @@ function ewww_image_optimizer_settings_script( $hook ) {
|
|
10821 |
}
|
10822 |
wp_enqueue_script( 'jquery-ui-progressbar' );
|
10823 |
}
|
|
|
|
|
|
|
10824 |
add_thickbox();
|
10825 |
wp_enqueue_script( 'ewww-beacon-script', plugins_url( '/includes/eio-beacon.js', __FILE__ ), array( 'jquery' ), EWWW_IMAGE_OPTIMIZER_VERSION );
|
10826 |
wp_enqueue_script( 'ewww-settings-script', plugins_url( '/includes/eio-settings.js', __FILE__ ), array( 'jquery' ), EWWW_IMAGE_OPTIMIZER_VERSION, true );
|
@@ -10841,6 +11004,10 @@ function ewww_image_optimizer_settings_script( $hook ) {
|
|
10841 |
'exactdn_network_success' => esc_html__( 'Easy IO setup and verification is complete.', 'ewww-image-optimizer' ),
|
10842 |
'webp_cloud_warning' => esc_html__( 'If you have not run the Bulk Optimizer on existing images, you will likely encounter broken image URLs. Are you ready to continue?', 'ewww-image-optimizer' ),
|
10843 |
'network_blog_ids' => $blog_ids,
|
|
|
|
|
|
|
|
|
10844 |
)
|
10845 |
);
|
10846 |
wp_add_inline_script(
|
@@ -11398,6 +11565,8 @@ function ewwwio_debug_info() {
|
|
11398 |
if ( ! defined( 'EWWW_IMAGE_OPTIMIZER_NOEXEC' ) ) {
|
11399 |
if ( defined( 'EWWW_IMAGE_OPTIMIZER_CLOUD' ) && EWWW_IMAGE_OPTIMIZER_CLOUD ) {
|
11400 |
ewww_image_optimizer_disable_tools();
|
|
|
|
|
11401 |
} else {
|
11402 |
ewww_image_optimizer_tool_init();
|
11403 |
ewww_image_optimizer_notice_utils( 'quiet' );
|
@@ -11482,7 +11651,7 @@ function ewwwio_debug_info() {
|
|
11482 |
'ewwwio_test_verify' => '949c34123cf2a4e4ce2f985135830df4a1b2adc24905f53d2fd3f5df5b16293245',
|
11483 |
),
|
11484 |
'cookies' => $_COOKIE,
|
11485 |
-
'sslverify' => false,
|
11486 |
);
|
11487 |
// Don't lock up other requests while processing.
|
11488 |
session_write_close();
|
@@ -11611,6 +11780,8 @@ function ewww_image_optimizer_intro_wizard() {
|
|
11611 |
if ( ! defined( 'EWWW_IMAGE_OPTIMIZER_NOEXEC' ) ) {
|
11612 |
if ( defined( 'EWWW_IMAGE_OPTIMIZER_CLOUD' ) && EWWW_IMAGE_OPTIMIZER_CLOUD ) {
|
11613 |
ewww_image_optimizer_disable_tools();
|
|
|
|
|
11614 |
} else {
|
11615 |
ewww_image_optimizer_tool_init();
|
11616 |
ewww_image_optimizer_notice_utils( 'quiet' );
|
@@ -11623,7 +11794,7 @@ function ewww_image_optimizer_intro_wizard() {
|
|
11623 |
) {
|
11624 |
$show_premium = true;
|
11625 |
} elseif (
|
11626 |
-
ewww_image_optimizer_exec_check() &&
|
11627 |
! ewww_image_optimizer_get_option( 'ewww_image_optimizer_dismiss_exec_notice' ) &&
|
11628 |
! ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) &&
|
11629 |
! ewww_image_optimizer_easy_active()
|
@@ -11766,7 +11937,7 @@ function ewww_image_optimizer_intro_wizard() {
|
|
11766 |
<span class="description"><?php esc_html_e( 'Premium compression for your local images.', 'ewww-image-optimizer' ); ?></span>
|
11767 |
</p>
|
11768 |
<div id='ewwwio-easy-activation-result'></div>
|
11769 |
-
<
|
11770 |
<label><?php esc_html_e( 'Easy IO', 'ewww-image-optimizer' ); ?></label><br>
|
11771 |
<span class="description">
|
11772 |
<?php
|
@@ -11781,19 +11952,33 @@ function ewww_image_optimizer_intro_wizard() {
|
|
11781 |
<br><span class="description" style="font-weight: bolder"><?php esc_html_e( 'Easy IO cannot be activated on localhost installs.', 'ewww-image-optimizer' ); ?></span>
|
11782 |
<?php elseif ( empty( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) ) : ?>
|
11783 |
<br><br>
|
11784 |
-
|
11785 |
-
|
|
|
|
|
11786 |
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11787 |
<input type='text' id='exactdn_site_url' name='exactdn_site_url' value='<?php echo esc_url( trim( $easyio_site_url ) ); ?>' readonly />
|
11788 |
<span id='exactdn-site-url-copy'><?php esc_html_e( 'Click to Copy', 'ewww-image-optimizer' ); ?></span>
|
11789 |
<span id='exactdn-site-url-copied'><?php esc_html_e( 'Copied', 'ewww-image-optimizer' ); ?></span><br>
|
|
|
|
|
|
|
|
|
11790 |
<a id='ewwwio-easy-activate' href='#' class='button-secondary'><?php esc_html_e( 'Activate', 'ewww-image-optimizer' ); ?></a>
|
11791 |
<span id='ewwwio-easy-activation-processing'><img src='<?php echo esc_url( $loading_image_url ); ?>' alt='loading'/></span>
|
11792 |
<?php elseif ( class_exists( 'ExactDN' ) && ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) && $exactdn->get_exactdn_domain() && $exactdn->verify_domain( $exactdn->get_exactdn_domain() ) ) : ?>
|
11793 |
<br><span style="color: #3eadc9; font-weight: bolder"><?php esc_html_e( 'Verified', 'ewww-image-optimizer' ); ?></span>
|
11794 |
<span class="dashicons dashicons-yes"></span>
|
11795 |
<?php endif; ?>
|
11796 |
-
</
|
11797 |
</div>
|
11798 |
<input type='radio' id='ewww_image_optimizer_budget_free' name='ewww_image_optimizer_budget' value='free' required />
|
11799 |
<label for='ewww_image_optimizer_budget_free'><?php esc_html_e( 'Stick with free mode for now', 'ewww-image-optimizer' ); ?></label>
|
@@ -11907,7 +12092,7 @@ function ewww_image_optimizer_intro_wizard() {
|
|
11907 |
</p>
|
11908 |
<?php endif; ?>
|
11909 |
<p>
|
11910 |
-
<input type='checkbox' id='ewww_image_optimizer_enable_help' name='ewww_image_optimizer_enable_help' value='true'
|
11911 |
<label for='ewww_image_optimizer_enable_help'><?php esc_html_e( 'Embedded Help', 'ewww-image-optimizer' ); ?></label><br>
|
11912 |
<span class='description'><?php esc_html_e( 'Access documentation and support from your WordPress dashboard. Uses resources from external servers.', 'ewww-image-optimizer' ); ?></span>
|
11913 |
</p>
|
@@ -12677,7 +12862,7 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
12677 |
$easyio_site_url = $eio_base->content_url();
|
12678 |
$exactdn_los_che = ewww_image_optimizer_get_option( 'exactdn_lossy' );
|
12679 |
$exactdn_los_id = $exactdn_enabled ? 'exactdn_lossy_disabled' : 'exactdn_lossy';
|
12680 |
-
$exactdn_los_dis =
|
12681 |
$eio_exclude_paths = ewww_image_optimizer_get_option( 'exactdn_exclude' ) ? implode( "\n", ewww_image_optimizer_get_option( 'exactdn_exclude' ) ) : '';
|
12682 |
$lqip_che = ( ( is_multisite() && is_network_admin() ) || is_object( $exactdn ) ) && ewww_image_optimizer_get_option( 'ewww_image_optimizer_use_lqip' );
|
12683 |
$lqip_id = ! is_network_admin() && ! $exactdn_enabled ? 'ewww_image_optimizer_use_lqip_disabled' : 'ewww_image_optimizer_use_lqip';
|
@@ -12925,7 +13110,7 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
12925 |
<p class="description" style="font-weight: bolder"><?php esc_html_e( 'Easy IO cannot be activated on localhost installs.', 'ewww-image-optimizer' ); ?></p>
|
12926 |
<?php elseif ( 'network-multisite' === $network && empty( $exactdn_sub_folder ) ) : ?>
|
12927 |
<?php if ( 1 > $exactdn_network_enabled ) : ?>
|
12928 |
-
<
|
12929 |
<?php if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) : ?>
|
12930 |
<?php esc_html_e( 'Enter your API key above to enable automatic Easy IO site registration.', 'ewww-image-optimizer' ); ?><br>
|
12931 |
<?php endif; ?>
|
@@ -12936,9 +13121,9 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
12936 |
<strong><a href="https://ewww.io/plans/" target="_blank">
|
12937 |
<?php esc_html_e( 'Purchase a subscription for your sites', 'ewww-image-optimizer' ); ?>
|
12938 |
</a></strong><br>
|
12939 |
-
<a href="https://ewww.io/manage-sites/" target="_blank"><?php esc_html_e( 'Then, add your Site URLs to your account', '
|
12940 |
<?php endif; ?>
|
12941 |
-
</
|
12942 |
<p>
|
12943 |
<?php if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) : ?>
|
12944 |
<a id='ewwwio-easy-register-network' href='#' class='button-secondary'><?php esc_html_e( 'Register All Sites', 'ewww-image-optimizer' ); ?></a>
|
@@ -12969,32 +13154,51 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
12969 |
</a>
|
12970 |
<?php endif; ?>
|
12971 |
<?php elseif ( ! $exactdn_enabled ) : ?>
|
12972 |
-
<
|
12973 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12974 |
<?php esc_html_e( 'Purchase a subscription for your site.', 'ewww-image-optimizer' ); ?>
|
12975 |
-
</a></
|
12976 |
-
<a
|
|
|
|
|
|
|
|
|
|
|
|
|
12977 |
<input type='text' id='exactdn_site_url' name='exactdn_site_url' value='<?php echo esc_url( trim( $easyio_site_url ) ); ?>' readonly />
|
12978 |
<span id='exactdn-site-url-copy'><?php esc_html_e( 'Click to Copy', 'ewww-image-optimizer' ); ?></span>
|
12979 |
<span id='exactdn-site-url-copied'><?php esc_html_e( 'Copied', 'ewww-image-optimizer' ); ?></span><br>
|
|
|
|
|
|
|
|
|
12980 |
<a id='ewwwio-easy-activate' href='#' class='button-secondary'><?php esc_html_e( 'Activate', 'ewww-image-optimizer' ); ?></a>
|
12981 |
<span id='ewwwio-easy-activation-processing'><img src='<?php echo esc_url( $loading_image_url ); ?>' alt='loading'/></span>
|
12982 |
-
|
|
|
|
|
|
|
12983 |
<?php elseif ( class_exists( 'ExactDN' ) && ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) : ?>
|
12984 |
<p>
|
12985 |
-
|
12986 |
<span style="color: #3eadc9; font-weight: bolder"><?php esc_html_e( 'Verified', 'ewww-image-optimizer' ); ?></span>
|
12987 |
<br><?php echo esc_html( $exactdn->get_exactdn_domain() ); ?>
|
12988 |
-
|
12989 |
<span style="color: orange; font-weight: bolder"><?php esc_html_e( 'Temporarily disabled.', 'ewww-image-optimizer' ); ?></span>
|
12990 |
-
|
12991 |
<span style="color: orange; font-weight: bolder"><?php esc_html_e( 'Active, not yet verified.', 'ewww-image-optimizer' ); ?></span>';
|
12992 |
-
|
12993 |
<span style="color: red; font-weight: bolder"><a href="https://ewww.io/manage-sites/" target="_blank"><?php esc_html_e( 'Not Verified', 'ewww-image-optimizer' ); ?></a></span>
|
12994 |
-
|
12995 |
-
|
12996 |
<br><i><?php esc_html_e( 'Plugins that remove query strings are unnecessary with Easy IO. You may remove them at your convenience.', 'ewww-image-optimizer' ); ?></i><?php ewwwio_help_link( 'https://docs.ewww.io/article/50-exactdn-and-query-strings', '5a3d278a2c7d3a1943677b52' ); ?>
|
12997 |
-
|
12998 |
<br>
|
12999 |
<a id='ewwwio-easy-deactivate' class='button-secondary' href='<?php echo esc_url( admin_url( 'admin.php?action=ewww_image_optimizer_remove_easyio' ) ); ?>'>
|
13000 |
<?php esc_html_e( 'De-activate', 'ewww-image-optimizer' ); ?>
|
@@ -13020,7 +13224,7 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
13020 |
<tr class='ewwwio-exactdn-options' <?php echo $exactdn_enabled && ! $easymode ? '' : 'style="display:none;"'; ?>>
|
13021 |
<td> </td>
|
13022 |
<td>
|
13023 |
-
<input type='checkbox' name='exactdn_lossy' value='true' id='<?php echo esc_attr( $exactdn_los_id ); ?>' <?php
|
13024 |
<label for='exactdn_lossy'><strong><?php esc_html_e( 'Premium Compression', 'ewww-image-optimizer' ); ?></strong></label>
|
13025 |
<?php ewwwio_help_link( 'https://docs.ewww.io/article/47-getting-more-from-exactdn', '59de6631042863379ddc953c' ); ?>
|
13026 |
<p class='description'>
|
@@ -13092,6 +13296,20 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
13092 |
);
|
13093 |
?>
|
13094 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13095 |
<?php endif; ?>
|
13096 |
</td>
|
13097 |
</tr>
|
@@ -13753,14 +13971,14 @@ AddType image/webp .webp</pre>
|
|
13753 |
<td>
|
13754 |
<input type='checkbox' id='ewww_image_optimizer_sharpen' name='ewww_image_optimizer_sharpen' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_sharpen' ) ); ?> />
|
13755 |
<?php if ( ewww_image_optimizer_imagick_support() ) : ?>
|
13756 |
-
<?php esc_html_e( 'Apply improved sharpening to
|
13757 |
<p class='description'>
|
13758 |
<?php esc_html_e( 'Uses additional CPU resources and may cause thumbnail generation for large images to fail.', 'ewww-image-optimizer' ); ?>
|
13759 |
</p>
|
13760 |
<?php else : ?>
|
13761 |
<?php esc_html_e( 'Apply improved sharpening during WebP Conversion.', 'ewww-image-optimizer' ); ?><br>
|
13762 |
<p class='description'>
|
13763 |
-
<?php esc_html_e( 'Improve thumbnail generation by enabling the ImageMagick module for PHP.', 'ewww-image-optimizer' ); ?>
|
13764 |
</p>
|
13765 |
<?php endif; ?>
|
13766 |
</td>
|
14 |
exit;
|
15 |
}
|
16 |
|
17 |
+
define( 'EWWW_IMAGE_OPTIMIZER_VERSION', 670 );
|
18 |
|
19 |
// Initialize a couple globals.
|
20 |
$eio_debug = '';
|
154 |
add_action( 'network_admin_menu', 'ewww_image_optimizer_network_admin_menu' );
|
155 |
// Handle the bulk actions from the media library.
|
156 |
add_filter( 'handle_bulk_actions-upload', 'ewww_image_optimizer_bulk_action_handler', 10, 3 );
|
|
|
|
|
|
|
|
|
157 |
// Enables scheduled optimization via wp-cron.
|
158 |
add_action( 'ewww_image_optimizer_auto', 'ewww_image_optimizer_auto' );
|
159 |
// Correct records for files renamed by MFR.
|
170 |
add_action( 'wp_ajax_ewww_exactdn_activate_site', 'ewww_image_optimizer_exactdn_activate_site_ajax' );
|
171 |
// AJAX action hook to register a specific site with Easy IO.
|
172 |
add_action( 'wp_ajax_ewww_exactdn_register_site', 'ewww_image_optimizer_exactdn_register_site_ajax' );
|
173 |
+
// AJAX action hook to remove a specific site from Easy IO.
|
174 |
+
add_action( 'wp_ajax_ewww_exactdn_deregister_site', 'ewww_image_optimizer_exactdn_deregister_site_ajax' );
|
175 |
// AJAX action hook for inserting WebP rewrite rules into .htaccess.
|
176 |
add_action( 'wp_ajax_ewww_webp_rewrite', 'ewww_image_optimizer_webp_rewrite' );
|
177 |
// AJAX action hook for removing WebP rewrite rules from .htaccess.
|
219 |
// Non-AJAX handler to apply 6.2 current_timestamp db upgrade.
|
220 |
add_action( 'admin_action_ewww_image_optimizer_620_upgrade', 'ewww_image_optimizer_620_upgrade' );
|
221 |
// Check if WebP option was turned off and is now enabled.
|
222 |
+
add_action( 'update_option_ewww_image_optimizer_webp', 'ewww_image_optimizer_webp_maybe_enabled', 10, 2 );
|
223 |
// Check Scheduled Opt option has just been disabled and clear the queues/stop the process.
|
224 |
+
add_action( 'update_option_ewww_image_optimizer_auto', 'ewww_image_optimizer_scheduled_optimization_changed', 10, 2 );
|
225 |
+
// Check if image resize dimensions have been changed.
|
226 |
+
add_action( 'update_option_ewww_image_optimizer_maxmediawidth', 'ewww_image_optimizer_resize_dimensions_changed', 10, 2 );
|
227 |
+
add_action( 'update_option_ewww_image_optimizer_maxmediaheight', 'ewww_image_optimizer_resize_dimensions_changed', 10, 2 );
|
228 |
// Makes sure to flush out any scheduled jobs on deactivation.
|
229 |
register_deactivation_hook( EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE, 'ewww_image_optimizer_network_deactivate' );
|
230 |
// add_action( 'shutdown', 'ewwwio_memory_output' );.
|
948 |
ewwwio_debug_message( 'removing old version of pngout' );
|
949 |
ewwwio_delete_file( EWWW_IMAGE_OPTIMIZER_TOOL_PATH . '/pngout-static' );
|
950 |
}
|
951 |
+
if (
|
952 |
+
get_option( 'ewww_image_optimizer_version' ) < 661 &&
|
953 |
+
get_option( 'ewww_image_optimizer_exactdn' ) &&
|
954 |
+
! ewww_image_optimizer_get_option( 'ewww_image_optimizer_local_mode' ) &&
|
955 |
+
! ewww_image_optimizer_get_option( 'exactdn_lossy' )
|
956 |
+
) {
|
957 |
+
ewww_image_optimizer_set_option( 'exactdn_lossy', true );
|
958 |
+
}
|
959 |
if ( get_option( 'ewww_image_optimizer_version' ) && ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_review_time' ) ) {
|
960 |
$review_time = rand( time(), time() + 51 * DAY_IN_SECONDS );
|
961 |
add_option( 'ewww_image_optimizer_review_time', $review_time, '', false );
|
1125 |
register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_webp_rewrite_exclude', 'ewww_image_optimizer_exclude_paths_sanitize' );
|
1126 |
ewww_image_optimizer_exec_init();
|
1127 |
ewww_image_optimizer_cron_setup( 'ewww_image_optimizer_auto' );
|
1128 |
+
// Adds scripts to ajaxify the one-click actions on the media library, and register tooltips for conversion links.
|
1129 |
+
add_action( 'admin_enqueue_scripts', 'ewww_image_optimizer_media_scripts' );
|
1130 |
+
// Adds scripts for the EWWW IO settings page.
|
1131 |
+
add_action( 'admin_enqueue_scripts', 'ewww_image_optimizer_settings_script' );
|
1132 |
// Queue the function that contains custom styling for our progressbars.
|
1133 |
add_action( 'admin_enqueue_scripts', 'ewww_image_optimizer_progressbar_style' );
|
1134 |
if ( false !== strpos( add_query_arg( null, null ), 'site-new.php' ) ) {
|
1982 |
/**
|
1983 |
* Checks to see if the WebP conversion was just enabled.
|
1984 |
*
|
|
|
1985 |
* @param mixed $old_value The old value, also a boolean generally.
|
1986 |
+
* @param mixed $new_value The new value, in this case it will be boolean usually.
|
1987 |
*/
|
1988 |
+
function ewww_image_optimizer_webp_maybe_enabled( $old_value, $new_value ) {
|
1989 |
if ( ! empty( $new_value ) && (bool) $new_value !== (bool) $old_value ) {
|
1990 |
update_option( 'ewww_image_optimizer_webp_enabled', true );
|
1991 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1992 |
}
|
1993 |
|
1994 |
/**
|
1995 |
* Checks to see if Scheduled Optimization was just disabled.
|
1996 |
*
|
|
|
1997 |
* @param mixed $old_value The old value, also a boolean generally.
|
1998 |
+
* @param mixed $new_value The new value, in this case it will be boolean usually.
|
1999 |
*/
|
2000 |
+
function ewww_image_optimizer_scheduled_optimization_changed( $old_value, $new_value ) {
|
2001 |
if ( empty( $new_value ) && (bool) $new_value !== (bool) $old_value ) {
|
2002 |
global $ewwwio_image_background;
|
2003 |
if ( ! class_exists( 'WP_Background_Process' ) ) {
|
2006 |
$ewwwio_image_background->cancel_process();
|
2007 |
update_option( 'ewwwio_stop_scheduled_scan', true, false );
|
2008 |
}
|
2009 |
+
}
|
2010 |
+
|
2011 |
+
/**
|
2012 |
+
* Checks to see if Resize Images dimensions have been modified.
|
2013 |
+
*
|
2014 |
+
* If resize dimensions are modified, then we clear out the legacy settings,
|
2015 |
+
* as it is highly likely the admin wants something different now.
|
2016 |
+
*
|
2017 |
+
* @param mixed $old_value The old value, also a boolean generally.
|
2018 |
+
* @param mixed $new_value The new value, in this case it will be boolean usually.
|
2019 |
+
*/
|
2020 |
+
function ewww_image_optimizer_resize_dimensions_changed( $old_value, $new_value ) {
|
2021 |
+
if ( (int) $new_value !== (int) $old_value ) {
|
2022 |
+
update_option( 'ewww_image_optimizer_maxotherwidth', 0 );
|
2023 |
+
update_option( 'ewww_image_optimizer_maxotherheight', 0 );
|
2024 |
+
update_site_option( 'ewww_image_optimizer_maxotherwidth', 0 );
|
2025 |
+
update_site_option( 'ewww_image_optimizer_maxotherheight', 0 );
|
2026 |
+
}
|
2027 |
}
|
2028 |
|
2029 |
/**
|
2463 |
}
|
2464 |
}
|
2465 |
|
2466 |
+
/**
|
2467 |
+
* Checks if a plugin is offloading media to cloud storage and removing local copies.
|
2468 |
+
*
|
2469 |
+
* @return bool True if a plugin is removing local files, false otherwise..
|
2470 |
+
*/
|
2471 |
+
function ewww_image_optimizer_cloud_based_media() {
|
2472 |
+
if ( class_exists( 'Amazon_S3_And_CloudFront' ) ) {
|
2473 |
+
global $as3cf;
|
2474 |
+
if ( is_object( $as3cf ) && $as3cf->get_setting( 'serve-from-s3' ) && $as3cf->get_setting( 'remove-local-file' ) ) {
|
2475 |
+
return true;
|
2476 |
+
}
|
2477 |
+
}
|
2478 |
+
if ( class_exists( 'S3_Uploads' ) && function_exists( 's3_uploads_enabled' ) && s3_uploads_enabled() ) {
|
2479 |
+
return true;
|
2480 |
+
}
|
2481 |
+
if ( class_exists( 'S3_Uploads\Plugin' ) && function_exists( 'S3_Uploads\enabled' ) && \S3_Uploads\enabled() ) {
|
2482 |
+
return true;
|
2483 |
+
}
|
2484 |
+
if ( class_exists( 'wpCloud\StatelessMedia\EWWW' ) && function_exists( 'ud_get_stateless_media' ) ) {
|
2485 |
+
$sm = ud_get_stateless_media();
|
2486 |
+
if ( method_exists( $sm, 'get' ) ) {
|
2487 |
+
$sm_mode = $sm->get( 'sm.mode' );
|
2488 |
+
if ( 'disabled' !== $sm_mode ) {
|
2489 |
+
return true;
|
2490 |
+
}
|
2491 |
+
}
|
2492 |
+
}
|
2493 |
+
return false;
|
2494 |
+
}
|
2495 |
+
|
2496 |
/**
|
2497 |
* Loads the class to extend WP_Image_Editor for automatic optimization of generated images.
|
2498 |
*
|
5205 |
'timeout' => 60,
|
5206 |
'sslverify' => false,
|
5207 |
'body' => array(
|
5208 |
+
'api_key' => $key,
|
|
|
5209 |
'site_url' => $site_url,
|
5210 |
),
|
5211 |
)
|
5213 |
return $result;
|
5214 |
}
|
5215 |
|
5216 |
+
/**
|
5217 |
+
* Removes site from Easy IO via AJAX for a given site ID.
|
5218 |
+
*/
|
5219 |
+
function ewww_image_optimizer_exactdn_deregister_site_ajax() {
|
5220 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
5221 |
+
if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
|
5222 |
+
die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
|
5223 |
+
}
|
5224 |
+
if ( empty( $_REQUEST['site_id'] ) ) {
|
5225 |
+
die( wp_json_encode( array( 'error' => esc_html__( 'Site ID unknown.', 'ewww-image-optimizer' ) ) ) );
|
5226 |
+
}
|
5227 |
+
$site_id = (int) $_REQUEST['site_id'];
|
5228 |
+
ewwwio_debug_message( "deregistering site $site_id" );
|
5229 |
+
|
5230 |
+
$result = ewww_image_optimizer_deregister_site_post( $site_id );
|
5231 |
+
if ( is_wp_error( $result ) ) {
|
5232 |
+
$error_message = $result->get_error_message();
|
5233 |
+
ewwwio_debug_message( "de-registration failed: $error_message" );
|
5234 |
+
die(
|
5235 |
+
wp_json_encode(
|
5236 |
+
array(
|
5237 |
+
'error' => sprintf(
|
5238 |
+
/* translators: %s: an HTTP error message */
|
5239 |
+
esc_html__( 'Could not de-register site, HTTP error: %s', 'ewww-image-optimizer' ),
|
5240 |
+
$error_message
|
5241 |
+
),
|
5242 |
+
)
|
5243 |
+
)
|
5244 |
+
);
|
5245 |
+
} elseif ( ! empty( $result['body'] ) ) {
|
5246 |
+
$response = json_decode( $result['body'], true );
|
5247 |
+
if ( ! empty( $response['success'] ) ) {
|
5248 |
+
$response['success'] = esc_html__( 'Successfully removed site from Easy IO.', 'ewww-image-optimizer' );
|
5249 |
+
}
|
5250 |
+
die( wp_json_encode( $response ) );
|
5251 |
+
}
|
5252 |
+
die(
|
5253 |
+
wp_json_encode(
|
5254 |
+
array(
|
5255 |
+
'error' => esc_html__( 'Could not remove site from Easy IO: error unknown.', 'ewww-image-optimizer' ),
|
5256 |
+
)
|
5257 |
+
)
|
5258 |
+
);
|
5259 |
+
}
|
5260 |
+
|
5261 |
+
/**
|
5262 |
+
* POSTs the site URL to the API for Easy IO registration.
|
5263 |
+
*
|
5264 |
+
* @param int $site_id The site ID for the Easy IO zone.
|
5265 |
+
* @return array The results of the http POST request.
|
5266 |
+
*/
|
5267 |
+
function ewww_image_optimizer_deregister_site_post( $site_id ) {
|
5268 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
5269 |
+
|
5270 |
+
$key = ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' );
|
5271 |
+
if ( empty( $key ) ) {
|
5272 |
+
return new WP_Error( 'missing_key', __( 'No API key for Easy IO removal', 'ewww-image-optimizer' ) );
|
5273 |
+
}
|
5274 |
+
ewwwio_debug_message( "removing site $site_id from Easy IO" );
|
5275 |
+
$url = 'https://optimize.exactlywww.com/exactdn/remove.php';
|
5276 |
+
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
5277 |
+
$result = wp_remote_post(
|
5278 |
+
$url,
|
5279 |
+
array(
|
5280 |
+
'timeout' => 60,
|
5281 |
+
'sslverify' => false,
|
5282 |
+
'body' => array(
|
5283 |
+
'api_key' => $key,
|
5284 |
+
'site_id' => (int) $site_id,
|
5285 |
+
),
|
5286 |
+
)
|
5287 |
+
);
|
5288 |
+
return $result;
|
5289 |
+
}
|
5290 |
+
|
5291 |
+
/**
|
5292 |
+
* Checks to see if a site is registered with Easy IO.
|
5293 |
+
*
|
5294 |
+
* @param string $site_url The site URL to check for an Easy IO record.
|
5295 |
+
* @return bool True if the site is already registered, false otherwise.
|
5296 |
+
*/
|
5297 |
+
function ewww_image_optimizer_easy_site_registered( $site_url ) {
|
5298 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
5299 |
+
global $easyio_site_registered;
|
5300 |
+
global $easyio_site_id;
|
5301 |
+
if ( isset( $easyio_site_registered ) ) {
|
5302 |
+
return $easyio_site_registered;
|
5303 |
+
}
|
5304 |
+
$easyio_site_registered = false;
|
5305 |
+
$easyio_site_id = 0;
|
5306 |
+
|
5307 |
+
$cloud_key = ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' );
|
5308 |
+
if ( ! empty( $cloud_key ) ) {
|
5309 |
+
ewwwio_debug_message( "checking $site_url with Easy IO" );
|
5310 |
+
$url = 'https://optimize.exactlywww.com/exactdn/show.php';
|
5311 |
+
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
5312 |
+
$result = wp_remote_post(
|
5313 |
+
$url,
|
5314 |
+
array(
|
5315 |
+
'timeout' => 30,
|
5316 |
+
'sslverify' => false,
|
5317 |
+
'body' => array(
|
5318 |
+
'api_key' => $cloud_key,
|
5319 |
+
'site_url' => $site_url,
|
5320 |
+
),
|
5321 |
+
)
|
5322 |
+
);
|
5323 |
+
if ( is_wp_error( $result ) ) {
|
5324 |
+
$error_message = $result->get_error_message();
|
5325 |
+
ewwwio_debug_message( "register check via /show.php failed: $error_message" );
|
5326 |
+
} else {
|
5327 |
+
$easy_info = json_decode( $result['body'], true );
|
5328 |
+
if (
|
5329 |
+
is_array( $easy_info ) && ! empty( $easy_info['sites'][0]['site_url'] ) &&
|
5330 |
+
trailingslashit( $site_url ) === $easy_info['sites'][0]['site_url']
|
5331 |
+
) {
|
5332 |
+
$easyio_site_registered = true;
|
5333 |
+
$easyio_site_id = (int) $easy_info['sites'][0]['site_id'];
|
5334 |
+
return true;
|
5335 |
+
}
|
5336 |
+
if ( is_array( $easy_info ) && ! empty( $easy_info['sites'][0]['site_url'] ) ) {
|
5337 |
+
ewwwio_debug_message( 'found (maybe different) site 0: ' . $easy_info['sites'][0]['site_url'] );
|
5338 |
+
}
|
5339 |
+
}
|
5340 |
+
}
|
5341 |
+
return false;
|
5342 |
+
}
|
5343 |
+
|
5344 |
/**
|
5345 |
* Sanitizes an API key for the cloud service.
|
5346 |
*
|
7965 |
do_action( 'ewww_image_optimizer_image_resized', $file, $new_file );
|
7966 |
ewwwio_debug_message( "after resizing: $new_size" );
|
7967 |
// Use PEL to get the exif (if Remove Meta is unchecked) and GD is in use, so we can save it to the new image.
|
7968 |
+
if (
|
7969 |
+
'image/jpeg' === $type &&
|
7970 |
+
( ewww_image_optimizer_get_option( 'ewww_image_optimizer_metadata_skip_full' ) || ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_metadata_remove' ) ) &&
|
7971 |
+
! ewww_image_optimizer_imagick_support()
|
7972 |
+
) {
|
7973 |
ewwwio_debug_message( 'manually copying metadata for GD' );
|
7974 |
try {
|
7975 |
$old_jpeg = new PelJpeg( $file );
|
8054 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
8055 |
if ( function_exists( 'exif_read_data' ) && 'image/jpeg' === $type && ewwwio_is_readable( $file ) ) {
|
8056 |
$exif = @exif_read_data( $file );
|
|
|
|
|
|
|
8057 |
if ( is_array( $exif ) && array_key_exists( 'Orientation', $exif ) ) {
|
8058 |
return $exif['Orientation'];
|
8059 |
}
|
9874 |
// Get a human readable filesize.
|
9875 |
$file_size = ewww_image_optimizer_size_format( filesize( $file_path ) );
|
9876 |
}
|
9877 |
+
if ( ! defined( 'EWWW_IMAGE_OPTIMIZER_JPEGTRAN' ) && ! ewww_image_optimizer_os_supported() ) {
|
9878 |
+
ewww_image_optimizer_disable_tools();
|
9879 |
+
} elseif ( ! defined( 'EWWW_IMAGE_OPTIMIZER_JPEGTRAN' ) ) {
|
9880 |
ewww_image_optimizer_tool_init();
|
9881 |
ewww_image_optimizer_notice_utils( 'quiet' );
|
9882 |
}
|
10947 |
if ( 'settings_page_ewww-image-optimizer-options' !== $hook ) {
|
10948 |
return;
|
10949 |
}
|
10950 |
+
global $easyio_site_registered;
|
10951 |
+
global $easyio_site_id;
|
10952 |
+
|
10953 |
add_filter( 'admin_footer_text', 'ewww_image_optimizer_footer_review_text' );
|
10954 |
if (
|
10955 |
! ewww_image_optimizer_get_option( 'ewww_image_optimizer_wizard_complete' ) &&
|
10981 |
}
|
10982 |
wp_enqueue_script( 'jquery-ui-progressbar' );
|
10983 |
}
|
10984 |
+
$eio_base = new EIO_Base();
|
10985 |
+
$easyio_site_url = $eio_base->content_url();
|
10986 |
+
ewww_image_optimizer_easy_site_registered( $easyio_site_url );
|
10987 |
add_thickbox();
|
10988 |
wp_enqueue_script( 'ewww-beacon-script', plugins_url( '/includes/eio-beacon.js', __FILE__ ), array( 'jquery' ), EWWW_IMAGE_OPTIMIZER_VERSION );
|
10989 |
wp_enqueue_script( 'ewww-settings-script', plugins_url( '/includes/eio-settings.js', __FILE__ ), array( 'jquery' ), EWWW_IMAGE_OPTIMIZER_VERSION, true );
|
11004 |
'exactdn_network_success' => esc_html__( 'Easy IO setup and verification is complete.', 'ewww-image-optimizer' ),
|
11005 |
'webp_cloud_warning' => esc_html__( 'If you have not run the Bulk Optimizer on existing images, you will likely encounter broken image URLs. Are you ready to continue?', 'ewww-image-optimizer' ),
|
11006 |
'network_blog_ids' => $blog_ids,
|
11007 |
+
'blog_id' => (int) get_current_blog_id(),
|
11008 |
+
'easy_autoreg' => ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ? true : false,
|
11009 |
+
'easyio_site_id' => (int) $easyio_site_id,
|
11010 |
+
'easyio_site_registered' => (bool) $easyio_site_registered,
|
11011 |
)
|
11012 |
);
|
11013 |
wp_add_inline_script(
|
11565 |
if ( ! defined( 'EWWW_IMAGE_OPTIMIZER_NOEXEC' ) ) {
|
11566 |
if ( defined( 'EWWW_IMAGE_OPTIMIZER_CLOUD' ) && EWWW_IMAGE_OPTIMIZER_CLOUD ) {
|
11567 |
ewww_image_optimizer_disable_tools();
|
11568 |
+
} elseif ( ! ewww_image_optimizer_os_supported() ) {
|
11569 |
+
ewww_image_optimizer_disable_tools();
|
11570 |
} else {
|
11571 |
ewww_image_optimizer_tool_init();
|
11572 |
ewww_image_optimizer_notice_utils( 'quiet' );
|
11651 |
'ewwwio_test_verify' => '949c34123cf2a4e4ce2f985135830df4a1b2adc24905f53d2fd3f5df5b16293245',
|
11652 |
),
|
11653 |
'cookies' => $_COOKIE,
|
11654 |
+
'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
|
11655 |
);
|
11656 |
// Don't lock up other requests while processing.
|
11657 |
session_write_close();
|
11780 |
if ( ! defined( 'EWWW_IMAGE_OPTIMIZER_NOEXEC' ) ) {
|
11781 |
if ( defined( 'EWWW_IMAGE_OPTIMIZER_CLOUD' ) && EWWW_IMAGE_OPTIMIZER_CLOUD ) {
|
11782 |
ewww_image_optimizer_disable_tools();
|
11783 |
+
} elseif ( ! ewww_image_optimizer_os_supported() ) {
|
11784 |
+
ewww_image_optimizer_disable_tools();
|
11785 |
} else {
|
11786 |
ewww_image_optimizer_tool_init();
|
11787 |
ewww_image_optimizer_notice_utils( 'quiet' );
|
11794 |
) {
|
11795 |
$show_premium = true;
|
11796 |
} elseif (
|
11797 |
+
( ewww_image_optimizer_exec_check() || ! ewww_image_optimizer_os_supported() ) &&
|
11798 |
! ewww_image_optimizer_get_option( 'ewww_image_optimizer_dismiss_exec_notice' ) &&
|
11799 |
! ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) &&
|
11800 |
! ewww_image_optimizer_easy_active()
|
11937 |
<span class="description"><?php esc_html_e( 'Premium compression for your local images.', 'ewww-image-optimizer' ); ?></span>
|
11938 |
</p>
|
11939 |
<div id='ewwwio-easy-activation-result'></div>
|
11940 |
+
<div class='ewwwio-easy-setup-instructions'>
|
11941 |
<label><?php esc_html_e( 'Easy IO', 'ewww-image-optimizer' ); ?></label><br>
|
11942 |
<span class="description">
|
11943 |
<?php
|
11952 |
<br><span class="description" style="font-weight: bolder"><?php esc_html_e( 'Easy IO cannot be activated on localhost installs.', 'ewww-image-optimizer' ); ?></span>
|
11953 |
<?php elseif ( empty( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) ) : ?>
|
11954 |
<br><br>
|
11955 |
+
<?php if ( ! ewww_image_optimizer_easy_site_registered( $easyio_site_url ) ) : ?>
|
11956 |
+
<?php if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) : ?>
|
11957 |
+
<a class='easyio-cloud-key-ui' href="<?php echo esc_url( add_query_arg( 'site_url', trim( $easyio_site_url ), 'https://ewww.io/manage-sites/' ) ); ?>" target="_blank">
|
11958 |
+
<?php esc_html_e( 'Verify that this site is added to your account:', 'ewww-image-optimizer' ); ?>
|
11959 |
</a>
|
11960 |
+
<?php else : ?>
|
11961 |
+
<a class='easyio-cloud-key-ui' style='display:none;' href="<?php echo esc_url( add_query_arg( 'site_url', trim( $easyio_site_url ), 'https://ewww.io/manage-sites/' ) ); ?>" target="_blank">
|
11962 |
+
<?php esc_html_e( 'Verify that this site is added to your account:', 'ewww-image-optimizer' ); ?>
|
11963 |
+
</a>
|
11964 |
+
<a class='easyio-manual-ui' href="<?php echo esc_url( add_query_arg( 'site_url', trim( $easyio_site_url ), 'https://ewww.io/manage-sites/' ) ); ?>" target="_blank">
|
11965 |
+
<?php esc_html_e( 'First, add your Site URL to your account:', 'ewww-image-optimizer' ); ?>
|
11966 |
+
</a>
|
11967 |
+
<?php endif; ?>
|
11968 |
<input type='text' id='exactdn_site_url' name='exactdn_site_url' value='<?php echo esc_url( trim( $easyio_site_url ) ); ?>' readonly />
|
11969 |
<span id='exactdn-site-url-copy'><?php esc_html_e( 'Click to Copy', 'ewww-image-optimizer' ); ?></span>
|
11970 |
<span id='exactdn-site-url-copied'><?php esc_html_e( 'Copied', 'ewww-image-optimizer' ); ?></span><br>
|
11971 |
+
<script>var exactdn_registered = false;</script>
|
11972 |
+
<?php else : ?>
|
11973 |
+
<script>var exactdn_registered = true;</script>
|
11974 |
+
<?php endif; ?>
|
11975 |
<a id='ewwwio-easy-activate' href='#' class='button-secondary'><?php esc_html_e( 'Activate', 'ewww-image-optimizer' ); ?></a>
|
11976 |
<span id='ewwwio-easy-activation-processing'><img src='<?php echo esc_url( $loading_image_url ); ?>' alt='loading'/></span>
|
11977 |
<?php elseif ( class_exists( 'ExactDN' ) && ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) && $exactdn->get_exactdn_domain() && $exactdn->verify_domain( $exactdn->get_exactdn_domain() ) ) : ?>
|
11978 |
<br><span style="color: #3eadc9; font-weight: bolder"><?php esc_html_e( 'Verified', 'ewww-image-optimizer' ); ?></span>
|
11979 |
<span class="dashicons dashicons-yes"></span>
|
11980 |
<?php endif; ?>
|
11981 |
+
</div>
|
11982 |
</div>
|
11983 |
<input type='radio' id='ewww_image_optimizer_budget_free' name='ewww_image_optimizer_budget' value='free' required />
|
11984 |
<label for='ewww_image_optimizer_budget_free'><?php esc_html_e( 'Stick with free mode for now', 'ewww-image-optimizer' ); ?></label>
|
12092 |
</p>
|
12093 |
<?php endif; ?>
|
12094 |
<p>
|
12095 |
+
<input type='checkbox' id='ewww_image_optimizer_enable_help' name='ewww_image_optimizer_enable_help' value='true' />
|
12096 |
<label for='ewww_image_optimizer_enable_help'><?php esc_html_e( 'Embedded Help', 'ewww-image-optimizer' ); ?></label><br>
|
12097 |
<span class='description'><?php esc_html_e( 'Access documentation and support from your WordPress dashboard. Uses resources from external servers.', 'ewww-image-optimizer' ); ?></span>
|
12098 |
</p>
|
12862 |
$easyio_site_url = $eio_base->content_url();
|
12863 |
$exactdn_los_che = ewww_image_optimizer_get_option( 'exactdn_lossy' );
|
12864 |
$exactdn_los_id = $exactdn_enabled ? 'exactdn_lossy_disabled' : 'exactdn_lossy';
|
12865 |
+
$exactdn_los_dis = false;
|
12866 |
$eio_exclude_paths = ewww_image_optimizer_get_option( 'exactdn_exclude' ) ? implode( "\n", ewww_image_optimizer_get_option( 'exactdn_exclude' ) ) : '';
|
12867 |
$lqip_che = ( ( is_multisite() && is_network_admin() ) || is_object( $exactdn ) ) && ewww_image_optimizer_get_option( 'ewww_image_optimizer_use_lqip' );
|
12868 |
$lqip_id = ! is_network_admin() && ! $exactdn_enabled ? 'ewww_image_optimizer_use_lqip_disabled' : 'ewww_image_optimizer_use_lqip';
|
13110 |
<p class="description" style="font-weight: bolder"><?php esc_html_e( 'Easy IO cannot be activated on localhost installs.', 'ewww-image-optimizer' ); ?></p>
|
13111 |
<?php elseif ( 'network-multisite' === $network && empty( $exactdn_sub_folder ) ) : ?>
|
13112 |
<?php if ( 1 > $exactdn_network_enabled ) : ?>
|
13113 |
+
<div class="ewwwio-easy-setup-instructions">
|
13114 |
<?php if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) : ?>
|
13115 |
<?php esc_html_e( 'Enter your API key above to enable automatic Easy IO site registration.', 'ewww-image-optimizer' ); ?><br>
|
13116 |
<?php endif; ?>
|
13121 |
<strong><a href="https://ewww.io/plans/" target="_blank">
|
13122 |
<?php esc_html_e( 'Purchase a subscription for your sites', 'ewww-image-optimizer' ); ?>
|
13123 |
</a></strong><br>
|
13124 |
+
<a href="https://ewww.io/manage-sites/" target="_blank"><?php esc_html_e( 'Then, add your Site URLs to your account', 'ewww-image-optimizer' ); ?></a>
|
13125 |
<?php endif; ?>
|
13126 |
+
</div>
|
13127 |
<p>
|
13128 |
<?php if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) : ?>
|
13129 |
<a id='ewwwio-easy-register-network' href='#' class='button-secondary'><?php esc_html_e( 'Register All Sites', 'ewww-image-optimizer' ); ?></a>
|
13154 |
</a>
|
13155 |
<?php endif; ?>
|
13156 |
<?php elseif ( ! $exactdn_enabled ) : ?>
|
13157 |
+
<div class="ewwwio-easy-setup-instructions">
|
13158 |
+
<?php if ( ! ewww_image_optimizer_easy_site_registered( $easyio_site_url ) ) : ?>
|
13159 |
+
<?php if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) : ?>
|
13160 |
+
<a class='easyio-cloud-key-ui' href="<?php echo esc_url( add_query_arg( 'site_url', trim( $easyio_site_url ), 'https://ewww.io/manage-sites/' ) ); ?>" target="_blank">
|
13161 |
+
<?php esc_html_e( 'Verify that this site is added to your account:', 'ewww-image-optimizer' ); ?>
|
13162 |
+
</a>
|
13163 |
+
<?php else : ?>
|
13164 |
+
<p class='easyio-manual-ui' style="font-weight: bold;"><a href="https://ewww.io/plans/" target="_blank">
|
13165 |
<?php esc_html_e( 'Purchase a subscription for your site.', 'ewww-image-optimizer' ); ?>
|
13166 |
+
</a></p>
|
13167 |
+
<a class='easyio-cloud-key-ui' style='display:none;' href="<?php echo esc_url( add_query_arg( 'site_url', trim( $easyio_site_url ), 'https://ewww.io/manage-sites/' ) ); ?>" target="_blank">
|
13168 |
+
<?php esc_html_e( 'Verify that this site is added to your account:', 'ewww-image-optimizer' ); ?>
|
13169 |
+
</a>
|
13170 |
+
<a class='easyio-manual-ui' href="<?php echo esc_url( add_query_arg( 'site_url', trim( $easyio_site_url ), 'https://ewww.io/manage-sites/' ) ); ?>" target="_blank">
|
13171 |
+
<?php esc_html_e( 'Then, add your Site URL to your account:', 'ewww-image-optimizer' ); ?>
|
13172 |
+
</a>
|
13173 |
+
<?php endif; ?>
|
13174 |
<input type='text' id='exactdn_site_url' name='exactdn_site_url' value='<?php echo esc_url( trim( $easyio_site_url ) ); ?>' readonly />
|
13175 |
<span id='exactdn-site-url-copy'><?php esc_html_e( 'Click to Copy', 'ewww-image-optimizer' ); ?></span>
|
13176 |
<span id='exactdn-site-url-copied'><?php esc_html_e( 'Copied', 'ewww-image-optimizer' ); ?></span><br>
|
13177 |
+
<script>var exactdn_registered = false;</script>
|
13178 |
+
<?php else : ?>
|
13179 |
+
<script>var exactdn_registered = true;</script>
|
13180 |
+
<?php endif; ?>
|
13181 |
<a id='ewwwio-easy-activate' href='#' class='button-secondary'><?php esc_html_e( 'Activate', 'ewww-image-optimizer' ); ?></a>
|
13182 |
<span id='ewwwio-easy-activation-processing'><img src='<?php echo esc_url( $loading_image_url ); ?>' alt='loading'/></span>
|
13183 |
+
<?php if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) && ewww_image_optimizer_easy_site_registered( $easyio_site_url ) ) : ?>
|
13184 |
+
<a id='ewwwio-easy-deregister' href='#'><?php esc_html_e( 'De-register Site', 'ewww-image-optimizer' ); ?></a>
|
13185 |
+
<?php endif; ?>
|
13186 |
+
</div>
|
13187 |
<?php elseif ( class_exists( 'ExactDN' ) && ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) : ?>
|
13188 |
<p>
|
13189 |
+
<?php if ( $exactdn->get_exactdn_domain() && $exactdn->verify_domain( $exactdn->get_exactdn_domain() ) ) : ?>
|
13190 |
<span style="color: #3eadc9; font-weight: bolder"><?php esc_html_e( 'Verified', 'ewww-image-optimizer' ); ?></span>
|
13191 |
<br><?php echo esc_html( $exactdn->get_exactdn_domain() ); ?>
|
13192 |
+
<?php elseif ( $exactdn->get_exactdn_domain() && $exactdn->get_exactdn_option( 'verified' ) ) : ?>
|
13193 |
<span style="color: orange; font-weight: bolder"><?php esc_html_e( 'Temporarily disabled.', 'ewww-image-optimizer' ); ?></span>
|
13194 |
+
<?php elseif ( $exactdn->get_exactdn_domain() && $exactdn->get_exactdn_option( 'suspended' ) ) : ?>
|
13195 |
<span style="color: orange; font-weight: bolder"><?php esc_html_e( 'Active, not yet verified.', 'ewww-image-optimizer' ); ?></span>';
|
13196 |
+
<?php else : ?>
|
13197 |
<span style="color: red; font-weight: bolder"><a href="https://ewww.io/manage-sites/" target="_blank"><?php esc_html_e( 'Not Verified', 'ewww-image-optimizer' ); ?></a></span>
|
13198 |
+
<?php endif; ?>
|
13199 |
+
<?php if ( function_exists( 'remove_query_strings_link' ) || function_exists( 'rmqrst_loader_src' ) || function_exists( 'qsr_remove_query_strings_1' ) ) : ?>
|
13200 |
<br><i><?php esc_html_e( 'Plugins that remove query strings are unnecessary with Easy IO. You may remove them at your convenience.', 'ewww-image-optimizer' ); ?></i><?php ewwwio_help_link( 'https://docs.ewww.io/article/50-exactdn-and-query-strings', '5a3d278a2c7d3a1943677b52' ); ?>
|
13201 |
+
<?php endif; ?>
|
13202 |
<br>
|
13203 |
<a id='ewwwio-easy-deactivate' class='button-secondary' href='<?php echo esc_url( admin_url( 'admin.php?action=ewww_image_optimizer_remove_easyio' ) ); ?>'>
|
13204 |
<?php esc_html_e( 'De-activate', 'ewww-image-optimizer' ); ?>
|
13224 |
<tr class='ewwwio-exactdn-options' <?php echo $exactdn_enabled && ! $easymode ? '' : 'style="display:none;"'; ?>>
|
13225 |
<td> </td>
|
13226 |
<td>
|
13227 |
+
<input type='checkbox' name='exactdn_lossy' value='true' id='<?php echo esc_attr( $exactdn_los_id ); ?>' <?php checked( $exactdn_los_che ); ?> />
|
13228 |
<label for='exactdn_lossy'><strong><?php esc_html_e( 'Premium Compression', 'ewww-image-optimizer' ); ?></strong></label>
|
13229 |
<?php ewwwio_help_link( 'https://docs.ewww.io/article/47-getting-more-from-exactdn', '59de6631042863379ddc953c' ); ?>
|
13230 |
<p class='description'>
|
13296 |
);
|
13297 |
?>
|
13298 |
</p>
|
13299 |
+
<?php if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxotherwidth' ) || ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxotherheight' ) ) : ?>
|
13300 |
+
<p>
|
13301 |
+
<?php
|
13302 |
+
printf(
|
13303 |
+
/* translators: 1: width in pixels 2: height in pixels */
|
13304 |
+
esc_html__( '*Legacy resize options are in effect: %1$d x %2$d. These will be used for bulk operations and for images uploaded outside the post/page editor.', 'ewww-image-optimizer' ),
|
13305 |
+
(int) ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxotherwidth' ),
|
13306 |
+
(int) ewww_image_optimizer_get_option( 'ewww_image_optimizer_maxotherheight' )
|
13307 |
+
);
|
13308 |
+
?>
|
13309 |
+
<br>
|
13310 |
+
<?php esc_html_e( 'The legacy settings will be removed if the above width/height settings are modified.', 'ewww-image-optimizer' ); ?>
|
13311 |
+
</p>
|
13312 |
+
<?php endif; ?>
|
13313 |
<?php endif; ?>
|
13314 |
</td>
|
13315 |
</tr>
|
13971 |
<td>
|
13972 |
<input type='checkbox' id='ewww_image_optimizer_sharpen' name='ewww_image_optimizer_sharpen' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_sharpen' ) ); ?> />
|
13973 |
<?php if ( ewww_image_optimizer_imagick_support() ) : ?>
|
13974 |
+
<?php esc_html_e( 'Apply improved sharpening to JPG resizing operations and WebP Conversion.', 'ewww-image-optimizer' ); ?><br>
|
13975 |
<p class='description'>
|
13976 |
<?php esc_html_e( 'Uses additional CPU resources and may cause thumbnail generation for large images to fail.', 'ewww-image-optimizer' ); ?>
|
13977 |
</p>
|
13978 |
<?php else : ?>
|
13979 |
<?php esc_html_e( 'Apply improved sharpening during WebP Conversion.', 'ewww-image-optimizer' ); ?><br>
|
13980 |
<p class='description'>
|
13981 |
+
<?php esc_html_e( 'Improve JPG thumbnail generation by enabling the ImageMagick module for PHP.', 'ewww-image-optimizer' ); ?>
|
13982 |
</p>
|
13983 |
<?php endif; ?>
|
13984 |
</td>
|
ewww-image-optimizer.php
CHANGED
@@ -13,8 +13,8 @@ Plugin Name: EWWW Image Optimizer
|
|
13 |
Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
|
14 |
Description: Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
|
15 |
Author: Exactly WWW
|
16 |
-
Version: 6.
|
17 |
-
Requires at least: 5.
|
18 |
Requires PHP: 7.2
|
19 |
Author URI: https://ewww.io/
|
20 |
License: GPLv3
|
13 |
Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
|
14 |
Description: Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
|
15 |
Author: Exactly WWW
|
16 |
+
Version: 6.7.0
|
17 |
+
Requires at least: 5.8
|
18 |
Requires PHP: 7.2
|
19 |
Author URI: https://ewww.io/
|
20 |
License: GPLv3
|
includes/eio-settings.js
CHANGED
@@ -111,7 +111,10 @@ jQuery(document).ready(function($) {
|
|
111 |
$('#ewwwio-api-activation-result').html(ewww_response.success);
|
112 |
$('#ewwwio-api-activation-result').removeClass('error');
|
113 |
$('#ewwwio-api-activation-result').show();
|
|
|
|
|
114 |
$('#ewww_image_optimizer_cloud_key').attr('type', 'password');
|
|
|
115 |
ewwwCloudEnable();
|
116 |
}
|
117 |
});
|
@@ -137,15 +140,54 @@ jQuery(document).ready(function($) {
|
|
137 |
$('#ewww_image_optimizer_backup_files').prop('checked', true);
|
138 |
}
|
139 |
}
|
|
|
140 |
$('#ewwwio-easy-activate').on( 'click', function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
var ewww_post_action = 'ewww_exactdn_activate';
|
142 |
var ewww_post_data = {
|
143 |
action: ewww_post_action,
|
144 |
ewww_wpnonce: ewww_vars._wpnonce,
|
145 |
};
|
146 |
-
$('#ewwwio-easy-activate').hide();
|
147 |
-
$('#ewwwio-easy-activation-result').hide();
|
148 |
-
$('#ewwwio-easy-activation-processing').show();
|
149 |
$.post(ajaxurl, ewww_post_data, function(response) {
|
150 |
try {
|
151 |
var ewww_response = JSON.parse(response);
|
@@ -158,6 +200,9 @@ jQuery(document).ready(function($) {
|
|
158 |
return false;
|
159 |
}
|
160 |
if ( ewww_response.error ) {
|
|
|
|
|
|
|
161 |
$('#ewwwio-easy-activation-processing').hide();
|
162 |
$('#ewwwio-easy-activate').show();
|
163 |
$('#ewwwio-easy-activation-result').html(ewww_response.error);
|
@@ -176,7 +221,7 @@ jQuery(document).ready(function($) {
|
|
176 |
$('#ewwwio-easy-activation-result').show();
|
177 |
$('.ewwwio-exactdn-options input').prop('disabled', false);
|
178 |
$('.ewwwio-exactdn-options').show();
|
179 |
-
$('
|
180 |
$('#ewww_image_optimizer_webp_container').hide();
|
181 |
$('.ewww_image_optimizer_webp_setting_container').hide();
|
182 |
$('.ewww_image_optimizer_webp_rewrite_setting_container').hide();
|
@@ -184,7 +229,7 @@ jQuery(document).ready(function($) {
|
|
184 |
}
|
185 |
});
|
186 |
return false;
|
187 |
-
}
|
188 |
var exactdn_blog_ids = [];
|
189 |
var exactdn_blog_count = 0;
|
190 |
var exactdn_cancelled = false;
|
@@ -195,18 +240,15 @@ jQuery(document).ready(function($) {
|
|
195 |
exactdn_blog_ids = Array.from(ewww_vars.network_blog_ids);
|
196 |
exactdn_blog_count = exactdn_blog_ids.length;
|
197 |
$('#ewww_image_optimizer_exactdn_container .button-secondary').hide();
|
198 |
-
//$('#ewwwio-easy-activate-network').hide();
|
199 |
-
//$('#ewwwio-easy-deactivate').hide();
|
200 |
-
//$('#ewwwio-easy-register-network').hide();
|
201 |
$('#ewwwio-easy-cancel-network-operation').show();
|
202 |
$('#ewwwio-easy-activation-result').hide();
|
203 |
$('#ewwwio-easy-activation-processing').show();
|
204 |
$('#ewwwio-easy-activation-progressbar').progressbar({ max: exactdn_blog_count });
|
205 |
$('#ewwwio-easy-activation-progressbar').show();
|
206 |
-
|
207 |
return false;
|
208 |
});
|
209 |
-
function
|
210 |
var ewww_post_data = {
|
211 |
action: 'ewww_exactdn_activate_site',
|
212 |
ewww_wpnonce: ewww_vars._wpnonce,
|
@@ -241,12 +283,12 @@ jQuery(document).ready(function($) {
|
|
241 |
return false;
|
242 |
} else {
|
243 |
$('#ewwwio-easy-activation-processing').hide();
|
244 |
-
$('
|
245 |
$('p.ewwwio-easy-description').hide();
|
246 |
$('#ewwwio-easy-activation-progressbar').progressbar('option', 'value', exactdn_blogs_done);
|
247 |
}
|
248 |
if ( exactdn_blog_ids.length ) {
|
249 |
-
|
250 |
} else {
|
251 |
$('#ewwwio-easy-cancel-network-operation').hide();
|
252 |
if (exactdn_cancelled) {
|
@@ -274,9 +316,6 @@ jQuery(document).ready(function($) {
|
|
274 |
exactdn_blog_ids = Array.from(ewww_vars.network_blog_ids);
|
275 |
exactdn_blog_count = exactdn_blog_ids.length;
|
276 |
$('#ewww_image_optimizer_exactdn_container .button-secondary').hide();
|
277 |
-
//$('#ewwwio-easy-activate-network').hide();
|
278 |
-
//$('#ewwwio-easy-register-network').hide();
|
279 |
-
//$('#ewwwio-easy-deactivate').hide();
|
280 |
$('#ewwwio-easy-cancel-network-operation').show();
|
281 |
$('#ewwwio-easy-activation-result').hide();
|
282 |
$('#ewwwio-easy-activation-processing').show();
|
@@ -322,7 +361,7 @@ jQuery(document).ready(function($) {
|
|
322 |
return false;
|
323 |
} else {
|
324 |
$('#ewwwio-easy-activation-processing').hide();
|
325 |
-
$('
|
326 |
$('p.ewwwio-easy-description').hide();
|
327 |
$('#ewwwio-easy-activation-progressbar').progressbar('option', 'value', exactdn_blogs_done);
|
328 |
}
|
@@ -348,7 +387,59 @@ jQuery(document).ready(function($) {
|
|
348 |
exactdn_cancelled = true;
|
349 |
$('#ewwwio-easy-cancel-network-operation').hide();
|
350 |
return false;
|
351 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
$('#ewww_image_optimizer_webp').on(
|
353 |
'click',
|
354 |
function() {
|
@@ -495,7 +586,6 @@ jQuery(document).ready(function($) {
|
|
495 |
$('li.ewww-general-nav').addClass('ewww-selected');
|
496 |
if($('#ewww_image_optimizer_debug').length){
|
497 |
$('#ewww-resize-settings').hide();
|
498 |
-
console.log($('#ewww_image_optimizer_debug').length);
|
499 |
}
|
500 |
// New tabs.
|
501 |
$('#ewww-local-settings').hide();
|
111 |
$('#ewwwio-api-activation-result').html(ewww_response.success);
|
112 |
$('#ewwwio-api-activation-result').removeClass('error');
|
113 |
$('#ewwwio-api-activation-result').show();
|
114 |
+
$('.easyio-manual-ui').hide();
|
115 |
+
$('.easyio-cloud-key-ui').show();
|
116 |
$('#ewww_image_optimizer_cloud_key').attr('type', 'password');
|
117 |
+
ewww_vars.easy_autoreg = 1;
|
118 |
ewwwCloudEnable();
|
119 |
}
|
120 |
});
|
140 |
$('#ewww_image_optimizer_backup_files').prop('checked', true);
|
141 |
}
|
142 |
}
|
143 |
+
var easyio_registration_error = '';
|
144 |
$('#ewwwio-easy-activate').on( 'click', function() {
|
145 |
+
$('#ewwwio-easy-activate').hide();
|
146 |
+
$('#ewwwio-easy-deregister').hide();
|
147 |
+
$('#ewwwio-easy-activation-result').hide();
|
148 |
+
$('#ewwwio-easy-activation-processing').show();
|
149 |
+
if (! ewww_vars.easyio_site_registered && ewww_vars.easy_autoreg) {
|
150 |
+
var ewww_post_data = {
|
151 |
+
action: 'ewww_exactdn_register_site',
|
152 |
+
ewww_wpnonce: ewww_vars._wpnonce,
|
153 |
+
blog_id: ewww_vars.blog_id,
|
154 |
+
};
|
155 |
+
$.post(ajaxurl, ewww_post_data, function(response) {
|
156 |
+
try {
|
157 |
+
var ewww_response = JSON.parse(response);
|
158 |
+
} catch (err) {
|
159 |
+
$('#ewwwio-easy-activation-processing').hide();
|
160 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.invalid_response);
|
161 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
162 |
+
$('#ewwwio-easy-activation-result').show();
|
163 |
+
console.log( 'registration response: ' + response );
|
164 |
+
return false;
|
165 |
+
}
|
166 |
+
if ( ewww_response.error ) {
|
167 |
+
easyio_registration_error = ewww_response.error;
|
168 |
+
} else if ( ! ewww_response.status ) {
|
169 |
+
$('#ewwwio-easy-activation-processing').hide();
|
170 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.invalid_response);
|
171 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
172 |
+
$('#ewwwio-easy-activation-result').show();
|
173 |
+
console.log( 'registration response: ' + response );
|
174 |
+
return false;
|
175 |
+
}
|
176 |
+
setTimeout( activateExactDNSite, 5000 );
|
177 |
+
return false;
|
178 |
+
});
|
179 |
+
} else {
|
180 |
+
activateExactDNSite();
|
181 |
+
return false;
|
182 |
+
}
|
183 |
+
return false;
|
184 |
+
});
|
185 |
+
function activateExactDNSite() {
|
186 |
var ewww_post_action = 'ewww_exactdn_activate';
|
187 |
var ewww_post_data = {
|
188 |
action: ewww_post_action,
|
189 |
ewww_wpnonce: ewww_vars._wpnonce,
|
190 |
};
|
|
|
|
|
|
|
191 |
$.post(ajaxurl, ewww_post_data, function(response) {
|
192 |
try {
|
193 |
var ewww_response = JSON.parse(response);
|
200 |
return false;
|
201 |
}
|
202 |
if ( ewww_response.error ) {
|
203 |
+
if ( easyio_registration_error ) {
|
204 |
+
ewww_response.error = easyio_registration_error + '<br>' + ewww_response.error;
|
205 |
+
}
|
206 |
$('#ewwwio-easy-activation-processing').hide();
|
207 |
$('#ewwwio-easy-activate').show();
|
208 |
$('#ewwwio-easy-activation-result').html(ewww_response.error);
|
221 |
$('#ewwwio-easy-activation-result').show();
|
222 |
$('.ewwwio-exactdn-options input').prop('disabled', false);
|
223 |
$('.ewwwio-exactdn-options').show();
|
224 |
+
$('.ewwwio-easy-setup-instructions').hide();
|
225 |
$('#ewww_image_optimizer_webp_container').hide();
|
226 |
$('.ewww_image_optimizer_webp_setting_container').hide();
|
227 |
$('.ewww_image_optimizer_webp_rewrite_setting_container').hide();
|
229 |
}
|
230 |
});
|
231 |
return false;
|
232 |
+
}
|
233 |
var exactdn_blog_ids = [];
|
234 |
var exactdn_blog_count = 0;
|
235 |
var exactdn_cancelled = false;
|
240 |
exactdn_blog_ids = Array.from(ewww_vars.network_blog_ids);
|
241 |
exactdn_blog_count = exactdn_blog_ids.length;
|
242 |
$('#ewww_image_optimizer_exactdn_container .button-secondary').hide();
|
|
|
|
|
|
|
243 |
$('#ewwwio-easy-cancel-network-operation').show();
|
244 |
$('#ewwwio-easy-activation-result').hide();
|
245 |
$('#ewwwio-easy-activation-processing').show();
|
246 |
$('#ewwwio-easy-activation-progressbar').progressbar({ max: exactdn_blog_count });
|
247 |
$('#ewwwio-easy-activation-progressbar').show();
|
248 |
+
activateExactDNMultiSite();
|
249 |
return false;
|
250 |
});
|
251 |
+
function activateExactDNMultiSite() {
|
252 |
var ewww_post_data = {
|
253 |
action: 'ewww_exactdn_activate_site',
|
254 |
ewww_wpnonce: ewww_vars._wpnonce,
|
283 |
return false;
|
284 |
} else {
|
285 |
$('#ewwwio-easy-activation-processing').hide();
|
286 |
+
$('.ewwwio-easy-setup-instructions').hide();
|
287 |
$('p.ewwwio-easy-description').hide();
|
288 |
$('#ewwwio-easy-activation-progressbar').progressbar('option', 'value', exactdn_blogs_done);
|
289 |
}
|
290 |
if ( exactdn_blog_ids.length ) {
|
291 |
+
activateExactDNMultiSite();
|
292 |
} else {
|
293 |
$('#ewwwio-easy-cancel-network-operation').hide();
|
294 |
if (exactdn_cancelled) {
|
316 |
exactdn_blog_ids = Array.from(ewww_vars.network_blog_ids);
|
317 |
exactdn_blog_count = exactdn_blog_ids.length;
|
318 |
$('#ewww_image_optimizer_exactdn_container .button-secondary').hide();
|
|
|
|
|
|
|
319 |
$('#ewwwio-easy-cancel-network-operation').show();
|
320 |
$('#ewwwio-easy-activation-result').hide();
|
321 |
$('#ewwwio-easy-activation-processing').show();
|
361 |
return false;
|
362 |
} else {
|
363 |
$('#ewwwio-easy-activation-processing').hide();
|
364 |
+
$('.ewwwio-easy-setup-instructions').hide();
|
365 |
$('p.ewwwio-easy-description').hide();
|
366 |
$('#ewwwio-easy-activation-progressbar').progressbar('option', 'value', exactdn_blogs_done);
|
367 |
}
|
387 |
exactdn_cancelled = true;
|
388 |
$('#ewwwio-easy-cancel-network-operation').hide();
|
389 |
return false;
|
390 |
+
});
|
391 |
+
$('#ewwwio-easy-deregister').on( 'click', function() {
|
392 |
+
$('#ewwwio-easy-activate').hide();
|
393 |
+
$('#ewwwio-easy-deregister').hide();
|
394 |
+
$('#ewwwio-easy-activation-result').hide();
|
395 |
+
$('#ewwwio-easy-activation-processing').show();
|
396 |
+
if (ewww_vars.easyio_site_id) {
|
397 |
+
deregisterExactDNSite();
|
398 |
+
} else {
|
399 |
+
$('#ewwwio-easy-activation-processing').hide();
|
400 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.invalid_response);
|
401 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
402 |
+
$('#ewwwio-easy-activation-result').show();
|
403 |
+
}
|
404 |
+
return false;
|
405 |
+
});
|
406 |
+
function deregisterExactDNSite() {
|
407 |
+
var ewww_post_data = {
|
408 |
+
action: 'ewww_exactdn_deregister_site',
|
409 |
+
ewww_wpnonce: ewww_vars._wpnonce,
|
410 |
+
site_id: ewww_vars.easyio_site_id,
|
411 |
+
};
|
412 |
+
$.post(ajaxurl, ewww_post_data, function(response) {
|
413 |
+
try {
|
414 |
+
var ewww_response = JSON.parse(response);
|
415 |
+
} catch (err) {
|
416 |
+
$('#ewwwio-easy-activation-processing').hide();
|
417 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.invalid_response);
|
418 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
419 |
+
$('#ewwwio-easy-activation-result').show();
|
420 |
+
console.log( 'de-registration response: ' + response );
|
421 |
+
return false;
|
422 |
+
}
|
423 |
+
if ( ewww_response.error ) {
|
424 |
+
$('#ewwwio-easy-activation-processing').hide();
|
425 |
+
$('#ewwwio-easy-activation-result').html(ewww_response.error);
|
426 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
427 |
+
$('#ewwwio-easy-activation-result').show();
|
428 |
+
} else if ( ! ewww_response.success ) {
|
429 |
+
$('#ewwwio-easy-activation-processing').hide();
|
430 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.invalid_response);
|
431 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
432 |
+
$('#ewwwio-easy-activation-result').show();
|
433 |
+
console.log( 'de-registration response: ' + response );
|
434 |
+
} else {
|
435 |
+
$('#ewwwio-easy-activation-processing').hide();
|
436 |
+
$('#ewwwio-easy-activation-result').html(ewww_response.success);
|
437 |
+
$('#ewwwio-easy-activation-result').removeClass('error');
|
438 |
+
$('#ewwwio-easy-activation-result').show();
|
439 |
+
}
|
440 |
+
});
|
441 |
+
return false;
|
442 |
+
}
|
443 |
$('#ewww_image_optimizer_webp').on(
|
444 |
'click',
|
445 |
function() {
|
586 |
$('li.ewww-general-nav').addClass('ewww-selected');
|
587 |
if($('#ewww_image_optimizer_debug').length){
|
588 |
$('#ewww-resize-settings').hide();
|
|
|
589 |
}
|
590 |
// New tabs.
|
591 |
$('#ewww-local-settings').hide();
|
includes/jquery-ui-1.10.1.custom.css
CHANGED
@@ -716,6 +716,11 @@ p#ewww-webp-rewrite-status {
|
|
716 |
#ewwwio-easy-activate, #ewwwio-easy-deactivate, #ewwwio-easy-activate-network, #ewwwio-easy-register-network {
|
717 |
margin-top: 10px;
|
718 |
}
|
|
|
|
|
|
|
|
|
|
|
719 |
.ewwwio-notice {
|
720 |
background-color: white;
|
721 |
border: 1px solid #ccd0d4;
|
@@ -729,6 +734,9 @@ p#ewww-webp-rewrite-status {
|
|
729 |
.ewwwio-notice.notice-success {
|
730 |
border-left-color: #46b450;
|
731 |
}
|
|
|
|
|
|
|
732 |
#ewwwio-api-activation-result, #ewwwio-easy-activation-result, #ewww-webp-rewrite-result {
|
733 |
display: none;
|
734 |
background-color: white;
|
716 |
#ewwwio-easy-activate, #ewwwio-easy-deactivate, #ewwwio-easy-activate-network, #ewwwio-easy-register-network {
|
717 |
margin-top: 10px;
|
718 |
}
|
719 |
+
#ewwwio-easy-deregister {
|
720 |
+
vertical-align: bottom;
|
721 |
+
padding-left: 20px;
|
722 |
+
line-height: 2.15;
|
723 |
+
}
|
724 |
.ewwwio-notice {
|
725 |
background-color: white;
|
726 |
border: 1px solid #ccd0d4;
|
734 |
.ewwwio-notice.notice-success {
|
735 |
border-left-color: #46b450;
|
736 |
}
|
737 |
+
#ewwwio-easy-register-failed {
|
738 |
+
display: none;
|
739 |
+
}
|
740 |
#ewwwio-api-activation-result, #ewwwio-easy-activation-result, #ewww-webp-rewrite-result {
|
741 |
display: none;
|
742 |
background-color: white;
|
includes/lazysizes-post.js
CHANGED
@@ -27,7 +27,11 @@ function constrainSrc(url,objectWidth,objectHeight,objectType){
|
|
27 |
var regW = /w=(\d+)/;
|
28 |
var regFit = /fit=(\d+),(\d+)/;
|
29 |
var regResize = /resize=(\d+),(\d+)/;
|
|
|
30 |
var decUrl = decodeURIComponent(url);
|
|
|
|
|
|
|
31 |
if (typeof eio_lazy_vars === 'undefined'){
|
32 |
console.log('setting failsafe lazy vars');
|
33 |
eio_lazy_vars = {"exactdn_domain":".exactdn.com"};
|
@@ -37,11 +41,23 @@ function constrainSrc(url,objectWidth,objectHeight,objectType){
|
|
37 |
console.log('domain matches URL with a ?');
|
38 |
var resultResize = regResize.exec(decUrl);
|
39 |
if(resultResize && objectWidth < resultResize[1]){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
console.log('resize param found, replacing');
|
41 |
return decUrl.replace(regResize, 'resize=' + objectWidth + ',' + objectHeight);
|
42 |
}
|
43 |
var resultW = regW.exec(url);
|
44 |
if(resultW && objectWidth <= resultW[1]){
|
|
|
|
|
|
|
|
|
45 |
if('bg-cover'===objectType || 'img-crop'===objectType){
|
46 |
var diff = resultW[1] - objectWidth;
|
47 |
if ( diff > 20 || objectHeight < 1080 ) {
|
@@ -66,6 +82,14 @@ function constrainSrc(url,objectWidth,objectHeight,objectType){
|
|
66 |
console.log('fit param found, but only ' + wDiff + '/' + hDiff + ' pixels off, ignoring');
|
67 |
return url;
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
console.log('fit param found, replacing');
|
70 |
return decUrl.replace(regFit, 'fit=' + objectWidth + ',' + objectHeight);
|
71 |
}
|
@@ -79,8 +103,8 @@ function constrainSrc(url,objectWidth,objectHeight,objectType){
|
|
79 |
console.log('for ' + objectType);
|
80 |
return url + '&resize=' + objectWidth + ',' + objectHeight;
|
81 |
}
|
82 |
-
if(objectHeight>objectWidth){
|
83 |
-
console.log('fallback height>width, using h param');
|
84 |
return url + '&h=' + objectHeight;
|
85 |
}
|
86 |
console.log('fallback using w param');
|
@@ -97,9 +121,9 @@ function constrainSrc(url,objectWidth,objectHeight,objectType){
|
|
97 |
console.log('for ' + objectType);
|
98 |
return url + '?resize=' + objectWidth + ',' + objectHeight;
|
99 |
}
|
100 |
-
if(objectHeight>objectWidth){
|
101 |
-
console.log('fallback height>width, using h param');
|
102 |
-
return url + '
|
103 |
}
|
104 |
console.log('fallback using w param');
|
105 |
return url + '?w=' + objectWidth;
|
@@ -161,6 +185,18 @@ document.addEventListener('lazybeforeunveil', function(e){
|
|
161 |
} else if ( window.lazySizes.hC(target,'et_pb_jt_filterable_grid_item_image') || window.lazySizes.hC(target,'ss-foreground-image') || window.lazySizes.hC(target,'img-crop') ) {
|
162 |
console.log('img that needs a hard crop');
|
163 |
var newSrc = constrainSrc(src,targetWidth,targetHeight,'img-crop');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
} else if ( window.lazySizes.hC(target,'ct-image') && window.lazySizes.hC(target,'object-cover') ) {
|
165 |
console.log('Oxygen cover img that needs a hard crop');
|
166 |
var newSrc = constrainSrc(src,targetWidth,targetHeight,'img-crop');
|
27 |
var regW = /w=(\d+)/;
|
28 |
var regFit = /fit=(\d+),(\d+)/;
|
29 |
var regResize = /resize=(\d+),(\d+)/;
|
30 |
+
var regSVG = /\.svg(\?.+)?$/;
|
31 |
var decUrl = decodeURIComponent(url);
|
32 |
+
if (regSVG.exec(decUrl)){
|
33 |
+
return url;
|
34 |
+
}
|
35 |
if (typeof eio_lazy_vars === 'undefined'){
|
36 |
console.log('setting failsafe lazy vars');
|
37 |
eio_lazy_vars = {"exactdn_domain":".exactdn.com"};
|
41 |
console.log('domain matches URL with a ?');
|
42 |
var resultResize = regResize.exec(decUrl);
|
43 |
if(resultResize && objectWidth < resultResize[1]){
|
44 |
+
if('img-w'===objectType){
|
45 |
+
console.log('resize param found, replacing in ' + objectType);
|
46 |
+
return decUrl.replace(regResize, 'w=' + objectWidth );
|
47 |
+
}
|
48 |
+
if('img-h'===objectType){
|
49 |
+
console.log('resize param found, replacing in ' + objectType);
|
50 |
+
return decUrl.replace(regResize, 'h=' + objectHeight );
|
51 |
+
}
|
52 |
console.log('resize param found, replacing');
|
53 |
return decUrl.replace(regResize, 'resize=' + objectWidth + ',' + objectHeight);
|
54 |
}
|
55 |
var resultW = regW.exec(url);
|
56 |
if(resultW && objectWidth <= resultW[1]){
|
57 |
+
if('img-h'===objectType){
|
58 |
+
console.log('w param found, replacing in ' + objectType);
|
59 |
+
return decUrl.replace(regW, 'h=' + objectHeight );
|
60 |
+
}
|
61 |
if('bg-cover'===objectType || 'img-crop'===objectType){
|
62 |
var diff = resultW[1] - objectWidth;
|
63 |
if ( diff > 20 || objectHeight < 1080 ) {
|
82 |
console.log('fit param found, but only ' + wDiff + '/' + hDiff + ' pixels off, ignoring');
|
83 |
return url;
|
84 |
}
|
85 |
+
if('img-w'===objectType){
|
86 |
+
console.log('fit param found, replacing in ' + objectType);
|
87 |
+
return decUrl.replace(regFit, 'w=' + objectWidth );
|
88 |
+
}
|
89 |
+
if('img-h'===objectType){
|
90 |
+
console.log('fit param found, replacing in ' + objectType);
|
91 |
+
return decUrl.replace(regFit, 'h=' + objectHeight );
|
92 |
+
}
|
93 |
console.log('fit param found, replacing');
|
94 |
return decUrl.replace(regFit, 'fit=' + objectWidth + ',' + objectHeight);
|
95 |
}
|
103 |
console.log('for ' + objectType);
|
104 |
return url + '&resize=' + objectWidth + ',' + objectHeight;
|
105 |
}
|
106 |
+
if('img-h'===objectType || objectHeight>objectWidth){
|
107 |
+
console.log('img-h or fallback height>width, using h param');
|
108 |
return url + '&h=' + objectHeight;
|
109 |
}
|
110 |
console.log('fallback using w param');
|
121 |
console.log('for ' + objectType);
|
122 |
return url + '?resize=' + objectWidth + ',' + objectHeight;
|
123 |
}
|
124 |
+
if('img-h'===objectType || objectHeight>objectWidth){
|
125 |
+
console.log('img-h or fallback height>width, using h param');
|
126 |
+
return url + '&h=' + objectHeight;
|
127 |
}
|
128 |
console.log('fallback using w param');
|
129 |
return url + '?w=' + objectWidth;
|
185 |
} else if ( window.lazySizes.hC(target,'et_pb_jt_filterable_grid_item_image') || window.lazySizes.hC(target,'ss-foreground-image') || window.lazySizes.hC(target,'img-crop') ) {
|
186 |
console.log('img that needs a hard crop');
|
187 |
var newSrc = constrainSrc(src,targetWidth,targetHeight,'img-crop');
|
188 |
+
} else if (
|
189 |
+
window.lazySizes.hC(target,'object-cover') &&
|
190 |
+
( window.lazySizes.hC(target,'object-top') || window.lazySizes.hC(target,'object-bottom') )
|
191 |
+
) {
|
192 |
+
console.log('cover img that needs a width scale');
|
193 |
+
var newSrc = constrainSrc(src,targetWidth,targetHeight,'img-w');
|
194 |
+
} else if (
|
195 |
+
window.lazySizes.hC(target,'object-cover') &&
|
196 |
+
( window.lazySizes.hC(target,'object-left') || window.lazySizes.hC(target,'object-right') )
|
197 |
+
) {
|
198 |
+
console.log('cover img that needs a height scale');
|
199 |
+
var newSrc = constrainSrc(src,targetWidth,targetHeight,'img-h');
|
200 |
} else if ( window.lazySizes.hC(target,'ct-image') && window.lazySizes.hC(target,'object-cover') ) {
|
201 |
console.log('Oxygen cover img that needs a hard crop');
|
202 |
var newSrc = constrainSrc(src,targetWidth,targetHeight,'img-crop');
|
includes/lazysizes.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var ewww_webp_supported;function shouldAutoScale(e){if(1==eio_lazy_vars.skip_autoscale)return!1;if(e.hasAttributes())for(var t=e.attributes,a=/skip-autoscale/,i=t.length-1;0<=i;i--){if(a.test(t[i].name))return!1;if(a.test(t[i].value))return!1}return!0}function constrainSrc(e,t,a,i){if(null===e)return e;var r=/w=(\d+)/,n=/fit=(\d+),(\d+)/,o=/resize=(\d+),(\d+)/,s=decodeURIComponent(e);if("undefined"==typeof eio_lazy_vars&&(eio_lazy_vars={exactdn_domain:".exactdn.com"}),0<e.search("\\?")&&0<e.search(eio_lazy_vars.exactdn_domain)){var l=o.exec(s);if(l&&t<l[1])return s.replace(o,"resize="+t+","+a);o=r.exec(e);if(o&&t<=o[1]){if("bg-cover"!==i&&"img-crop"!==i)return e.replace(r,"w="+t);var d=o[1]-t;return 20<d||a<1080?e.replace(r,"resize="+t+","+a):e}d=n.exec(s);if(d&&t<d[1]){if("bg-cover"!==i&&"img-crop"!==i)return s.replace(n,"fit="+t+","+a);s=d[1]-t,n=d[2]-a;return 20<s||20<n?e.replace(r,"resize="+t+","+a):e}if(!o&&!d&&!l)return"img"===i?e+"&fit="+t+","+a:"bg-cover"===i||"img-crop"===i?e+"&resize="+t+","+a:t<a?e+"&h="+a:e+"&w="+t}return-1==e.search("\\?")&&0<e.search(eio_lazy_vars.exactdn_domain)?"img"===i?e+"?fit="+t+","+a:"bg-cover"===i||"img-crop"===i?e+"?resize="+t+","+a:t<a?e+"?h="+a:e+"?w="+t:e}void 0===ewww_webp_supported&&(ewww_webp_supported=!1),window.lazySizesConfig=window.lazySizesConfig||{},window.lazySizesConfig.expand=500<document.documentElement.clientHeight&&500<document.documentElement.clientWidth?1e3:740,50<eio_lazy_vars.threshold&&(window.lazySizesConfig.expand=eio_lazy_vars.threshold),function(e,t){function a(){t(e.lazySizes),e.removeEventListener("lazyunveilread",a,!0)}t=t.bind(null,e,e.document),"object"==typeof module&&module.exports?t(require("lazysizes")):e.lazySizes?a():e.addEventListener("lazyunveilread",a,!0)}(window,function(n,e,o){"use strict";var s;e.addEventListener&&(s=/\(|\)|\s|'/,addEventListener("lazybeforeunveil",function(e){var t,a,i,r;e.detail.instance==o&&(e.defaultPrevented||("none"==e.target.preload&&(e.target.preload="auto"),(i=e.target.getAttribute("data-bg"))&&(ewww_webp_supported&&(r=e.target.getAttribute("data-bg-webp"))&&(i=r),t=n.devicePixelRatio||1,a=Math.round(e.target.offsetWidth*t),r=Math.round(e.target.offsetHeight*t),0===i.search(/\[/)||shouldAutoScale(e.target)&&shouldAutoScale(e.target.parentNode)&&(i=n.lazySizes.hC(e.target,"wp-block-cover")?(n.lazySizes.hC(e.target,"has-parallax")?(a=Math.round(n.screen.width*t),r=Math.round(n.screen.height*t)):r<300&&(r=430),constrainSrc(i,a,r,"bg-cover")):n.lazySizes.hC(e.target,"cover-image")||n.lazySizes.hC(e.target,"elementor-bg")||n.lazySizes.hC(e.target,"et_parallax_bg")||n.lazySizes.hC(e.target,"bg-image-crop")?constrainSrc(i,a,r,"bg-cover"):constrainSrc(i,a,r,"bg")),e.target.style.backgroundImage&&-1===e.target.style.backgroundImage.search(/^initial/)?0===i.search(/\[/)?((i=JSON.parse(i)).forEach(function(e){s.test(e)&&JSON.stringify(e)}),i='url("'+i.join('"), url("')+'"',r=e.target.style.backgroundImage+", "+i,e.target.style.backgroundImage=r):e.target.style.backgroundImage=e.target.style.backgroundImage+', url("'+(s.test(i)?JSON.stringify(i):i)+'")':0===i.search(/\[/)?((i=JSON.parse(i)).forEach(function(e){s.test(e)&&JSON.stringify(e)}),i='url("'+i.join('"), url("')+'"',e.target.style.backgroundImage=i):e.target.style.backgroundImage="url("+(s.test(i)?JSON.stringify(i):i)+")")))},!1))}),document.addEventListener("lazybeforesizes",function(e){e.target.getAttribute("data-src");void 0!==e.target._lazysizesWidth&&e.detail.width<e.target._lazysizesWidth&&(e.detail.width=e.target._lazysizesWidth)}),document.addEventListener("lazybeforeunveil",function(e){var t,a,i,r,n,o=e.target,s=o.getAttribute("data-srcset");o.naturalWidth&&!s&&1<o.naturalWidth&&1<o.naturalHeight&&(i=window.devicePixelRatio||1,a=o.naturalWidth,r=o.naturalHeight,t=o.getAttribute("data-eio-rwidth"),e=o.getAttribute("data-eio-rheight"),t&&a<t&&(a=t,r=e),a=o.clientWidth&&1.25*o.clientWidth<a,r=o.clientHeight&&1.25*o.clientHeight<r,(a||r)&&(a=Math.round(o.offsetWidth*i),r=Math.round(o.offsetHeight*i),i=o.getAttribute("data-src"),n=o.getAttribute("data-src-webp"),ewww_webp_supported&&n&&-1==i.search("webp=1")&&(i=n),(r=!(!shouldAutoScale(o)||!shouldAutoScale(o.parentNode))&&(window.lazySizes.hC(o,"et_pb_jt_filterable_grid_item_image")||window.lazySizes.hC(o,"ss-foreground-image")||window.lazySizes.hC(o,"img-crop")||window.lazySizes.hC(o,"ct-image")&&window.lazySizes.hC(o,"object-cover")?constrainSrc(i,a,r,"img-crop"):constrainSrc(i,a,r,"img")))&&i!=r&&o.setAttribute("data-src",r))),ewww_webp_supported&&(!s||(s=o.getAttribute("data-srcset-webp"))&&o.setAttribute("data-srcset",s),(n=o.getAttribute("data-src-webp"))&&o.setAttribute("data-src",n))}),function(e,t){t=t(e,e.document,Date);e.lazySizes=t,"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:{},function(i,f,n){"use strict";var g,h;if(!function(){var e,t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in h=i.lazySizesConfig||i.lazysizesConfig||{},t)e in h||(h[e]=t[e])}(),!f||!f.getElementsByClassName)return{init:function(){},cfg:h,noSupport:!0};function c(e,t){S(e,t)||e.setAttribute("class",(e[y]("class")||"").trim()+" "+t)}function u(e,t){(t=S(e,t))&&e.setAttribute("class",(e[y]("class")||"").replace(t," "))}function z(e,t){var a;!l&&(a=i.picturefill||h.pf)?(t&&t.src&&!e[y]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)}var a,r,t,o,s,m=f.documentElement,l=i.HTMLPictureElement,d="addEventListener",y="getAttribute",e=i[d].bind(i),p=i.setTimeout,v=i.requestAnimationFrame||p,b=i.requestIdleCallback,w=/^picture$/i,_=["load","error","lazyincluded","_lazyloaded"],C={},A=Array.prototype.forEach,S=function(e,t){return C[t]||(C[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),C[t].test(e[y]("class")||"")&&C[t]},E=function(t,a,e){var i=e?d:"removeEventListener";e&&E(t,a),_.forEach(function(e){t[i](e,a)})},x=function(e,t,a,i,r){var n=f.createEvent("Event");return(a=a||{}).instance=g,n.initEvent(t,!i,!r),n.detail=a,e.dispatchEvent(n),n},N=function(e,t){return(getComputedStyle(e,null)||{})[t]},M=function(e,t,a){for(a=a||e.offsetWidth;a<h.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},W=(o=[],s=t=[],k._lsFlush=L,k);function L(){var e=s;for(s=t.length?o:t,r=!(a=!0);e.length;)e.shift()();a=!1}function k(e,t){a&&!t?e.apply(this,arguments):(s.push(e),r||(r=!0,(f.hidden?p:v)(L)))}function H(a,e){return e?function(){W(a)}:function(){var e=this,t=arguments;W(function(){a.apply(e,t)})}}function I(e){function t(){var e=n.now()-i;e<99?p(t,99-e):(b||r)(r)}var a,i,r=function(){a=null,e()};return function(){i=n.now(),a=a||p(t,99)}}var O,R,B,T,F,P,j,D,J,$,q,U,G,K,Q,V,X,Y,Z,ee,te,ae,ie,re,ne,oe,se,le,de,ce,ue,fe=(Z=/^img$/i,ee=/^iframe$/i,te="onscroll"in i&&!/(gle|ing)bot/.test(navigator.userAgent),re=-1,ne=function(e){return(U=null==U?"hidden"==N(f.body,"visibility"):U)||!("hidden"==N(e.parentNode,"visibility")&&"hidden"==N(e,"visibility"))},G=he,Q=ie=ae=0,V=h.throttleDelay,X=h.ricTimeout,Y=b&&49<X?function(){b(ze,{timeout:X}),X!==h.ricTimeout&&(X=h.ricTimeout)}:H(function(){p(ze)},!0),se=H(me),le=function(e){se({target:e.target})},de=H(function(t,e,a,i,r){var n,o,s,l,d;(s=x(t,"lazybeforeunveil",e)).defaultPrevented||(i&&(a?c(t,h.autosizesClass):t.setAttribute("sizes",i)),n=t[y](h.srcsetAttr),a=t[y](h.srcAttr),r&&(o=(d=t.parentNode)&&w.test(d.nodeName||"")),l=e.firesLoad||"src"in t&&(n||a||o),s={target:t},c(t,h.loadingClass),l&&(clearTimeout(B),B=p(ge,2500),E(t,le,!0)),o&&A.call(d.getElementsByTagName("source"),ye),n?t.setAttribute("srcset",n):a&&!o&&(ee.test(t.nodeName)?(i=a,0==(d=(e=t).getAttribute("data-load-mode")||h.iframeLoadMode)?e.contentWindow.location.replace(i):1==d&&(e.src=i)):t.src=a),r&&(n||o)&&z(t,{src:a})),t._lazyRace&&delete t._lazyRace,u(t,h.lazyClass),W(function(){var e=t.complete&&1<t.naturalWidth;l&&!e||(e&&c(t,h.fastLoadedClass),me(s),t._lazyCache=!0,p(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&ie--},!0)}),ue=I(function(){h.loadMode=3,oe()}),{_:function(){F=n.now(),g.elements=f.getElementsByClassName(h.lazyClass),O=f.getElementsByClassName(h.lazyClass+" "+h.preloadClass),e("scroll",oe,!0),e("resize",oe,!0),e("pageshow",function(e){var t;!e.persisted||(t=f.querySelectorAll("."+h.loadingClass)).length&&t.forEach&&v(function(){t.forEach(function(e){e.complete&&ce(e)})})}),i.MutationObserver?new MutationObserver(oe).observe(m,{childList:!0,subtree:!0,attributes:!0}):(m[d]("DOMNodeInserted",oe,!0),m[d]("DOMAttrModified",oe,!0),setInterval(oe,999)),e("hashchange",oe,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){f[d](e,oe,!0)}),/d$|^c/.test(f.readyState)?ve():(e("load",ve),f[d]("DOMContentLoaded",oe),p(ve,2e4)),g.elements.length?(he(),W._lsFlush()):oe()},checkElems:oe=function(e){var t;(e=!0===e)&&(X=33),K||(K=!0,(t=V-(n.now()-Q))<0&&(t=0),e||t<9?Y():p(Y,t))},unveil:ce=function(e){var t,a,i,r;e._lazyRace||(!(r="auto"==(i=(a=Z.test(e.nodeName))&&(e[y](h.sizesAttr)||e[y]("sizes"))))&&R||!a||!e[y]("src")&&!e.srcset||e.complete||S(e,h.errorClass)||!S(e,h.lazyClass))&&(t=x(e,"lazyunveilread").detail,r&&Ce.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,ie++,de(e,t,r,i,a))},_aLSL:pe});function ge(e){ie--,e&&!(ie<0)&&e.target||(ie=0)}function he(){var e,t,a,i,r,n,o,s,l,d,c,u=g.elements;if((T=h.loadMode)&&ie<8&&(e=u.length)){for(t=0,re++;t<e;t++)if(u[t]&&!u[t]._lazyRace)if(!te||g.prematureUnveil&&g.prematureUnveil(u[t]))ce(u[t]);else if((o=u[t][y]("data-expand"))&&(r=+o)||(r=ae),l||(l=!h.expand||h.expand<1?500<m.clientHeight&&500<m.clientWidth?500:370:h.expand,d=(g._defEx=l)*h.expFactor,c=h.hFac,U=null,ae<d&&ie<1&&2<re&&2<T&&!f.hidden?(ae=d,re=0):ae=1<T&&1<re&&ie<6?l:0),s!==r&&(P=innerWidth+r*c,j=innerHeight+r,n=-1*r,s=r),d=u[t].getBoundingClientRect(),(q=d.bottom)>=n&&(D=d.top)<=j&&($=d.right)>=n*c&&(J=d.left)<=P&&(q||$||J||D)&&(h.loadHidden||ne(u[t]))&&(R&&ie<3&&!o&&(T<3||re<4)||function(e,t){var a,i=e,r=ne(e);for(D-=t,q+=t,J-=t,$+=t;r&&(i=i.offsetParent)&&i!=f.body&&i!=m;)(r=0<(N(i,"opacity")||1))&&"visible"!=N(i,"overflow")&&(a=i.getBoundingClientRect(),r=$>a.left&&J<a.right&&q>a.top-1&&D<a.bottom+1);return r}(u[t],r))){if(ce(u[t]),i=!0,9<ie)break}else!i&&R&&!a&&ie<4&&re<4&&2<T&&(O[0]||h.preloadAfterLoad)&&(O[0]||!o&&(q||$||J||D||"auto"!=u[t][y](h.sizesAttr)))&&(a=O[0]||u[t]);a&&!i&&ce(a)}}function ze(){K=!1,Q=n.now(),G()}function me(e){var t=e.target;t._lazyCache?delete t._lazyCache:(ge(e),c(t,h.loadedClass),u(t,h.loadingClass),E(t,le),x(t,"lazyloaded"))}function ye(e){var t,a=e[y](h.srcsetAttr);(t=h.customMedia[e[y]("data-media")||e[y]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)}function pe(){3==h.loadMode&&(h.loadMode=2),ue()}function ve(){R||(n.now()-F<999?p(ve,999):(R=!0,h.loadMode=3,oe(),e("scroll",pe,!0)))}var be,we,_e,Ce=(we=H(function(e,t,a,i){var r,n,o;if(e._lazysizesWidth=i,e.setAttribute("sizes",i+="px"),w.test(t.nodeName||""))for(n=0,o=(r=t.getElementsByTagName("source")).length;n<o;n++)r[n].setAttribute("sizes",i);a.detail.dataAttr||z(e,a.detail)}),{_:function(){be=f.getElementsByClassName(h.autosizesClass),e("resize",_e)},checkElems:_e=I(function(){var e,t=be.length;if(t)for(e=0;e<t;e++)Ae(be[e])}),updateElem:Ae});function Ae(e,t,a){var i=e.parentNode;i&&(a=M(e,i,a),(t=x(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=t.detail.width)&&a!==e._lazysizesWidth&&we(e,i,t,a))}function Se(){!Se.i&&f.getElementsByClassName&&(Se.i=!0,Ce._(),fe._())}return p(function(){h.init&&Se()}),g={cfg:h,autoSizer:Ce,loader:fe,init:Se,uP:z,aC:c,rC:u,hC:S,fire:x,gW:M,rAF:W}});
|
1 |
+
var ewww_webp_supported;function shouldAutoScale(e){if(1==eio_lazy_vars.skip_autoscale)return!1;if(e.hasAttributes())for(var t=e.attributes,a=/skip-autoscale/,i=t.length-1;0<=i;i--){if(a.test(t[i].name))return!1;if(a.test(t[i].value))return!1}return!0}function constrainSrc(e,t,a,i){if(null===e)return e;var r=/w=(\d+)/,n=/fit=(\d+),(\d+)/,o=/resize=(\d+),(\d+)/,s=decodeURIComponent(e);if(/\.svg(\?.+)?$/.exec(s))return e;if("undefined"==typeof eio_lazy_vars&&(eio_lazy_vars={exactdn_domain:".exactdn.com"}),0<e.search("\\?")&&0<e.search(eio_lazy_vars.exactdn_domain)){var l=o.exec(s);if(l&&t<l[1])return"img-w"===i?s.replace(o,"w="+t):"img-h"===i?s.replace(o,"h="+a):s.replace(o,"resize="+t+","+a);o=r.exec(e);if(o&&t<=o[1]){if("img-h"===i)return s.replace(r,"h="+a);if("bg-cover"!==i&&"img-crop"!==i)return e.replace(r,"w="+t);var c=o[1]-t;return 20<c||a<1080?e.replace(r,"resize="+t+","+a):e}c=n.exec(s);if(c&&t<c[1]){if("bg-cover"!==i&&"img-crop"!==i)return"img-w"===i?s.replace(n,"w="+t):"img-h"===i?s.replace(n,"h="+a):s.replace(n,"fit="+t+","+a);s=c[1]-t,n=c[2]-a;return 20<s||20<n?e.replace(r,"resize="+t+","+a):e}if(!o&&!c&&!l)return"img"===i?e+"&fit="+t+","+a:"bg-cover"===i||"img-crop"===i?e+"&resize="+t+","+a:"img-h"===i||t<a?e+"&h="+a:e+"&w="+t}return-1==e.search("\\?")&&0<e.search(eio_lazy_vars.exactdn_domain)?"img"===i?e+"?fit="+t+","+a:"bg-cover"===i||"img-crop"===i?e+"?resize="+t+","+a:"img-h"===i||t<a?e+"&h="+a:e+"?w="+t:e}void 0===ewww_webp_supported&&(ewww_webp_supported=!1),window.lazySizesConfig=window.lazySizesConfig||{},window.lazySizesConfig.expand=500<document.documentElement.clientHeight&&500<document.documentElement.clientWidth?1e3:740,50<eio_lazy_vars.threshold&&(window.lazySizesConfig.expand=eio_lazy_vars.threshold),function(e,t){function a(){t(e.lazySizes),e.removeEventListener("lazyunveilread",a,!0)}t=t.bind(null,e,e.document),"object"==typeof module&&module.exports?t(require("lazysizes")):e.lazySizes?a():e.addEventListener("lazyunveilread",a,!0)}(window,function(n,e,o){"use strict";var s;e.addEventListener&&(s=/\(|\)|\s|'/,addEventListener("lazybeforeunveil",function(e){var t,a,i,r;e.detail.instance==o&&(e.defaultPrevented||("none"==e.target.preload&&(e.target.preload="auto"),(i=e.target.getAttribute("data-bg"))&&(ewww_webp_supported&&(r=e.target.getAttribute("data-bg-webp"))&&(i=r),t=n.devicePixelRatio||1,a=Math.round(e.target.offsetWidth*t),r=Math.round(e.target.offsetHeight*t),0===i.search(/\[/)||shouldAutoScale(e.target)&&shouldAutoScale(e.target.parentNode)&&(i=n.lazySizes.hC(e.target,"wp-block-cover")?(n.lazySizes.hC(e.target,"has-parallax")?(a=Math.round(n.screen.width*t),r=Math.round(n.screen.height*t)):r<300&&(r=430),constrainSrc(i,a,r,"bg-cover")):n.lazySizes.hC(e.target,"cover-image")||n.lazySizes.hC(e.target,"elementor-bg")||n.lazySizes.hC(e.target,"et_parallax_bg")||n.lazySizes.hC(e.target,"bg-image-crop")?constrainSrc(i,a,r,"bg-cover"):constrainSrc(i,a,r,"bg")),e.target.style.backgroundImage&&-1===e.target.style.backgroundImage.search(/^initial/)?0===i.search(/\[/)?((i=JSON.parse(i)).forEach(function(e){s.test(e)&&JSON.stringify(e)}),i='url("'+i.join('"), url("')+'"',r=e.target.style.backgroundImage+", "+i,e.target.style.backgroundImage=r):e.target.style.backgroundImage=e.target.style.backgroundImage+', url("'+(s.test(i)?JSON.stringify(i):i)+'")':0===i.search(/\[/)?((i=JSON.parse(i)).forEach(function(e){s.test(e)&&JSON.stringify(e)}),i='url("'+i.join('"), url("')+'"',e.target.style.backgroundImage=i):e.target.style.backgroundImage="url("+(s.test(i)?JSON.stringify(i):i)+")")))},!1))}),document.addEventListener("lazybeforesizes",function(e){e.target.getAttribute("data-src");void 0!==e.target._lazysizesWidth&&e.detail.width<e.target._lazysizesWidth&&(e.detail.width=e.target._lazysizesWidth)}),document.addEventListener("lazybeforeunveil",function(e){var t,a,i,r,n,o=e.target,s=o.getAttribute("data-srcset");o.naturalWidth&&!s&&1<o.naturalWidth&&1<o.naturalHeight&&(i=window.devicePixelRatio||1,a=o.naturalWidth,r=o.naturalHeight,t=o.getAttribute("data-eio-rwidth"),e=o.getAttribute("data-eio-rheight"),t&&a<t&&(a=t,r=e),a=o.clientWidth&&1.25*o.clientWidth<a,r=o.clientHeight&&1.25*o.clientHeight<r,(a||r)&&(a=Math.round(o.offsetWidth*i),r=Math.round(o.offsetHeight*i),i=o.getAttribute("data-src"),n=o.getAttribute("data-src-webp"),ewww_webp_supported&&n&&-1==i.search("webp=1")&&(i=n),(r=!(!shouldAutoScale(o)||!shouldAutoScale(o.parentNode))&&(window.lazySizes.hC(o,"et_pb_jt_filterable_grid_item_image")||window.lazySizes.hC(o,"ss-foreground-image")||window.lazySizes.hC(o,"img-crop")?constrainSrc(i,a,r,"img-crop"):window.lazySizes.hC(o,"object-cover")&&(window.lazySizes.hC(o,"object-top")||window.lazySizes.hC(o,"object-bottom"))?constrainSrc(i,a,r,"img-w"):window.lazySizes.hC(o,"object-cover")&&(window.lazySizes.hC(o,"object-left")||window.lazySizes.hC(o,"object-right"))?constrainSrc(i,a,r,"img-h"):window.lazySizes.hC(o,"ct-image")&&window.lazySizes.hC(o,"object-cover")?constrainSrc(i,a,r,"img-crop"):constrainSrc(i,a,r,"img")))&&i!=r&&o.setAttribute("data-src",r))),ewww_webp_supported&&(!s||(s=o.getAttribute("data-srcset-webp"))&&o.setAttribute("data-srcset",s),(n=o.getAttribute("data-src-webp"))&&o.setAttribute("data-src",n))}),function(e,t){t=t(e,e.document,Date);e.lazySizes=t,"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:{},function(i,f,n){"use strict";var g,h;if(!function(){var e,t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in h=i.lazySizesConfig||i.lazysizesConfig||{},t)e in h||(h[e]=t[e])}(),!f||!f.getElementsByClassName)return{init:function(){},cfg:h,noSupport:!0};function d(e,t){A(e,t)||e.setAttribute("class",(e[y]("class")||"").trim()+" "+t)}function u(e,t){(t=A(e,t))&&e.setAttribute("class",(e[y]("class")||"").replace(t," "))}function z(e,t){var a;!l&&(a=i.picturefill||h.pf)?(t&&t.src&&!e[y]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)}var a,r,t,o,s,m=f.documentElement,l=i.HTMLPictureElement,c="addEventListener",y="getAttribute",e=i[c].bind(i),p=i.setTimeout,v=i.requestAnimationFrame||p,w=i.requestIdleCallback,b=/^picture$/i,_=["load","error","lazyincluded","_lazyloaded"],C={},S=Array.prototype.forEach,A=function(e,t){return C[t]||(C[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),C[t].test(e[y]("class")||"")&&C[t]},E=function(t,a,e){var i=e?c:"removeEventListener";e&&E(t,a),_.forEach(function(e){t[i](e,a)})},x=function(e,t,a,i,r){var n=f.createEvent("Event");return(a=a||{}).instance=g,n.initEvent(t,!i,!r),n.detail=a,e.dispatchEvent(n),n},N=function(e,t){return(getComputedStyle(e,null)||{})[t]},M=function(e,t,a){for(a=a||e.offsetWidth;a<h.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},W=(o=[],s=t=[],k._lsFlush=L,k);function L(){var e=s;for(s=t.length?o:t,r=!(a=!0);e.length;)e.shift()();a=!1}function k(e,t){a&&!t?e.apply(this,arguments):(s.push(e),r||(r=!0,(f.hidden?p:v)(L)))}function j(a,e){return e?function(){W(a)}:function(){var e=this,t=arguments;W(function(){a.apply(e,t)})}}function H(e){function t(){var e=n.now()-i;e<99?p(t,99-e):(w||r)(r)}var a,i,r=function(){a=null,e()};return function(){i=n.now(),a=a||p(t,99)}}var I,O,R,B,T,F,P,D,J,$,q,U,G,K,Q,V,X,Y,Z,ee,te,ae,ie,re,ne,oe,se,le,ce,de,ue,fe=(Z=/^img$/i,ee=/^iframe$/i,te="onscroll"in i&&!/(gle|ing)bot/.test(navigator.userAgent),re=-1,ne=function(e){return(U=null==U?"hidden"==N(f.body,"visibility"):U)||!("hidden"==N(e.parentNode,"visibility")&&"hidden"==N(e,"visibility"))},G=he,Q=ie=ae=0,V=h.throttleDelay,X=h.ricTimeout,Y=w&&49<X?function(){w(ze,{timeout:X}),X!==h.ricTimeout&&(X=h.ricTimeout)}:j(function(){p(ze)},!0),se=j(me),le=function(e){se({target:e.target})},ce=j(function(t,e,a,i,r){var n,o,s,l,c;(s=x(t,"lazybeforeunveil",e)).defaultPrevented||(i&&(a?d(t,h.autosizesClass):t.setAttribute("sizes",i)),n=t[y](h.srcsetAttr),a=t[y](h.srcAttr),r&&(o=(c=t.parentNode)&&b.test(c.nodeName||"")),l=e.firesLoad||"src"in t&&(n||a||o),s={target:t},d(t,h.loadingClass),l&&(clearTimeout(R),R=p(ge,2500),E(t,le,!0)),o&&S.call(c.getElementsByTagName("source"),ye),n?t.setAttribute("srcset",n):a&&!o&&(ee.test(t.nodeName)?(i=a,0==(c=(e=t).getAttribute("data-load-mode")||h.iframeLoadMode)?e.contentWindow.location.replace(i):1==c&&(e.src=i)):t.src=a),r&&(n||o)&&z(t,{src:a})),t._lazyRace&&delete t._lazyRace,u(t,h.lazyClass),W(function(){var e=t.complete&&1<t.naturalWidth;l&&!e||(e&&d(t,h.fastLoadedClass),me(s),t._lazyCache=!0,p(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&ie--},!0)}),ue=H(function(){h.loadMode=3,oe()}),{_:function(){T=n.now(),g.elements=f.getElementsByClassName(h.lazyClass),I=f.getElementsByClassName(h.lazyClass+" "+h.preloadClass),e("scroll",oe,!0),e("resize",oe,!0),e("pageshow",function(e){var t;!e.persisted||(t=f.querySelectorAll("."+h.loadingClass)).length&&t.forEach&&v(function(){t.forEach(function(e){e.complete&&de(e)})})}),i.MutationObserver?new MutationObserver(oe).observe(m,{childList:!0,subtree:!0,attributes:!0}):(m[c]("DOMNodeInserted",oe,!0),m[c]("DOMAttrModified",oe,!0),setInterval(oe,999)),e("hashchange",oe,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){f[c](e,oe,!0)}),/d$|^c/.test(f.readyState)?ve():(e("load",ve),f[c]("DOMContentLoaded",oe),p(ve,2e4)),g.elements.length?(he(),W._lsFlush()):oe()},checkElems:oe=function(e){var t;(e=!0===e)&&(X=33),K||(K=!0,(t=V-(n.now()-Q))<0&&(t=0),e||t<9?Y():p(Y,t))},unveil:de=function(e){var t,a,i,r;e._lazyRace||(!(r="auto"==(i=(a=Z.test(e.nodeName))&&(e[y](h.sizesAttr)||e[y]("sizes"))))&&O||!a||!e[y]("src")&&!e.srcset||e.complete||A(e,h.errorClass)||!A(e,h.lazyClass))&&(t=x(e,"lazyunveilread").detail,r&&Ce.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,ie++,ce(e,t,r,i,a))},_aLSL:pe});function ge(e){ie--,e&&!(ie<0)&&e.target||(ie=0)}function he(){var e,t,a,i,r,n,o,s,l,c,d,u=g.elements;if((B=h.loadMode)&&ie<8&&(e=u.length)){for(t=0,re++;t<e;t++)if(u[t]&&!u[t]._lazyRace)if(!te||g.prematureUnveil&&g.prematureUnveil(u[t]))de(u[t]);else if((o=u[t][y]("data-expand"))&&(r=+o)||(r=ae),l||(l=!h.expand||h.expand<1?500<m.clientHeight&&500<m.clientWidth?500:370:h.expand,c=(g._defEx=l)*h.expFactor,d=h.hFac,U=null,ae<c&&ie<1&&2<re&&2<B&&!f.hidden?(ae=c,re=0):ae=1<B&&1<re&&ie<6?l:0),s!==r&&(F=innerWidth+r*d,P=innerHeight+r,n=-1*r,s=r),c=u[t].getBoundingClientRect(),(q=c.bottom)>=n&&(D=c.top)<=P&&($=c.right)>=n*d&&(J=c.left)<=F&&(q||$||J||D)&&(h.loadHidden||ne(u[t]))&&(O&&ie<3&&!o&&(B<3||re<4)||function(e,t){var a,i=e,r=ne(e);for(D-=t,q+=t,J-=t,$+=t;r&&(i=i.offsetParent)&&i!=f.body&&i!=m;)(r=0<(N(i,"opacity")||1))&&"visible"!=N(i,"overflow")&&(a=i.getBoundingClientRect(),r=$>a.left&&J<a.right&&q>a.top-1&&D<a.bottom+1);return r}(u[t],r))){if(de(u[t]),i=!0,9<ie)break}else!i&&O&&!a&&ie<4&&re<4&&2<B&&(I[0]||h.preloadAfterLoad)&&(I[0]||!o&&(q||$||J||D||"auto"!=u[t][y](h.sizesAttr)))&&(a=I[0]||u[t]);a&&!i&&de(a)}}function ze(){K=!1,Q=n.now(),G()}function me(e){var t=e.target;t._lazyCache?delete t._lazyCache:(ge(e),d(t,h.loadedClass),u(t,h.loadingClass),E(t,le),x(t,"lazyloaded"))}function ye(e){var t,a=e[y](h.srcsetAttr);(t=h.customMedia[e[y]("data-media")||e[y]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)}function pe(){3==h.loadMode&&(h.loadMode=2),ue()}function ve(){O||(n.now()-T<999?p(ve,999):(O=!0,h.loadMode=3,oe(),e("scroll",pe,!0)))}var we,be,_e,Ce=(be=j(function(e,t,a,i){var r,n,o;if(e._lazysizesWidth=i,e.setAttribute("sizes",i+="px"),b.test(t.nodeName||""))for(n=0,o=(r=t.getElementsByTagName("source")).length;n<o;n++)r[n].setAttribute("sizes",i);a.detail.dataAttr||z(e,a.detail)}),{_:function(){we=f.getElementsByClassName(h.autosizesClass),e("resize",_e)},checkElems:_e=H(function(){var e,t=we.length;if(t)for(e=0;e<t;e++)Se(we[e])}),updateElem:Se});function Se(e,t,a){var i=e.parentNode;i&&(a=M(e,i,a),(t=x(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=t.detail.width)&&a!==e._lazysizesWidth&&be(e,i,t,a))}function Ae(){!Ae.i&&f.getElementsByClassName&&(Ae.i=!0,Ce._(),fe._())}return p(function(){h.init&&Ae()}),g={cfg:h,autoSizer:Ce,loader:fe,init:Ae,uP:z,aC:d,rC:u,hC:A,fire:x,gW:M,rAF:W}});
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
Contributors: nosilver4u
|
3 |
Donate link: https://ewww.io/donate/
|
4 |
Tags: optimize, image, convert, webp, resize, compress, lazy load, optimization, lossless, lossy, seo, scale
|
5 |
-
Requires at least: 5.
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 7.2
|
8 |
-
Stable tag: 6.
|
9 |
License: GPLv3
|
10 |
|
11 |
Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
|
@@ -137,6 +137,19 @@ That's not a question, but since I made it up, I'll answer it. See this resource
|
|
137 |
* Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io/b/features)
|
138 |
* If you would like to help translate this plugin in your language, [join the team](https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/)
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
= 6.6.0 =
|
141 |
* added: AVIF support via Easy IO, enable on site management at ewww.io
|
142 |
* added: sharpening setting to improve WP resizing via ImageMagick and WebP conversion
|
2 |
Contributors: nosilver4u
|
3 |
Donate link: https://ewww.io/donate/
|
4 |
Tags: optimize, image, convert, webp, resize, compress, lazy load, optimization, lossless, lossy, seo, scale
|
5 |
+
Requires at least: 5.8
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 7.2
|
8 |
+
Stable tag: 6.7.0
|
9 |
License: GPLv3
|
10 |
|
11 |
Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
|
137 |
* Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io/b/features)
|
138 |
* If you would like to help translate this plugin in your language, [join the team](https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/)
|
139 |
|
140 |
+
= 6.7.0 =
|
141 |
+
* added: API keys can be used to auto-register sites for Easy IO, including sub-keys
|
142 |
+
* changed: expose legacy resize dimensions with removal option
|
143 |
+
* fixed: Lazy Load not using EWWWIO_CONTENT_DIR
|
144 |
+
* fixed: Easy IO Premium/WebP compression disabled incorrectly when in Easy Mode
|
145 |
+
* fixed: JS WebP body script throws error if wp_head script missing
|
146 |
+
* fixed: Lazy Load Auto-scale adds query parameters to SVG images
|
147 |
+
* fixed: JS WebP and Lazy Load prevent image loading in GiveWP iframe
|
148 |
+
* fixed: Auto Scale crops too much for object-* images in Oxygen
|
149 |
+
* fixed: trailing space on image URL handled incorrectly
|
150 |
+
* updated: Gifsicle to version 1.93 and Pngquant to 2.17
|
151 |
+
* removed: free binaries for SunOS, may use free cloud-based JPG compression instead
|
152 |
+
|
153 |
= 6.6.0 =
|
154 |
* added: AVIF support via Easy IO, enable on site management at ewww.io
|
155 |
* added: sharpening setting to improve WP resizing via ImageMagick and WebP conversion
|
tests/test-optimize.php
CHANGED
@@ -380,7 +380,7 @@ class EWWWIO_Optimize_Tests extends WP_UnitTestCase {
|
|
380 |
update_site_option( 'ewww_image_optimizer_optipng_level', 2 );
|
381 |
update_site_option( 'ewww_image_optimizer_metadata_remove', true );
|
382 |
$results = $this->optimize_png();
|
383 |
-
$this->assertEquals(
|
384 |
unlink( $results[0] );
|
385 |
}
|
386 |
|
380 |
update_site_option( 'ewww_image_optimizer_optipng_level', 2 );
|
381 |
update_site_option( 'ewww_image_optimizer_metadata_remove', true );
|
382 |
$results = $this->optimize_png();
|
383 |
+
$this->assertEquals( 38603, filesize( $results[0] ) );
|
384 |
unlink( $results[0] );
|
385 |
}
|
386 |
|
unique.php
CHANGED
@@ -110,10 +110,13 @@ function ewww_image_optimizer_exec_init() {
|
|
110 |
* @return bool True if the PHP_OS is supported, false otherwise.
|
111 |
*/
|
112 |
function ewww_image_optimizer_os_supported() {
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
117 |
}
|
118 |
|
119 |
/**
|
@@ -254,11 +257,37 @@ function ewww_image_optimizer_notice_hosting_requires_api() {
|
|
254 |
*/
|
255 |
function ewww_image_optimizer_notice_os() {
|
256 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
}
|
263 |
|
264 |
/**
|
@@ -1122,7 +1151,9 @@ function ewww_image_optimizer_md5check( $path ) {
|
|
1122 |
'1ed9343194cfca0a1c32677c974192746adfd48cb4cea6a2df668452df0e68f7', // optipng-sol 0.7.6, EWWW 2.8.0.
|
1123 |
'03b86ce2c08e2cc78d76d3d3dd173986b498b055c3c19e13a97a7c3c674772c6', // optipng.exe 0.7.6, EWWW 2.8.0.
|
1124 |
'f01cba0ab658e08738315843ee635be273726bf102ae448416b3d8956843d864', // optipng-fbsd 0.7.7 EWWW 4.1.0.
|
|
|
1125 |
'4404076a4f9119d4dfbb7acb00eb65345e804186a019c7136d8f8e87fb0cb997', // optipng-linux 0.7.7 EWWW 4.1.0.
|
|
|
1126 |
'36535c1b262e0c457bbb0ed2bc71e812a49e26a6cada63b6acbd8d809c68a5a1', // optipng-mac 0.7.7 EWWW 4.1.0.
|
1127 |
'41a4c78e6c97ea26836f4b021157b34f1812a9e5c2341502aad8cde942b18576', // optipng-sol 0.7.7 EWWW 4.1.0.
|
1128 |
'6a321e07eca8e28fa8a969b5db3c1d3cc008a2064d636cf74762bbe4364b7b14', // optipng.exe 0.7.7 EWWW 4.1.0.
|
@@ -1158,6 +1189,9 @@ function ewww_image_optimizer_md5check( $path ) {
|
|
1158 |
'5fcdd102146984e41b01a160d072dd36852d7be14ab569a323c47e7e56916d0d', // gifsicle-sol 1.91, EWWW 4.x.
|
1159 |
'7156bfe16dc5e33af7facdc6847d268154ffeb75c0217517e4e188b58b293c6a', // gifsicle.exe 1.91, EWWW 4.1.0.
|
1160 |
'3f59274d214a9c4f7a3bf68755ff75b6801c94f3e9e73b5a95767e2d7ec0fc42', // gifsicle.exe 1.92, EWWW 6.1.0.
|
|
|
|
|
|
|
1161 |
// end gifsicle.
|
1162 |
'bdea95497d6e60aae8938cae8e999ef74a255ad603531bf523dcdb531f61fc8f', // 20110722-bsd/i686/pngout.
|
1163 |
'57c09b3ebd7d4623d16f6056efd7951e8f98e2362a27993a7d865af677875c00', // 20110722-bsd-static/i686/pngout-static.
|
@@ -1231,6 +1265,10 @@ function ewww_image_optimizer_md5check( $path ) {
|
|
1231 |
'd8f5cfeb240ade34cf2f4b06dd66d29a28b8fd38e275d4caa9278bc83a39571f', // pngquant-mac 2.13.1 EWWW 6.1.0.
|
1232 |
'199365d719c045a291596fc47cddc0111125cc3ff9d55235cabffdf476db4ca4', // pngquant-sol 2.13.1 EWWW 6.1.0.
|
1233 |
'1e93bc6991d7e77ad7a1f48560d62a1b80faa99df38ddf56030e23d48476769e', // pngquant.exe 2.13.1 EWWW 6.1.0.
|
|
|
|
|
|
|
|
|
1234 |
// end pngquant.
|
1235 |
'bf0e12f996802dc114a864e5150647ce41089a5a2b5e36c3a270ac848b655c26', // cwebp-fbsd 0.4.1, EWWW 2.0.0.
|
1236 |
'5349646072c3ef5f8b4588bbee8635e882c245439e2d86b863f04b7e27f4fafe', // cwebp-fbsd64 0.4.1, EWWW 2.0.0.
|
@@ -1284,6 +1322,7 @@ function ewww_image_optimizer_md5check( $path ) {
|
|
1284 |
'fc25866344efb604b3e70dc3e5519199605da13b550ccee4b7bbdcdeb0b5e6be', // cwebp-mac15 1.2.0, EWWW 6.1.0.
|
1285 |
'488410937dbbc4ec55fddfc0fa6835b862f7024680744a5e5ac8b88be9270fcc', // cwebp-sol 1.2.0, EWWW 6.1.0.
|
1286 |
'2849fd06012a9eb311b02a4f8918ae4b16775693bc21e95f4cc6a382eac299f9', // cwebp.exe 1.2.0, EWWW 6.1.0.
|
|
|
1287 |
// end cwebp.
|
1288 |
'15d8b7d54b73059a9a63ab3d5ca8201cd30c2f6fc59fc068f7bd6c85e6a22420', // svgcleaner-linux 0.9.5.
|
1289 |
'c88c1961374b3edc93a29376ccbd447a514c1cda335fe6a868c0dac6d77c79fa', // svgcleaner-mac 0.9.5.
|
110 |
* @return bool True if the PHP_OS is supported, false otherwise.
|
111 |
*/
|
112 |
function ewww_image_optimizer_os_supported() {
|
113 |
+
$supported_oss = array(
|
114 |
+
'Linux',
|
115 |
+
'Darwin',
|
116 |
+
'FreeBSD',
|
117 |
+
'WINNT',
|
118 |
+
);
|
119 |
+
return in_array( PHP_OS, $supported_oss, true );
|
120 |
}
|
121 |
|
122 |
/**
|
257 |
*/
|
258 |
function ewww_image_optimizer_notice_os() {
|
259 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
260 |
+
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_dismiss_exec_notice' ) ) {
|
261 |
+
return;
|
262 |
+
}
|
263 |
+
if (
|
264 |
+
ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ||
|
265 |
+
ewww_image_optimizer_easy_active() ||
|
266 |
+
! ewww_image_optimizer_get_option( 'ewww_image_optimizer_wizard_complete' )
|
267 |
+
) {
|
268 |
+
return;
|
269 |
+
}
|
270 |
+
echo "<div id='ewww-image-optimizer-warning-exec' class='notice notice-warning is-dismissible'><p>" .
|
271 |
+
esc_html__( 'Free server-based compression with EWWW Image Optimizer is only supported on Linux, FreeBSD, Mac OSX, and Windows.', 'ewww-image-optimizer' ) .
|
272 |
+
'<br><strong>' .
|
273 |
+
/* translators: %s: link to 'start your free trial' */
|
274 |
+
sprintf( esc_html__( 'Dismiss this notice to continue with free cloud-based JPG compression or %s.', 'ewww-image-optimizer' ), "<a href='https://ewww.io/plans/'>" . esc_html__( 'start your premium trial', 'ewww-image-optimizer' ) . '</a>' );
|
275 |
+
ewwwio_help_link( 'https://docs.ewww.io/article/29-what-is-exec-and-why-do-i-need-it', '592dd12d0428634b4a338c39' );
|
276 |
+
echo '</strong></p></div>';
|
277 |
+
?>
|
278 |
+
<script>
|
279 |
+
jQuery(document).on('click', '#ewww-image-optimizer-warning-exec .notice-dismiss', function() {
|
280 |
+
var ewww_dismiss_exec_data = {
|
281 |
+
action: 'ewww_dismiss_exec_notice',
|
282 |
+
};
|
283 |
+
jQuery.post(ajaxurl, ewww_dismiss_exec_data, function(response) {
|
284 |
+
if (response) {
|
285 |
+
console.log(response);
|
286 |
+
}
|
287 |
+
});
|
288 |
+
});
|
289 |
+
</script>
|
290 |
+
<?php
|
291 |
}
|
292 |
|
293 |
/**
|
1151 |
'1ed9343194cfca0a1c32677c974192746adfd48cb4cea6a2df668452df0e68f7', // optipng-sol 0.7.6, EWWW 2.8.0.
|
1152 |
'03b86ce2c08e2cc78d76d3d3dd173986b498b055c3c19e13a97a7c3c674772c6', // optipng.exe 0.7.6, EWWW 2.8.0.
|
1153 |
'f01cba0ab658e08738315843ee635be273726bf102ae448416b3d8956843d864', // optipng-fbsd 0.7.7 EWWW 4.1.0.
|
1154 |
+
'4c6efd6ef91f277f6887ba38d025d3060f4e6539838fb359e3057960c84e3cda', // optipng-fbsd 0.7.7 stripped EWWW 6.7.0.
|
1155 |
'4404076a4f9119d4dfbb7acb00eb65345e804186a019c7136d8f8e87fb0cb997', // optipng-linux 0.7.7 EWWW 4.1.0.
|
1156 |
+
'5a14f6e8fda7a8c5e571525b279a5cf264116a62afd3cc2885e4c9ea8ef0f24b', // optipng-linux 0.7.7 stripped EWWW 6.7.0.
|
1157 |
'36535c1b262e0c457bbb0ed2bc71e812a49e26a6cada63b6acbd8d809c68a5a1', // optipng-mac 0.7.7 EWWW 4.1.0.
|
1158 |
'41a4c78e6c97ea26836f4b021157b34f1812a9e5c2341502aad8cde942b18576', // optipng-sol 0.7.7 EWWW 4.1.0.
|
1159 |
'6a321e07eca8e28fa8a969b5db3c1d3cc008a2064d636cf74762bbe4364b7b14', // optipng.exe 0.7.7 EWWW 4.1.0.
|
1189 |
'5fcdd102146984e41b01a160d072dd36852d7be14ab569a323c47e7e56916d0d', // gifsicle-sol 1.91, EWWW 4.x.
|
1190 |
'7156bfe16dc5e33af7facdc6847d268154ffeb75c0217517e4e188b58b293c6a', // gifsicle.exe 1.91, EWWW 4.1.0.
|
1191 |
'3f59274d214a9c4f7a3bf68755ff75b6801c94f3e9e73b5a95767e2d7ec0fc42', // gifsicle.exe 1.92, EWWW 6.1.0.
|
1192 |
+
'3b745d61a6be2b546424523848f699db5c60765a69659c328621daf39be199a1', // gifsicle-fbsd 1.93, EWWW 6.7.0.
|
1193 |
+
'205abe804d1060375f713d990c45b0285cbc4b56226da1612e9f1d2d2e2c5369', // gifsicle-linux 1.93, EWWW 6.7.0.
|
1194 |
+
'fbd269135c779acf8f96e38116cea3e2f429fb4fada3f876f2cedea8511830ba', // gifsicle-mac 1.93, EWWW 6.7.0.
|
1195 |
// end gifsicle.
|
1196 |
'bdea95497d6e60aae8938cae8e999ef74a255ad603531bf523dcdb531f61fc8f', // 20110722-bsd/i686/pngout.
|
1197 |
'57c09b3ebd7d4623d16f6056efd7951e8f98e2362a27993a7d865af677875c00', // 20110722-bsd-static/i686/pngout-static.
|
1265 |
'd8f5cfeb240ade34cf2f4b06dd66d29a28b8fd38e275d4caa9278bc83a39571f', // pngquant-mac 2.13.1 EWWW 6.1.0.
|
1266 |
'199365d719c045a291596fc47cddc0111125cc3ff9d55235cabffdf476db4ca4', // pngquant-sol 2.13.1 EWWW 6.1.0.
|
1267 |
'1e93bc6991d7e77ad7a1f48560d62a1b80faa99df38ddf56030e23d48476769e', // pngquant.exe 2.13.1 EWWW 6.1.0.
|
1268 |
+
'c2918bb09fcf1a07ad6982c3d7c9d93a50c9f201d9277e26778b2ede2f950423', // pngquant-fbsd 2.17.0 EWWW 6.7.0.
|
1269 |
+
'd4521b01d134351d9d398ab1086406cfc8f706fc300e88d1a4b9b914a33d9229', // pngquant-linux 2.17.0 EWWW 6.7.0.
|
1270 |
+
'0ac4981983faa3a2334c0ae7abf9a26480eddc77ed2c581a11dada0eee5a5e2d', // pngquant-mac 2.17.0 EWWW 6.7.0.
|
1271 |
+
'7aadad6a50aa5c40cfcb20f9478c92f6030360a3424bc262ce383dc1e97fb86a', // pngquant.exe 2.17.0 EWWW 6.7.0.
|
1272 |
// end pngquant.
|
1273 |
'bf0e12f996802dc114a864e5150647ce41089a5a2b5e36c3a270ac848b655c26', // cwebp-fbsd 0.4.1, EWWW 2.0.0.
|
1274 |
'5349646072c3ef5f8b4588bbee8635e882c245439e2d86b863f04b7e27f4fafe', // cwebp-fbsd64 0.4.1, EWWW 2.0.0.
|
1322 |
'fc25866344efb604b3e70dc3e5519199605da13b550ccee4b7bbdcdeb0b5e6be', // cwebp-mac15 1.2.0, EWWW 6.1.0.
|
1323 |
'488410937dbbc4ec55fddfc0fa6835b862f7024680744a5e5ac8b88be9270fcc', // cwebp-sol 1.2.0, EWWW 6.1.0.
|
1324 |
'2849fd06012a9eb311b02a4f8918ae4b16775693bc21e95f4cc6a382eac299f9', // cwebp.exe 1.2.0, EWWW 6.1.0.
|
1325 |
+
// libwebp 1.2.2 contains no changes to cwebp from 1.2.0 so far.
|
1326 |
// end cwebp.
|
1327 |
'15d8b7d54b73059a9a63ab3d5ca8201cd30c2f6fc59fc068f7bd6c85e6a22420', // svgcleaner-linux 0.9.5.
|
1328 |
'c88c1961374b3edc93a29376ccbd447a514c1cda335fe6a868c0dac6d77c79fa', // svgcleaner-mac 0.9.5.
|