ShortPixel Image Optimizer - Version 4.3.1

Version Description

  • hide API Key on single sites option ( define SHORTPIXEL_HIDE_API_KEY true in wp-config.php)
  • fix for PHP installs on Linux that don't have the posix functions available
  • show an alert when the plugin is no longer able to contact our servers (initially was alerting only before key validation)
Download this release

Release Info

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

Code changes from version 4.3.0 to 4.3.1

class/view/shortpixel_view.php CHANGED
@@ -98,6 +98,9 @@ class ShortPixelView {
98
  }
99
  echo("</ul>");
100
  break;
 
 
 
101
  }
102
  ?>
103
  </div>
@@ -695,7 +698,13 @@ class ShortPixelView {
695
  class="regular-text" <?php echo($editApiKey ? "" : 'disabled') ?>>
696
  <?php } elseif(defined("SHORTPIXEL_API_KEY")) {
697
  $canValidate = true;?>
698
- <input name="key" type="text" id="key" disabled="true" placeholder="<?php _e('Multisite API Key','shortpixel-image-optimiser');?>" class="regular-text">
 
 
 
 
 
 
699
  <?php } ?>
700
  <input type="hidden" name="validate" id="valid" value=""/>
701
  <button type="button" id="validate" class="button button-primary" title="<?php _e('Validate the provided API key','shortpixel-image-optimiser');?>"
98
  }
99
  echo("</ul>");
100
  break;
101
+ case 'generic' :
102
+ echo("<p>$extra</p>");
103
+ break;
104
  }
105
  ?>
106
  </div>
698
  class="regular-text" <?php echo($editApiKey ? "" : 'disabled') ?>>
699
  <?php } elseif(defined("SHORTPIXEL_API_KEY")) {
700
  $canValidate = true;?>
701
+ <input name="key" type="text" id="key" disabled="true" placeholder="<?php
702
+ if(defined("SHORTPIXEL_HIDE_API_KEY")) {
703
+ echo("********************");
704
+ } else {
705
+ _e('Multisite API Key','shortpixel-image-optimiser');
706
+ }
707
+ ?>" class="regular-text">
708
  <?php } ?>
709
  <input type="hidden" name="validate" id="valid" value=""/>
710
  <button type="button" id="validate" class="button button-primary" title="<?php _e('Validate the provided API key','shortpixel-image-optimiser');?>"
class/wp-short-pixel.php CHANGED
@@ -1125,7 +1125,7 @@ class WPShortPixel {
1125
  if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
1126
  //on *nix platforms check also the owner
1127
  $owner = fileowner($file);
1128
- if($owner !== false && $owner != posix_getuid()) { //files with changed owner
1129
  return false;
1130
  }
1131
  }
@@ -1381,6 +1381,7 @@ class WPShortPixel {
1381
  $quotaData = $this->getQuotaInformation();
1382
  }
1383
  if ( !$quotaData['APIKeyValid']) {
 
1384
  return $quotaData;
1385
  }
1386
  //$tempus = microtime(true);
@@ -1472,6 +1473,7 @@ class WPShortPixel {
1472
  </div>
1473
  </div> <?php
1474
  }
 
