ShortPixel Image Optimizer - Version 2.1.4

Version Description

  • fixed global variable issue for some variables
  • fixed API Key validation that occured for some of the hosting providers out there when HTTPS was used
Download this release

Release Info

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

Code changes from version 2.1.3 to 2.1.4

Files changed (2) hide show
  1. readme.txt +6 -1
  2. wp-shortpixel.php +10 -6
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: AlexSP
4
  Tags: picture, optimization, image editor, pngout, upload speed, shortpixel, compression, jpegmini, webp, lossless, cwebp, media, tinypng, jpegtran,image, image optimisation, 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
5
  Requires at least: 3.0.0 or higher
6
  Tested up to: 4.1.2
7
- Stable tag: 2.1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -112,6 +112,11 @@ The ShortPixel team is here to help. <a href="https://shortpixel.com/contact">Co
112
 
113
  == Changelog ==
114
 
 
 
 
 
 
115
  = 2.1.3 =
116
 
117
  * when backup wasn't activated the processed files weren't put in the right place
4
  Tags: picture, optimization, image editor, pngout, upload speed, shortpixel, compression, jpegmini, webp, lossless, cwebp, media, tinypng, jpegtran,image, image optimisation, 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
5
  Requires at least: 3.0.0 or higher
6
  Tested up to: 4.1.2
7
+ Stable tag: 2.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
112
 
113
  == Changelog ==
114
 
115
+ = 2.1.4 =
116
+
117
+ * fixed global variable issue for some variables
118
+ * fixed API Key validation that occured for some of the hosting providers out there when HTTPS was used
119
+
120
  = 2.1.3 =
121
 
122
  * when backup wasn't activated the processed files weren't put in the right place
wp-shortpixel.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: ShortPixel Image Optimizer
4
  * Plugin URI: https://shortpixel.com/
5
  * Description: ShortPixel is an image compression tool that helps improve your website performance. The plugin optimizes images automatically using both lossy and lossless compression. Resulting, smaller, images are no different in quality from the original. To install: 1) Click the "Activate" link to the left of this description. 2) <a href="https://shortpixel.com/wp-apikey" target="_blank">Free Sign up</a> for your unique API Key . 3) Check your email for your API key. 4) Use your API key to activate ShortPixel plugin in the 'Plugins' menu in WordPress. 5) Done!
6
- * Version: 2.1.3
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  */
@@ -15,7 +15,7 @@ if ( !is_plugin_active( 'wpmandrill/wpmandrill.php' ) ) {
15
  require_once( ABSPATH . 'wp-includes/pluggable.php' );//to avoid conflict with wpmandrill plugin
16
  }
17
 
18
- define('PLUGIN_VERSION', "2.1.3");
19
  define('SP_DEBUG', false);
20
  define('SP_LOG', false);
21
  define('SP_MAX_TIMEOUT', 10);
