ShortPixel Image Optimizer - Version 4.17.3

Version Description

Release date: 16th April 2020 * Added a collapsable details feature to notifications, in order to avoid filling up the screen with them; * Added a filter to completely disable the plugin, when necessary (for certain user roles for example); * Hide the API key from the support chat module in settings, when the API key is entered via wp-config.php; * Prevent fatal errors if multiple versions of the plugin are active simultaneously; * Fix for API key that could be leaked in the frontend through JS; * Fix for situations where the plugin was crashing if the API key was added via wp-config.php; * Fix missing optimize button on Edit Media screen; * Fix for time stamp in Other Media screen when the server is set on another time zone than UTC; * Fix for JSON parsing errors when set_time_limit function is forbidden; * Fix for notifications not showing correctly the number of credits available; * Fix for images stuck in "Pending Restore" in Other Media, when there was no backup for them; * Fix for hamburger menu in Other Media not displaying options centered; * Language 4 new strings added, 2 updated, 0 fuzzied, and 4 obsoleted.

Download this release

Release Info

Developer petredobrescu
Plugin Icon 128x128 ShortPixel Image Optimizer
Version 4.17.3
Comparing to
See all releases

Code changes from version 4.17.2 to 4.17.3

build/shortpixel/notices/src/NoticeController.php CHANGED
@@ -139,6 +139,7 @@ class NoticeController //extends ShortPixelController
139
  public function getNoticesForDisplay()
140
  {
141
  $newNotices = array();
 
142
  foreach(self::$notices as $notice)
143
  {
144
  if ($notice->isDismissed()) // dismissed never displays.
@@ -274,7 +275,13 @@ class NoticeController //extends ShortPixelController
274
  $noticeController->update();
275
  }
276
 
277
- public static function makePersistent($notice, $key, $suppress = -1)
 
 
 
 
 
 
278
  {
279
  $noticeController = self::getInstance();
280
  $existing = $noticeController->getNoticeByID($key);
@@ -299,7 +306,7 @@ class NoticeController //extends ShortPixelController
299
  }
300
  else
301
  {
302
- $notice->setPersistent($key, $suppress); // set this notice persistent.
303
  }
304
 
305
  $noticeController->update();
139
  public function getNoticesForDisplay()
140
  {
141
  $newNotices = array();
142
+
143
  foreach(self::$notices as $notice)
144
  {
145
  if ($notice->isDismissed()) // dismissed never displays.
275
  $noticeController->update();
276
  }
277
 
278
+ /** Make a regular notice persistent across multiple page loads
279
+ * @param $notice NoticeModel The Notice to make Persistent
280
+ * @param $key String Identifier of the persistent notice.
281
+ * @param $suppress Int When dismissed, time to stay dismissed
282
+ * @param $callback Function Callable function
283
+ */
284
+ public static function makePersistent($notice, $key, $suppress = -1, $callback = null)
285
  {
286
  $noticeController = self::getInstance();
287
  $existing = $noticeController->getNoticeByID($key);
306
  }
307
  else
308
  {
309
+ $notice->setPersistent($key, $suppress, $callback); // set this notice persistent.
310
  }
311
 
312
  $noticeController->update();
build/shortpixel/notices/src/NoticeModel.php CHANGED
@@ -17,6 +17,7 @@ class NoticeModel //extends ShortPixelModel
17
  public $messageType = self::NOTICE_NORMAL;
18
 
19
  public $notice_action; // empty unless for display. Ajax action to talk back to controller.
 
20
 
21
  public static $icons = array();
22
 
@@ -100,11 +101,15 @@ class NoticeModel //extends ShortPixelModel
100
  * @param $key Unique Key of this message. Required
101
  * @param $suppress When dismissed do not show this message again for X amount of time. When -1 it will just be dropped from the Notices and not suppressed
102
  */
103
- public function setPersistent($key, $suppress = -1)
104
  {
105
  $this->id = $key;
106
  $this->is_persistent = true;
107
  $this->suppress_period = $suppress;
 
 
 
 
108
  }
109
 
110
  public static function setIcon($notice_type, $icon)
@@ -135,6 +140,13 @@ class NoticeModel //extends ShortPixelModel
135
 
136
  $icon = '';
137
 
 
 
 
 
 
 
 
138
  switch($this->messageType)
139
  {
140
  case self::NOTICE_ERROR:
@@ -171,11 +183,22 @@ class NoticeModel //extends ShortPixelModel
171
  $class .= 'is-persistent ';
172
  }
173
 
174
- $id = ! is_null($this->id) ? 'id="' . $this->id . '"' : '';
175
-
176
- $output = "<div $id class='$class'><span class='icon'> " . $icon . "</span> <span class='content'>" . $this->message;
177
  if ($this->hasDetails())
178
- $output .= "<p class='details'>" . $this->parseDetails() . "</p>";
 
 
 
 
 
 
 
 
 
 
 
179
  $output .= "</span></div>";
180
 
181
  if ($this->is_persistent && $this->is_removable)
17
  public $messageType = self::NOTICE_NORMAL;
18
 
19
  public $notice_action; // empty unless for display. Ajax action to talk back to controller.
20
+ protected $callback; // empty unless callback is needed
21
 
22
  public static $icons = array();
23
 
101
  * @param $key Unique Key of this message. Required
102
  * @param $suppress When dismissed do not show this message again for X amount of time. When -1 it will just be dropped from the Notices and not suppressed
103
  */
104
+ public function setPersistent($key, $suppress = -1, $callback = null)
105
  {
106
  $this->id = $key;
107
  $this->is_persistent = true;
108
  $this->suppress_period = $suppress;
109
+ if ( ! is_null($callback) && is_callable($callback))
110
+ {
111
+ $this->callback = $callback;
112
+ }
113
  }
114
 
115
  public static function setIcon($notice_type, $icon)
140
 
141
  $icon = '';
142
 
143
+ if ($this->callback)
144
+ {
145
+ $return = call_user_func($this->callback, $this);
146
+ if ($return === false) // don't display is callback returns false explicitly.
147
+ return;
148
+ }
149
+
150
  switch($this->messageType)
151
  {
152
  case self::NOTICE_ERROR:
183
  $class .= 'is-persistent ';
184
  }
185
 
186
+ $id = ! is_null($this->id) ? $this->id : uniqid();
187
+ //'id="' . $this->id . '"'
188
+ $output = "<div id='$id' class='$class'><span class='icon'> " . $icon . "</span> <span class='content'>" . $this->message;
189
  if ($this->hasDetails())
190
+ {
191
+ $output .= '<div class="details-wrapper">
192
+ <input type="checkbox" name="detailhider" id="check-' . $id .'">
193
+ <label for="check-' . $id . '" class="show-details"><span>' . __('See Details', 'shortpixel-image-optimiser') . '</span>
194
+ </label>';
195
+
196
+ $output .= "<div class='detail-content-wrapper'><p class='detail-content'>" . $this->parseDetails() . "</p></div>";
197
+ $output .= '<label for="check-' . $id . '" class="hide-details"><span>' . __('Hide Details', 'shortpixel-image-optimiser') . '</span></label>';
198
+
199
+ $output .= '</div>'; // detail rapper
200
+
201
+ }
202
  $output .= "</span></div>";
203
 
204
  if ($this->is_persistent && $this->is_removable)
class/controller/adminnotices_controller.php CHANGED
@@ -128,7 +128,7 @@ class adminNoticesController extends ShortPixelController
128
  {
129
  if (! \wpSPIO()->env()->is_screen_to_use)
130
  return; // suppress all when not our screen.
131
-
132
  $this->doFilePermNotice();
133
  $this->doAPINotices();
134
  $this->doCompatNotices();
@@ -307,7 +307,7 @@ class adminNoticesController extends ShortPixelController
307
  $message = $this->getBulkUpgradeMessage(array('filesTodo' => $stats['totalFiles'] - $stats['totalProcessedFiles'],
308
  'quotaAvailable' => max(0, $quotaData['APICallsQuotaNumeric'] + $quotaData['APICallsQuotaOneTimeNumeric'] - $quotaData['APICallsMadeNumeric'] - $quotaData['APICallsMadeOneTimeNumeric'])));
309
  $notice = Notices::addNormal($message);
310
- Notices::makePersistent($notice, self::MSG_UPGRADE_BULK, YEAR_IN_SECONDS);
311
  //ShortPixelView::displayActivationNotice('upgbulk', );
312
  }
313
  //consider the monthly plus 1/6 of the available one-time credits.
@@ -335,6 +335,13 @@ class adminNoticesController extends ShortPixelController
335
 
336
  }
337
 
 
 
 
 
 
 
 
338
  protected function getActivationNotice()
339
  {
340
  $message = "<p>" . __('In order to start the optimization process, you need to validate your API Key in the '
128
  {
129
  if (! \wpSPIO()->env()->is_screen_to_use)
130
  return; // suppress all when not our screen.
131
+
132
  $this->doFilePermNotice();
133
  $this->doAPINotices();
134
  $this->doCompatNotices();
307
  $message = $this->getBulkUpgradeMessage(array('filesTodo' => $stats['totalFiles'] - $stats['totalProcessedFiles'],
308
  'quotaAvailable' => max(0, $quotaData['APICallsQuotaNumeric'] + $quotaData['APICallsQuotaOneTimeNumeric'] - $quotaData['APICallsMadeNumeric'] - $quotaData['APICallsMadeOneTimeNumeric'])));
309
  $notice = Notices::addNormal($message);
310
+ Notices::makePersistent($notice, self::MSG_UPGRADE_BULK, YEAR_IN_SECONDS, array($this, 'upgradeBulkCallback'));
311
  //ShortPixelView::displayActivationNotice('upgbulk', );
312
  }
313
  //consider the monthly plus 1/6 of the available one-time credits.
335
 
336
  }
337
 
338
+ // Callback to check if we are on the correct page.
339
+ public function upgradeBulkCallback($notice)
340
+ {
341
+ if (! \wpSPIO()->env()->is_bulk_page)
342
+ return false;
343
+ }
344
+
345
  protected function getActivationNotice()
346
  {
347
  $message = "<p>" . __('In order to start the optimization process, you need to validate your API Key in the '
class/controller/apikey_controller.php CHANGED
@@ -7,11 +7,21 @@ This should probably in future incorporate some apikey checking functions that s
7
  */
8
  class ApiKeyController extends shortPixelController
9
  {
 
10
 
11
  public function __construct()
12
  {
13
  $this->loadModel('apikey');
14
  $this->model = new apiKeyModel();
 
 
 
 
 
 
 
 
 
15
  }
16
 
17
  // glue method.
@@ -26,5 +36,19 @@ class ApiKeyController extends shortPixelController
26
  $this->model->loadKey();
27
  }
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  }
7
  */
8
  class ApiKeyController extends shortPixelController
9
  {
10
+ private static $instance;
11
 
12
  public function __construct()
13
  {
14
  $this->loadModel('apikey');
15
  $this->model = new apiKeyModel();
16
+ $this->load();
17
+ }
18
+
19
+ public static function getInstance()
20
+ {
21
+ if (is_null(self::$instance))
22
+ self::$instance = new ApiKeyController();
23
+
24
+ return self::$instance;
25
  }
26
 
27
  // glue method.
36
  $this->model->loadKey();
37
  }
38
 
39
+ public function getKeyForDisplay()
40
+ {
41
+ if (! $this->model->is_hidden())
42
+ {
43
+ return $this->model->getKey();
44
+ }
45
+ else
46
+ return false;
47
+ }
48
+
49
+ public function keyIsVerified()
50
+ {
51
+ return $this->model->is_verified();
52
+ }
53
 
54
  }
class/controller/controller.php CHANGED
@@ -56,7 +56,7 @@ class ShortPixelController
56
  $this->view->notices = null; // Notices of class notice, for everything noticable
57
  $this->view->data = null; // Data(base), to separate from regular view data
58
 
59
- $this->userisAllowed = $this->checkUserPrivileges();
60
 
61
  }
62
 
56
  $this->view->notices = null; // Notices of class notice, for everything noticable
57
  $this->view->data = null; // Data(base), to separate from regular view data
58
 
59
+ $this->userIsAllowed = $this->checkUserPrivileges();
60
 
61
  }
62
 
class/controller/edit_media_controller.php CHANGED
@@ -5,21 +5,16 @@ use ShortPixel\ShortpixelLogger\ShortPixelLogger as Log;
5
  // Future contoller for the edit media metabox view.
6
  class editMediaController extends ShortPixelController
7
  {
8
- //$this->model = new
9
  protected $template = 'view-edit-media';
10
  protected $model = 'image';
11
 
12
- private $post_id;
13
- // private $actions_allowed;
14
-
15
- private $legacyViewObj;
16
 
17
  public function __construct()
18
  {
19
-
20
- $this->loadModel($this->model);
21
- // $this->loadModel('image');
22
  parent::__construct();
 
23
  }
24
 
25
  // This data should be rendered by Image Model in the future.
5
  // Future contoller for the edit media metabox view.
6
  class editMediaController extends ShortPixelController
7
  {
 
8
  protected $template = 'view-edit-media';
9
  protected $model = 'image';
10
 
11
+ protected $post_id;
12
+ protected $legacyViewObj;
 
 
13
 
14
  public function __construct()
15
  {
 
 
 
16
  parent::__construct();
17
+ $this->loadModel($this->model);
18
  }
19
 
20
  // This data should be rendered by Image Model in the future.
class/controller/filesystem_controller.php CHANGED
@@ -162,11 +162,16 @@ Class FileSystemController extends ShortPixelController
162
  $url = str_replace($wp_home_path, $home_url, $filepath);
163
  }
164
 
165
- if (parse_url($url) !== false)
166
- return $url;
167
- else {
168
  return false;
169
- }
 
 
 
 
 
 
170
  }
171
 
172
  /** Sort files / directories in a certain way.
162
  $url = str_replace($wp_home_path, $home_url, $filepath);
163
  }
164
 
165
+ // can happen if there are WP path errors.
166
+ if (is_null($url))
 
167
  return false;
168
+
169
+ $parsed = parse_url($url); // returns array, null, or false.
170
+
171
+ if (! is_null($parsed) && $parsed !== false)
172
+ return $url;
173
+
174
+ return false;
175
  }
176
 
177
  /** Sort files / directories in a certain way.
class/controller/views/othermedia_view_controller.php CHANGED
@@ -84,7 +84,7 @@ class OtherMediaViewController extends ShortPixelController
84
  }
85
  }
86
 
87
-
88
  protected function setActions()
89
  {
90
  $nonce = wp_create_nonce( 'sp_custom_action' );
@@ -106,6 +106,7 @@ class OtherMediaViewController extends ShortPixelController
106
  'compare' => array('link' => '<a href="javascript:ShortPixel.loadComparer(\'C-%%item_id%%\');">%%text%%</a>',
107
  'text' => __('Compare', 'shortpixel-image-optimiser')),
108
  'view' => array('link' => '<a href="%%item_url%%" target="_blank">%%text%%</a>', 'text' => __('View','shortpixel-image-optimiser')),
 
109
  );
110
  $this->actions = $actions;
111
  }
@@ -441,7 +442,10 @@ class OtherMediaViewController extends ShortPixelController
441
  $thisActions[] = $this->actions['view']; // always .
442
  $settings = \wpSPIO()->settings();
443
 
444
- if ($settings->quotaExceeded)
 
 
 
445
  {
446
  return $this->renderActions($thisActions, $item, $file); // nothing more.
447
  }
@@ -463,8 +467,13 @@ class OtherMediaViewController extends ShortPixelController
463
  {
464
  $thisActions = array();
465
  $settings = \wpSPIO()->settings();
 
466
 
467
- if ($settings->quotaExceeded)
 
 
 
 
468
  {
469
  $thisActions[] = $this->actions['quota'];
470
  }
@@ -510,7 +519,7 @@ class OtherMediaViewController extends ShortPixelController
510
 
511
  foreach($actions as $index => $action)
512
  {
513
- $text = $action['text'];
514
 
515
  if (isset($action['link']))
516
  {
84
  }
85
  }
86
 
87
+ /** Sets all possible actions and it's links. Doesn't check what can be loaded per individual case. */
88
  protected function setActions()