1475
  public function bulkProcess() {
1476
  global $wpdb;
1477
 
@@ -1577,9 +1579,9 @@ class WPShortPixel {
1577
 
1578
  public function getPercent($quotaData) {
1579
  if($this->_settings->processThumbnails) {
1580
- return min(99, round($quotaData["totalProcessedFiles"] *100.0 / $quotaData["totalFiles"]));
1581
  } else {
1582
- return min(99, round($quotaData["mainProcessedFiles"] *100.0 / $quotaData["mainFiles"]));
1583
  }
1584
  }
1585
 
@@ -1919,7 +1921,8 @@ class WPShortPixel {
1919
  }
1920
  }
1921
 
1922
- $showApiKey = is_main_site() || (function_exists("is_multisite") && is_multisite() && !defined("SHORTPIXEL_API_KEY"));
 
1923
  $editApiKey = !defined("SHORTPIXEL_API_KEY") && $showApiKey;
1924
 
1925
  if($this->_settings->verifiedKey) {
@@ -2051,7 +2054,7 @@ class WPShortPixel {
2051
 
2052
  $defaultData = array(
2053
  "APIKeyValid" => false,
2054
- "Message" => __('API Key could not be validated due to a connectivity error.<BR>Your firewall may be blocking us. Please contact your hosting provider and ask them to allow connections from your site to IP 176.9.106.46.<BR> If you still cannot validate your API Key after this, please <a href="https://shortpixel.com/contact" target="_blank">contact us</a> and we will try to help. ','shortpixel-image-optimiser'),
2055
  "APICallsMade" => __('Information unavailable. Please check your API key.','shortpixel-image-optimiser'),
2056
  "APICallsQuota" => __('Information unavailable. Please check your API key.','shortpixel-image-optimiser'),
2057
  "DomainCheck" => 'NOT Accessible');
1125
  if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
1126
  //on *nix platforms check also the owner
1127
  $owner = fileowner($file);
1128
+ if($owner !== false && function_exists('posix_getuid') && $owner != posix_getuid()) { //files with changed owner
1129
  return false;
1130
  }
1131
  }
1381
  $quotaData = $this->getQuotaInformation();
1382
  }
1383
  if ( !$quotaData['APIKeyValid']) {
1384
+ $this->view->displayActivationNotice('generic', $quotaData['Message']);
1385
  return $quotaData;
1386
  }
1387
  //$tempus = microtime(true);
1473
  </div>
1474
  </div> <?php
1475
  }
1476
+
1477
  public function bulkProcess() {
1478
  global $wpdb;
1479
 
1579
 
1580
  public function getPercent($quotaData) {
1581
  if($this->_settings->processThumbnails) {
1582
+ return $quotaData["totalFiles"] ? min(99, round($quotaData["totalProcessedFiles"] *100.0 / $quotaData["totalFiles"])) : 0;
1583
  } else {
1584
+ return $quotaData["mainFiles"] ? min(99, round($quotaData["mainProcessedFiles"] *100.0 / $quotaData["mainFiles"])) : 0;
1585
  }
1586
  }
1587
 
1921
  }
1922
  }
1923
 
1924
+ $showApiKey = ( is_main_site() || (function_exists("is_multisite") && is_multisite() && !defined("SHORTPIXEL_API_KEY"))
1925
+ && !defined("SHORTPIXEL_HIDE_API_KEY"));
1926
  $editApiKey = !defined("SHORTPIXEL_API_KEY") && $showApiKey;
1927
 