@@ -138,6 +138,7 @@ class WPShortPixel {
138
 
139
  public function shortPixelActivatePlugin()//reset some params to avoid troubles for plugins that were activated/deactivated/activated
140
  {
 
141
  $this->getMaxShortPixelId();//fetch data for endQueryID and startQueryID
142
  delete_option('bulkProcessingStatus');
143
  delete_option( 'wp-short-pixel-cancel-pointer');
@@ -278,7 +279,7 @@ class WPShortPixel {
278
  die();
279
  }
280
  //query database for first found entry that needs processing //
281
- global $wpdb;
282
 
283
  //////////////////
284
 
@@ -609,7 +610,7 @@ class WPShortPixel {
609
  }
610
 
611
  public function bulkProcess() {
612
- global $wpdb;
613
  echo '<h1>Bulk Image Optimization by ShortPixel</h1>';
614
 
615
  if(MUST_HAVE_KEY && $this->_verifiedKey == false) {//invalid API Key
@@ -759,7 +760,7 @@ class WPShortPixel {
759
 
760
  public function cancelProcessing(){
761
  //cancel an ongoing bulk processing, it might be needed sometimes
762
- global $wpdb;
763
  $startQueryID = get_option('wp-short-pixel-query-id-start');
764
  add_option( 'wp-short-pixel-cancel-pointer', $startQueryID);//we save this so we can resume bulk processing
765
 
@@ -1050,10 +1051,13 @@ Currently, you have {$imageCount} images in your library. </br>
1050
  );
1051
 
1052
  if($appendUserAgent) {
1053
- $args['body']['useragent'] = "Agnt" . urlencode($_SERVER['HTTP_USER_AGENT']);
1054
  }
1055
 
1056
  $response = wp_remote_post($requestURL, $args);
 
 
 
1057
 
1058
  if(is_wp_error( $response )) {
1059
  $response = wp_remote_get(str_replace('https://', 'http://', $requestURL), $args);
3
  * Plugin Name: ShortPixel Image Optimizer
4
  * Plugin URI: https://shortpixel.com/
5
  * Description: ShortPixel is an image compression tool that helps improve your website performance. The plugin optimizes images automatically using both lossy and lossless compression. Resulting, smaller, images are no different in quality from the original. To install: 1) Click the "Activate" link to the left of this description. 2) <a href="https://shortpixel.com/wp-apikey" target="_blank">Free Sign up</a> for your unique API Key . 3) Check your email for your API key. 4) Use your API key to activate ShortPixel plugin in the 'Plugins' menu in WordPress. 5) Done!
6
+ * Version: 2.1.4
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  */
15
  require_once( ABSPATH . 'wp-includes/pluggable.php' );//to avoid conflict with wpmandrill plugin
16
  }
17
 
18
+ define('PLUGIN_VERSION', "2.1.4");
19
  define('SP_DEBUG', false);
20
  define('SP_LOG', false);
21
  define('SP_MAX_TIMEOUT', 10);
138
 
139
  public function shortPixelActivatePlugin()//reset some params to avoid troubles for plugins that were activated/deactivated/activated
140
  {
141
+ global $startQueryID,$endQueryID;
142
  $this->getMaxShortPixelId();//fetch data for endQueryID and startQueryID
143
  delete_option('bulkProcessingStatus');
144
  delete_option( 'wp-short-pixel-cancel-pointer');
279
  die();
280
  }
281
  //query database for first found entry that needs processing //
282
+ global $wpdb,$startQueryID,$endQueryID;
283
 
284
  //////////////////
285
 
610
  }
611
 
612
  public function bulkProcess() {
613
+ global $wpdb,$startQueryID,$endQueryID;
614
  echo '<h1>Bulk Image Optimization by ShortPixel</h1>';
615
 
616
  if(MUST_HAVE_KEY && $this->_verifiedKey == false) {//invalid API Key
760
 
761
  public function cancelProcessing(){
762
  //cancel an ongoing bulk processing, it might be needed sometimes
763
+ global $wpdb,$startQueryID,$endQueryID;
764
  $startQueryID = get_option('wp-short-pixel-query-id-start');
765
  add_option( 'wp-short-pixel-cancel-pointer', $startQueryID);//we save this so we can resume bulk processing
766
 
1051
  );
1052
 
1053
  if($appendUserAgent) {
1054
+ $args['body']['useragent'] = "Agent" . urlencode($_SERVER['HTTP_USER_AGENT']);
1055
  }
1056
 
1057
  $response = wp_remote_post($requestURL, $args);
1058
+
1059
+ if(is_wp_error( $response )) //some hosting providers won't allow https:// POST connections so we try http:// as well
1060
+ $response = wp_remote_post(str_replace('https://', 'http://', $requestURL), $args);
1061
 
1062
  if(is_wp_error( $response )) {
1063
  $response = wp_remote_get(str_replace('https://', 'http://', $requestURL), $args);