Version Description
- added: Multi-site domain-based installs can activate/register sites en masse, and directly upon site creation
- changed: improved db upgrade routine for updated column
- changed: JS WebP script moved back to page head
- fixed: local PNG placeholders enabled with Easy IO when placeholder folder is not writable
- fixed: WebP Rewriters not detecting upload URL correctly for CDN support
- fixed: iframe lazy loading breaks Gravity Forms and FacetWP when parsing JSON
- fixed: is_amp() called too early
- fixed: SQL error when running "wp-cli ewwwio optimize media" - props @komsitr
- fixed: local savings query sometimes returns no results
- fixed: PHP warnings when local tools are disabled
Download this release
Release Info
Developer | nosilver4u |
Plugin | EWWW Image Optimizer |
Version | 6.2.4 |
Comparing to | |
See all releases |
Code changes from version 6.2.3 to 6.2.4
- aux-optimize.php +1 -1
- changelog.txt +12 -0
- classes/class-eio-base.php +25 -2
- classes/class-eio-js-webp.php +11 -4
- classes/class-eio-lazy-load.php +9 -5
- classes/class-eio-picture-webp.php +6 -3
- classes/class-exactdn.php +20 -10
- common.php +505 -48
- ewww-image-optimizer.php +3 -3
- includes/eio-settings.js +165 -0
- includes/jquery-ui-1.10.1.custom.css +4 -1
- includes/lazysizes-post.js +3 -0
- includes/lazysizes.min.js +1 -1
- includes/resize-detection.js +5 -1
- includes/resize-detection.min.js +1 -1
- readme.txt +19 -72
aux-optimize.php
CHANGED
@@ -970,7 +970,7 @@ function ewww_image_optimizer_get_all_attachments() {
|
|
970 |
function ewww_image_optimizer_get_queued_attachments( $gallery, $limit = 100 ) {
|
971 |
global $wpdb;
|
972 |
// Retrieve the attachment IDs that were pre-loaded in the database.
|
973 |
-
$selected_ids = $wpdb->get_col( $wpdb->prepare( "SELECT attachment_id FROM $wpdb->ewwwio_queue WHERE gallery = %s AND scanned = 1
|
974 |
if ( empty( $selected_ids ) ) {
|
975 |
ewwwio_debug_message( 'no attachments found in queue' );
|
976 |
return array( 0 );
|
970 |
function ewww_image_optimizer_get_queued_attachments( $gallery, $limit = 100 ) {
|
971 |
global $wpdb;
|
972 |
// Retrieve the attachment IDs that were pre-loaded in the database.
|
973 |
+
$selected_ids = $wpdb->get_col( $wpdb->prepare( "SELECT attachment_id FROM $wpdb->ewwwio_queue WHERE gallery = %s AND scanned = 1 ORDER BY attachment_id DESC LIMIT %d", $gallery, $limit ) );
|
974 |
if ( empty( $selected_ids ) ) {
|
975 |
ewwwio_debug_message( 'no attachments found in queue' );
|
976 |
return array( 0 );
|
changelog.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 6.2.3 =
|
2 |
* fixed: db error when MariaDB 10.1 does not permit ALTER for setting default column value
|
3 |
* fixed: Lazy Load missing placeholder folder when Easy IO is enabled
|
1 |
+
= 6.2.4 =
|
2 |
+
* added: Multi-site domain-based installs can activate/register sites en masse, and directly upon site creation
|
3 |
+
* changed: improved db upgrade routine for updated column
|
4 |
+
* changed: JS WebP script moved back to page head
|
5 |
+
* fixed: local PNG placeholders enabled with Easy IO when placeholder folder is not writable
|
6 |
+
* fixed: WebP Rewriters not detecting upload URL correctly for CDN support
|
7 |
+
* fixed: iframe lazy loading breaks Gravity Forms and FacetWP when parsing JSON
|
8 |
+
* fixed: is_amp() called too early
|
9 |
+
* fixed: SQL error when running "wp-cli ewwwio optimize media" - props @komsitr
|
10 |
+
* fixed: local savings query sometimes returns no results
|
11 |
+
* fixed: PHP warnings when local tools are disabled
|
12 |
+
|
13 |
= 6.2.3 =
|
14 |
* fixed: db error when MariaDB 10.1 does not permit ALTER for setting default column value
|
15 |
* fixed: Lazy Load missing placeholder folder when Easy IO is enabled
|
classes/class-eio-base.php
CHANGED
@@ -364,6 +364,25 @@ if ( ! class_exists( 'EIO_Base' ) ) {
|
|
364 |
return false;
|
365 |
}
|
366 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
/**
|
368 |
* Make sure this is really and truly a "front-end request", excluding page builders and such.
|
369 |
*
|
@@ -778,13 +797,13 @@ if ( ! class_exists( 'EIO_Base' ) ) {
|
|
778 |
$this->allowed_domains[] = $this->parse_url( swis()->settings->get_option( 'cdn_domain' ), PHP_URL_HOST );
|
779 |
}
|
780 |
|
|
|
781 |
if ( $this->s3_active ) {
|
782 |
$this->site_url = defined( 'EXACTDN_LOCAL_DOMAIN' ) && EXACTDN_LOCAL_DOMAIN ? EXACTDN_LOCAL_DOMAIN : $s3_scheme . '://' . $s3_domain;
|
783 |
} else {
|
784 |
// Normally, we use this one, as it will be shorter for sub-directory installs.
|
785 |
$home_url = get_home_url();
|
786 |
$site_url = get_site_url();
|
787 |
-
$upload_dir = wp_get_upload_dir();
|
788 |
$home_domain = $this->parse_url( $home_url, PHP_URL_HOST );
|
789 |
$site_domain = $this->parse_url( $site_url, PHP_URL_HOST );
|
790 |
// If the home domain does not match the upload url, and the site domain does match...
|
@@ -794,7 +813,11 @@ if ( ! class_exists( 'EIO_Base' ) ) {
|
|
794 |
}
|
795 |
$this->site_url = defined( 'EXACTDN_LOCAL_DOMAIN' ) && EXACTDN_LOCAL_DOMAIN ? EXACTDN_LOCAL_DOMAIN : $home_url;
|
796 |
}
|
797 |
-
|
|
|
|
|
|
|
|
|
798 |
$this->upload_domain = $this->parse_url( $this->site_url, PHP_URL_HOST );
|
799 |
$this->allowed_domains[] = $this->upload_domain;
|
800 |
// Grab domain aliases that might point to the same place as the upload_domain.
|
364 |
return false;
|
365 |
}
|
366 |
|
367 |
+
/**
|
368 |
+
* Checks to see if the current buffer/output is a JSON-encoded string.
|
369 |
+
*
|
370 |
+
* Specifically, we are looking for JSON objects/strings, not just ANY JSON value.
|
371 |
+
* Thus, the check is rather "loose", only looking for {} or [] at the start/end.
|
372 |
+
*
|
373 |
+
* @param string $buffer The content to check for JSON.
|
374 |
+
* @return bool True for JSON, false for everything else.
|
375 |
+
*/
|
376 |
+
function is_json( $buffer ) {
|
377 |
+
if ( '{' === substr( $buffer, 0, 1 ) && '}' === substr( $buffer, -1 ) ) {
|
378 |
+
return true;
|
379 |
+
}
|
380 |
+
if ( '[' === substr( $buffer, 0, 1 ) && ']' === substr( $buffer, -1 ) ) {
|
381 |
+
return true;
|
382 |
+
}
|
383 |
+
return false;
|
384 |
+
}
|
385 |
+
|
386 |
/**
|
387 |
* Make sure this is really and truly a "front-end request", excluding page builders and such.
|
388 |
*
|
797 |
$this->allowed_domains[] = $this->parse_url( swis()->settings->get_option( 'cdn_domain' ), PHP_URL_HOST );
|
798 |
}
|
799 |
|
800 |
+
$upload_dir = wp_get_upload_dir();
|
801 |
if ( $this->s3_active ) {
|
802 |
$this->site_url = defined( 'EXACTDN_LOCAL_DOMAIN' ) && EXACTDN_LOCAL_DOMAIN ? EXACTDN_LOCAL_DOMAIN : $s3_scheme . '://' . $s3_domain;
|
803 |
} else {
|
804 |
// Normally, we use this one, as it will be shorter for sub-directory installs.
|
805 |
$home_url = get_home_url();
|
806 |
$site_url = get_site_url();
|
|
|
807 |
$home_domain = $this->parse_url( $home_url, PHP_URL_HOST );
|
808 |
$site_domain = $this->parse_url( $site_url, PHP_URL_HOST );
|
809 |
// If the home domain does not match the upload url, and the site domain does match...
|
813 |
}
|
814 |
$this->site_url = defined( 'EXACTDN_LOCAL_DOMAIN' ) && EXACTDN_LOCAL_DOMAIN ? EXACTDN_LOCAL_DOMAIN : $home_url;
|
815 |
}
|
816 |
+
// This is used by the WebP parsers, and by the Lazy Load via get_image_dimensions_by_url().
|
817 |
+
$this->upload_url = trailingslashit( ! empty( $upload_dir['baseurl'] ) ? $upload_dir['baseurl'] : content_url( 'uploads' ) );
|
818 |
+
$this->debug_message( "upload_url: $this->upload_url" );
|
819 |
+
|
820 |
+
// But this is used by Easy IO, so it should be derived from the above logic instead, which already matches the site/home URLs against the upload URL.
|
821 |
$this->upload_domain = $this->parse_url( $this->site_url, PHP_URL_HOST );
|
822 |
$this->allowed_domains[] = $this->upload_domain;
|
823 |
// Grab domain aliases that might point to the same place as the upload_domain.
|
classes/class-eio-js-webp.php
CHANGED
@@ -114,7 +114,11 @@ class EIO_JS_Webp extends EIO_Page_Parser {
|
|
114 |
add_action( 'wp_enqueue_scripts', array( $this, 'min_external_script' ), -99 );
|
115 |
} else {
|
116 |
add_action( 'wp_head', array( $this, 'inline_check_script' ), -99 );
|
117 |
-
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
$this->validate_user_exclusions();
|
120 |
}
|
@@ -141,9 +145,6 @@ class EIO_JS_Webp extends EIO_Page_Parser {
|
|
141 |
$this->debug_message( 'is_admin' );
|
142 |
return false;
|
143 |
}
|
144 |
-
if ( $this->is_amp() ) {
|
145 |
-
return false;
|
146 |
-
}
|
147 |
if ( ewww_image_optimizer_ce_webp_enabled() ) {
|
148 |
return false;
|
149 |
}
|
@@ -190,6 +191,9 @@ class EIO_JS_Webp extends EIO_Page_Parser {
|
|
190 |
if ( ! isset( $wp_query ) ) {
|
191 |
return $should_process;
|
192 |
}
|
|
|
|
|
|
|
193 |
if ( is_embed() ) {
|
194 |
$this->debug_message( 'is_embed' );
|
195 |
return false;
|
@@ -343,6 +347,9 @@ class EIO_JS_Webp extends EIO_Page_Parser {
|
|
343 |
$this->debug_message( 'JS WebP disabled' );
|
344 |
return $buffer;
|
345 |
}
|
|
|
|
|
|
|
346 |
if ( ! $this->should_process_page() ) {
|
347 |
$this->debug_message( 'JS WebP should not process page' );
|
348 |
return $buffer;
|
114 |
add_action( 'wp_enqueue_scripts', array( $this, 'min_external_script' ), -99 );
|
115 |
} else {
|
116 |
add_action( 'wp_head', array( $this, 'inline_check_script' ), -99 );
|
117 |
+
if ( defined( 'EWWW_IMAGE_OPTIMIZER_WEBP_FOOTER_SCRIPT' ) && EWWW_IMAGE_OPTIMIZER_WEBP_FOOTER_SCRIPT ) {
|
118 |
+
add_action( 'wp_footer', array( $this, 'inline_load_script' ), -99 );
|
119 |
+
} else {
|
120 |
+
add_action( 'wp_head', array( $this, 'inline_load_script' ), -90 );
|
121 |
+
}
|
122 |
}
|
123 |
$this->validate_user_exclusions();
|
124 |
}
|
145 |
$this->debug_message( 'is_admin' );
|
146 |
return false;
|
147 |
}
|
|
|
|
|
|
|
148 |
if ( ewww_image_optimizer_ce_webp_enabled() ) {
|
149 |
return false;
|
150 |
}
|
191 |
if ( ! isset( $wp_query ) ) {
|
192 |
return $should_process;
|
193 |
}
|
194 |
+
if ( $this->is_amp() ) {
|
195 |
+
return false;
|
196 |
+
}
|
197 |
if ( is_embed() ) {
|
198 |
$this->debug_message( 'is_embed' );
|
199 |
return false;
|
347 |
$this->debug_message( 'JS WebP disabled' );
|
348 |
return $buffer;
|
349 |
}
|
350 |
+
if ( $this->is_json( $buffer ) ) {
|
351 |
+
return $buffer;
|
352 |
+
}
|
353 |
if ( ! $this->should_process_page() ) {
|
354 |
$this->debug_message( 'JS WebP should not process page' );
|
355 |
return $buffer;
|
classes/class-eio-lazy-load.php
CHANGED
@@ -183,9 +183,6 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
183 |
$this->debug_message( 'is_admin' );
|
184 |
return false;
|
185 |
}
|
186 |
-
if ( $this->is_amp() ) {
|
187 |
-
return false;
|
188 |
-
}
|
189 |
if ( empty( $uri ) ) {
|
190 |
$uri = add_query_arg( null, null );
|
191 |
}
|
@@ -229,6 +226,9 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
229 |
if ( ! isset( $wp_query ) ) {
|
230 |
return $should_process;
|
231 |
}
|
|
|
|
|
|
|
232 |
if ( is_embed() ) {
|
233 |
$this->debug_message( 'is_embed' );
|
234 |
return false;
|
@@ -288,6 +288,9 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
288 |
$this->debug_message( 'AMP page processing' );
|
289 |
return $buffer;
|
290 |
}
|
|
|
|
|
|
|
291 |
if ( ! $this->should_process_page() ) {
|
292 |
return $buffer;
|
293 |
}
|
@@ -399,7 +402,7 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
399 |
foreach ( $frames as $index => $frame ) {
|
400 |
$this->debug_message( 'parsing an iframe element' );
|
401 |
$url = $this->get_attribute( $frame, 'src' );
|
402 |
-
if ( $url && $this->validate_iframe_tag( $frame ) ) {
|
403 |
$this->debug_message( "lazifying iframe for: $url" );
|
404 |
$this->set_attribute( $frame, 'data-src', $url );
|
405 |
$this->remove_attribute( $frame, 'src' );
|
@@ -540,7 +543,7 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
540 |
$filename_height = $height_attr;
|
541 |
}
|
542 |
|
543 |
-
if ( $filename_width && $filename_height ) {
|
544 |
$placeholder_src = $this->create_piip( $filename_width, $filename_height );
|
545 |
/* $placeholder_src = $exactdn->generate_url( $this->content_url . 'lazy/placeholder-' . $filename_width . 'x' . $filename_height . '.png' ); */
|
546 |
$use_native_lazy = true;
|
@@ -886,6 +889,7 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
|
|
886 |
'data-no-lazy=',
|
887 |
'lazyload',
|
888 |
'skip-lazy',
|
|
|
889 |
),
|
890 |
$this->user_exclusions
|
891 |
),
|
183 |
$this->debug_message( 'is_admin' );
|
184 |
return false;
|
185 |
}
|
|
|
|
|
|
|
186 |
if ( empty( $uri ) ) {
|
187 |
$uri = add_query_arg( null, null );
|
188 |
}
|
226 |
if ( ! isset( $wp_query ) ) {
|
227 |
return $should_process;
|
228 |
}
|
229 |
+
if ( $this->is_amp() ) {
|
230 |
+
return false;
|
231 |
+
}
|
232 |
if ( is_embed() ) {
|
233 |
$this->debug_message( 'is_embed' );
|
234 |
return false;
|
288 |
$this->debug_message( 'AMP page processing' );
|
289 |
return $buffer;
|
290 |
}
|
291 |
+
if ( $this->is_json( $buffer ) ) {
|
292 |
+
return $buffer;
|
293 |
+
}
|
294 |
if ( ! $this->should_process_page() ) {
|
295 |
return $buffer;
|
296 |
}
|
402 |
foreach ( $frames as $index => $frame ) {
|
403 |
$this->debug_message( 'parsing an iframe element' );
|
404 |
$url = $this->get_attribute( $frame, 'src' );
|
405 |
+
if ( $url && 0 === strpos( $url, 'http' ) && $this->validate_iframe_tag( $frame ) ) {
|
406 |
$this->debug_message( "lazifying iframe for: $url" );
|
407 |
$this->set_attribute( $frame, 'data-src', $url );
|
408 |
$this->remove_attribute( $frame, 'src' );
|
543 |
$filename_height = $height_attr;
|
544 |
}
|
545 |
|
546 |
+
if ( $filename_width && $filename_height && $this->allow_piip ) {
|
547 |
$placeholder_src = $this->create_piip( $filename_width, $filename_height );
|
548 |
/* $placeholder_src = $exactdn->generate_url( $this->content_url . 'lazy/placeholder-' . $filename_width . 'x' . $filename_height . '.png' ); */
|
549 |
$use_native_lazy = true;
|
889 |
'data-no-lazy=',
|
890 |
'lazyload',
|
891 |
'skip-lazy',
|
892 |
+
'about:blank',
|
893 |
),
|
894 |
$this->user_exclusions
|
895 |
),
|
classes/class-eio-picture-webp.php
CHANGED
@@ -105,9 +105,6 @@ class EIO_Picture_Webp extends EIO_Page_Parser {
|
|
105 |
$this->debug_message( 'is_admin' );
|
106 |
return false;
|
107 |
}
|
108 |
-
if ( $this->is_amp() ) {
|
109 |
-
return false;
|
110 |
-
}
|
111 |
if ( ewww_image_optimizer_ce_webp_enabled() ) {
|
112 |
return false;
|
113 |
}
|
@@ -154,6 +151,9 @@ class EIO_Picture_Webp extends EIO_Page_Parser {
|
|
154 |
if ( ! isset( $wp_query ) ) {
|
155 |
return $should_process;
|
156 |
}
|
|
|
|
|
|
|
157 |
if ( is_embed() ) {
|
158 |
$this->debug_message( 'is_embed' );
|
159 |
return false;
|
@@ -244,6 +244,9 @@ class EIO_Picture_Webp extends EIO_Page_Parser {
|
|
244 |
$this->debug_message( 'picture WebP disabled' );
|
245 |
return $buffer;
|
246 |
}
|
|
|
|
|
|
|
247 |
if ( ! $this->should_process_page() ) {
|
248 |
$this->debug_message( 'picture WebP should not process page' );
|
249 |
return $buffer;
|
105 |
$this->debug_message( 'is_admin' );
|
106 |
return false;
|
107 |
}
|
|
|
|
|
|
|
108 |
if ( ewww_image_optimizer_ce_webp_enabled() ) {
|
109 |
return false;
|
110 |
}
|
151 |
if ( ! isset( $wp_query ) ) {
|
152 |
return $should_process;
|
153 |
}
|
154 |
+
if ( $this->is_amp() ) {
|
155 |
+
return false;
|
156 |
+
}
|
157 |
if ( is_embed() ) {
|
158 |
$this->debug_message( 'is_embed' );
|
159 |
return false;
|
244 |
$this->debug_message( 'picture WebP disabled' );
|
245 |
return $buffer;
|
246 |
}
|
247 |
+
if ( $this->is_json( $buffer ) ) {
|
248 |
+
return $buffer;
|
249 |
+
}
|
250 |
if ( ! $this->should_process_page() ) {
|
251 |
$this->debug_message( 'picture WebP should not process page' );
|
252 |
return $buffer;
|
classes/class-exactdn.php
CHANGED
@@ -248,8 +248,8 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
248 |
$this->debug_message( "could not break down URL: $this->site_url" );
|
249 |
return;
|
250 |
}
|
251 |
-
if ( ! $this->
|
252 |
-
$this->
|
253 |
}
|
254 |
$this->debug_message( "allowing images from here: $this->upload_domain" );
|
255 |
if (
|
@@ -264,8 +264,8 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
264 |
$this->debug_message( "removing this from urls: $this->remove_path" );
|
265 |
}
|
266 |
if (
|
267 |
-
$this->
|
268 |
-
! $this->allow_image_domain( $this->
|
269 |
is_admin()
|
270 |
) {
|
271 |
add_action( 'admin_notices', $this->prefix . 'notice_exactdn_domain_mismatch' );
|
@@ -283,7 +283,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
283 |
function setup() {
|
284 |
$this->debug_message( '<b>' . __METHOD__ . '()</b>' );
|
285 |
// If we don't have a domain yet, go grab one.
|
286 |
-
$this->plan_id = $this->get_exactdn_option( 'plan_id' );
|
287 |
$new_site = false;
|
288 |
if ( ! $this->get_exactdn_domain() ) {
|
289 |
$this->debug_message( 'attempting to activate exactDN' );
|
@@ -481,7 +481,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
481 |
if ( $ssl ) {
|
482 |
$api_url = set_url_scheme( $api_url, 'https' );
|
483 |
}
|
484 |
-
if ( ! defined( 'EXACTDN_LOCAL_DOMAIN' ) && $this->get_exactdn_option( 'verify_method' ) > 0 ) {
|
485 |
// Test with an image file that should be available on the ExactDN zone.
|
486 |
$test_url = plugins_url( '/images/test.png', constant( strtoupper( $this->prefix ) . 'PLUGIN_FILE' ) );
|
487 |
$local_domain = $this->parse_url( $test_url, PHP_URL_HOST );
|
@@ -678,14 +678,14 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
678 |
*/
|
679 |
function get_exactdn_option( $option_name ) {
|
680 |
if ( defined( 'EXACTDN_DOMAIN' ) && EXACTDN_DOMAIN ) {
|
681 |
-
return
|
682 |
}
|
683 |
if ( is_multisite() ) {
|
684 |
if ( ! SUBDOMAIN_INSTALL ) {
|
685 |
-
return
|
686 |
}
|
687 |
}
|
688 |
-
return
|
689 |
}
|
690 |
|
691 |
/**
|
@@ -878,6 +878,10 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
878 |
* @return string The content with ExactDN image urls.
|
879 |
*/
|
880 |
function filter_the_content( $content ) {
|
|
|
|
|
|
|
|
|
881 |
$started = microtime( true );
|
882 |
$this->debug_message( '<b>' . __METHOD__ . '()</b>' );
|
883 |
$images = $this->get_images_from_html( $content, true );
|
@@ -1893,7 +1897,13 @@ if ( ! class_exists( 'ExactDN' ) ) {
|
|
1893 |
}
|
1894 |
|
1895 |
if ( function_exists( 'aq_resize' ) ) {
|
1896 |
-
$this->debug_message( 'aq_resize detected, image_downsize filter
|
|
|
|
|
|
|
|
|
|
|
|
|
1897 |
return $image;
|
1898 |
}
|
1899 |
|
248 |
$this->debug_message( "could not break down URL: $this->site_url" );
|
249 |
return;
|
250 |
}
|
251 |
+
if ( ! $this->get_exactdn_option( 'local_domain' ) ) {
|
252 |
+
$this->set_exactdn_option( 'local_domain', $this->upload_domain );
|
253 |
}
|
254 |
$this->debug_message( "allowing images from here: $this->upload_domain" );
|
255 |
if (
|
264 |
$this->debug_message( "removing this from urls: $this->remove_path" );
|
265 |
}
|
266 |
if (
|
267 |
+
$this->get_exactdn_option( 'local_domain' ) !== $this->upload_domain &&
|
268 |
+
! $this->allow_image_domain( $this->get_exactdn_option( 'local_domain' ) ) &&
|
269 |
is_admin()
|
270 |
) {
|
271 |
add_action( 'admin_notices', $this->prefix . 'notice_exactdn_domain_mismatch' );
|
283 |
function setup() {
|
284 |
$this->debug_message( '<b>' . __METHOD__ . '()</b>' );
|
285 |
// If we don't have a domain yet, go grab one.
|
286 |
+
$this->plan_id = (int) $this->get_exactdn_option( 'plan_id' );
|
287 |
$new_site = false;
|
288 |
if ( ! $this->get_exactdn_domain() ) {
|
289 |
$this->debug_message( 'attempting to activate exactDN' );
|
481 |
if ( $ssl ) {
|
482 |
$api_url = set_url_scheme( $api_url, 'https' );
|
483 |
}
|
484 |
+
if ( ! defined( 'EXACTDN_LOCAL_DOMAIN' ) && (int) $this->get_exactdn_option( 'verify_method' ) > 0 ) {
|
485 |
// Test with an image file that should be available on the ExactDN zone.
|
486 |
$test_url = plugins_url( '/images/test.png', constant( strtoupper( $this->prefix ) . 'PLUGIN_FILE' ) );
|
487 |
$local_domain = $this->parse_url( $test_url, PHP_URL_HOST );
|
678 |
*/
|
679 |
function get_exactdn_option( $option_name ) {
|
680 |
if ( defined( 'EXACTDN_DOMAIN' ) && EXACTDN_DOMAIN ) {
|
681 |
+
return get_option( $this->prefix . 'exactdn_' . $option_name );
|
682 |
}
|
683 |
if ( is_multisite() ) {
|
684 |
if ( ! SUBDOMAIN_INSTALL ) {
|
685 |
+
return get_site_option( $this->prefix . 'exactdn_' . $option_name );
|
686 |
}
|
687 |
}
|
688 |
+
return get_option( $this->prefix . 'exactdn_' . $option_name );
|
689 |
}
|
690 |
|
691 |
/**
|
878 |
* @return string The content with ExactDN image urls.
|
879 |
*/
|
880 |
function filter_the_content( $content ) {
|
881 |
+
if ( $this->is_json( $content ) ) {
|
882 |
+
return $content;
|
883 |
+
}
|
884 |
+
|
885 |
$started = microtime( true );
|
886 |
$this->debug_message( '<b>' . __METHOD__ . '()</b>' );
|
887 |
$images = $this->get_images_from_html( $content, true );
|
1897 |
}
|
1898 |
|
1899 |
if ( function_exists( 'aq_resize' ) ) {
|
1900 |
+
$this->debug_message( 'aq_resize detected, image_downsize filter bypassed' );
|
1901 |
+
return $image;
|
1902 |
+
}
|
1903 |
+
|
1904 |
+
// BFI Thumb integration, usually Elementor, possibly others.
|
1905 |
+
if ( is_array( $size ) && ! empty( $size['bfi_thumb'] ) ) {
|
1906 |
+
$this->debug_message( 'bfi_thumb detected, image_downsize filter bypassed' );
|
1907 |
return $image;
|
1908 |
}
|
1909 |
|
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 = '';
|
@@ -158,10 +158,16 @@ add_action( 'ewww_image_optimizer_auto', 'ewww_image_optimizer_auto' );
|
|
158 |
add_action( 'mfrh_path_renamed', 'ewww_image_optimizer_path_renamed', 10, 3 );
|
159 |
// Correct any records in the table created during retina generation.
|
160 |
add_action( 'wr2x_retina_file_added', 'ewww_image_optimizer_retina', 20, 2 );
|
|
|
|
|
161 |
// AJAX action hook to verify an API key.
|
162 |
add_action( 'wp_ajax_ewww_cloud_key_verify', 'ewww_image_optimizer_cloud_key_verify_ajax' );
|
163 |
// AJAX action hook to activate Easy IO.
|
164 |
add_action( 'wp_ajax_ewww_exactdn_activate', 'ewww_image_optimizer_exactdn_activate_ajax' );
|
|
|
|
|
|
|
|
|
165 |
// AJAX action hook for inserting WebP rewrite rules into .htaccess.
|
166 |
add_action( 'wp_ajax_ewww_webp_rewrite', 'ewww_image_optimizer_webp_rewrite' );
|
167 |
// AJAX action hook for removing WebP rewrite rules from .htaccess.
|
@@ -190,6 +196,8 @@ add_action( 'admin_bar_init', 'ewww_image_optimizer_admin_bar_init' );
|
|
190 |
add_action( 'admin_action_ewww_image_optimizer_remove_cloud_key', 'ewww_image_optimizer_remove_cloud_key' );
|
191 |
// Non-AJAX handler to disable Easy IO and reroute back to the settings page.
|
192 |
add_action( 'admin_action_ewww_image_optimizer_remove_easyio', 'ewww_image_optimizer_remove_easyio' );
|
|
|
|
|
193 |
// Non-AJAX handler to enable Force WebP for GIF files.
|
194 |
add_action( 'admin_action_ewww_image_optimizer_enable_force_gif2webp', 'ewww_image_optimizer_enable_force_gif2webp' );
|
195 |
// Non-AJAX handler to retest async/background mode.
|
@@ -198,6 +206,8 @@ add_action( 'admin_action_ewww_image_optimizer_retest_background_optimization',
|
|
198 |
add_action( 'admin_action_ewww_image_optimizer_view_debug_log', 'ewww_image_optimizer_view_debug_log' );
|
199 |
// Non-AJAX handler to delete the debug log, and reroute back to the settings page.
|
200 |
add_action( 'admin_action_ewww_image_optimizer_delete_debug_log', 'ewww_image_optimizer_delete_debug_log' );
|
|
|
|
|
201 |
// Check if WebP option was turned off and is now enabled.
|
202 |
add_filter( 'pre_update_option_ewww_image_optimizer_webp', 'ewww_image_optimizer_webp_maybe_enabled', 10, 2 );
|
203 |
// Check Scheduled Opt option has just been disabled and clear the queues/stop the process.
|
@@ -726,6 +736,7 @@ function ewww_image_optimizer_save_network_settings() {
|
|
726 |
$ewww_image_optimizer_allow_tracking = empty( $_POST['ewww_image_optimizer_allow_tracking'] ) ? false : $ewwwio_tracking->check_for_settings_optin( (bool) $_POST['ewww_image_optimizer_allow_tracking'] );
|
727 |
update_site_option( 'ewww_image_optimizer_allow_tracking', $ewww_image_optimizer_allow_tracking );
|
728 |
add_action( 'network_admin_notices', 'ewww_image_optimizer_network_settings_saved' );
|
|
|
729 |
if ( ! empty( $_POST['ewww_image_optimizer_exactdn'] ) && ! class_exists( 'ExactDN' ) ) {
|
730 |
/**
|
731 |
* Page Parsing class for working with HTML content.
|
@@ -998,6 +1009,22 @@ function ewww_image_optimizer_retest_background_optimization() {
|
|
998 |
exit;
|
999 |
}
|
1000 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1001 |
/**
|
1002 |
* Plugin initialization for admin area.
|
1003 |
*
|
@@ -1085,6 +1112,12 @@ function ewww_image_optimizer_admin_init() {
|
|
1085 |
ewww_image_optimizer_cron_setup( 'ewww_image_optimizer_auto' );
|
1086 |
// Queue the function that contains custom styling for our progressbars.
|
1087 |
add_action( 'admin_enqueue_scripts', 'ewww_image_optimizer_progressbar_style' );
|
|
|
|
|
|
|
|
|
|
|
|
|
1088 |
if ( defined( 'EWWW_IMAGE_OPTIMIZER_CLOUD_KEY' ) && get_option( 'ewww_image_optimizer_cloud_key_invalid' ) ) {
|
1089 |
add_action( 'network_admin_notices', 'ewww_image_optimizer_notice_invalid_key' );
|
1090 |
add_action( 'admin_notices', 'ewww_image_optimizer_notice_invalid_key' );
|
@@ -1134,6 +1167,10 @@ function ewww_image_optimizer_admin_init() {
|
|
1134 |
add_action( 'network_admin_notices', 'ewww_image_optimizer_notice_reoptimization' );
|
1135 |
add_action( 'admin_notices', 'ewww_image_optimizer_notice_reoptimization' );
|
1136 |
}
|
|
|
|
|
|
|
|
|
1137 |
if (
|
1138 |
is_super_admin() &&
|
1139 |
ewww_image_optimizer_get_option( 'ewww_image_optimizer_review_time' ) &&
|
@@ -1642,14 +1679,31 @@ function ewww_image_optimizer_install_table() {
|
|
1642 |
}
|
1643 |
// Make sure there are valid dates in updated column.
|
1644 |
$wpdb->query( "UPDATE $wpdb->ewwwio_images SET updated = '1971-01-01 00:00:00' WHERE updated < '1001-01-01 00:00:01'" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1645 |
if (
|
1646 |
-
false !== strpos( $mysql_version, '5.7.' ) ||
|
1647 |
-
|
1648 |
) {
|
1649 |
-
if (
|
|
|
1650 |
$wpdb->query( "ALTER TABLE $wpdb->ewwwio_images MODIFY updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" );
|
|
|
|
|
|
|
1651 |
}
|
1652 |
-
}
|
1653 |
$wpdb->query( "ALTER TABLE $wpdb->ewwwio_images ALTER updated SET DEFAULT CURRENT_TIMESTAMP" );
|
1654 |
}
|
1655 |
// Check the current collation and adjust it if necessary.
|
@@ -2052,6 +2106,25 @@ function ewww_image_optimizer_notice_exactdn_activation_success() {
|
|
2052 |
<?php
|
2053 |
}
|
2054 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2055 |
/**
|
2056 |
* Let the user know the local domain appears to have changed from what Easy IO has recorded in the db.
|
2057 |
*/
|
@@ -2067,7 +2140,7 @@ function ewww_image_optimizer_notice_exactdn_domain_mismatch() {
|
|
2067 |
printf(
|
2068 |
/* translators: 1: old domain name, 2: current domain name */
|
2069 |
esc_html__( 'Easy IO detected that the Site URL has changed since the initial activation (previously %1$s, currently %2$s).', 'ewww-image-optimizer' ),
|
2070 |
-
'<strong>' . esc_html(
|
2071 |
'<strong>' . esc_html( $exactdn->upload_domain ) . '</strong>'
|
2072 |
);
|
2073 |
?>
|
@@ -2212,6 +2285,18 @@ function ewww_image_optimizer_notice_media_listmode() {
|
|
2212 |
}
|
2213 |
}
|
2214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2215 |
/**
|
2216 |
* Ask the user to leave a review for the plugin on wp.org.
|
2217 |
*/
|
@@ -3795,11 +3880,13 @@ function ewwwio_is_file( $file ) {
|
|
3795 |
$upload_dir = $content_dir;
|
3796 |
}
|
3797 |
$plugin_dir = realpath( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH );
|
3798 |
-
$tool_dir = $content_dir;
|
3799 |
if ( defined( 'EWWW_IMAGE_OPTIMIZER_TOOL_PATH' ) ) {
|
3800 |
$tool_dir = realpath( EWWW_IMAGE_OPTIMIZER_TOOL_PATH );
|
3801 |
$tool_dir = dirname( $tool_dir );
|
3802 |
}
|
|
|
|
|
|
|
3803 |
if (
|
3804 |
false === strpos( $file, $upload_dir ) &&
|
3805 |
false === strpos( $file, $content_dir ) &&
|
@@ -4615,7 +4702,11 @@ function ewww_image_optimizer_exactdn_activate_ajax() {
|
|
4615 |
if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
|
4616 |
die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
|
4617 |
}
|
4618 |
-
|
|
|
|
|
|
|
|
|
4619 |
if ( ! class_exists( 'ExactDN' ) ) {
|
4620 |
/**
|
4621 |
* Page Parsing class for working with HTML content.
|
@@ -4652,6 +4743,193 @@ function ewww_image_optimizer_exactdn_activate_ajax() {
|
|
4652 |
);
|
4653 |
}
|
4654 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4655 |
/**
|
4656 |
* Sanitizes an API key for the cloud service.
|
4657 |
*
|
@@ -10098,6 +10376,9 @@ function ewww_image_optimizer_get_option( $option_name, $default = false, $singl
|
|
10098 |
}
|
10099 |
if ( ! $single && is_multisite() && is_plugin_active_for_network( EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL ) && ! get_site_option( 'ewww_image_optimizer_allow_multisite_override' ) ) {
|
10100 |
$option_value = get_site_option( $option_name );
|
|
|
|
|
|
|
10101 |
} else {
|
10102 |
$option_value = get_option( $option_name );
|
10103 |
}
|
@@ -10180,6 +10461,15 @@ function ewww_image_optimizer_settings_script( $hook ) {
|
|
10180 |
remove_action( 'admin_notices', 'ewww_image_optimizer_notice_exactdn_domain_mismatch' );
|
10181 |
$exactdn->setup();
|
10182 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10183 |
add_thickbox();
|
10184 |
wp_enqueue_script( 'ewww-beacon-script', plugins_url( '/includes/eio-beacon.js', __FILE__ ), array( 'jquery' ), EWWW_IMAGE_OPTIMIZER_VERSION );
|
10185 |
wp_enqueue_script( 'ewww-settings-script', plugins_url( '/includes/eio-settings.js', __FILE__ ), array( 'jquery' ), EWWW_IMAGE_OPTIMIZER_VERSION, true );
|
@@ -10190,10 +10480,16 @@ function ewww_image_optimizer_settings_script( $hook ) {
|
|
10190 |
'ewww-settings-script',
|
10191 |
'ewww_vars',
|
10192 |
array(
|
10193 |
-
'_wpnonce'
|
10194 |
-
'invalid_response'
|
10195 |
-
'loading_image_url'
|
10196 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
10197 |
)
|
10198 |
);
|
10199 |
wp_add_inline_script(
|
@@ -10208,21 +10504,20 @@ function ewww_image_optimizer_settings_script( $hook ) {
|
|
10208 |
/**
|
10209 |
* Get a total of how much space we have saved so far.
|
10210 |
*
|
10211 |
-
* @param bool $network_admin True if this is called from the network admin dashboard, false otherwise.
|
10212 |
* @global object $wpdb
|
10213 |
*
|
10214 |
* @return int The total savings found, in bytes.
|
10215 |
*/
|
10216 |
-
function ewww_image_optimizer_savings(
|
10217 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
10218 |
global $wpdb;
|
10219 |
$total_orig = 0;
|
10220 |
$total_opt = 0;
|
10221 |
$total_savings = 0;
|
10222 |
$started = microtime( true );
|
10223 |
-
if ( is_multisite() &&
|
10224 |
$cache_savings = get_site_transient( 'ewww_image_optimizer_savings' );
|
10225 |
-
if ( ! empty( $cache_savings ) && is_array( $cache_savings ) && 2 === count( $cache_savings ) ) {
|
10226 |
ewwwio_debug_message( 'savings query avoided via (multi-site) cache' );
|
10227 |
return $cache_savings;
|
10228 |
}
|
@@ -10250,8 +10545,9 @@ function ewww_image_optimizer_savings( $network_admin = false ) {
|
|
10250 |
}
|
10251 |
switch_to_blog( $blog_id );
|
10252 |
ewwwio_debug_message( "getting savings for site: $blog_id" );
|
10253 |
-
$table_name
|
10254 |
-
|
|
|
10255 |
if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) !== $table_name ) {
|
10256 |
ewww_image_optimizer_install_table();
|
10257 |
}
|
@@ -10266,6 +10562,7 @@ function ewww_image_optimizer_savings( $network_admin = false ) {
|
|
10266 |
}
|
10267 |
restore_current_blog();
|
10268 |
}
|
|
|
10269 |
}
|
10270 |
set_site_transient( 'ewww_image_optimizer_savings', array( $total_opt, $total_orig ), DAY_IN_SECONDS );
|
10271 |
} else {
|
@@ -11462,7 +11759,7 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
11462 |
global $eio_alt_webp;
|
11463 |
$total_savings = 0;
|
11464 |
if ( 'network-multisite' === $network ) {
|
11465 |
-
$total_sizes = ewww_image_optimizer_savings(
|
11466 |
$total_savings = $total_sizes[1] - $total_sizes[0];
|
11467 |
} else {
|
11468 |
$total_sizes = ewww_image_optimizer_savings();
|
@@ -11574,7 +11871,11 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
11574 |
$speed_score += 20;
|
11575 |
}
|
11576 |
$exactdn_enabled = true;
|
11577 |
-
|
|
|
|
|
|
|
|
|
11578 |
}
|
11579 |
} elseif ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) {
|
11580 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) {
|
@@ -11595,6 +11896,10 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
11595 |
delete_site_option( 'ewww_image_optimizer_exactdn_validation' );
|
11596 |
delete_site_option( 'ewww_image_optimizer_exactdn_suspended' );
|
11597 |
}
|
|
|
|
|
|
|
|
|
11598 |
$easymode = false;
|
11599 |
if (
|
11600 |
! ewww_image_optimizer_get_option( 'ewww_image_optimizer_local_mode' )
|
@@ -12035,7 +12340,7 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
12035 |
<li class='ewww-tab ewww-support-nav'><span><?php esc_html_e( 'Support', 'ewww-image-optimizer' ); ?></span></li>
|
12036 |
<li class='ewww-tab ewww-contribute-nav'><span><?php esc_html_e( 'Contribute', 'ewww-image-optimizer' ); ?></span></li>
|
12037 |
</ul>
|
12038 |
-
<?php elseif ( $easymode ) : ?>
|
12039 |
<ul class='ewww-tab-nav'>
|
12040 |
<li class='ewww-tab ewww-general-nav'><span><?php esc_html_e( 'Basic', 'ewww-image-optimizer' ); ?></span></li>
|
12041 |
<li class='ewww-tab ewww-support-nav'><span><?php esc_html_e( 'Support', 'ewww-image-optimizer' ); ?></span></li>
|
@@ -12170,14 +12475,20 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
12170 |
<span id='ewwwio-api-activation-processing'><img src='<?php echo esc_url( $loading_image_url ); ?>' alt='loading'/></span>
|
12171 |
<p class='description'>
|
12172 |
<?php esc_html_e( 'Premium compression for your local images.', 'ewww-image-optimizer' ); ?>
|
12173 |
-
|
12174 |
-
|
12175 |
-
|
|
|
|
|
|
|
|
|
|
|
12176 |
</p>
|
12177 |
</td>
|
12178 |
</tr>
|
12179 |
<?php endif; ?>
|
12180 |
<?php if ( ! get_option( 'easyio_exactdn' ) ) : ?>
|
|
|
12181 |
<tr id="ewww_image_optimizer_exactdn_container" class="ewwwio-premium-setup" <?php echo wp_kses_post( $premium_hide ); ?>>
|
12182 |
<th scope='row'>
|
12183 |
<span id='ewwwio-exactdn-anchor'></span>
|
@@ -12186,19 +12497,66 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
12186 |
</th>
|
12187 |
<td>
|
12188 |
<div id='ewwwio-easy-activation-result'></div>
|
12189 |
-
|
12190 |
-
|
12191 |
-
|
12192 |
-
|
12193 |
-
|
12194 |
-
|
12195 |
-
|
|
|
|
|
12196 |
<?php if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) && ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) : ?>
|
12197 |
<p style='color: red'><?php esc_html_e( 'Inactive, please disable the Image Accelerator option on the Jetpack Dashboard.', 'ewww-image-optimizer' ); ?></p>
|
12198 |
<?php elseif ( false !== strpos( $easyio_site_url, 'localhost' ) ) : ?>
|
12199 |
<p class="description" style="font-weight: bolder"><?php esc_html_e( 'Easy IO cannot be activated on localhost installs.', 'ewww-image-optimizer' ); ?></p>
|
12200 |
-
<?php elseif (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12201 |
<p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12202 |
<strong><a href="https://ewww.io/plans/" target="_blank">
|
12203 |
<?php esc_html_e( 'Purchase a subscription for your site.', 'ewww-image-optimizer' ); ?>
|
12204 |
</a></strong><br>
|
@@ -12232,6 +12590,8 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
|
|
12232 |
<?php endif; ?>
|
12233 |
</td>
|
12234 |
</tr>
|
|
|
|
|
12235 |
<?php endif; ?>
|
12236 |
<tr class='ewwwio-exactdn-options' <?php echo $exactdn_enabled ? '' : 'style="display:none;"'; ?>>
|
12237 |
<td> </td>
|
@@ -13074,6 +13434,7 @@ AddType image/webp .webp</pre>
|
|
13074 |
<?php ob_end_clean(); ?>
|
13075 |
<div id='ewww-resize-settings'>
|
13076 |
<table class='form-table'>
|
|
|
13077 |
<?php endif; ?>
|
13078 |
<!-- RIGHT HERE is where we begin/clear buffer for network-singlesite (non-override version). -->
|
13079 |
<!-- Though the buffer will need to be started right the form begins. -->
|
@@ -13258,9 +13619,8 @@ AddType image/webp .webp</pre>
|
|
13258 |
<noscript><h2><?php esc_html_e( 'Support', 'ewww-image-optimizer' ); ?></h2></noscript>
|
13259 |
<p>
|
13260 |
<a class='ewww-docs-root' href='https://docs.ewww.io/'><?php esc_html_e( 'Documentation', 'ewww-image-optimizer' ); ?></a> |
|
13261 |
-
<a class='ewww-docs-root' href='https://ewww.io/contact-us/'><?php esc_html_e( '
|
13262 |
-
<a href='https://feedback.ewww.io/b/features'><?php esc_html_e( 'Submit Feedback', 'ewww-image-optimizer' ); ?></a>
|
13263 |
-
<a href='https://ewww.io/status/'><?php esc_html_e( 'Server Status', 'ewww-image-optimizer' ); ?></a>
|
13264 |
</p>
|
13265 |
<p style='float:right;'>
|
13266 |
<a href='<?php echo esc_url( wp_nonce_url( admin_url( 'options-general.php?page=ewww-image-optimizer-options&uncomplete_wizard=1' ), 'ewww_image_optimizer_options-options' ) ); ?>'>
|
@@ -13420,7 +13780,9 @@ function ewwwio_help_link( $link, $hsid = '' ) {
|
|
13420 |
}
|
13421 |
|
13422 |
/**
|
13423 |
-
* Checks to see if ExactDN or Easy
|
|
|
|
|
13424 |
*/
|
13425 |
function ewww_image_optimizer_easy_active() {
|
13426 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) || get_option( 'easyio_exactdn' ) ) {
|
@@ -13429,12 +13791,48 @@ function ewww_image_optimizer_easy_active() {
|
|
13429 |
return false;
|
13430 |
}
|
13431 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13432 |
/**
|
13433 |
* Removes the API key currently installed.
|
13434 |
*
|
13435 |
* @param boolean|string $redirect Should the plugin do a silent redirect back to the referring page? Default true.
|
13436 |
*/
|
13437 |
function ewww_image_optimizer_remove_cloud_key( $redirect = true ) {
|
|
|
13438 |
$permissions = apply_filters( 'ewww_image_optimizer_admin_permissions', '' );
|
13439 |
if ( 'none' !== $redirect && false === current_user_can( $permissions ) ) {
|
13440 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
@@ -13463,8 +13861,7 @@ function ewww_image_optimizer_remove_cloud_key( $redirect = true ) {
|
|
13463 |
delete_transient( 'ewww_image_optimizer_cloud_status' );
|
13464 |
ewww_image_optimizer_set_option( 'ewww_image_optimizer_backup_files', '' );
|
13465 |
if ( 'none' !== $redirect ) {
|
13466 |
-
|
13467 |
-
wp_safe_redirect( $sendback );
|
13468 |
exit;
|
13469 |
}
|
13470 |
}
|
@@ -13473,11 +13870,12 @@ function ewww_image_optimizer_remove_cloud_key( $redirect = true ) {
|
|
13473 |
* De-activates Easy IO.
|
13474 |
*/
|
13475 |
function ewww_image_optimizer_remove_easyio() {
|
|
|
13476 |
$permissions = apply_filters( 'ewww_image_optimizer_admin_permissions', '' );
|
13477 |
if ( false === current_user_can( $permissions ) ) {
|
13478 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
13479 |
}
|
13480 |
-
|
13481 |
delete_option( 'ewww_image_optimizer_exactdn_domain' );
|
13482 |
delete_option( 'ewww_image_optimizer_exactdn_plan_id' );
|
13483 |
delete_option( 'ewww_image_optimizer_exactdn_failures' );
|
@@ -13485,6 +13883,7 @@ function ewww_image_optimizer_remove_easyio() {
|
|
13485 |
delete_option( 'ewww_image_optimizer_exactdn_verified' );
|
13486 |
delete_option( 'ewww_image_optimizer_exactdn_validation' );
|
13487 |
delete_option( 'ewww_image_optimizer_exactdn_suspended' );
|
|
|
13488 |
delete_site_option( 'ewww_image_optimizer_exactdn_domain' );
|
13489 |
delete_site_option( 'ewww_image_optimizer_exactdn_plan_id' );
|
13490 |
delete_site_option( 'ewww_image_optimizer_exactdn_failures' );
|
@@ -13494,8 +13893,50 @@ function ewww_image_optimizer_remove_easyio() {
|
|
13494 |
delete_site_option( 'ewww_image_optimizer_exactdn_suspended' );
|
13495 |
global $exactdn;
|
13496 |
$exactdn->cron_setup( false );
|
13497 |
-
|
13498 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13499 |
exit;
|
13500 |
}
|
13501 |
|
@@ -13530,13 +13971,29 @@ function ewww_image_optimizer_resize_detection_script() {
|
|
13530 |
} else {
|
13531 |
$resize_detection_script = file_get_contents( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'includes/resize-detection.min.js' );
|
13532 |
}
|
13533 |
-
|
13534 |
-
|
13535 |
-
|
13536 |
-
|
13537 |
-
|
13538 |
-
|
13539 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13540 |
}
|
13541 |
}
|
13542 |
|
14 |
exit;
|
15 |
}
|
16 |
|
17 |
+
define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '624' );
|
18 |
|
19 |
// Initialize a couple globals.
|
20 |
$eio_debug = '';
|
158 |
add_action( 'mfrh_path_renamed', 'ewww_image_optimizer_path_renamed', 10, 3 );
|
159 |
// Correct any records in the table created during retina generation.
|
160 |
add_action( 'wr2x_retina_file_added', 'ewww_image_optimizer_retina', 20, 2 );
|
161 |
+
// Hook onto creation of new sites in multi-site for Easy IO registration.
|
162 |
+
add_action( 'wp_initialize_site', 'ewww_image_optimizer_initialize_site', 101, 1 );
|
163 |
// AJAX action hook to verify an API key.
|
164 |
add_action( 'wp_ajax_ewww_cloud_key_verify', 'ewww_image_optimizer_cloud_key_verify_ajax' );
|
165 |
// AJAX action hook to activate Easy IO.
|
166 |
add_action( 'wp_ajax_ewww_exactdn_activate', 'ewww_image_optimizer_exactdn_activate_ajax' );
|
167 |
+
// AJAX action hook to activate Easy IO on a specific site.
|
168 |
+
add_action( 'wp_ajax_ewww_exactdn_activate_site', 'ewww_image_optimizer_exactdn_activate_site_ajax' );
|
169 |
+
// AJAX action hook to register a specific site with Easy IO.
|
170 |
+
add_action( 'wp_ajax_ewww_exactdn_register_site', 'ewww_image_optimizer_exactdn_register_site_ajax' );
|
171 |
// AJAX action hook for inserting WebP rewrite rules into .htaccess.
|
172 |
add_action( 'wp_ajax_ewww_webp_rewrite', 'ewww_image_optimizer_webp_rewrite' );
|
173 |
// AJAX action hook for removing WebP rewrite rules from .htaccess.
|
196 |
add_action( 'admin_action_ewww_image_optimizer_remove_cloud_key', 'ewww_image_optimizer_remove_cloud_key' );
|
197 |
// Non-AJAX handler to disable Easy IO and reroute back to the settings page.
|
198 |
add_action( 'admin_action_ewww_image_optimizer_remove_easyio', 'ewww_image_optimizer_remove_easyio' );
|
199 |
+
// Non-AJAX handler to disable Easy IO network-wide.
|
200 |
+
add_action( 'admin_action_ewww_image_optimizer_network_remove_easyio', 'ewww_image_optimizer_network_remove_easyio' );
|
201 |
// Non-AJAX handler to enable Force WebP for GIF files.
|
202 |
add_action( 'admin_action_ewww_image_optimizer_enable_force_gif2webp', 'ewww_image_optimizer_enable_force_gif2webp' );
|
203 |
// Non-AJAX handler to retest async/background mode.
|
206 |
add_action( 'admin_action_ewww_image_optimizer_view_debug_log', 'ewww_image_optimizer_view_debug_log' );
|
207 |
// Non-AJAX handler to delete the debug log, and reroute back to the settings page.
|
208 |
add_action( 'admin_action_ewww_image_optimizer_delete_debug_log', 'ewww_image_optimizer_delete_debug_log' );
|
209 |
+
// Non-AJAX handler to apply 6.2 current_timestamp db upgrade.
|
210 |
+
add_action( 'admin_action_ewww_image_optimizer_620_upgrade', 'ewww_image_optimizer_620_upgrade' );
|
211 |
// Check if WebP option was turned off and is now enabled.
|
212 |
add_filter( 'pre_update_option_ewww_image_optimizer_webp', 'ewww_image_optimizer_webp_maybe_enabled', 10, 2 );
|
213 |
// Check Scheduled Opt option has just been disabled and clear the queues/stop the process.
|
736 |
$ewww_image_optimizer_allow_tracking = empty( $_POST['ewww_image_optimizer_allow_tracking'] ) ? false : $ewwwio_tracking->check_for_settings_optin( (bool) $_POST['ewww_image_optimizer_allow_tracking'] );
|
737 |
update_site_option( 'ewww_image_optimizer_allow_tracking', $ewww_image_optimizer_allow_tracking );
|
738 |
add_action( 'network_admin_notices', 'ewww_image_optimizer_network_settings_saved' );
|
739 |
+
// TODO: we probably don't need this bit anymore with the new multi-site activation.
|
740 |
if ( ! empty( $_POST['ewww_image_optimizer_exactdn'] ) && ! class_exists( 'ExactDN' ) ) {
|
741 |
/**
|
742 |
* Page Parsing class for working with HTML content.
|
1009 |
exit;
|
1010 |
}
|
1011 |
|
1012 |
+
/**
|
1013 |
+
* Apply 6.2.0+ current_timestamp db upgrade.
|
1014 |
+
*/
|
1015 |
+
function ewww_image_optimizer_620_upgrade() {
|
1016 |
+
if ( ! current_user_can( apply_filters( 'ewww_image_optimizer_admin_permissions', '' ) ) ) {
|
1017 |
+
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
1018 |
+
}
|
1019 |
+
delete_transient( 'ewww_image_optimizer_620_upgrade_needed' );
|
1020 |
+
global $wpdb;
|
1021 |
+
$suppress = $wpdb->suppress_errors();
|
1022 |
+
$wpdb->query( "ALTER TABLE $wpdb->ewwwio_images MODIFY updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" );
|
1023 |
+
$wpdb->suppress_errors( $suppress );
|
1024 |
+
wp_safe_redirect( wp_get_referer() );
|
1025 |
+
exit;
|
1026 |
+
}
|
1027 |
+
|
1028 |
/**
|
1029 |
* Plugin initialization for admin area.
|
1030 |
*
|
1112 |
ewww_image_optimizer_cron_setup( 'ewww_image_optimizer_auto' );
|
1113 |
// Queue the function that contains custom styling for our progressbars.
|
1114 |
add_action( 'admin_enqueue_scripts', 'ewww_image_optimizer_progressbar_style' );
|
1115 |
+
if ( false !== strpos( add_query_arg( null, null ), 'site-new.php' ) ) {
|
1116 |
+
if ( is_multisite() && is_network_admin() && isset( $_GET['update'] ) && 'added' === $_GET['update'] && ! empty( $_GET['id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
|
1117 |
+
add_action( 'network_admin_notices', 'ewww_image_optimizer_easyio_site_initialized' );
|
1118 |
+
add_action( 'admin_notices', 'ewww_image_optimizer_easyio_site_initialized' );
|
1119 |
+
}
|
1120 |
+
}
|
1121 |
if ( defined( 'EWWW_IMAGE_OPTIMIZER_CLOUD_KEY' ) && get_option( 'ewww_image_optimizer_cloud_key_invalid' ) ) {
|
1122 |
add_action( 'network_admin_notices', 'ewww_image_optimizer_notice_invalid_key' );
|
1123 |
add_action( 'admin_notices', 'ewww_image_optimizer_notice_invalid_key' );
|
1167 |
add_action( 'network_admin_notices', 'ewww_image_optimizer_notice_reoptimization' );
|
1168 |
add_action( 'admin_notices', 'ewww_image_optimizer_notice_reoptimization' );
|
1169 |
}
|
1170 |
+
// Let the admin know a db upgrade is needed.
|
1171 |
+
if ( is_super_admin() && get_transient( 'ewww_image_optimizer_620_upgrade_needed' ) ) {
|
1172 |
+
add_action( 'admin_notices', 'ewww_image_optimizer_620_upgrade_needed' );
|
1173 |
+
}
|
1174 |
if (
|
1175 |
is_super_admin() &&
|
1176 |
ewww_image_optimizer_get_option( 'ewww_image_optimizer_review_time' ) &&
|
1679 |
}
|
1680 |
// Make sure there are valid dates in updated column.
|
1681 |
$wpdb->query( "UPDATE $wpdb->ewwwio_images SET updated = '1971-01-01 00:00:00' WHERE updated < '1001-01-01 00:00:01'" );
|
1682 |
+
// Get the current table layout.
|
1683 |
+
$suppress = $wpdb->suppress_errors();
|
1684 |
+
$tablefields = $wpdb->get_results( "DESCRIBE {$wpdb->ewwwio_images};" );
|
1685 |
+
$wpdb->suppress_errors( $suppress );
|
1686 |
+
$timestamp_upgrade_needed = false;
|
1687 |
+
if ( ewww_image_optimizer_iterable( $tablefields ) ) {
|
1688 |
+
foreach ( $tablefields as $tablefield ) {
|
1689 |
+
if ( 'updated' === $tablefield->Field && false === stripos( $tablefield->Default, 'current_timestamp' ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
1690 |
+
$timestamp_upgrade_needed = true;
|
1691 |
+
ewwwio_debug_message( 'updated timestamp upgrade needed' );
|
1692 |
+
}
|
1693 |
+
}
|
1694 |
+
}
|
1695 |
if (
|
1696 |
+
( false !== strpos( $mysql_version, '5.7.' ) || false !== strpos( $mysql_version, '10.1.' ) ) &&
|
1697 |
+
$timestamp_upgrade_needed
|
1698 |
) {
|
1699 |
+
if ( is_multisite() ) {
|
1700 |
+
// Just do the upgrade.
|
1701 |
$wpdb->query( "ALTER TABLE $wpdb->ewwwio_images MODIFY updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" );
|
1702 |
+
} else {
|
1703 |
+
// Do it later via user interaction.
|
1704 |
+
set_transient( 'ewww_image_optimizer_620_upgrade_needed', true );
|
1705 |
}
|
1706 |
+
} elseif ( $timestamp_upgrade_needed ) {
|
1707 |
$wpdb->query( "ALTER TABLE $wpdb->ewwwio_images ALTER updated SET DEFAULT CURRENT_TIMESTAMP" );
|
1708 |
}
|
1709 |
// Check the current collation and adjust it if necessary.
|
2106 |
<?php
|
2107 |
}
|
2108 |
|
2109 |
+
/**
|
2110 |
+
* Remind network admin to activate Easy IO on the new site.
|
2111 |
+
*/
|
2112 |
+
function ewww_image_optimizer_easyio_site_initialized() {
|
2113 |
+
if ( defined( 'EASYIO_NEW_SITE_AUTOREG' ) && EASYIO_NEW_SITE_AUTOREG ) {
|
2114 |
+
?>
|
2115 |
+
<div id="ewww-image-optimizer-notice-exactdn-success" class="notice notice-info"><p>
|
2116 |
+
<?php esc_html_e( 'Easy IO registration is complete. Visit the plugin settings to activate your new site.', 'ewww-image-optimizer' ); ?>
|
2117 |
+
</div>
|
2118 |
+
<?php
|
2119 |
+
} else {
|
2120 |
+
?>
|
2121 |
+
<div id="ewww-image-optimizer-notice-exactdn-success" class="notice notice-info"><p>
|
2122 |
+
<?php esc_html_e( 'Please visit the EWWW Image Optimizer plugin settings to activate Easy IO on your new site.', 'ewww-image-optimizer' ); ?>
|
2123 |
+
</div>
|
2124 |
+
<?php
|
2125 |
+
}
|
2126 |
+
}
|
2127 |
+
|
2128 |
/**
|
2129 |
* Let the user know the local domain appears to have changed from what Easy IO has recorded in the db.
|
2130 |
*/
|
2140 |
printf(
|
2141 |
/* translators: 1: old domain name, 2: current domain name */
|
2142 |
esc_html__( 'Easy IO detected that the Site URL has changed since the initial activation (previously %1$s, currently %2$s).', 'ewww-image-optimizer' ),
|
2143 |
+
'<strong>' . esc_html( $exactdn->get_exactdn_option( 'local_domain' ) ) . '</strong>',
|
2144 |
'<strong>' . esc_html( $exactdn->upload_domain ) . '</strong>'
|
2145 |
);
|
2146 |
?>
|
2285 |
}
|
2286 |
}
|
2287 |
|
2288 |
+
/**
|
2289 |
+
* Instruct the user to run the db upgrade.
|
2290 |
+
*/
|
2291 |
+
function ewww_image_optimizer_620_upgrade_needed() {
|
2292 |
+
// $wpdb->query( "ALTER TABLE $wpdb->ewwwio_images MODIFY updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" );
|
2293 |
+
echo "<div id='ewww-image-optimizer-upgrade-notice' class='notice notice-info'><p>" .
|
2294 |
+
esc_html__( 'EWWW Image Optimizer needs to upgrade the image log table.', 'ewww-image-optimizer' ) . '<br>' .
|
2295 |
+
'<a href="' . esc_url( admin_url( 'admin.php?action=ewww_image_optimizer_620_upgrade' ) ) . '" class="button-secondary">' .
|
2296 |
+
esc_html__( 'Upgrade', 'ewww-image-optimizer' ) . '</a>' .
|
2297 |
+
'</p></div>';
|
2298 |
+
}
|
2299 |
+
|
2300 |
/**
|
2301 |
* Ask the user to leave a review for the plugin on wp.org.
|
2302 |
*/
|
3880 |
$upload_dir = $content_dir;
|
3881 |
}
|
3882 |
$plugin_dir = realpath( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH );
|
|
|
3883 |
if ( defined( 'EWWW_IMAGE_OPTIMIZER_TOOL_PATH' ) ) {
|
3884 |
$tool_dir = realpath( EWWW_IMAGE_OPTIMIZER_TOOL_PATH );
|
3885 |
$tool_dir = dirname( $tool_dir );
|
3886 |
}
|
3887 |
+
if ( empty( $tool_dir ) ) {
|
3888 |
+
$tool_dir = $content_dir;
|
3889 |
+
}
|
3890 |
if (
|
3891 |
false === strpos( $file, $upload_dir ) &&
|
3892 |
false === strpos( $file, $content_dir ) &&
|
4702 |
if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
|
4703 |
die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
|
4704 |
}
|
4705 |
+
if ( is_multisite() && defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ) {
|
4706 |
+
update_option( 'ewww_image_optimizer_exactdn', true );
|
4707 |
+
} else {
|
4708 |
+
ewww_image_optimizer_set_option( 'ewww_image_optimizer_exactdn', true );
|
4709 |
+
}
|
4710 |
if ( ! class_exists( 'ExactDN' ) ) {
|
4711 |
/**
|
4712 |
* Page Parsing class for working with HTML content.
|
4743 |
);
|
4744 |
}
|
4745 |
|
4746 |
+
/**
|
4747 |
+
* Activates Easy IO via AJAX for a given blog on a multi-site install.
|
4748 |
+
*/
|
4749 |
+
function ewww_image_optimizer_exactdn_activate_site_ajax() {
|
4750 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
4751 |
+
if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
|
4752 |
+
die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
|
4753 |
+
}
|
4754 |
+
if ( empty( $_REQUEST['blog_id'] ) ) {
|
4755 |
+
die( wp_json_encode( array( 'error' => esc_html__( 'Blog ID not provided.', 'ewww-image-optimizer' ) ) ) );
|
4756 |
+
}
|
4757 |
+
$blog_id = (int) $_REQUEST['blog_id'];
|
4758 |
+
if ( get_current_blog_id() !== $blog_id ) {
|
4759 |
+
switch_to_blog( $blog_id );
|
4760 |
+
}
|
4761 |
+
if ( get_option( 'ewww_image_optimizer_exactdn' ) ) {
|
4762 |
+
die( wp_json_encode( array( 'success' => esc_html__( 'Easy IO setup and verification is complete.', 'ewww-image-optimizer' ) ) ) );
|
4763 |
+
}
|
4764 |
+
update_option( 'ewww_image_optimizer_exactdn', true );
|
4765 |
+
global $exactdn;
|
4766 |
+
if ( ! class_exists( 'ExactDN' ) ) {
|
4767 |
+
/**
|
4768 |
+
* Page Parsing class for working with HTML content.
|
4769 |
+
*/
|
4770 |
+
require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'classes/class-eio-page-parser.php' );
|
4771 |
+
/**
|
4772 |
+
* ExactDN class for parsing image urls and rewriting them.
|
4773 |
+
*/
|
4774 |
+
require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'classes/class-exactdn.php' );
|
4775 |
+
} elseif ( is_object( $exactdn ) ) {
|
4776 |
+
unset( $GLOBALS['exactdn'] );
|
4777 |
+
$exactdn = new ExactDN();
|
4778 |
+
}
|
4779 |
+
if ( $exactdn->get_exactdn_domain() ) {
|
4780 |
+
die( wp_json_encode( array( 'success' => esc_html__( 'Easy IO setup and verification is complete.', 'ewww-image-optimizer' ) ) ) );
|
4781 |
+
}
|
4782 |
+
restore_current_blog();
|
4783 |
+
global $exactdn_activate_error;
|
4784 |
+
if ( empty( $exactdn_activate_error ) ) {
|
4785 |
+
$exactdn_activate_error = 'error unknown';
|
4786 |
+
}
|
4787 |
+
$error_message = sprintf(
|
4788 |
+
/* translators: 1: The blog URL 2: the error message/details */
|
4789 |
+
esc_html__( 'Could not activate Easy IO on %1$s: %2$s', 'ewww-image-optimizer' ),
|
4790 |
+
esc_url( get_home_url( $blog_id ) ),
|
4791 |
+
'<code>' . esc_html( $exactdn_activate_error ) . '</code>'
|
4792 |
+
);
|
4793 |
+
if ( 'as3cf_cname_active' === $exactdn_activate_error ) {
|
4794 |
+
$error_message = esc_html__( 'Easy IO cannot optimize your images while using a custom domain (CNAME) in WP Offload Media. Please disable the custom domain in the WP Offload Media settings.', 'ewww-image-optimizer' );
|
4795 |
+
}
|
4796 |
+
die(
|
4797 |
+
wp_json_encode(
|
4798 |
+
array(
|
4799 |
+
'error' => $error_message,
|
4800 |
+
)
|
4801 |
+
)
|
4802 |
+
);
|
4803 |
+
}
|
4804 |
+
|
4805 |
+
/**
|
4806 |
+
* Registers Easy IO via AJAX for a given blog on a multi-site install.
|
4807 |
+
*/
|
4808 |
+
function ewww_image_optimizer_exactdn_register_site_ajax() {
|
4809 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
4810 |
+
if ( empty( $_REQUEST['ewww_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['ewww_wpnonce'] ), 'ewww-image-optimizer-settings' ) ) {
|
4811 |
+
die( wp_json_encode( array( 'error' => esc_html__( 'Access token has expired, please reload the page.', 'ewww-image-optimizer' ) ) ) );
|
4812 |
+
}
|
4813 |
+
if ( empty( $_REQUEST['blog_id'] ) ) {
|
4814 |
+
die( wp_json_encode( array( 'error' => esc_html__( 'Blog ID not provided.', 'ewww-image-optimizer' ) ) ) );
|
4815 |
+
}
|
4816 |
+
$blog_id = (int) $_REQUEST['blog_id'];
|
4817 |
+
if ( get_current_blog_id() !== $blog_id ) {
|
4818 |
+
$switch = true;
|
4819 |
+
switch_to_blog( $blog_id );
|
4820 |
+
}
|
4821 |
+
if ( get_option( 'ewww_image_optimizer_exactdn' ) ) {
|
4822 |
+
if ( ! empty( $switch ) ) {
|
4823 |
+
restore_current_blog();
|
4824 |
+
}
|
4825 |
+
die( wp_json_encode( array( 'status' => 'active' ) ) );
|
4826 |
+
}
|
4827 |
+
|
4828 |
+
$result = ewww_image_optimizer_register_site_post();
|
4829 |
+
if ( ! empty( $switch ) ) {
|
4830 |
+
restore_current_blog();
|
4831 |
+
}
|
4832 |
+
if ( is_wp_error( $result ) ) {
|
4833 |
+
$error_message = $result->get_error_message();
|
4834 |
+
$easyio_site_url = get_home_url( $blog_id );
|
4835 |
+
ewwwio_debug_message( "registration failed for $easyio_site_url: $error_message" );
|
4836 |
+
die(
|
4837 |
+
wp_json_encode(
|
4838 |
+
array(
|
4839 |
+
'error' => sprintf(
|
4840 |
+
/* translators: %s: an HTTP error message */
|
4841 |
+
esc_html__( 'Could not register site, HTTP error: %s', 'ewww-image-optimizer' ),
|
4842 |
+
$error_message
|
4843 |
+
),
|
4844 |
+
)
|
4845 |
+
)
|
4846 |
+
);
|
4847 |
+
} elseif ( ! empty( $result['body'] ) ) {
|
4848 |
+
$response = json_decode( $result['body'], true );
|
4849 |
+
if ( ! empty( $response['error'] ) && false !== strpos( strtolower( $response['error'] ), 'duplicate site url' ) ) {
|
4850 |
+
die( wp_json_encode( array( 'status' => 'registered' ) ) );
|
4851 |
+
}
|
4852 |
+
die( wp_json_encode( $response ) );
|
4853 |
+
}
|
4854 |
+
$error_message = sprintf(
|
4855 |
+
/* translators: %s: The blog URL */
|
4856 |
+
esc_html__( 'Could not register Easy IO for %s: error unknown.', 'ewww-image-optimizer' ),
|
4857 |
+
esc_url( get_home_url( $blog_id ) )
|
4858 |
+
);
|
4859 |
+
die(
|
4860 |
+
wp_json_encode(
|
4861 |
+
array(
|
4862 |
+
'error' => $error_message,
|
4863 |
+
)
|
4864 |
+
)
|
4865 |
+
);
|
4866 |
+
}
|
4867 |
+
|
4868 |
+
/**
|
4869 |
+
* Registers Easy IO for a new blog on a multi-site install.
|
4870 |
+
*
|
4871 |
+
* @param object $new_site WP_Site instace for the new site.
|
4872 |
+
*/
|
4873 |
+
function ewww_image_optimizer_initialize_site( $new_site ) {
|
4874 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
4875 |
+
if ( empty( $new_site->id ) ) {
|
4876 |
+
return;
|
4877 |
+
}
|
4878 |
+
if ( ! defined( 'EASYIO_NEW_SITE_AUTOREG' ) || ! EASYIO_NEW_SITE_AUTOREG ) {
|
4879 |
+
return;
|
4880 |
+
}
|
4881 |
+
if ( get_current_blog_id() !== $new_site->id ) {
|
4882 |
+
$switch = true;
|
4883 |
+
switch_to_blog( $new_site->id );
|
4884 |
+
}
|
4885 |
+
|
4886 |
+
$result = ewww_image_optimizer_register_site_post();
|
4887 |
+
$easyio_site_url = get_home_url( $new_site->id );
|
4888 |
+
if ( ! empty( $switch ) ) {
|
4889 |
+
restore_current_blog();
|
4890 |
+
}
|
4891 |
+
if ( is_wp_error( $result ) ) {
|
4892 |
+
$error_message = $result->get_error_message();
|
4893 |
+
ewwwio_debug_message( "registration failed for $easyio_site_url: $error_message" );
|
4894 |
+
} elseif ( ! empty( $result['body'] ) ) {
|
4895 |
+
$response = json_decode( $result['body'], true );
|
4896 |
+
if ( ! empty( $response['error'] ) ) {
|
4897 |
+
ewwwio_debug_message( "registration failed for $easyio_site_url: {$response['error']}" );
|
4898 |
+
}
|
4899 |
+
}
|
4900 |
+
}
|
4901 |
+
|
4902 |
+
/**
|
4903 |
+
* POSTs the site URL to the API for Easy IO registration.
|
4904 |
+
*
|
4905 |
+
* @return array The results of the http POST request.
|
4906 |
+
*/
|
4907 |
+
function ewww_image_optimizer_register_site_post() {
|
4908 |
+
// Get the site URL for a given blog.
|
4909 |
+
$eio_base = new EIO_Base();
|
4910 |
+
$site_url = $eio_base->content_url();
|
4911 |
+
|
4912 |
+
$key = ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' );
|
4913 |
+
if ( empty( $key ) ) {
|
4914 |
+
return new WP_Error( 'missing_key', __( 'No API key for Easy IO registration', 'ewww-image-optimizer' ) );
|
4915 |
+
}
|
4916 |
+
$url = 'https://optimize.exactlywww.com/exactdn/create.php';
|
4917 |
+
add_filter( 'http_headers_useragent', 'ewww_image_optimizer_cloud_useragent', PHP_INT_MAX );
|
4918 |
+
$result = wp_remote_post(
|
4919 |
+
$url,
|
4920 |
+
array(
|
4921 |
+
'timeout' => 60,
|
4922 |
+
'sslverify' => false,
|
4923 |
+
'body' => array(
|
4924 |
+
'key' => $key,
|
4925 |
+
'token' => $key,
|
4926 |
+
'site_url' => $site_url,
|
4927 |
+
),
|
4928 |
+
)
|
4929 |
+
);
|
4930 |
+
return $result;
|
4931 |
+
}
|
4932 |
+
|
4933 |
/**
|
4934 |
* Sanitizes an API key for the cloud service.
|
4935 |
*
|
10376 |
}
|
10377 |
if ( ! $single && is_multisite() && is_plugin_active_for_network( EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL ) && ! get_site_option( 'ewww_image_optimizer_allow_multisite_override' ) ) {
|
10378 |
$option_value = get_site_option( $option_name );
|
10379 |
+
if ( 'ewww_image_optimizer_exactdn' === $option_name && ! $option_value ) {
|
10380 |
+
$option_value = get_option( $option_name );
|
10381 |
+
}
|
10382 |
} else {
|
10383 |
$option_value = get_option( $option_name );
|
10384 |
}
|
10461 |
remove_action( 'admin_notices', 'ewww_image_optimizer_notice_exactdn_domain_mismatch' );
|
10462 |
$exactdn->setup();
|
10463 |
}
|
10464 |
+
$blog_ids = array();
|
10465 |
+
if ( is_multisite() && is_network_admin() ) {
|
10466 |
+
global $wpdb;
|
10467 |
+
$blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = %d ORDER BY blog_id DESC", $wpdb->siteid ) );
|
10468 |
+
if ( ! ewww_image_optimizer_iterable( $blog_ids ) ) {
|
10469 |
+
$blog_ids = array();
|
10470 |
+
}
|
10471 |
+
wp_enqueue_script( 'jquery-ui-progressbar' );
|
10472 |
+
}
|
10473 |
add_thickbox();
|
10474 |
wp_enqueue_script( 'ewww-beacon-script', plugins_url( '/includes/eio-beacon.js', __FILE__ ), array( 'jquery' ), EWWW_IMAGE_OPTIMIZER_VERSION );
|
10475 |
wp_enqueue_script( 'ewww-settings-script', plugins_url( '/includes/eio-settings.js', __FILE__ ), array( 'jquery' ), EWWW_IMAGE_OPTIMIZER_VERSION, true );
|
10480 |
'ewww-settings-script',
|
10481 |
'ewww_vars',
|
10482 |
array(
|
10483 |
+
'_wpnonce' => wp_create_nonce( 'ewww-image-optimizer-settings' ),
|
10484 |
+
'invalid_response' => esc_html__( 'Received an invalid response from your website, please check for errors in the Developer Tools console of your browser.', 'ewww-image-optimizer' ),
|
10485 |
+
'loading_image_url' => plugins_url( '/images/spinner.gif', __FILE__ ),
|
10486 |
+
'operation_stopped' => esc_html__( 'Operation stopped.', 'ewww-image-optimizer' ),
|
10487 |
+
'easyio_register_warning' => esc_html__( 'This will register all your sites with the Easy IO CDN and will take some time to complete. Do you wish to proceed?', 'ewww-image-optimizer' ),
|
10488 |
+
'easyio_register_success' => esc_html__( 'Easy IO registration complete. Please wait 5-10 minutes and then activate your sites.', 'ewww-image-optimizer' ),
|
10489 |
+
'exactdn_network_warning' => esc_html__( 'This will attempt to activate Easy IO on all sites within the multi-site network. Please be sure you have registered all your site URLs before continuing.', 'ewww-image-optimizer' ),
|
10490 |
+
'exactdn_network_success' => esc_html__( 'Easy IO setup and verification is complete.', 'ewww-image-optimizer' ),
|
10491 |
+
'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' ),
|
10492 |
+
'network_blog_ids' => $blog_ids,
|
10493 |
)
|
10494 |
);
|
10495 |
wp_add_inline_script(
|
10504 |
/**
|
10505 |
* Get a total of how much space we have saved so far.
|
10506 |
*
|
|
|
10507 |
* @global object $wpdb
|
10508 |
*
|
10509 |
* @return int The total savings found, in bytes.
|
10510 |
*/
|
10511 |
+
function ewww_image_optimizer_savings() {
|
10512 |
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
10513 |
global $wpdb;
|
10514 |
$total_orig = 0;
|
10515 |
$total_opt = 0;
|
10516 |
$total_savings = 0;
|
10517 |
$started = microtime( true );
|
10518 |
+
if ( is_multisite() && is_network_admin() ) {
|
10519 |
$cache_savings = get_site_transient( 'ewww_image_optimizer_savings' );
|
10520 |
+
if ( ! empty( $cache_savings ) && is_array( $cache_savings ) && 2 === count( $cache_savings ) && ! empty( $cache_savings[0] ) ) {
|
10521 |
ewwwio_debug_message( 'savings query avoided via (multi-site) cache' );
|
10522 |
return $cache_savings;
|
10523 |
}
|
10545 |
}
|
10546 |
switch_to_blog( $blog_id );
|
10547 |
ewwwio_debug_message( "getting savings for site: $blog_id" );
|
10548 |
+
$table_name = $wpdb->prefix . 'ewwwio_images';
|
10549 |
+
$wpdb->ewwwio_images = $table_name;
|
10550 |
+
ewwwio_debug_message( "table name is $table_name ({$wpdb->ewwwio_images})" );
|
10551 |
if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) !== $table_name ) {
|
10552 |
ewww_image_optimizer_install_table();
|
10553 |
}
|
10562 |
}
|
10563 |
restore_current_blog();
|
10564 |
}
|
10565 |
+
$wpdb->ewwwio_images = $wpdb->prefix . 'ewwwio_images';
|
10566 |
}
|
10567 |
set_site_transient( 'ewww_image_optimizer_savings', array( $total_opt, $total_orig ), DAY_IN_SECONDS );
|
10568 |
} else {
|
11759 |
global $eio_alt_webp;
|
11760 |
$total_savings = 0;
|
11761 |
if ( 'network-multisite' === $network ) {
|
11762 |
+
$total_sizes = ewww_image_optimizer_savings();
|
11763 |
$total_savings = $total_sizes[1] - $total_sizes[0];
|
11764 |
} else {
|
11765 |
$total_sizes = ewww_image_optimizer_savings();
|
11871 |
$speed_score += 20;
|
11872 |
}
|
11873 |
$exactdn_enabled = true;
|
11874 |
+
if ( is_multisite() && is_network_admin() && defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ) {
|
11875 |
+
$exactdn_savings = 0;
|
11876 |
+
} else {
|
11877 |
+
$exactdn_savings = $exactdn->savings();
|
11878 |
+
}
|
11879 |
}
|
11880 |
} elseif ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) {
|
11881 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) {
|
11896 |
delete_site_option( 'ewww_image_optimizer_exactdn_validation' );
|
11897 |
delete_site_option( 'ewww_image_optimizer_exactdn_suspended' );
|
11898 |
}
|
11899 |
+
$exactdn_network_enabled = 0;
|
11900 |
+
if ( $exactdn_enabled && is_multisite() && is_network_admin() && defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ) {
|
11901 |
+
$exactdn_network_enabled = ewww_image_optimizer_easyio_network_activated();
|
11902 |
+
}
|
11903 |
$easymode = false;
|
11904 |
if (
|
11905 |
! ewww_image_optimizer_get_option( 'ewww_image_optimizer_local_mode' )
|
12340 |
<li class='ewww-tab ewww-support-nav'><span><?php esc_html_e( 'Support', 'ewww-image-optimizer' ); ?></span></li>
|
12341 |
<li class='ewww-tab ewww-contribute-nav'><span><?php esc_html_e( 'Contribute', 'ewww-image-optimizer' ); ?></span></li>
|
12342 |
</ul>
|
12343 |
+
<?php elseif ( $easymode && 'network-singlesite' !== $network ) : ?>
|
12344 |
<ul class='ewww-tab-nav'>
|
12345 |
<li class='ewww-tab ewww-general-nav'><span><?php esc_html_e( 'Basic', 'ewww-image-optimizer' ); ?></span></li>
|
12346 |
<li class='ewww-tab ewww-support-nav'><span><?php esc_html_e( 'Support', 'ewww-image-optimizer' ); ?></span></li>
|
12475 |
<span id='ewwwio-api-activation-processing'><img src='<?php echo esc_url( $loading_image_url ); ?>' alt='loading'/></span>
|
12476 |
<p class='description'>
|
12477 |
<?php esc_html_e( 'Premium compression for your local images.', 'ewww-image-optimizer' ); ?>
|
12478 |
+
<?php
|
12479 |
+
printf(
|
12480 |
+
/* translators: 1: the string 'Start your free trial' with a link to the signup page 2: 'enter an existing key' linked to the account/key page */
|
12481 |
+
esc_html__( '%1$s or %2$s.', 'ewww-image-optimizer' ),
|
12482 |
+
"<a href='https://ewww.io/plans/' target='_blank'>" . esc_html__( 'Start your free trial', 'ewww-image-optimizer' ) . '</a>',
|
12483 |
+
"<a href='https://ewww.io/manage-keys/' target='_blank'>" . esc_html__( 'enter an existing key', 'ewww-image-optimizer' ) . '</a>'
|
12484 |
+
);
|
12485 |
+
?>
|
12486 |
</p>
|
12487 |
</td>
|
12488 |
</tr>
|
12489 |
<?php endif; ?>
|
12490 |
<?php if ( ! get_option( 'easyio_exactdn' ) ) : ?>
|
12491 |
+
<?php ob_start(); ?>
|
12492 |
<tr id="ewww_image_optimizer_exactdn_container" class="ewwwio-premium-setup" <?php echo wp_kses_post( $premium_hide ); ?>>
|
12493 |
<th scope='row'>
|
12494 |
<span id='ewwwio-exactdn-anchor'></span>
|
12497 |
</th>
|
12498 |
<td>
|
12499 |
<div id='ewwwio-easy-activation-result'></div>
|
12500 |
+
<p class='ewwwio-easy-description'>
|
12501 |
+
<?php
|
12502 |
+
printf(
|
12503 |
+
/* translators: %s: the string 'and more' with a link to the docs */
|
12504 |
+
esc_html__( 'An image-optimizing CDN with automatic compression, scaling, WebP conversion %s.', 'ewww-image-optimizer' ),
|
12505 |
+
'<a href="https://docs.ewww.io/article/44-introduction-to-exactdn" target="_blank" data-beacon-article="59bc5ad6042863033a1ce370">' . esc_html__( 'and more', 'ewww-image-optimizer' ) . '</a>'
|
12506 |
+
);
|
12507 |
+
?>
|
12508 |
+
</p>
|
12509 |
<?php if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) && ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) ) : ?>
|
12510 |
<p style='color: red'><?php esc_html_e( 'Inactive, please disable the Image Accelerator option on the Jetpack Dashboard.', 'ewww-image-optimizer' ); ?></p>
|
12511 |
<?php elseif ( false !== strpos( $easyio_site_url, 'localhost' ) ) : ?>
|
12512 |
<p class="description" style="font-weight: bolder"><?php esc_html_e( 'Easy IO cannot be activated on localhost installs.', 'ewww-image-optimizer' ); ?></p>
|
12513 |
+
<?php elseif ( 'network-multisite' === $network && defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ) : ?>
|
12514 |
+
<?php if ( 1 > $exactdn_network_enabled ) : ?>
|
12515 |
+
<p class="ewwwio-easy-setup-instructions">
|
12516 |
+
<?php if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) : ?>
|
12517 |
+
<?php esc_html_e( 'Enter your API key above to enable automatic Easy IO site registration.', 'ewww-image-optimizer' ); ?><br>
|
12518 |
+
<?php endif; ?>
|
12519 |
+
<?php if ( -1 === $exactdn_network_enabled ) : ?>
|
12520 |
+
<span style="color: orange; font-weight: bolder"><?php esc_html_e( 'Partially Active', 'ewww-image-optimizer' ); ?></span> - <a href="https://ewww.io/manage-sites/"><?php esc_html_e( 'Manage Sites', 'ewww-image-optimizer' ); ?></a><br>
|
12521 |
+
<span><?php esc_html_e( 'Easy IO is not active on some sites. You may activate individual sites via the plugin settings in each site dashboard, or activate all remaining sites below.', 'ewww-image-optimizer' ); ?></span><br>
|
12522 |
+
<?php else : ?>
|
12523 |
+
<strong><a href="https://ewww.io/plans/" target="_blank">
|
12524 |
+
<?php esc_html_e( 'Purchase a subscription for your sites', 'ewww-image-optimizer' ); ?>
|
12525 |
+
</a></strong><br>
|
12526 |
+
<a href="https://ewww.io/manage-sites/" target="_blank"><?php esc_html_e( 'Then, add your Site URLs to your account', 'easy-image-optimizer' ); ?></a>
|
12527 |
+
<?php endif; ?>
|
12528 |
+
</p>
|
12529 |
<p>
|
12530 |
+
<?php if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_cloud_key' ) ) : ?>
|
12531 |
+
<a id='ewwwio-easy-register-network' href='#' class='button-secondary'><?php esc_html_e( 'Register All Sites', 'ewww-image-optimizer' ); ?></a>
|
12532 |
+
<?php endif; ?>
|
12533 |
+
<a id='ewwwio-easy-activate-network' href='#' class='button-secondary'><?php esc_html_e( 'Activate All Sites', 'ewww-image-optimizer' ); ?></a>
|
12534 |
+
</p>
|
12535 |
+
<span id='ewwwio-easy-activation-processing'><img src='<?php echo esc_url( $loading_image_url ); ?>' alt='loading'/></span>
|
12536 |
+
<div id='ewwwio-easy-activation-progressbar' style='display:none;'></div>
|
12537 |
+
<a id='ewwwio-easy-cancel-network-operation' style='display:none;' href='#' class='button-secondary'><?php esc_html_e( 'Cancel', 'ewww-image-optimizer' ); ?></a>
|
12538 |
+
<div id='ewwwio-easy-activation-errors' style='display:none;'>
|
12539 |
+
<p>
|
12540 |
+
<?php
|
12541 |
+
printf(
|
12542 |
+
/* translators: %s: link to docs */
|
12543 |
+
esc_html__( 'The following errors were encountered during the bulk operation. Please see %s for troubleshooting steps.', 'ewww-image-optimizer' ),
|
12544 |
+
'<a href="https://docs.ewww.io/article/66-exactdn-not-verified" data-beacon-article="5beee9932c7d3a31944e0d33" target="_blank">https://docs.ewww.io/article/66-exactdn-not-verified</a>'
|
12545 |
+
);
|
12546 |
+
?>
|
12547 |
+
</p>
|
12548 |
+
</div>
|
12549 |
+
<?php endif; ?>
|
12550 |
+
<?php if ( 1 === $exactdn_network_enabled ) : ?>
|
12551 |
+
<span style="color: #3eadc9; font-weight: bolder"><?php esc_html_e( 'Verified', 'ewww-image-optimizer' ); ?></span> - <a href="https://ewww.io/manage-sites/"><?php esc_html_e( 'Manage Sites', 'ewww-image-optimizer' ); ?></a><br>
|
12552 |
+
<?php endif; ?>
|
12553 |
+
<?php if ( 0 !== $exactdn_network_enabled ) : ?>
|
12554 |
+
<a id='ewwwio-easy-deactivate' class='button-secondary' href='<?php echo esc_url( admin_url( 'admin.php?action=ewww_image_optimizer_network_remove_easyio' ) ); ?>'>
|
12555 |
+
<?php esc_html_e( 'De-activate All Sites', 'ewww-image-optimizer' ); ?>
|
12556 |
+
</a>
|
12557 |
+
<?php endif; ?>
|
12558 |
+
<?php elseif ( ! $exactdn_enabled ) : ?>
|
12559 |
+
<p class="ewwwio-easy-setup-instructions">
|
12560 |
<strong><a href="https://ewww.io/plans/" target="_blank">
|
12561 |
<?php esc_html_e( 'Purchase a subscription for your site.', 'ewww-image-optimizer' ); ?>
|
12562 |
</a></strong><br>
|
12590 |
<?php endif; ?>
|
12591 |
</td>
|
12592 |
</tr>
|
12593 |
+
<?php $exactdn_settings_row = ob_get_contents(); ?>
|
12594 |
+
<?php ob_end_flush(); ?>
|
12595 |
<?php endif; ?>
|
12596 |
<tr class='ewwwio-exactdn-options' <?php echo $exactdn_enabled ? '' : 'style="display:none;"'; ?>>
|
12597 |
<td> </td>
|
13434 |
<?php ob_end_clean(); ?>
|
13435 |
<div id='ewww-resize-settings'>
|
13436 |
<table class='form-table'>
|
13437 |
+
<?php echo ( defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ? wp_kses_post( $exactdn_settings_row ) : '' ); ?>
|
13438 |
<?php endif; ?>
|
13439 |
<!-- RIGHT HERE is where we begin/clear buffer for network-singlesite (non-override version). -->
|
13440 |
<!-- Though the buffer will need to be started right the form begins. -->
|
13619 |
<noscript><h2><?php esc_html_e( 'Support', 'ewww-image-optimizer' ); ?></h2></noscript>
|
13620 |
<p>
|
13621 |
<a class='ewww-docs-root' href='https://docs.ewww.io/'><?php esc_html_e( 'Documentation', 'ewww-image-optimizer' ); ?></a> |
|
13622 |
+
<a class='ewww-docs-root' href='https://ewww.io/contact-us/'><?php esc_html_e( 'Contact Support', 'ewww-image-optimizer' ); ?></a> |
|
13623 |
+
<a href='https://feedback.ewww.io/b/features'><?php esc_html_e( 'Submit Feedback', 'ewww-image-optimizer' ); ?></a>
|
|
|
13624 |
</p>
|
13625 |
<p style='float:right;'>
|
13626 |
<a href='<?php echo esc_url( wp_nonce_url( admin_url( 'options-general.php?page=ewww-image-optimizer-options&uncomplete_wizard=1' ), 'ewww_image_optimizer_options-options' ) ); ?>'>
|
13780 |
}
|
13781 |
|
13782 |
/**
|
13783 |
+
* Checks to see if ExactDN or Easy IO is active.
|
13784 |
+
*
|
13785 |
+
* @return bool True if Easy IO is active in this plugin or the standalone Easy IO plugin. False if not.
|
13786 |
*/
|
13787 |
function ewww_image_optimizer_easy_active() {
|
13788 |
if ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_exactdn' ) || get_option( 'easyio_exactdn' ) ) {
|
13791 |
return false;
|
13792 |
}
|
13793 |
|
13794 |
+
|
13795 |
+
/**
|
13796 |
+
* Checks to see if Easy IO is active for multiple sites in a network install.
|
13797 |
+
*
|
13798 |
+
* @return int 1 if all tested sites are active, -1 if only partially active, 0 for none active.
|
13799 |
+
*/
|
13800 |
+
function ewww_image_optimizer_easyio_network_activated() {
|
13801 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
13802 |
+
$active = 0;
|
13803 |
+
$inactive = 0;
|
13804 |
+
$total = 0;
|
13805 |
+
global $wpdb;
|
13806 |
+
$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = %d LIMIT 500", $wpdb->siteid ), ARRAY_A );
|
13807 |
+
if ( ewww_image_optimizer_iterable( $blogs ) ) {
|
13808 |
+
foreach ( $blogs as $blog ) {
|
13809 |
+
$total++;
|
13810 |
+
switch_to_blog( $blog['blog_id'] );
|
13811 |
+
if ( get_option( 'ewww_image_optimizer_exactdn' ) && get_option( 'ewww_image_optimizer_exactdn_verified' ) ) {
|
13812 |
+
ewwwio_debug_message( "blog $blog_id active" );
|
13813 |
+
$active++;
|
13814 |
+
} else {
|
13815 |
+
ewwwio_debug_message( "blog $blog_id inactive" );
|
13816 |
+
$inactive++;
|
13817 |
+
}
|
13818 |
+
restore_current_blog();
|
13819 |
+
}
|
13820 |
+
}
|
13821 |
+
if ( $active > 0 && $active < $total ) {
|
13822 |
+
$active = -1;
|
13823 |
+
} elseif ( $active > 0 && $active === $total ) {
|
13824 |
+
$active = 1;
|
13825 |
+
}
|
13826 |
+
return $active;
|
13827 |
+
}
|
13828 |
+
|
13829 |
/**
|
13830 |
* Removes the API key currently installed.
|
13831 |
*
|
13832 |
* @param boolean|string $redirect Should the plugin do a silent redirect back to the referring page? Default true.
|
13833 |
*/
|
13834 |
function ewww_image_optimizer_remove_cloud_key( $redirect = true ) {
|
13835 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
13836 |
$permissions = apply_filters( 'ewww_image_optimizer_admin_permissions', '' );
|
13837 |
if ( 'none' !== $redirect && false === current_user_can( $permissions ) ) {
|
13838 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
13861 |
delete_transient( 'ewww_image_optimizer_cloud_status' );
|
13862 |
ewww_image_optimizer_set_option( 'ewww_image_optimizer_backup_files', '' );
|
13863 |
if ( 'none' !== $redirect ) {
|
13864 |
+
wp_safe_redirect( wp_get_referer() );
|
|
|
13865 |
exit;
|
13866 |
}
|
13867 |
}
|
13870 |
* De-activates Easy IO.
|
13871 |
*/
|
13872 |
function ewww_image_optimizer_remove_easyio() {
|
13873 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
13874 |
$permissions = apply_filters( 'ewww_image_optimizer_admin_permissions', '' );
|
13875 |
if ( false === current_user_can( $permissions ) ) {
|
13876 |
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
13877 |
}
|
13878 |
+
update_option( 'ewww_image_optimizer_exactdn', '' );
|
13879 |
delete_option( 'ewww_image_optimizer_exactdn_domain' );
|
13880 |
delete_option( 'ewww_image_optimizer_exactdn_plan_id' );
|
13881 |
delete_option( 'ewww_image_optimizer_exactdn_failures' );
|
13883 |
delete_option( 'ewww_image_optimizer_exactdn_verified' );
|
13884 |
delete_option( 'ewww_image_optimizer_exactdn_validation' );
|
13885 |
delete_option( 'ewww_image_optimizer_exactdn_suspended' );
|
13886 |
+
update_site_option( 'ewww_image_optimizer_exactdn', '' );
|
13887 |
delete_site_option( 'ewww_image_optimizer_exactdn_domain' );
|
13888 |
delete_site_option( 'ewww_image_optimizer_exactdn_plan_id' );
|
13889 |
delete_site_option( 'ewww_image_optimizer_exactdn_failures' );
|
13893 |
delete_site_option( 'ewww_image_optimizer_exactdn_suspended' );
|
13894 |
global $exactdn;
|
13895 |
$exactdn->cron_setup( false );
|
13896 |
+
wp_safe_redirect( wp_get_referer() );
|
13897 |
+
exit;
|
13898 |
+
}
|
13899 |
+
|
13900 |
+
/**
|
13901 |
+
* De-activates Easy IO on entire network install.
|
13902 |
+
*/
|
13903 |
+
function ewww_image_optimizer_network_remove_easyio() {
|
13904 |
+
ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
|
13905 |
+
$permissions = apply_filters( 'ewww_image_optimizer_admin_permissions', 'manage_network_options' );
|
13906 |
+
if ( false === current_user_can( $permissions ) ) {
|
13907 |
+
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
13908 |
+
}
|
13909 |
+
if ( ! is_multisite() ) {
|
13910 |
+
wp_die( esc_html__( 'Access denied.', 'ewww-image-optimizer' ) );
|
13911 |
+
}
|
13912 |
+
global $wpdb;
|
13913 |
+
$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = %d", $wpdb->siteid ), ARRAY_A );
|
13914 |
+
if ( ewww_image_optimizer_iterable( $blogs ) ) {
|
13915 |
+
foreach ( $blogs as $blog ) {
|
13916 |
+
switch_to_blog( $blog['blog_id'] );
|
13917 |
+
update_option( 'ewww_image_optimizer_exactdn', '' );
|
13918 |
+
delete_option( 'ewww_image_optimizer_exactdn_domain' );
|
13919 |
+
delete_option( 'ewww_image_optimizer_exactdn_plan_id' );
|
13920 |
+
delete_option( 'ewww_image_optimizer_exactdn_failures' );
|
13921 |
+
delete_option( 'ewww_image_optimizer_exactdn_checkin' );
|
13922 |
+
delete_option( 'ewww_image_optimizer_exactdn_verified' );
|
13923 |
+
delete_option( 'ewww_image_optimizer_exactdn_validation' );
|
13924 |
+
delete_option( 'ewww_image_optimizer_exactdn_suspended' );
|
13925 |
+
wp_clear_scheduled_hook( 'easyio_verification_checkin' );
|
13926 |
+
restore_current_blog();
|
13927 |
+
}
|
13928 |
+
}
|
13929 |
+
|
13930 |
+
update_site_option( 'ewww_image_optimizer_exactdn', '' );
|
13931 |
+
delete_site_option( 'ewww_image_optimizer_exactdn_domain' );
|
13932 |
+
delete_site_option( 'ewww_image_optimizer_exactdn_plan_id' );
|
13933 |
+
delete_site_option( 'ewww_image_optimizer_exactdn_failures' );
|
13934 |
+
delete_site_option( 'ewww_image_optimizer_exactdn_checkin' );
|
13935 |
+
delete_site_option( 'ewww_image_optimizer_exactdn_verified' );
|
13936 |
+
delete_site_option( 'ewww_image_optimizer_exactdn_validation' );
|
13937 |
+
delete_site_option( 'ewww_image_optimizer_exactdn_suspended' );
|
13938 |
+
|
13939 |
+
wp_safe_redirect( wp_get_referer() );
|
13940 |
exit;
|
13941 |
}
|
13942 |
|
13971 |
} else {
|
13972 |
$resize_detection_script = file_get_contents( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'includes/resize-detection.min.js' );
|
13973 |
}
|
13974 |
+
?>
|
13975 |
+
<style>
|
13976 |
+
#wp-admin-bar-resize-detection div.ab-empty-item {
|
13977 |
+
cursor: pointer;
|
13978 |
+
}
|
13979 |
+
#wp-admin-bar-resize-detection {
|
13980 |
+
opacity: 1;
|
13981 |
+
-webkit-transition: opacity 0.3s ease-in-out;
|
13982 |
+
-moz-transition: opacity 0.3s ease-in-out;
|
13983 |
+
-ms-transition: opacity 0.3s ease-in-out;
|
13984 |
+
-o-transition: opacity 0.3s ease-in-out;
|
13985 |
+
transition: opacity 0.3 ease-in-out;
|
13986 |
+
}
|
13987 |
+
#wp-admin-bar-resize-detection.ewww-fade {
|
13988 |
+
opacity: 0;
|
13989 |
+
}
|
13990 |
+
img.scaled-image {
|
13991 |
+
border: 3px #3eadc9 dotted;
|
13992 |
+
margin: -3px;
|
13993 |
+
}
|
13994 |
+
</style>
|
13995 |
+
<script><?php echo $resize_detection_script; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></script>
|
13996 |
+
<?php
|
13997 |
}
|
13998 |
}
|
13999 |
|
ewww-image-optimizer.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Loader for Standard EWWW
|
4 |
*
|
5 |
* This file bootstraps the rest of the EWWW IO plugin after some basic checks.
|
6 |
*
|
@@ -13,8 +13,8 @@ Plugin Name: EWWW Image Optimizer
|
|
13 |
Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
|
14 |
Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
|
15 |
Author: Exactly WWW
|
16 |
-
Version: 6.2.
|
17 |
-
Requires at least: 5.
|
18 |
Requires PHP: 7.1
|
19 |
Author URI: https://ewww.io/
|
20 |
License: GPLv3
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Loader for Standard EWWW IO plugin.
|
4 |
*
|
5 |
* This file bootstraps the rest of the EWWW IO plugin after some basic checks.
|
6 |
*
|
13 |
Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
|
14 |
Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
|
15 |
Author: Exactly WWW
|
16 |
+
Version: 6.2.4
|
17 |
+
Requires at least: 5.5
|
18 |
Requires PHP: 7.1
|
19 |
Author URI: https://ewww.io/
|
20 |
License: GPLv3
|
includes/eio-settings.js
CHANGED
@@ -175,6 +175,7 @@ jQuery(document).ready(function($) {
|
|
175 |
$('#ewwwio-easy-activation-result').show();
|
176 |
$('.ewwwio-exactdn-options input').prop('disabled', false);
|
177 |
$('.ewwwio-exactdn-options').show();
|
|
|
178 |
$('#ewww_image_optimizer_webp_container').hide();
|
179 |
$('.ewww_image_optimizer_webp_setting_container').hide();
|
180 |
$('.ewww_image_optimizer_webp_rewrite_setting_container').hide();
|
@@ -183,6 +184,170 @@ jQuery(document).ready(function($) {
|
|
183 |
});
|
184 |
return false;
|
185 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
$('#ewww_image_optimizer_webp').on(
|
187 |
'click',
|
188 |
function() {
|
175 |
$('#ewwwio-easy-activation-result').show();
|
176 |
$('.ewwwio-exactdn-options input').prop('disabled', false);
|
177 |
$('.ewwwio-exactdn-options').show();
|
178 |
+
$('p.ewwwio-easy-setup-instructions').hide();
|
179 |
$('#ewww_image_optimizer_webp_container').hide();
|
180 |
$('.ewww_image_optimizer_webp_setting_container').hide();
|
181 |
$('.ewww_image_optimizer_webp_rewrite_setting_container').hide();
|
184 |
});
|
185 |
return false;
|
186 |
});
|
187 |
+
var exactdn_blog_ids = [];
|
188 |
+
var exactdn_blog_count = 0;
|
189 |
+
var exactdn_cancelled = false;
|
190 |
+
$('#ewwwio-easy-activate-network').on( 'click', function() {
|
191 |
+
if (!confirm(ewww_vars.exactdn_network_warning)) {
|
192 |
+
return false;
|
193 |
+
}
|
194 |
+
exactdn_blog_ids = Array.from(ewww_vars.network_blog_ids);
|
195 |
+
exactdn_blog_count = exactdn_blog_ids.length;
|
196 |
+
$('#ewww_image_optimizer_exactdn_container .button-secondary').hide();
|
197 |
+
//$('#ewwwio-easy-activate-network').hide();
|
198 |
+
//$('#ewwwio-easy-deactivate').hide();
|
199 |
+
//$('#ewwwio-easy-register-network').hide();
|
200 |
+
$('#ewwwio-easy-cancel-network-operation').show();
|
201 |
+
$('#ewwwio-easy-activation-result').hide();
|
202 |
+
$('#ewwwio-easy-activation-processing').show();
|
203 |
+
$('#ewwwio-easy-activation-progressbar').progressbar({ max: exactdn_blog_count });
|
204 |
+
$('#ewwwio-easy-activation-progressbar').show();
|
205 |
+
activateExactDNSite();
|
206 |
+
return false;
|
207 |
+
});
|
208 |
+
function activateExactDNSite() {
|
209 |
+
var ewww_post_data = {
|
210 |
+
action: 'ewww_exactdn_activate_site',
|
211 |
+
ewww_wpnonce: ewww_vars._wpnonce,
|
212 |
+
blog_id: exactdn_blog_ids.pop(),
|
213 |
+
};
|
214 |
+
$.post(ajaxurl, ewww_post_data, function(response) {
|
215 |
+
try {
|
216 |
+
var ewww_response = JSON.parse(response);
|
217 |
+
} catch (err) {
|
218 |
+
$('#ewwwio-easy-activation-processing').hide();
|
219 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.invalid_response);
|
220 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
221 |
+
$('#ewwwio-easy-activation-result').show();
|
222 |
+
$('#ewwwio-easy-cancel-network-operation').hide();
|
223 |
+
console.log( response );
|
224 |
+
return false;
|
225 |
+
}
|
226 |
+
var exactdn_blogs_done = exactdn_blog_count - exactdn_blog_ids.length;
|
227 |
+
if ( ewww_response.error ) {
|
228 |
+
$('#ewwwio-easy-activation-processing').hide();
|
229 |
+
$('#ewwwio-easy-activation-errors').append('<p>' + ewww_response.error + '</p>');
|
230 |
+
$('#ewwwio-easy-activation-errors').show();
|
231 |
+
$('#ewwwio-easy-activation-progressbar').progressbar('option', 'value', exactdn_blogs_done);
|
232 |
+
} else if ( ! ewww_response.success ) {
|
233 |
+
$('#ewwwio-easy-activate-network').show();
|
234 |
+
$('#ewwwio-easy-activation-processing').hide();
|
235 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.invalid_response);
|
236 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
237 |
+
$('#ewwwio-easy-activation-result').show();
|
238 |
+
$('#ewwwio-easy-cancel-network-operation').hide();
|
239 |
+
console.log( response );
|
240 |
+
return false;
|
241 |
+
} else {
|
242 |
+
$('#ewwwio-easy-activation-processing').hide();
|
243 |
+
$('p.ewwwio-easy-setup-instructions').hide();
|
244 |
+
$('p.ewwwio-easy-description').hide();
|
245 |
+
$('#ewwwio-easy-activation-progressbar').progressbar('option', 'value', exactdn_blogs_done);
|
246 |
+
}
|
247 |
+
if ( exactdn_blog_ids.length ) {
|
248 |
+
activateExactDNSite();
|
249 |
+
} else {
|
250 |
+
$('#ewwwio-easy-cancel-network-operation').hide();
|
251 |
+
if (exactdn_cancelled) {
|
252 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.operation_stopped);
|
253 |
+
} else {
|
254 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.exactdn_network_success);
|
255 |
+
}
|
256 |
+
$('#ewwwio-easy-activation-result').removeClass('error');
|
257 |
+
$('#ewwwio-easy-activation-result').show();
|
258 |
+
$('.ewwwio-exactdn-options input').prop('disabled', false);
|
259 |
+
$('.ewwwio-exactdn-options').show();
|
260 |
+
$('#ewwwio-easy-activation-progressbar').hide();
|
261 |
+
$('#ewww_image_optimizer_webp_container').hide();
|
262 |
+
$('.ewww_image_optimizer_webp_setting_container').hide();
|
263 |
+
$('.ewww_image_optimizer_webp_rewrite_setting_container').hide();
|
264 |
+
$('#ewww_image_optimizer_webp_easyio_container').show();
|
265 |
+
}
|
266 |
+
});
|
267 |
+
return false;
|
268 |
+
}
|
269 |
+
$('#ewwwio-easy-register-network').on( 'click', function() {
|
270 |
+
if (!confirm(ewww_vars.easyio_register_warning)) {
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
exactdn_blog_ids = Array.from(ewww_vars.network_blog_ids);
|
274 |
+
exactdn_blog_count = exactdn_blog_ids.length;
|
275 |
+
$('#ewww_image_optimizer_exactdn_container .button-secondary').hide();
|
276 |
+
//$('#ewwwio-easy-activate-network').hide();
|
277 |
+
//$('#ewwwio-easy-register-network').hide();
|
278 |
+
//$('#ewwwio-easy-deactivate').hide();
|
279 |
+
$('#ewwwio-easy-cancel-network-operation').show();
|
280 |
+
$('#ewwwio-easy-activation-result').hide();
|
281 |
+
$('#ewwwio-easy-activation-processing').show();
|
282 |
+
$('#ewwwio-easy-activation-progressbar').progressbar({ max: exactdn_blog_count });
|
283 |
+
$('#ewwwio-easy-activation-progressbar').show();
|
284 |
+
registerExactDNSite();
|
285 |
+
return false;
|
286 |
+
});
|
287 |
+
function registerExactDNSite() {
|
288 |
+
var ewww_post_data = {
|
289 |
+
action: 'ewww_exactdn_register_site',
|
290 |
+
ewww_wpnonce: ewww_vars._wpnonce,
|
291 |
+
blog_id: exactdn_blog_ids.pop(),
|
292 |
+
};
|
293 |
+
$.post(ajaxurl, ewww_post_data, function(response) {
|
294 |
+
try {
|
295 |
+
var ewww_response = JSON.parse(response);
|
296 |
+
} catch (err) {
|
297 |
+
$('#ewwwio-easy-activation-processing').hide();
|
298 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.invalid_response);
|
299 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
300 |
+
$('#ewwwio-easy-activation-result').show();
|
301 |
+
$('#ewwwio-easy-cancel-network-operation').hide();
|
302 |
+
console.log( response );
|
303 |
+
return false;
|
304 |
+
}
|
305 |
+
var exactdn_blogs_done = exactdn_blog_count - exactdn_blog_ids.length;
|
306 |
+
if ( ewww_response.error ) {
|
307 |
+
$('#ewwwio-easy-activation-processing').hide();
|
308 |
+
$('#ewwwio-easy-register-network').show();
|
309 |
+
$('#ewwwio-easy-activation-result').html(ewww_response.error);
|
310 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
311 |
+
$('#ewwwio-easy-activation-result').show();
|
312 |
+
$('#ewwwio-easy-cancel-network-operation').hide();
|
313 |
+
return false;
|
314 |
+
} else if ( ! ewww_response.status ) {
|
315 |
+
$('#ewwwio-easy-activation-processing').hide();
|
316 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.invalid_response);
|
317 |
+
$('#ewwwio-easy-activation-result').addClass('error');
|
318 |
+
$('#ewwwio-easy-activation-result').show();
|
319 |
+
$('#ewwwio-easy-cancel-network-operation').hide();
|
320 |
+
console.log( response );
|
321 |
+
return false;
|
322 |
+
} else {
|
323 |
+
$('#ewwwio-easy-activation-processing').hide();
|
324 |
+
$('p.ewwwio-easy-setup-instructions').hide();
|
325 |
+
$('p.ewwwio-easy-description').hide();
|
326 |
+
$('#ewwwio-easy-activation-progressbar').progressbar('option', 'value', exactdn_blogs_done);
|
327 |
+
}
|
328 |
+
if ( exactdn_blog_ids.length ) {
|
329 |
+
registerExactDNSite();
|
330 |
+
} else {
|
331 |
+
if (exactdn_cancelled) {
|
332 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.operation_stopped);
|
333 |
+
} else {
|
334 |
+
$('#ewwwio-easy-activation-result').html(ewww_vars.easyio_register_success);
|
335 |
+
}
|
336 |
+
$('#ewwwio-easy-activation-result').removeClass('error');
|
337 |
+
$('#ewwwio-easy-activation-result').show();
|
338 |
+
$('#ewwwio-easy-cancel-network-operation').hide();
|
339 |
+
$('#ewwwio-easy-activation-progressbar').hide();
|
340 |
+
$('#ewwwio-easy-activate-network').show();
|
341 |
+
}
|
342 |
+
});
|
343 |
+
return false;
|
344 |
+
}
|
345 |
+
$('#ewwwio-easy-cancel-network-operation').on('click', function() {
|
346 |
+
exactdn_blog_ids = [];
|
347 |
+
exactdn_cancelled = true;
|
348 |
+
$('#ewwwio-easy-cancel-network-operation').hide();
|
349 |
+
return false;
|
350 |
+
})
|
351 |
$('#ewww_image_optimizer_webp').on(
|
352 |
'click',
|
353 |
function() {
|
includes/jquery-ui-1.10.1.custom.css
CHANGED
@@ -712,7 +712,7 @@ div#ewww-webp-rewrite-status {
|
|
712 |
p#ewww-webp-rewrite-status {
|
713 |
font-style: italic;
|
714 |
}
|
715 |
-
#ewwwio-easy-activate, #ewwwio-easy-deactivate {
|
716 |
margin-top: 10px;
|
717 |
}
|
718 |
.ewwwio-notice {
|
@@ -743,6 +743,9 @@ p#ewww-webp-rewrite-status {
|
|
743 |
#ewwwio-api-activation-result.error, #ewwwio-easy-activation-result.error, #ewww-webp-rewrite-result.error {
|
744 |
border-left-color: #dc3232;
|
745 |
}
|
|
|
|
|
|
|
746 |
#ewww-webp-rewrite-result p {
|
747 |
/* margin: 0.5em 0; */
|
748 |
}
|
712 |
p#ewww-webp-rewrite-status {
|
713 |
font-style: italic;
|
714 |
}
|
715 |
+
#ewwwio-easy-activate, #ewwwio-easy-deactivate, #ewwwio-easy-activate-network, #ewwwio-easy-register-network {
|
716 |
margin-top: 10px;
|
717 |
}
|
718 |
.ewwwio-notice {
|
743 |
#ewwwio-api-activation-result.error, #ewwwio-easy-activation-result.error, #ewww-webp-rewrite-result.error {
|
744 |
border-left-color: #dc3232;
|
745 |
}
|
746 |
+
#ewwwio-easy-activation-progressbar {
|
747 |
+
margin: 10px 0;
|
748 |
+
}
|
749 |
#ewww-webp-rewrite-result p {
|
750 |
/* margin: 0.5em 0; */
|
751 |
}
|
includes/lazysizes-post.js
CHANGED
@@ -161,6 +161,9 @@ 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 {
|
165 |
console.log('plain old img, constraining');
|
166 |
var newSrc = constrainSrc(src,targetWidth,targetHeight,'img');
|
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');
|
167 |
} else {
|
168 |
console.log('plain old img, constraining');
|
169 |
var newSrc = constrainSrc(src,targetWidth,targetHeight,'img');
|
includes/lazysizes.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
if(void 0===ewww_webp_supported)var ewww_webp_supported=!1;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);var d=r.exec(e);if(d&&t<=d[1]){if("bg-cover"!==i&&"img-crop"!==i)return e.replace(r,"w="+t);var c=d[1]-t;return 20<c||a<1080?e.replace(r,"resize="+t+","+a):e}var u=n.exec(s);if(u&&t<u[1]){if("bg-cover"!==i&&"img-crop"!==i)return s.replace(n,"fit="+t+","+a);var f=u[1]-t,g=u[2]-a;return 20<f||20<g?e.replace(r,"resize="+t+","+a):e}if(!d&&!u&&!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}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){var a=function(){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(o,e,s){"use strict";var l;e.addEventListener&&(l=/\(|\)|\s|'/,addEventListener("lazybeforeunveil",function(e){var t,a;if(e.detail.instance==s&&(!e.defaultPrevented&&("none"==e.target.preload&&(e.target.preload="auto"),t=e.target.getAttribute("data-bg")))){ewww_webp_supported&&(a=e.target.getAttribute("data-bg-webp"))&&(t=a);var i=o.devicePixelRatio||1,r=Math.round(e.target.offsetWidth*i),n=Math.round(e.target.offsetHeight*i);shouldAutoScale(e.target)&&shouldAutoScale(e.target.parentNode)&&(t=o.lazySizes.hC(e.target,"wp-block-cover")?(o.lazySizes.hC(e.target,"has-parallax")?(r=Math.round(o.screen.width*i),n=Math.round(o.screen.height*i)):n<300&&(n=430),constrainSrc(t,r,n,"bg-cover")):o.lazySizes.hC(e.target,"elementor-bg")?constrainSrc(t,r,n,"bg-cover"):constrainSrc(t,r,n,"bg")),e.target.style.backgroundImage="url("+(l.test(t)?JSON.stringify(t):t)+")"}},!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=e.target,a=t.getAttribute("data-srcset");if(t.naturalWidth&&!a&&1<t.naturalWidth&&1<t.naturalHeight){var i=window.devicePixelRatio||1,r=t.naturalWidth,n=t.naturalHeight,o=t.getAttribute("data-eio-rwidth"),s=t.getAttribute("data-eio-rheight");o&&r<o&&(r=o,n=s);var l=t.clientWidth&&1.25*t.clientWidth<r,d=t.clientHeight&&1.25*t.clientHeight<n;if(l||d){var c=Math.round(t.offsetWidth*i),u=Math.round(t.offsetHeight*i),f=t.getAttribute("data-src"),g=t.getAttribute("data-src-webp");if(ewww_webp_supported&&g&&-1==f.search("webp=1")&&(f=g),shouldAutoScale(t)&&shouldAutoScale(t.parentNode))if(window.lazySizes.hC(t,"et_pb_jt_filterable_grid_item_image")||window.lazySizes.hC(t,"ss-foreground-image")||window.lazySizes.hC(t,"img-crop"))h=constrainSrc(f,c,u,"img-crop");else h=constrainSrc(f,c,u,"img");else var h=!1;h&&f!=h&&t.setAttribute("data-src",h)}}if(ewww_webp_supported){if(a){var z=t.getAttribute("data-srcset-webp");z&&t.setAttribute("data-srcset",z)}if(!(g=t.getAttribute("data-src-webp")))return;t.setAttribute("data-src",g)}}),function(e,t){var a=function(i,g,n){"use strict";var h,z;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 z=i.lazySizesConfig||i.lazysizesConfig||{},t)e in z||(z[e]=t[e])}(),!g||!g.getElementsByClassName)return{init:function(){},cfg:z,noSupport:!0};var v=g.documentElement,r=i.HTMLPictureElement,o="addEventListener",m="getAttribute",e=i[o].bind(i),p=i.setTimeout,a=i.requestAnimationFrame||p,s=i.requestIdleCallback,y=/^picture$/i,l=["load","error","lazyincluded","_lazyloaded"],d={},b=Array.prototype.forEach,c=function(e,t){return d[t]||(d[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),d[t].test(e[m]("class")||"")&&d[t]},w=function(e,t){c(e,t)||e.setAttribute("class",(e[m]("class")||"").trim()+" "+t)},_=function(e,t){var a;(a=c(e,t))&&e.setAttribute("class",(e[m]("class")||"").replace(a," "))},C=function(t,a,e){var i=e?o:"removeEventListener";e&&C(t,a),l.forEach(function(e){t[i](e,a)})},A=function(e,t,a,i,r){var n=g.createEvent("Event");return a||(a={}),a.instance=h,n.initEvent(t,!i,!r),n.detail=a,e.dispatchEvent(n),n},E=function(e,t){var a;!r&&(a=i.picturefill||z.pf)?(t&&t.src&&!e[m]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)},u=function(e,t){return(getComputedStyle(e,null)||{})[t]},f=function(e,t,a){for(a=a||e.offsetWidth;a<z.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},S=(_e=[],Ce=[],Ae=_e,Ee=function(){var e=Ae;for(Ae=_e.length?Ce:_e,we=!(be=!0);e.length;)e.shift()();be=!1},Se=function(e,t){be&&!t?e.apply(this,arguments):(Ae.push(e),we||(we=!0,(g.hidden?p:a)(Ee)))},Se._lsFlush=Ee,Se),t=function(a,e){return e?function(){S(a)}:function(){var e=this,t=arguments;S(function(){a.apply(e,t)})}},x=function(e){var t,a,i=function(){t=null,e()},r=function(){var e=n.now()-a;e<99?p(r,99-e):(s||i)(i)};return function(){a=n.now(),t||(t=p(r,99))}},M=(ee=/^img$/i,te=/^iframe$/i,ae="onscroll"in i&&!/(gle|ing)bot/.test(navigator.userAgent),ie=0,re=0,ne=-1,oe=function(e){re--,(!e||re<0||!e.target)&&(re=0)},se=function(e){return null==J&&(J="hidden"==u(g.body,"visibility")),J||!("hidden"==u(e.parentNode,"visibility")&&"hidden"==u(e,"visibility"))},le=function(e,t){var a,i=e,r=se(e);for($-=t,U+=t,q-=t,j+=t;r&&(i=i.offsetParent)&&i!=g.body&&i!=v;)(r=0<(u(i,"opacity")||1))&&"visible"!=u(i,"overflow")&&(a=i.getBoundingClientRect(),r=j>a.left&&q<a.right&&U>a.top-1&&$<a.bottom+1);return r},de=function(){var e,t,a,i,r,n,o,s,l,d,c,u,f=h.elements;if((P=z.loadMode)&&re<8&&(e=f.length)){for(t=0,ne++;t<e;t++)if(f[t]&&!f[t]._lazyRace)if(!ae||h.prematureUnveil&&h.prematureUnveil(f[t]))ve(f[t]);else if((s=f[t][m]("data-expand"))&&(n=1*s)||(n=ie),d||(d=!z.expand||z.expand<1?500<v.clientHeight&&500<v.clientWidth?500:370:z.expand,h._defEx=d,c=d*z.expFactor,u=z.hFac,J=null,ie<c&&re<1&&2<ne&&2<P&&!g.hidden?(ie=c,ne=0):ie=1<P&&1<ne&&re<6?d:0),l!==n&&(O=innerWidth+n*u,I=innerHeight+n,o=-1*n,l=n),a=f[t].getBoundingClientRect(),(U=a.bottom)>=o&&($=a.top)<=I&&(j=a.right)>=o*u&&(q=a.left)<=O&&(U||j||q||$)&&(z.loadHidden||se(f[t]))&&(T&&re<3&&!s&&(P<3||ne<4)||le(f[t],n))){if(ve(f[t]),r=!0,9<re)break}else!r&&T&&!i&&re<4&&ne<4&&2<P&&(B[0]||z.preloadAfterLoad)&&(B[0]||!s&&(U||j||q||$||"auto"!=f[t][m](z.sizesAttr)))&&(i=B[0]||f[t]);i&&!r&&ve(i)}},G=de,Q=0,V=z.throttleDelay,X=z.ricTimeout,Y=function(){K=!1,Q=n.now(),G()},Z=s&&49<X?function(){s(Y,{timeout:X}),X!==z.ricTimeout&&(X=z.ricTimeout)}:t(function(){p(Y)},!0),ce=function(e){var t;(e=!0===e)&&(X=33),K||(K=!0,(t=V-(n.now()-Q))<0&&(t=0),e||t<9?Z():p(Z,t))},ue=function(e){var t=e.target;t._lazyCache?delete t._lazyCache:(oe(e),w(t,z.loadedClass),_(t,z.loadingClass),C(t,ge),A(t,"lazyloaded"))},fe=t(ue),ge=function(e){fe({target:e.target})},he=function(e){var t,a=e[m](z.srcsetAttr);(t=z.customMedia[e[m]("data-media")||e[m]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)},ze=t(function(t,e,a,i,r){var n,o,s,l,d,c,u,f,g;(d=A(t,"lazybeforeunveil",e)).defaultPrevented||(i&&(a?w(t,z.autosizesClass):t.setAttribute("sizes",i)),o=t[m](z.srcsetAttr),n=t[m](z.srcAttr),r&&(s=t.parentNode,l=s&&y.test(s.nodeName||"")),c=e.firesLoad||"src"in t&&(o||n||l),d={target:t},w(t,z.loadingClass),c&&(clearTimeout(F),F=p(oe,2500),C(t,ge,!0)),l&&b.call(s.getElementsByTagName("source"),he),o?t.setAttribute("srcset",o):n&&!l&&(te.test(t.nodeName)?(f=n,0==(g=(u=t).getAttribute("data-load-mode")||z.iframeLoadMode)?u.contentWindow.location.replace(f):1==g&&(u.src=f)):t.src=n),r&&(o||l)&&E(t,{src:n})),t._lazyRace&&delete t._lazyRace,_(t,z.lazyClass),S(function(){var e=t.complete&&1<t.naturalWidth;c&&!e||(e&&w(t,z.fastLoadedClass),ue(d),t._lazyCache=!0,p(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&re--},!0)}),ve=function(e){if(!e._lazyRace){var t,a=ee.test(e.nodeName),i=a&&(e[m](z.sizesAttr)||e[m]("sizes")),r="auto"==i;(!r&&T||!a||!e[m]("src")&&!e.srcset||e.complete||c(e,z.errorClass)||!c(e,z.lazyClass))&&(t=A(e,"lazyunveilread").detail,r&&W.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,re++,ze(e,t,r,i,a))}},me=x(function(){z.loadMode=3,ce()}),pe=function(){3==z.loadMode&&(z.loadMode=2),me()},ye=function(){T||(n.now()-D<999?p(ye,999):(T=!0,z.loadMode=3,ce(),e("scroll",pe,!0)))},{_:function(){D=n.now(),h.elements=g.getElementsByClassName(z.lazyClass),B=g.getElementsByClassName(z.lazyClass+" "+z.preloadClass),e("scroll",ce,!0),e("resize",ce,!0),e("pageshow",function(e){if(e.persisted){var t=g.querySelectorAll("."+z.loadingClass);t.length&&t.forEach&&a(function(){t.forEach(function(e){e.complete&&ve(e)})})}}),i.MutationObserver?new MutationObserver(ce).observe(v,{childList:!0,subtree:!0,attributes:!0}):(v[o]("DOMNodeInserted",ce,!0),v[o]("DOMAttrModified",ce,!0),setInterval(ce,999)),e("hashchange",ce,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){g[o](e,ce,!0)}),/d$|^c/.test(g.readyState)?ye():(e("load",ye),g[o]("DOMContentLoaded",ce),p(ye,2e4)),h.elements.length?(de(),S._lsFlush()):ce()},checkElems:ce,unveil:ve,_aLSL:pe}),W=(H=t(function(e,t,a,i){var r,n,o;if(e._lazysizesWidth=i,i+="px",e.setAttribute("sizes",i),y.test(t.nodeName||""))for(r=t.getElementsByTagName("source"),n=0,o=r.length;n<o;n++)r[n].setAttribute("sizes",i);a.detail.dataAttr||E(e,a.detail)}),R=function(e,t,a){var i,r=e.parentNode;r&&(a=f(e,r,a),(i=A(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=i.detail.width)&&a!==e._lazysizesWidth&&H(e,r,i,a))},k=x(function(){var e,t=N.length;if(t)for(e=0;e<t;e++)R(N[e])}),{_:function(){N=g.getElementsByClassName(z.autosizesClass),e("resize",k)},checkElems:k,updateElem:R}),L=function(){!L.i&&g.getElementsByClassName&&(L.i=!0,W._(),M._())};var N,H,R,k;var B,T,F,P,D,O,I,$,q,j,U,J,G,K,Q,V,X,Y,Z,ee,te,ae,ie,re,ne,oe,se,le,de,ce,ue,fe,ge,he,ze,ve,me,pe,ye;var be,we,_e,Ce,Ae,Ee,Se;return p(function(){z.init&&L()}),h={cfg:z,autoSizer:W,loader:M,init:L,uP:E,aC:w,rC:_,hC:c,fire:A,gW:f,rAF:S}}(e,e.document,Date);e.lazySizes=a,"object"==typeof module&&module.exports&&(module.exports=a)}("undefined"!=typeof window?window:{});
|
1 |
+
if(void 0===ewww_webp_supported)var ewww_webp_supported=!1;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);var d=r.exec(e);if(d&&t<=d[1]){if("bg-cover"!==i&&"img-crop"!==i)return e.replace(r,"w="+t);var c=d[1]-t;return 20<c||a<1080?e.replace(r,"resize="+t+","+a):e}var u=n.exec(s);if(u&&t<u[1]){if("bg-cover"!==i&&"img-crop"!==i)return s.replace(n,"fit="+t+","+a);var f=u[1]-t,g=u[2]-a;return 20<f||20<g?e.replace(r,"resize="+t+","+a):e}if(!d&&!u&&!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}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){var a=function(){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(o,e,s){"use strict";var l;e.addEventListener&&(l=/\(|\)|\s|'/,addEventListener("lazybeforeunveil",function(e){var t,a;if(e.detail.instance==s&&(!e.defaultPrevented&&("none"==e.target.preload&&(e.target.preload="auto"),t=e.target.getAttribute("data-bg")))){ewww_webp_supported&&(a=e.target.getAttribute("data-bg-webp"))&&(t=a);var i=o.devicePixelRatio||1,r=Math.round(e.target.offsetWidth*i),n=Math.round(e.target.offsetHeight*i);shouldAutoScale(e.target)&&shouldAutoScale(e.target.parentNode)&&(t=o.lazySizes.hC(e.target,"wp-block-cover")?(o.lazySizes.hC(e.target,"has-parallax")?(r=Math.round(o.screen.width*i),n=Math.round(o.screen.height*i)):n<300&&(n=430),constrainSrc(t,r,n,"bg-cover")):o.lazySizes.hC(e.target,"elementor-bg")?constrainSrc(t,r,n,"bg-cover"):constrainSrc(t,r,n,"bg")),e.target.style.backgroundImage="url("+(l.test(t)?JSON.stringify(t):t)+")"}},!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=e.target,a=t.getAttribute("data-srcset");if(t.naturalWidth&&!a&&1<t.naturalWidth&&1<t.naturalHeight){var i=window.devicePixelRatio||1,r=t.naturalWidth,n=t.naturalHeight,o=t.getAttribute("data-eio-rwidth"),s=t.getAttribute("data-eio-rheight");o&&r<o&&(r=o,n=s);var l=t.clientWidth&&1.25*t.clientWidth<r,d=t.clientHeight&&1.25*t.clientHeight<n;if(l||d){var c=Math.round(t.offsetWidth*i),u=Math.round(t.offsetHeight*i),f=t.getAttribute("data-src"),g=t.getAttribute("data-src-webp");if(ewww_webp_supported&&g&&-1==f.search("webp=1")&&(f=g),shouldAutoScale(t)&&shouldAutoScale(t.parentNode))if(window.lazySizes.hC(t,"et_pb_jt_filterable_grid_item_image")||window.lazySizes.hC(t,"ss-foreground-image")||window.lazySizes.hC(t,"img-crop"))h=constrainSrc(f,c,u,"img-crop");else if(window.lazySizes.hC(t,"ct-image")&&window.lazySizes.hC(t,"object-cover"))h=constrainSrc(f,c,u,"img-crop");else h=constrainSrc(f,c,u,"img");else var h=!1;h&&f!=h&&t.setAttribute("data-src",h)}}if(ewww_webp_supported){if(a){var z=t.getAttribute("data-srcset-webp");z&&t.setAttribute("data-srcset",z)}if(!(g=t.getAttribute("data-src-webp")))return;t.setAttribute("data-src",g)}}),function(e,t){var a=function(i,g,n){"use strict";var h,z;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 z=i.lazySizesConfig||i.lazysizesConfig||{},t)e in z||(z[e]=t[e])}(),!g||!g.getElementsByClassName)return{init:function(){},cfg:z,noSupport:!0};var v=g.documentElement,r=i.HTMLPictureElement,o="addEventListener",m="getAttribute",e=i[o].bind(i),p=i.setTimeout,a=i.requestAnimationFrame||p,s=i.requestIdleCallback,y=/^picture$/i,l=["load","error","lazyincluded","_lazyloaded"],d={},b=Array.prototype.forEach,c=function(e,t){return d[t]||(d[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),d[t].test(e[m]("class")||"")&&d[t]},w=function(e,t){c(e,t)||e.setAttribute("class",(e[m]("class")||"").trim()+" "+t)},_=function(e,t){var a;(a=c(e,t))&&e.setAttribute("class",(e[m]("class")||"").replace(a," "))},C=function(t,a,e){var i=e?o:"removeEventListener";e&&C(t,a),l.forEach(function(e){t[i](e,a)})},A=function(e,t,a,i,r){var n=g.createEvent("Event");return a||(a={}),a.instance=h,n.initEvent(t,!i,!r),n.detail=a,e.dispatchEvent(n),n},S=function(e,t){var a;!r&&(a=i.picturefill||z.pf)?(t&&t.src&&!e[m]("srcset")&&e.setAttribute("srcset",t.src),a({reevaluate:!0,elements:[e]})):t&&t.src&&(e.src=t.src)},u=function(e,t){return(getComputedStyle(e,null)||{})[t]},f=function(e,t,a){for(a=a||e.offsetWidth;a<z.minSize&&t&&!e._lazysizesWidth;)a=t.offsetWidth,t=t.parentNode;return a},E=(_e=[],Ce=[],Ae=_e,Se=function(){var e=Ae;for(Ae=_e.length?Ce:_e,we=!(be=!0);e.length;)e.shift()();be=!1},Ee=function(e,t){be&&!t?e.apply(this,arguments):(Ae.push(e),we||(we=!0,(g.hidden?p:a)(Se)))},Ee._lsFlush=Se,Ee),t=function(a,e){return e?function(){E(a)}:function(){var e=this,t=arguments;E(function(){a.apply(e,t)})}},x=function(e){var t,a,i=function(){t=null,e()},r=function(){var e=n.now()-a;e<99?p(r,99-e):(s||i)(i)};return function(){a=n.now(),t||(t=p(r,99))}},M=(ee=/^img$/i,te=/^iframe$/i,ae="onscroll"in i&&!/(gle|ing)bot/.test(navigator.userAgent),ie=0,re=0,ne=-1,oe=function(e){re--,(!e||re<0||!e.target)&&(re=0)},se=function(e){return null==J&&(J="hidden"==u(g.body,"visibility")),J||!("hidden"==u(e.parentNode,"visibility")&&"hidden"==u(e,"visibility"))},le=function(e,t){var a,i=e,r=se(e);for($-=t,U+=t,j-=t,q+=t;r&&(i=i.offsetParent)&&i!=g.body&&i!=v;)(r=0<(u(i,"opacity")||1))&&"visible"!=u(i,"overflow")&&(a=i.getBoundingClientRect(),r=q>a.left&&j<a.right&&U>a.top-1&&$<a.bottom+1);return r},de=function(){var e,t,a,i,r,n,o,s,l,d,c,u,f=h.elements;if((P=z.loadMode)&&re<8&&(e=f.length)){for(t=0,ne++;t<e;t++)if(f[t]&&!f[t]._lazyRace)if(!ae||h.prematureUnveil&&h.prematureUnveil(f[t]))ve(f[t]);else if((s=f[t][m]("data-expand"))&&(n=1*s)||(n=ie),d||(d=!z.expand||z.expand<1?500<v.clientHeight&&500<v.clientWidth?500:370:z.expand,h._defEx=d,c=d*z.expFactor,u=z.hFac,J=null,ie<c&&re<1&&2<ne&&2<P&&!g.hidden?(ie=c,ne=0):ie=1<P&&1<ne&&re<6?d:0),l!==n&&(O=innerWidth+n*u,I=innerHeight+n,o=-1*n,l=n),a=f[t].getBoundingClientRect(),(U=a.bottom)>=o&&($=a.top)<=I&&(q=a.right)>=o*u&&(j=a.left)<=O&&(U||q||j||$)&&(z.loadHidden||se(f[t]))&&(T&&re<3&&!s&&(P<3||ne<4)||le(f[t],n))){if(ve(f[t]),r=!0,9<re)break}else!r&&T&&!i&&re<4&&ne<4&&2<P&&(B[0]||z.preloadAfterLoad)&&(B[0]||!s&&(U||q||j||$||"auto"!=f[t][m](z.sizesAttr)))&&(i=B[0]||f[t]);i&&!r&&ve(i)}},G=de,Q=0,V=z.throttleDelay,X=z.ricTimeout,Y=function(){K=!1,Q=n.now(),G()},Z=s&&49<X?function(){s(Y,{timeout:X}),X!==z.ricTimeout&&(X=z.ricTimeout)}:t(function(){p(Y)},!0),ce=function(e){var t;(e=!0===e)&&(X=33),K||(K=!0,(t=V-(n.now()-Q))<0&&(t=0),e||t<9?Z():p(Z,t))},ue=function(e){var t=e.target;t._lazyCache?delete t._lazyCache:(oe(e),w(t,z.loadedClass),_(t,z.loadingClass),C(t,ge),A(t,"lazyloaded"))},fe=t(ue),ge=function(e){fe({target:e.target})},he=function(e){var t,a=e[m](z.srcsetAttr);(t=z.customMedia[e[m]("data-media")||e[m]("media")])&&e.setAttribute("media",t),a&&e.setAttribute("srcset",a)},ze=t(function(t,e,a,i,r){var n,o,s,l,d,c,u,f,g;(d=A(t,"lazybeforeunveil",e)).defaultPrevented||(i&&(a?w(t,z.autosizesClass):t.setAttribute("sizes",i)),o=t[m](z.srcsetAttr),n=t[m](z.srcAttr),r&&(s=t.parentNode,l=s&&y.test(s.nodeName||"")),c=e.firesLoad||"src"in t&&(o||n||l),d={target:t},w(t,z.loadingClass),c&&(clearTimeout(F),F=p(oe,2500),C(t,ge,!0)),l&&b.call(s.getElementsByTagName("source"),he),o?t.setAttribute("srcset",o):n&&!l&&(te.test(t.nodeName)?(f=n,0==(g=(u=t).getAttribute("data-load-mode")||z.iframeLoadMode)?u.contentWindow.location.replace(f):1==g&&(u.src=f)):t.src=n),r&&(o||l)&&S(t,{src:n})),t._lazyRace&&delete t._lazyRace,_(t,z.lazyClass),E(function(){var e=t.complete&&1<t.naturalWidth;c&&!e||(e&&w(t,z.fastLoadedClass),ue(d),t._lazyCache=!0,p(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&re--},!0)}),ve=function(e){if(!e._lazyRace){var t,a=ee.test(e.nodeName),i=a&&(e[m](z.sizesAttr)||e[m]("sizes")),r="auto"==i;(!r&&T||!a||!e[m]("src")&&!e.srcset||e.complete||c(e,z.errorClass)||!c(e,z.lazyClass))&&(t=A(e,"lazyunveilread").detail,r&&W.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,re++,ze(e,t,r,i,a))}},me=x(function(){z.loadMode=3,ce()}),pe=function(){3==z.loadMode&&(z.loadMode=2),me()},ye=function(){T||(n.now()-D<999?p(ye,999):(T=!0,z.loadMode=3,ce(),e("scroll",pe,!0)))},{_:function(){D=n.now(),h.elements=g.getElementsByClassName(z.lazyClass),B=g.getElementsByClassName(z.lazyClass+" "+z.preloadClass),e("scroll",ce,!0),e("resize",ce,!0),e("pageshow",function(e){if(e.persisted){var t=g.querySelectorAll("."+z.loadingClass);t.length&&t.forEach&&a(function(){t.forEach(function(e){e.complete&&ve(e)})})}}),i.MutationObserver?new MutationObserver(ce).observe(v,{childList:!0,subtree:!0,attributes:!0}):(v[o]("DOMNodeInserted",ce,!0),v[o]("DOMAttrModified",ce,!0),setInterval(ce,999)),e("hashchange",ce,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){g[o](e,ce,!0)}),/d$|^c/.test(g.readyState)?ye():(e("load",ye),g[o]("DOMContentLoaded",ce),p(ye,2e4)),h.elements.length?(de(),E._lsFlush()):ce()},checkElems:ce,unveil:ve,_aLSL:pe}),W=(H=t(function(e,t,a,i){var r,n,o;if(e._lazysizesWidth=i,i+="px",e.setAttribute("sizes",i),y.test(t.nodeName||""))for(r=t.getElementsByTagName("source"),n=0,o=r.length;n<o;n++)r[n].setAttribute("sizes",i);a.detail.dataAttr||S(e,a.detail)}),R=function(e,t,a){var i,r=e.parentNode;r&&(a=f(e,r,a),(i=A(e,"lazybeforesizes",{width:a,dataAttr:!!t})).defaultPrevented||(a=i.detail.width)&&a!==e._lazysizesWidth&&H(e,r,i,a))},k=x(function(){var e,t=N.length;if(t)for(e=0;e<t;e++)R(N[e])}),{_:function(){N=g.getElementsByClassName(z.autosizesClass),e("resize",k)},checkElems:k,updateElem:R}),L=function(){!L.i&&g.getElementsByClassName&&(L.i=!0,W._(),M._())};var N,H,R,k;var B,T,F,P,D,O,I,$,j,q,U,J,G,K,Q,V,X,Y,Z,ee,te,ae,ie,re,ne,oe,se,le,de,ce,ue,fe,ge,he,ze,ve,me,pe,ye;var be,we,_e,Ce,Ae,Se,Ee;return p(function(){z.init&&L()}),h={cfg:z,autoSizer:W,loader:M,init:L,uP:S,aC:w,rC:_,hC:c,fire:A,gW:f,rAF:E}}(e,e.document,Date);e.lazySizes=a,"object"==typeof module&&module.exports&&(module.exports=a)}("undefined"!=typeof window?window:{});
|
includes/resize-detection.js
CHANGED
@@ -3,13 +3,17 @@ window.onload = function() {
|
|
3 |
var adminBarButton = document.getElementById('wp-admin-bar-resize-detection');
|
4 |
if (adminBarButton) {
|
5 |
adminBarButton.onclick = function() {
|
|
|
6 |
clearScaledImages();
|
7 |
checkImageSizes();
|
|
|
|
|
|
|
8 |
};
|
9 |
}
|
10 |
}
|
11 |
function checkImageSizes() {
|
12 |
-
// Find images which have width or height
|
13 |
// width or height, and give them a stark and ugly marker, as well
|
14 |
// as a useful title.
|
15 |
var imgs = document.getElementsByTagName("img");
|
3 |
var adminBarButton = document.getElementById('wp-admin-bar-resize-detection');
|
4 |
if (adminBarButton) {
|
5 |
adminBarButton.onclick = function() {
|
6 |
+
adminBarButton.classList.toggle('ewww-fade');
|
7 |
clearScaledImages();
|
8 |
checkImageSizes();
|
9 |
+
setTimeout(function() {
|
10 |
+
adminBarButton.classList.toggle('ewww-fade');
|
11 |
+
}, 500);
|
12 |
};
|
13 |
}
|
14 |
}
|
15 |
function checkImageSizes() {
|
16 |
+
// Find images which have width or height greater than their natural
|
17 |
// width or height, and give them a stark and ugly marker, as well
|
18 |
// as a useful title.
|
19 |
var imgs = document.getElementsByTagName("img");
|
includes/resize-detection.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function checkImageSizes(){var e=document.getElementsByTagName("img");for(i=0;i<e.length;i++)e[i].classList.remove("scaled-image"),checkImageScale(e[i]);return!1}function checkImageScale(e){if(e.src&&!("string"==typeof e.src&&-1<e.src.search(/\.svg/))&&!("string"==typeof e.src&&-1<e.src.search(/data:image/))&&e.naturalWidth&&25<e.naturalWidth&&25<e.naturalHeight&&25<e.clientWidth&&25<e.clientHeight){var t=window.devicePixelRatio||1,a=1.5*e.clientWidth*t<e.naturalWidth,i=1.5*e.clientHeight*t<e.naturalHeight;(a||i)&&(e.classList.add("scaled-image"),e.title="Forced to wrong size: "+e.clientWidth+"x"+e.clientHeight+", natural is "+e.naturalWidth+"x"+e.naturalHeight+"!")}}function clearScaledImages(){for(var e=document.querySelectorAll("img.scaled-image"),t=0,a=e.length;t<a;t++)e[t].classList.remove("scaled-image")}window.onload=function(){checkImageSizes();var e=document.getElementById("wp-admin-bar-resize-detection");e&&(e.onclick=function(){clearScaledImages(),checkImageSizes()})},document.addEventListener("lazyloaded",function(e){e.target.classList.remove("scaled-image"),0===e.target.title.search("Forced to wrong size")&&(e.target.title=""),checkImageScale(e.target)});
|
1 |
+
function checkImageSizes(){var e=document.getElementsByTagName("img");for(i=0;i<e.length;i++)e[i].classList.remove("scaled-image"),checkImageScale(e[i]);return!1}function checkImageScale(e){if(e.src&&!("string"==typeof e.src&&-1<e.src.search(/\.svg/))&&!("string"==typeof e.src&&-1<e.src.search(/data:image/))&&e.naturalWidth&&25<e.naturalWidth&&25<e.naturalHeight&&25<e.clientWidth&&25<e.clientHeight){var t=window.devicePixelRatio||1,a=1.5*e.clientWidth*t<e.naturalWidth,i=1.5*e.clientHeight*t<e.naturalHeight;(a||i)&&(e.classList.add("scaled-image"),e.title="Forced to wrong size: "+e.clientWidth+"x"+e.clientHeight+", natural is "+e.naturalWidth+"x"+e.naturalHeight+"!")}}function clearScaledImages(){for(var e=document.querySelectorAll("img.scaled-image"),t=0,a=e.length;t<a;t++)e[t].classList.remove("scaled-image")}window.onload=function(){checkImageSizes();var e=document.getElementById("wp-admin-bar-resize-detection");e&&(e.onclick=function(){e.classList.toggle("ewww-fade"),clearScaledImages(),checkImageSizes(),setTimeout(function(){e.classList.toggle("ewww-fade")},500)})},document.addEventListener("lazyloaded",function(e){e.target.classList.remove("scaled-image"),0===e.target.title.search("Forced to wrong size")&&(e.target.title=""),checkImageScale(e.target)});
|
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: 5.8
|
7 |
Requires PHP: 7.1
|
8 |
-
Stable tag: 6.2.
|
9 |
License: GPLv3
|
10 |
|
11 |
Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
|
@@ -88,6 +88,11 @@ To find out if your webhost works with the EWWW Image Optimizer, you can check t
|
|
88 |
|
89 |
== Frequently Asked Questions ==
|
90 |
|
|
|
|
|
|
|
|
|
|
|
91 |
= Google Pagespeed says my images need compressing or resizing, but I already optimized all my images. What do I do? =
|
92 |
|
93 |
Try this for starters: [https://docs.ewww.io/article/5-pagespeed-says-my-images-need-more-work](https://docs.ewww.io/article/5-pagespeed-says-my-images-need-more-work)
|
@@ -132,6 +137,18 @@ That's not a question, but since I made it up, I'll answer it. See this resource
|
|
132 |
* Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io/b/features)
|
133 |
* 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/)
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
= 6.2.3 =
|
136 |
* fixed: db error when MariaDB 10.1 does not permit ALTER for setting default column value
|
137 |
* fixed: Lazy Load missing placeholder folder when Easy IO is enabled
|
@@ -174,76 +191,6 @@ That's not a question, but since I made it up, I'll answer it. See this resource
|
|
174 |
* fixed: Add Missing Dimensions overwrites smaller width/height attribute if only one is set
|
175 |
* fixed: replacing an existing attribute (like width) with a numeric value is broken
|
176 |
|
177 |
-
= 6.1.9 =
|
178 |
-
* fixed: Easy IO's Include All Resources compat with Oxygen Builder and Beaver Builder
|
179 |
-
* fixed: regex to detect SVG images in use elements caused excessive backtracking
|
180 |
-
* fixed: WebP version of full-size image not removed when attachment deleted due to undefined variable
|
181 |
-
* fixed: Easy IO adds invalid zoom parameter of 1920 to srcset URL
|
182 |
-
|
183 |
-
= 6.1.8 =
|
184 |
-
* fixed: Lazy Load fails to auto-scale with img-crop class for Easy IO
|
185 |
-
* fixed: WebP files sometimes fail to be re-generated after Photo Engine (WP/LR) sync
|
186 |
-
* fixed: Lazy Load throws JS error in SCRIPT_DEBUG mode
|
187 |
-
|
188 |
-
= 6.1.7 =
|
189 |
-
* fixed: syntax error due to trailing comma after last parameter in function call(s).
|
190 |
-
|
191 |
-
= 6.1.6 =
|
192 |
-
* added: support for BuddyPress uploads via Vikinger theme.
|
193 |
-
* added: compatibility with Weglot.
|
194 |
-
* added: use 'img-crop' id/class, or data-img-crop attribute to force cropping with Easy IO + Lazy Load.
|
195 |
-
* changed: Resize Existing enabled by default for new installs.
|
196 |
-
* changed: Lazy Load JS moved to footer
|
197 |
-
* fixed: prevent Resize Detection from flagging SVG files.
|
198 |
-
|
199 |
-
= 6.1.5 =
|
200 |
-
* changed: use core wp_getimagesize() for proper error handling
|
201 |
-
* fixed: prevent erasing title attributes for admin users when Lazy Load and Resize Detection are enabled
|
202 |
-
* fixed: creates empty file when image is too large for WebP conversion
|
203 |
-
|
204 |
-
= 6.1.4 =
|
205 |
-
* changed: better handling for API quotas
|
206 |
-
* fixed: picture elements not parsed when using JS WebP with Lazy Load
|
207 |
-
* fixed: bundled tools don't work if the binary/tool directory is mounted on a filesystem separate from wp-content/
|
208 |
-
* fixed: bulk optimizer not finding images from cloud storage (like S3) when local versions are removed
|
209 |
-
|
210 |
-
= 6.1.3 =
|
211 |
-
* changed: bulk optimizer no longer skips image types set to "no compression" in WebP-only mode
|
212 |
-
* fixed: CNAME setting from WP Offload Media triggers "unknown" error in Easy IO
|
213 |
-
* fixed: missing EIO_LL_THRESHOLD variable for minified JS
|
214 |
-
|
215 |
-
= 6.1.2 =
|
216 |
-
* fixed: bug from bypass/exclusion code for bulk scanner in 6.1.1
|
217 |
-
* fixed: running is_file on system binaries may trigger open_basedir warnings, use EWWWIO_OPEN_BASEDIR to override PHP's open_basedir restriction
|
218 |
-
|
219 |
-
= 6.1.1 =
|
220 |
-
* change: added setting to enable adding of missing width/height dimensions, disabled by default
|
221 |
-
* fixed: warning from plugins using core wp_lazy_load filter without second parameter/argument
|
222 |
-
|
223 |
-
= 6.1.0 =
|
224 |
-
* added: ability to use SVG placeholders for more efficient lazy load
|
225 |
-
* added: Easy IO and Lazy Load add missing width and height to image elements
|
226 |
-
* added: Lazy Load - right-sized placeholders can be generated for full-sized images
|
227 |
-
* added: configure Lazy Load pre-load threshold via EIO_LL_THRESHOLD constant
|
228 |
-
* changed: Lazy Load for external (non-inline) CSS images must be configured for specific elements
|
229 |
-
* changed: Easy IO's Include All Resources unlocked for all plans
|
230 |
-
* changed: native lazy loading is now disabled when using EWWW IO lazy load, override with EIO_ENABLE_NATIVE_LAZY constant
|
231 |
-
* changed: Lazy Load pre-load threshold increased from 500px to 1000px
|
232 |
-
* changed: Lazy Load picture elements use right-sized img placeholder instead of 1x1 inline GIF
|
233 |
-
* changed: system-installed binary detection improved
|
234 |
-
* fixed: native iframe lazy load disabled in WP 5.7+
|
235 |
-
* fixed: detection for Shield Security plugin lock to location
|
236 |
-
* fixed: relative path migration showing errors in site tools
|
237 |
-
* fixed: WebP rewriters not handling relative image urls
|
238 |
-
* fixed: existing <picture> elements ignored by <picture> WebP Rewriting
|
239 |
-
* fixed: <img> elements inside <picture> elements incorrectly handled by JS WebP Rewriting
|
240 |
-
* fixed: removing metadata clobbers APNG animations
|
241 |
-
* fixed: some JSON elements still being altered by Lazy Load
|
242 |
-
* fixed: Easy IO throws warnings when WP content is not in a sub-directory
|
243 |
-
* updated: jpegtran to version 9d
|
244 |
-
* updated: cwebp to version 1.2.0
|
245 |
-
* updated: pngquant to version 2.13.1
|
246 |
-
|
247 |
= Earlier versions =
|
248 |
Please refer to the separate changelog.txt file.
|
249 |
|
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.5
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 7.1
|
8 |
+
Stable tag: 6.2.4
|
9 |
License: GPLv3
|
10 |
|
11 |
Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
|
88 |
|
89 |
== Frequently Asked Questions ==
|
90 |
|
91 |
+
= Does the plugin remove EXIF and/or IPTC metadata?
|
92 |
+
|
93 |
+
EWWW IO will remove metadata by default, but if you need to keep the EXIF/IPTC data for copyright purposes, you can disable the Remove Metadata option.
|
94 |
+
EXIF data does not impact SEO, and it is recommended by Google (and just about everyone else) to remove EXIF data.
|
95 |
+
|
96 |
= Google Pagespeed says my images need compressing or resizing, but I already optimized all my images. What do I do? =
|
97 |
|
98 |
Try this for starters: [https://docs.ewww.io/article/5-pagespeed-says-my-images-need-more-work](https://docs.ewww.io/article/5-pagespeed-says-my-images-need-more-work)
|
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.2.4 =
|
141 |
+
* added: Multi-site domain-based installs can activate/register sites en masse, and directly upon site creation
|
142 |
+
* changed: improved db upgrade routine for updated column
|
143 |
+
* changed: JS WebP script moved back to page head
|
144 |
+
* fixed: local PNG placeholders enabled with Easy IO when placeholder folder is not writable
|
145 |
+
* fixed: WebP Rewriters not detecting upload URL correctly for CDN support
|
146 |
+
* fixed: iframe lazy loading breaks Gravity Forms and FacetWP when parsing JSON
|
147 |
+
* fixed: is_amp() called too early
|
148 |
+
* fixed: SQL error when running "wp-cli ewwwio optimize media" - props @komsitr
|
149 |
+
* fixed: local savings query sometimes returns no results
|
150 |
+
* fixed: PHP warnings when local tools are disabled
|
151 |
+
|
152 |
= 6.2.3 =
|
153 |
* fixed: db error when MariaDB 10.1 does not permit ALTER for setting default column value
|
154 |
* fixed: Lazy Load missing placeholder folder when Easy IO is enabled
|
191 |
* fixed: Add Missing Dimensions overwrites smaller width/height attribute if only one is set
|
192 |
* fixed: replacing an existing attribute (like width) with a numeric value is broken
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
= Earlier versions =
|
195 |
Please refer to the separate changelog.txt file.
|
196 |
|