1928
  if($this->_settings->verifiedKey) {
2054
 
2055
  $defaultData = array(
2056
  "APIKeyValid" => false,
2057
+ "Message" => __('API Key could not be validated due to a connectivity error.<BR>Your firewall may be blocking us. Please contact your hosting provider and ask them to allow connections from your site to api.shortpixel.com (IP 176.9.106.46).<BR> If you still cannot validate your API Key after this, please <a href="https://shortpixel.com/contact" target="_blank">contact us</a> and we will try to help. ','shortpixel-image-optimiser'),
2058
  "APICallsMade" => __('Information unavailable. Please check your API key.','shortpixel-image-optimiser'),
2059
  "APICallsQuota" => __('Information unavailable. Please check your API key.','shortpixel-image-optimiser'),
2060
  "DomainCheck" => 'NOT Accessible');
readme.txt CHANGED
@@ -1,11 +1,12 @@
1
  === ShortPixel Image Optimizer ===
2
 
3
  Contributors: ShortPixel
4
- Tags: image optimizer, image optimization, compress pdf, compress jpeg, compress png, image compression, wp smush, compress images, optimize images, shrink jpeg, optimize photos, tinypng
 
5
 
6
  Requires at least: 3.2.0
7
  Tested up to: 4.7
8
- Stable tag: 4.3.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -37,7 +38,7 @@ Make an instant <a rel="friend" href="http://shortpixel.com/image-compression-te
37
  * compatible with WP Retina 2x - all **retina images** are automatically compressed. <a rel="friend" href="http://blog.shortpixel.com/how-to-use-optimized-retina-images-on-your-wordpress-site-for-best-user-experience-on-apple-devices/" target="_blank">How to benefit from Retina displays?</a>
38
  * optimize thumbnails as well as featured images
39
  * ability to optimize any image on your site including images in **NextGEN Gallery** and any other image gallery or slider
40
- * featured images can be rescaled before being optimized with 2 different options. No need for additional plugins like Imsanity
41
  * CMYK to RGB conversion
42
  * **24h <a href="https://wordpress.org/support/plugin/shortpixel-image-optimiser/reviews/?filter=5" target="_blank">stellar support</a>** (24/7) directly from developers.
43
  * easily **test lossy/lossless** versions of the images with a single click in your Media Library
@@ -54,6 +55,7 @@ Make an instant <a rel="friend" href="http://shortpixel.com/image-compression-te
54
  * compatible with watermarking plugins
55
  * option to deactivate auto-optimizing images on upload
56
  * images that are optimized less that 5% are bonus
 
57
  * 40 days optimization report with all image details and overall statistics
58
  * **free optimization credits for non-profits**, <a href="https://shortpixel.com/contact" target="_blank">contact us</a> for details
59
 
@@ -80,7 +82,7 @@ Help us spread a the word by recommending ShortPixel to your friends and collect
80
  * Facebook <a href="https://www.facebook.com/ShortPixel" target="_blank">https://www.facebook.com/ShortPixel</a>
81
  * LinkedIn <a href="https://www.linkedin.com/company/shortpixel" target="_blank">https://www.linkedin.com/company/shortpixel</a>
82
 
83
- **Keywords:** picture, optimization, image editor, pngout, upload speed, shortpixel, compression, nextgen, nextgen gallery optimizer, 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, wpml compatible, smush, imsanity, scale, wp smush, compress images, pdf compression, optimize images, shrink jpeg, compressor, faster website, google pagerank, imagify, prizm, optimus, zara, improve page speed, PageSpeed Insights, sitespeed, smaller images, tinyjpeg, wordpress compression, wordPress image tool, reduce image size, bandwidth, pics, keep exif, remove exif, speed up site, speed up website, compress thumbnails, optimize thumbnails
84
 
85
 
86
  == Installation ==
@@ -120,7 +122,7 @@ Let's get ShortPixel plugin running on your WordPress website:
120
 
121
  = Can I restore my images? What happens with the originals? =
122
  If you choose the "Image backup" option in Settings/ShortPixel then the original version of any optimized image or PDF will be saved in the backup folder.
123
- The original image is necessary if you want to restore an image or if you want to convert an image from lossy/glossy to lossless or viceversa.
124
 
125
  = What types of formats can be optimized? =
126
  ShortPixel optimizes JPEG, PNG, GIF and PDF type of files.
@@ -219,6 +221,12 @@ The ShortPixel team is here to help. <a href="https://shortpixel.com/contact">Co
219
 
220
  == Changelog ==
221
 
 
 
 
 
 
 
222
  = 4.3.0 =
223
 
224
  * a new level of optimization intermediate between lossy and lossless: glossy
1
  === ShortPixel Image Optimizer ===
2
 
3
  Contributors: ShortPixel
4
+ Tags: compress, image, compression, optimize, image optimizer, image compression, resize, compress pdf, compress jpg, compress png, image compression
5
+
6
 
7
  Requires at least: 3.2.0
8
  Tested up to: 4.7
9
+ Stable tag: 4.3.1
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
38
  * compatible with WP Retina 2x - all **retina images** are automatically compressed. <a rel="friend" href="http://blog.shortpixel.com/how-to-use-optimized-retina-images-on-your-wordpress-site-for-best-user-experience-on-apple-devices/" target="_blank">How to benefit from Retina displays?</a>
39
  * optimize thumbnails as well as featured images
40
  * ability to optimize any image on your site including images in **NextGEN Gallery** and any other image gallery or slider
41
+ * featured images can be automatically resized before being optimized with 2 different options. No need for additional plugins like Imsanity
42
  * CMYK to RGB conversion
43
  * **24h <a href="https://wordpress.org/support/plugin/shortpixel-image-optimiser/reviews/?filter=5" target="_blank">stellar support</a>** (24/7) directly from developers.
44
  * easily **test lossy/lossless** versions of the images with a single click in your Media Library
55
  * compatible with watermarking plugins
56
  * option to deactivate auto-optimizing images on upload
57
  * images that are optimized less that 5% are bonus
58
+ * WooCommerce compatible
59
  * 40 days optimization report with all image details and overall statistics
60
  * **free optimization credits for non-profits**, <a href="https://shortpixel.com/contact" target="_blank">contact us</a> for details
61
 
82
  * Facebook <a href="https://www.facebook.com/ShortPixel" target="_blank">https://www.facebook.com/ShortPixel</a>
83
  * LinkedIn <a href="https://www.linkedin.com/company/shortpixel" target="_blank">https://www.linkedin.com/company/shortpixel</a>
84
 
85
+ **Keywords:** picture, optimization, image editor, pngout, upload speed, shortpixel, compression, nextgen, nextgen gallery optimizer, 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, 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, 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, tinyjpg, short pixel, woocommerce compatible, wpml compatible, smush, imsanity, scale, wp smush, compress images, pdf compression, optimize images, shrink jpeg, compressor, faster website, google pagerank, imagify, prizm, optimus, zara, improve page speed, PageSpeed Insights, sitespeed, smaller images, tinyjpeg, wordpress compression, wordPress image tool, reduce image size, bandwidth, pics, keep exif, remove exif, speed up site, speed up website, compress thumbnails, optimize thumbnails
86
 
87
 
88
  == Installation ==
122
 
123
  = Can I restore my images? What happens with the originals? =
124
  If you choose the "Image backup" option in Settings/ShortPixel then the original version of any optimized image or PDF will be saved in the backup folder.
125
+ The original image is needed if you want to restore an image or if you want to convert an image from lossy/glossy to lossless or viceversa.
126
 
127
  = What types of formats can be optimized? =
128
  ShortPixel optimizes JPEG, PNG, GIF and PDF type of files.
221
 
222
  == Changelog ==
223
 
224
+ = 4.3.1 =
225
+
226
+ * hide API Key on single sites option ( define SHORTPIXEL_HIDE_API_KEY true in wp-config.php)
227
+ * fix for PHP installs on Linux that don't have the posix functions available
228
+ * show an alert when the plugin is no longer able to contact our servers (initially was alerting only before key validation)
229
+
230
  = 4.3.0 =
231
 
232
  * a new level of optimization intermediate between lossy and lossless: glossy
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: 4.3.0
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  * Text Domain: shortpixel-image-optimiser
@@ -17,7 +17,7 @@ define('SHORTPIXEL_PLUGIN_FILE', __FILE__);
17
 
18
  define('SP_AFFILIATE_CODE', '');
19
 
20
- define('PLUGIN_VERSION', "4.3.0");
21
  define('SP_MAX_TIMEOUT', 10);
22
  define('SP_VALIDATE_MAX_TIMEOUT', 15);
23
  define('SP_BACKUP', 'ShortpixelBackups');
3
  * Plugin Name: ShortPixel Image Optimizer
4
  * Plugin URI: https://shortpixel.com/
5
  * Description: ShortPixel optimizes images automatically, while guarding the quality of your images. Check your <a href="options-general.php?page=wp-shortpixel" target="_blank">Settings &gt; ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
6
+ * Version: 4.3.1
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  * Text Domain: shortpixel-image-optimiser
17
 
18
  define('SP_AFFILIATE_CODE', '');
19
 
20
+ define('PLUGIN_VERSION', "4.3.1");
21
  define('SP_MAX_TIMEOUT', 10);
22
  define('SP_VALIDATE_MAX_TIMEOUT', 15);
23
  define('SP_BACKUP', 'ShortpixelBackups');