Version Description
Release date: 22nd April 2020 * Fix 400 errors response on admin-ajax.php when using a fontend uploader plugin; * Language 0 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted.
Download this release
Release Info
Developer | petredobrescu |
Plugin | ShortPixel Image Optimizer |
Version | 4.17.4 |
Comparing to | |
See all releases |
Code changes from version 4.17.3 to 4.17.4
- class/controller/front_controller.php +20 -9
- readme.txt +7 -1
- wp-shortpixel.php +2 -2
class/controller/front_controller.php
CHANGED
@@ -14,14 +14,22 @@ class frontController extends ShortPixelController
|
|
14 |
|
15 |
public function __construct()
|
16 |
{
|
|
|
|
|
17 |
if (wpSPIO()->env()->is_front) // if is front.
|
18 |
{
|
19 |
$this->initWebpHooks();
|
20 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
}
|
23 |
|
24 |
-
|
25 |
{
|
26 |
$webp_option = \wpSPIO()->settings()->deliverWebp;
|
27 |
|
@@ -42,11 +50,8 @@ class frontController extends ShortPixelController
|
|
42 |
}
|
43 |
}
|
44 |
|
45 |
-
|
46 |
{
|
47 |
-
if (! \wpSPIO()->settings()->frontBootstrap)
|
48 |
-
return;
|
49 |
-
|
50 |
$prio = (! defined('SHORTPIXEL_NOFLOCK')) ? \ShortPixelQueue::get() : \ShortPixelQueueDB::get();
|
51 |
|
52 |
if ($prio && is_array($prio) && count($prio) > 0)
|
@@ -55,14 +60,20 @@ class frontController extends ShortPixelController
|
|
55 |
add_action( 'wp_footer', array( \wpSPIO()->getShortPixel(), 'shortPixelJS') );
|
56 |
add_filter('script_loader_tag', array($this, 'load_sp_async'), 10, 3);
|
57 |
|
58 |
-
|
59 |
//need to add the nopriv action for when items exist in the queue and no user is logged in
|
60 |
-
add_action( '
|
61 |
-
add_action( 'wp_ajax_shortpixel_image_processing', array( \wpSPIO()->getShortPixel(), 'handleImageProcessing') );
|
62 |
|
63 |
}
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
/* When loading on front, asynd defer ourselves */
|
67 |
public function load_sp_async($tag, $handle, $src)
|
68 |
{
|
14 |
|
15 |
public function __construct()
|
16 |
{
|
17 |
+
$do_front = \wpSPIO()->settings()->frontBootstrap;
|
18 |
+
|
19 |
if (wpSPIO()->env()->is_front) // if is front.
|
20 |
{
|
21 |
$this->initWebpHooks();
|
22 |
+
if ($do_front)
|
23 |
+
$this->hookFrontProcessing();
|
24 |
+
}
|
25 |
+
// Ajax call is not front, but backend. Hook nopriv if ajax is incoming and front process is on.
|
26 |
+
if (wpSPIO()->env()->is_ajaxcall && $do_front)
|
27 |
+
{
|
28 |
+
$this->hookFrontImageProcessing();
|
29 |
}
|
30 |
}
|
31 |
|
32 |
+
protected function initWebpHooks()
|
33 |
{
|
34 |
$webp_option = \wpSPIO()->settings()->deliverWebp;
|
35 |
|
50 |
}
|
51 |
}
|
52 |
|
53 |
+
protected function hookFrontProcessing()
|
54 |
{
|
|
|
|
|
|
|
55 |
$prio = (! defined('SHORTPIXEL_NOFLOCK')) ? \ShortPixelQueue::get() : \ShortPixelQueueDB::get();
|
56 |
|
57 |
if ($prio && is_array($prio) && count($prio) > 0)
|
60 |
add_action( 'wp_footer', array( \wpSPIO()->getShortPixel(), 'shortPixelJS') );
|
61 |
add_filter('script_loader_tag', array($this, 'load_sp_async'), 10, 3);
|
62 |
|
|
|
63 |
//need to add the nopriv action for when items exist in the queue and no user is logged in
|
64 |
+
//add_action( 'wp_ajax_shortpixel_image_processing', array( \wpSPIO()->getShortPixel(), 'handleImageProcessing') );
|
|
|
65 |
|
66 |
}
|
67 |
}
|
68 |
|
69 |
+
/** Add nopriv to ajax call to allow non-logged in users to optimize on the frontend.
|
70 |
+
*
|
71 |
+
*/
|
72 |
+
protected function hookFrontImageProcessing()
|
73 |
+
{
|
74 |
+
add_action( 'wp_ajax_nopriv_shortpixel_image_processing', array( \wpSPIO()->getShortPixel(), 'handleImageProcessing') );
|
75 |
+
}
|
76 |
+
|
77 |
/* When loading on front, asynd defer ourselves */
|
78 |
public function load_sp_async($tag, $handle, $src)
|
79 |
{
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: compressor, image, compression, optimize, image optimizer, image optimiser
|
|
4 |
Requires at least: 3.2.0
|
5 |
Tested up to: 5.4
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 4.17.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -281,6 +281,12 @@ Hide the Cloudflare settings by defining these constants in wp-config.php:
|
|
281 |
|
282 |
== Changelog ==
|
283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
= 4.17.3 =
|
285 |
|
286 |
Release date: 16th April 2020
|
4 |
Requires at least: 3.2.0
|
5 |
Tested up to: 5.4
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 4.17.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
281 |
|
282 |
== Changelog ==
|
283 |
|
284 |
+
= 4.17.4 =
|
285 |
+
|
286 |
+
Release date: 22nd April 2020
|
287 |
+
* Fix 400 errors response on admin-ajax.php when using a fontend uploader plugin;
|
288 |
+
* Language – 0 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted.
|
289 |
+
|
290 |
= 4.17.3 =
|
291 |
|
292 |
Release date: 16th April 2020
|
wp-shortpixel.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: ShortPixel Image Optimizer
|
4 |
* Plugin URI: https://shortpixel.com/
|
5 |
* Description: ShortPixel optimizes images automatically, while guarding the quality of your images. Check your <a href="options-general.php?page=wp-shortpixel-settings" target="_blank">Settings > ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
|
6 |
-
* Version: 4.17.
|
7 |
* Author: ShortPixel
|
8 |
* Author URI: https://shortpixel.com
|
9 |
* Text Domain: shortpixel-image-optimiser
|
@@ -32,7 +32,7 @@ define('SHORTPIXEL_PLUGIN_DIR', __DIR__);
|
|
32 |
|
33 |
//define('SHORTPIXEL_AFFILIATE_CODE', '');
|
34 |
|
35 |
-
define('SHORTPIXEL_IMAGE_OPTIMISER_VERSION', "4.17.
|
36 |
define('SHORTPIXEL_MAX_TIMEOUT', 10);
|
37 |
define('SHORTPIXEL_VALIDATE_MAX_TIMEOUT', 15);
|
38 |
define('SHORTPIXEL_BACKUP', 'ShortpixelBackups');
|
3 |
* Plugin Name: ShortPixel Image Optimizer
|
4 |
* Plugin URI: https://shortpixel.com/
|
5 |
* Description: ShortPixel optimizes images automatically, while guarding the quality of your images. Check your <a href="options-general.php?page=wp-shortpixel-settings" target="_blank">Settings > ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
|
6 |
+
* Version: 4.17.4
|
7 |
* Author: ShortPixel
|
8 |
* Author URI: https://shortpixel.com
|
9 |
* Text Domain: shortpixel-image-optimiser
|
32 |
|
33 |
//define('SHORTPIXEL_AFFILIATE_CODE', '');
|
34 |
|
35 |
+
define('SHORTPIXEL_IMAGE_OPTIMISER_VERSION', "4.17.4");
|
36 |
define('SHORTPIXEL_MAX_TIMEOUT', 10);
|
37 |
define('SHORTPIXEL_VALIDATE_MAX_TIMEOUT', 15);
|
38 |
define('SHORTPIXEL_BACKUP', 'ShortpixelBackups');
|