Version Description
Release date August 26th 2020
* Fix: there was a PHP warning when using the PICTURE
method to deliver WebP images, which is now fixed;
* Fix: in some cases the image URL's were relative and the optimization could not be done;
* Language: 4 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted.
Download this release
Release Info
Developer | petredobrescu |
Plugin | ShortPixel Image Optimizer |
Version | 4.20.2 |
Comparing to | |
See all releases |
Code changes from version 4.20.1 to 4.20.2
- class/Controller/AdminNoticesController.php +36 -1
- class/Controller/FileSystemController.php +1 -4
- class/Controller/SettingsController.php +5 -4
- class/Model/FileModel.php +25 -5
- class/external/helpscout.php +6 -3
- class/front/img-to-picture-webp.php +4 -0
- class/view/settings/part-general.php +10 -0
- class/wp-short-pixel.php +1 -1
- class/wp-shortpixel-settings.php +34 -1
- readme.txt +8 -2
- res/js/shortpixel.js +21 -1
- res/js/shortpixel.min.js +1 -1
- shortpixel-plugin.php +3 -0
- wp-shortpixel.php +2 -2
class/Controller/AdminNoticesController.php
CHANGED
@@ -142,6 +142,8 @@ class AdminNoticesController extends \ShortPixel\Controller
|
|
142 |
$this->doQuotaNotices();
|
143 |
|
144 |
$this->doIntegrationNotices();
|
|
|
|
|
145 |
}
|
146 |
|
147 |
|
@@ -301,7 +303,7 @@ class AdminNoticesController extends \ShortPixel\Controller
|
|
301 |
|
302 |
$statsSetting = is_array($settings->currentStats) ? $settings->currentStats : array();
|
303 |
$stats = $shortpixel->countAllIfNeeded($statsSetting, 86400);
|
304 |
-
|
305 |
$quotaData = $stats;
|
306 |
$noticeController = Notices::getInstance();
|
307 |
|
@@ -344,6 +346,20 @@ class AdminNoticesController extends \ShortPixel\Controller
|
|
344 |
|
345 |
}
|
346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
// Callback to check if we are on the correct page.
|
348 |
public function upgradeBulkCallback($notice)
|
349 |
{
|
@@ -507,6 +523,25 @@ class AdminNoticesController extends \ShortPixel\Controller
|
|
507 |
return $message;
|
508 |
}
|
509 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
protected function monthlyUpgradeNeeded($quotaData) {
|
511 |
return isset($quotaData['APICallsQuotaNumeric']) && $this->getMonthAvg($quotaData) > $quotaData['APICallsQuotaNumeric'] + ($quotaData['APICallsQuotaOneTimeNumeric'] - $quotaData['APICallsMadeOneTimeNumeric'])/6 + 20;
|
512 |
}
|
142 |
$this->doQuotaNotices();
|
143 |
|
144 |
$this->doIntegrationNotices();
|
145 |
+
|
146 |
+
$this->doHelpOptInNotices();
|
147 |
}
|
148 |
|
149 |
|
303 |
|
304 |
$statsSetting = is_array($settings->currentStats) ? $settings->currentStats : array();
|
305 |
$stats = $shortpixel->countAllIfNeeded($statsSetting, 86400);
|
306 |
+
|
307 |
$quotaData = $stats;
|
308 |
$noticeController = Notices::getInstance();
|
309 |
|
346 |
|
347 |
}
|
348 |
|
349 |
+
|
350 |
+
protected function doHelpOptInNotices()
|
351 |
+
{
|
352 |
+
return; // this is disabled pending review.
|
353 |
+
$settings = \wpSPIO()->settings();
|
354 |
+
$optin = $settings->helpscoutOptin;
|
355 |
+
|
356 |
+
if ($optin == -1)
|
357 |
+
{
|
358 |
+
$message = $this->getHelpOptinMessage();
|
359 |
+
Notices::addNormal($message);
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
// Callback to check if we are on the correct page.
|
364 |
public function upgradeBulkCallback($notice)
|
365 |
{
|
523 |
return $message;
|
524 |
}
|
525 |
|
526 |
+
protected function getHelpOptinMessage()
|
527 |
+
{
|
528 |
+
|
529 |
+
//onclick='ShortPixel.optInHelp(0)'
|
530 |
+
$message = __('Shortpixel needs to ask permission to load the help functionality');
|
531 |
+
$message .= "<div><button type='button' id='sp-helpscout-disallow' class='button button-primary' >" . __('No, I don\'t need help', 'shortpixel-image-optimiser') . "</button> ";
|
532 |
+
$message .= "<button type='button' id='sp-helpscout-allow' class='button button-primary'>" . __('Yes, load the help widget', 'shortpixel-image-optimiser') . "</button></div>";
|
533 |
+
|
534 |
+
$message .= "<p>" . __('Shortpixel uses third party services Helpscout and Quriobot to access our help easier. By giving permission you agree to opt-in and load these service on ShortPixel related pages', 'shortpixel-image-optimiser');
|
535 |
+
|
536 |
+
$message .= "<script>window.addEventListener('load', function(){
|
537 |
+
document.getElementById('sp-helpscout-allow').addEventListener('click', ShortPixel.optInHelp, {once: true} );
|
538 |
+
document.getElementById('sp-helpscout-allow').toggleParam = 'on';
|
539 |
+
document.getElementById('sp-helpscout-disallow').addEventListener('click', ShortPixel.optInHelp, {once: true} );
|
540 |
+
document.getElementById('sp-helpscout-disallow').toggleParam = 'off';
|
541 |
+
}); </script>";
|
542 |
+
return $message;
|
543 |
+
}
|
544 |
+
|
545 |
protected function monthlyUpgradeNeeded($quotaData) {
|
546 |
return isset($quotaData['APICallsQuotaNumeric']) && $this->getMonthAvg($quotaData) > $quotaData['APICallsQuotaNumeric'] + ($quotaData['APICallsQuotaOneTimeNumeric'] - $quotaData['APICallsMadeOneTimeNumeric'])/6 + 20;
|
547 |
}
|
class/Controller/FileSystemController.php
CHANGED
@@ -44,9 +44,7 @@ Class FileSystemController extends \ShortPixel\Controller
|
|
44 |
$filepath = get_attached_file($id);
|
45 |
// same signature as wordpress' filter. Only for this plugin.
|
46 |
$filepath = apply_filters('shortpixel_get_attached_file', $filepath, $id);
|
47 |
-
|
48 |
return new FileModel($filepath);
|
49 |
-
|
50 |
}
|
51 |
|
52 |
/* wp_get_original_image_path with specific ShortPixel filter */
|
@@ -121,7 +119,6 @@ Class FileSystemController extends \ShortPixel\Controller
|
|
121 |
public function getWPUploadBase()
|
122 |
{
|
123 |
$upload_dir = wp_upload_dir(null, false);
|
124 |
-
|
125 |
return $this->getDirectory($upload_dir['basedir']);
|
126 |
}
|
127 |
|
@@ -160,7 +157,7 @@ Class FileSystemController extends \ShortPixel\Controller
|
|
160 |
$directory = $file->getFileDir();
|
161 |
|
162 |
// stolen from wp_get_attachment_url
|
163 |
-
if ( ( $uploads = wp_get_upload_dir() ) && false === $uploads['error'] ) {
|
164 |
// Check that the upload base exists in the file location.
|
165 |
if ( 0 === strpos( $filepath, $uploads['basedir'] ) ) {
|
166 |
// Replace file location with url location.
|
44 |
$filepath = get_attached_file($id);
|
45 |
// same signature as wordpress' filter. Only for this plugin.
|
46 |
$filepath = apply_filters('shortpixel_get_attached_file', $filepath, $id);
|
|
|
47 |
return new FileModel($filepath);
|
|
|
48 |
}
|
49 |
|
50 |
/* wp_get_original_image_path with specific ShortPixel filter */
|
119 |
public function getWPUploadBase()
|
120 |
{
|
121 |
$upload_dir = wp_upload_dir(null, false);
|
|
|
122 |
return $this->getDirectory($upload_dir['basedir']);
|
123 |
}
|
124 |
|
157 |
$directory = $file->getFileDir();
|
158 |
|
159 |
// stolen from wp_get_attachment_url
|
160 |
+
if ( ( $uploads = wp_get_upload_dir() ) && (false === $uploads['error'] || strlen(trim($uploads['error'])) == 0 ) ) {
|
161 |
// Check that the upload base exists in the file location.
|
162 |
if ( 0 === strpos( $filepath, $uploads['basedir'] ) ) {
|
163 |
// Replace file location with url location.
|
class/Controller/SettingsController.php
CHANGED
@@ -38,7 +38,6 @@ class SettingsController extends \ShortPixel\Controller
|
|
38 |
{
|
39 |
// @todo Remove Debug Call
|
40 |
$this->model = new \WPShortPixelSettings();
|
41 |
-
|
42 |
$this->keyModel = new ApiKeyModel();
|
43 |
|
44 |
parent::__construct();
|
@@ -64,7 +63,7 @@ class SettingsController extends \ShortPixel\Controller
|
|
64 |
$this->loadEnv();
|
65 |
$this->checkPost(); // sets up post data
|
66 |
|
67 |
-
$this->model->
|
68 |
|
69 |
if ($this->is_form_submit)
|
70 |
{
|
@@ -118,6 +117,7 @@ class SettingsController extends \ShortPixel\Controller
|
|
118 |
$this->load();
|
119 |
}
|
120 |
|
|
|
121 |
public function action_debug_medialibrary()
|
122 |
{
|
123 |
$this->loadEnv();
|
@@ -127,6 +127,8 @@ class SettingsController extends \ShortPixel\Controller
|
|
127 |
$this->load();
|
128 |
}
|
129 |
|
|
|
|
|
130 |
public function processSave()
|
131 |
{
|
132 |
// Split this in the several screens. I.e. settings, advanced, Key Request IF etc.
|
@@ -176,7 +178,6 @@ class SettingsController extends \ShortPixel\Controller
|
|
176 |
else
|
177 |
\WpShortPixelDb::checkCustomTables();
|
178 |
|
179 |
-
|
180 |
$this->view->data = (Object) $this->model->getData();
|
181 |
if (($this->is_constant_key))
|
182 |
$this->view->data->apiKey = SHORTPIXEL_API_KEY;
|
@@ -192,7 +193,7 @@ class SettingsController extends \ShortPixel\Controller
|
|
192 |
|
193 |
$this->view->cloudflare_constant = defined('SHORTPIXEL_CFTOKEN') ? true : false;
|
194 |
|
195 |
-
$settings =
|
196 |
$this->view->dismissedNotices = $settings->dismissedNotices;
|
197 |
|
198 |
$this->loadView('view-settings');
|
38 |
{
|
39 |
// @todo Remove Debug Call
|
40 |
$this->model = new \WPShortPixelSettings();
|
|
|
41 |
$this->keyModel = new ApiKeyModel();
|
42 |
|
43 |
parent::__construct();
|
63 |
$this->loadEnv();
|
64 |
$this->checkPost(); // sets up post data
|
65 |
|
66 |
+
$this->model->redirectedSe_settingsttings = 2; // Prevents any redirects after loading settings
|
67 |
|
68 |
if ($this->is_form_submit)
|
69 |
{
|
117 |
$this->load();
|
118 |
}
|
119 |
|
120 |
+
|
121 |
public function action_debug_medialibrary()
|
122 |
{
|
123 |
$this->loadEnv();
|
127 |
$this->load();
|
128 |
}
|
129 |
|
130 |
+
|
131 |
+
|
132 |
public function processSave()
|
133 |
{
|
134 |
// Split this in the several screens. I.e. settings, advanced, Key Request IF etc.
|
178 |
else
|
179 |
\WpShortPixelDb::checkCustomTables();
|
180 |
|
|
|
181 |
$this->view->data = (Object) $this->model->getData();
|
182 |
if (($this->is_constant_key))
|
183 |
$this->view->data->apiKey = SHORTPIXEL_API_KEY;
|
193 |
|
194 |
$this->view->cloudflare_constant = defined('SHORTPIXEL_CFTOKEN') ? true : false;
|
195 |
|
196 |
+
$settings = \wpSPIO()->settings();
|
197 |
$this->view->dismissedNotices = $settings->dismissedNotices;
|
198 |
|
199 |
$this->loadView('view-settings');
|
class/Model/FileModel.php
CHANGED
@@ -21,6 +21,7 @@ class FileModel extends \ShortPixel\Model
|
|
21 |
protected $filebase = null; // filename without extension
|
22 |
protected $directory = null;
|
23 |
protected $extension = null;
|
|
|
24 |
|
25 |
// File Status
|
26 |
protected $exists = null;
|
@@ -286,7 +287,17 @@ class FileModel extends \ShortPixel\Model
|
|
286 |
|
287 |
public function getMime()
|
288 |
{
|
289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
}
|
291 |
/* Util function to get location of backup Directory.
|
292 |
* @return Boolean | DirectModel Returns false if directory is not properly set, otherwhise with a new directoryModel
|
@@ -340,9 +351,10 @@ class FileModel extends \ShortPixel\Model
|
|
340 |
$uploadDir = $fs->getWPUploadBase();
|
341 |
$abspath = $fs->getWPAbsPath();
|
342 |
|
343 |
-
if (strpos($path, $abspath->getPath()) === false
|
|
|
344 |
$path = $this->relativeToFullPath($path);
|
345 |
-
|
346 |
$path = apply_filters('shortpixel/filesystem/processFilePath', $path, $original_path);
|
347 |
/* This needs some check here on malformed path's, but can't be test for existing since that's not a requirement.
|
348 |
if (file_exists($path) === false) // failed to process path to something workable.
|
@@ -427,11 +439,19 @@ class FileModel extends \ShortPixel\Model
|
|
427 |
$fs = \wpSPIO()->filesystem();
|
428 |
$uploadDir = $fs->getWPUploadBase();
|
429 |
$abspath = $fs->getWPAbsPath();
|
430 |
-
|
|
|
431 |
{
|
432 |
return $path;
|
433 |
}
|
434 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
|
436 |
// this is probably a bit of a sharp corner to take.
|
437 |
// if path starts with / remove it due to trailingslashing ABSPATH
|
21 |
protected $filebase = null; // filename without extension
|
22 |
protected $directory = null;
|
23 |
protected $extension = null;
|
24 |
+
protected $mime = null;
|
25 |
|
26 |
// File Status
|
27 |
protected $exists = null;
|
287 |
|
288 |
public function getMime()
|
289 |
{
|
290 |
+
if (is_null($this->mime))
|
291 |
+
$this->setFileInfo();
|
292 |
+
|
293 |
+
if ($this->exists())
|
294 |
+
{
|
295 |
+
$this->mime = wp_get_image_mime($this->fullpath);
|
296 |
+
}
|
297 |
+
else
|
298 |
+
$this->mime = false;
|
299 |
+
|
300 |
+
return $this->mime;
|
301 |
}
|
302 |
/* Util function to get location of backup Directory.
|
303 |
* @return Boolean | DirectModel Returns false if directory is not properly set, otherwhise with a new directoryModel
|
351 |
$uploadDir = $fs->getWPUploadBase();
|
352 |
$abspath = $fs->getWPAbsPath();
|
353 |
|
354 |
+
if (strpos($path, $abspath->getPath()) === false)
|
355 |
+
{
|
356 |
$path = $this->relativeToFullPath($path);
|
357 |
+
}
|
358 |
$path = apply_filters('shortpixel/filesystem/processFilePath', $path, $original_path);
|
359 |
/* This needs some check here on malformed path's, but can't be test for existing since that's not a requirement.
|
360 |
if (file_exists($path) === false) // failed to process path to something workable.
|
439 |
$fs = \wpSPIO()->filesystem();
|
440 |
$uploadDir = $fs->getWPUploadBase();
|
441 |
$abspath = $fs->getWPAbsPath();
|
442 |
+
|
443 |
+
if (strpos($path, $uploadDir->getPath()) !== false) // If upload Dir is feature in path, consider it ok.
|
444 |
{
|
445 |
return $path;
|
446 |
}
|
447 |
+
elseif (file_exists($abspath->getPath() . $path)) // If upload dir is abspath plus return path. Exceptions.
|
448 |
+
{
|
449 |
+
return $abspath->getPath() . $path;
|
450 |
+
}
|
451 |
+
elseif(file_exists($uploadDir->getPath() . $path)) // This happens when upload_dir is not properly prepended in get_attachment_file due to WP errors
|
452 |
+
{
|
453 |
+
return $uploadDir->getPath() . $path;
|
454 |
+
}
|
455 |
|
456 |
// this is probably a bit of a sharp corner to take.
|
457 |
// if path starts with / remove it due to trailingslashing ABSPATH
|
class/external/helpscout.php
CHANGED
@@ -8,15 +8,18 @@ class HelpScout
|
|
8 |
{
|
9 |
public static function outputBeacon()
|
10 |
{
|
11 |
-
// this
|
12 |
-
return;
|
13 |
|
14 |
global $shortPixelPluginInstance;
|
15 |
-
$
|
|
|
16 |
if(isset($dismissed['help'])) {
|
17 |
return;
|
18 |
}
|
19 |
|
|
|
|
|
|
|
20 |
$keyControl = ApiKeyController::getInstance();
|
21 |
$apikey = $keyControl->getKeyForDisplay();
|
22 |
|
8 |
{
|
9 |
public static function outputBeacon()
|
10 |
{
|
11 |
+
return; // this is disabled.
|
|
|
12 |
|
13 |
global $shortPixelPluginInstance;
|
14 |
+
$settings = \wpSPIO()->settings();
|
15 |
+
$dismissed = $settings->dismissedNotices ? $settings->dismissedNotices : array();
|
16 |
if(isset($dismissed['help'])) {
|
17 |
return;
|
18 |
}
|
19 |
|
20 |
+
// if ($settings->helpscoutOptin <> 1)
|
21 |
+
|
22 |
+
|
23 |
$keyControl = ApiKeyController::getInstance();
|
24 |
$apikey = $keyControl->getKeyForDisplay();
|
25 |
|
class/front/img-to-picture-webp.php
CHANGED
@@ -200,12 +200,16 @@ class ShortPixelImgToPictureWebp
|
|
200 |
$parts = preg_split('/\s+/', trim($item));
|
201 |
|
202 |
$fileurl = $parts[0];
|
|
|
|
|
|
|
203 |
$condition = isset($parts[1]) ? ' ' . $parts[1] : '';
|
204 |
|
205 |
Log::addDebug('Running item - ' . $item, $fileurl);
|
206 |
|
207 |
$fsFile = $fs->getFile($fileurl);
|
208 |
$extension = $fsFile->getExtension(); // trigger setFileinfo, which will resolve URL -> Path
|
|
|
209 |
$mime = $fsFile->getMime();
|
210 |
|
211 |
$fileWebp = $fs->getFile($imageBase . $fsFile->getFileBase() . '.webp');
|
200 |
$parts = preg_split('/\s+/', trim($item));
|
201 |
|
202 |
$fileurl = $parts[0];
|
203 |
+
// A source that starts with data:, will not need processing.
|
204 |
+
if (strpos($fileurl, 'data:') === 0)
|
205 |
+
continue;
|
206 |
$condition = isset($parts[1]) ? ' ' . $parts[1] : '';
|
207 |
|
208 |
Log::addDebug('Running item - ' . $item, $fileurl);
|
209 |
|
210 |
$fsFile = $fs->getFile($fileurl);
|
211 |
$extension = $fsFile->getExtension(); // trigger setFileinfo, which will resolve URL -> Path
|
212 |
+
|
213 |
$mime = $fsFile->getMime();
|
214 |
|
215 |
$fileWebp = $fs->getFile($imageBase . $fsFile->getFileBase() . '.webp');
|
class/view/settings/part-general.php
CHANGED
@@ -140,6 +140,16 @@
|
|
140 |
</td>
|
141 |
</tr>
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
<?php $imagick = (\wpSPIO()->env()->hasImagick()) ? 1 : 0; ?>
|
144 |
<tr class='exif_imagick_warning view-notice-row' data-imagick="<?php echo $imagick ?>">
|
145 |
<th scope="row"> </th>
|
140 |
</td>
|
141 |
</tr>
|
142 |
|
143 |
+
<?php /* Disabled, pending review <tr>
|
144 |
+
<th scope="row"><?php _e('OptIn for Help Services','shortpixel-image-optimiser');?></th>
|
145 |
+
<td>
|
146 |
+
<input name="helpscoutOptin" type="checkbox" id="helpscoutOptin" value="1" <?php checked($view->data->helpscoutOptin, 1);?>>
|
147 |
+
<label for="helpscoutOptin"><?php _e('Show me InAdmin Help','shortpixel-image-optimiser');?></label>
|
148 |
+
<p class="settings-info"> <?php _e('We use HelpScout and QuriOBot to better serve your questions. You have give permission so we can answer your questions straight in your admin panel','shortpixel-image-optimiser');?></p>
|
149 |
+
|
150 |
+
</td>
|
151 |
+
</tr> */ ?>
|
152 |
+
|
153 |
<?php $imagick = (\wpSPIO()->env()->hasImagick()) ? 1 : 0; ?>
|
154 |
<tr class='exif_imagick_warning view-notice-row' data-imagick="<?php echo $imagick ?>">
|
155 |
<th scope="row"> </th>
|
class/wp-short-pixel.php
CHANGED
@@ -62,7 +62,7 @@ class WPShortPixel {
|
|
62 |
self::$first_run = true;
|
63 |
load_plugin_textdomain('shortpixel-image-optimiser', false, plugin_basename(dirname( SHORTPIXEL_PLUGIN_FILE )).'/lang');
|
64 |
|
65 |
-
$isAdminUser = current_user_can( 'manage_options' );
|
66 |
|
67 |
define('QUOTA_EXCEEDED', $this->view->getQuotaExceededHTML());
|
68 |
|
62 |
self::$first_run = true;
|
63 |
load_plugin_textdomain('shortpixel-image-optimiser', false, plugin_basename(dirname( SHORTPIXEL_PLUGIN_FILE )).'/lang');
|
64 |
|
65 |
+
$isAdminUser = current_user_can( 'manage_options' ); // @todo This should be in env
|
66 |
|
67 |
define('QUOTA_EXCEEDED', $this->view->getQuotaExceededHTML());
|
68 |
|
class/wp-shortpixel-settings.php
CHANGED
@@ -79,6 +79,8 @@ class WPShortPixelSettings extends \ShortPixel\Model {
|
|
79 |
'mediaLibraryViewMode' => array('key' => 'wp-short-pixel-view-mode', 'default' => null, 'group' => 'state'),
|
80 |
'redirectedSettings' => array('key' => 'wp-short-pixel-redirected-settings', 'default' => null, 'group' => 'state'),
|
81 |
'convertedPng2Jpg' => array('key' => 'wp-short-pixel-converted-png2jpg', 'default' => array(), 'group' => 'state'),
|
|
|
|
|
82 |
|
83 |
//bulk state machine
|
84 |
'bulkType' => array('key' => 'wp-short-pixel-bulk-type', 'default' => null, 'group' => 'bulk'),
|
@@ -138,6 +140,7 @@ class WPShortPixelSettings extends \ShortPixel\Model {
|
|
138 |
'savedSpace' => array('s' => 'skip'),
|
139 |
'fileCount' => array('s' => 'skip'), // int
|
140 |
'under5Percent' => array('s' => 'skip'), // int
|
|
|
141 |
);
|
142 |
|
143 |
// @todo Eventually, this should not happen onLoad, but on demand.
|
@@ -286,4 +289,34 @@ class WPShortPixelSettings extends \ShortPixel\Model {
|
|
286 |
}
|
287 |
}
|
288 |
}
|
289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
'mediaLibraryViewMode' => array('key' => 'wp-short-pixel-view-mode', 'default' => null, 'group' => 'state'),
|
80 |
'redirectedSettings' => array('key' => 'wp-short-pixel-redirected-settings', 'default' => null, 'group' => 'state'),
|
81 |
'convertedPng2Jpg' => array('key' => 'wp-short-pixel-converted-png2jpg', 'default' => array(), 'group' => 'state'),
|
82 |
+
'helpscoutOptin' => array('key' => 'wp-short-pixel-helpscout-optin', 'default' => -1, 'group' => 'state'),
|
83 |
+
|
84 |
|
85 |
//bulk state machine
|
86 |
'bulkType' => array('key' => 'wp-short-pixel-bulk-type', 'default' => null, 'group' => 'bulk'),
|
140 |
'savedSpace' => array('s' => 'skip'),
|
141 |
'fileCount' => array('s' => 'skip'), // int
|
142 |
'under5Percent' => array('s' => 'skip'), // int
|
143 |
+
'helpscoutOptin' => array('s' => 'boolean'), // checkbox
|
144 |
);
|
145 |
|
146 |
// @todo Eventually, this should not happen onLoad, but on demand.
|
289 |
}
|
290 |
}
|
291 |
}
|
292 |
+
|
293 |
+
public function ajax_helpscoutOptin()
|
294 |
+
{
|
295 |
+
$toggle = isset($_POST['toggle']) ? sanitize_text_field($_POST['toggle']) : false;
|
296 |
+
$response = array('Status' => 'fail');
|
297 |
+
$settings = \wpSPIO()->settings();
|
298 |
+
|
299 |
+
if (! $toggle)
|
300 |
+
{
|
301 |
+
$response['Status'] = 'No Toggle';
|
302 |
+
}
|
303 |
+
|
304 |
+
if ($toggle == 'off')
|
305 |
+
{
|
306 |
+
$settings->helpscoutOptin = 0;
|
307 |
+
$response['Status'] = 'success';
|
308 |
+
}
|
309 |
+
elseif($toggle == 'on')
|
310 |
+
{
|
311 |
+
$settings->helpscoutOptin = 1;
|
312 |
+
$response['Status'] = 'success';
|
313 |
+
}
|
314 |
+
else
|
315 |
+
{
|
316 |
+
$response['Status'] = 'No valid Toggle';
|
317 |
+
}
|
318 |
+
|
319 |
+
wp_send_json($response);
|
320 |
+
exit();
|
321 |
+
}
|
322 |
+
} // class
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: convert webp, optimize images, image optimization, resize, compressor, ima
|
|
4 |
Requires at least: 3.2.0
|
5 |
Tested up to: 5.5
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 4.20.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -80,7 +80,7 @@ Help us spread the word by recommending ShortPixel to your friends and collect *
|
|
80 |
|
81 |
**Other plugins by ShortPixel**
|
82 |
|
83 |
-
* Image optimization & CDN on the fly - <a href="https://wordpress.org/plugins/shortpixel-adaptive-images/" target="_blank">ShortPixel Adaptive Images</a>
|
84 |
* Easily replace images or files in Media Library - <a href="https://wordpress.org/plugins/enable-media-replace/" target="_blank">Enable Media Replace</a>
|
85 |
* Regenerate thumbnails plugin compatible with the other ShortPixel plugins - <a href="https://wordpress.org/plugins/regenerate-thumbnails-advanced/" target="_blank">reGenerate Thumbnails Advanced</a>
|
86 |
* Make sure you don't have huge images in your Media Library - <a href="https://wordpress.org/plugins/resize-image-after-upload/" target="_blank">Resize Image After Upload</a>
|
@@ -299,6 +299,12 @@ Hide the Cloudflare settings by defining these constants in wp-config.php:
|
|
299 |
9. Check other optimized images status - themes or other plugins' images. (Media>Other Media)
|
300 |
|
301 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
|
303 |
= 4.20.1 =
|
304 |
|
4 |
Requires at least: 3.2.0
|
5 |
Tested up to: 5.5
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 4.20.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
80 |
|
81 |
**Other plugins by ShortPixel**
|
82 |
|
83 |
+
* Image optimization & CDN on the fly - <a href="https://wordpress.org/plugins/shortpixel-adaptive-images/" target="_blank">ShortPixel Adaptive Images</a>
|
84 |
* Easily replace images or files in Media Library - <a href="https://wordpress.org/plugins/enable-media-replace/" target="_blank">Enable Media Replace</a>
|
85 |
* Regenerate thumbnails plugin compatible with the other ShortPixel plugins - <a href="https://wordpress.org/plugins/regenerate-thumbnails-advanced/" target="_blank">reGenerate Thumbnails Advanced</a>
|
86 |
* Make sure you don't have huge images in your Media Library - <a href="https://wordpress.org/plugins/resize-image-after-upload/" target="_blank">Resize Image After Upload</a>
|
299 |
9. Check other optimized images status - themes or other plugins' images. (Media>Other Media)
|
300 |
|
301 |
== Changelog ==
|
302 |
+
= 4.20.2 =
|
303 |
+
|
304 |
+
Release date August 26th 2020
|
305 |
+
* Fix: there was a PHP warning when using the `PICTURE` method to deliver WebP images, which is now fixed;
|
306 |
+
* Fix: in some cases the image URL's were relative and the optimization could not be done;
|
307 |
+
* Language: 4 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted.
|
308 |
|
309 |
= 4.20.1 =
|
310 |
|
res/js/shortpixel.js
CHANGED
@@ -817,6 +817,25 @@ var ShortPixel = function() {
|
|
817 |
return url.replace(parser.protocol + '//' + parser.hostname, parser.protocol + '//' + parser.hostname.split('.').map(function(part) {return sp_punycode.toASCII(part)}).join('.'));
|
818 |
}
|
819 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
820 |
return {
|
821 |
init : init,
|
822 |
setOptions : setOptions,
|
@@ -877,6 +896,7 @@ var ShortPixel = function() {
|
|
877 |
toRefresh : false,
|
878 |
resizeSizesAlert: false,
|
879 |
returnedStatusSearching: 0, // How often this status has come back in a row from server.
|
|
|
880 |
}
|
881 |
}();
|
882 |
|
@@ -1667,4 +1687,4 @@ function SPstringFormat() {
|
|
1667 |
SpioResize.run();
|
1668 |
}
|
1669 |
} );
|
1670 |
-
} )( jQuery, window, document );
|
817 |
return url.replace(parser.protocol + '//' + parser.hostname, parser.protocol + '//' + parser.hostname.split('.').map(function(part) {return sp_punycode.toASCII(part)}).join('.'));
|
818 |
}
|
819 |
|
820 |
+
function optInHelp(e,toggle)
|
821 |
+
{
|
822 |
+
var toggle = e.currentTarget.toggleParam;
|
823 |
+
|
824 |
+
var data = {
|
825 |
+
action: 'shortpixel_helpscoutOptin',
|
826 |
+
toggle: toggle,
|
827 |
+
};
|
828 |
+
var $target = jQuery(e.target);
|
829 |
+
|
830 |
+
jQuery.post(ShortPixel.AJAX_URL, data, function(response) {
|
831 |
+
//data = JSON.parse(response);
|
832 |
+
if(response.Status == 'success') {
|
833 |
+
$target.parents('.shortpixel.notice').fadeOut();
|
834 |
+
//console.log("dismissed");
|
835 |
+
}
|
836 |
+
});
|
837 |
+
}
|
838 |
+
|
839 |
return {
|
840 |
init : init,
|
841 |
setOptions : setOptions,
|
896 |
toRefresh : false,
|
897 |
resizeSizesAlert: false,
|
898 |
returnedStatusSearching: 0, // How often this status has come back in a row from server.
|
899 |
+
optInHelp: optInHelp, // Optin for Helpscout cs
|
900 |
}
|
901 |
}();
|
902 |
|
1687 |
SpioResize.run();
|
1688 |
}
|
1689 |
} );
|
1690 |
+
} )( jQuery, window, document );
|
res/js/shortpixel.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready((function(){ShortPixel.init()}));var ShortPixel=function(){function e(){if(typeof ShortPixel.API_IS_ACTIVE!=="undefined")return;if(jQuery("table.wp-list-table.media").length>0){jQuery('select[name^="action"] option:last-child').before('<option value="short-pixel-bulk">'+_spTr.optimizeWithSP+'</option><option value="short-pixel-bulk-lossy"> → '+_spTr.redoLossy+'</option><option value="short-pixel-bulk-glossy"> → '+_spTr.redoGlossy+'</option><option value="short-pixel-bulk-lossless"> → '+_spTr.redoLossless+'</option><option value="short-pixel-bulk-restore"> → '+_spTr.restoreOriginal+"</option>")}ShortPixel.setOptions(ShortPixelConstants[0]);if(jQuery("#backup-folder-size").length){jQuery("#backup-folder-size").html(ShortPixel.getBackupSize())}if(ShortPixel.MEDIA_ALERT=="todo"&&jQuery("div.media-frame.mode-grid").length>0){jQuery("div.media-frame.mode-grid").before('<div id="short-pixel-media-alert" class="notice notice-warning"><p>'+SPstringFormat(_spTr.changeMLToListMode,'<a href="upload.php?mode=list" class="view-list"><span class="screen-reader-text">'," </span>",'</a><a class="alignright" href="javascript:ShortPixel.dismissMediaAlert();">',"</a>")+"</p></div>")}jQuery(window).on("beforeunload",(function(){if(ShortPixel.bulkProcessor==true){clearBulkProcessor()}}));checkQuotaExceededAlert();checkBulkProgress()}function r(e){for(var r in e){ShortPixel[r]=e[r]}}function t(e){return/^\w+([\.+-]?\w+)*@\w+([\.-]?\w+)*(\.\w{1,63})+$/.test(e)}function i(){var e=jQuery("#pluginemail").val();if(ShortPixel.isEmailValid(e)){jQuery("#request_key").removeClass("disabled")}jQuery("#request_key").attr("href",jQuery("#request_key").attr("href").split("?")[0]+"?pluginemail="+e)}function s(e){jQuery("#valid").val("validate");jQuery(e).parents("form").submit()}jQuery("#key").keypress((function(e){if(e.which==13){jQuery("#valid").val("validate")}}));function o(e){if(jQuery(e).is(":checked")){jQuery("#width,#height").removeAttr("disabled");SpioResize.lastW=false;jQuery(".resize-type-wrap").show(800,window.SpioResize.run)}else{jQuery("#width,#height").attr("disabled","disabled");window.SpioResize.hide();jQuery(".resize-type-wrap").hide(800)}}function a(){if(!jQuery('input[name="removeExif"]').is(":checked")&&jQuery('input[name="png2jpg"]').is(":checked"))jQuery(".exif_warning").fadeIn();else jQuery(".exif_warning").fadeOut();if(!jQuery('input[name="removeExif"]').is(":checked")&&jQuery(".exif_imagick_warning").data("imagick")<=0)jQuery(".exif_imagick_warning").fadeIn();else jQuery(".exif_imagick_warning").fadeOut()}function l(){if(!jQuery('input[name="backupImages"]').is(":checked")){jQuery(".backup_warning").fadeIn()}else{jQuery(".backup_warning").fadeOut()}}function n(){var e=0;if(typeof document.wp_shortpixel_options!=="undefined")e=document.wp_shortpixel_options.compressionType;for(var r=0,t=null;r<e.length;r++){e[r].onclick=function(){if(this!==t){t=this}if(typeof ShortPixel.setupGeneralTabAlert!=="undefined")return;alert(_spTr.alertOnlyAppliesToNewImages);ShortPixel.setupGeneralTabAlert=1}}ShortPixel.enableResize("#resize");jQuery("#resize").change((function(){o(this)}));jQuery(".resize-sizes").blur((function(e){var r=jQuery(e.target);if(ShortPixel.resizeSizesAlert==r.val())return;ShortPixel.resizeSizesAlert=r.val();var t=jQuery("#min-"+r.attr("name")).val();var i=jQuery("#min-"+r.attr("name")).data("nicename");if(r.val()<Math.min(t,1024)){if(t>1024){alert(SPstringFormat(_spTr.pleaseDoNotSetLesser1024,i))}else{alert(SPstringFormat(_spTr.pleaseDoNotSetLesserSize,i,i,t))}e.preventDefault();r.focus()}else{this.defaultValue=r.val()}}));jQuery(".shortpixel-confirm").click((function(e){var r=confirm(e.target.getAttribute("data-confirm"));if(!r){e.preventDefault();return false}return true}));jQuery('input[name="removeExif"], input[name="png2jpg"]').on("change",(function(){ShortPixel.checkExifWarning()}));ShortPixel.checkExifWarning();jQuery('input[name="backupImages"]').on("change",(function(){ShortPixel.checkBackUpWarning()}));ShortPixel.checkBackUpWarning()}function u(){jQuery(".wp-shortpixel-options .shortpixel-key-valid").css("display","none");jQuery(".wp-shortpixel-options button#validate").css("display","inline-block")}function p(){jQuery("input.remove-folder-button").click((function(){var e=jQuery(this).data("value");var r=jQuery(this).data("name");var t=confirm(SPstringFormat(_spTr.areYouSureStopOptimizing,r));if(t==true){jQuery("#removeFolder").val(e);jQuery("#wp_shortpixel_options").submit()}}));jQuery("input.recheck-folder-button").click((function(){var e=jQuery(this).data("value");var r=confirm(SPstringFormat(_spTr.areYouSureStopOptimizing,e));if(r==true){jQuery("#recheckFolder").val(e);jQuery("#wp_shortpixel_options").submit()}}))}function c(e){var r=jQuery("#"+(e.checked?"total":"main")+"ToProcess").val();jQuery("div.bulk-play span.total").text(r);jQuery("#displayTotal").text(r)}function d(){ShortPixel.adjustSettingsTabs();ShortPixel.setupGeneralTab();jQuery(window).resize((function(){ShortPixel.adjustSettingsTabs()}));jQuery("article.sp-tabs a.tab-link").click((function(e){var r=jQuery(e.target).data("id");ShortPixel.switchSettingsTab(r)}));jQuery("input[type=radio][name=deliverWebpType]").change((function(){if(this.value=="deliverWebpAltered"){if(window.confirm(_spTr.alertDeliverWebPAltered)){var e=jQuery("input[type=radio][name=deliverWebpAlteringType]:checked").length;if(e==0){jQuery("#deliverWebpAlteredWP").prop("checked",true)}}else{jQuery(this).prop("checked",false)}}else if(this.value=="deliverWebpUnaltered"){window.alert(_spTr.alertDeliverWebPUnaltered)}}))}function h(e){var r=e.replace("tab-",""),t="",i=jQuery("section#"+e);jQuery('input[name="display_part"]').val(r);var s=window.location.href.toString();if(s.indexOf("?")>0){var o=s.substring(0,s.indexOf("?"));o+="?"+jQuery.param({page:"wp-shortpixel-settings",part:r});window.history.replaceState({},document.title,o)}if(i.length>0){jQuery("section").removeClass("sel-tab");jQuery("section .wp-shortpixel-tab-content").fadeOut(50);jQuery(i).addClass("sel-tab");ShortPixel.adjustSettingsTabs();jQuery(i).find(".wp-shortpixel-tab-content").fadeIn(50)}if(typeof HS!=="undefined"&&typeof HS.beacon.suggest!=="undefined"){switch(r){case"settings":t=shortpixel_suggestions_settings;break;case"adv-settings":t=shortpixel_suggestions_adv_settings;break;case"cloudflare":case"stats":t=shortpixel_suggestions_cloudflare;break;default:break}HS.beacon.suggest(t)}}function f(){var e=jQuery("section.sel-tab").height()+90;jQuery(".section-wrapper").css("height",e)}function m(){var e={action:"shortpixel_dismiss_media_alert"};jQuery.get(ShortPixel.AJAX_URL,e,(function(r){e=JSON.parse(r);if(e["Status"]=="success"){jQuery("#short-pixel-media-alert").hide()}}))}function g(){jQuery("#shortpixel-hs-button-blind").remove();jQuery("#shortpixel-hs-tools").remove();jQuery("#hs-beacon").remove();jQuery("#botbutton").remove();jQuery("#shortpixel-hs-blind").remove()}function S(){g();dismissShortPixelNotice("help")}function y(){var e={action:"shortpixel_check_quota",nonce:ShortPixelActions.nonce_check_quota,return_json:true};jQuery.post(ShortPixel.AJAX_URL,e,(function(e){console.log("quota refreshed");console.log(e);window.location.href=e.redirect}))}function x(e){if(e.checked){jQuery("#with-thumbs").css("display","inherit");jQuery("#without-thumbs").css("display","none")}else{jQuery("#without-thumbs").css("display","inherit");jQuery("#with-thumbs").css("display","none")}}function j(e,r,t,i,s){return(r>0?"<div class='sp-column-info'>"+_spTr.reducedBy+" <strong><span class='percent'>"+r+"%</span></strong> ":"")+(r>0&&r<5?"<br>":"")+(r<5?_spTr.bonusProcessing:"")+(t.length>0?" ("+t+")":"")+(0+i>0?"<br>"+SPstringFormat(_spTr.plusXthumbsOpt,i):"")+(0+s>0?"<br>"+SPstringFormat(_spTr.plusXretinasOpt,s):"")+"</div>"}function P(e,r){jQuery(e).knob({readOnly:true,width:r,height:r,fgColor:"#1CAECB",format:function(e){return e+"%"}})}function v(e,r,t,i,s,o){if(s==1){var a=jQuery(".sp-column-actions-template").clone();if(!a.length)return false;var l;if(r.length==0){l=["lossy","lossless"]}else{l=["lossy","glossy","lossless"].filter((function(e){return!(e==r)}))}a.html(a.html().replace(/__SP_ID__/g,e));if(o.substr(o.lastIndexOf(".")+1).toLowerCase()=="pdf"){jQuery(".sp-action-compare",a).remove()}if(t==0&&i>0){a.html(a.html().replace("__SP_THUMBS_TOTAL__",i))}else{jQuery(".sp-action-optimize-thumbs",a).remove();jQuery(".sp-dropbtn",a).removeClass("button-primary")}a.html(a.html().replace(/__SP_FIRST_TYPE__/g,l[0]));a.html(a.html().replace(/__SP_SECOND_TYPE__/g,l[1]));return a.html()}return""}function Q(e,r){e=e.substring(2);if(jQuery(".shortpixel-other-media").length){var t=["optimize","retry","restore","redo","quota","view"];for(var i=0,s=t.length;i<s;i++){jQuery("#"+t[i]+"_"+e).css("display","none")}for(var i=0,s=r.length;i<s;i++){jQuery("#"+r[i]+"_"+e).css("display","")}}}function b(e){ShortPixel.retries++;if(isNaN(ShortPixel.retries))ShortPixel.retries=1;if(ShortPixel.retries<6){console.log("Invalid response from server (Error: "+e+"). Retrying pass "+(ShortPixel.retries+1)+"...");setBulkTimer(5e3)}else{ShortPixel.bulkShowError(-1,"Invalid response from server received 6 times. Please retry later by reloading this page, or <a href='https://shortpixel.com/contact' target='_blank'>contact support</a>. (Error: "+e+")","");console.log("Invalid response from server 6 times. Giving up.")}}function k(e){e.action="shortpixel_browse_content";var r="";jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){r=e},async:false});return r}function T(){var e={action:"shortpixel_get_backup_size"};var r="";jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){r=e},async:false});return r}function _(e){if(!jQuery("#tos").is(":checked")){e.preventDefault();jQuery("#tos-robo").fadeIn(400,(function(){jQuery("#tos-hand").fadeIn()}));jQuery("#tos").click((function(){jQuery("#tos-robo").css("display","none");jQuery("#tos-hand").css("display","none")}));return}jQuery("#request_key").addClass("disabled");jQuery("#pluginemail_spinner").addClass("is-active");ShortPixel.updateSignupEmail();if(ShortPixel.isEmailValid(jQuery("#pluginemail").val())){jQuery("#pluginemail-error").css("display","none");var r={action:"shortpixel_new_api_key",email:jQuery("#pluginemail").val()};jQuery.ajax({type:"POST",async:false,url:ShortPixel.AJAX_URL,data:r,success:function(r){data=JSON.parse(r);if(data["Status"]=="success"){e.preventDefault();window.location.reload()}else if(data["Status"]=="invalid"){jQuery("#pluginemail-error").html("<b>"+data["Details"]+"</b>");jQuery("#pluginemail-error").css("display","");jQuery("#pluginemail-info").css("display","none");e.preventDefault()}else{}}});jQuery("#request_key").removeAttr("onclick")}else{jQuery("#pluginemail-error").css("display","");jQuery("#pluginemail-info").css("display","none");e.preventDefault()}jQuery("#request_key").removeClass("disabled");jQuery("#pluginemail_spinner").removeClass("is-active")}function w(){jQuery("#shortPixelProposeUpgrade .sp-modal-body").addClass("sptw-modal-spinner");jQuery("#shortPixelProposeUpgrade .sp-modal-body").html("");jQuery("#shortPixelProposeUpgradeShade").css("display","block");jQuery("#shortPixelProposeUpgrade").removeClass("shortpixel-hide");var e={action:"shortpixel_propose_upgrade"};jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){jQuery("#shortPixelProposeUpgrade .sp-modal-body").removeClass("sptw-modal-spinner");jQuery("#shortPixelProposeUpgrade .sp-modal-body").html(e)}})}function C(){jQuery("#shortPixelProposeUpgradeShade").css("display","none");jQuery("#shortPixelProposeUpgrade").addClass("shortpixel-hide");if(ShortPixel.toRefresh){ShortPixel.checkQuota()}}function A(){jQuery(".select-folder-button").click((function(){jQuery(".sp-folder-picker-shade").fadeIn(100);jQuery(".shortpixel-modal.modal-folder-picker").show();var e=jQuery(".sp-folder-picker");e.parent().css("margin-left",-e.width()/2);e.fileTree({script:ShortPixel.browseContent,multiFolder:false})}));jQuery(".shortpixel-modal input.select-folder-cancel, .sp-folder-picker-shade").click((function(){jQuery(".sp-folder-picker-shade").fadeOut(100);jQuery(".shortpixel-modal.modal-folder-picker").hide()}));jQuery(".shortpixel-modal input.select-folder").click((function(e){var r=jQuery("UL.jqueryFileTree LI.directory.selected");if(jQuery(r).length==0)var r=jQuery("UL.jqueryFileTree LI.selected").parents(".directory");var t=jQuery(r).children("a").attr("rel");if(typeof t==="undefined")return;t=t.trim();if(t){var i=jQuery("#customFolderBase").val()+t;i=i.replace(/\/\//,"/");console.debug("FullPath"+i);jQuery("#addCustomFolder").val(i);jQuery("#addCustomFolderView").val(i);jQuery(".sp-folder-picker-shade").fadeOut(100);jQuery(".shortpixel-modal.modal-folder-picker").css("display","none");jQuery("#saveAdvAddFolder").removeClass("hidden")}else{alert("Please select a folder from the list.")}}))}function U(e,r,t){var i=jQuery(".bulk-notice-msg.bulk-lengthy");if(i.length==0)return;var s=jQuery("a",i);s.text(r);if(t){s.attr("href",t)}else{s.attr("href",s.data("href").replace("__ID__",e))}i.css("display","block")}function z(){jQuery(".bulk-notice-msg.bulk-lengthy").css("display","none")}function R(e){var r=jQuery(".bulk-notice-msg.bulk-"+e);if(r.length==0)return;r.css("display","block")}function E(e){jQuery(".bulk-notice-msg.bulk-"+e).css("display","none")}function M(e,r,t,i){var s=jQuery("#bulk-error-template");if(s.length==0)return;var o=s.clone();o.attr("id","bulk-error-"+e);if(e==-1){jQuery("span.sp-err-title",o).remove();o.addClass("bulk-error-fatal")}else{jQuery("img",o).remove();jQuery("#bulk-error-".id).remove()}jQuery("span.sp-err-content",o).html(r);var a=jQuery("a.sp-post-link",o);if(i){a.attr("href",i)}else{a.attr("href",a.attr("href").replace("__ID__",e))}a.text(t);s.after(o);o.css("display","block")}function B(e,r){if(!confirm(_spTr["confirmBulk"+e])){r.stopPropagation();r.preventDefault();return false}return true}function L(e){var r=jQuery(e.target).val();var t=jQuery('input[name="random_answer"]').val();var i=jQuery('input[name="random_answer"]').data("target");if(r==t){jQuery(i).removeClass("disabled").prop("disabled",false);jQuery(i).removeAttr("aria-disabled")}else{jQuery(i).addClass("disabled").prop("disabled",true)}}function I(e){jQuery(e).parent().parent().remove()}function D(e){return e.substring(0,2)=="C-"}function O(e){e.preventDefault();if(!this.menuCloseEvent){jQuery(window).click((function(e){if(!e.target.matches(".sp-dropbtn")){jQuery(".sp-dropdown.sp-show").removeClass("sp-show")}}));this.menuCloseEvent=true}var r=e.target.parentElement.classList.contains("sp-show");jQuery(".sp-dropdown.sp-show").removeClass("sp-show");if(!r)e.target.parentElement.classList.add("sp-show")}function F(e){this.comparerData.origUrl=false;if(this.comparerData.cssLoaded===false){jQuery("<link>").appendTo("head").attr({type:"text/css",rel:"stylesheet",href:this.WP_PLUGIN_URL+"/res/css/twentytwenty.min.css"});this.comparerData.cssLoaded=2}if(this.comparerData.jsLoaded===false){jQuery.getScript(this.WP_PLUGIN_URL+"/res/js/jquery.twentytwenty.min.js",(function(){ShortPixel.comparerData.jsLoaded=2;if(ShortPixel.comparerData.origUrl.length>0){ShortPixel.displayComparerPopup(ShortPixel.comparerData.width,ShortPixel.comparerData.height,ShortPixel.comparerData.origUrl,ShortPixel.comparerData.optUrl)}}));this.comparerData.jsLoaded=1}if(this.comparerData.origUrl===false){jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_get_comparer_data",id:e},success:function(e){data=JSON.parse(e);jQuery.extend(ShortPixel.comparerData,data);if(ShortPixel.comparerData.jsLoaded==2){ShortPixel.displayComparerPopup(ShortPixel.comparerData.width,ShortPixel.comparerData.height,ShortPixel.comparerData.origUrl,ShortPixel.comparerData.optUrl)}}});this.comparerData.origUrl=""}}function N(e,r,t,i){var s=e;var o=r<150||e<350;var a=jQuery(o?"#spUploadCompareSideBySide":"#spUploadCompare");var l=jQuery(".sp-modal-shade");if(!o){jQuery("#spCompareSlider").html('<img alt="'+_spTr.originalImage+'" class="spUploadCompareOriginal"/><img alt="'+_spTr.optimizedImage+'" class="spUploadCompareOptimized"/>')}e=Math.max(350,Math.min(800,e<350?(e+25)*2:r<150?e+25:e));r=Math.max(150,o?s>350?2*(r+45):r+45:r*e/s);var n="-"+Math.round(e/2);jQuery(".sp-modal-body",a).css("width",e);jQuery(".shortpixel-slider",a).css("width",e);a.css("width",e);a.css("marginLeft",n+"px");jQuery(".sp-modal-body",a).css("height",r);a.show();l.show();if(!o){jQuery("#spCompareSlider").twentytwenty({slider_move:"mousemove"})}jQuery(".sp-close-button").on("click",ShortPixel.closeComparerPopup);jQuery(document).on("keyup.sp_modal_active",ShortPixel.closeComparerPopup);jQuery(".sp-modal-shade").on("click",ShortPixel.closeComparerPopup);var u=jQuery(".spUploadCompareOptimized",a);jQuery(".spUploadCompareOriginal",a).attr("src",t);setTimeout((function(){jQuery(window).trigger("resize")}),1e3);u.load((function(){jQuery(window).trigger("resize")}));u.attr("src",i)}function W(e){jQuery("#spUploadCompareSideBySide").hide();jQuery("#spUploadCompare").hide();jQuery(".sp-modal-shade").hide();jQuery(document).unbind("keyup.sp_modal_active");jQuery(".sp-modal-shade").off("click");jQuery(".sp-close-button").off("click")}function J(e){var r=document.createElement("a");r.href=e;if(e.indexOf(r.protocol+"//"+r.hostname)<0){return r.href}return e.replace(r.protocol+"//"+r.hostname,r.protocol+"//"+r.hostname.split(".").map((function(e){return sp_punycode.toASCII(e)})).join("."))}return{init:e,setOptions:r,isEmailValid:t,updateSignupEmail:i,validateKey:s,enableResize:o,setupGeneralTab:n,apiKeyChanged:u,setupAdvancedTab:p,checkThumbsUpdTotal:c,initSettings:d,switchSettingsTab:h,adjustSettingsTabs:f,onBulkThumbsCheck:x,dismissMediaAlert:m,closeHelpPane:g,dismissHelpPane:S,checkQuota:y,percentDial:P,successMsg:j,successActions:v,otherMediaUpdateActions:Q,retry:b,initFolderSelector:A,browseContent:k,getBackupSize:T,newApiKey:_,proposeUpgrade:w,closeProposeUpgrade:C,bulkShowLengthyMsg:U,bulkHideLengthyMsg:z,bulkShowMaintenanceMsg:R,bulkHideMaintenanceMsg:E,bulkShowError:M,confirmBulkAction:B,checkRandomAnswer:L,removeBulkMsg:I,isCustomImageId:D,openImageMenu:O,menuCloseEvent:false,loadComparer:F,displayComparerPopup:N,closeComparerPopup:W,convertPunycode:J,checkExifWarning:a,checkBackUpWarning:l,comparerData:{cssLoaded:false,jsLoaded:false,origUrl:false,optUrl:false,width:0,height:0},toRefresh:false,resizeSizesAlert:false,returnedStatusSearching:0}}();function showToolBarAlert(e,r,t){var i=jQuery("li.shortpixel-toolbar-processing");switch(e){case ShortPixel.STATUS_QUOTA_EXCEEDED:if(window.location.href.search("wp-short-pixel-bulk")>0&&jQuery(".sp-quota-exceeded-alert").length==0){return}i.addClass("shortpixel-alert");i.addClass("shortpixel-quota-exceeded");jQuery("a",i).attr("href","options-general.php?page=wp-shortpixel-settings");jQuery("a div",i).attr("title","ShortPixel quota exceeded. Click for details.");break;case ShortPixel.STATUS_SKIP:case ShortPixel.STATUS_FAIL:i.addClass("shortpixel-alert shortpixel-processing");jQuery("a div",i).attr("title",r);if(typeof t!=="undefined"){jQuery("a",i).attr("href","post.php?post="+t+"&action=edit")}break;case ShortPixel.STATUS_NO_KEY:i.addClass("shortpixel-alert");i.addClass("shortpixel-quota-exceeded");jQuery("a",i).attr("href","options-general.php?page=wp-shortpixel-settings");jQuery("a div",i).attr("title","Get API Key");break;case ShortPixel.STATUS_SUCCESS:case ShortPixel.STATUS_RETRY:i.addClass("shortpixel-processing");i.removeClass("shortpixel-alert");jQuery("a",i).removeAttr("target");jQuery("a",i).attr("href",jQuery("a img",i).attr("success-url"))}i.removeClass("shortpixel-hide")}function hideToolBarAlert(e){var r=jQuery("li.shortpixel-toolbar-processing.shortpixel-processing");if(ShortPixel.STATUS_EMPTY_QUEUE==e){if(r.hasClass("shortpixel-alert")||r.hasClass("shortpixel-quota-exceeded")){return}}r.addClass("shortpixel-hide")}function hideQuotaExceededToolBarAlert(){jQuery("li.shortpixel-toolbar-processing.shortpixel-quota-exceeded").addClass("shortpixel-hide")}function checkQuotaExceededAlert(){if(typeof shortPixelQuotaExceeded!="undefined"){if(shortPixelQuotaExceeded==1){showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED)}else{hideQuotaExceededToolBarAlert()}}}function checkBulkProgress(){var e=function(e){if(!r){r=true;return e}return"/"};var r=false;var t=window.location.href.toLowerCase().replace(/\/\//g,e);r=false;var i=ShortPixel.WP_ADMIN_URL.toLowerCase().replace(/\/\//g,e);if(t.search(i)<0){t=ShortPixel.convertPunycode(t);i=ShortPixel.convertPunycode(i)}if(ShortPixel.bulkProcessor==true&&window.location.href.search("wp-short-pixel-bulk")<0&&typeof localStorage.bulkPage!=="undefined"&&localStorage.bulkPage>0){ShortPixel.bulkProcessor=false}if(window.location.href.search("wp-short-pixel-bulk")>=0){ShortPixel.bulkProcessor=true;localStorage.bulkTime=Date.now();localStorage.bulkPage=1;ShortPixel.BULK_SECRET=false}if(ShortPixel.BULK_SECRET!==false){if(ShortPixel.BULK_SECRET!=localStorage.bulkSecret){clearBulkProcessor();jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-processing");jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-hide");return}}if(ShortPixel.bulkProcessor==true||typeof localStorage.bulkTime=="undefined"||Date.now()-localStorage.bulkTime>1e4){ShortPixel.bulkProcessor=true;localStorage.bulkPage=window.location.href.search("wp-short-pixel-bulk")>=0?1:0;localStorage.bulkTime=Date.now();if(localStorage.getItem("bulkSecret")==null)localStorage.bulkSecret=Math.random().toString(36).substring(7);checkBulkProcessingCallApi()}else{setBulkTimer(2e4)}}var bulkTimer;function setBulkTimer(e){window.clearTimeout(bulkTimer);if(e>0){bulkTimer=window.setTimeout(checkBulkProgress,e)}}function checkBulkProcessingCallApi(){var e={action:"shortpixel_image_processing","bulk-secret":localStorage.bulkSecret};jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){if(e.length>0){var r=null;try{var r=JSON.parse(e)}catch(e){ShortPixel.retry(e.message);return}ShortPixel.retries=0;var t=r["ImageID"];var i=jQuery("div.short-pixel-bulk-page").length>0;if(r["Status"]&&r["Status"]!=ShortPixel.STATUS_SEARCHING){if(ShortPixel.returnedStatusSearching>=2)jQuery(".bulk-notice-msg.bulk-searching").hide();ShortPixel.returnedStatusSearching=0}switch(r["Status"]){case ShortPixel.STATUS_NO_KEY:setCellMessage(t,r["Message"],"<a class='button button-smaller button-primary' href=\"https://shortpixel.com/wp-apikey"+'" target="_blank">'+_spTr.getApiKey+"</a>");showToolBarAlert(ShortPixel.STATUS_NO_KEY);break;case ShortPixel.STATUS_QUOTA_EXCEEDED:setCellMessage(t,r["Message"],"<a class='button button-smaller button-primary' href=\"https://shortpixel.com/login/"+'" target="_blank">'+_spTr.extendQuota+"</a>"+"<a class='button button-smaller' href='javascript:ShortPixel.checkQuota()'>"+_spTr.check__Quota+"</a>");showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED);if(r["Stop"]==false){setBulkTimer(5e3)}ShortPixel.otherMediaUpdateActions(t,["quota","view"]);break;case ShortPixel.STATUS_FAIL:setCellMessage(t,r["Message"],"<a class='button button-smaller button-primary' href=\"javascript:manualOptimization('"+t+"', true)\">"+_spTr.retry+"</a>");showToolBarAlert(ShortPixel.STATUS_FAIL,r["Message"],t);if(i){ShortPixel.bulkShowError(t,r["Message"],r["Filename"],r["CustomImageLink"]);if(r["BulkPercent"]){progressUpdate(r["BulkPercent"],r["BulkMsg"])}ShortPixel.otherMediaUpdateActions(t,["retry","view"])}console.log(r["Message"]);setBulkTimer(5e3);break;case ShortPixel.STATUS_EMPTY_QUEUE:console.log(r["Message"]);clearBulkProcessor();hideToolBarAlert(r["Status"]);var s=jQuery("#bulk-progress");if(i&&s.length&&r["BulkStatus"]!="2"){progressUpdate(100,"Bulk finished!");jQuery("a.bulk-cancel").attr("disabled","disabled");hideSlider();setTimeout((function(){window.location.reload()}),3e3)}break;case ShortPixel.STATUS_SUCCESS:if(i){ShortPixel.bulkHideLengthyMsg();ShortPixel.bulkHideMaintenanceMsg()}var o=r["PercentImprovement"];showToolBarAlert(ShortPixel.STATUS_SUCCESS,"");var a=ShortPixel.isCustomImageId(t)?"":ShortPixel.successActions(t,r["Type"],r["ThumbsCount"],r["ThumbsTotal"],r["BackupEnabled"],r["Filename"]);setCellMessage(t,ShortPixel.successMsg(t,o,r["Type"],r["ThumbsCount"],r["RetinasCount"]),a);if(jQuery("#post-"+t).length>0)jQuery("#post-"+t).find(".filename").text(r["Filename"]);if(jQuery(".misc-pub-filename strong").length>0)jQuery(".misc-pub-filename strong").text(r["Filename"]);if(ShortPixel.isCustomImageId(t)&&r["TsOptimized"]&&r["TsOptimized"].length>0){var l=jQuery(".list-overview .item-"+t);jQuery(l).children(".date").text(r["TsOptimized"]);jQuery(l).find(".row-actions .action-optimize").remove()}var n=jQuery(["restore","view","redolossy","redoglossy","redolossless"]).not(["redo"+r["Type"]]).get();ShortPixel.otherMediaUpdateActions(t,n);var u=new PercentageAnimator("#sp-msg-"+t+" span.percent",o);u.animate(o);if(i&&typeof r["Thumb"]!=="undefined"){if(r["BulkPercent"]){progressUpdate(r["BulkPercent"],r["BulkMsg"])}if(r["Thumb"].length>0){sliderUpdate(t,r["Thumb"],r["BkThumb"],r["PercentImprovement"],r["Filename"]);if(typeof r["AverageCompression"]!=="undefined"&&0+r["AverageCompression"]>0){jQuery("#sp-avg-optimization").html('<input type="text" class="dial" value="'+Math.round(r["AverageCompression"])+'"/>');ShortPixel.percentDial("#sp-avg-optimization .dial",60)}}}console.log("Server response: "+e);if(i&&typeof r["BulkPercent"]!=="undefined"){progressUpdate(r["BulkPercent"],r["BulkMsg"])}setBulkTimer(5e3);break;case ShortPixel.STATUS_SKIP:if(r["Silent"]!==1){ShortPixel.bulkShowError(t,r["Message"],r["Filename"],r["CustomImageLink"])}case ShortPixel.STATUS_ERROR:if(typeof r["Message"]!=="undefined"){showToolBarAlert(ShortPixel.STATUS_SKIP,r["Message"]+" Image ID: "+t);setCellMessage(t,r["Message"],"")}ShortPixel.otherMediaUpdateActions(t,["retry","view"]);case ShortPixel.STATUS_RETRY:console.log("Server response: "+e);showToolBarAlert(ShortPixel.STATUS_RETRY,"");if(i&&typeof r["BulkPercent"]!=="undefined"){progressUpdate(r["BulkPercent"],r["BulkMsg"])}if(i&&r["Count"]>3){ShortPixel.bulkShowLengthyMsg(t,r["Filename"],r["CustomImageLink"])}setBulkTimer(5e3);break;case ShortPixel.STATUS_SEARCHING:console.log("Server response: "+e);ShortPixel.returnedStatusSearching++;if(ShortPixel.returnedStatusSearching>=2){jQuery(".bulk-notice-msg.bulk-searching").show()}setBulkTimer(2500);break;case ShortPixel.STATUS_MAINTENANCE:ShortPixel.bulkShowMaintenanceMsg("maintenance");setBulkTimer(6e4);break;case ShortPixel.STATUS_QUEUE_FULL:ShortPixel.bulkShowMaintenanceMsg("queue-full");setBulkTimer(6e4);break;default:ShortPixel.retry("Unknown status "+r["Status"]+". Retrying...");break}if(typeof t!="undefined"&&ShortPixel.isCustomImageId(t)){var l=jQuery(".list-overview .item-"+t);jQuery(l).find(".row-actions .action-optimize").remove();if(r["actions"]){jQuery(l).children(".actions").html(r["actions"])}}}},error:function(e){ShortPixel.retry(e.statusText)}})}function clearBulkProcessor(){ShortPixel.bulkProcessor=false;localStorage.bulkTime=Date.now();setBulkTimer(0);if(window.location.href.search("wp-short-pixel-bulk")>=0){localStorage.bulkPage=0}}function setCellMessage(e,r,t){var i=jQuery("#sp-msg-"+e);if(i.length>0){i.html("<div class='sp-column-actions'>"+t+"</div>"+"<div class='sp-column-info'>"+r+"</div>");i.css("color","")}i=jQuery("#sp-cust-msg-"+e);if(i.length>0){i.html("<div class='sp-column-info'>"+r+"</div>")}}function manualOptimization(e,r){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>Image waiting to be processed","");jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide");jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-alert");jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var t={action:"shortpixel_manual_optimization",image_id:e,cleanup:r};jQuery.ajax({type:"GET",url:ShortPixel.AJAX_URL,data:t,success:function(r){var t=JSON.parse(r);if(t["Status"]==ShortPixel.STATUS_SUCCESS){setBulkTimer(2e3);ShortPixel.BULK_SECRET=false}else{setCellMessage(e,typeof t["Message"]!=="undefined"?t["Message"]:_spTr.thisContentNotProcessable,"")}},error:function(r){t.action="shortpixel_check_status";jQuery.ajax({type:"GET",url:ShortPixel.AJAX_URL,data:t,success:function(r){var t=JSON.parse(r);if(t["Status"]!==ShortPixel.STATUS_SUCCESS){setCellMessage(e,typeof t["Message"]!=="undefined"?t["Message"]:_spTr.thisContentNotProcessable,"")}}})}})}function reoptimize(e,r){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>Image waiting to be reprocessed","");jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide");jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var t={action:"shortpixel_redo",attachment_ID:e,type:r};jQuery.get(ShortPixel.AJAX_URL,t,(function(r){t=JSON.parse(r);if(t["Status"]==ShortPixel.STATUS_SUCCESS){setBulkTimer(2e3);ShortPixel.BULK_SECRET=false}else{$msg=typeof t["Message"]!=="undefined"?t["Message"]:_spTr.thisContentNotProcessable;setCellMessage(e,$msg,"");showToolBarAlert(ShortPixel.STATUS_FAIL,$msg)}}))}function optimizeThumbs(e){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>"+_spTr.imageWaitOptThumbs,"");jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide");jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var r={action:"shortpixel_optimize_thumbs",attachment_ID:e};jQuery.get(ShortPixel.AJAX_URL,r,(function(t){r=JSON.parse(t);if(r["Status"]==ShortPixel.STATUS_SUCCESS){setBulkTimer(2e3);ShortPixel.BULK_SECRET=false}else{setCellMessage(e,typeof r["Message"]!=="undefined"?r["Message"]:_spTr.thisContentNotProcessable,"")}}))}function dismissShortPixelNotice(e){jQuery("#short-pixel-notice-"+e).hide();var r={action:"shortpixel_dismiss_notice",notice_id:e};jQuery.get(ShortPixel.AJAX_URL,r,(function(e){r=JSON.parse(e);if(r["Status"]==ShortPixel.STATUS_SUCCESS){console.log("dismissed")}}))}function dismissFileError(){jQuery(".shortpixel-alert").hide();var e={action:"shortpixel_dismissFileError"};jQuery.get(ShortPixel.AJAX_URL,e,(function(r){e=JSON.parse(r);if(e["Status"]==ShortPixel.STATUS_SUCCESS){console.log("dismissed")}}))}function PercentageAnimator(e,r){this.animationSpeed=10;this.increment=2;this.curPercentage=0;this.targetPercentage=r;this.outputSelector=e;this.animate=function(e){this.targetPercentage=e;setTimeout(PercentageTimer.bind(null,this),this.animationSpeed)}}function PercentageTimer(e){if(e.curPercentage-e.targetPercentage<-e.increment){e.curPercentage+=e.increment}else if(e.curPercentage-e.targetPercentage>e.increment){e.curPercentage-=e.increment}else{e.curPercentage=e.targetPercentage}jQuery(e.outputSelector).text(e.curPercentage+"%");if(e.curPercentage!=e.targetPercentage){setTimeout(PercentageTimer.bind(null,e),e.animationSpeed)}}function progressUpdate(e,r){var t=jQuery("#bulk-progress");if(t.length){jQuery(".progress-left",t).css("width",e+"%");jQuery(".progress-img",t).css("left",e+"%");if(e>24){jQuery(".progress-img span",t).html("");jQuery(".progress-left",t).html(e+"%")}else{jQuery(".progress-img span",t).html(e+"%");jQuery(".progress-left",t).html("")}jQuery(".bulk-estimate").html(r)}}function sliderUpdate(e,r,t,i,s){var o=jQuery(".bulk-slider div.bulk-slide:first-child");if(o.length===0){return}if(o.attr("id")!="empty-slide"){o.hide()}o.css("z-index",1e3);jQuery(".bulk-img-opt",o).attr("src","");if(typeof t==="undefined"){t=""}if(t.length>0){jQuery(".bulk-img-orig",o).attr("src","")}var a=o.clone();a.attr("id","slide-"+e);jQuery(".bulk-img-opt",a).attr("src",r);if(t.length>0){jQuery(".img-original",a).css("display","inline-block");jQuery(".bulk-img-orig",a).attr("src",t)}else{jQuery(".img-original",a).css("display","none")}jQuery(".bulk-opt-percent",a).html('<input type="text" class="dial" value="'+i+'"/>');jQuery(".bulk-slider").append(a);ShortPixel.percentDial("#"+a.attr("id")+" .dial",100);jQuery(".bulk-slider-container span.filename").html(" "+s);if(o.attr("id")=="empty-slide"){o.remove();jQuery(".bulk-slider-container").css("display","block")}else{o.animate({left:o.width()+o.position().left},"slow","swing",(function(){o.remove();a.fadeIn("slow")}))}}function hideSlider(){jQuery(".bulk-slider-container").css("display","none")}function showStats(){var e=jQuery(".bulk-stats");if(e.length>0){}}function SPstringFormat(){var e=Array.prototype.slice.call(arguments);if(e.length===0)return;var r=e.shift();for(i=0;i<e.length;i++){r=r.replace(new RegExp("\\{"+i+"\\}","gm"),e[i])}return r}(function(e,r,t){r.SpioResize={image:{width:0,height:0},lag:2e3,step1:false,step2:false,step3:false,sizeRule:null,initialized:false,lastW:false,lastH:false,lastType:false};SpioResize.hide=function(){e(".presentation-wrap").css("opacity",0)};SpioResize.animate=function(e,r,t,i,s){e.animate(r,1e3,"swing",(function(){SpioResize.step3=setTimeout((function(){document.styleSheets[0].deleteRule(SpioResize.sizeRule);t.animate(i,1e3,"swing",(function(){SpioResize.sizeRule=document.styleSheets[0].insertRule(s)}))}),600)}))};SpioResize.run=function(){if(!SpioResize.initialized){var r=e(t);r.on("input change",'input[name="resizeWidth"], input[name="resizeHeight"]',(function(e){clearTimeout(SpioResize.change);SpioResize.changeDone=true;SpioResize.changeFired=false;SpioResize.change=setTimeout((function(){SpioResize.changeFired=true;SpioResize.run()}),1500)}));r.on("blur",'input[name="resizeWidth"], input[name="resizeHeight"]',(function(e){if(SpioResize.changeFired){return}clearTimeout(SpioResize.change);SpioResize.change=setTimeout((function(){SpioResize.run()}),1500)}));r.on("change",'input[name="resizeType"]',(function(e){SpioResize.run()}));SpioResize.initialized=true}var i=e("#width").val();var s=e("#height").val();if(!i||!s)return;var o=e("#resize_type_outer").is(":checked")?"outer":"inner";if(i===SpioResize.lastW&&s===SpioResize.lastH&&o===SpioResize.lastType){return}SpioResize.hide();SpioResize.lastW=i;SpioResize.lastH=s;SpioResize.lastType=o;var a=Math.round(120*Math.sqrt(i/s));var l=Math.round(120*Math.sqrt(s/i));var n=a/l;if(a>280){a=280;l=Math.round(280/n)}if(l>150){l=150;a=Math.round(150*n)}var u=15/8;var p=e("img.spai-resize-img");p.css("width","");p.css("height","");p.css("margin","0px");var c=e("div.spai-resize-frame");c.css("display","none");c.css("width",a+"px");c.css("height",l+"px");c.css("margin",Math.round((156-l)/2)+"px auto 0");clearTimeout(SpioResize.step1);clearTimeout(SpioResize.step2);clearTimeout(SpioResize.step3);p.stop();c.stop();if(SpioResize.sizeRule!==null){document.styleSheets[0].deleteRule(SpioResize.sizeRule);SpioResize.sizeRule=null}SpioResize.sizeRule=document.styleSheets[0].insertRule('.spai-resize-frame:after { content: "'+i+" × "+s+'"; }');c.addClass("spai-resize-frame");e(".presentation-wrap").animate({opacity:1},500,"swing",(function(){c.css("display","block");SpioResize.step2=setTimeout((function(){if(o=="outer"){if(u>n){var e={height:l+"px",margin:Math.round((160-l)/2)+"px 0px"};var r=l*u;var t={width:Math.round(r)+"px"};var d='.spai-resize-frame:after { content: "'+Math.round(r*i/a)+" × "+s+'"; }'}else{var e={width:a+"px",margin:Math.round((160-a/u)/2)+"px 0px"};var h=a/u;var t={height:Math.round(h)+"px",margin:Math.round((156-h)/2)+"px auto 0"};var d='.spai-resize-frame:after { content: "'+i+" × "+Math.round(h*i/a)+'"; }'}}else{if(u>n){var e={width:a,margin:Math.round((160-a/u)/2)+"px 0px"};var h=a/u;var t={height:Math.round(h)+"px",margin:Math.round((156-h)/2)+"px auto 0"};var d='.spai-resize-frame:after { content: "'+i+" × "+Math.round(h*i/a)+'"; }'}else{var e={height:l,margin:Math.round((160-l)/2)+"px 0px"};var r=l*u;var t={width:Math.round(r)+"px"};var d='.spai-resize-frame:after { content: "'+Math.round(r*i/a)+" × "+s+'"; }'}}SpioResize.animate(p,e,c,t,d)}),1e3)}))};e((function(){if(e("#resize").is("checked")){SpioResize.run()}}))})(jQuery,window,document);
|
1 |
+
function showToolBarAlert(e,t,r){var i=jQuery("li.shortpixel-toolbar-processing");switch(e){case ShortPixel.STATUS_QUOTA_EXCEEDED:if(window.location.href.search("wp-short-pixel-bulk")>0&&0==jQuery(".sp-quota-exceeded-alert").length)return;i.addClass("shortpixel-alert"),i.addClass("shortpixel-quota-exceeded"),jQuery("a",i).attr("href","options-general.php?page=wp-shortpixel-settings"),jQuery("a div",i).attr("title","ShortPixel quota exceeded. Click for details.");break;case ShortPixel.STATUS_SKIP:case ShortPixel.STATUS_FAIL:i.addClass("shortpixel-alert shortpixel-processing"),jQuery("a div",i).attr("title",t),void 0!==r&&jQuery("a",i).attr("href","post.php?post="+r+"&action=edit");break;case ShortPixel.STATUS_NO_KEY:i.addClass("shortpixel-alert"),i.addClass("shortpixel-quota-exceeded"),jQuery("a",i).attr("href","options-general.php?page=wp-shortpixel-settings"),jQuery("a div",i).attr("title","Get API Key");break;case ShortPixel.STATUS_SUCCESS:case ShortPixel.STATUS_RETRY:i.addClass("shortpixel-processing"),i.removeClass("shortpixel-alert"),jQuery("a",i).removeAttr("target"),jQuery("a",i).attr("href",jQuery("a img",i).attr("success-url"))}i.removeClass("shortpixel-hide")}function hideToolBarAlert(e){var t=jQuery("li.shortpixel-toolbar-processing.shortpixel-processing");ShortPixel.STATUS_EMPTY_QUEUE==e&&(t.hasClass("shortpixel-alert")||t.hasClass("shortpixel-quota-exceeded"))||t.addClass("shortpixel-hide")}function hideQuotaExceededToolBarAlert(){jQuery("li.shortpixel-toolbar-processing.shortpixel-quota-exceeded").addClass("shortpixel-hide")}function checkQuotaExceededAlert(){"undefined"!=typeof shortPixelQuotaExceeded&&(1==shortPixelQuotaExceeded?showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED):hideQuotaExceededToolBarAlert())}function checkBulkProgress(){var e=function(e){return t?"/":(t=!0,e)},t=!1,r=window.location.href.toLowerCase().replace(/\/\//g,e);t=!1;var i=ShortPixel.WP_ADMIN_URL.toLowerCase().replace(/\/\//g,e);if(r.search(i)<0&&(r=ShortPixel.convertPunycode(r),i=ShortPixel.convertPunycode(i)),1==ShortPixel.bulkProcessor&&window.location.href.search("wp-short-pixel-bulk")<0&&void 0!==localStorage.bulkPage&&localStorage.bulkPage>0&&(ShortPixel.bulkProcessor=!1),window.location.href.search("wp-short-pixel-bulk")>=0&&(ShortPixel.bulkProcessor=!0,localStorage.bulkTime=Date.now(),localStorage.bulkPage=1,ShortPixel.BULK_SECRET=!1),!1!==ShortPixel.BULK_SECRET&&ShortPixel.BULK_SECRET!=localStorage.bulkSecret)return clearBulkProcessor(),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-processing"),void jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-hide");1==ShortPixel.bulkProcessor||void 0===localStorage.bulkTime||Date.now()-localStorage.bulkTime>1e4?(ShortPixel.bulkProcessor=!0,localStorage.bulkPage=window.location.href.search("wp-short-pixel-bulk")>=0?1:0,localStorage.bulkTime=Date.now(),null==localStorage.getItem("bulkSecret")&&(localStorage.bulkSecret=Math.random().toString(36).substring(7)),checkBulkProcessingCallApi()):setBulkTimer(2e4)}function setBulkTimer(e){window.clearTimeout(bulkTimer),e>0&&(bulkTimer=window.setTimeout(checkBulkProgress,e))}function checkBulkProcessingCallApi(){var e={action:"shortpixel_image_processing","bulk-secret":localStorage.bulkSecret};jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){if(e.length>0){t=null;try{var t=JSON.parse(e)}catch(e){return void ShortPixel.retry(e.message)}ShortPixel.retries=0;var r=t.ImageID,i=jQuery("div.short-pixel-bulk-page").length>0;switch(t.Status&&t.Status!=ShortPixel.STATUS_SEARCHING&&(ShortPixel.returnedStatusSearching>=2&&jQuery(".bulk-notice-msg.bulk-searching").hide(),ShortPixel.returnedStatusSearching=0),t.Status){case ShortPixel.STATUS_NO_KEY:setCellMessage(r,t.Message,'<a class=\'button button-smaller button-primary\' href="https://shortpixel.com/wp-apikey" target="_blank">'+_spTr.getApiKey+"</a>"),showToolBarAlert(ShortPixel.STATUS_NO_KEY);break;case ShortPixel.STATUS_QUOTA_EXCEEDED:setCellMessage(r,t.Message,'<a class=\'button button-smaller button-primary\' href="https://shortpixel.com/login/" target="_blank">'+_spTr.extendQuota+"</a><a class='button button-smaller' href='javascript:ShortPixel.checkQuota()'>"+_spTr.check__Quota+"</a>"),showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED),0==t.Stop&&setBulkTimer(5e3),ShortPixel.otherMediaUpdateActions(r,["quota","view"]);break;case ShortPixel.STATUS_FAIL:setCellMessage(r,t.Message,"<a class='button button-smaller button-primary' href=\"javascript:manualOptimization('"+r+"', true)\">"+_spTr.retry+"</a>"),showToolBarAlert(ShortPixel.STATUS_FAIL,t.Message,r),i&&(ShortPixel.bulkShowError(r,t.Message,t.Filename,t.CustomImageLink),t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),ShortPixel.otherMediaUpdateActions(r,["retry","view"])),console.log(t.Message),setBulkTimer(5e3);break;case ShortPixel.STATUS_EMPTY_QUEUE:console.log(t.Message),clearBulkProcessor(),hideToolBarAlert(t.Status);var s=jQuery("#bulk-progress");i&&s.length&&"2"!=t.BulkStatus&&(progressUpdate(100,"Bulk finished!"),jQuery("a.bulk-cancel").attr("disabled","disabled"),hideSlider(),setTimeout(function(){window.location.reload()},3e3));break;case ShortPixel.STATUS_SUCCESS:i&&(ShortPixel.bulkHideLengthyMsg(),ShortPixel.bulkHideMaintenanceMsg());var o=t.PercentImprovement;showToolBarAlert(ShortPixel.STATUS_SUCCESS,"");var a=ShortPixel.isCustomImageId(r)?"":ShortPixel.successActions(r,t.Type,t.ThumbsCount,t.ThumbsTotal,t.BackupEnabled,t.Filename);if(setCellMessage(r,ShortPixel.successMsg(r,o,t.Type,t.ThumbsCount,t.RetinasCount),a),jQuery("#post-"+r).length>0&&jQuery("#post-"+r).find(".filename").text(t.Filename),jQuery(".misc-pub-filename strong").length>0&&jQuery(".misc-pub-filename strong").text(t.Filename),ShortPixel.isCustomImageId(r)&&t.TsOptimized&&t.TsOptimized.length>0){n=jQuery(".list-overview .item-"+r);jQuery(n).children(".date").text(t.TsOptimized),jQuery(n).find(".row-actions .action-optimize").remove()}var l=jQuery(["restore","view","redolossy","redoglossy","redolossless"]).not(["redo"+t.Type]).get();ShortPixel.otherMediaUpdateActions(r,l);new PercentageAnimator("#sp-msg-"+r+" span.percent",o).animate(o),i&&void 0!==t.Thumb&&(t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),t.Thumb.length>0&&(sliderUpdate(r,t.Thumb,t.BkThumb,t.PercentImprovement,t.Filename),void 0!==t.AverageCompression&&0+t.AverageCompression>0&&(jQuery("#sp-avg-optimization").html('<input type="text" class="dial" value="'+Math.round(t.AverageCompression)+'"/>'),ShortPixel.percentDial("#sp-avg-optimization .dial",60)))),console.log("Server response: "+e),i&&void 0!==t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),setBulkTimer(5e3);break;case ShortPixel.STATUS_SKIP:1!==t.Silent&&ShortPixel.bulkShowError(r,t.Message,t.Filename,t.CustomImageLink);case ShortPixel.STATUS_ERROR:void 0!==t.Message&&(showToolBarAlert(ShortPixel.STATUS_SKIP,t.Message+" Image ID: "+r),setCellMessage(r,t.Message,"")),ShortPixel.otherMediaUpdateActions(r,["retry","view"]);case ShortPixel.STATUS_RETRY:console.log("Server response: "+e),showToolBarAlert(ShortPixel.STATUS_RETRY,""),i&&void 0!==t.BulkPercent&&progressUpdate(t.BulkPercent,t.BulkMsg),i&&t.Count>3&&ShortPixel.bulkShowLengthyMsg(r,t.Filename,t.CustomImageLink),setBulkTimer(5e3);break;case ShortPixel.STATUS_SEARCHING:console.log("Server response: "+e),ShortPixel.returnedStatusSearching++,ShortPixel.returnedStatusSearching>=2&&jQuery(".bulk-notice-msg.bulk-searching").show(),setBulkTimer(2500);break;case ShortPixel.STATUS_MAINTENANCE:ShortPixel.bulkShowMaintenanceMsg("maintenance"),setBulkTimer(6e4);break;case ShortPixel.STATUS_QUEUE_FULL:ShortPixel.bulkShowMaintenanceMsg("queue-full"),setBulkTimer(6e4);break;default:ShortPixel.retry("Unknown status "+t.Status+". Retrying...")}if(void 0!==r&&ShortPixel.isCustomImageId(r)){var n=jQuery(".list-overview .item-"+r);jQuery(n).find(".row-actions .action-optimize").remove(),t.actions&&jQuery(n).children(".actions").html(t.actions)}}},error:function(e){ShortPixel.retry(e.statusText)}})}function clearBulkProcessor(){ShortPixel.bulkProcessor=!1,localStorage.bulkTime=Date.now(),setBulkTimer(0),window.location.href.search("wp-short-pixel-bulk")>=0&&(localStorage.bulkPage=0)}function setCellMessage(e,t,r){var i=jQuery("#sp-msg-"+e);i.length>0&&(i.html("<div class='sp-column-actions'>"+r+"</div><div class='sp-column-info'>"+t+"</div>"),i.css("color","")),(i=jQuery("#sp-cust-msg-"+e)).length>0&&i.html("<div class='sp-column-info'>"+t+"</div>")}function manualOptimization(e,t){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>Image waiting to be processed",""),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide"),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-alert"),jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var r={action:"shortpixel_manual_optimization",image_id:e,cleanup:t};jQuery.ajax({type:"GET",url:ShortPixel.AJAX_URL,data:r,success:function(t){var r=JSON.parse(t);r.Status==ShortPixel.STATUS_SUCCESS?(setBulkTimer(2e3),ShortPixel.BULK_SECRET=!1):setCellMessage(e,void 0!==r.Message?r.Message:_spTr.thisContentNotProcessable,"")},error:function(t){r.action="shortpixel_check_status",jQuery.ajax({type:"GET",url:ShortPixel.AJAX_URL,data:r,success:function(t){var r=JSON.parse(t);r.Status!==ShortPixel.STATUS_SUCCESS&&setCellMessage(e,void 0!==r.Message?r.Message:_spTr.thisContentNotProcessable,"")}})}})}function reoptimize(e,t){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>Image waiting to be reprocessed",""),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide"),jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var r={action:"shortpixel_redo",attachment_ID:e,type:t};jQuery.get(ShortPixel.AJAX_URL,r,function(t){(r=JSON.parse(t)).Status==ShortPixel.STATUS_SUCCESS?(setBulkTimer(2e3),ShortPixel.BULK_SECRET=!1):($msg=void 0!==r.Message?r.Message:_spTr.thisContentNotProcessable,setCellMessage(e,$msg,""),showToolBarAlert(ShortPixel.STATUS_FAIL,$msg))})}function optimizeThumbs(e){setCellMessage(e,"<img src='"+ShortPixel.WP_PLUGIN_URL+"/res/img/loading.gif' alt='"+_spTr.loading+"' class='sp-loading-small'>"+_spTr.imageWaitOptThumbs,""),jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide"),jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");var t={action:"shortpixel_optimize_thumbs",attachment_ID:e};jQuery.get(ShortPixel.AJAX_URL,t,function(r){(t=JSON.parse(r)).Status==ShortPixel.STATUS_SUCCESS?(setBulkTimer(2e3),ShortPixel.BULK_SECRET=!1):setCellMessage(e,void 0!==t.Message?t.Message:_spTr.thisContentNotProcessable,"")})}function dismissShortPixelNotice(e){jQuery("#short-pixel-notice-"+e).hide();var t={action:"shortpixel_dismiss_notice",notice_id:e};jQuery.get(ShortPixel.AJAX_URL,t,function(e){(t=JSON.parse(e)).Status==ShortPixel.STATUS_SUCCESS&&console.log("dismissed")})}function dismissFileError(){jQuery(".shortpixel-alert").hide();var e={action:"shortpixel_dismissFileError"};jQuery.get(ShortPixel.AJAX_URL,e,function(t){(e=JSON.parse(t)).Status==ShortPixel.STATUS_SUCCESS&&console.log("dismissed")})}function PercentageAnimator(e,t){this.animationSpeed=10,this.increment=2,this.curPercentage=0,this.targetPercentage=t,this.outputSelector=e,this.animate=function(e){this.targetPercentage=e,setTimeout(PercentageTimer.bind(null,this),this.animationSpeed)}}function PercentageTimer(e){e.curPercentage-e.targetPercentage<-e.increment?e.curPercentage+=e.increment:e.curPercentage-e.targetPercentage>e.increment?e.curPercentage-=e.increment:e.curPercentage=e.targetPercentage,jQuery(e.outputSelector).text(e.curPercentage+"%"),e.curPercentage!=e.targetPercentage&&setTimeout(PercentageTimer.bind(null,e),e.animationSpeed)}function progressUpdate(e,t){var r=jQuery("#bulk-progress");r.length&&(jQuery(".progress-left",r).css("width",e+"%"),jQuery(".progress-img",r).css("left",e+"%"),e>24?(jQuery(".progress-img span",r).html(""),jQuery(".progress-left",r).html(e+"%")):(jQuery(".progress-img span",r).html(e+"%"),jQuery(".progress-left",r).html("")),jQuery(".bulk-estimate").html(t))}function sliderUpdate(e,t,r,i,s){var o=jQuery(".bulk-slider div.bulk-slide:first-child");if(0!==o.length){"empty-slide"!=o.attr("id")&&o.hide(),o.css("z-index",1e3),jQuery(".bulk-img-opt",o).attr("src",""),void 0===r&&(r=""),r.length>0&&jQuery(".bulk-img-orig",o).attr("src","");var a=o.clone();a.attr("id","slide-"+e),jQuery(".bulk-img-opt",a).attr("src",t),r.length>0?(jQuery(".img-original",a).css("display","inline-block"),jQuery(".bulk-img-orig",a).attr("src",r)):jQuery(".img-original",a).css("display","none"),jQuery(".bulk-opt-percent",a).html('<input type="text" class="dial" value="'+i+'"/>'),jQuery(".bulk-slider").append(a),ShortPixel.percentDial("#"+a.attr("id")+" .dial",100),jQuery(".bulk-slider-container span.filename").html(" "+s),"empty-slide"==o.attr("id")?(o.remove(),jQuery(".bulk-slider-container").css("display","block")):o.animate({left:o.width()+o.position().left},"slow","swing",function(){o.remove(),a.fadeIn("slow")})}}function hideSlider(){jQuery(".bulk-slider-container").css("display","none")}function showStats(){jQuery(".bulk-stats").length}function SPstringFormat(){var e=Array.prototype.slice.call(arguments);if(0!==e.length){var t=e.shift();for(i=0;i<e.length;i++)t=t.replace(new RegExp("\\{"+i+"\\}","gm"),e[i]);return t}}jQuery(document).ready(function(){ShortPixel.init()});var bulkTimer,ShortPixel=function(){function e(e){jQuery(e).is(":checked")?(jQuery("#width,#height").removeAttr("disabled"),SpioResize.lastW=!1,jQuery(".resize-type-wrap").show(800,window.SpioResize.run)):(jQuery("#width,#height").attr("disabled","disabled"),window.SpioResize.hide(),jQuery(".resize-type-wrap").hide(800))}function t(){jQuery("#shortpixel-hs-button-blind").remove(),jQuery("#shortpixel-hs-tools").remove(),jQuery("#hs-beacon").remove(),jQuery("#botbutton").remove(),jQuery("#shortpixel-hs-blind").remove()}return jQuery("#key").keypress(function(e){13==e.which&&jQuery("#valid").val("validate")}),{init:function(){void 0===ShortPixel.API_IS_ACTIVE&&(jQuery("table.wp-list-table.media").length>0&&jQuery('select[name^="action"] option:last-child').before('<option value="short-pixel-bulk">'+_spTr.optimizeWithSP+'</option><option value="short-pixel-bulk-lossy"> → '+_spTr.redoLossy+'</option><option value="short-pixel-bulk-glossy"> → '+_spTr.redoGlossy+'</option><option value="short-pixel-bulk-lossless"> → '+_spTr.redoLossless+'</option><option value="short-pixel-bulk-restore"> → '+_spTr.restoreOriginal+"</option>"),ShortPixel.setOptions(ShortPixelConstants[0]),jQuery("#backup-folder-size").length&&jQuery("#backup-folder-size").html(ShortPixel.getBackupSize()),"todo"==ShortPixel.MEDIA_ALERT&&jQuery("div.media-frame.mode-grid").length>0&&jQuery("div.media-frame.mode-grid").before('<div id="short-pixel-media-alert" class="notice notice-warning"><p>'+SPstringFormat(_spTr.changeMLToListMode,'<a href="upload.php?mode=list" class="view-list"><span class="screen-reader-text">'," </span>",'</a><a class="alignright" href="javascript:ShortPixel.dismissMediaAlert();">',"</a>")+"</p></div>"),jQuery(window).on("beforeunload",function(){1==ShortPixel.bulkProcessor&&clearBulkProcessor()}),checkQuotaExceededAlert(),checkBulkProgress())},setOptions:function(e){for(var t in e)ShortPixel[t]=e[t]},isEmailValid:function(e){return/^\w+([\.+-]?\w+)*@\w+([\.-]?\w+)*(\.\w{1,63})+$/.test(e)},updateSignupEmail:function(){var e=jQuery("#pluginemail").val();ShortPixel.isEmailValid(e)&&jQuery("#request_key").removeClass("disabled"),jQuery("#request_key").attr("href",jQuery("#request_key").attr("href").split("?")[0]+"?pluginemail="+e)},validateKey:function(e){jQuery("#valid").val("validate"),jQuery(e).parents("form").submit()},enableResize:e,setupGeneralTab:function(){var t=0;void 0!==document.wp_shortpixel_options&&(t=document.wp_shortpixel_options.compressionType);for(var r=0,i=null;r<t.length;r++)t[r].onclick=function(){this!==i&&(i=this),void 0===ShortPixel.setupGeneralTabAlert&&(alert(_spTr.alertOnlyAppliesToNewImages),ShortPixel.setupGeneralTabAlert=1)};ShortPixel.enableResize("#resize"),jQuery("#resize").change(function(){e(this)}),jQuery(".resize-sizes").blur(function(e){var t=jQuery(e.target);if(ShortPixel.resizeSizesAlert!=t.val()){ShortPixel.resizeSizesAlert=t.val();var r=jQuery("#min-"+t.attr("name")).val(),i=jQuery("#min-"+t.attr("name")).data("nicename");t.val()<Math.min(r,1024)?(r>1024?alert(SPstringFormat(_spTr.pleaseDoNotSetLesser1024,i)):alert(SPstringFormat(_spTr.pleaseDoNotSetLesserSize,i,i,r)),e.preventDefault(),t.focus()):this.defaultValue=t.val()}}),jQuery(".shortpixel-confirm").click(function(e){return!!confirm(e.target.getAttribute("data-confirm"))||(e.preventDefault(),!1)}),jQuery('input[name="removeExif"], input[name="png2jpg"]').on("change",function(){ShortPixel.checkExifWarning()}),ShortPixel.checkExifWarning(),jQuery('input[name="backupImages"]').on("change",function(){ShortPixel.checkBackUpWarning()}),ShortPixel.checkBackUpWarning()},apiKeyChanged:function(){jQuery(".wp-shortpixel-options .shortpixel-key-valid").css("display","none"),jQuery(".wp-shortpixel-options button#validate").css("display","inline-block")},setupAdvancedTab:function(){jQuery("input.remove-folder-button").click(function(){var e=jQuery(this).data("value"),t=jQuery(this).data("name");1==confirm(SPstringFormat(_spTr.areYouSureStopOptimizing,t))&&(jQuery("#removeFolder").val(e),jQuery("#wp_shortpixel_options").submit())}),jQuery("input.recheck-folder-button").click(function(){var e=jQuery(this).data("value");1==confirm(SPstringFormat(_spTr.areYouSureStopOptimizing,e))&&(jQuery("#recheckFolder").val(e),jQuery("#wp_shortpixel_options").submit())})},checkThumbsUpdTotal:function(e){var t=jQuery("#"+(e.checked?"total":"main")+"ToProcess").val();jQuery("div.bulk-play span.total").text(t),jQuery("#displayTotal").text(t)},initSettings:function(){ShortPixel.adjustSettingsTabs(),ShortPixel.setupGeneralTab(),jQuery(window).resize(function(){ShortPixel.adjustSettingsTabs()}),jQuery("article.sp-tabs a.tab-link").click(function(e){var t=jQuery(e.target).data("id");ShortPixel.switchSettingsTab(t)}),jQuery("input[type=radio][name=deliverWebpType]").change(function(){"deliverWebpAltered"==this.value?window.confirm(_spTr.alertDeliverWebPAltered)?0==jQuery("input[type=radio][name=deliverWebpAlteringType]:checked").length&&jQuery("#deliverWebpAlteredWP").prop("checked",!0):jQuery(this).prop("checked",!1):"deliverWebpUnaltered"==this.value&&window.alert(_spTr.alertDeliverWebPUnaltered)})},switchSettingsTab:function(e){var t=e.replace("tab-",""),r="",i=jQuery("section#"+e);jQuery('input[name="display_part"]').val(t);var s=window.location.href.toString();if(s.indexOf("?")>0){var o=s.substring(0,s.indexOf("?"));o+="?"+jQuery.param({page:"wp-shortpixel-settings",part:t}),window.history.replaceState({},document.title,o)}if(i.length>0&&(jQuery("section").removeClass("sel-tab"),jQuery("section .wp-shortpixel-tab-content").fadeOut(50),jQuery(i).addClass("sel-tab"),ShortPixel.adjustSettingsTabs(),jQuery(i).find(".wp-shortpixel-tab-content").fadeIn(50)),"undefined"!=typeof HS&&void 0!==HS.beacon.suggest){switch(t){case"settings":r=shortpixel_suggestions_settings;break;case"adv-settings":r=shortpixel_suggestions_adv_settings;break;case"cloudflare":case"stats":r=shortpixel_suggestions_cloudflare}HS.beacon.suggest(r)}},adjustSettingsTabs:function(){var e=jQuery("section.sel-tab").height()+90;jQuery(".section-wrapper").css("height",e)},onBulkThumbsCheck:function(e){e.checked?(jQuery("#with-thumbs").css("display","inherit"),jQuery("#without-thumbs").css("display","none")):(jQuery("#without-thumbs").css("display","inherit"),jQuery("#with-thumbs").css("display","none"))},dismissMediaAlert:function(){var e={action:"shortpixel_dismiss_media_alert"};jQuery.get(ShortPixel.AJAX_URL,e,function(t){"success"==(e=JSON.parse(t)).Status&&jQuery("#short-pixel-media-alert").hide()})},closeHelpPane:t,dismissHelpPane:function(){t(),dismissShortPixelNotice("help")},checkQuota:function(){var e={action:"shortpixel_check_quota",nonce:ShortPixelActions.nonce_check_quota,return_json:!0};jQuery.post(ShortPixel.AJAX_URL,e,function(e){console.log("quota refreshed"),console.log(e),window.location.href=e.redirect})},percentDial:function(e,t){jQuery(e).knob({readOnly:!0,width:t,height:t,fgColor:"#1CAECB",format:function(e){return e+"%"}})},successMsg:function(e,t,r,i,s){return(t>0?"<div class='sp-column-info'>"+_spTr.reducedBy+" <strong><span class='percent'>"+t+"%</span></strong> ":"")+(t>0&&t<5?"<br>":"")+(t<5?_spTr.bonusProcessing:"")+(r.length>0?" ("+r+")":"")+(0+i>0?"<br>"+SPstringFormat(_spTr.plusXthumbsOpt,i):"")+(0+s>0?"<br>"+SPstringFormat(_spTr.plusXretinasOpt,s):"")+"</div>"},successActions:function(e,t,r,i,s,o){if(1==s){var a=jQuery(".sp-column-actions-template").clone();if(!a.length)return!1;var l;return l=0==t.length?["lossy","lossless"]:["lossy","glossy","lossless"].filter(function(e){return!(e==t)}),a.html(a.html().replace(/__SP_ID__/g,e)),"pdf"==o.substr(o.lastIndexOf(".")+1).toLowerCase()&&jQuery(".sp-action-compare",a).remove(),0==r&&i>0?a.html(a.html().replace("__SP_THUMBS_TOTAL__",i)):(jQuery(".sp-action-optimize-thumbs",a).remove(),jQuery(".sp-dropbtn",a).removeClass("button-primary")),a.html(a.html().replace(/__SP_FIRST_TYPE__/g,l[0])),a.html(a.html().replace(/__SP_SECOND_TYPE__/g,l[1])),a.html()}return""},otherMediaUpdateActions:function(e,t){if(e=e.substring(2),jQuery(".shortpixel-other-media").length){for(var r=["optimize","retry","restore","redo","quota","view"],i=0,s=r.length;i<s;i++)jQuery("#"+r[i]+"_"+e).css("display","none");for(var i=0,s=t.length;i<s;i++)jQuery("#"+t[i]+"_"+e).css("display","")}},retry:function(e){ShortPixel.retries++,isNaN(ShortPixel.retries)&&(ShortPixel.retries=1),ShortPixel.retries<6?(console.log("Invalid response from server (Error: "+e+"). Retrying pass "+(ShortPixel.retries+1)+"..."),setBulkTimer(5e3)):(ShortPixel.bulkShowError(-1,"Invalid response from server received 6 times. Please retry later by reloading this page, or <a href='https://shortpixel.com/contact' target='_blank'>contact support</a>. (Error: "+e+")",""),console.log("Invalid response from server 6 times. Giving up."))},initFolderSelector:function(){jQuery(".select-folder-button").click(function(){jQuery(".sp-folder-picker-shade").fadeIn(100),jQuery(".shortpixel-modal.modal-folder-picker").show();var e=jQuery(".sp-folder-picker");e.parent().css("margin-left",-e.width()/2),e.fileTree({script:ShortPixel.browseContent,multiFolder:!1})}),jQuery(".shortpixel-modal input.select-folder-cancel, .sp-folder-picker-shade").click(function(){jQuery(".sp-folder-picker-shade").fadeOut(100),jQuery(".shortpixel-modal.modal-folder-picker").hide()}),jQuery(".shortpixel-modal input.select-folder").click(function(e){if(t=jQuery("UL.jqueryFileTree LI.directory.selected"),0==jQuery(t).length)var t=jQuery("UL.jqueryFileTree LI.selected").parents(".directory");var r=jQuery(t).children("a").attr("rel");if(void 0!==r)if(r=r.trim()){var i=jQuery("#customFolderBase").val()+r;i=i.replace(/\/\//,"/"),console.debug("FullPath"+i),jQuery("#addCustomFolder").val(i),jQuery("#addCustomFolderView").val(i),jQuery(".sp-folder-picker-shade").fadeOut(100),jQuery(".shortpixel-modal.modal-folder-picker").css("display","none"),jQuery("#saveAdvAddFolder").removeClass("hidden")}else alert("Please select a folder from the list.")})},browseContent:function(e){e.action="shortpixel_browse_content";var t="";return jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){t=e},async:!1}),t},getBackupSize:function(){var e="";return jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_get_backup_size"},success:function(t){e=t},async:!1}),e},newApiKey:function(e){if(!jQuery("#tos").is(":checked"))return e.preventDefault(),jQuery("#tos-robo").fadeIn(400,function(){jQuery("#tos-hand").fadeIn()}),void jQuery("#tos").click(function(){jQuery("#tos-robo").css("display","none"),jQuery("#tos-hand").css("display","none")});if(jQuery("#request_key").addClass("disabled"),jQuery("#pluginemail_spinner").addClass("is-active"),ShortPixel.updateSignupEmail(),ShortPixel.isEmailValid(jQuery("#pluginemail").val())){jQuery("#pluginemail-error").css("display","none");var t={action:"shortpixel_new_api_key",email:jQuery("#pluginemail").val()};jQuery.ajax({type:"POST",async:!1,url:ShortPixel.AJAX_URL,data:t,success:function(t){data=JSON.parse(t),"success"==data.Status?(e.preventDefault(),window.location.reload()):"invalid"==data.Status&&(jQuery("#pluginemail-error").html("<b>"+data.Details+"</b>"),jQuery("#pluginemail-error").css("display",""),jQuery("#pluginemail-info").css("display","none"),e.preventDefault())}}),jQuery("#request_key").removeAttr("onclick")}else jQuery("#pluginemail-error").css("display",""),jQuery("#pluginemail-info").css("display","none"),e.preventDefault();jQuery("#request_key").removeClass("disabled"),jQuery("#pluginemail_spinner").removeClass("is-active")},proposeUpgrade:function(){jQuery("#shortPixelProposeUpgrade .sp-modal-body").addClass("sptw-modal-spinner"),jQuery("#shortPixelProposeUpgrade .sp-modal-body").html(""),jQuery("#shortPixelProposeUpgradeShade").css("display","block"),jQuery("#shortPixelProposeUpgrade").removeClass("shortpixel-hide"),jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_propose_upgrade"},success:function(e){jQuery("#shortPixelProposeUpgrade .sp-modal-body").removeClass("sptw-modal-spinner"),jQuery("#shortPixelProposeUpgrade .sp-modal-body").html(e)}})},closeProposeUpgrade:function(){jQuery("#shortPixelProposeUpgradeShade").css("display","none"),jQuery("#shortPixelProposeUpgrade").addClass("shortpixel-hide"),ShortPixel.toRefresh&&ShortPixel.checkQuota()},bulkShowLengthyMsg:function(e,t,r){var i=jQuery(".bulk-notice-msg.bulk-lengthy");if(0!=i.length){var s=jQuery("a",i);s.text(t),r?s.attr("href",r):s.attr("href",s.data("href").replace("__ID__",e)),i.css("display","block")}},bulkHideLengthyMsg:function(){jQuery(".bulk-notice-msg.bulk-lengthy").css("display","none")},bulkShowMaintenanceMsg:function(e){var t=jQuery(".bulk-notice-msg.bulk-"+e);0!=t.length&&t.css("display","block")},bulkHideMaintenanceMsg:function(e){jQuery(".bulk-notice-msg.bulk-"+e).css("display","none")},bulkShowError:function(e,t,r,i){var s=jQuery("#bulk-error-template");if(0!=s.length){var o=s.clone();o.attr("id","bulk-error-"+e),-1==e?(jQuery("span.sp-err-title",o).remove(),o.addClass("bulk-error-fatal")):(jQuery("img",o).remove(),jQuery("#bulk-error-".id).remove()),jQuery("span.sp-err-content",o).html(t);var a=jQuery("a.sp-post-link",o);i?a.attr("href",i):a.attr("href",a.attr("href").replace("__ID__",e)),a.text(r),s.after(o),o.css("display","block")}},confirmBulkAction:function(e,t){return!!confirm(_spTr["confirmBulk"+e])||(t.stopPropagation(),t.preventDefault(),!1)},checkRandomAnswer:function(e){var t=jQuery(e.target).val(),r=jQuery('input[name="random_answer"]').val(),i=jQuery('input[name="random_answer"]').data("target");t==r?(jQuery(i).removeClass("disabled").prop("disabled",!1),jQuery(i).removeAttr("aria-disabled")):jQuery(i).addClass("disabled").prop("disabled",!0)},removeBulkMsg:function(e){jQuery(e).parent().parent().remove()},isCustomImageId:function(e){return"C-"==e.substring(0,2)},openImageMenu:function(e){e.preventDefault(),this.menuCloseEvent||(jQuery(window).click(function(e){e.target.matches(".sp-dropbtn")||jQuery(".sp-dropdown.sp-show").removeClass("sp-show")}),this.menuCloseEvent=!0);var t=e.target.parentElement.classList.contains("sp-show");jQuery(".sp-dropdown.sp-show").removeClass("sp-show"),t||e.target.parentElement.classList.add("sp-show")},menuCloseEvent:!1,loadComparer:function(e){this.comparerData.origUrl=!1,!1===this.comparerData.cssLoaded&&(jQuery("<link>").appendTo("head").attr({type:"text/css",rel:"stylesheet",href:this.WP_PLUGIN_URL+"/res/css/twentytwenty.min.css"}),this.comparerData.cssLoaded=2),!1===this.comparerData.jsLoaded&&(jQuery.getScript(this.WP_PLUGIN_URL+"/res/js/jquery.twentytwenty.min.js",function(){ShortPixel.comparerData.jsLoaded=2,ShortPixel.comparerData.origUrl.length>0&&ShortPixel.displayComparerPopup(ShortPixel.comparerData.width,ShortPixel.comparerData.height,ShortPixel.comparerData.origUrl,ShortPixel.comparerData.optUrl)}),this.comparerData.jsLoaded=1),!1===this.comparerData.origUrl&&(jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_get_comparer_data",id:e},success:function(e){data=JSON.parse(e),jQuery.extend(ShortPixel.comparerData,data),2==ShortPixel.comparerData.jsLoaded&&ShortPixel.displayComparerPopup(ShortPixel.comparerData.width,ShortPixel.comparerData.height,ShortPixel.comparerData.origUrl,ShortPixel.comparerData.optUrl)}}),this.comparerData.origUrl="")},displayComparerPopup:function(e,t,r,i){var s=e,o=t<150||e<350,a=jQuery(o?"#spUploadCompareSideBySide":"#spUploadCompare"),l=jQuery(".sp-modal-shade");o||jQuery("#spCompareSlider").html('<img alt="'+_spTr.originalImage+'" class="spUploadCompareOriginal"/><img alt="'+_spTr.optimizedImage+'" class="spUploadCompareOptimized"/>'),e=Math.max(350,Math.min(800,e<350?2*(e+25):t<150?e+25:e)),t=Math.max(150,o?s>350?2*(t+45):t+45:t*e/s);var n="-"+Math.round(e/2);jQuery(".sp-modal-body",a).css("width",e),jQuery(".shortpixel-slider",a).css("width",e),a.css("width",e),a.css("marginLeft",n+"px"),jQuery(".sp-modal-body",a).css("height",t),a.show(),l.show(),o||jQuery("#spCompareSlider").twentytwenty({slider_move:"mousemove"}),jQuery(".sp-close-button").on("click",ShortPixel.closeComparerPopup),jQuery(document).on("keyup.sp_modal_active",ShortPixel.closeComparerPopup),jQuery(".sp-modal-shade").on("click",ShortPixel.closeComparerPopup);var u=jQuery(".spUploadCompareOptimized",a);jQuery(".spUploadCompareOriginal",a).attr("src",r),setTimeout(function(){jQuery(window).trigger("resize")},1e3),u.load(function(){jQuery(window).trigger("resize")}),u.attr("src",i)},closeComparerPopup:function(e){jQuery("#spUploadCompareSideBySide").hide(),jQuery("#spUploadCompare").hide(),jQuery(".sp-modal-shade").hide(),jQuery(document).unbind("keyup.sp_modal_active"),jQuery(".sp-modal-shade").off("click"),jQuery(".sp-close-button").off("click")},convertPunycode:function(e){var t=document.createElement("a");return t.href=e,e.indexOf(t.protocol+"//"+t.hostname)<0?t.href:e.replace(t.protocol+"//"+t.hostname,t.protocol+"//"+t.hostname.split(".").map(function(e){return sp_punycode.toASCII(e)}).join("."))},checkExifWarning:function(){!jQuery('input[name="removeExif"]').is(":checked")&&jQuery('input[name="png2jpg"]').is(":checked")?jQuery(".exif_warning").fadeIn():jQuery(".exif_warning").fadeOut(),!jQuery('input[name="removeExif"]').is(":checked")&&jQuery(".exif_imagick_warning").data("imagick")<=0?jQuery(".exif_imagick_warning").fadeIn():jQuery(".exif_imagick_warning").fadeOut()},checkBackUpWarning:function(){jQuery('input[name="backupImages"]').is(":checked")?jQuery(".backup_warning").fadeOut():jQuery(".backup_warning").fadeIn()},comparerData:{cssLoaded:!1,jsLoaded:!1,origUrl:!1,optUrl:!1,width:0,height:0},toRefresh:!1,resizeSizesAlert:!1,returnedStatusSearching:0,optInHelp:function(e,t){var r={action:"shortpixel_helpscoutOptin",toggle:e.currentTarget.toggleParam},i=jQuery(e.target);jQuery.post(ShortPixel.AJAX_URL,r,function(e){"success"==e.Status&&i.parents(".shortpixel.notice").fadeOut()})}}}();!function(e,t,r){t.SpioResize={image:{width:0,height:0},lag:2e3,step1:!1,step2:!1,step3:!1,sizeRule:null,initialized:!1,lastW:!1,lastH:!1,lastType:!1},SpioResize.hide=function(){e(".presentation-wrap").css("opacity",0)},SpioResize.animate=function(e,t,r,i,s){e.animate(t,1e3,"swing",function(){SpioResize.step3=setTimeout(function(){document.styleSheets[0].deleteRule(SpioResize.sizeRule),r.animate(i,1e3,"swing",function(){SpioResize.sizeRule=document.styleSheets[0].insertRule(s)})},600)})},SpioResize.run=function(){if(!SpioResize.initialized){var t=e(r);t.on("input change",'input[name="resizeWidth"], input[name="resizeHeight"]',function(e){clearTimeout(SpioResize.change),SpioResize.changeDone=!0,SpioResize.changeFired=!1,SpioResize.change=setTimeout(function(){SpioResize.changeFired=!0,SpioResize.run()},1500)}),t.on("blur",'input[name="resizeWidth"], input[name="resizeHeight"]',function(e){SpioResize.changeFired||(clearTimeout(SpioResize.change),SpioResize.change=setTimeout(function(){SpioResize.run()},1500))}),t.on("change",'input[name="resizeType"]',function(e){SpioResize.run()}),SpioResize.initialized=!0}var i=e("#width").val(),s=e("#height").val();if(i&&s){var o=e("#resize_type_outer").is(":checked")?"outer":"inner";if(i!==SpioResize.lastW||s!==SpioResize.lastH||o!==SpioResize.lastType){SpioResize.hide(),SpioResize.lastW=i,SpioResize.lastH=s,SpioResize.lastType=o;var a=Math.round(120*Math.sqrt(i/s)),l=Math.round(120*Math.sqrt(s/i)),n=a/l;a>280&&(a=280,l=Math.round(280/n)),l>150&&(l=150,a=Math.round(150*n));var u=e("img.spai-resize-img");u.css("width",""),u.css("height",""),u.css("margin","0px");var c=e("div.spai-resize-frame");c.css("display","none"),c.css("width",a+"px"),c.css("height",l+"px"),c.css("margin",Math.round((156-l)/2)+"px auto 0"),clearTimeout(SpioResize.step1),clearTimeout(SpioResize.step2),clearTimeout(SpioResize.step3),u.stop(),c.stop(),null!==SpioResize.sizeRule&&(document.styleSheets[0].deleteRule(SpioResize.sizeRule),SpioResize.sizeRule=null),SpioResize.sizeRule=document.styleSheets[0].insertRule('.spai-resize-frame:after { content: "'+i+" × "+s+'"; }'),c.addClass("spai-resize-frame"),e(".presentation-wrap").animate({opacity:1},500,"swing",function(){c.css("display","block"),SpioResize.step2=setTimeout(function(){if("outer"==o)if(15/8>n)var e={height:l+"px",margin:Math.round((160-l)/2)+"px 0px"},t=l*(15/8),r={width:Math.round(t)+"px"},p='.spai-resize-frame:after { content: "'+Math.round(t*i/a)+" × "+s+'"; }';else var e={width:a+"px",margin:Math.round((160-a/(15/8))/2)+"px 0px"},h=a/(15/8),r={height:Math.round(h)+"px",margin:Math.round((156-h)/2)+"px auto 0"},p='.spai-resize-frame:after { content: "'+i+" × "+Math.round(h*i/a)+'"; }';else if(15/8>n)var e={width:a,margin:Math.round((160-a/(15/8))/2)+"px 0px"},h=a/(15/8),r={height:Math.round(h)+"px",margin:Math.round((156-h)/2)+"px auto 0"},p='.spai-resize-frame:after { content: "'+i+" × "+Math.round(h*i/a)+'"; }';else var e={height:l,margin:Math.round((160-l)/2)+"px 0px"},t=l*(15/8),r={width:Math.round(t)+"px"},p='.spai-resize-frame:after { content: "'+Math.round(t*i/a)+" × "+s+'"; }';SpioResize.animate(u,e,c,r,p)},1e3)})}}},e(function(){e("#resize").is("checked")&&SpioResize.run()})}(jQuery,window,document);
|
shortpixel-plugin.php
CHANGED
@@ -157,6 +157,9 @@ class ShortPixelPlugin
|
|
157 |
// if automedialibrary is off, but we do want to auto-optimize on the front, still load the hook.
|
158 |
add_filter( 'wp_generate_attachment_metadata', array($admin,'handleImageUploadHook'), 10, 2 );
|
159 |
}
|
|
|
|
|
|
|
160 |
}
|
161 |
|
162 |
/** Hook in our admin pages */
|
157 |
// if automedialibrary is off, but we do want to auto-optimize on the front, still load the hook.
|
158 |
add_filter( 'wp_generate_attachment_metadata', array($admin,'handleImageUploadHook'), 10, 2 );
|
159 |
}
|
160 |
+
|
161 |
+
// *** AJAX HOOKS @todo These must be moved from wp-short-pixel in future */
|
162 |
+
add_action('wp_ajax_shortpixel_helpscoutOptin', array(\wpSPIO()->settings(), 'ajax_helpscoutOptin'));
|
163 |
}
|
164 |
|
165 |
/** Hook in our admin pages */
|
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.20.
|
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.20.
|
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.20.2
|
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.20.2");
|
36 |
define('SHORTPIXEL_MAX_TIMEOUT', 10);
|
37 |
define('SHORTPIXEL_VALIDATE_MAX_TIMEOUT', 15);
|
38 |
define('SHORTPIXEL_BACKUP', 'ShortpixelBackups');
|