ShortPixel Image Optimizer - Version 4.2.5

Version Description

  • fix for PHP7.1 fatal error when encountering corrupt metadata (wp_get_attachment_metadata returning empty string)
Download this release

Release Info

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

Code changes from version 4.2.4 to 4.2.5

class/db/shortpixel-meta-facade.php CHANGED
@@ -37,8 +37,7 @@ class ShortPixelMetaFacade {
37
  if($this->type == self::CUSTOM_TYPE) {
38
  $this->meta = $this->spMetaDao->getMeta($this->ID);
39
  } else {
40
- $rawMeta = wp_get_attachment_metadata($this->ID);
41
- $this->sanitizeMeta($rawMeta);
42
  $this->meta = self::rawMetaToMeta($this->ID, $rawMeta);
43
  $this->rawMeta = $rawMeta;
44
  }
@@ -77,8 +76,9 @@ class ShortPixelMetaFacade {
77
 
78
  function sanitizeMeta($rawMeta){
79
  if(!is_array($rawMeta)) {
80
- $rawMeta = array("previous_meta" => $rawMeta, 'ShortPixel' => array());
81
- }
 
82
  }
83
 
84
  function updateMeta($newMeta = null) {
@@ -94,8 +94,7 @@ class ShortPixelMetaFacade {
94
  elseif($this->type == ShortPixelMetaFacade::MEDIA_LIBRARY_TYPE) {
95
  $duplicates = ShortPixelMetaFacade::getWPMLDuplicates($this->ID);
96
  foreach($duplicates as $_ID) {
97
- $rawMeta = wp_get_attachment_metadata($_ID);
98
- $this->sanitizeMeta($rawMeta);
99
 
100
  $rawMeta['ShortPixel']['type'] = ($this->meta->getCompressionType() == 1 ? "lossy" : "lossless");
101
  $rawMeta['ShortPixel']['exifKept'] = $this->meta->getKeepExif();
37
  if($this->type == self::CUSTOM_TYPE) {
38
  $this->meta = $this->spMetaDao->getMeta($this->ID);
39
  } else {
40
+ $rawMeta = $this->sanitizeMeta(wp_get_attachment_metadata($this->ID));
 
41
  $this->meta = self::rawMetaToMeta($this->ID, $rawMeta);
42
  $this->rawMeta = $rawMeta;
43
  }
76
 
77
  function sanitizeMeta($rawMeta){
78
  if(!is_array($rawMeta)) {
79
+ return array("previous_meta" => $rawMeta, 'ShortPixel' => array());
80
+ }
81
+ return $rawMeta;
82
  }
83
 
84
  function updateMeta($newMeta = null) {
94
  elseif($this->type == ShortPixelMetaFacade::MEDIA_LIBRARY_TYPE) {
95
  $duplicates = ShortPixelMetaFacade::getWPMLDuplicates($this->ID);
96
  foreach($duplicates as $_ID) {
97
+ $rawMeta = $this->sanitizeMeta(wp_get_attachment_metadata($_ID));
 
98
 
99
  $rawMeta['ShortPixel']['type'] = ($this->meta->getCompressionType() == 1 ? "lossy" : "lossless");
100
  $rawMeta['ShortPixel']['exifKept'] = $this->meta->getKeepExif();
class/view/shortpixel_view.php CHANGED
@@ -362,22 +362,24 @@ class ShortPixelView {
362
  }
363
 
364
  public function displayBulkProcessingRunning($percent, $message, $remainingQuota, $averageCompression, $type) {
 
 
365
  ?>
366
  <div class="wrap short-pixel-bulk-page">
367
  <h1><?php _e('Bulk Image Optimization by ShortPixel','shortpixel-image-optimiser');?></h1>
368
  <?php $this->displayBulkProgressBar(true, $percent, $message, $remainingQuota, $averageCompression, $type);?>
369
 
370
  <!-- Partners: SQUIRLY -->
371
- <?php if(false) { ?>
372
- <div class="sp-notice sp-notice-info bulk-progress bulk-progress-partners sp-floating-block sp-full-width">
373
- <div style="float:right"><a href=""><?php _e('Dismiss','shortpixel-image-optimiser');?></a></div>
374
  <a href="https://my.squirrly.co/go120073/squirrly.co/short-pixel-seo" target="_blank">
375
  <img src="<?php echo(plugins_url( 'shortpixel-image-optimiser/res/img/squirrly.png' ));?>" height="50">
376
  <div><?php _e('While you wait for your images to optimize, check out Squirrly, a great plugin for further boosting your SEO.','shortpixel-image-optimiser');?></div>
377
  </a>
378
  </div>
379
  <?php } ?>
380
-
381
  <div class="sp-floating-block notice bulk-notices-parent">
382
  <div class="bulk-notice-container">
383
  <div class="bulk-notice-msg bulk-lengthy">
362
  }
363
 
364
  public function displayBulkProcessingRunning($percent, $message, $remainingQuota, $averageCompression, $type) {
365
+ $settings = $this->ctrl->getSettings();
366
+ $dismissed = $settings->dismissedNotices ? $settings->dismissedNotices : array();
367
  ?>
368
  <div class="wrap short-pixel-bulk-page">
369
  <h1><?php _e('Bulk Image Optimization by ShortPixel','shortpixel-image-optimiser');?></h1>
370
  <?php $this->displayBulkProgressBar(true, $percent, $message, $remainingQuota, $averageCompression, $type);?>
371
 
372
  <!-- Partners: SQUIRLY -->
373
+ <?php if(!isset($dismissed['squirrly'])) { ?>
374
+ <div id="short-pixel-notice-squirrly" class="sp-notice sp-notice-info bulk-progress bulk-progress-partners sp-floating-block sp-full-width">
375
+ <div style="float:right"><a href="javascript:dismissShortPixelNotice('squirrly')"><?php _e('Dismiss','shortpixel-image-optimiser');?></a></div>
376
  <a href="https://my.squirrly.co/go120073/squirrly.co/short-pixel-seo" target="_blank">
377
  <img src="<?php echo(plugins_url( 'shortpixel-image-optimiser/res/img/squirrly.png' ));?>" height="50">
378
  <div><?php _e('While you wait for your images to optimize, check out Squirrly, a great plugin for further boosting your SEO.','shortpixel-image-optimiser');?></div>
379
  </a>
380
  </div>
381
  <?php } ?>
382
+
383
  <div class="sp-floating-block notice bulk-notices-parent">
384
  <div class="bulk-notice-container">
385
  <div class="bulk-notice-msg bulk-lengthy">
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: image optimizer, image optimization, compress pdf, compress jpeg, compress
5
 
6
  Requires at least: 3.2.0
7
  Tested up to: 4.7
8
- Stable tag: 4.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -192,6 +192,10 @@ The ShortPixel team is here to help. <a href="https://shortpixel.com/contact">Co
192
 
193
  == Changelog ==
194
 
 
 
 
 
195
  = 4.2.4 =
196
 
197
  * fix not processing the images in the custom image folders if they had uppercase extensions
5
 
6
  Requires at least: 3.2.0
7
  Tested up to: 4.7
8
+ Stable tag: 4.2.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
192
 
193
  == Changelog ==
194
 
195
+ = 4.2.5 =
196
+
197
+ * fix for PHP7.1 fatal error when encountering corrupt metadata (wp_get_attachment_metadata returning empty string)
198
+
199
  = 4.2.4 =
200
 
201
  * fix not processing the images in the custom image folders if they had uppercase extensions
res/img/squirrly.png ADDED
Binary file
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.2.4
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  * Text Domain: shortpixel-image-optimiser
@@ -14,7 +14,7 @@ define('SP_RESET_ON_ACTIVATE', false); //if true TODO set false
14
 
15
  define('SP_AFFILIATE_CODE', '');
16
 
17
- define('PLUGIN_VERSION', "4.2.4");
18
  define('SP_MAX_TIMEOUT', 10);
19
  define('SP_VALIDATE_MAX_TIMEOUT', 15);
20
  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.2.5
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  * Text Domain: shortpixel-image-optimiser
14
 
15
  define('SP_AFFILIATE_CODE', '');
16
 
17
+ define('PLUGIN_VERSION', "4.2.5");
18
  define('SP_MAX_TIMEOUT', 10);
19
  define('SP_VALIDATE_MAX_TIMEOUT', 15);
20
  define('SP_BACKUP', 'ShortpixelBackups');