ShortPixel Image Optimizer - Version 3.1.7

Version Description

  • bugfixes
Download this release

Release Info

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

Code changes from version 3.1.6 to 3.1.7

css/short-pixel.css CHANGED
@@ -31,7 +31,7 @@ li.shortpixel-toolbar-processing.shortpixel-alert > a.ab-item > div,
31
  li.shortpixel-hide {
32
  display:none;
33
  }
34
- .clearfix {
35
  width:100%;
36
  float:left;
37
  }
31
  li.shortpixel-hide {
32
  display:none;
33
  }
34
+ .shortpixel-clearfix {
35
  width:100%;
36
  float:left;
37
  }
js/short-pixel.js CHANGED
@@ -103,7 +103,7 @@ function checkQuotaExceededAlert() {
103
  * calls itself until receives an Empty queue message
104
  */
105
  function checkBulkProgress() {
106
- if(false && window.location.href.search("wp-admin/upload.php") < 0
107
  && window.location.href.search("wp-admin/edit.php") < 0
108
  && window.location.href.search("wp-admin/edit-tags.php") < 0
109
  && window.location.href.search("wp-admin/post-new.php") < 0
103
  * calls itself until receives an Empty queue message
104
  */
105
  function checkBulkProgress() {
106
+ if(window.location.href.search("wp-admin/upload.php") < 0
107
  && window.location.href.search("wp-admin/edit.php") < 0
108
  && window.location.href.search("wp-admin/edit-tags.php") < 0
109
  && window.location.href.search("wp-admin/post-new.php") < 0
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: AlexSP
4
  Tags: picture, optimization, image editor, pngout, upload speed, shortpixel, compression, jpegmini, webp, lossless, cwebp, media, jpegtran, image, image optimisation, image optimization, shrink, picture, photo, optimize photos, compress, performance, tinypng, crunch, pngquant, attachment, optimize, pictures, fast, images, image files, image quality, lossy, upload, kraken, resize, seo, smushit, optipng, kraken image optimizer, ewww, photo optimization, gifsicle, image optimizer, images, krakenio, png, gmagick, image optimize, pdf, pdf optimisation, pdf optimization, optimize pdf, optimise pdf, shrink pdf, jpg, jpeg, jpg optimisation, jpg optimization, optimize jpg, optimise jpg, shrink jpg, gif, animated gif, optimize gif, optimise gif, optimizer, optimiser, compresion, optimization, cruncher, image cruncher, compress png, compress jpg, compress jpeg, compress pdf, faster loading times, image optimiser, improve pagerank, optimise, optimize animated gif, optimise jpeg, optimize jpeg, optimize png, optimise png, optimise pdf, optimize pdf, tinyjpg, short pixel, shortpixel, woocommerce compatible
5
 
6
  Requires at least: 3.0.1
7
- Tested up to: 4.3
8
- Stable tag: 3.1.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -168,6 +168,10 @@ The ShortPixel team is here to help. <a href="https://shortpixel.com/contact">Co
168
 
169
  == Changelog ==
170
 
 
 
 
 
171
  = 3.1.6 =
172
 
173
  * look and feel improvements
4
  Tags: picture, optimization, image editor, pngout, upload speed, shortpixel, compression, jpegmini, webp, lossless, cwebp, media, jpegtran, image, image optimisation, image optimization, shrink, picture, photo, optimize photos, compress, performance, tinypng, crunch, pngquant, attachment, optimize, pictures, fast, images, image files, image quality, lossy, upload, kraken, resize, seo, smushit, optipng, kraken image optimizer, ewww, photo optimization, gifsicle, image optimizer, images, krakenio, png, gmagick, image optimize, pdf, pdf optimisation, pdf optimization, optimize pdf, optimise pdf, shrink pdf, jpg, jpeg, jpg optimisation, jpg optimization, optimize jpg, optimise jpg, shrink jpg, gif, animated gif, optimize gif, optimise gif, optimizer, optimiser, compresion, optimization, cruncher, image cruncher, compress png, compress jpg, compress jpeg, compress pdf, faster loading times, image optimiser, improve pagerank, optimise, optimize animated gif, optimise jpeg, optimize jpeg, optimize png, optimise png, optimise pdf, optimize pdf, tinyjpg, short pixel, shortpixel, woocommerce compatible
5
 
6
  Requires at least: 3.0.1
7
+ Tested up to: 4.4
8
+ Stable tag: 3.1.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
168
 
169
  == Changelog ==
170
 
171
+ = 3.1.7 =
172
+
173
+ * bugfixes
174
+
175
  = 3.1.6 =
176
 
177
  * look and feel improvements
shortpixel_view.php CHANGED
@@ -118,11 +118,11 @@ class ShortPixelView {
118
  </div>
119
  <?php } ?>
120
  </form>
121
- <div class='clearfix'></div>
122
  <div class="bulk-wide">
123
  <h3 style='font-size: 1.1em; font-weight: bold;'>In order for the optimization to run, you must keep this page open and your computer running. If you close the page for whatever reason, just turn back to it and the bulk process will resume.</h3>
124
  </div>
125
- <div class='clearfix'></div>
126
  <div class="bulk-text-container">
127
  <h3>What are Thumbnails?</h3>
128
  <p>Thumbnails are smaller images generated by your WP theme. Most themes generate between 3 and 6 thumbnails for each Media Library image.</p>
118
  </div>
119
  <?php } ?>
120
  </form>
121
+ <div class='shortpixel-clearfix'></div>
122
  <div class="bulk-wide">
123
  <h3 style='font-size: 1.1em; font-weight: bold;'>In order for the optimization to run, you must keep this page open and your computer running. If you close the page for whatever reason, just turn back to it and the bulk process will resume.</h3>
124
  </div>
125
+ <div class='shortpixel-clearfix'></div>
126
  <div class="bulk-text-container">
127
  <h3>What are Thumbnails?</h3>
128
  <p>Thumbnails are smaller images generated by your WP theme. Most themes generate between 3 and 6 thumbnails for each Media Library image.</p>
wp-shortpixel.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: ShortPixel Image Optimizer
4
  * Plugin URI: https://shortpixel.com/
5
  * Description: ShortPixel optimizes images automatically, while guarding the quality of your images. Check your <a href="options-general.php?page=wp-shortpixel" target="_blank">Settings &gt; ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
6
- * Version: 3.1.6
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  */
@@ -17,11 +17,11 @@ if ( !is_plugin_active( 'wpmandrill/wpmandrill.php' ) && !is_plugin_active( 'wp-
17
  require_once( ABSPATH . 'wp-includes/pluggable.php' );//to avoid conflict with wpmandrill plugin
18
  }
19
 
20
- define('SP_RESET_ON_ACTIVATE', false); //TODO remove
21
 
22
  define('SP_AFFILIATE_CODE', '');
23
 
24
- define('PLUGIN_VERSION', "3.1.6");
25
  define('SP_MAX_TIMEOUT', 10);
26
  define('SP_VALIDATE_MAX_TIMEOUT', 60);
27
  define('SP_BACKUP', 'ShortpixelBackups');
@@ -318,8 +318,9 @@ class WPShortPixel {
318
  $mediaIds = array_reverse($_GET['media']);
319
  foreach( $mediaIds as $ID ) {
320
  $meta = wp_get_attachment_metadata($ID);
321
- if( (!isset($meta['ShortPixel']) || (isset($meta['ShortPixel']['WaitingProcessing']) && $meta['ShortPixel']['WaitingProcessing'] == true))
322
- && (!isset($meta['ShortPixelImprovement']) || $meta['ShortPixelImprovement'] != 'Optimization N/A')) {
 
323
  $this->prioQ->push($ID);
324
  $meta['ShortPixel']['WaitingProcessing'] = true;
325
  wp_update_attachment_metadata($ID, $meta);
@@ -589,38 +590,7 @@ class WPShortPixel {
589
  } else {
590
  $ret = array("Status" => ShortPixelAPI::STATUS_SKIP, "message" => $imageId);
591
  }
592
- //TODO curata functia asta
593
  die(json_encode($ret));
594
-
595
- $urlList[] = wp_get_attachment_url($attachmentID);
596
- $filePath[] = get_attached_file($attachmentID);
597
- $meta = wp_get_attachment_metadata($attachmentID);
598
-
599
- $processThumbnails = get_option('wp-short-process_thumbnails');
600
-
601
- //process all files (including thumbs)
602
- if($processThumbnails && !empty($meta['sizes'])) {
603
- //we generate an array with the URLs that need to be handled
604
- $SubDir = $this->_apiInterface->returnSubDir($meta['file']);
605
- foreach($meta['sizes'] as $thumbnailInfo)
606
- {
607
- $urlList[]= str_replace(ShortPixelAPI::MB_basename($filePath[0]), $thumbnailInfo['file'], $urlList[0]);
608
- $filePath[] = str_replace(ShortPixelAPI::MB_basename($filePath[0]), $thumbnailInfo['file'], $filePath[0]);
609
- }
610
- }
611
-
612
- $result = $this->_apiInterface->processImage($urlList, $filePath, $attachmentID);//request to process all the images
613
-
614
- if ( !is_array($result) )//there was an error, we save it in ShortPixelImprovement data
615
- $this->handleError($attachmentID, $result);
616
-
617
- // store the referring webpage location
618
- $sendback = wp_get_referer();
619
- // sanitize the referring webpage location
620
- $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
621
- // send the user back where they came from
622
- wp_redirect($sendback);
623
- // we are done,
624
  }
625
 
626
  //save error in file's meta data
@@ -658,7 +628,8 @@ class WPShortPixel {
658
  }
659
  }
660
  unset($meta["ShortPixelImprovement"]);
661
- unset($meta['ShortPixel']['WaitingProcessing']);
 
662
  wp_update_attachment_metadata($attachmentID, $meta);
663
 
664
  } catch(Exception $e) {
@@ -1396,7 +1367,7 @@ class WPShortPixel {
1396
  else
1397
  {
1398
  $attachment = unserialize($file->meta_value);
1399
- if(self::isProcessablePath($attachment['file'])){
1400
  if ( isset($attachment['sizes']) )
1401
  $totalFiles += count($attachment['sizes']);
1402
 
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" target="_blank">Settings &gt; ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
6
+ * Version: 3.1.7
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  */
17
  require_once( ABSPATH . 'wp-includes/pluggable.php' );//to avoid conflict with wpmandrill plugin
18
  }
19
 
20
+ define('SP_RESET_ON_ACTIVATE', false); //if true TODO set false
21
 
22
  define('SP_AFFILIATE_CODE', '');
23
 
24
+ define('PLUGIN_VERSION', "3.1.7");
25
  define('SP_MAX_TIMEOUT', 10);
26
  define('SP_VALIDATE_MAX_TIMEOUT', 60);
27
  define('SP_BACKUP', 'ShortpixelBackups');
318
  $mediaIds = array_reverse($_GET['media']);
319
  foreach( $mediaIds as $ID ) {
320
  $meta = wp_get_attachment_metadata($ID);
321
+ if( ( !isset($meta['ShortPixel']) //never touched by ShortPixel
322
+ || (isset($meta['ShortPixel']['WaitingProcessing']) && $meta['ShortPixel']['WaitingProcessing'] == true))
323
+ && (!isset($meta['ShortPixelImprovement']) || $meta['ShortPixelImprovement'] == 'Optimization N/A')) {
324
  $this->prioQ->push($ID);
325
  $meta['ShortPixel']['WaitingProcessing'] = true;
326
  wp_update_attachment_metadata($ID, $meta);
590
  } else {
591
  $ret = array("Status" => ShortPixelAPI::STATUS_SKIP, "message" => $imageId);
592
  }
 
593
  die(json_encode($ret));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
  }
595
 
596
  //save error in file's meta data
628
  }
629
  }
630
  unset($meta["ShortPixelImprovement"]);
631
+ //unset($meta['ShortPixel']['WaitingProcessing']);
632
+ unset($meta['ShortPixel']);
633
  wp_update_attachment_metadata($attachmentID, $meta);
634
 
635
  } catch(Exception $e) {
1367
  else
1368
  {
1369
  $attachment = unserialize($file->meta_value);
1370
+ if(isset($attachment['file']) && self::isProcessablePath($attachment['file'])){
1371
  if ( isset($attachment['sizes']) )
1372
  $totalFiles += count($attachment['sizes']);
1373