89
  {
90
  $nonce = wp_create_nonce( 'sp_custom_action' );
106
  'compare' => array('link' => '<a href="javascript:ShortPixel.loadComparer(\'C-%%item_id%%\');">%%text%%</a>',
107
  'text' => __('Compare', 'shortpixel-image-optimiser')),
108
  'view' => array('link' => '<a href="%%item_url%%" target="_blank">%%text%%</a>', 'text' => __('View','shortpixel-image-optimiser')),
109
+ 'no-key' => array('link' => '<a href="options-general.php?page=wp-shortpixel-settings">%%text%%</a>', 'text' => __('Invalid API Key. Check your Settings','shortpixel-image-optimiser') ),
110
  );
111
  $this->actions = $actions;
112
  }
442
  $thisActions[] = $this->actions['view']; // always .
443
  $settings = \wpSPIO()->settings();
444
 
445
+ $keyControl = ApiKeyController::getInstance();
446
+
447
+
448
+ if ($settings->quotaExceeded || ! $keyControl->keyIsVerified() )
449
  {
450
  return $this->renderActions($thisActions, $item, $file); // nothing more.
451
  }
467
  {
468
  $thisActions = array();
469
  $settings = \wpSPIO()->settings();
470
+ $keyControl = ApiKeyController::getInstance();
471
 
472
+ if (! $keyControl->keyIsVerified())
473
+ {
474
+ $thisActions[] = $this->actions['no-key'];
475
+ }
476
+ elseif ($settings->quotaExceeded)
477
  {
478
  $thisActions[] = $this->actions['quota'];
479
  }
519
 
520
  foreach($actions as $index => $action)
521
  {
522
+ $text = isset($action['text']) ? $action['text'] : '';
523
 
524
  if (isset($action['link']))
525
  {
class/db/shortpixel-custom-meta-dao.php CHANGED
@@ -128,8 +128,6 @@ class ShortPixelCustomMetaDao {
128
  // $this->addIfMissing("UNIQUE INDEX", $this->db->getPrefix()."shortpixel_meta", "sp_path", "path");
129
  $this->addIfMissing("FOREIGN KEY", $this->db->getPrefix()."shortpixel_meta", "fk_shortpixel_meta_folder", "folder_id",
130
  $this->db->getPrefix()."shortpixel_folders", "id");
131
-
132
-
133
  }
134
 
135
  public function getFolders() {
@@ -183,6 +181,7 @@ class ShortPixelCustomMetaDao {
183
  $path = $folder->getPath();
184
  $tsUpdated = date("Y-m-d H:i:s", $folder->getTsUpdated());
185
 
 
186
  return $this->db->insert($this->db->getPrefix().'shortpixel_folders',
187
  array("path" => $path, "path_md5" => md5($path), "file_count" => $fileCount, "ts_updated" => $tsUpdated, "ts_created" => date("Y-m-d H:i:s")),
188
  array("path" => "%s", "path_md5" => "%s", "file_count" => "%d", "ts_updated" => "%s"));
@@ -229,15 +228,6 @@ class ShortPixelCustomMetaDao {
229
 
230
 
231
 
232
- /* Check files and add what's needed
233
- * Moved for directory Other Media Model
234
- public function refreshFolder(ShortPixel\DirectoryModel $folder)
235
- {
236
-
237
-
238
- }
239
- */
240
-
241
  /**
242
  *
243
  * @param type $path
@@ -309,18 +299,19 @@ class ShortPixelCustomMetaDao {
309
  $this->db->query($sqlCleanup);
310
 
311
  $values = array();
312
- $sql = "INSERT IGNORE INTO {$this->db->getPrefix()}shortpixel_meta(folder_id, path, name, path_md5, status) VALUES ";
313
- $format = '(%d,%s,%s,%s,%d)';
314
  $i = 0;
315
  $count = 0;
316
  $placeholders = array();
317
  $status = (\wpSPIO()->settings()->autoMediaLibrary == 1) ? ShortPixelMeta::FILE_STATUS_PENDING : ShortPixelMeta::FILE_STATUS_UNPROCESSED;
318
-
 
319
  foreach($files as $file) {
320
  $filepath = $file->getFullPath();
321
  $filename = $file->getFileName();
322
 
323
- array_push($values, $folderId, $filepath, $filename, md5($filepath), $status);
324
  $placeholders[] = $format;
325
 
326
  if($i % 500 == 499) {
@@ -428,7 +419,7 @@ class ShortPixelCustomMetaDao {
428
 
429
  $table = $this->db->getPrefix() . 'shortpixel_meta';
430
  //$sql = "UPDATE status on "; ShortPixelMeta::FILE_STATUS_TORESTORE
431
- $this->db->update($table, array('status' => ShortPixelMeta::FILE_STATUS_TORESTORE), array('folder_id' => $folder_id), '%d', '%d' );
432
  }
433
 
434
 
128
  // $this->addIfMissing("UNIQUE INDEX", $this->db->getPrefix()."shortpixel_meta", "sp_path", "path");
129
  $this->addIfMissing("FOREIGN KEY", $this->db->getPrefix()."shortpixel_meta", "fk_shortpixel_meta_folder", "folder_id",
130
  $this->db->getPrefix()."shortpixel_folders", "id");
 
 
131
  }
132
 
133
  public function getFolders() {
181
  $path = $folder->getPath();
182
  $tsUpdated = date("Y-m-d H:i:s", $folder->getTsUpdated());
183
 
184
+
185
  return $this->db->insert($this->db->getPrefix().'shortpixel_folders',
186
  array("path" => $path, "path_md5" => md5($path), "file_count" => $fileCount, "ts_updated" => $tsUpdated, "ts_created" => date("Y-m-d H:i:s")),
187
  array("path" => "%s", "path_md5" => "%s", "file_count" => "%d", "ts_updated" => "%s"));
228
 
229
 
230
 
 
 
 
 
 
 
 
 
 
231
  /**
232
  *
233
  * @param type $path
299
  $this->db->query($sqlCleanup);
300
 
301
  $values = array();
302
+ $sql = "INSERT IGNORE INTO {$this->db->getPrefix()}shortpixel_meta(folder_id, path, name, path_md5, status, ts_added) VALUES ";
303
+ $format = '(%d,%s,%s,%s,%d,%s)';
304
  $i = 0;
305
  $count = 0;
306
  $placeholders = array();
307
  $status = (\wpSPIO()->settings()->autoMediaLibrary == 1) ? ShortPixelMeta::FILE_STATUS_PENDING : ShortPixelMeta::FILE_STATUS_UNPROCESSED;
308
+ $created = date("Y-m-d H:i:s");
309
+
310
  foreach($files as $file) {
311
  $filepath = $file->getFullPath();
312
  $filename = $file->getFileName();
313
 
314
+ array_push($values, $folderId, $filepath, $filename, md5($filepath), $status, $created);
315
  $placeholders[] = $format;
316
 
317
  if($i % 500 == 499) {
419
 
420
  $table = $this->db->getPrefix() . 'shortpixel_meta';
421
  //$sql = "UPDATE status on "; ShortPixelMeta::FILE_STATUS_TORESTORE
422
+ $this->db->update($table, array('status' => ShortPixelMeta::FILE_STATUS_TORESTORE), array('folder_id' => $folder_id, 'status' => ShortPixelMeta::FILE_STATUS_SUCCESS), '%d', '%d' );
423
  }
424
 
425
 
class/db/shortpixel-meta-facade.php CHANGED
@@ -639,8 +639,7 @@ class ShortPixelMetaFacade {
639
  $sizes = $meta->getThumbs();
640
 
641
  //it is NOT a PDF file and thumbs are processable
642
- if ( /* strtolower(substr($path,strrpos($path, ".")+1)) != "pdf"
643
- &&*/ ($processThumbnails || $onlyThumbs)
644
  && count($sizes))
645
  {
646
  $Tmp = explode("/", SHORTPIXEL_UPLOADS_BASE);
@@ -814,8 +813,18 @@ class ShortPixelMetaFacade {
814
  Log::addError('Secondary download failed', array($url, $response->get_error_messages(), $response->get_error_codes() ));
815
  }
816
  }
817
- else { // success
818
  $pathFile = $fs->getFile($response['filename']);
 
 
 
 
 
 
 
 
 
 
819
  }
820
 
821
  $fsUrl = $fs->pathToUrl($pathFile);
639
  $sizes = $meta->getThumbs();
640
 
641
  //it is NOT a PDF file and thumbs are processable
642
+ if ( $mainExists && ($processThumbnails || $onlyThumbs)
 
643
  && count($sizes))
644
  {
645
  $Tmp = explode("/", SHORTPIXEL_UPLOADS_BASE);
813
  Log::addError('Secondary download failed', array($url, $response->get_error_messages(), $response->get_error_codes() ));
814
  }
815
  }
816
+ else { // success, at least the download.
817
  $pathFile = $fs->getFile($response['filename']);
818
+
819
+ if ($pathFile->exists())
820
+ {
821
+ // It seems it can happen that remote_get returns a 0-byte response. That's not valid and should not remain on disk.
822
+ if ($pathFile->getFileSize() == 0)
823
+ $pathFile->delete();
824
+ else
825
+ $path = $pathFile->getFullPath();
826
+
827
+ }
828
  }
829
 
830
  $fsUrl = $fs->pathToUrl($pathFile);
class/external/helpscout.php CHANGED
@@ -4,13 +4,17 @@ namespace ShortPixel;
4
  // Integration class for HelpScout
5
  class HelpScout
6
  {
7
- public static function outputBeacon($apiKey)
8
  {
9
  global $shortPixelPluginInstance;
10
  $dismissed = $shortPixelPluginInstance->getSettings()->dismissedNotices ? $shortPixelPluginInstance->getSettings()->dismissedNotices : array();
11
  if(isset($dismissed['help'])) {
12
  return;
13
  }
 
 
 
 
14
  ?>
15
  <style>
16
  .shortpixel-hs-blind {
@@ -158,7 +162,7 @@ class HelpScout
158
 
159
  window.Beacon('identify', {
160
  email: "<?php $u = wp_get_current_user(); echo($u->user_email); ?>",
161
- apiKey: "<?php echo($apiKey);?>"
162
  });
163
  window.Beacon('suggest', <?php echo( $suggestions ) ?>);
164
  </script>
4
  // Integration class for HelpScout
5
  class HelpScout
6
  {
7
+ public static function outputBeacon()
8
  {
9
  global $shortPixelPluginInstance;
10
  $dismissed = $shortPixelPluginInstance->getSettings()->dismissedNotices ? $shortPixelPluginInstance->getSettings()->dismissedNotices : array();
11
  if(isset($dismissed['help'])) {
12
  return;
13
  }
14
+
15
+ $keyControl = ApiKeyController::getInstance();
16
+ $apikey = $keyControl->getKeyForDisplay();
17
+
18
  ?>
19
  <style>
20
  .shortpixel-hs-blind {
162
 
163
  window.Beacon('identify', {
164
  email: "<?php $u = wp_get_current_user(); echo($u->user_email); ?>",
165
+ apiKey: "<?php echo($apikey);?>"
166
  });
167
  window.Beacon('suggest', <?php echo( $suggestions ) ?>);
168
  </script>
class/model/apikey_model.php CHANGED
@@ -189,7 +189,7 @@ class ApiKeyModel extends ShortPixelModel
189
  adminNoticesController::resetAPINotices();
190
  adminNoticesController::resetQuotaNotices();
191
  adminNoticesController::resetIntegrationNotices();
192
-
193
  $this->update();
194
 
195
  }
@@ -223,7 +223,7 @@ class ApiKeyModel extends ShortPixelModel
223
  /** Process some things when key has been added. This is from original wp-short-pixel.php */
224
  protected function processNewKey($quotaData)
225
  {
226
- $settingsObj = $this->shortPixel->getSettings();
227
  $lastStatus = $settingsObj->bulkLastStatus;
228
 
229
  if(isset($lastStatus['Status']) && $lastStatus['Status'] == \ShortPixelAPI::STATUS_NO_KEY) {
@@ -239,7 +239,7 @@ class ApiKeyModel extends ShortPixelModel
239
  $notice = __("Great, your API Key is valid! <br>You seem to be running a multisite, please note that API Key can also be configured in wp-config.php like this:",'shortpixel-image-optimiser')
240
  . "<BR> <b>define('SHORTPIXEL_API_KEY', '". $this->apiKey ."');</b>";
241
  else
242
- $notice = __('Great, your API Key is valid. Please take a few moments to review the plugin settings below before starting to optimize your images.','shortpixel-image-optimiser');
243
 
244
  Notice::addSuccess($notice);
245
  }
@@ -278,8 +278,7 @@ class ApiKeyModel extends ShortPixelModel
278
  // Does remote Validation of key. In due time should be replaced with something more lean.
279
  private function remoteValidate($key)
280
  {
281
-
282
- return $this->shortPixel->getQuotaInformation($key, true, true);
283
  }
284
 
285
  protected function checkRedirect()
189
  adminNoticesController::resetAPINotices();
190
  adminNoticesController::resetQuotaNotices();
191
  adminNoticesController::resetIntegrationNotices();
192
+
193
  $this->update();
194
 
195
  }
223
  /** Process some things when key has been added. This is from original wp-short-pixel.php */
224
  protected function processNewKey($quotaData)
225
  {
226
+ $settingsObj = \wpSPIO()->settings();
227
  $lastStatus = $settingsObj->bulkLastStatus;
228
 
229
  if(isset($lastStatus['Status']) && $lastStatus['Status'] == \ShortPixelAPI::STATUS_NO_KEY) {
239
  $notice = __("Great, your API Key is valid! <br>You seem to be running a multisite, please note that API Key can also be configured in wp-config.php like this:",'shortpixel-image-optimiser')
240
  . "<BR> <b>define('SHORTPIXEL_API_KEY', '". $this->apiKey ."');</b>";
241
  else
242
+ $notice = __('Great, your API Key is valid. Please take a few moments to review the plugin settings before starting to optimize your images.','shortpixel-image-optimiser');
243
 
244
  Notice::addSuccess($notice);
245
  }
278
  // Does remote Validation of key. In due time should be replaced with something more lean.
279
  private function remoteValidate($key)
280
  {
281
+ return \wpSPIO()->getShortPixel()->getQuotaInformation($key, true, true);
 
282
  }
283
 
284
  protected function checkRedirect()
class/model/directory_othermedia_model.php CHANGED
@@ -12,7 +12,7 @@ class DirectoryOtherMediaModel extends DirectoryModel
12
 
13
  protected $name;
14
  protected $status = 0;
15
- protected $fileCount = 0; // inherent onreliable statistic in dbase. When insert / batch insert the folder count could not be updated, only on refreshFolder which is a relative heavy function to use on every file upload. Totals are better gotten from a stat-query, on request.
16
  protected $updated = 0;
17
  protected $created = 0;
18
 
@@ -182,7 +182,7 @@ class DirectoryOtherMediaModel extends DirectoryModel
182
  public function delete()
183
  {
184
  $id = $this->id;
185
- if (! $in_db)
186
  {
187
  Log::addError('Trying to remove Folder without ID ' . $id, $this->getPath());
188
  }
12
 
13
  protected $name;
14
  protected $status = 0;
15
+ protected $fileCount = 0; // inherent onreliable statistic in dbase. When insert / batch insert the folder count could not be updated, only on refreshFolder which is a relative heavy function to use on every file upload. Totals are better gotten from a stat-query, on request.
16
  protected $updated = 0;
17
  protected $created = 0;
18
 
182
  public function delete()
183
  {
184
  $id = $this->id;
185
+ if (! $this->in_db)
186
  {
187
  Log::addError('Trying to remove Folder without ID ' . $id, $this->getPath());
188
  }
class/model/environment_model.php CHANGED
@@ -13,6 +13,7 @@ class EnvironmentModel extends ShortPixelModel
13
  public $is_apache;
14
  public $is_gd_installed;
15
  public $is_curl_installed;
 
16
 
17
  // MultiSite
18
  public $is_multisite;
@@ -56,6 +57,28 @@ class EnvironmentModel extends ShortPixelModel
56
  return self::$instance;
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  private function setServer()
60
  {
61
  $this->is_nginx = strpos(strtolower($_SERVER["SERVER_SOFTWARE"]), 'nginx') !== false ? true : false;
@@ -94,15 +117,6 @@ class EnvironmentModel extends ShortPixelModel
94
 
95
  public function setScreen($screen)
96
  {
97
- /*if (! function_exists('get_current_screen')) // way too early.
98
- return false;
99
-
100
- $screen = get_current_screen();
101
- */
102
-
103
- /*if (is_null($screen)) //
104
- return false; */
105
-
106
  // WordPress pages where we'll be active on.
107
  // https://codex.wordpress.org/Plugin_API/Admin_Screen_Reference
108
  $use_screens = array(
13
  public $is_apache;
14
  public $is_gd_installed;
15
  public $is_curl_installed;
16
+ private $disabled_functions = array();
17
 
18
  // MultiSite
19
  public $is_multisite;
57
  return self::$instance;
58
  }
59
 
60
+ /** Check ENV is a specific function is allowed. Use this with functions that might be turned off on configurations
61
+ * @param $function String The name of the function being tested
62
+ * Note: In future this function can be extended with other function edge cases.
63
+ */
64
+ public function is_function_usable($function)
65
+ {
66
+ if (count($this->disabled_functions) == 0)
67
+ {
68
+ $disabled = ini_get('disable_functions');
69
+ $this->disabled_functions = explode($disabled, ',');
70
+ }
71
+
72
+ if (isset($this->disabled_functions[$function]))
73
+ return false;
74
+
75
+ if (function_exists($function))
76
+ return true;
77
+
78
+ return false;
79
+
80
+ }
81
+
82
  private function setServer()
83
  {
84
  $this->is_nginx = strpos(strtolower($_SERVER["SERVER_SOFTWARE"]), 'nginx') !== false ? true : false;
117
 
118
  public function setScreen($screen)
119
  {
 
 
 
 
 
 
 
 
 
120
  // WordPress pages where we'll be active on.
121
  // https://codex.wordpress.org/Plugin_API/Admin_Screen_Reference
122
  $use_screens = array(
class/shortpixel-png2jpg.php CHANGED
@@ -482,7 +482,7 @@ class ShortPixelPng2Jpg {
482
  $timeElapsed = microtime(true) - $startTime;
483
  if($timeElapsed > SHORTPIXEL_MAX_EXECUTION_TIME / 2) {
484
  //try to add some time or get out if not
485
- if(set_time_limit(SHORTPIXEL_MAX_EXECUTION_TIME)) {
486
  $startTime += SHORTPIXEL_MAX_EXECUTION_TIME / 2;
487
  } else {
488
  break;
482
  $timeElapsed = microtime(true) - $startTime;
483
  if($timeElapsed > SHORTPIXEL_MAX_EXECUTION_TIME / 2) {
484
  //try to add some time or get out if not
485
+ if(\wpSPIO()->env()->is_function_usable('set_time_limit') && set_time_limit(SHORTPIXEL_MAX_EXECUTION_TIME)) {
486
  $startTime += SHORTPIXEL_MAX_EXECUTION_TIME / 2;
487
  } else {
488
  break;
class/view/settings/part-general.php CHANGED
@@ -6,7 +6,6 @@
6
 
7
  <div class="wp-shortpixel-options wp-shortpixel-tab-content" style="visibility: hidden">
8
 
9
-
10
  <table class="form-table">
11
  <tbody>
12
  <tr>
6
 
7
  <div class="wp-shortpixel-options wp-shortpixel-tab-content" style="visibility: hidden">
8
 
 
9
  <table class="form-table">
10
  <tbody>
11
  <tr>
class/view/shortpixel_view.php CHANGED
@@ -218,7 +218,7 @@ class ShortPixelView {
218
  $averageCompression, $filesOptimized, $savedSpace, $percent, $customCount) {
219
  $settings = $this->ctrl->getSettings();
220
  //$this->ctrl->outputHSBeacon();
221
- \ShortPixel\HelpScout::outputBeacon($this->ctrl->getApiKey());
222
 
223
  $this->bulkType = $this->ctrl->getPrioQ()->getBulkTypeForDisplay(); // adding to the mess
224
  $hider = ($this->bulkType == ShortPixelQueue::BULK_TYPE_RESTORE) ? 'sp-hidden' : '';
218
  $averageCompression, $filesOptimized, $savedSpace, $percent, $customCount) {
219
  $settings = $this->ctrl->getSettings();
220
  //$this->ctrl->outputHSBeacon();
221
+ \ShortPixel\HelpScout::outputBeacon();
222
 
223
  $this->bulkType = $this->ctrl->getPrioQ()->getBulkTypeForDisplay(); // adding to the mess
224
  $hider = ($this->bulkType == ShortPixelQueue::BULK_TYPE_RESTORE) ? 'sp-hidden' : '';
class/view/view-other-media.php CHANGED
@@ -9,7 +9,7 @@ if ( isset($_GET['noheader']) ) {
9
  require_once(ABSPATH . 'wp-admin/admin-header.php');
10
  }
11
  //$this->outputHSBeacon();
12
- \ShortPixel\HelpScout::outputBeacon(\wpSPIO()->getShortPixel()->getApiKey());
13
 
14
  echo $this->view->rewriteHREF;
15
 
9
  require_once(ABSPATH . 'wp-admin/admin-header.php');
10
  }
11
  //$this->outputHSBeacon();
12
+ \ShortPixel\HelpScout::outputBeacon();
13
 
14
  echo $this->view->rewriteHREF;
15
 
class/view/view-settings.php CHANGED
@@ -2,7 +2,7 @@
2
  namespace ShortPixel;
3
  use ShortPixel\ShortpixelLogger\ShortPixelLogger as Log;
4
 
5
- HelpScout::outputBeacon($this->hide_api_key ? '' : $view->data->apiKey);
6
 
7
  ?>
8
  <div class="wrap">
2
  namespace ShortPixel;
3
  use ShortPixel\ShortpixelLogger\ShortPixelLogger as Log;
4
 
5
+ HelpScout::outputBeacon();
6
 
7
  ?>
8
  <div class="wrap">
class/wp-short-pixel.php CHANGED
@@ -30,7 +30,6 @@ class WPShortPixel {
30
  public function __construct() {
31
  $this->timer = time();
32
 
33
-
34
  if (Log::debugIsActive()) {
35
  $this->jsSuffix = '.js'; //use unminified versions for easier debugging
36
  }
@@ -53,12 +52,10 @@ class WPShortPixel {
53
  }
54
 
55
  // only load backed, or when frontend processing is enabled.
56
- if (is_admin() || $this->_settings->frontBootstrap )
57
  {
58
- $keyControl = new \ShortPixel\apiKeyController();
59
- $keyControl->setShortPixel($this);
60
- $keyControl->load();
61
- }
62
 
63
  }
64
 
@@ -299,8 +296,6 @@ class WPShortPixel {
299
  /** @todo Plugin init class. Try to get rid of inline JS. Also still loads on all WP pages, prevent that. */
300
  function shortPixelJS() {
301
 
302
-
303
-
304
  $is_front = (wpSPIO()->env()->is_front) ? true : false;
305
 
306
  // load everywhere, because we are inconsistent.
@@ -329,6 +324,8 @@ class WPShortPixel {
329
 
330
  wp_register_script('shortpixel', plugins_url('/res/js/shortpixel' . $this->jsSuffix,SHORTPIXEL_PLUGIN_FILE), array('jquery', 'jquery.knob.min.js'), SHORTPIXEL_IMAGE_OPTIMISER_VERSION, true);
331
 
 
 
332
 
333
  // Using an Array within another Array to protect the primitive values from being cast to strings
334
  $ShortPixelConstants = array(array(
@@ -345,7 +342,8 @@ class WPShortPixel {
345
  'STATUS_SEARCHING' => ShortPixelAPI::STATUS_SEARCHING,
346
  'WP_PLUGIN_URL'=>plugins_url( '', SHORTPIXEL_PLUGIN_FILE ),
347
  'WP_ADMIN_URL'=>admin_url(),
348
- 'API_KEY'=> (defined("SHORTPIXEL_HIDE_API_KEY" ) || !is_admin() ) ? '' : $this->_settings->apiKey,
 
349
  'DEFAULT_COMPRESSION'=>0 + intval($this->_settings->compressionType), // no int can happen when settings are empty still
350
  'MEDIA_ALERT'=>$this->_settings->mediaAlert ? "done" : "todo",
351
  'FRONT_BOOTSTRAP'=>$this->_settings->frontBootstrap && (!isset($this->_settings->lastBackAction) || (time() - $this->_settings->lastBackAction > 600)) ? 1 : 0,
@@ -483,7 +481,17 @@ class WPShortPixel {
483
  if($lastStatus && $lastStatus['Status'] !== ShortPixelAPI::STATUS_SUCCESS) {
484
  $extraClasses = " shortpixel-alert shortpixel-processing";
485
  $tooltip = '';
486
- $successLink = $link = admin_url(current_user_can( 'edit_others_posts')? 'post.php?post=' . $lastStatus['ImageID'] . '&action=edit' : 'upload.php');
 
 
 
 
 
 
 
 
 
 
487
 
488
  $wp_admin_bar->add_node( array(
489
  'id' => 'shortpixel_processing-title',
@@ -764,6 +772,7 @@ class WPShortPixel {
764
  $meta->setResize($this->_settings->resizeImages);
765
  $meta->setResizeWidth($this->_settings->resizeWidth);
766
  $meta->setResizeHeight($this->_settings->resizeHeight);
 
767
  $ID = $this->spMetaDao->addImage($meta);
768
  $meta->setId($ID);
769
 
@@ -785,6 +794,7 @@ class WPShortPixel {
785
  $metaThumb->setResize($this->_settings->resizeImages);
786
  $metaThumb->setResizeWidth($this->_settings->resizeWidth);
787
  $metaThumb->setResizeHeight($this->_settings->resizeHeight);
 
788
  $ID = $this->spMetaDao->addImage($metaThumb);
789
  $metaThumb->setId($ID);
790
 
@@ -966,7 +976,7 @@ class WPShortPixel {
966
  $crtStartQueryID = $post_id; // $itemMetaData->post_id;
967
  if(time() - $this->timer >= 60) Log::addInfo("GETDB is SO SLOW. Check processable for $crtStartQueryID.");
968
  if(time() - $this->timer >= $maxTime - $timeoutThreshold){
969
- if($counter == 0 && set_time_limit(30)) {
970
  self::log("GETDB is SO SLOW. Increasing time limit by 30 sec succeeded.");
971
  $maxTime += 30 - $timeoutThreshold;
972
  } else {
@@ -1067,7 +1077,9 @@ class WPShortPixel {
1067
  return $items;
1068
  }
1069
 
1070
- /** Checks the API key **/
 
 
1071
  private function checkKey($ID) {
1072
  if( $this->_settings->verifiedKey == false) {
1073
  if($ID == null){
@@ -2326,9 +2338,8 @@ class WPShortPixel {
2326
  if($backupFile === false)
2327
  {
2328
  Log::addWarn("Custom File $ID - $file does not have a backup");
2329
- $notice = Notices::addWarning(__('Not able to restore file. Could not find backup', 'shortpixel-image-optimiser'), true);
2330
  Notices::addDetail($notice, (string) $file);
2331
-
2332
  return false;
2333
  }
2334
  elseif ($backupFile->copy($fileObj))
@@ -2337,7 +2348,8 @@ class WPShortPixel {
2337
  }
2338
  else {
2339
  Log::addError('Could not restore back to source' . $backupFile->getFullPath() );
2340
- Notices::addError('The file could not be restored from backup. Plugin could not copy backup back to original location. Check file permissions. ', 'shortpixel-image-optimiser');
 
2341
  return false;
2342
  }
2343
 
@@ -2702,8 +2714,7 @@ class WPShortPixel {
2702
  if ( isset($_GET['noheader']) ) {
2703
  require_once(ABSPATH . 'wp-admin/admin-header.php');
2704
  }
2705
- //$this->outputHSBeacon();
2706
- \ShortPixel\HelpScout::outputBeacon($this->getApiKey());
2707
  ?>
2708
  <div class="wrap shortpixel-other-media">
2709
  <h2>
30
  public function __construct() {
31
  $this->timer = time();
32
 
 
33
  if (Log::debugIsActive()) {
34
  $this->jsSuffix = '.js'; //use unminified versions for easier debugging
35
  }
52
  }
53
 
54
  // only load backed, or when frontend processing is enabled.
55
+ /*if (is_admin() || $this->_settings->frontBootstrap )
56
  {
57
+ $keyControl = \ShortPixel\ApiKeyController::getInstance();
58
+ } */
 
 
59
 
60
  }
61
 
296
  /** @todo Plugin init class. Try to get rid of inline JS. Also still loads on all WP pages, prevent that. */
297
  function shortPixelJS() {
298
 
 
 
299
  $is_front = (wpSPIO()->env()->is_front) ? true : false;
300
 
301
  // load everywhere, because we are inconsistent.
324
 
325
  wp_register_script('shortpixel', plugins_url('/res/js/shortpixel' . $this->jsSuffix,SHORTPIXEL_PLUGIN_FILE), array('jquery', 'jquery.knob.min.js'), SHORTPIXEL_IMAGE_OPTIMISER_VERSION, true);
326
 
327
+ $keyControl = \ShortPixel\ApiKeyController::getInstance();
328
+ $apikey = $keyControl->getKeyForDisplay();
329
 
330
  // Using an Array within another Array to protect the primitive values from being cast to strings
331
  $ShortPixelConstants = array(array(
342
  'STATUS_SEARCHING' => ShortPixelAPI::STATUS_SEARCHING,
343
  'WP_PLUGIN_URL'=>plugins_url( '', SHORTPIXEL_PLUGIN_FILE ),
344
  'WP_ADMIN_URL'=>admin_url(),
345
+ // 'API_KEY'=> $apikey,
346
+ 'API_IS_ACTIVE' => $keyControl->keyIsVerified(),
347
  'DEFAULT_COMPRESSION'=>0 + intval($this->_settings->compressionType), // no int can happen when settings are empty still
348
  'MEDIA_ALERT'=>$this->_settings->mediaAlert ? "done" : "todo",
349
  'FRONT_BOOTSTRAP'=>$this->_settings->frontBootstrap && (!isset($this->_settings->lastBackAction) || (time() - $this->_settings->lastBackAction > 600)) ? 1 : 0,
481
  if($lastStatus && $lastStatus['Status'] !== ShortPixelAPI::STATUS_SUCCESS) {
482
  $extraClasses = " shortpixel-alert shortpixel-processing";
483
  $tooltip = '';
484
+
485
+ $link = '';
486
+ if (admin_url(current_user_can( 'edit_others_posts')))
487
+ {
488
+ $link = 'post.php?post=' . $lastStatus['ImageID'] . '&action=edit';
489
+ }
490
+ else
491
+ {
492
+ $link = 'upload.php';
493
+ }
494
+ $successLink = $link;
495
 
496
  $wp_admin_bar->add_node( array(
497
  'id' => 'shortpixel_processing-title',
772
  $meta->setResize($this->_settings->resizeImages);
773
  $meta->setResizeWidth($this->_settings->resizeWidth);
774
  $meta->setResizeHeight($this->_settings->resizeHeight);
775
+ $meta->setTsAdded(date("Y-m-d H:i:s"));
776
  $ID = $this->spMetaDao->addImage($meta);
777
  $meta->setId($ID);
778
 
794
  $metaThumb->setResize($this->_settings->resizeImages);
795
  $metaThumb->setResizeWidth($this->_settings->resizeWidth);
796
  $metaThumb->setResizeHeight($this->_settings->resizeHeight);
797
+ $metaThumb->setTsAdded(date("Y-m-d H:i:s"));
798
  $ID = $this->spMetaDao->addImage($metaThumb);
799
  $metaThumb->setId($ID);
800
 
976
  $crtStartQueryID = $post_id; // $itemMetaData->post_id;
977
  if(time() - $this->timer >= 60) Log::addInfo("GETDB is SO SLOW. Check processable for $crtStartQueryID.");
978
  if(time() - $this->timer >= $maxTime - $timeoutThreshold){
979
+ if($counter == 0 && \wpSPIO()->env()->is_function_usable('set_time_limit') && set_time_limit(30)) {
980
  self::log("GETDB is SO SLOW. Increasing time limit by 30 sec succeeded.");
981
  $maxTime += 30 - $timeoutThreshold;
982
  } else {
1077
  return $items;
1078
  }
1079
 
1080
+ /** Checks the API key
1081
+ * @todo This function should be moved to Apikey Controller.
1082
+ **/
1083
  private function checkKey($ID) {
1084
  if( $this->_settings->verifiedKey == false) {
1085
  if($ID == null){
2338
  if($backupFile === false)
2339
  {
2340
  Log::addWarn("Custom File $ID - $file does not have a backup");
2341
+ $notice = Notices::addWarning(__('Not able to restore file(s). Could not find backup', 'shortpixel-image-optimiser'), true);
2342
  Notices::addDetail($notice, (string) $file);
 
2343
  return false;
2344
  }
2345
  elseif ($backupFile->copy($fileObj))
2348
  }
2349
  else {
2350
  Log::addError('Could not restore back to source' . $backupFile->getFullPath() );
2351
+ $notice = Notices::addError('These file(s) could not be restored from backup. Plugin could not copy backup back to original location. Check file permissions. ', 'shortpixel-image-optimiser');
2352
+ Notices::addDetail($notice, (string) $backupFile);
2353
  return false;
2354
  }
2355
 
2714
  if ( isset($_GET['noheader']) ) {
2715
  require_once(ABSPATH . 'wp-admin/admin-header.php');
2716
  }
2717
+
 
2718
  ?>
2719
  <div class="wrap shortpixel-other-media">
2720
  <h2>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: compressor, image, compression, optimize, image optimizer, image optimiser
4
  Requires at least: 3.2.0
5
  Tested up to: 5.4
6
  Requires PHP: 5.3
7
- Stable tag: 4.17.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -281,6 +281,23 @@ Hide the Cloudflare settings by defining these constants in wp-config.php:
281
 
282
  == Changelog ==
283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  = 4.17.2 =
285
 
286
  Release date: 10th April 2020
@@ -411,7 +428,7 @@ Release date: 27th November 2019
411
  * Fixed: check for DOING_AJAX on redirect to settings.
412
  * Fixed: Shortpixel icon + exclamation mark in toolbar showing on every page load.
413
  * Fixed: Add Custom media browser doesn't display files anymore
414
- * Fixed: WebP option adds an extra border if image already has a border -> borders will not be replicated to `<picture>` tags.
415
  * Fixed: Validating empty key doesn't show any message.
416
  * Fixed: on Nginx writes .htaccess files.
417
  * Fixed: Bug with safeGetAttachmentUrl for URLs that start with //.
4
  Requires at least: 3.2.0
5
  Tested up to: 5.4
6
  Requires PHP: 5.3
7
+ Stable tag: 4.17.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
281
 
282
  == Changelog ==
283
 
284
+ = 4.17.3 =
285
+
286
+ Release date: 16th April 2020
287
+ * Added a collapsable details feature to notifications, in order to avoid filling up the screen with them;
288
+ * Added a filter to completely disable the plugin, when necessary (for certain user roles for example);
289
+ * Hide the API key from the support chat module in settings, when the API key is entered via wp-config.php;
290
+ * Prevent fatal errors if multiple versions of the plugin are active simultaneously;
291
+ * Fix for API key that could be leaked in the frontend through JS;
292
+ * Fix for situations where the plugin was crashing if the API key was added via wp-config.php;
293
+ * Fix missing optimize button on Edit Media screen;
294
+ * Fix for time stamp in Other Media screen when the server is set on another time zone than UTC;
295
+ * Fix for JSON parsing errors when `set_time_limit` function is forbidden;
296
+ * Fix for notifications not showing correctly the number of credits available;
297
+ * Fix for images stuck in "Pending Restore" in Other Media, when there was no backup for them;
298
+ * Fix for hamburger menu in Other Media not displaying options centered;
299
+ * Language – 4 new strings added, 2 updated, 0 fuzzied, and 4 obsoleted.
300
+
301
  = 4.17.2 =
302
 
303
  Release date: 10th April 2020
428
  * Fixed: check for DOING_AJAX on redirect to settings.
429
  * Fixed: Shortpixel icon + exclamation mark in toolbar showing on every page load.
430
  * Fixed: Add Custom media browser doesn't display files anymore
431
+ * Fixed: WebP option adds an extra border if image already has a border -> borders will not be replicated to <picture> tags.
432
  * Fixed: Validating empty key doesn't show any message.
433
  * Fixed: on Nginx writes .htaccess files.
434
  * Fixed: Bug with safeGetAttachmentUrl for URLs that start with //.
res/css/short-pixel.css CHANGED
@@ -16,9 +16,10 @@
16
 
17
  /* Dropdown Button */
18
  .sp-dropbtn.button {
19
- padding: 1px 24px 20px 5px;
 
20
  font-size: 20px;
21
- line-height: 28px;
22
  /*background-color: #4CAF50;
23
  color: white;
24
  border: none;*/
@@ -47,6 +48,10 @@
47
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
48
  z-index: 1;
49
  }
 
 
 
 
50
 
51
  /* Links inside the dropdown */
52
  .sp-dropdown-content a {
@@ -353,6 +358,10 @@ div.shortpixel-rate-us > a:focus {
353
 
354
  float:right;
355
  }
 
 
 
 
356
 
357
  th.sortable.column-wp-shortPixel a,
358
  th.sorted.column-wp-shortPixel a {
16
 
17
  /* Dropdown Button */
18
  .sp-dropbtn.button {
19
+ box-sizing: content-box;
20
+ padding: 0 5px;
21
  font-size: 20px;
22
+ line-height: 20px;
23
  /*background-color: #4CAF50;
24
  color: white;
25
  border: none;*/
48
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
49
  z-index: 1;
50
  }
51
+ .rtl .sp-dropdown-content {
52
+ right:auto;
53
+ left: 0;
54
+ }
55
 
56
  /* Links inside the dropdown */
57
  .sp-dropdown-content a {
358
 
359
  float:right;
360
  }
361
+ .wp-core-ui.rtl .column-wp-shortPixel .sp-column-actions,
362
+ .wp-core-ui.rtl .column-wp-shortPixel .button.button-smaller{
363
+ float:left;
364
+ }
365
 
366
  th.sortable.column-wp-shortPixel a,
367
  th.sorted.column-wp-shortPixel a {
res/css/short-pixel.min.css CHANGED
@@ -1 +1 @@
1
- .reset{font-weight:400;font-style:normal}.clearfix:after,.clearfix:before{content:" ";display:table}.clearfix:after{clear:both}.clearfix{zoom:1}.resumeLabel{float:right;line-height:30px;margin-right:20px;font-size:16px}.sp-dropbtn.button{padding:1px 24px 20px 5px;font-size:20px;line-height:28px;cursor:pointer}.sp-dropdown{position:relative;display:inline-block}.sp-dropdown-content{display:none;right:0;position:absolute;background-color:#f9f9f9;min-width:190px;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);z-index:1}.sp-dropdown-content a{color:#000;padding:12px 16px;text-decoration:none;display:block}.sp-dropdown-content a:hover{background-color:#f1f1f1}.sp-dropdown.sp-show .sp-dropdown-content{display:block}div.fb-like{transform:scale(1.3);-ms-transform:scale(1.3);-webkit-transform:scale(1.3);-o-transform:scale(1.3);-moz-transform:scale(1.3);transform-origin:bottom left;-ms-transform-origin:bottom left;-webkit-transform-origin:bottom left;-moz-transform-origin:bottom left;-webkit-transform-origin:bottom left}.wp-core-ui .button.button-alert,.wp-core-ui .button.button-alert:hover{background:#f79797}.wp-core-ui .button.remove-folder-button{min-width:120px}.sp-notice{background:#fff;border-left:4px solid #fff;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);padding:1px 12px}.sp-notice img{vertical-align:bottom}@media(max-width:1249px){.sp-notice{margin:5px 15px 2px}}.sp-notice-info{border-left-color:#00a0d2}.sp-notice-success{border-left-color:#46b450}.sp-notice-warning{border-left-color:#f1e02a}div.short-pixel-bulk-page input.dial{font-size:16px!important}div.short-pixel-bulk-page h1{margin-bottom:20px}div.bulk-progress div.sp-h2{margin-top:0;margin-bottom:10px;font-size:23px;font-weight:400;padding:9px 15px 4px 0;line-height:29px}div.bulk-progress-partners{margin-top:20px}div.bulk-progress.bulk-progress-partners a div{display:inline-block;vertical-align:top;line-height:50px;margin-left:30px;font-size:1.2em}div.bulk-progress .bulk-progress-indicator,div.sp-quota-exceeded-alert .bulk-progress-indicator{display:inline-block;text-align:center;padding:0 10px;margin-left:10px;float:left;height:90px;overflow:hidden;border:1px solid #1caecb}div.wrap.short-pixel-bulk-page .bulk-notice-container{margin-top:15px;position:absolute;width:500px}div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg{text-align:center;margin:10px 0 0 32px;overflow:hidden;border:1px solid #1caecb;background-color:#9ddbe0;border-radius:5px;padding:7px 10px 10px;display:none;max-width:600px;margin-right:20px}div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg.bulk-error{border:1px solid #b5914d;background-color:#ffe996;margin-right:20px;position:relative;z-index:10}div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg.bulk-error.bulk-error-fatal{border:1px solid #c32525;background-color:#ff969d}div.wrap.short-pixel-bulk-page .bulk-notice-msg img{float:left;margin-top:3px;margin-right:5px}div.sp-bulk-summary{float:right;margin:8px 5px 3px 20px}.sp-notice .bulk-error-show{cursor:pointer}.sp-notice div.bulk-error-list{background-color:#f1f1f1;padding:0 10px;display:none;max-height:200px;overflow-y:scroll}.sp-notice div.bulk-error-list ul{padding:3px 0 0;margin-top:5px}.sp-notice div.bulk-error-list ul>li:not(:last-child){border-bottom:1px solid #fff;padding-bottom:4px}input.dial{box-shadow:none}.shortpixel-table .column-filename{max-width:32em;width:40%}.shortpixel-table .column-folder{max-width:20em;width:20%}.shortpixel-table .column-media_type{max-width:8em;width:10%}.shortpixel-table .column-status{max-width:16em;width:15%}.shortpixel-table .column-options{max-width:16em;width:15%}.form-table th{width:220px}.form-table td{position:relative}div.shortpixel-rate-us{display:inline-block;margin-left:10px;vertical-align:top;font-weight:700}div.shortpixel-rate-us>a{vertical-align:middle;padding:1px 5px 0;text-align:center;display:inline-block}div.shortpixel-rate-us>a>span{display:inline-block;vertical-align:top;margin-top:5px}div.shortpixel-rate-us>a>img{padding-top:7px}div.shortpixel-rate-us>a:active,div.shortpixel-rate-us>a:focus,div.shortpixel-rate-us>a:hover{outline:0;border-style:none}.sp-loading-small{margin-top:2px;float:left;margin-right:5px}.twentytwenty-horizontal .twentytwenty-after-label:before,.twentytwenty-horizontal .twentytwenty-before-label:before{font-family:inherit;font-size:16px}.short-pixel-bulk-page p{margin:.6em 0}.short-pixel-bulk-page form.start{display:table;content:" ";width:98%;background-color:#fff;padding:10px 10px 0;position:relative}.bulk-stats-container{display:inline-block;min-width:450px;width:45%;float:left;padding-right:50px;font-size:1.1em;line-height:1.5em}.bulk-text-container{display:inline-block;min-width:440px;width:45%;float:left;padding-right:50px}.bulk-text-container h3{border-bottom:1px solid #a8a8a8;margin-bottom:.5em;padding-bottom:.5em}.bulk-wide{display:inline-block;width:90%;float:left;margin-top:25px}.bulk-stats-container .bulk-label{width:220px;display:inline-block}.bulk-stats-container .bulk-val{width:50px;display:inline-block;text-align:right}.bulk-stats-container .bulk-total{font-weight:700;margin-top:10px;margin-bottom:10px}.wp-core-ui .bulk-play{display:inline;width:310px;float:left;margin-bottom:20px}.wp-core-ui .bulk-play.bulk-nothing-optimize{font-weight:700;color:#0080b2;border:1px solid;border-radius:5px;margin-top:60px;padding:5px 12px}.wp-core-ui .bulk-play a.button{height:60px;margin-top:27px;overflow:hidden}.wp-core-ui .column-wp-shortPixel .sp-column-actions{max-width:140px;float:right;text-align:right}.wp-core-ui .column-wp-shortPixel .sp-column-actions .button.button-smaller{margin-right:0}.wp-core-ui .column-wp-shortPixel .button.button-smaller{font-size:13px;padding:0 5px;margin-bottom:4px;min-height:30px;float:right}th.sortable.column-wp-shortPixel a,th.sorted.column-wp-shortPixel a{display:inline-block}.column-wp-shortPixel .sorting-indicator{display:inline-block}.wp-core-ui .bulk-play a.button .bulk-btn-img{display:inline-block;padding-top:6px}.wp-core-ui .bulk-play a.button .bulk-btn-txt{display:inline-block;text-align:right;line-height:1.3em;margin:11px 10px}.wp-core-ui .bulk-play a.button .bulk-btn-txt span.label{font-size:1.6em}.wp-core-ui .bulk-play a.button .bulk-btn-txt span.total{font-size:1.4em}.bulk-progress{padding:20px 32px 17px;background-color:#fff}.bulk-progress.bulk-stats>div{display:inline-block}.bulk-progress.bulk-stats>div.label{width:320px}.bulk-progress.bulk-stats>div.stat-value{width:80px;text-align:right}.short-pixel-bulk-page .progress{background-color:#ecedee;height:30px;position:relative;width:60%;display:inline-block;margin-right:28px;overflow:visible}.progress .progress-img{position:absolute;top:-10px;z-index:2;margin-left:-35px;line-height:48px;font-size:22px;font-weight:700}.progress .progress-img span{vertical-align:top;margin-left:-7px}.progress .progress-left{background-color:#1cbecb;bottom:0;left:0;position:absolute;top:0;z-index:1;font-size:22px;font-weight:700;line-height:28px;text-align:center;color:#fff}.bulk-estimate{font-size:20px;line-height:30px;vertical-align:top;display:inline-block}.wp-core-ui .button-primary.bulk-cancel{float:right;height:30px}.short-pixel-block-title{font-size:22px;font-weight:700;text-align:center;margin-bottom:30px}.sp-floating-block.bulk-slider-container{display:none}.sp-floating-block.sp-notice.bulk-notices-parent{padding:0;margin:0;float:right;margin-right:500px!important}.bulk-slider-container{margin-top:20px;min-height:300px;overflow:hidden}.bulk-slider-container h2{margin-bottom:15px}.bulk-slider-container span.filename{font-weight:400}.bulk-slider{display:table;margin:0 auto}.bulk-slider .bulk-slide{margin:0 auto;padding-left:120px;display:inline-block;font-weight:700}.bulk-slider .img-optimized,.bulk-slider .img-original{display:inline-block;margin-right:20px;text-align:center}.bulk-slider .img-optimized div,.bulk-slider .img-original div{max-height:450px;overflow:hidden}.bulk-slider .img-optimized img,.bulk-slider .img-original img{max-width:300px}.bulk-slider .img-info{display:inline-block;vertical-align:top;font-size:48px;max-width:150px;padding:10px 0 0 20px}.bulk-slide-images{display:inline-block;border:1px solid #1caecb;padding:15px 0 0 20px}p.settings-info{padding-top:0;color:#818181;font-size:13px!important}p.settings-info.shortpixel-settings-error{color:#c32525}.shortpixel-key-valid{font-weight:700}.shortpixel-key-valid .dashicons-yes:before{font-size:2em;line-height:25px;color:#3485ba;margin-left:-20px}.shortpixel-compression .shortpixel-compression-options{color:#999}.shortpixel-compression strong{line-height:22px}.shortpixel-compression .shortpixel-compression-options{display:inline-block}.shortpixel-compression label{width:158px;margin:0 -2px;background-color:#e2faff;font-weight:700;display:inline-block}.shortpixel-compression label span{text-align:center;font-size:18px;padding:8px 0;display:block}.shortpixel-compression label input{display:none}.shortpixel-compression input:checked+span{background-color:#0085ba;color:#f7f7f7}.shortpixel-compression .shortpixel-radio-info{min-height:60px}article.sp-tabs{position:relative;display:block;width:100%;margin:2em auto}article.sp-tabs section{position:absolute;display:block;top:1.8em;left:0;width:100%;max-width:100%;box-sizing:border-box;padding:10px 20px;z-index:0}article.sp-tabs section.sel-tab{box-shadow:0 3px 3px rgba(0,0,0,.1)}article.sp-tabs section .wp-shortpixel-tab-content{visibility:hidden}article.sp-tabs section.sel-tab .wp-shortpixel-tab-content{visibility:visible!important}article.sp-tabs section:first-child{z-index:1}article.sp-tabs section h2 a:focus,article.sp-tabs section#tab-resources a:focus{box-shadow:none;outline:0}article.sp-tabs section.sel-tab,article.sp-tabs section.sel-tab h2{color:#333;background-color:#fff;z-index:2}#tab-stats .sp-bulk-summary{position:absolute;right:0;top:0;z-index:100}.deliverWebpAlteringTypes,.deliverWebpSettings,.deliverWebpTypes{display:none}.deliverWebpTypes .sp-notice{color:red}.deliverWebpSettings{margin:16px 0}.deliverWebpSettings input:disabled+label{color:#818181}.deliverWebpAlteringTypes,.deliverWebpTypes{margin:16px 0 16px 16px}#png2jpg:not(:checked)~#png2jpgForce,#png2jpg:not(:checked)~label[for=png2jpgForce]{display:none}article.sp-tabs section #createWebp:checked~.deliverWebpSettings,article.sp-tabs section #deliverWebp:checked~.deliverWebpTypes,article.sp-tabs section #deliverWebpAltered:checked~.deliverWebpAlteringTypes{display:block}.shortpixel-help-link span.dashicons{text-decoration:none;margin-top:-1px}@media(min-width:1000px){section#tab-resources .col-md-6{display:inline-block;width:45%}}@media(max-width:999px){section#tab-resources .col-sm-12{display:inline-block;width:100%}}section#tab-resources .text-center{text-align:center}section#tab-resources p{font-size:16px}.wrap.short-pixel-bulk-page{margin-right:0}.sp-container{overflow:hidden;display:block;width:100%}.sp-floating-block{overflow:hidden;display:inline-block;float:left;margin-right:1.1%!important}.sp-full-width{width:98.8%;box-sizing:border-box}.sp-double-width{width:65.52%;box-sizing:border-box}.sp-single-width{width:32.23%;box-sizing:border-box}@media(max-width:1759px){.sp-floating-block{margin-right:1.3%!important}.sp-double-width,.sp-full-width{width:98.65%}.sp-single-width{width:48.7%}}@media(max-width:1249px){.sp-floating-block{margin-right:2%!important}.sp-double-width,.sp-full-width,.sp-single-width{width:97%}}.sp-tabs h2:before{content:none}.sp-column-actions-template+.sp-column-info{display:none}
1
+ .reset{font-weight:normal;font-style:normal}.clearfix:before,.clearfix:after{content:" ";display:table}.clearfix:after{clear:both}.clearfix{zoom:1}.resumeLabel{float:right;line-height:30px;margin-right:20px;font-size:16px}.sp-dropbtn.button{box-sizing:content-box;padding:0 5px;font-size:20px;line-height:20px;cursor:pointer}.sp-dropdown{position:relative;display:inline-block}.sp-dropdown-content{display:none;right:0;position:absolute;background-color:#f9f9f9;min-width:190px;box-shadow:0 8px 16px 0 rgba(0,0,0,0.2);z-index:1}.rtl .sp-dropdown-content{right:auto;left:0}.sp-dropdown-content a{color:black;padding:12px 16px;text-decoration:none;display:block}.sp-dropdown-content a:hover{background-color:#f1f1f1}.sp-dropdown.sp-show .sp-dropdown-content{display:block}div.fb-like{transform:scale(1.3);-ms-transform:scale(1.3);-webkit-transform:scale(1.3);-o-transform:scale(1.3);-moz-transform:scale(1.3);transform-origin:bottom left;-ms-transform-origin:bottom left;-webkit-transform-origin:bottom left;-moz-transform-origin:bottom left;-webkit-transform-origin:bottom left}.wp-core-ui .button.button-alert,.wp-core-ui .button.button-alert:hover{background:#f79797}.wp-core-ui .button.remove-folder-button{min-width:120px}.sp-notice{background:#fff;border-left:4px solid #fff;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);padding:1px 12px}.sp-notice img{vertical-align:bottom}@media(max-width:1249px){.sp-notice{margin:5px 15px 2px}}.sp-notice-info{border-left-color:#00a0d2}.sp-notice-success{border-left-color:#46b450}.sp-notice-warning{border-left-color:#f1e02a}div.short-pixel-bulk-page input.dial{font-size:16px !important}div.short-pixel-bulk-page h1{margin-bottom:20px}div.bulk-progress div.sp-h2{margin-top:0;margin-bottom:10px;font-size:23px;font-weight:400;padding:9px 15px 4px 0;line-height:29px}div.bulk-progress-partners{margin-top:20px}div.bulk-progress.bulk-progress-partners a div{display:inline-block;vertical-align:top;line-height:50px;margin-left:30px;font-size:1.2em}div.bulk-progress .bulk-progress-indicator,div.sp-quota-exceeded-alert .bulk-progress-indicator{display:inline-block;text-align:center;padding:0 10px;margin-left:10px;float:left;height:90px;overflow:hidden;border:1px solid #1caecb}div.wrap.short-pixel-bulk-page .bulk-notice-container{margin-top:15px;position:absolute;width:500px}div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg{text-align:center;margin:10px 0 0 32px;overflow:hidden;border:1px solid #1caecb;background-color:#9ddbe0;border-radius:5px;padding:7px 10px 10px;display:none;max-width:600px;margin-right:20px}div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg.bulk-error{border:1px solid #b5914d;background-color:#ffe996;margin-right:20px;position:relative;z-index:10}div.wrap.short-pixel-bulk-page .bulk-notice-container .bulk-notice-msg.bulk-error.bulk-error-fatal{border:1px solid #c32525;background-color:#ff969d}div.wrap.short-pixel-bulk-page .bulk-notice-msg img{float:left;margin-top:3px;margin-right:5px}div.sp-bulk-summary{float:right;margin:8px 5px 3px 20px}.sp-notice .bulk-error-show{cursor:pointer}.sp-notice div.bulk-error-list{background-color:#f1f1f1;padding:0 10px;display:none;max-height:200px;overflow-y:scroll}.sp-notice div.bulk-error-list ul{padding:3px 0 0;margin-top:5px}.sp-notice div.bulk-error-list ul>li:not(:last-child){border-bottom:1px solid white;padding-bottom:4px}input.dial{box-shadow:none}.shortpixel-table .column-filename{max-width:32em;width:40%}.shortpixel-table .column-folder{max-width:20em;width:20%}.shortpixel-table .column-media_type{max-width:8em;width:10%}.shortpixel-table .column-status{max-width:16em;width:15%}.shortpixel-table .column-options{max-width:16em;width:15%}.form-table th{width:220px}.form-table td{position:relative}div.shortpixel-rate-us{display:inline-block;margin-left:10px;vertical-align:top;font-weight:bold}div.shortpixel-rate-us>a{vertical-align:middle;padding:1px 5px 0;text-align:center;display:inline-block}div.shortpixel-rate-us>a>span{display:inline-block;vertical-align:top;margin-top:5px}div.shortpixel-rate-us>a>img{padding-top:7px}div.shortpixel-rate-us>a:active,div.shortpixel-rate-us>a:hover,div.shortpixel-rate-us>a:focus{outline:0;border-style:none}.sp-loading-small{margin-top:2px;float:left;margin-right:5px}.twentytwenty-horizontal .twentytwenty-before-label:before,.twentytwenty-horizontal .twentytwenty-after-label:before{font-family:inherit;font-size:16px}.short-pixel-bulk-page p{margin:.6em 0}.short-pixel-bulk-page form.start{display:table;content:" ";width:98%;background-color:white;padding:10px 10px 0;position:relative}.bulk-stats-container{display:inline-block;min-width:450px;width:45%;float:left;padding-right:50px;font-size:1.1em;line-height:1.5em}.bulk-text-container{display:inline-block;min-width:440px;width:45%;float:left;padding-right:50px}.bulk-text-container h3{border-bottom:1px solid #a8a8a8;margin-bottom:.5em;padding-bottom:.5em}.bulk-wide{display:inline-block;width:90%;float:left;margin-top:25px}.bulk-stats-container .bulk-label{width:220px;display:inline-block}.bulk-stats-container .bulk-val{width:50px;display:inline-block;text-align:right}.bulk-stats-container .bulk-total{font-weight:bold;margin-top:10px;margin-bottom:10px}.wp-core-ui .bulk-play{display:inline;width:310px;float:left;margin-bottom:20px}.wp-core-ui .bulk-play.bulk-nothing-optimize{font-weight:bold;color:#0080b2;border:1px solid;border-radius:5px;margin-top:60px;padding:5px 12px}.wp-core-ui .bulk-play a.button{height:60px;margin-top:27px;overflow:hidden}.wp-core-ui .column-wp-shortPixel .sp-column-actions{max-width:140px;float:right;text-align:right}.wp-core-ui .column-wp-shortPixel .sp-column-actions .button.button-smaller{margin-right:0}.wp-core-ui .column-wp-shortPixel .button.button-smaller{font-size:13px;padding:0 5px;margin-bottom:4px;min-height:30px;float:right}.wp-core-ui.rtl .column-wp-shortPixel .sp-column-actions,.wp-core-ui.rtl .column-wp-shortPixel .button.button-smaller{float:left}th.sortable.column-wp-shortPixel a,th.sorted.column-wp-shortPixel a{display:inline-block}.column-wp-shortPixel .sorting-indicator{display:inline-block}.wp-core-ui .bulk-play a.button .bulk-btn-img{display:inline-block;padding-top:6px}.wp-core-ui .bulk-play a.button .bulk-btn-txt{display:inline-block;text-align:right;line-height:1.3em;margin:11px 10px}.wp-core-ui .bulk-play a.button .bulk-btn-txt span.label{font-size:1.6em}.wp-core-ui .bulk-play a.button .bulk-btn-txt span.total{font-size:1.4em}.bulk-progress{padding:20px 32px 17px;background-color:#fff}.bulk-progress.bulk-stats>div{display:inline-block}.bulk-progress.bulk-stats>div.label{width:320px}.bulk-progress.bulk-stats>div.stat-value{width:80px;text-align:right}.short-pixel-bulk-page .progress{background-color:#ecedee;height:30px;position:relative;width:60%;display:inline-block;margin-right:28px;overflow:visible}.progress .progress-img{position:absolute;top:-10px;z-index:2;margin-left:-35px;line-height:48px;font-size:22px;font-weight:bold}.progress .progress-img span{vertical-align:top;margin-left:-7px}.progress .progress-left{background-color:#1cbecb;bottom:0;left:0;position:absolute;top:0;z-index:1;font-size:22px;font-weight:bold;line-height:28px;text-align:center;color:#fff}.bulk-estimate{font-size:20px;line-height:30px;vertical-align:top;display:inline-block}.wp-core-ui .button-primary.bulk-cancel{float:right;height:30px}.short-pixel-block-title{font-size:22px;font-weight:bold;text-align:center;margin-bottom:30px}.sp-floating-block.bulk-slider-container{display:none}.sp-floating-block.sp-notice.bulk-notices-parent{padding:0;margin:0;float:right;margin-right:500px !important}.bulk-slider-container{margin-top:20px;min-height:300px;overflow:hidden}.bulk-slider-container h2{margin-bottom:15px}.bulk-slider-container span.filename{font-weight:normal}.bulk-slider{display:table;margin:0 auto}.bulk-slider .bulk-slide{margin:0 auto;padding-left:120px;display:inline-block;font-weight:bold}.bulk-slider .img-original,.bulk-slider .img-optimized{display:inline-block;margin-right:20px;text-align:center}.bulk-slider .img-original div,.bulk-slider .img-optimized div{max-height:450px;overflow:hidden}.bulk-slider .img-original img,.bulk-slider .img-optimized img{max-width:300px}.bulk-slider .img-info{display:inline-block;vertical-align:top;font-size:48px;max-width:150px;padding:10px 0 0 20px}.bulk-slide-images{display:inline-block;border:1px solid #1caecb;padding:15px 0 0 20px}p.settings-info{padding-top:0;color:#818181;font-size:13px !important}p.settings-info.shortpixel-settings-error{color:#c32525}.shortpixel-key-valid{font-weight:bold}.shortpixel-key-valid .dashicons-yes:before{font-size:2em;line-height:25px;color:#3485ba;margin-left:-20px}.shortpixel-compression .shortpixel-compression-options{color:#999}.shortpixel-compression strong{line-height:22px}.shortpixel-compression .shortpixel-compression-options{display:inline-block}.shortpixel-compression label{width:158px;margin:0 -2px;background-color:#e2faff;font-weight:bold;display:inline-block}.shortpixel-compression label span{text-align:center;font-size:18px;padding:8px 0;display:block}.shortpixel-compression label input{display:none}.shortpixel-compression input:checked+span{background-color:#0085ba;color:#f7f7f7}.shortpixel-compression .shortpixel-radio-info{min-height:60px}article.sp-tabs{position:relative;display:block;width:100%;margin:2em auto}article.sp-tabs section{position:absolute;display:block;top:1.8em;left:0;width:100%;max-width:100%;box-sizing:border-box;padding:10px 20px;z-index:0}article.sp-tabs section.sel-tab{box-shadow:0 3px 3px rgba(0,0,0,0.1)}article.sp-tabs section .wp-shortpixel-tab-content{visibility:hidden}article.sp-tabs section.sel-tab .wp-shortpixel-tab-content{visibility:visible !important}article.sp-tabs section:first-child{z-index:1}article.sp-tabs section h2 a:focus,article.sp-tabs section#tab-resources a:focus{box-shadow:none;outline:0}article.sp-tabs section.sel-tab,article.sp-tabs section.sel-tab h2{color:#333;background-color:#fff;z-index:2}#tab-stats .sp-bulk-summary{position:absolute;right:0;top:0;z-index:100}.deliverWebpSettings,.deliverWebpTypes,.deliverWebpAlteringTypes{display:none}.deliverWebpTypes .sp-notice{color:red}.deliverWebpSettings{margin:16px 0}.deliverWebpSettings input:disabled+label{color:#818181}.deliverWebpTypes,.deliverWebpAlteringTypes{margin:16px 0 16px 16px}#png2jpg:not(:checked) ~ #png2jpgForce,#png2jpg:not(:checked) ~ label[for=png2jpgForce]{display:none}article.sp-tabs section #createWebp:checked ~ .deliverWebpSettings,article.sp-tabs section #deliverWebp:checked ~ .deliverWebpTypes,article.sp-tabs section #deliverWebpAltered:checked ~ .deliverWebpAlteringTypes{display:block}.shortpixel-help-link span.dashicons{text-decoration:none;margin-top:-1px}@media(min-width:1000px){section#tab-resources .col-md-6{display:inline-block;width:45%}}@media(max-width:999px){section#tab-resources .col-sm-12{display:inline-block;width:100%}}section#tab-resources .text-center{text-align:center}section#tab-resources p{font-size:16px}.wrap.short-pixel-bulk-page{margin-right:0}.sp-container{overflow:hidden;display:block;width:100%}.sp-floating-block{overflow:hidden;display:inline-block;float:left;margin-right:1.1% !important}.sp-full-width{width:98.8%;box-sizing:border-box}.sp-double-width{width:65.52%;box-sizing:border-box}.sp-single-width{width:32.23%;box-sizing:border-box}@media(max-width:1759px){.sp-floating-block{margin-right:1.3% !important}.sp-double-width,.sp-full-width{width:98.65%}.sp-single-width{width:48.7%}}@media(max-width:1249px){.sp-floating-block{margin-right:2% !important}.sp-double-width,.sp-full-width,.sp-single-width{width:97%}}.sp-tabs h2:before{content:none}.sp-column-actions-template+.sp-column-info{display:none}
res/css/shortpixel-notices.css CHANGED
@@ -9,6 +9,34 @@
9
  vertical-align: middle; }
10
  .shortpixel.notice span.icon {
11
  margin: 0 25px 0 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  .shortpixel.notice .sp-conflict-plugins {
14
  display: table;
9
  vertical-align: middle; }
10
  .shortpixel.notice span.icon {
11
  margin: 0 25px 0 0; }
12
+ .shortpixel.notice .details-wrapper {
13
+ margin: 8px 0 4px 0; }
14
+ .shortpixel.notice .details-wrapper .detail-content-wrapper {
15
+ max-height: 0;
16
+ overflow: hidden; }
17
+ .shortpixel.notice .details-wrapper .detail-content-wrapper .detail-content {
18
+ opacity: 0;
19
+ transition: opacity 750ms linear; }
20
+ .shortpixel.notice .details-wrapper label {
21
+ opacity: 100;
22
+ transition: opacity 250ms ease-in; }
23
+ .shortpixel.notice .details-wrapper label span {
24
+ cursor: pointer;
25
+ font-size: 14px;
26
+ color: #0085ba;
27
+ font-weight: 500; }
28
+ .shortpixel.notice .details-wrapper input[name="detailhider"] {
29
+ display: none; }
30
+ .shortpixel.notice .details-wrapper input[name="detailhider"]:checked ~ .detail-content-wrapper {
31
+ max-height: none; }
32
+ .shortpixel.notice .details-wrapper input[name="detailhider"]:checked ~ .detail-content-wrapper .detail-content {
33
+ opacity: 100; }
34
+ .shortpixel.notice .details-wrapper input[name="detailhider"]:checked ~ .show-details {
35
+ opacity: 0;
36
+ transition: opacity 50ms ease-out; }
37
+ .shortpixel.notice .details-wrapper input[name='detailhider']:not(:checked) ~ .hide-details {
38
+ opacity: 0;
39
+ transition: opacity 50ms ease-out; }
40
 
41
  .shortpixel.notice .sp-conflict-plugins {
42
  display: table;
res/js/shortpixel.js CHANGED
@@ -9,7 +9,7 @@ var ShortPixel = function() {
9
 
10
  function init() {
11
 
12
- if (typeof ShortPixel.API_KEY !== 'undefined') return; //was initialized by the 10 sec. setTimeout, rare but who knows, might happen on very slow connections...
13
  //are we on media list?
14
  if( jQuery('table.wp-list-table.media').length > 0) {
15
  //register a bulk action
@@ -1039,12 +1039,12 @@ function checkBulkProcessingCallApi(){
1039
  switch (data["Status"]) {
1040
  case ShortPixel.STATUS_NO_KEY:
1041
  setCellMessage(id, data["Message"], "<a class='button button-smaller button-primary' href=\"https://shortpixel.com/wp-apikey"
1042
- + ShortPixel.AFFILIATE + "\" target=\"_blank\">" + _spTr.getApiKey + "</a>");
1043
  showToolBarAlert(ShortPixel.STATUS_NO_KEY);
1044
  break;
1045
  case ShortPixel.STATUS_QUOTA_EXCEEDED:
1046
  setCellMessage(id, data["Message"], "<a class='button button-smaller button-primary' href=\"https://shortpixel.com/login/"
1047
- + ShortPixel.API_KEY + "\" target=\"_blank\">" + _spTr.extendQuota + "</a>"
1048
  + "<a class='button button-smaller' href='admin.php?action=shortpixel_check_quota'>" + _spTr.check__Quota + "</a>");
1049
  showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED);
1050
  if(data['Stop'] == false) { //there are other items in the priority list, maybe processed, try those
9
 
10
  function init() {
11
 
12
+ if (typeof ShortPixel.API_IS_ACTIVE !== 'undefined') return; //was initialized by the 10 sec. setTimeout, rare but who knows, might happen on very slow connections...
13
  //are we on media list?
14
  if( jQuery('table.wp-list-table.media').length > 0) {
15
  //register a bulk action
1039
  switch (data["Status"]) {
1040
  case ShortPixel.STATUS_NO_KEY:
1041
  setCellMessage(id, data["Message"], "<a class='button button-smaller button-primary' href=\"https://shortpixel.com/wp-apikey"
1042
+ + "\" target=\"_blank\">" + _spTr.getApiKey + "</a>");
1043
  showToolBarAlert(ShortPixel.STATUS_NO_KEY);
1044
  break;
1045
  case ShortPixel.STATUS_QUOTA_EXCEEDED:
1046
  setCellMessage(id, data["Message"], "<a class='button button-smaller button-primary' href=\"https://shortpixel.com/login/"
1047
+ + "\" target=\"_blank\">" + _spTr.extendQuota + "</a>"
1048
  + "<a class='button button-smaller' href='admin.php?action=shortpixel_check_quota'>" + _spTr.check__Quota + "</a>");
1049
  showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED);
1050
  if(data['Stop'] == false) { //there are other items in the priority list, maybe processed, try those
res/js/shortpixel.min.js CHANGED
@@ -1 +1 @@
1
- function showToolBarAlert(e,r,t){var o=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;o.addClass("shortpixel-alert"),o.addClass("shortpixel-quota-exceeded"),jQuery("a",o).attr("href","options-general.php?page=wp-shortpixel-settings"),jQuery("a div",o).attr("title","ShortPixel quota exceeded. Click for details.");break;case ShortPixel.STATUS_SKIP:case ShortPixel.STATUS_FAIL:o.addClass("shortpixel-alert shortpixel-processing"),jQuery("a div",o).attr("title",r),void 0!==t&&jQuery("a",o).attr("href","post.php?post="+t+"&action=edit");break;case ShortPixel.STATUS_NO_KEY:o.addClass("shortpixel-alert"),o.addClass("shortpixel-quota-exceeded"),jQuery("a",o).attr("href","options-general.php?page=wp-shortpixel-settings"),jQuery("a div",o).attr("title","Get API Key");break;case ShortPixel.STATUS_SUCCESS:case ShortPixel.STATUS_RETRY:o.addClass("shortpixel-processing"),o.removeClass("shortpixel-alert"),jQuery("a",o).removeAttr("target"),jQuery("a",o).attr("href",jQuery("a img",o).attr("success-url"))}o.removeClass("shortpixel-hide")}function hideToolBarAlert(e){var r=jQuery("li.shortpixel-toolbar-processing.shortpixel-processing");ShortPixel.STATUS_EMPTY_QUEUE==e&&(r.hasClass("shortpixel-alert")||r.hasClass("shortpixel-quota-exceeded"))||r.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 r?"/":(r=!0,e)},r=!1,t=window.location.href.toLowerCase().replace(/\/\//g,e);r=!1;var o=ShortPixel.WP_ADMIN_URL.toLowerCase().replace(/\/\//g,e);t.search(o)<0&&(t=ShortPixel.convertPunycode(t),o=ShortPixel.convertPunycode(o)),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=Math.floor(Date.now()/1e3),localStorage.bulkPage=1),1==ShortPixel.bulkProcessor||void 0===localStorage.bulkTime||Math.floor(Date.now()/1e3)-localStorage.bulkTime>90?(ShortPixel.bulkProcessor=!0,localStorage.bulkPage=window.location.href.search("wp-short-pixel-bulk")>=0?1:0,localStorage.bulkTime=Math.floor(Date.now()/1e3),console.log(localStorage.bulkTime),checkBulkProcessingCallApi()):setTimeout(checkBulkProgress,5e3)}function checkBulkProcessingCallApi(){jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_image_processing"},success:function(e){if(e.length>0){r=null;try{var r=JSON.parse(e)}catch(e){return void ShortPixel.retry(e.message)}ShortPixel.retries=0;var t=r.ImageID,o=jQuery("div.short-pixel-bulk-page").length>0;switch(r.Status&&r.Status!=ShortPixel.STATUS_SEARCHING&&(ShortPixel.returnedStatusSearching>=2&&jQuery(".bulk-notice-msg.bulk-searching").hide(),ShortPixel.returnedStatusSearching=0),r.Status){case ShortPixel.STATUS_NO_KEY:setCellMessage(t,r.Message,"<a class='button button-smaller button-primary' href=\"https://shortpixel.com/wp-apikey"+ShortPixel.AFFILIATE+'" 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/"+ShortPixel.API_KEY+'" target="_blank">'+_spTr.extendQuota+"</a><a class='button button-smaller' href='admin.php?action=shortpixel_check_quota'>"+_spTr.check__Quota+"</a>"),showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED),0==r.Stop&&setTimeout(checkBulkProgress,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),o&&(ShortPixel.bulkShowError(t,r.Message,r.Filename,r.CustomImageLink),r.BulkPercent&&progressUpdate(r.BulkPercent,r.BulkMsg),ShortPixel.otherMediaUpdateActions(t,["retry","view"])),console.log(r.Message),setTimeout(checkBulkProgress,5e3);break;case ShortPixel.STATUS_EMPTY_QUEUE:console.log(r.Message),clearBulkProcessor(),hideToolBarAlert(r.Status);var s=jQuery("#bulk-progress");o&&s.length&&"2"!=r.BulkStatus&&(progressUpdate(100,"Bulk finished!"),jQuery("a.bulk-cancel").attr("disabled","disabled"),hideSlider(),setTimeout(function(){window.location.reload()},3e3));break;case ShortPixel.STATUS_SUCCESS:o&&(ShortPixel.bulkHideLengthyMsg(),ShortPixel.bulkHideMaintenanceMsg());var i=r.PercentImprovement;showToolBarAlert(ShortPixel.STATUS_SUCCESS,"");var a=ShortPixel.isCustomImageId(t)?"":ShortPixel.successActions(t,r.Type,r.ThumbsCount,r.ThumbsTotal,r.BackupEnabled,r.Filename);if(setCellMessage(t,ShortPixel.successMsg(t,i,r.Type,r.ThumbsCount,r.RetinasCount),a),jQuery("#post-"+t).length>0&&jQuery("#post-"+t).find(".filename").text(r.Filename),jQuery(".misc-pub-filename strong").length>0&&jQuery(".misc-pub-filename strong").text(r.Filename),ShortPixel.isCustomImageId(t)&&r.TsOptimized&&r.TsOptimized.length>0){n=jQuery(".list-overview .item-"+t);jQuery(n).children(".date").text(r.TsOptimized),jQuery(n).find(".row-actions .action-optimize").remove()}var l=jQuery(["restore","view","redolossy","redoglossy","redolossless"]).not(["redo"+r.Type]).get();ShortPixel.otherMediaUpdateActions(t,l);new PercentageAnimator("#sp-msg-"+t+" span.percent",i).animate(i),o&&void 0!==r.Thumb&&(r.BulkPercent&&progressUpdate(r.BulkPercent,r.BulkMsg),r.Thumb.length>0&&(sliderUpdate(t,r.Thumb,r.BkThumb,r.PercentImprovement,r.Filename),void 0!==r.AverageCompression&&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),o&&void 0!==r.BulkPercent&&progressUpdate(r.BulkPercent,r.BulkMsg),setTimeout(checkBulkProgress,5e3);break;case ShortPixel.STATUS_SKIP:1!==r.Silent&&ShortPixel.bulkShowError(t,r.Message,r.Filename,r.CustomImageLink);case ShortPixel.STATUS_ERROR:void 0!==r.Message&&(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,""),o&&void 0!==r.BulkPercent&&progressUpdate(r.BulkPercent,r.BulkMsg),o&&r.Count>3&&ShortPixel.bulkShowLengthyMsg(t,r.Filename,r.CustomImageLink),setTimeout(checkBulkProgress,5e3);break;case ShortPixel.STATUS_SEARCHING:console.log("Server response: "+e),ShortPixel.returnedStatusSearching++,ShortPixel.returnedStatusSearching>=2&&jQuery(".bulk-notice-msg.bulk-searching").show(),setTimeout(checkBulkProgress,2500);break;case ShortPixel.STATUS_MAINTENANCE:ShortPixel.bulkShowMaintenanceMsg("maintenance"),setTimeout(checkBulkProgress,6e4);break;case ShortPixel.STATUS_QUEUE_FULL:ShortPixel.bulkShowMaintenanceMsg("queue-full"),setTimeout(checkBulkProgress,6e4);break;default:ShortPixel.retry("Unknown status "+r.Status+". Retrying...")}if(void 0!==t&&ShortPixel.isCustomImageId(t)){var n=jQuery(".list-overview .item-"+t);jQuery(n).find(".row-actions .action-optimize").remove(),r.actions&&jQuery(n).children(".actions").html(r.actions)}}},error:function(e){ShortPixel.retry(e.statusText)}})}function clearBulkProcessor(){ShortPixel.bulkProcessor=!1,localStorage.bulkTime=0,window.location.href.search("wp-short-pixel-bulk")>=0&&(localStorage.bulkPage=0)}function setCellMessage(e,r,t){var o=jQuery("#sp-msg-"+e);o.length>0&&(o.html("<div class='sp-column-actions'>"+t+"</div><div class='sp-column-info'>"+r+"</div>"),o.css("color","")),(o=jQuery("#sp-cust-msg-"+e)).length>0&&o.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);t.Status==ShortPixel.STATUS_SUCCESS?setTimeout(checkBulkProgress,2e3):setCellMessage(e,void 0!==t.Message?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);t.Status!==ShortPixel.STATUS_SUCCESS&&setCellMessage(e,void 0!==t.Message?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)).Status==ShortPixel.STATUS_SUCCESS?setTimeout(checkBulkProgress,2e3):($msg=void 0!==t.Message?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)).Status==ShortPixel.STATUS_SUCCESS?setTimeout(checkBulkProgress,2e3):setCellMessage(e,void 0!==r.Message?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)).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)).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){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,r){var t=jQuery("#bulk-progress");t.length&&(jQuery(".progress-left",t).css("width",e+"%"),jQuery(".progress-img",t).css("left",e+"%"),e>24?(jQuery(".progress-img span",t).html(""),jQuery(".progress-left",t).html(e+"%")):(jQuery(".progress-img span",t).html(e+"%"),jQuery(".progress-left",t).html("")),jQuery(".bulk-estimate").html(r))}function sliderUpdate(e,r,t,o,s){var i=jQuery(".bulk-slider div.bulk-slide:first-child");if(0!==i.length){"empty-slide"!=i.attr("id")&&i.hide(),i.css("z-index",1e3),jQuery(".bulk-img-opt",i).attr("src",""),void 0===t&&(t=""),t.length>0&&jQuery(".bulk-img-orig",i).attr("src","");var a=i.clone();a.attr("id","slide-"+e),jQuery(".bulk-img-opt",a).attr("src",r),t.length>0?(jQuery(".img-original",a).css("display","inline-block"),jQuery(".bulk-img-orig",a).attr("src",t)):jQuery(".img-original",a).css("display","none"),jQuery(".bulk-opt-percent",a).html('<input type="text" class="dial" value="'+o+'"/>'),jQuery(".bulk-slider").append(a),ShortPixel.percentDial("#"+a.attr("id")+" .dial",100),jQuery(".bulk-slider-container span.filename").html("&nbsp;&nbsp;"+s),"empty-slide"==i.attr("id")?(i.remove(),jQuery(".bulk-slider-container").css("display","block")):i.animate({left:i.width()+i.position().left},"slow","swing",function(){i.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 r=e.shift();for(i=0;i<e.length;i++)r=r.replace(new RegExp("\\{"+i+"\\}","gm"),e[i]);return r}}jQuery(document).ready(function(){ShortPixel.init()});var ShortPixel=function(){function e(e){jQuery(e).is(":checked")?jQuery("#width,#height").removeAttr("disabled"):jQuery("#width,#height").attr("disabled","disabled")}function r(){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_KEY&&(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 r in e)ShortPixel[r]=e[r]},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 r=0;void 0!==document.wp_shortpixel_options&&(r=document.wp_shortpixel_options.compressionType);for(var t=0,o=null;t<r.length;t++)r[t].onclick=function(){this!==o&&(o=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 r=jQuery(e.target);if(ShortPixel.resizeSizesAlert!=r.val()){ShortPixel.resizeSizesAlert=r.val();var t=jQuery("#min-"+r.attr("name")).val(),o=jQuery("#min-"+r.attr("name")).data("nicename");r.val()<Math.min(t,1024)?(t>1024?alert(SPstringFormat(_spTr.pleaseDoNotSetLesser1024,o)):alert(SPstringFormat(_spTr.pleaseDoNotSetLesserSize,o,o,t)),e.preventDefault(),r.focus()):this.defaultValue=r.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");1==confirm(SPstringFormat(_spTr.areYouSureStopOptimizing,e))&&(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 r=jQuery("#"+(e.checked?"total":"main")+"ToProcess").val();jQuery("div.bulk-play span.total").text(r),jQuery("#displayTotal").text(r)},initSettings:function(){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(){"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 r=e.replace("tab-",""),t="",o=jQuery("section#"+e);jQuery('input[name="display_part"]').val(r);var s=window.location.href.toString();if(s.indexOf("?")>0){var i=s.substring(0,s.indexOf("?"));i+="?"+jQuery.param({page:"wp-shortpixel-settings",part:r}),window.history.replaceState({},document.title,i)}if(o.length>0&&(jQuery("section").removeClass("sel-tab"),jQuery("section .wp-shortpixel-tab-content").fadeOut(50),jQuery(o).addClass("sel-tab"),ShortPixel.adjustSettingsTabs(),jQuery(o).find(".wp-shortpixel-tab-content").fadeIn(50)),"undefined"!=typeof HS&&void 0!==HS.beacon.suggest){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}HS.beacon.suggest(t)}},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(r){"success"==(e=JSON.parse(r)).Status&&jQuery("#short-pixel-media-alert").hide()})},closeHelpPane:r,dismissHelpPane:function(){r(),dismissShortPixelNotice("help")},checkQuota:function(){jQuery.get(ShortPixel.AJAX_URL,{action:"shortpixel_check_quota"},function(){console.log("quota refreshed")})},percentDial:function(e,r){jQuery(e).knob({readOnly:!0,width:r,height:r,fgColor:"#1CAECB",format:function(e){return e+"%"}})},successMsg:function(e,r,t,o,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+o>0?"<br>"+SPstringFormat(_spTr.plusXthumbsOpt,o):"")+(0+s>0?"<br>"+SPstringFormat(_spTr.plusXretinasOpt,s):"")+"</div>"},successActions:function(e,r,t,o,s,i){if(1==s){var a=jQuery(".sp-column-actions-template").clone();if(!a.length)return!1;var l;return l=0==r.length?["lossy","lossless"]:["lossy","glossy","lossless"].filter(function(e){return!(e==r)}),a.html(a.html().replace(/__SP_ID__/g,e)),"pdf"==i.substr(i.lastIndexOf(".")+1).toLowerCase()&&jQuery(".sp-action-compare",a).remove(),0==t&&o>0?a.html(a.html().replace("__SP_THUMBS_TOTAL__",o)):(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,r){if(e=e.substring(2),jQuery(".shortpixel-other-media").length){for(var t=["optimize","retry","restore","redo","quota","view"],o=0,s=t.length;o<s;o++)jQuery("#"+t[o]+"_"+e).css("display","none");for(var o=0,s=r.length;o<s;o++)jQuery("#"+r[o]+"_"+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)+"..."),setTimeout(checkBulkProgress,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(r=jQuery("UL.jqueryFileTree LI.directory.selected"),0==jQuery(r).length)var r=jQuery("UL.jqueryFileTree LI.selected").parents(".directory");var t=jQuery(r).children("a").attr("rel");if(void 0!==t)if(t=t.trim()){var o=jQuery("#customFolderBase").val()+t;o=o.replace(/\/\//,"/"),console.debug("FullPath"+o),jQuery("#addCustomFolder").val(o),jQuery("#addCustomFolderView").val(o),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 r="";return jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){r=e},async:!1}),r},getBackupSize:function(){var e="";return jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_get_backup_size"},success:function(r){e=r},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 r={action:"shortpixel_new_api_key",email:jQuery("#pluginemail").val()};jQuery.ajax({type:"POST",async:!1,url:ShortPixel.AJAX_URL,data:r,success:function(r){data=JSON.parse(r),"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.recheckQuota()},bulkShowLengthyMsg:function(e,r,t){var o=jQuery(".bulk-notice-msg.bulk-lengthy");if(0!=o.length){var s=jQuery("a",o);s.text(r),t?s.attr("href",t):s.attr("href",s.data("href").replace("__ID__",e)),o.css("display","block")}},bulkHideLengthyMsg:function(){jQuery(".bulk-notice-msg.bulk-lengthy").css("display","none")},bulkShowMaintenanceMsg:function(e){var r=jQuery(".bulk-notice-msg.bulk-"+e);0!=r.length&&r.css("display","block")},bulkHideMaintenanceMsg:function(e){jQuery(".bulk-notice-msg.bulk-"+e).css("display","none")},bulkShowError:function(e,r,t,o){var s=jQuery("#bulk-error-template");if(0!=s.length){var i=s.clone();i.attr("id","bulk-error-"+e),-1==e?(jQuery("span.sp-err-title",i).remove(),i.addClass("bulk-error-fatal")):(jQuery("img",i).remove(),jQuery("#bulk-error-".id).remove()),jQuery("span.sp-err-content",i).html(r);var a=jQuery("a.sp-post-link",i);o?a.attr("href",o):a.attr("href",a.attr("href").replace("__ID__",e)),a.text(t),s.after(i),i.css("display","block")}},confirmBulkAction:function(e,r){return!!confirm(_spTr["confirmBulk"+e])||(r.stopPropagation(),r.preventDefault(),!1)},checkRandomAnswer:function(e){var r=jQuery(e.target).val(),t=jQuery('input[name="random_answer"]').val(),o=jQuery('input[name="random_answer"]').data("target");r==t?(jQuery(o).removeClass("disabled").prop("disabled",!1),jQuery(o).removeAttr("aria-disabled")):jQuery(o).addClass("disabled").prop("disabled",!0)},removeBulkMsg:function(e){jQuery(e).parent().parent().remove()},isCustomImageId:function(e){return"C-"==e.substring(0,2)},recheckQuota:function(){var e=window.location.href.split("#");window.location.href=e[0]+(e[0].indexOf("?")>0?"&":"?")+"checkquota=1"+(void 0===e[1]?"":"#"+e[1])},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 r=e.target.parentElement.classList.contains("sp-show");jQuery(".sp-dropdown.sp-show").removeClass("sp-show"),r||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,r,t,o){var s=e,i=r<150||e<350,a=jQuery(i?"#spUploadCompareSideBySide":"#spUploadCompare"),l=jQuery(".sp-modal-shade");i||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):r<150?e+25:e)),r=Math.max(150,i?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(),i||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",o)},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 r=document.createElement("a");return r.href=e,e.indexOf(r.protocol+"//"+r.hostname)<0?r.href:e.replace(r.protocol+"//"+r.hostname,r.protocol+"//"+r.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()},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}}();
1
+ function showToolBarAlert(e,r,t){var o=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;o.addClass("shortpixel-alert"),o.addClass("shortpixel-quota-exceeded"),jQuery("a",o).attr("href","options-general.php?page=wp-shortpixel-settings"),jQuery("a div",o).attr("title","ShortPixel quota exceeded. Click for details.");break;case ShortPixel.STATUS_SKIP:case ShortPixel.STATUS_FAIL:o.addClass("shortpixel-alert shortpixel-processing"),jQuery("a div",o).attr("title",r),void 0!==t&&jQuery("a",o).attr("href","post.php?post="+t+"&action=edit");break;case ShortPixel.STATUS_NO_KEY:o.addClass("shortpixel-alert"),o.addClass("shortpixel-quota-exceeded"),jQuery("a",o).attr("href","options-general.php?page=wp-shortpixel-settings"),jQuery("a div",o).attr("title","Get API Key");break;case ShortPixel.STATUS_SUCCESS:case ShortPixel.STATUS_RETRY:o.addClass("shortpixel-processing"),o.removeClass("shortpixel-alert"),jQuery("a",o).removeAttr("target"),jQuery("a",o).attr("href",jQuery("a img",o).attr("success-url"))}o.removeClass("shortpixel-hide")}function hideToolBarAlert(e){var r=jQuery("li.shortpixel-toolbar-processing.shortpixel-processing");ShortPixel.STATUS_EMPTY_QUEUE==e&&(r.hasClass("shortpixel-alert")||r.hasClass("shortpixel-quota-exceeded"))||r.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 r?"/":(r=!0,e)},r=!1,t=window.location.href.toLowerCase().replace(/\/\//g,e);r=!1;var o=ShortPixel.WP_ADMIN_URL.toLowerCase().replace(/\/\//g,e);t.search(o)<0&&(t=ShortPixel.convertPunycode(t),o=ShortPixel.convertPunycode(o)),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=Math.floor(Date.now()/1e3),localStorage.bulkPage=1),1==ShortPixel.bulkProcessor||void 0===localStorage.bulkTime||Math.floor(Date.now()/1e3)-localStorage.bulkTime>90?(ShortPixel.bulkProcessor=!0,localStorage.bulkPage=window.location.href.search("wp-short-pixel-bulk")>=0?1:0,localStorage.bulkTime=Math.floor(Date.now()/1e3),console.log(localStorage.bulkTime),checkBulkProcessingCallApi()):setTimeout(checkBulkProgress,5e3)}function checkBulkProcessingCallApi(){jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_image_processing"},success:function(e){if(e.length>0){r=null;try{var r=JSON.parse(e)}catch(e){return void ShortPixel.retry(e.message)}ShortPixel.retries=0;var t=r.ImageID,o=jQuery("div.short-pixel-bulk-page").length>0;switch(r.Status&&r.Status!=ShortPixel.STATUS_SEARCHING&&(ShortPixel.returnedStatusSearching>=2&&jQuery(".bulk-notice-msg.bulk-searching").hide(),ShortPixel.returnedStatusSearching=0),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='admin.php?action=shortpixel_check_quota'>"+_spTr.check__Quota+"</a>"),showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED),0==r.Stop&&setTimeout(checkBulkProgress,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),o&&(ShortPixel.bulkShowError(t,r.Message,r.Filename,r.CustomImageLink),r.BulkPercent&&progressUpdate(r.BulkPercent,r.BulkMsg),ShortPixel.otherMediaUpdateActions(t,["retry","view"])),console.log(r.Message),setTimeout(checkBulkProgress,5e3);break;case ShortPixel.STATUS_EMPTY_QUEUE:console.log(r.Message),clearBulkProcessor(),hideToolBarAlert(r.Status);var s=jQuery("#bulk-progress");o&&s.length&&"2"!=r.BulkStatus&&(progressUpdate(100,"Bulk finished!"),jQuery("a.bulk-cancel").attr("disabled","disabled"),hideSlider(),setTimeout(function(){window.location.reload()},3e3));break;case ShortPixel.STATUS_SUCCESS:o&&(ShortPixel.bulkHideLengthyMsg(),ShortPixel.bulkHideMaintenanceMsg());var i=r.PercentImprovement;showToolBarAlert(ShortPixel.STATUS_SUCCESS,"");var a=ShortPixel.isCustomImageId(t)?"":ShortPixel.successActions(t,r.Type,r.ThumbsCount,r.ThumbsTotal,r.BackupEnabled,r.Filename);if(setCellMessage(t,ShortPixel.successMsg(t,i,r.Type,r.ThumbsCount,r.RetinasCount),a),jQuery("#post-"+t).length>0&&jQuery("#post-"+t).find(".filename").text(r.Filename),jQuery(".misc-pub-filename strong").length>0&&jQuery(".misc-pub-filename strong").text(r.Filename),ShortPixel.isCustomImageId(t)&&r.TsOptimized&&r.TsOptimized.length>0){n=jQuery(".list-overview .item-"+t);jQuery(n).children(".date").text(r.TsOptimized),jQuery(n).find(".row-actions .action-optimize").remove()}var l=jQuery(["restore","view","redolossy","redoglossy","redolossless"]).not(["redo"+r.Type]).get();ShortPixel.otherMediaUpdateActions(t,l);new PercentageAnimator("#sp-msg-"+t+" span.percent",i).animate(i),o&&void 0!==r.Thumb&&(r.BulkPercent&&progressUpdate(r.BulkPercent,r.BulkMsg),r.Thumb.length>0&&(sliderUpdate(t,r.Thumb,r.BkThumb,r.PercentImprovement,r.Filename),void 0!==r.AverageCompression&&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),o&&void 0!==r.BulkPercent&&progressUpdate(r.BulkPercent,r.BulkMsg),setTimeout(checkBulkProgress,5e3);break;case ShortPixel.STATUS_SKIP:1!==r.Silent&&ShortPixel.bulkShowError(t,r.Message,r.Filename,r.CustomImageLink);case ShortPixel.STATUS_ERROR:void 0!==r.Message&&(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,""),o&&void 0!==r.BulkPercent&&progressUpdate(r.BulkPercent,r.BulkMsg),o&&r.Count>3&&ShortPixel.bulkShowLengthyMsg(t,r.Filename,r.CustomImageLink),setTimeout(checkBulkProgress,5e3);break;case ShortPixel.STATUS_SEARCHING:console.log("Server response: "+e),ShortPixel.returnedStatusSearching++,ShortPixel.returnedStatusSearching>=2&&jQuery(".bulk-notice-msg.bulk-searching").show(),setTimeout(checkBulkProgress,2500);break;case ShortPixel.STATUS_MAINTENANCE:ShortPixel.bulkShowMaintenanceMsg("maintenance"),setTimeout(checkBulkProgress,6e4);break;case ShortPixel.STATUS_QUEUE_FULL:ShortPixel.bulkShowMaintenanceMsg("queue-full"),setTimeout(checkBulkProgress,6e4);break;default:ShortPixel.retry("Unknown status "+r.Status+". Retrying...")}if(void 0!==t&&ShortPixel.isCustomImageId(t)){var n=jQuery(".list-overview .item-"+t);jQuery(n).find(".row-actions .action-optimize").remove(),r.actions&&jQuery(n).children(".actions").html(r.actions)}}},error:function(e){ShortPixel.retry(e.statusText)}})}function clearBulkProcessor(){ShortPixel.bulkProcessor=!1,localStorage.bulkTime=0,window.location.href.search("wp-short-pixel-bulk")>=0&&(localStorage.bulkPage=0)}function setCellMessage(e,r,t){var o=jQuery("#sp-msg-"+e);o.length>0&&(o.html("<div class='sp-column-actions'>"+t+"</div><div class='sp-column-info'>"+r+"</div>"),o.css("color","")),(o=jQuery("#sp-cust-msg-"+e)).length>0&&o.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);t.Status==ShortPixel.STATUS_SUCCESS?setTimeout(checkBulkProgress,2e3):setCellMessage(e,void 0!==t.Message?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);t.Status!==ShortPixel.STATUS_SUCCESS&&setCellMessage(e,void 0!==t.Message?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)).Status==ShortPixel.STATUS_SUCCESS?setTimeout(checkBulkProgress,2e3):($msg=void 0!==t.Message?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)).Status==ShortPixel.STATUS_SUCCESS?setTimeout(checkBulkProgress,2e3):setCellMessage(e,void 0!==r.Message?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)).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)).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){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,r){var t=jQuery("#bulk-progress");t.length&&(jQuery(".progress-left",t).css("width",e+"%"),jQuery(".progress-img",t).css("left",e+"%"),e>24?(jQuery(".progress-img span",t).html(""),jQuery(".progress-left",t).html(e+"%")):(jQuery(".progress-img span",t).html(e+"%"),jQuery(".progress-left",t).html("")),jQuery(".bulk-estimate").html(r))}function sliderUpdate(e,r,t,o,s){var i=jQuery(".bulk-slider div.bulk-slide:first-child");if(0!==i.length){"empty-slide"!=i.attr("id")&&i.hide(),i.css("z-index",1e3),jQuery(".bulk-img-opt",i).attr("src",""),void 0===t&&(t=""),t.length>0&&jQuery(".bulk-img-orig",i).attr("src","");var a=i.clone();a.attr("id","slide-"+e),jQuery(".bulk-img-opt",a).attr("src",r),t.length>0?(jQuery(".img-original",a).css("display","inline-block"),jQuery(".bulk-img-orig",a).attr("src",t)):jQuery(".img-original",a).css("display","none"),jQuery(".bulk-opt-percent",a).html('<input type="text" class="dial" value="'+o+'"/>'),jQuery(".bulk-slider").append(a),ShortPixel.percentDial("#"+a.attr("id")+" .dial",100),jQuery(".bulk-slider-container span.filename").html("&nbsp;&nbsp;"+s),"empty-slide"==i.attr("id")?(i.remove(),jQuery(".bulk-slider-container").css("display","block")):i.animate({left:i.width()+i.position().left},"slow","swing",function(){i.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 r=e.shift();for(i=0;i<e.length;i++)r=r.replace(new RegExp("\\{"+i+"\\}","gm"),e[i]);return r}}jQuery(document).ready(function(){ShortPixel.init()});var ShortPixel=function(){function e(e){jQuery(e).is(":checked")?jQuery("#width,#height").removeAttr("disabled"):jQuery("#width,#height").attr("disabled","disabled")}function r(){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 r in e)ShortPixel[r]=e[r]},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 r=0;void 0!==document.wp_shortpixel_options&&(r=document.wp_shortpixel_options.compressionType);for(var t=0,o=null;t<r.length;t++)r[t].onclick=function(){this!==o&&(o=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 r=jQuery(e.target);if(ShortPixel.resizeSizesAlert!=r.val()){ShortPixel.resizeSizesAlert=r.val();var t=jQuery("#min-"+r.attr("name")).val(),o=jQuery("#min-"+r.attr("name")).data("nicename");r.val()<Math.min(t,1024)?(t>1024?alert(SPstringFormat(_spTr.pleaseDoNotSetLesser1024,o)):alert(SPstringFormat(_spTr.pleaseDoNotSetLesserSize,o,o,t)),e.preventDefault(),r.focus()):this.defaultValue=r.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"),r=jQuery(this).data("name");1==confirm(SPstringFormat(_spTr.areYouSureStopOptimizing,r))&&(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 r=jQuery("#"+(e.checked?"total":"main")+"ToProcess").val();jQuery("div.bulk-play span.total").text(r),jQuery("#displayTotal").text(r)},initSettings:function(){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(){"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 r=e.replace("tab-",""),t="",o=jQuery("section#"+e);jQuery('input[name="display_part"]').val(r);var s=window.location.href.toString();if(s.indexOf("?")>0){var i=s.substring(0,s.indexOf("?"));i+="?"+jQuery.param({page:"wp-shortpixel-settings",part:r}),window.history.replaceState({},document.title,i)}if(o.length>0&&(jQuery("section").removeClass("sel-tab"),jQuery("section .wp-shortpixel-tab-content").fadeOut(50),jQuery(o).addClass("sel-tab"),ShortPixel.adjustSettingsTabs(),jQuery(o).find(".wp-shortpixel-tab-content").fadeIn(50)),"undefined"!=typeof HS&&void 0!==HS.beacon.suggest){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}HS.beacon.suggest(t)}},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(r){"success"==(e=JSON.parse(r)).Status&&jQuery("#short-pixel-media-alert").hide()})},closeHelpPane:r,dismissHelpPane:function(){r(),dismissShortPixelNotice("help")},checkQuota:function(){jQuery.get(ShortPixel.AJAX_URL,{action:"shortpixel_check_quota"},function(){console.log("quota refreshed")})},percentDial:function(e,r){jQuery(e).knob({readOnly:!0,width:r,height:r,fgColor:"#1CAECB",format:function(e){return e+"%"}})},successMsg:function(e,r,t,o,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+o>0?"<br>"+SPstringFormat(_spTr.plusXthumbsOpt,o):"")+(0+s>0?"<br>"+SPstringFormat(_spTr.plusXretinasOpt,s):"")+"</div>"},successActions:function(e,r,t,o,s,i){if(1==s){var a=jQuery(".sp-column-actions-template").clone();if(!a.length)return!1;var l;return l=0==r.length?["lossy","lossless"]:["lossy","glossy","lossless"].filter(function(e){return!(e==r)}),a.html(a.html().replace(/__SP_ID__/g,e)),"pdf"==i.substr(i.lastIndexOf(".")+1).toLowerCase()&&jQuery(".sp-action-compare",a).remove(),0==t&&o>0?a.html(a.html().replace("__SP_THUMBS_TOTAL__",o)):(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,r){if(e=e.substring(2),jQuery(".shortpixel-other-media").length){for(var t=["optimize","retry","restore","redo","quota","view"],o=0,s=t.length;o<s;o++)jQuery("#"+t[o]+"_"+e).css("display","none");for(var o=0,s=r.length;o<s;o++)jQuery("#"+r[o]+"_"+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)+"..."),setTimeout(checkBulkProgress,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(r=jQuery("UL.jqueryFileTree LI.directory.selected"),0==jQuery(r).length)var r=jQuery("UL.jqueryFileTree LI.selected").parents(".directory");var t=jQuery(r).children("a").attr("rel");if(void 0!==t)if(t=t.trim()){var o=jQuery("#customFolderBase").val()+t;o=o.replace(/\/\//,"/"),console.debug("FullPath"+o),jQuery("#addCustomFolder").val(o),jQuery("#addCustomFolderView").val(o),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 r="";return jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:e,success:function(e){r=e},async:!1}),r},getBackupSize:function(){var e="";return jQuery.ajax({type:"POST",url:ShortPixel.AJAX_URL,data:{action:"shortpixel_get_backup_size"},success:function(r){e=r},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 r={action:"shortpixel_new_api_key",email:jQuery("#pluginemail").val()};jQuery.ajax({type:"POST",async:!1,url:ShortPixel.AJAX_URL,data:r,success:function(r){data=JSON.parse(r),"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.recheckQuota()},bulkShowLengthyMsg:function(e,r,t){var o=jQuery(".bulk-notice-msg.bulk-lengthy");if(0!=o.length){var s=jQuery("a",o);s.text(r),t?s.attr("href",t):s.attr("href",s.data("href").replace("__ID__",e)),o.css("display","block")}},bulkHideLengthyMsg:function(){jQuery(".bulk-notice-msg.bulk-lengthy").css("display","none")},bulkShowMaintenanceMsg:function(e){var r=jQuery(".bulk-notice-msg.bulk-"+e);0!=r.length&&r.css("display","block")},bulkHideMaintenanceMsg:function(e){jQuery(".bulk-notice-msg.bulk-"+e).css("display","none")},bulkShowError:function(e,r,t,o){var s=jQuery("#bulk-error-template");if(0!=s.length){var i=s.clone();i.attr("id","bulk-error-"+e),-1==e?(jQuery("span.sp-err-title",i).remove(),i.addClass("bulk-error-fatal")):(jQuery("img",i).remove(),jQuery("#bulk-error-".id).remove()),jQuery("span.sp-err-content",i).html(r);var a=jQuery("a.sp-post-link",i);o?a.attr("href",o):a.attr("href",a.attr("href").replace("__ID__",e)),a.text(t),s.after(i),i.css("display","block")}},confirmBulkAction:function(e,r){return!!confirm(_spTr["confirmBulk"+e])||(r.stopPropagation(),r.preventDefault(),!1)},checkRandomAnswer:function(e){var r=jQuery(e.target).val(),t=jQuery('input[name="random_answer"]').val(),o=jQuery('input[name="random_answer"]').data("target");r==t?(jQuery(o).removeClass("disabled").prop("disabled",!1),jQuery(o).removeAttr("aria-disabled")):jQuery(o).addClass("disabled").prop("disabled",!0)},removeBulkMsg:function(e){jQuery(e).parent().parent().remove()},isCustomImageId:function(e){return"C-"==e.substring(0,2)},recheckQuota:function(){var e=window.location.href.split("#");window.location.href=e[0]+(e[0].indexOf("?")>0?"&":"?")+"checkquota=1"+(void 0===e[1]?"":"#"+e[1])},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 r=e.target.parentElement.classList.contains("sp-show");jQuery(".sp-dropdown.sp-show").removeClass("sp-show"),r||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,r,t,o){var s=e,i=r<150||e<350,a=jQuery(i?"#spUploadCompareSideBySide":"#spUploadCompare"),l=jQuery(".sp-modal-shade");i||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):r<150?e+25:e)),r=Math.max(150,i?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(),i||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",o)},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 r=document.createElement("a");return r.href=e,e.indexOf(r.protocol+"//"+r.hostname)<0?r.href:e.replace(r.protocol+"//"+r.hostname,r.protocol+"//"+r.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()},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}}();
res/scss/shortpixel-notices.scss CHANGED
@@ -23,12 +23,52 @@
23
  margin: 0 25px 0 0;
24
  // display: inline-block;
25
  }
26
- &.content
27
- {
28
- //j display: inline-block;
29
- //max-width: 600px;
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
 
 
 
 
 
 
 
 
 
 
 
32
  }
33
  }
34
 
23
  margin: 0 25px 0 0;
24
  // display: inline-block;
25
  }
26
+ }
27
+ .details-wrapper // open close mechanic.
28
+ {
29
+ margin: 8px 0 4px 0;
30
+ .detail-content-wrapper
31
+ {
32
+ max-height: 0;
33
+ overflow: hidden;
34
+
35
+ .detail-content {
36
+ opacity: 0;
37
+ transition: opacity 750ms linear;
38
+ }
39
+ }
40
+ label
41
+ {
42
+ opacity: 100;
43
+ transition: opacity 250ms ease-in;
44
+ span
45
+ {
46
+ cursor: pointer;
47
+ font-size: 14px;
48
+ color: #0085ba;
49
+ font-weight: 500;
50
+ }
51
+ }
52
+ input[name="detailhider"] { display: none; } // hidden checkbox
53
+ input[name="detailhider"]:checked ~ .detail-content-wrapper
54
+ {
55
+ max-height: none;
56
+ }
57
+ input[name="detailhider"]:checked ~ .detail-content-wrapper .detail-content
58
+ {
59
+ opacity: 100;
60
 
61
+ }
62
+ input[name="detailhider"]:checked ~ .show-details
63
+ {
64
+ opacity: 0;
65
+ transition: opacity 50ms ease-out;
66
+ }
67
+ input[name='detailhider']:not(:checked) ~ .hide-details
68
+ {
69
+ opacity: 0;
70
+ transition: opacity 50ms ease-out;
71
+ }
72
  }
73
  }
74
 
shortpixel-plugin.php CHANGED
@@ -31,7 +31,7 @@ class ShortPixelPlugin
31
  $this->plugin_url = plugin_dir_url(SHORTPIXEL_PLUGIN_FILE);
32
 
33
  $this->initRuntime(); // require controllers, and other needed classes
34
- $this->initHooks();
35
  add_action('plugins_loaded', array($this, 'init'), 5); // early as possible init.
36
  }
37
 
@@ -46,13 +46,17 @@ class ShortPixelPlugin
46
  $this->is_noheaders = true;
47
  }
48
 
 
49
  /* Filter to prevent SPIO from starting. This can be used by third-parties to prevent init when needed for a particular situation.
50
  * Hook into plugins_loaded with priority lower than 5 */
51
  $init = apply_filters('shortpixel/plugin/init', true);
52
 
53
  if (! $init)
 
54
  return;
 
55
 
 
56
 
57
  // @todo Transitionary init for the time being, since plugin init functionality is still split between.
58
  global $shortPixelPluginInstance;
31
  $this->plugin_url = plugin_dir_url(SHORTPIXEL_PLUGIN_FILE);
32
 
33
  $this->initRuntime(); // require controllers, and other needed classes
34
+ //$this->initHooks();
35
  add_action('plugins_loaded', array($this, 'init'), 5); // early as possible init.
36
  }
37
 
46
  $this->is_noheaders = true;
47
  }
48
 
49
+
50
  /* Filter to prevent SPIO from starting. This can be used by third-parties to prevent init when needed for a particular situation.
51
  * Hook into plugins_loaded with priority lower than 5 */
52
  $init = apply_filters('shortpixel/plugin/init', true);
53
 
54
  if (! $init)
55
+ {
56
  return;
57
+ }
58
 
59
+ $this->initHooks();
60
 
61
  // @todo Transitionary init for the time being, since plugin init functionality is still split between.
62
  global $shortPixelPluginInstance;
shortpixel_api.php CHANGED
@@ -274,7 +274,7 @@ class ShortPixelAPI {
274
  $firstImage = $APIresponse[0];//extract as object first image
275
  switch($firstImage->Status->Code)
276
  {
277
- case 2:
278
  //handle image has been processed
279
  if(!isset($firstImage->Status->QuotaExceeded)) {
280
  $this->_settings->quotaExceeded = 0;//reset the quota exceeded flag
@@ -291,6 +291,7 @@ class ShortPixelAPI {
291
  }
292
  elseif ( isset($APIresponse[0]->Status->Message) ) {
293
  //return array("Status" => self::STATUS_FAIL, "Message" => "There was an error and your request was not processed (" . $APIresponse[0]->Status->Message . "). REQ: " . json_encode($URLs));
 
294
  $err = array("Status" => self::STATUS_FAIL, "Code" => (isset($APIresponse[0]->Status->Code) ? $APIresponse[0]->Status->Code : self::ERR_UNKNOWN),
295
  "Message" => __('There was an error and your request was not processed.','shortpixel-image-optimiser')
296
  . " (" . wp_basename($APIresponse[0]->OriginalURL) . ": " . $APIresponse[0]->Status->Message . ")");
274
  $firstImage = $APIresponse[0];//extract as object first image
275
  switch($firstImage->Status->Code)
276
  {
277
+ case 2: //self::STATUS_SUCCESS: <- @todo Success in this constant is 1 ,but appears to be 2? // success
278
  //handle image has been processed
279
  if(!isset($firstImage->Status->QuotaExceeded)) {
280
  $this->_settings->quotaExceeded = 0;//reset the quota exceeded flag
291
  }
292
  elseif ( isset($APIresponse[0]->Status->Message) ) {
293
  //return array("Status" => self::STATUS_FAIL, "Message" => "There was an error and your request was not processed (" . $APIresponse[0]->Status->Message . "). REQ: " . json_encode($URLs));
294
+ Log::addTemp("Failed API REquest", $APIresponse);
295
  $err = array("Status" => self::STATUS_FAIL, "Code" => (isset($APIresponse[0]->Status->Code) ? $APIresponse[0]->Status->Code : self::ERR_UNKNOWN),
296
  "Message" => __('There was an error and your request was not processed.','shortpixel-image-optimiser')
297
  . " (" . wp_basename($APIresponse[0]->OriginalURL) . ": " . $APIresponse[0]->Status->Message . ")");
wp-shortpixel.php CHANGED
@@ -3,12 +3,25 @@
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 &gt; ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
6
- * Version: 4.17.2
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  * Text Domain: shortpixel-image-optimiser
10
  * Domain Path: /lang
11
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  if (! defined('SHORTPIXEL_RESET_ON_ACTIVATE'))
13
  define('SHORTPIXEL_RESET_ON_ACTIVATE', false); //if true TODO set false
14
  //define('SHORTPIXEL_DEBUG', true);
@@ -19,7 +32,7 @@ define('SHORTPIXEL_PLUGIN_DIR', __DIR__);
19
 
20
  //define('SHORTPIXEL_AFFILIATE_CODE', '');
21
 
22
- define('SHORTPIXEL_IMAGE_OPTIMISER_VERSION', "4.17.2");
23
  define('SHORTPIXEL_MAX_TIMEOUT', 10);
24
  define('SHORTPIXEL_VALIDATE_MAX_TIMEOUT', 15);
25
  define('SHORTPIXEL_BACKUP', 'ShortpixelBackups');
@@ -68,8 +81,8 @@ define("SHORTPIXEL_MAX_RESULTS_QUERY", 30);
68
  /* Function to reach core function of ShortPixel
69
  * Use to get plugin url, plugin path, or certain core controllers
70
  */
71
- if (! function_exists('wpSPIO'))
72
- {
73
  function wpSPIO()
74
  {
75
  return \ShortPixel\ShortPixelPlugin::getInstance();
@@ -94,7 +107,7 @@ if (\ShortPixel\ShortPixelLogger\ShortPixelLogger::debugIsActive())
94
  // @todo Better solution for pre-runtime inclusions of externals.
95
  // Should not be required here. wpspio initruntime loads externals
96
 
97
- wpSPIO(); // let's go!
98
 
99
 
100
 
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 &gt; ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
6
+ * Version: 4.17.3
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  * Text Domain: shortpixel-image-optimiser
10
  * Domain Path: /lang
11
  */
12
+
13
+
14
+ // Preventing double load crash.
15
+ if (function_exists('wpSPIO'))
16
+ {
17
+ add_action('admin_notices', function () {
18
+ echo '<div class="error"><h4>';
19
+ printf(__('Shortpixel plugin already loaded. You might have two versions active. Not loaded: %s', 'shortpixel-image-optimiser'), __FILE__);
20
+ echo '</h4></div>';
21
+ });
22
+ return;
23
+ }
24
+
25
  if (! defined('SHORTPIXEL_RESET_ON_ACTIVATE'))
26
  define('SHORTPIXEL_RESET_ON_ACTIVATE', false); //if true TODO set false
27
  //define('SHORTPIXEL_DEBUG', true);
32
 
33
  //define('SHORTPIXEL_AFFILIATE_CODE', '');
34
 
35
+ define('SHORTPIXEL_IMAGE_OPTIMISER_VERSION', "4.17.3");
36
  define('SHORTPIXEL_MAX_TIMEOUT', 10);
37
  define('SHORTPIXEL_VALIDATE_MAX_TIMEOUT', 15);
38
  define('SHORTPIXEL_BACKUP', 'ShortpixelBackups');
81
  /* Function to reach core function of ShortPixel
82
  * Use to get plugin url, plugin path, or certain core controllers
83
  */
84
+
85
+ if (! function_exists("wpSPIO")) {
86
  function wpSPIO()
87
  {
88
  return \ShortPixel\ShortPixelPlugin::getInstance();
107
  // @todo Better solution for pre-runtime inclusions of externals.
108
  // Should not be required here. wpspio initruntime loads externals
109
 
110
+ wpSPIO(); // let's go!
111
 
112
 
113