Version Description
Release date October 11th, 2021
* Fix: the plugin is now checking for the UPLOADS constant when building the paths on MultiSite installs;
* Fix: in certain specific cases, a fatal error was triggered when the backup couldn't be restored;
* Fix: if the automatic Media Library optimization is disabled, the plugin will also disable the front-end processing option;
* Fix: removed inaccurate statistics from the bulk screen summary until the next major release;
* Language: 0 new string added, 0 updated, 0 fuzzed, and 0 obsoleted.
Download this release
Release Info
| Developer | petredobrescu |
| Plugin | |
| Version | 4.22.6 |
| Comparing to | |
| See all releases | |
Code changes from version 4.22.5 to 4.22.6
- class/Controller/FileSystemController.php +13 -2
- class/Controller/SettingsController.php +6 -0
- class/Model/FileModel.php +4 -3
- class/view/shortpixel_view.php +1 -2
- class/wp-short-pixel.php +3 -2
- readme.txt +10 -2
- shortpixel-plugin.php +6 -5
- wp-shortpixel.php +2 -2
class/Controller/FileSystemController.php
CHANGED
|
@@ -134,6 +134,9 @@ Class FileSystemController extends \ShortPixel\Controller
|
|
| 134 |
else
|
| 135 |
$abspath = $wpContentAbs;
|
| 136 |
|
|
|
|
|
|
|
|
|
|
| 137 |
$abspath = apply_filters('shortpixel/filesystem/abspath', $abspath );
|
| 138 |
|
| 139 |
return $this->getDirectory($abspath);
|
|
@@ -177,8 +180,16 @@ Class FileSystemController extends \ShortPixel\Controller
|
|
| 177 |
if (strpos($url, $wp_home_path) !== false)
|
| 178 |
{
|
| 179 |
// This is SITE URL, for the same reason it should be home_url in FILEMODEL. The difference is when the site is running on a subdirectory
|
| 180 |
-
// ** This is a fix for a real-life issue, do not change if this causes issues, another fix is needed then.
|
| 181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
$url = str_replace($wp_home_path, $home_url, $filepath);
|
| 183 |
}
|
| 184 |
|
| 134 |
else
|
| 135 |
$abspath = $wpContentAbs;
|
| 136 |
|
| 137 |
+
if (defined('UPLOADS')) // if this is set, lead.
|
| 138 |
+
$abspath = trailingslashit(ABSPATH) . UPLOADS;
|
| 139 |
+
|
| 140 |
$abspath = apply_filters('shortpixel/filesystem/abspath', $abspath );
|
| 141 |
|
| 142 |
return $this->getDirectory($abspath);
|
| 180 |
if (strpos($url, $wp_home_path) !== false)
|
| 181 |
{
|
| 182 |
// This is SITE URL, for the same reason it should be home_url in FILEMODEL. The difference is when the site is running on a subdirectory
|
| 183 |
+
// (1) ** This is a fix for a real-life issue, do not change if this causes issues, another fix is needed then.
|
| 184 |
+
// (2) ** Also a real life fix when a path is /wwwroot/assets/sites/2/ etc, in get site url, the home URL is the site URL, without appending the sites stuff. Fails on original image.
|
| 185 |
+
if ($this->env->is_multisite && ! $this->env->is_mainsite)
|
| 186 |
+
{
|
| 187 |
+
$wp_home_path = wp_normalize_path(trailingslashit($uploads['basedir']));
|
| 188 |
+
$home_url = trailingslashit($uploads['baseurl']);
|
| 189 |
+
}
|
| 190 |
+
else
|
| 191 |
+
$home_url = trailingslashit(get_site_url()); // (1)
|
| 192 |
+
|
| 193 |
$url = str_replace($wp_home_path, $home_url, $filepath);
|
| 194 |
}
|
| 195 |
|
class/Controller/SettingsController.php
CHANGED
|
@@ -473,6 +473,12 @@ class SettingsController extends \ShortPixel\Controller
|
|
| 473 |
|
| 474 |
parent::processPostData($post);
|
| 475 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 476 |
}
|
| 477 |
|
| 478 |
/** Function for the WebP settings overload
|
| 473 |
|
| 474 |
parent::processPostData($post);
|
| 475 |
|
| 476 |
+
// Unset front optimization when automedialib. is off
|
| 477 |
+
if ($this->postData['autoMediaLibrary'] == 0)
|
| 478 |
+
{
|
| 479 |
+
$this->postData['frontBootstrap'] = 0;
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
}
|
| 483 |
|
| 484 |
/** Function for the WebP settings overload
|
class/Model/FileModel.php
CHANGED
|
@@ -313,9 +313,10 @@ class FileModel extends \ShortPixel\Model
|
|
| 313 |
|
| 314 |
if (is_null($this->backupDirectory))
|
| 315 |
{
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
|
|
|
| 319 |
|
| 320 |
if (! $directory->exists()) // check if exists. FileModel should not attempt to create.
|
| 321 |
{
|
| 313 |
|
| 314 |
if (is_null($this->backupDirectory))
|
| 315 |
{
|
| 316 |
+
//$backup_dir = str_replace($fs->getWPAbsPath(), "", $this->directory->getPath());
|
| 317 |
+
//$backupDirectory = SHORTPIXEL_BACKUP_FOLDER . '/' . $backup_dir;
|
| 318 |
+
//$directory = new DirectoryModel($backupDirectory);
|
| 319 |
+
$directory = $fs->getBackupDirectory($this);
|
| 320 |
|
| 321 |
if (! $directory->exists()) // check if exists. FileModel should not attempt to create.
|
| 322 |
{
|
class/view/shortpixel_view.php
CHANGED
|
@@ -684,8 +684,7 @@ class ShortPixelView {
|
|
| 684 |
<div class="label"><?php _e('Processed Thumbnails:','shortpixel-image-optimiser');?></div><div class="stat-value"><?php echo(number_format($totalOptimized - $mainOptimized));?></div><br>
|
| 685 |
<div class="label totals"><?php _e('Total files processed:','shortpixel-image-optimiser');?></div><div class="stat-value"><?php echo(number_format($totalOptimized));?></div><br>
|
| 686 |
<div class="label totals"><?php _e('Minus files with <5% optimization (free):','shortpixel-image-optimiser');?></div><div class="stat-value"><?php echo(number_format($under5PercentCount));?></div><br><br>
|
| 687 |
-
|
| 688 |
-
<br>
|
| 689 |
<div class="label"><?php _e('Average optimization:','shortpixel-image-optimiser');?></div><div class="stat-value"><?php echo($averageCompression);?>%</div><br>
|
| 690 |
<div class="label"><?php _e('Saved space:','shortpixel-image-optimiser');?></div><div class="stat-value"><?php echo($savedSpace);?></div>
|
| 691 |
</div>
|
| 684 |
<div class="label"><?php _e('Processed Thumbnails:','shortpixel-image-optimiser');?></div><div class="stat-value"><?php echo(number_format($totalOptimized - $mainOptimized));?></div><br>
|
| 685 |
<div class="label totals"><?php _e('Total files processed:','shortpixel-image-optimiser');?></div><div class="stat-value"><?php echo(number_format($totalOptimized));?></div><br>
|
| 686 |
<div class="label totals"><?php _e('Minus files with <5% optimization (free):','shortpixel-image-optimiser');?></div><div class="stat-value"><?php echo(number_format($under5PercentCount));?></div><br><br>
|
| 687 |
+
|
|
|
|
| 688 |
<div class="label"><?php _e('Average optimization:','shortpixel-image-optimiser');?></div><div class="stat-value"><?php echo($averageCompression);?>%</div><br>
|
| 689 |
<div class="label"><?php _e('Saved space:','shortpixel-image-optimiser');?></div><div class="stat-value"><?php echo($savedSpace);?></div>
|
| 690 |
</div>
|
class/wp-short-pixel.php
CHANGED
|
@@ -2105,9 +2105,10 @@ class WPShortPixel {
|
|
| 2105 |
{
|
| 2106 |
$bkOrigFile = $origFile->getBackUpFile();
|
| 2107 |
if ($bkOrigFile && $bkOrigFile->exists())
|
| 2108 |
-
|
| 2109 |
|
| 2110 |
-
|
|
|
|
| 2111 |
}
|
| 2112 |
//$this->renameWithRetina($bkFile, $file);
|
| 2113 |
if (! $bkFile->move($fsFile))
|
| 2105 |
{
|
| 2106 |
$bkOrigFile = $origFile->getBackUpFile();
|
| 2107 |
if ($bkOrigFile && $bkOrigFile->exists())
|
| 2108 |
+
{ $bkOrigFile->move($origFile);
|
| 2109 |
|
| 2110 |
+
Log::addDebug('Restore result - Backup original file', array($bkOrigFile->getFullPath(), $origFile->getFullPath() ));
|
| 2111 |
+
}
|
| 2112 |
}
|
| 2113 |
//$this->renameWithRetina($bkFile, $file);
|
| 2114 |
if (! $bkFile->move($fsFile))
|
readme.txt
CHANGED
|
@@ -4,11 +4,11 @@ Tags: convert webp, optimize images, image optimization, resize, compressor, ima
|
|
| 4 |
Requires at least: 4.2.0
|
| 5 |
Tested up to: 5.8
|
| 6 |
Requires PHP: 5.6
|
| 7 |
-
Stable tag: 4.22.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 11 |
-
Speed up your website & boost your SEO by compressing old & new images and PDFs.
|
| 12 |
|
| 13 |
== Description ==
|
| 14 |
|
|
@@ -314,6 +314,14 @@ Alternatively, you can use this filter in your theme's functions.php file:
|
|
| 314 |
|
| 315 |
== Changelog ==
|
| 316 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
= 4.22.5 =
|
| 318 |
Release date August 31st, 2021
|
| 319 |
* Fix: in some cases, the MIME type of other files than images were wrongly set to `image/jpg`;
|
| 4 |
Requires at least: 4.2.0
|
| 5 |
Tested up to: 5.8
|
| 6 |
Requires PHP: 5.6
|
| 7 |
+
Stable tag: 4.22.6
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 11 |
+
Speed up your website & boost your SEO by compressing old & new images and PDFs. Optimize and convert WebP & AVIF.
|
| 12 |
|
| 13 |
== Description ==
|
| 14 |
|
| 314 |
|
| 315 |
== Changelog ==
|
| 316 |
|
| 317 |
+
= 4.22.6 =
|
| 318 |
+
Release date October 11th, 2021
|
| 319 |
+
* Fix: the plugin is now checking for the `UPLOADS` constant when building the paths on MultiSite installs;
|
| 320 |
+
* Fix: in certain specific cases, a fatal error was triggered when the backup couldn't be restored;
|
| 321 |
+
* Fix: if the automatic Media Library optimization is disabled, the plugin will also disable the front-end processing option;
|
| 322 |
+
* Fix: removed inaccurate statistics from the bulk screen summary until the next major release;
|
| 323 |
+
* Language: 0 new string added, 0 updated, 0 fuzzed, and 0 obsoleted.
|
| 324 |
+
|
| 325 |
= 4.22.5 =
|
| 326 |
Release date August 31st, 2021
|
| 327 |
* Fix: in some cases, the MIME type of other files than images were wrongly set to `image/jpg`;
|
shortpixel-plugin.php
CHANGED
|
@@ -152,12 +152,13 @@ class ShortPixelPlugin
|
|
| 152 |
add_filter( 'mpp_generate_metadata', array($admin,'handleImageUploadHook'), 10, 2 );
|
| 153 |
}
|
| 154 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
}
|
| 156 |
-
|
| 157 |
-
{
|
| 158 |
-
// if automedialibrary is off, but we do want to auto-optimize on the front, still load the hook.
|
| 159 |
-
add_filter( 'wp_generate_attachment_metadata', array($admin,'handleImageUploadHook'), 10, 2 );
|
| 160 |
-
}
|
| 161 |
|
| 162 |
// *** AJAX HOOKS @todo These must be moved from wp-short-pixel in future */
|
| 163 |
add_action('wp_ajax_shortpixel_helpscoutOptin', array(\wpSPIO()->settings(), 'ajax_helpscoutOptin'));
|
| 152 |
add_filter( 'mpp_generate_metadata', array($admin,'handleImageUploadHook'), 10, 2 );
|
| 153 |
}
|
| 154 |
}
|
| 155 |
+
if($this->settings()->frontBootstrap && $this->env()->is_front)
|
| 156 |
+
{
|
| 157 |
+
// We want this only to work when the automedialibrary setting is on.
|
| 158 |
+
add_filter( 'wp_generate_attachment_metadata', array($admin,'handleImageUploadHook'), 10, 2 );
|
| 159 |
+
}
|
| 160 |
}
|
| 161 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
// *** AJAX HOOKS @todo These must be moved from wp-short-pixel in future */
|
| 164 |
add_action('wp_ajax_shortpixel_helpscoutOptin', array(\wpSPIO()->settings(), 'ajax_helpscoutOptin'));
|
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-settings" target="_blank">Settings > ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
|
| 6 |
-
* Version: 4.22.
|
| 7 |
* Author: ShortPixel
|
| 8 |
* Author URI: https://shortpixel.com
|
| 9 |
* GitHub Plugin URI: https://github.com/short-pixel-optimizer/shortpixel-image-optimiser
|
|
@@ -33,7 +33,7 @@ define('SHORTPIXEL_PLUGIN_DIR', __DIR__);
|
|
| 33 |
|
| 34 |
//define('SHORTPIXEL_AFFILIATE_CODE', '');
|
| 35 |
|
| 36 |
-
define('SHORTPIXEL_IMAGE_OPTIMISER_VERSION', "4.22.
|
| 37 |
define('SHORTPIXEL_MAX_TIMEOUT', 10);
|
| 38 |
define('SHORTPIXEL_VALIDATE_MAX_TIMEOUT', 15);
|
| 39 |
define('SHORTPIXEL_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-settings" target="_blank">Settings > ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
|
| 6 |
+
* Version: 4.22.6
|
| 7 |
* Author: ShortPixel
|
| 8 |
* Author URI: https://shortpixel.com
|
| 9 |
* GitHub Plugin URI: https://github.com/short-pixel-optimizer/shortpixel-image-optimiser
|
| 33 |
|
| 34 |
//define('SHORTPIXEL_AFFILIATE_CODE', '');
|
| 35 |
|
| 36 |
+
define('SHORTPIXEL_IMAGE_OPTIMISER_VERSION', "4.22.6");
|
| 37 |
define('SHORTPIXEL_MAX_TIMEOUT', 10);
|
| 38 |
define('SHORTPIXEL_VALIDATE_MAX_TIMEOUT', 15);
|
| 39 |
define('SHORTPIXEL_BACKUP', 'ShortpixelBackups');
|
