Version Description
- 2020/02/13 =
- Fix: do not warn that all the quota has been consumed when it is not the case.
- Fix: fix a "chunky upload" error that some users experienced.
- Fix: php notices that could happen when optimizing.
Download this release
Release Info
Developer | wp_media |
Plugin | Imagify Image Optimizer |
Version | 1.9.9 |
Comparing to | |
See all releases |
Code changes from version 1.9.8.1 to 1.9.9
- assets/images/check-1.svg +0 -0
- assets/images/check-mini-1.svg +0 -0
- assets/images/imagify-logo.png +0 -0
- assets/images/imagify-menu-bar-de.jpg +0 -0
- assets/images/imagify-menu-bar-en.jpg +0 -0
- assets/images/imagify-menu-bar-es.jpg +0 -0
- assets/images/imagify-menu-bar-fr.jpg +0 -0
- assets/images/imagify-menu-bar-it.jpg +0 -0
- assets/images/logo-wprocket.png +0 -0
- assets/images/mushrooms-aggressive.jpg +0 -0
- assets/images/mushrooms-normal.jpg +0 -0
- assets/images/mushrooms-original.jpg +0 -0
- assets/images/mushrooms-ultra.jpg +0 -0
- assets/images/spinner.gif +0 -0
- assets/images/upload-image.png +0 -0
- assets/js/chart.js +0 -0
- assets/js/chart.min.js +0 -0
- assets/js/es6-promise.auto.js +0 -0
- assets/js/es6-promise.auto.min.js +0 -0
- assets/js/imagify-gulp.js +0 -0
- assets/js/imagify-gulp.min.js +0 -0
- classes/Imagifybeat/Actions.php +17 -12
- classes/Optimization/File.php +3 -1
- imagify.php +2 -2
- inc/3rd-party/hosting/siteground.php +0 -0
- inc/3rd-party/hosting/wordpress-com.php +0 -0
- inc/3rd-party/hosting/wpengine.php +0 -0
- inc/3rd-party/nextgen-gallery/inc/functions/attachments.php +0 -0
- inc/3rd-party/regenerate-thumbnails/classes/Main.php +3 -1
- inc/admin/upgrader.php +18 -7
- inc/classes/class-imagify-auto-optimization.php +0 -0
- inc/classes/class-imagify-db.php +0 -0
- inc/classes/class-imagify-requirements.php +3 -12
- inc/classes/class-imagify-user.php +73 -52
- inc/classes/class-imagify.php +108 -108
- inc/functions/admin-ui.php +0 -0
- inc/functions/api.php +1 -0
- inc/functions/i18n.php +3 -3
- readme.txt +7 -2
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +4 -4
- views/part-rocket-ad.php +0 -7
assets/images/check-1.svg
CHANGED
File without changes
|
assets/images/check-mini-1.svg
CHANGED
File without changes
|
assets/images/imagify-logo.png
CHANGED
File without changes
|
assets/images/imagify-menu-bar-de.jpg
CHANGED
File without changes
|
assets/images/imagify-menu-bar-en.jpg
CHANGED
File without changes
|
assets/images/imagify-menu-bar-es.jpg
CHANGED
File without changes
|
assets/images/imagify-menu-bar-fr.jpg
CHANGED
File without changes
|
assets/images/imagify-menu-bar-it.jpg
CHANGED
File without changes
|
assets/images/logo-wprocket.png
CHANGED
File without changes
|
assets/images/mushrooms-aggressive.jpg
CHANGED
File without changes
|
assets/images/mushrooms-normal.jpg
CHANGED
File without changes
|
assets/images/mushrooms-original.jpg
CHANGED
File without changes
|
assets/images/mushrooms-ultra.jpg
CHANGED
File without changes
|
assets/images/spinner.gif
CHANGED
File without changes
|
assets/images/upload-image.png
CHANGED
File without changes
|
assets/js/chart.js
CHANGED
File without changes
|
assets/js/chart.min.js
CHANGED
File without changes
|
assets/js/es6-promise.auto.js
CHANGED
File without changes
|
assets/js/es6-promise.auto.min.js
CHANGED
File without changes
|
assets/js/imagify-gulp.js
CHANGED
File without changes
|
assets/js/imagify-gulp.min.js
CHANGED
File without changes
|
classes/Imagifybeat/Actions.php
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<?php
|
2 |
namespace Imagify\Imagifybeat;
|
3 |
|
|
|
|
|
4 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
5 |
|
6 |
/**
|
@@ -66,18 +68,13 @@ class Actions {
|
|
66 |
return $response;
|
67 |
}
|
68 |
|
69 |
-
$is_blocked = \Imagify_Requirements::is_imagify_blocked();
|
70 |
-
$is_api_up = \Imagify_Requirements::is_api_up();
|
71 |
-
$is_key_valid = \Imagify_Requirements::is_api_key_valid();
|
72 |
-
$is_over_quota = \Imagify_Requirements::is_over_quota();
|
73 |
-
|
74 |
$response[ $imagifybeat_id ] = [
|
75 |
-
'curl_missing' => !
|
76 |
-
'editor_missing' => !
|
77 |
-
'external_http_blocked' =>
|
78 |
-
'api_down' =>
|
79 |
-
'key_is_valid' =>
|
80 |
-
'is_over_quota' =>
|
81 |
];
|
82 |
|
83 |
return $response;
|
@@ -157,7 +154,15 @@ class Actions {
|
|
157 |
|
158 |
if ( $optim_data->is_optimized() ) {
|
159 |
// Successfully optimized.
|
160 |
-
$full_size_data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
$response[ $imagifybeat_id ][] = [
|
162 |
'mediaID' => $media_atts['media_id'],
|
163 |
'context' => $media_atts['context'],
|
1 |
<?php
|
2 |
namespace Imagify\Imagifybeat;
|
3 |
|
4 |
+
use Imagify_Requirements;
|
5 |
+
|
6 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
7 |
|
8 |
/**
|
68 |
return $response;
|
69 |
}
|
70 |
|
|
|
|
|
|
|
|
|
|
|
71 |
$response[ $imagifybeat_id ] = [
|
72 |
+
'curl_missing' => ! Imagify_Requirements::supports_curl(),
|
73 |
+
'editor_missing' => ! Imagify_Requirements::supports_image_editor(),
|
74 |
+
'external_http_blocked' => Imagify_Requirements::is_imagify_blocked(),
|
75 |
+
'api_down' => ! Imagify_Requirements::is_api_up(),
|
76 |
+
'key_is_valid' => Imagify_Requirements::is_api_key_valid(),
|
77 |
+
'is_over_quota' => Imagify_Requirements::is_over_quota(),
|
78 |
];
|
79 |
|
80 |
return $response;
|
154 |
|
155 |
if ( $optim_data->is_optimized() ) {
|
156 |
// Successfully optimized.
|
157 |
+
$full_size_data = $optim_data->get_size_data();
|
158 |
+
$full_size_data = array_merge(
|
159 |
+
[
|
160 |
+
'original_size' => 0,
|
161 |
+
'optimized_size' => 0,
|
162 |
+
'percent' => 0,
|
163 |
+
],
|
164 |
+
$full_size_data
|
165 |
+
);
|
166 |
$response[ $imagifybeat_id ][] = [
|
167 |
'mediaID' => $media_atts['media_id'],
|
168 |
'context' => $media_atts['context'],
|
classes/Optimization/File.php
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<?php
|
2 |
namespace Imagify\Optimization;
|
3 |
|
|
|
|
|
4 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
5 |
|
6 |
/**
|
@@ -477,7 +479,7 @@ class File {
|
|
477 |
}
|
478 |
|
479 |
// Check if external HTTP requests are blocked.
|
480 |
-
if (
|
481 |
return new \WP_Error( 'http_block_external', __( 'External HTTP requests are blocked.', 'imagify' ) );
|
482 |
}
|
483 |
|
1 |
<?php
|
2 |
namespace Imagify\Optimization;
|
3 |
|
4 |
+
use Imagify_Requirements;
|
5 |
+
|
6 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
7 |
|
8 |
/**
|
479 |
}
|
480 |
|
481 |
// Check if external HTTP requests are blocked.
|
482 |
+
if ( Imagify_Requirements::is_imagify_blocked() ) {
|
483 |
return new \WP_Error( 'http_block_external', __( 'External HTTP requests are blocked.', 'imagify' ) );
|
484 |
}
|
485 |
|
imagify.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Imagify
|
4 |
* Plugin URI: https://wordpress.org/plugins/imagify/
|
5 |
* Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
|
6 |
-
* Version: 1.9.
|
7 |
* Requires PHP: 5.4
|
8 |
* Author: WP Media
|
9 |
* Author URI: https://wp-media.me/
|
@@ -20,7 +20,7 @@
|
|
20 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
21 |
|
22 |
// Imagify defines.
|
23 |
-
define( 'IMAGIFY_VERSION', '1.9.
|
24 |
define( 'IMAGIFY_SLUG', 'imagify' );
|
25 |
define( 'IMAGIFY_FILE', __FILE__ );
|
26 |
define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
|
3 |
* Plugin Name: Imagify
|
4 |
* Plugin URI: https://wordpress.org/plugins/imagify/
|
5 |
* Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
|
6 |
+
* Version: 1.9.9
|
7 |
* Requires PHP: 5.4
|
8 |
* Author: WP Media
|
9 |
* Author URI: https://wp-media.me/
|
20 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
21 |
|
22 |
// Imagify defines.
|
23 |
+
define( 'IMAGIFY_VERSION', '1.9.9' );
|
24 |
define( 'IMAGIFY_SLUG', 'imagify' );
|
25 |
define( 'IMAGIFY_FILE', __FILE__ );
|
26 |
define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
|
inc/3rd-party/hosting/siteground.php
CHANGED
File without changes
|
inc/3rd-party/hosting/wordpress-com.php
CHANGED
File without changes
|
inc/3rd-party/hosting/wpengine.php
CHANGED
File without changes
|
inc/3rd-party/nextgen-gallery/inc/functions/attachments.php
CHANGED
File without changes
|
inc/3rd-party/regenerate-thumbnails/classes/Main.php
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<?php
|
2 |
namespace Imagify\ThirdParty\RegenerateThumbnails;
|
3 |
|
|
|
|
|
4 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
5 |
|
6 |
/**
|
@@ -221,7 +223,7 @@ class Main extends \Imagify_Regenerate_Thumbnails_Deprecated {
|
|
221 |
* @return bool
|
222 |
*/
|
223 |
protected function set_process( $media_id ) {
|
224 |
-
if ( ! $media_id || !
|
225 |
return false;
|
226 |
}
|
227 |
|
1 |
<?php
|
2 |
namespace Imagify\ThirdParty\RegenerateThumbnails;
|
3 |
|
4 |
+
use Imagify_Requirements;
|
5 |
+
|
6 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
7 |
|
8 |
/**
|
223 |
* @return bool
|
224 |
*/
|
225 |
protected function set_process( $media_id ) {
|
226 |
+
if ( ! $media_id || ! Imagify_Requirements::is_api_key_valid() ) {
|
227 |
return false;
|
228 |
}
|
229 |
|
inc/admin/upgrader.php
CHANGED
@@ -346,30 +346,41 @@ function imagify_maybe_reset_opcache( $wp_upgrader, $hook_extra ) {
|
|
346 |
* Reset PHP opcache.
|
347 |
*
|
348 |
* @since 1.8.1
|
|
|
349 |
* @author Grégory Viguier
|
|
|
|
|
|
|
350 |
*/
|
351 |
-
function imagify_reset_opcache() {
|
352 |
static $can_reset;
|
353 |
|
354 |
-
if ( ! isset( $can_reset ) ) {
|
355 |
if ( ! function_exists( 'opcache_reset' ) ) {
|
356 |
$can_reset = false;
|
357 |
-
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
}
|
359 |
|
360 |
-
$restrict_api = ini_get( 'opcache.restrict_api' );
|
361 |
|
362 |
if ( $restrict_api && strpos( __FILE__, $restrict_api ) !== 0 ) {
|
363 |
$can_reset = false;
|
364 |
-
return;
|
365 |
}
|
366 |
|
367 |
$can_reset = true;
|
368 |
}
|
369 |
|
370 |
if ( ! $can_reset ) {
|
371 |
-
return;
|
372 |
}
|
373 |
|
374 |
-
opcache_reset();
|
375 |
}
|
346 |
* Reset PHP opcache.
|
347 |
*
|
348 |
* @since 1.8.1
|
349 |
+
* @since 1.9.9 Added $reset_function_cache parameter and return boolean.
|
350 |
* @author Grégory Viguier
|
351 |
+
*
|
352 |
+
* @param bool $reset_function_cache Set to true to bypass the cache.
|
353 |
+
* @return bool Return true if the opcode cache was reset (or reset in a previous call), or false if the opcode cache is disabled.
|
354 |
*/
|
355 |
+
function imagify_reset_opcache( $reset_function_cache = false ) {
|
356 |
static $can_reset;
|
357 |
|
358 |
+
if ( $reset_function_cache || ! isset( $can_reset ) ) {
|
359 |
if ( ! function_exists( 'opcache_reset' ) ) {
|
360 |
$can_reset = false;
|
361 |
+
return false;
|
362 |
+
}
|
363 |
+
|
364 |
+
$opcache_enabled = filter_var( ini_get( 'opcache.enable' ), FILTER_VALIDATE_BOOLEAN ); // phpcs:ignore PHPCompatibility.IniDirectives.NewIniDirectives.opcache_enableFound
|
365 |
+
|
366 |
+
if ( ! $opcache_enabled ) {
|
367 |
+
$can_reset = false;
|
368 |
+
return false;
|
369 |
}
|
370 |
|
371 |
+
$restrict_api = ini_get( 'opcache.restrict_api' ); // phpcs:ignore PHPCompatibility.IniDirectives.NewIniDirectives.opcache_restrict_apiFound
|
372 |
|
373 |
if ( $restrict_api && strpos( __FILE__, $restrict_api ) !== 0 ) {
|
374 |
$can_reset = false;
|
375 |
+
return false;
|
376 |
}
|
377 |
|
378 |
$can_reset = true;
|
379 |
}
|
380 |
|
381 |
if ( ! $can_reset ) {
|
382 |
+
return false;
|
383 |
}
|
384 |
|
385 |
+
return opcache_reset(); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.opcache_resetFound
|
386 |
}
|
inc/classes/class-imagify-auto-optimization.php
CHANGED
File without changes
|
inc/classes/class-imagify-db.php
CHANGED
File without changes
|
inc/classes/class-imagify-requirements.php
CHANGED
@@ -8,16 +8,6 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
|
8 |
* @author Grégory Viguier
|
9 |
*/
|
10 |
class Imagify_Requirements {
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class version.
|
14 |
-
*
|
15 |
-
* @var string
|
16 |
-
* @since 1.7.1
|
17 |
-
* @author Grégory Viguier
|
18 |
-
*/
|
19 |
-
const VERSION = '1.0';
|
20 |
-
|
21 |
/**
|
22 |
* Cache the test results.
|
23 |
*
|
@@ -301,11 +291,12 @@ class Imagify_Requirements {
|
|
301 |
* Test for the Imagify account quota.
|
302 |
*
|
303 |
* @since 1.7.1
|
|
|
304 |
* @access public
|
305 |
* @author Grégory Viguier
|
306 |
*
|
307 |
* @param bool $reset_cache True to get a fresh value.
|
308 |
-
* @return bool
|
309 |
*/
|
310 |
public static function is_over_quota( $reset_cache = false ) {
|
311 |
if ( ! $reset_cache && isset( self::$supports['over_quota'] ) ) {
|
@@ -314,7 +305,7 @@ class Imagify_Requirements {
|
|
314 |
|
315 |
$user = new Imagify_User();
|
316 |
|
317 |
-
self::$supports['over_quota'] = $user->is_over_quota();
|
318 |
|
319 |
return self::$supports['over_quota'];
|
320 |
}
|
8 |
* @author Grégory Viguier
|
9 |
*/
|
10 |
class Imagify_Requirements {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
/**
|
12 |
* Cache the test results.
|
13 |
*
|
291 |
* Test for the Imagify account quota.
|
292 |
*
|
293 |
* @since 1.7.1
|
294 |
+
* @since 1.9.9 Return false when the API cannot be reached.
|
295 |
* @access public
|
296 |
* @author Grégory Viguier
|
297 |
*
|
298 |
* @param bool $reset_cache True to get a fresh value.
|
299 |
+
* @return bool True when over quota. False otherwise, even when the API cannot be reached.
|
300 |
*/
|
301 |
public static function is_over_quota( $reset_cache = false ) {
|
302 |
if ( ! $reset_cache && isset( self::$supports['over_quota'] ) ) {
|
305 |
|
306 |
$user = new Imagify_User();
|
307 |
|
308 |
+
self::$supports['over_quota'] = $user->get_error() ? false : $user->is_over_quota();
|
309 |
|
310 |
return self::$supports['over_quota'];
|
311 |
}
|
inc/classes/class-imagify-user.php
CHANGED
@@ -7,14 +7,6 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
|
7 |
* @since 1.0
|
8 |
*/
|
9 |
class Imagify_User {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Class version.
|
13 |
-
*
|
14 |
-
* @var string
|
15 |
-
*/
|
16 |
-
const VERSION = '1.0.1';
|
17 |
-
|
18 |
/**
|
19 |
* The Imagify user ID.
|
20 |
*
|
@@ -115,6 +107,17 @@ class Imagify_User {
|
|
115 |
*/
|
116 |
public $is_active;
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
/**
|
119 |
* The constructor.
|
120 |
*
|
@@ -126,6 +129,7 @@ class Imagify_User {
|
|
126 |
$user = get_imagify_user();
|
127 |
|
128 |
if ( is_wp_error( $user ) ) {
|
|
|
129 |
return;
|
130 |
}
|
131 |
|
@@ -139,6 +143,20 @@ class Imagify_User {
|
|
139 |
$this->consumed_current_month_quota = $user->consumed_current_month_quota;
|
140 |
$this->next_date_update = $user->next_date_update;
|
141 |
$this->is_active = $user->is_active;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
|
144 |
/**
|
@@ -152,6 +170,10 @@ class Imagify_User {
|
|
152 |
public function get_percent_consumed_quota() {
|
153 |
static $done = false;
|
154 |
|
|
|
|
|
|
|
|
|
155 |
$quota = $this->quota;
|
156 |
$consumed_quota = $this->consumed_current_month_quota;
|
157 |
|
@@ -168,42 +190,45 @@ class Imagify_User {
|
|
168 |
$percent = min( max( 0, $percent ), 100 );
|
169 |
}
|
170 |
|
171 |
-
if (
|
172 |
-
$
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
|
|
205 |
}
|
206 |
|
|
|
|
|
207 |
return $percent;
|
208 |
}
|
209 |
|
@@ -216,8 +241,7 @@ class Imagify_User {
|
|
216 |
* @return float|int
|
217 |
*/
|
218 |
public function get_percent_unconsumed_quota() {
|
219 |
-
|
220 |
-
return $percent;
|
221 |
}
|
222 |
|
223 |
/**
|
@@ -229,27 +253,24 @@ class Imagify_User {
|
|
229 |
* @return bool
|
230 |
*/
|
231 |
public function is_free() {
|
232 |
-
|
233 |
-
return true;
|
234 |
-
}
|
235 |
-
|
236 |
-
return false;
|
237 |
}
|
238 |
|
239 |
/**
|
240 |
* Check if the user has consumed all his/her quota.
|
241 |
*
|
242 |
* @since 1.1.1
|
|
|
243 |
*
|
244 |
* @access public
|
245 |
* @return bool
|
246 |
*/
|
247 |
public function is_over_quota() {
|
248 |
-
if (
|
249 |
-
return
|
250 |
}
|
251 |
|
252 |
-
if ( $this->is_free() && 100 === $this->get_percent_consumed_quota() ) {
|
253 |
return true;
|
254 |
}
|
255 |
|
7 |
* @since 1.0
|
8 |
*/
|
9 |
class Imagify_User {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
/**
|
11 |
* The Imagify user ID.
|
12 |
*
|
107 |
*/
|
108 |
public $is_active;
|
109 |
|
110 |
+
/**
|
111 |
+
* Store a \WP_Error object if the request to fetch the user data failed.
|
112 |
+
* False overwise.
|
113 |
+
*
|
114 |
+
* @var bool|\WP_Error
|
115 |
+
* @since 1.9.9
|
116 |
+
* @access private
|
117 |
+
* @author Grégory Viguier
|
118 |
+
*/
|
119 |
+
private $error;
|
120 |
+
|
121 |
/**
|
122 |
* The constructor.
|
123 |
*
|
129 |
$user = get_imagify_user();
|
130 |
|
131 |
if ( is_wp_error( $user ) ) {
|
132 |
+
$this->error = $user;
|
133 |
return;
|
134 |
}
|
135 |
|
143 |
$this->consumed_current_month_quota = $user->consumed_current_month_quota;
|
144 |
$this->next_date_update = $user->next_date_update;
|
145 |
$this->is_active = $user->is_active;
|
146 |
+
$this->error = false;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Get the possible error returned when fetching user data.
|
151 |
+
*
|
152 |
+
* @since 1.9.9
|
153 |
+
* @access public
|
154 |
+
* @author Grégory Viguier
|
155 |
+
*
|
156 |
+
* @return bool|\WP_Error A \WP_Error object if the request to fetch the user data failed. False overwise.
|
157 |
+
*/
|
158 |
+
public function get_error() {
|
159 |
+
return $this->error;
|
160 |
}
|
161 |
|
162 |
/**
|
170 |
public function get_percent_consumed_quota() {
|
171 |
static $done = false;
|
172 |
|
173 |
+
if ( $this->get_error() ) {
|
174 |
+
return 0;
|
175 |
+
}
|
176 |
+
|
177 |
$quota = $this->quota;
|
178 |
$consumed_quota = $this->consumed_current_month_quota;
|
179 |
|
190 |
$percent = min( max( 0, $percent ), 100 );
|
191 |
}
|
192 |
|
193 |
+
if ( $done ) {
|
194 |
+
return $percent;
|
195 |
+
}
|
196 |
+
|
197 |
+
$previous_percent = Imagify_Data::get_instance()->get( 'previous_quota_percent' );
|
198 |
+
|
199 |
+
// Percent is not 100% anymore.
|
200 |
+
if ( 100.0 === (float) $previous_percent && $percent < 100 ) {
|
201 |
+
/**
|
202 |
+
* Triggered when the consumed quota percent decreases below 100%.
|
203 |
+
*
|
204 |
+
* @since 1.7
|
205 |
+
* @author Grégory Viguier
|
206 |
+
*
|
207 |
+
* @param float|int $percent The current percentage of consumed quota.
|
208 |
+
*/
|
209 |
+
do_action( 'imagify_not_over_quota_anymore', $percent );
|
210 |
+
}
|
211 |
+
|
212 |
+
// Percent is not >= 80% anymore.
|
213 |
+
if ( (float) $previous_percent >= 80.0 && $percent < 80 ) {
|
214 |
+
/**
|
215 |
+
* Triggered when the consumed quota percent decreases below 80%.
|
216 |
+
*
|
217 |
+
* @since 1.7
|
218 |
+
* @author Grégory Viguier
|
219 |
+
*
|
220 |
+
* @param float|int $percent The current percentage of consumed quota.
|
221 |
+
* @param float|int $previous_percent The previous percentage of consumed quota.
|
222 |
+
*/
|
223 |
+
do_action( 'imagify_not_almost_over_quota_anymore', $percent, $previous_percent );
|
224 |
+
}
|
225 |
+
|
226 |
+
if ( (float) $previous_percent !== (float) $percent ) {
|
227 |
+
Imagify_Data::get_instance()->set( 'previous_quota_percent', $percent );
|
228 |
}
|
229 |
|
230 |
+
$done = true;
|
231 |
+
|
232 |
return $percent;
|
233 |
}
|
234 |
|
241 |
* @return float|int
|
242 |
*/
|
243 |
public function get_percent_unconsumed_quota() {
|
244 |
+
return 100 - $this->get_percent_consumed_quota();
|
|
|
245 |
}
|
246 |
|
247 |
/**
|
253 |
* @return bool
|
254 |
*/
|
255 |
public function is_free() {
|
256 |
+
return 1 === $this->plan_id;
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
|
259 |
/**
|
260 |
* Check if the user has consumed all his/her quota.
|
261 |
*
|
262 |
* @since 1.1.1
|
263 |
+
* @since 1.9.9 Return false if the request to fetch the user data failed.
|
264 |
*
|
265 |
* @access public
|
266 |
* @return bool
|
267 |
*/
|
268 |
public function is_over_quota() {
|
269 |
+
if ( $this->get_error() ) {
|
270 |
+
return false;
|
271 |
}
|
272 |
|
273 |
+
if ( $this->is_free() && 100.0 === (float) $this->get_percent_consumed_quota() ) {
|
274 |
return true;
|
275 |
}
|
276 |
|
inc/classes/class-imagify.php
CHANGED
@@ -5,13 +5,8 @@ defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
|
5 |
* Imagify.io API for WordPress.
|
6 |
*/
|
7 |
class Imagify {
|
|
|
8 |
|
9 |
-
/**
|
10 |
-
* Class version.
|
11 |
-
*
|
12 |
-
* @var string
|
13 |
-
*/
|
14 |
-
const VERSION = '1.3';
|
15 |
/**
|
16 |
* The Imagify API endpoint.
|
17 |
*
|
@@ -38,14 +33,14 @@ class Imagify {
|
|
38 |
*
|
39 |
* @var array
|
40 |
*/
|
41 |
-
private $headers =
|
42 |
|
43 |
/**
|
44 |
* All (default) HTTP headers. They must not be modified once the class is instanciated, or it will affect any following HTTP calls.
|
45 |
*
|
46 |
* @var array
|
47 |
*/
|
48 |
-
private $all_headers =
|
49 |
|
50 |
/**
|
51 |
* Filesystem object.
|
@@ -58,13 +53,14 @@ class Imagify {
|
|
58 |
protected $filesystem;
|
59 |
|
60 |
/**
|
61 |
-
*
|
62 |
*
|
|
|
|
|
63 |
* @access protected
|
64 |
-
*
|
65 |
-
* @var object
|
66 |
*/
|
67 |
-
protected static $
|
68 |
|
69 |
/**
|
70 |
* The constructor.
|
@@ -84,23 +80,6 @@ class Imagify {
|
|
84 |
$this->all_headers['Authorization'] = 'Authorization: token ' . $this->api_key;
|
85 |
}
|
86 |
|
87 |
-
/**
|
88 |
-
* Get the main Instance.
|
89 |
-
*
|
90 |
-
* @access public
|
91 |
-
* @since 1.6.5
|
92 |
-
* @author Grégory Viguier
|
93 |
-
*
|
94 |
-
* @return object Main instance.
|
95 |
-
*/
|
96 |
-
public static function get_instance() {
|
97 |
-
if ( ! isset( self::$_instance ) ) {
|
98 |
-
self::$_instance = new self();
|
99 |
-
}
|
100 |
-
|
101 |
-
return self::$_instance;
|
102 |
-
}
|
103 |
-
|
104 |
/**
|
105 |
* Get your Imagify account infos.
|
106 |
*
|
@@ -110,41 +89,40 @@ class Imagify {
|
|
110 |
* @return object
|
111 |
*/
|
112 |
public function get_user() {
|
113 |
-
static $user;
|
114 |
global $wp_current_filter;
|
115 |
|
116 |
-
if ( isset(
|
117 |
-
return
|
118 |
}
|
119 |
|
120 |
-
if (
|
121 |
-
$this->headers = $this->all_headers;
|
122 |
-
|
123 |
-
$user = $this->http_call( 'users/me/', array(
|
124 |
-
'timeout' => 10,
|
125 |
-
) );
|
126 |
-
|
127 |
-
if ( ! is_wp_error( $user ) ) {
|
128 |
-
$maybe_missing = [
|
129 |
-
'account_type' => 'free',
|
130 |
-
'quota' => 0,
|
131 |
-
'extra_quota' => 0,
|
132 |
-
'extra_quota_consumed' => 0,
|
133 |
-
'consumed_current_month_quota' => 0,
|
134 |
-
];
|
135 |
-
|
136 |
-
foreach ( $maybe_missing as $name => $value ) {
|
137 |
-
if ( ! isset( $user->$name ) ) {
|
138 |
-
$user->$name = $value;
|
139 |
-
}
|
140 |
-
}
|
141 |
-
}
|
142 |
-
} else {
|
143 |
// Dirty patch used when updating from 1.7.
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
149 |
|
150 |
/**
|
@@ -157,20 +135,26 @@ class Imagify {
|
|
157 |
* @return object
|
158 |
*/
|
159 |
public function create_user( $data ) {
|
160 |
-
$this->headers =
|
161 |
-
$data = array_merge(
|
162 |
-
|
163 |
-
|
164 |
-
|
|
|
|
|
|
|
165 |
|
166 |
if ( ! $data['partner'] ) {
|
167 |
unset( $data['partner'] );
|
168 |
}
|
169 |
|
170 |
-
$response = $this->http_call(
|
171 |
-
'
|
172 |
-
|
173 |
-
|
|
|
|
|
|
|
174 |
|
175 |
if ( ! is_wp_error( $response ) ) {
|
176 |
imagify_delete_partner();
|
@@ -191,11 +175,14 @@ class Imagify {
|
|
191 |
public function update_user( $data ) {
|
192 |
$this->headers = $this->all_headers;
|
193 |
|
194 |
-
return $this->http_call(
|
195 |
-
'
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
199 |
}
|
200 |
|
201 |
/**
|
@@ -208,15 +195,15 @@ class Imagify {
|
|
208 |
* @return object
|
209 |
*/
|
210 |
public function get_status( $data ) {
|
211 |
-
static $status =
|
212 |
|
213 |
if ( isset( $status[ $data ] ) ) {
|
214 |
return $status[ $data ];
|
215 |
}
|
216 |
|
217 |
-
$this->headers =
|
218 |
'Authorization' => 'Authorization: token ' . $data,
|
219 |
-
|
220 |
|
221 |
$uri = 'status/';
|
222 |
$partner = imagify_get_partner();
|
@@ -225,9 +212,7 @@ class Imagify {
|
|
225 |
$uri .= '?partner=' . $partner;
|
226 |
}
|
227 |
|
228 |
-
$status[ $data ] = $this->http_call( $uri,
|
229 |
-
'timeout' => 10,
|
230 |
-
) );
|
231 |
|
232 |
return $status[ $data ];
|
233 |
}
|
@@ -244,13 +229,11 @@ class Imagify {
|
|
244 |
static $api_version;
|
245 |
|
246 |
if ( ! isset( $api_version ) ) {
|
247 |
-
$this->headers =
|
248 |
'Authorization' => $this->all_headers['Authorization'],
|
249 |
-
|
250 |
|
251 |
-
$api_version = $this->http_call( 'version/',
|
252 |
-
'timeout' => 5,
|
253 |
-
) );
|
254 |
}
|
255 |
|
256 |
return $api_version;
|
@@ -281,14 +264,17 @@ class Imagify {
|
|
281 |
* @return object
|
282 |
*/
|
283 |
public function upload_image( $data ) {
|
284 |
-
$this->headers =
|
285 |
'Authorization' => $this->all_headers['Authorization'],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
);
|
287 |
-
|
288 |
-
return $this->http_call( 'upload/', array(
|
289 |
-
'method' => 'POST',
|
290 |
-
'post_data' => $data,
|
291 |
-
) );
|
292 |
}
|
293 |
|
294 |
/**
|
@@ -303,10 +289,13 @@ class Imagify {
|
|
303 |
public function fetch_image( $data ) {
|
304 |
$this->headers = $this->all_headers;
|
305 |
|
306 |
-
return $this->http_call(
|
307 |
-
'
|
308 |
-
|
309 |
-
|
|
|
|
|
|
|
310 |
}
|
311 |
|
312 |
/**
|
@@ -391,12 +380,15 @@ class Imagify {
|
|
391 |
* @param array $args The request args.
|
392 |
* @return object
|
393 |
*/
|
394 |
-
private function http_call( $url, $args =
|
395 |
-
$args = array_merge(
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
|
|
|
|
|
|
400 |
|
401 |
$endpoint = trim( $url, '/' );
|
402 |
/**
|
@@ -415,11 +407,14 @@ class Imagify {
|
|
415 |
return $this->curl_http_call( $url, $args );
|
416 |
}
|
417 |
|
418 |
-
$args = array_merge(
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
|
|
|
|
|
|
423 |
|
424 |
unset( $args['post_data'] );
|
425 |
|
@@ -436,8 +431,8 @@ class Imagify {
|
|
436 |
// Make sure our API has not overwritten by some other plugin.
|
437 |
$args[ $this->secure_key ] = preg_replace( '/^token /', '', $args['headers']['Authorization'] );
|
438 |
|
439 |
-
if ( ! has_filter( 'http_request_args',
|
440 |
-
add_filter( 'http_request_args',
|
441 |
}
|
442 |
}
|
443 |
|
@@ -465,7 +460,7 @@ class Imagify {
|
|
465 |
* @param array $args The request arguments.
|
466 |
* @return object
|
467 |
*/
|
468 |
-
private function curl_http_call( $url, $args =
|
469 |
// Check if curl is available.
|
470 |
if ( ! Imagify_Requirements::supports_curl() ) {
|
471 |
return new WP_Error( 'curl', 'cURL isn\'t installed on the server.' );
|
@@ -526,11 +521,12 @@ class Imagify {
|
|
526 |
* Tell which http version to use with cURL during image optimization.
|
527 |
*
|
528 |
* @since 1.8.4.1
|
|
|
529 |
* @author Grégory Viguier
|
530 |
*
|
531 |
-
* @param $use_version_1_0 bool True to use version 1.0. False for 1.1. Default is
|
532 |
*/
|
533 |
-
if ( apply_filters( 'imagify_curl_http_version_1_0',
|
534 |
curl_setopt( $ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
|
535 |
} else {
|
536 |
curl_setopt( $ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
|
@@ -618,6 +614,10 @@ class Imagify {
|
|
618 |
return new WP_Error( 'error ' . $http_code, "Our server returned an error ({$http_code}{$error})" );
|
619 |
}
|
620 |
|
|
|
|
|
|
|
|
|
621 |
return $response;
|
622 |
}
|
623 |
|
5 |
* Imagify.io API for WordPress.
|
6 |
*/
|
7 |
class Imagify {
|
8 |
+
use \Imagify\Traits\InstanceGetterTrait;
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
/**
|
11 |
* The Imagify API endpoint.
|
12 |
*
|
33 |
*
|
34 |
* @var array
|
35 |
*/
|
36 |
+
private $headers = [];
|
37 |
|
38 |
/**
|
39 |
* All (default) HTTP headers. They must not be modified once the class is instanciated, or it will affect any following HTTP calls.
|
40 |
*
|
41 |
* @var array
|
42 |
*/
|
43 |
+
private $all_headers = [];
|
44 |
|
45 |
/**
|
46 |
* Filesystem object.
|
53 |
protected $filesystem;
|
54 |
|
55 |
/**
|
56 |
+
* Use data fetched from the API.
|
57 |
*
|
58 |
+
* @var \stdClass|\WP_Error
|
59 |
+
* @since 1.9.9
|
60 |
* @access protected
|
61 |
+
* @author Grégory Viguier
|
|
|
62 |
*/
|
63 |
+
protected static $user;
|
64 |
|
65 |
/**
|
66 |
* The constructor.
|
80 |
$this->all_headers['Authorization'] = 'Authorization: token ' . $this->api_key;
|
81 |
}
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
/**
|
84 |
* Get your Imagify account infos.
|
85 |
*
|
89 |
* @return object
|
90 |
*/
|
91 |
public function get_user() {
|
|
|
92 |
global $wp_current_filter;
|
93 |
|
94 |
+
if ( isset( static::$user ) ) {
|
95 |
+
return static::$user;
|
96 |
}
|
97 |
|
98 |
+
if ( in_array( 'upgrader_post_install', (array) $wp_current_filter, true ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
// Dirty patch used when updating from 1.7.
|
100 |
+
static::$user = new WP_Error();
|
101 |
+
return static::$user;
|
102 |
+
}
|
103 |
+
|
104 |
+
$this->headers = $this->all_headers;
|
105 |
+
static::$user = $this->http_call( 'users/me/', [ 'timeout' => 10 ] );
|
106 |
+
|
107 |
+
if ( is_wp_error( static::$user ) ) {
|
108 |
+
return static::$user;
|
109 |
}
|
110 |
|
111 |
+
$maybe_missing = [
|
112 |
+
'account_type' => 'free',
|
113 |
+
'quota' => 0,
|
114 |
+
'extra_quota' => 0,
|
115 |
+
'extra_quota_consumed' => 0,
|
116 |
+
'consumed_current_month_quota' => 0,
|
117 |
+
];
|
118 |
+
|
119 |
+
foreach ( $maybe_missing as $name => $value ) {
|
120 |
+
if ( ! isset( static::$user->$name ) ) {
|
121 |
+
static::$user->$name = $value;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
return static::$user;
|
126 |
}
|
127 |
|
128 |
/**
|
135 |
* @return object
|
136 |
*/
|
137 |
public function create_user( $data ) {
|
138 |
+
$this->headers = [];
|
139 |
+
$data = array_merge(
|
140 |
+
$data,
|
141 |
+
[
|
142 |
+
'from_plugin' => true,
|
143 |
+
'partner' => imagify_get_partner(),
|
144 |
+
]
|
145 |
+
);
|
146 |
|
147 |
if ( ! $data['partner'] ) {
|
148 |
unset( $data['partner'] );
|
149 |
}
|
150 |
|
151 |
+
$response = $this->http_call(
|
152 |
+
'users/',
|
153 |
+
[
|
154 |
+
'method' => 'POST',
|
155 |
+
'post_data' => $data,
|
156 |
+
]
|
157 |
+
);
|
158 |
|
159 |
if ( ! is_wp_error( $response ) ) {
|
160 |
imagify_delete_partner();
|
175 |
public function update_user( $data ) {
|
176 |
$this->headers = $this->all_headers;
|
177 |
|
178 |
+
return $this->http_call(
|
179 |
+
'users/me/',
|
180 |
+
[
|
181 |
+
'method' => 'PUT',
|
182 |
+
'post_data' => $data,
|
183 |
+
'timeout' => 10,
|
184 |
+
]
|
185 |
+
);
|
186 |
}
|
187 |
|
188 |
/**
|
195 |
* @return object
|
196 |
*/
|
197 |
public function get_status( $data ) {
|
198 |
+
static $status = [];
|
199 |
|
200 |
if ( isset( $status[ $data ] ) ) {
|
201 |
return $status[ $data ];
|
202 |
}
|
203 |
|
204 |
+
$this->headers = [
|
205 |
'Authorization' => 'Authorization: token ' . $data,
|
206 |
+
];
|
207 |
|
208 |
$uri = 'status/';
|
209 |
$partner = imagify_get_partner();
|
212 |
$uri .= '?partner=' . $partner;
|
213 |
}
|
214 |
|
215 |
+
$status[ $data ] = $this->http_call( $uri, [ 'timeout' => 10 ] );
|
|
|
|
|
216 |
|
217 |
return $status[ $data ];
|
218 |
}
|
229 |
static $api_version;
|
230 |
|
231 |
if ( ! isset( $api_version ) ) {
|
232 |
+
$this->headers = [
|
233 |
'Authorization' => $this->all_headers['Authorization'],
|
234 |
+
];
|
235 |
|
236 |
+
$api_version = $this->http_call( 'version/', [ 'timeout' => 5 ] );
|
|
|
|
|
237 |
}
|
238 |
|
239 |
return $api_version;
|
264 |
* @return object
|
265 |
*/
|
266 |
public function upload_image( $data ) {
|
267 |
+
$this->headers = [
|
268 |
'Authorization' => $this->all_headers['Authorization'],
|
269 |
+
];
|
270 |
+
|
271 |
+
return $this->http_call(
|
272 |
+
'upload/',
|
273 |
+
[
|
274 |
+
'method' => 'POST',
|
275 |
+
'post_data' => $data,
|
276 |
+
]
|
277 |
);
|
|
|
|
|
|
|
|
|
|
|
278 |
}
|
279 |
|
280 |
/**
|
289 |
public function fetch_image( $data ) {
|
290 |
$this->headers = $this->all_headers;
|
291 |
|
292 |
+
return $this->http_call(
|
293 |
+
'fetch/',
|
294 |
+
[
|
295 |
+
'method' => 'POST',
|
296 |
+
'post_data' => wp_json_encode( $data ),
|
297 |
+
]
|
298 |
+
);
|
299 |
}
|
300 |
|
301 |
/**
|
380 |
* @param array $args The request args.
|
381 |
* @return object
|
382 |
*/
|
383 |
+
private function http_call( $url, $args = [] ) {
|
384 |
+
$args = array_merge(
|
385 |
+
[
|
386 |
+
'method' => 'GET',
|
387 |
+
'post_data' => null,
|
388 |
+
'timeout' => 45,
|
389 |
+
],
|
390 |
+
$args
|
391 |
+
);
|
392 |
|
393 |
$endpoint = trim( $url, '/' );
|
394 |
/**
|
407 |
return $this->curl_http_call( $url, $args );
|
408 |
}
|
409 |
|
410 |
+
$args = array_merge(
|
411 |
+
[
|
412 |
+
'headers' => [],
|
413 |
+
'body' => $args['post_data'],
|
414 |
+
'sslverify' => apply_filters( 'https_ssl_verify', false ),
|
415 |
+
],
|
416 |
+
$args
|
417 |
+
);
|
418 |
|
419 |
unset( $args['post_data'] );
|
420 |
|
431 |
// Make sure our API has not overwritten by some other plugin.
|
432 |
$args[ $this->secure_key ] = preg_replace( '/^token /', '', $args['headers']['Authorization'] );
|
433 |
|
434 |
+
if ( ! has_filter( 'http_request_args', [ $this, 'force_api_key_header' ] ) ) {
|
435 |
+
add_filter( 'http_request_args', [ $this, 'force_api_key_header' ], IMAGIFY_INT_MAX + 25, 2 );
|
436 |
}
|
437 |
}
|
438 |
|
460 |
* @param array $args The request arguments.
|
461 |
* @return object
|
462 |
*/
|
463 |
+
private function curl_http_call( $url, $args = [] ) {
|
464 |
// Check if curl is available.
|
465 |
if ( ! Imagify_Requirements::supports_curl() ) {
|
466 |
return new WP_Error( 'curl', 'cURL isn\'t installed on the server.' );
|
521 |
* Tell which http version to use with cURL during image optimization.
|
522 |
*
|
523 |
* @since 1.8.4.1
|
524 |
+
* @since 1.9.9 Default value is `false`.
|
525 |
* @author Grégory Viguier
|
526 |
*
|
527 |
+
* @param $use_version_1_0 bool True to use version 1.0. False for 1.1. Default is false.
|
528 |
*/
|
529 |
+
if ( apply_filters( 'imagify_curl_http_version_1_0', false ) ) {
|
530 |
curl_setopt( $ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
|
531 |
} else {
|
532 |
curl_setopt( $ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
|
614 |
return new WP_Error( 'error ' . $http_code, "Our server returned an error ({$http_code}{$error})" );
|
615 |
}
|
616 |
|
617 |
+
if ( ! is_object( $response ) ) {
|
618 |
+
return new WP_Error( 'invalid response', 'Our server returned an invalid response.', $response );
|
619 |
+
}
|
620 |
+
|
621 |
return $response;
|
622 |
}
|
623 |
|
inc/functions/admin-ui.php
CHANGED
File without changes
|
inc/functions/api.php
CHANGED
@@ -210,6 +210,7 @@ function imagify_translate_api_message( $message ) {
|
|
210 |
'Could not initialize a new cURL handle' => __( 'Could not initialize a new cURL handle.', 'imagify' ),
|
211 |
'Unknown error occurred' => __( 'Unknown error occurred.', 'imagify' ),
|
212 |
'Your image is too big to be uploaded on our server' => __( 'Your file is too big to be uploaded on our server.', 'imagify' ),
|
|
|
213 |
'cURL isn\'t installed on the server' => __( 'cURL is not available on the server.', 'imagify' ),
|
214 |
// API messages.
|
215 |
'Authentification not provided' => __( 'Authentication not provided.', 'imagify' ),
|
210 |
'Could not initialize a new cURL handle' => __( 'Could not initialize a new cURL handle.', 'imagify' ),
|
211 |
'Unknown error occurred' => __( 'Unknown error occurred.', 'imagify' ),
|
212 |
'Your image is too big to be uploaded on our server' => __( 'Your file is too big to be uploaded on our server.', 'imagify' ),
|
213 |
+
'Our server returned an invalid response' => __( 'Our server returned an invalid response.', 'imagify' ),
|
214 |
'cURL isn\'t installed on the server' => __( 'cURL is not available on the server.', 'imagify' ),
|
215 |
// API messages.
|
216 |
'Authentification not provided' => __( 'Authentication not provided.', 'imagify' ),
|
inc/functions/i18n.php
CHANGED
@@ -80,9 +80,9 @@ function get_imagify_localize_script_translations( $context ) {
|
|
80 |
'curlMissing' => ! Imagify_Requirements::supports_curl(),
|
81 |
'editorMissing' => ! Imagify_Requirements::supports_image_editor(),
|
82 |
'extHttpBlocked' => Imagify_Requirements::is_imagify_blocked(),
|
83 |
-
'apiDown' =>
|
84 |
-
'keyIsValid' =>
|
85 |
-
'isOverQuota' =>
|
86 |
'imagifybeatIDs' => [
|
87 |
'queue' => $imagifybeat_actions->get_imagifybeat_id( 'bulk_optimization_status' ),
|
88 |
'requirements' => $imagifybeat_actions->get_imagifybeat_id( 'requirements' ),
|
80 |
'curlMissing' => ! Imagify_Requirements::supports_curl(),
|
81 |
'editorMissing' => ! Imagify_Requirements::supports_image_editor(),
|
82 |
'extHttpBlocked' => Imagify_Requirements::is_imagify_blocked(),
|
83 |
+
'apiDown' => ! Imagify_Requirements::is_api_up(),
|
84 |
+
'keyIsValid' => Imagify_Requirements::is_api_key_valid(),
|
85 |
+
'isOverQuota' => Imagify_Requirements::is_over_quota(),
|
86 |
'imagifybeatIDs' => [
|
87 |
'queue' => $imagifybeat_actions->get_imagifybeat_id( 'bulk_optimization_status' ),
|
88 |
'requirements' => $imagifybeat_actions->get_imagifybeat_id( 'requirements' ),
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: wp_media, GregLone
|
3 |
Tags: optimize images, images, optimize, performance, webp
|
4 |
Requires at least: 4.0.0
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 1.9.
|
7 |
|
8 |
Optimize images in one click: reduce image file sizes, convert WebP, keep your images beautiful… and boost your loading time and your SEO!
|
9 |
|
@@ -153,6 +153,11 @@ When the plugin is disabled, your existing images remain optimized. Backups of t
|
|
153 |
4. Other Media Page
|
154 |
|
155 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
156 |
= 1.9.8.1 - 2019/11/15 =
|
157 |
* Fix: webp image not showing when using the `<picture>` method and the original `<img/>` does not have a `srcset` attribute.
|
158 |
* Fix: a fatal error with WP Offload Media 2.3.
|
2 |
Contributors: wp_media, GregLone
|
3 |
Tags: optimize images, images, optimize, performance, webp
|
4 |
Requires at least: 4.0.0
|
5 |
+
Tested up to: 5.4
|
6 |
+
Stable tag: 1.9.9
|
7 |
|
8 |
Optimize images in one click: reduce image file sizes, convert WebP, keep your images beautiful… and boost your loading time and your SEO!
|
9 |
|
153 |
4. Other Media Page
|
154 |
|
155 |
== Changelog ==
|
156 |
+
= 1.9.9 - 2020/02/13 =
|
157 |
+
* Fix: do not warn that all the quota has been consumed when it is not the case.
|
158 |
+
* Fix: fix a "chunky upload" error that some users experienced.
|
159 |
+
* Fix: php notices that could happen when optimizing.
|
160 |
+
|
161 |
= 1.9.8.1 - 2019/11/15 =
|
162 |
* Fix: webp image not showing when using the `<picture>` method and the original `<img/>` does not have a `srcset` attribute.
|
163 |
* Fix: a fatal error with WP Offload Media 2.3.
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitb97c519d24d95afd7d57037f5b53badc::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit9a65f06d351d3ca28131bdc6dbd92154
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$classMap = require __DIR__ . '/autoload_classmap.php';
|
33 |
if ($classMap) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitb97c519d24d95afd7d57037f5b53badc
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitb97c519d24d95afd7d57037f5b53badc', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitb97c519d24d95afd7d57037f5b53badc', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitb97c519d24d95afd7d57037f5b53badc::getInitializer($loader));
|
31 |
} else {
|
32 |
$classMap = require __DIR__ . '/autoload_classmap.php';
|
33 |
if ($classMap) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -7,7 +7,7 @@ namespace Composer\Autoload;
|
|
7 |
use Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader as ClassLoaderWPMediaImagifyWordPressPlugin;
|
8 |
|
9 |
|
10 |
-
class
|
11 |
{
|
12 |
public static $prefixLengthsPsr4 = array (
|
13 |
'I' =>
|
@@ -283,9 +283,9 @@ class ComposerStaticInit9a65f06d351d3ca28131bdc6dbd92154
|
|
283 |
public static function getInitializer(ClassLoaderWPMediaImagifyWordPressPlugin $loader)
|
284 |
{
|
285 |
return \Closure::bind(function () use ($loader) {
|
286 |
-
$loader->prefixLengthsPsr4 =
|
287 |
-
$loader->prefixDirsPsr4 =
|
288 |
-
$loader->classMap =
|
289 |
|
290 |
}, null, ClassLoaderWPMediaImagifyWordPressPlugin::class);
|
291 |
}
|
7 |
use Composer\AutoloadWPMediaImagifyWordPressPlugin\ClassLoader as ClassLoaderWPMediaImagifyWordPressPlugin;
|
8 |
|
9 |
|
10 |
+
class ComposerStaticInitb97c519d24d95afd7d57037f5b53badc
|
11 |
{
|
12 |
public static $prefixLengthsPsr4 = array (
|
13 |
'I' =>
|
283 |
public static function getInitializer(ClassLoaderWPMediaImagifyWordPressPlugin $loader)
|
284 |
{
|
285 |
return \Closure::bind(function () use ($loader) {
|
286 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitb97c519d24d95afd7d57037f5b53badc::$prefixLengthsPsr4;
|
287 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitb97c519d24d95afd7d57037f5b53badc::$prefixDirsPsr4;
|
288 |
+
$loader->classMap = ComposerStaticInitb97c519d24d95afd7d57037f5b53badc::$classMap;
|
289 |
|
290 |
}, null, ClassLoaderWPMediaImagifyWordPressPlugin::class);
|
291 |
}
|
views/part-rocket-ad.php
CHANGED
@@ -15,7 +15,6 @@ if ( isset( $notices[ $notice ] ) ) {
|
|
15 |
}
|
16 |
|
17 |
$discount_percent = '20%';
|
18 |
-
$discount_code = 'IMAGIFY20';
|
19 |
$dismiss_url = wp_nonce_url( admin_url( 'admin-post.php?action=imagify_dismiss_ad&ad=' . $notice ), 'imagify-dismiss-ad' );
|
20 |
?>
|
21 |
|
@@ -35,12 +34,6 @@ $dismiss_url = wp_nonce_url( admin_url( 'admin-post.php?action=imagify_dism
|
|
35 |
</p>
|
36 |
|
37 |
<p>
|
38 |
-
<span class="imagify-rocket-cta-promo">
|
39 |
-
<?php
|
40 |
-
/* translators: %s is a coupon code. */
|
41 |
-
printf( __( 'Coupon: %s', 'imagify' ), '<strong>' . $discount_code . '</strong>' );
|
42 |
-
?>
|
43 |
-
</span>
|
44 |
<a class="btn btn-rocket" href="<?php echo esc_url( imagify_get_wp_rocket_url() ); ?>" target="_blank">
|
45 |
<?php
|
46 |
/* translators: %s is a percentage. */
|
15 |
}
|
16 |
|
17 |
$discount_percent = '20%';
|
|
|
18 |
$dismiss_url = wp_nonce_url( admin_url( 'admin-post.php?action=imagify_dismiss_ad&ad=' . $notice ), 'imagify-dismiss-ad' );
|
19 |
?>
|
20 |
|
34 |
</p>
|
35 |
|
36 |
<p>
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
<a class="btn btn-rocket" href="<?php echo esc_url( imagify_get_wp_rocket_url() ); ?>" target="_blank">
|
38 |
<?php
|
39 |
/* translators: %s is a percentage. */
|