Version Description
Release date March 15th, 2021 * New: added 2 new filters, one for the backup paths and one for the full list of image sizes displayed by the plugin in the Advanced settings; * Fix: png2jpg wouldn't update post_mime_type to image/jpeg when converting; * Fix: replaced Get_home_path in GetBackupDirectory to use our solution; * Fix: unlisted images were not working properly when adding an unlisted image after optimizing other unlisted images; * Fix: double WebP path files (e.g. filename.jpg.webp) will now be removed correctly when the original image is deleted; * Tweak: various updates to the readme file; * Language: 0 new strings added, 0 updated, 0 fuzzed, and 0 obsoleted.
Download this release
Release Info
| Developer | petredobrescu |
| Plugin | |
| Version | 4.21.2 |
| Comparing to | |
| See all releases | |
Code changes from version 4.21.1 to 4.21.2
- class/Model/FileModel.php +3 -1
- class/Model/ImageModel.php +18 -10
- class/db/shortpixel-meta-facade.php +8 -0
- class/db/wp-shortpixel-media-library-adapter.php +2 -2
- class/shortpixel-png2jpg.php +2 -1
- class/view/view-edit-media.php +1 -0
- class/wp-short-pixel.php +9 -98
- readme.txt +17 -1
- shortpixel_api.php +2 -0
- wp-shortpixel.php +2 -2
class/Model/FileModel.php
CHANGED
|
@@ -309,9 +309,11 @@ class FileModel extends \ShortPixel\Model
|
|
| 309 |
Log::addWarn('Could not establish FileDir ' . $this->fullpath);
|
| 310 |
return false;
|
| 311 |
}
|
|
|
|
|
|
|
| 312 |
if (is_null($this->backupDirectory))
|
| 313 |
{
|
| 314 |
-
$backup_dir = str_replace(
|
| 315 |
$backupDirectory = SHORTPIXEL_BACKUP_FOLDER . '/' . $backup_dir;
|
| 316 |
$directory = new DirectoryModel($backupDirectory);
|
| 317 |
|
| 309 |
Log::addWarn('Could not establish FileDir ' . $this->fullpath);
|
| 310 |
return false;
|
| 311 |
}
|
| 312 |
+
$fs = \wpSPIO()->filesystem();
|
| 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 |
|
class/Model/ImageModel.php
CHANGED
|
@@ -210,10 +210,10 @@ class ImageModel extends \ShortPixel\Model
|
|
| 210 |
|
| 211 |
}
|
| 212 |
|
| 213 |
-
|
| 214 |
{
|
| 215 |
-
|
| 216 |
-
$
|
| 217 |
|
| 218 |
// must be media library, setting must be on.
|
| 219 |
if($this->facade->getType() != \ShortPixelMetaFacade::MEDIA_LIBRARY_TYPE
|
|
@@ -222,17 +222,24 @@ class ImageModel extends \ShortPixel\Model
|
|
| 222 |
}
|
| 223 |
|
| 224 |
$this->facade->removeSPFoundMeta(); // remove all found meta. If will be re-added here every time.
|
| 225 |
-
$meta = $this->
|
| 226 |
|
| 227 |
-
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
-
|
| 231 |
-
$
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
// Find Thumbs returns *full file path*
|
| 234 |
-
$foundThumbs = \WpShortPixelMediaLbraryAdapter::findThumbs($
|
| 235 |
|
|
|
|
| 236 |
// no thumbs, then done.
|
| 237 |
if (count($foundThumbs) == 0)
|
| 238 |
{
|
|
@@ -240,10 +247,11 @@ class ImageModel extends \ShortPixel\Model
|
|
| 240 |
}
|
| 241 |
//first identify which thumbs are not in the sizes
|
| 242 |
$sizes = $meta->getThumbs();
|
|
|
|
| 243 |
$mimeType = false;
|
| 244 |
|
| 245 |
$allSizes = array();
|
| 246 |
-
$basepath = $
|
| 247 |
|
| 248 |
foreach($sizes as $size) {
|
| 249 |
// Thumbs should have filename only. This is shortpixel-meta ! Not metadata!
|
| 210 |
|
| 211 |
}
|
| 212 |
|
| 213 |
+
public function addUnlistedThumbs()
|
| 214 |
{
|
| 215 |
+
$settings = \wpSPIO()->settings();
|
| 216 |
+
$fs = \wpSPIO()->filesystem();
|
| 217 |
|
| 218 |
// must be media library, setting must be on.
|
| 219 |
if($this->facade->getType() != \ShortPixelMetaFacade::MEDIA_LIBRARY_TYPE
|
| 222 |
}
|
| 223 |
|
| 224 |
$this->facade->removeSPFoundMeta(); // remove all found meta. If will be re-added here every time.
|
| 225 |
+
$meta = $this->facade->getMeta(true); // Important meta needs RELOADING here. //$itemHandler->getMeta();
|
| 226 |
|
| 227 |
+
//$path = $meta->getPath();
|
| 228 |
+
if ($this->is_scaled)
|
| 229 |
+
$pathFile = $this->original_file;
|
| 230 |
+
else
|
| 231 |
+
$pathFile = $this->file;
|
| 232 |
|
| 233 |
+
Log::addDebug('Finding Thumbs on path' . $pathFile->getFullPath());
|
| 234 |
+
// $thumbs = \WpShortPixelMediaLbraryAdapter::findThumbs($pathFile->getFullPath());
|
| 235 |
+
|
| 236 |
+
/*$fs = \wpSPIO()->filesystem();
|
| 237 |
+
$mainFile = $this->file; */
|
| 238 |
|
| 239 |
// Find Thumbs returns *full file path*
|
| 240 |
+
$foundThumbs = \WpShortPixelMediaLbraryAdapter::findThumbs($pathFile->getFullPath());
|
| 241 |
|
| 242 |
+
//Log::addTemp('Found Thumbs', $foundThumbs);
|
| 243 |
// no thumbs, then done.
|
| 244 |
if (count($foundThumbs) == 0)
|
| 245 |
{
|
| 247 |
}
|
| 248 |
//first identify which thumbs are not in the sizes
|
| 249 |
$sizes = $meta->getThumbs();
|
| 250 |
+
|
| 251 |
$mimeType = false;
|
| 252 |
|
| 253 |
$allSizes = array();
|
| 254 |
+
$basepath = $pathFile->getFileDir()->getPath();
|
| 255 |
|
| 256 |
foreach($sizes as $size) {
|
| 257 |
// Thumbs should have filename only. This is shortpixel-meta ! Not metadata!
|
class/db/shortpixel-meta-facade.php
CHANGED
|
@@ -264,6 +264,7 @@ class ShortPixelMetaFacade {
|
|
| 264 |
/** Checks if there are unlisted files present in system. Save them into sizes
|
| 265 |
* @return int Number 'Unlisted' Items in metadta.
|
| 266 |
*/
|
|
|
|
| 267 |
public function searchUnlistedFiles()
|
| 268 |
{
|
| 269 |
// must be media library, setting must be on.
|
|
@@ -276,6 +277,13 @@ class ShortPixelMetaFacade {
|
|
| 276 |
|
| 277 |
//exit($this->_settings->optimizeUnlisted);
|
| 278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
$meta = $this->getMeta();
|
| 280 |
Log::addDebug('Finding Thumbs on path' . $meta->getPath());
|
| 281 |
$thumbs = WpShortPixelMediaLbraryAdapter::findThumbs($meta->getPath());
|
| 264 |
/** Checks if there are unlisted files present in system. Save them into sizes
|
| 265 |
* @return int Number 'Unlisted' Items in metadta.
|
| 266 |
*/
|
| 267 |
+
|
| 268 |
public function searchUnlistedFiles()
|
| 269 |
{
|
| 270 |
// must be media library, setting must be on.
|
| 277 |
|
| 278 |
//exit($this->_settings->optimizeUnlisted);
|
| 279 |
|
| 280 |
+
$imageObj = new ImageModel();
|
| 281 |
+
$imageObj->setbyPostID($this->ID);
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
return $imageObj->addUnlistedThumbs();
|
| 285 |
+
|
| 286 |
+
|
| 287 |
$meta = $this->getMeta();
|
| 288 |
Log::addDebug('Finding Thumbs on path' . $meta->getPath());
|
| 289 |
$thumbs = WpShortPixelMediaLbraryAdapter::findThumbs($meta->getPath());
|
class/db/wp-shortpixel-media-library-adapter.php
CHANGED
|
@@ -532,8 +532,7 @@ class WpShortPixelMediaLbraryAdapter {
|
|
| 532 |
|
| 533 |
public static function getThumbsToOptimize($data, $filepath)
|
| 534 |
{
|
| 535 |
-
|
| 536 |
-
$settings = new \WPShortPixelSettings();
|
| 537 |
|
| 538 |
$fs = \wpSPIO()->fileSystem();
|
| 539 |
$mainfile = $fs->getFile($filepath);
|
|
@@ -691,6 +690,7 @@ class WpShortPixelMediaLbraryAdapter {
|
|
| 691 |
|
| 692 |
$thumbs = array_merge($thumbs, self::getFilesByPattern($dirPath, $pattern));
|
| 693 |
|
|
|
|
| 694 |
/*$dirIterator = new \DirectoryIterator($dirPath);
|
| 695 |
$regExIterator = new \RegexIterator($dirIterator, $pattern);
|
| 696 |
|
| 532 |
|
| 533 |
public static function getThumbsToOptimize($data, $filepath)
|
| 534 |
{
|
| 535 |
+
$settings = \wpSPIO()->settings();
|
|
|
|
| 536 |
|
| 537 |
$fs = \wpSPIO()->fileSystem();
|
| 538 |
$mainfile = $fs->getFile($filepath);
|
| 690 |
|
| 691 |
$thumbs = array_merge($thumbs, self::getFilesByPattern($dirPath, $pattern));
|
| 692 |
|
| 693 |
+
|
| 694 |
/*$dirIterator = new \DirectoryIterator($dirPath);
|
| 695 |
$regExIterator = new \RegexIterator($dirIterator, $pattern);
|
| 696 |
|
class/shortpixel-png2jpg.php
CHANGED
|
@@ -398,6 +398,7 @@ class ShortPixelPng2Jpg {
|
|
| 398 |
*/
|
| 399 |
protected function updateFileAlsoInWPMLDuplicates($parentID, &$parentMeta, $file){
|
| 400 |
$duplicates = ShortPixelMetaFacade::getWPMLDuplicates($parentID);
|
|
|
|
| 401 |
foreach($duplicates as $ID) {
|
| 402 |
$meta = $parentID == $ID ? $parentMeta : wp_get_attachment_metadata($ID);
|
| 403 |
$meta['file'] = $file;
|
|
@@ -445,7 +446,7 @@ class ShortPixelPng2Jpg {
|
|
| 445 |
'attachments' => array("UPDATE $wpdb->posts SET guid = replace(guid, %s, %s) WHERE post_type = 'attachment'", __('Attachments','shortpixel-image-optimiser') ),
|
| 446 |
'links' => array("UPDATE $wpdb->links SET link_url = replace(link_url, %s, %s)", __('Links','shortpixel-image-optimiser') ),
|
| 447 |
'custom' => array("UPDATE $wpdb->postmeta SET meta_value = replace(meta_value, %s, %s)", __('Custom Fields','shortpixel-image-optimiser') ),
|
| 448 |
-
'guids' => array("UPDATE $wpdb->posts SET guid = replace(guid, %s, %s)", __('GUIDs','shortpixel-image-optimiser') )
|
| 449 |
);
|
| 450 |
if(count($options) == 0) {
|
| 451 |
$options = array_keys($queries);
|
| 398 |
*/
|
| 399 |
protected function updateFileAlsoInWPMLDuplicates($parentID, &$parentMeta, $file){
|
| 400 |
$duplicates = ShortPixelMetaFacade::getWPMLDuplicates($parentID);
|
| 401 |
+
Log::addTemp("Update Duplicates on png2jpg", $duplicates);
|
| 402 |
foreach($duplicates as $ID) {
|
| 403 |
$meta = $parentID == $ID ? $parentMeta : wp_get_attachment_metadata($ID);
|
| 404 |
$meta['file'] = $file;
|
| 446 |
'attachments' => array("UPDATE $wpdb->posts SET guid = replace(guid, %s, %s) WHERE post_type = 'attachment'", __('Attachments','shortpixel-image-optimiser') ),
|
| 447 |
'links' => array("UPDATE $wpdb->links SET link_url = replace(link_url, %s, %s)", __('Links','shortpixel-image-optimiser') ),
|
| 448 |
'custom' => array("UPDATE $wpdb->postmeta SET meta_value = replace(meta_value, %s, %s)", __('Custom Fields','shortpixel-image-optimiser') ),
|
| 449 |
+
'guids' => array("UPDATE $wpdb->posts SET guid = replace(guid, %s, %s), post_mime_type = 'image/jpeg' ", __('GUIDs','shortpixel-image-optimiser') )
|
| 450 |
);
|
| 451 |
if(count($options) == 0) {
|
| 452 |
$options = array_keys($queries);
|
class/view/view-edit-media.php
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
namespace ShortPixel;
|
| 3 |
use ShortPixel\ShortpixelLogger\ShortPixelLogger as Log;
|
| 4 |
|
|
|
|
| 5 |
?>
|
| 6 |
|
| 7 |
<div id='sp-msg-<?php echo($view->id);?>' class='column-wp-shortPixel view-edit-media'>
|
| 2 |
namespace ShortPixel;
|
| 3 |
use ShortPixel\ShortpixelLogger\ShortPixelLogger as Log;
|
| 4 |
|
| 5 |
+
|
| 6 |
?>
|
| 7 |
|
| 8 |
<div id='sp-msg-<?php echo($view->id);?>' class='column-wp-shortPixel view-edit-media'>
|
class/wp-short-pixel.php
CHANGED
|
@@ -1503,105 +1503,7 @@ class WPShortPixel {
|
|
| 1503 |
$result["BulkMsg"] = $this->bulkProgressMessage($deltaBulkPercent, $minutesRemaining);
|
| 1504 |
}
|
| 1505 |
|
| 1506 |
-
/** Check for unlisted thumbsnail settings and checks if this file has unlisted thumbs present.
|
| 1507 |
-
* Will update meta. if any are found.
|
| 1508 |
-
* @param ShortPixelMetaFacade $itemHandler ShortpixelMetaFacade item handler.
|
| 1509 |
-
* @return int Number of additions to the sizes Metadata.
|
| 1510 |
-
* @todo This function should Dis/pear. addUnlistedThumbs is now part of image model, to be called via proper controller.
|
| 1511 |
-
*/
|
| 1512 |
-
private function addUnlistedThumbs($itemHandler)
|
| 1513 |
-
{
|
| 1514 |
-
// must be media library, setting must be on.
|
| 1515 |
-
if($itemHandler->getType() != ShortPixelMetaFacade::MEDIA_LIBRARY_TYPE
|
| 1516 |
-
|| ! $this->_settings->optimizeUnlisted) {
|
| 1517 |
-
return 0;
|
| 1518 |
-
}
|
| 1519 |
-
|
| 1520 |
-
$itemHandler->removeSPFoundMeta(); // remove all found meta. If will be re-added here every time.
|
| 1521 |
-
$meta = $itemHandler->getMeta();
|
| 1522 |
-
|
| 1523 |
-
Log::addDebug('Finding Thumbs on path' . $meta->getPath());
|
| 1524 |
-
//$thumbs = WpShortPixelMediaLbraryAdapter::findThumbs($meta->getPath());
|
| 1525 |
|
| 1526 |
-
$fs = \wpSPIO()->fileSystem();
|
| 1527 |
-
$mainFile = $fs->getFile($meta->getPath());
|
| 1528 |
-
|
| 1529 |
-
// Find Thumbs returns *full file path*
|
| 1530 |
-
$foundThumbs = WpShortPixelMediaLbraryAdapter::findThumbs($mainFile->getFullPath());
|
| 1531 |
-
|
| 1532 |
-
// no thumbs, then done.
|
| 1533 |
-
if (count($foundThumbs) == 0)
|
| 1534 |
-
{
|
| 1535 |
-
return 0;
|
| 1536 |
-
}
|
| 1537 |
-
//first identify which thumbs are not in the sizes
|
| 1538 |
-
$sizes = $meta->getThumbs();
|
| 1539 |
-
$mimeType = false;
|
| 1540 |
-
|
| 1541 |
-
$allSizes = array();
|
| 1542 |
-
$basepath = $mainFile->getFileDir()->getPath();
|
| 1543 |
-
|
| 1544 |
-
foreach($sizes as $size) {
|
| 1545 |
-
// Thumbs should have filename only. This is shortpixel-meta ! Not metadata!
|
| 1546 |
-
// Provided filename can be unexpected (URL, fullpath), so first do check, get filename, then check the full path
|
| 1547 |
-
$sizeFileCheck = $fs->getFile($size['file']);
|
| 1548 |
-
$sizeFilePath = $basepath . $sizeFileCheck->getFileName();
|
| 1549 |
-
$sizeFile = $fs->getFile($sizeFilePath);
|
| 1550 |
-
|
| 1551 |
-
//get the mime-type from one of the thumbs metas
|
| 1552 |
-
if(isset($size['mime-type'])) { //situation from support case #9351 Ramesh Mehay
|
| 1553 |
-
$mimeType = $size['mime-type'];
|
| 1554 |
-
}
|
| 1555 |
-
$allSizes[] = $sizeFile;
|
| 1556 |
-
}
|
| 1557 |
-
|
| 1558 |
-
foreach($foundThumbs as $id => $found) {
|
| 1559 |
-
$foundFile = $fs->getFile($found);
|
| 1560 |
-
|
| 1561 |
-
foreach($allSizes as $sizeFile) {
|
| 1562 |
-
if ($sizeFile->getExtension() !== $foundFile->getExtension())
|
| 1563 |
-
{
|
| 1564 |
-
$foundThumbs[$id] = false;
|
| 1565 |
-
}
|
| 1566 |
-
elseif ($sizeFile->getFileName() === $foundFile->getFileName())
|
| 1567 |
-
{
|
| 1568 |
-
$foundThumbs[$id] = false;
|
| 1569 |
-
}
|
| 1570 |
-
}
|
| 1571 |
-
}
|
| 1572 |
-
// add the unfound ones to the sizes array
|
| 1573 |
-
$ind = 1;
|
| 1574 |
-
$counter = 0;
|
| 1575 |
-
// Assumption:: there is no point in adding to this array since findThumbs should find *all* thumbs that are relevant to this image.
|
| 1576 |
-
/*while (isset($sizes[ShortPixelMeta::FOUND_THUMB_PREFIX . str_pad("".$start, 2, '0', STR_PAD_LEFT)]))
|
| 1577 |
-
{
|
| 1578 |
-
$start++;
|
| 1579 |
-
} */
|
| 1580 |
-
// $start = $ind;
|
| 1581 |
-
|
| 1582 |
-
foreach($foundThumbs as $found) {
|
| 1583 |
-
if($found !== false) {
|
| 1584 |
-
Log::addDebug('Adding File to sizes -> ' . $found);
|
| 1585 |
-
$size = getimagesize($found);
|
| 1586 |
-
Log::addDebug('Add Unlisted, add size' . $found );
|
| 1587 |
-
|
| 1588 |
-
$sizes[ShortPixelMeta::FOUND_THUMB_PREFIX . str_pad("".$ind, 2, '0', STR_PAD_LEFT)]= array( // it's a file that has no corresponding thumb so it's the WEBP for the main file
|
| 1589 |
-
'file' => ShortPixelAPI::MB_basename($found),
|
| 1590 |
-
'width' => $size[0],
|
| 1591 |
-
'height' => $size[1],
|
| 1592 |
-
'mime-type' => $mimeType
|
| 1593 |
-
);
|
| 1594 |
-
$ind++;
|
| 1595 |
-
$counter++;
|
| 1596 |
-
}
|
| 1597 |
-
}
|
| 1598 |
-
if($ind > 1) { // at least one thumbnail added, update
|
| 1599 |
-
$meta->setThumbs($sizes);
|
| 1600 |
-
$itemHandler->updateMeta($meta);
|
| 1601 |
-
}
|
| 1602 |
-
|
| 1603 |
-
return $counter;
|
| 1604 |
-
} // addUnlistedThumbs
|
| 1605 |
|
| 1606 |
private function sendToProcessing($itemHandler, $compressionType = false, $onlyThumbs = false) {
|
| 1607 |
//conversion of PNG 2 JPG for existing images
|
|
@@ -3695,6 +3597,13 @@ Log::addDebug('GetQuotaInformation Result ', $dataArray);
|
|
| 3695 |
$file->delete();
|
| 3696 |
$file = $fs->getFile(substr($path, 0, $pos) . "@2x.webp");
|
| 3697 |
$file->delete();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3698 |
}
|
| 3699 |
//delte also the backups for image and retina correspondent
|
| 3700 |
$fileName = $pathFile->getFileName();
|
|
@@ -3991,6 +3900,8 @@ Log::addDebug('GetQuotaInformation Result ', $dataArray);
|
|
| 3991 |
} elseif(is_array($_wp_additional_image_sizes)) {
|
| 3992 |
$sizes = array_merge($sizes, $_wp_additional_image_sizes);
|
| 3993 |
}
|
|
|
|
|
|
|
| 3994 |
return $sizes;
|
| 3995 |
}
|
| 3996 |
|
| 1503 |
$result["BulkMsg"] = $this->bulkProgressMessage($deltaBulkPercent, $minutesRemaining);
|
| 1504 |
}
|
| 1505 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1506 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1507 |
|
| 1508 |
private function sendToProcessing($itemHandler, $compressionType = false, $onlyThumbs = false) {
|
| 1509 |
//conversion of PNG 2 JPG for existing images
|
| 3597 |
$file->delete();
|
| 3598 |
$file = $fs->getFile(substr($path, 0, $pos) . "@2x.webp");
|
| 3599 |
$file->delete();
|
| 3600 |
+
|
| 3601 |
+
// Check for double extension. Everything is going, so delete if it's not us anyhow.
|
| 3602 |
+
$file = $fs->getFile($path . '.webp');
|
| 3603 |
+
$file->delete();
|
| 3604 |
+
|
| 3605 |
+
$file = $fs->getFile($path . '.@2xwebp');
|
| 3606 |
+
$file->delete();
|
| 3607 |
}
|
| 3608 |
//delte also the backups for image and retina correspondent
|
| 3609 |
$fileName = $pathFile->getFileName();
|
| 3900 |
} elseif(is_array($_wp_additional_image_sizes)) {
|
| 3901 |
$sizes = array_merge($sizes, $_wp_additional_image_sizes);
|
| 3902 |
}
|
| 3903 |
+
|
| 3904 |
+
$sizes = apply_filters('shortpixel/settings/image_sizes', $sizes);
|
| 3905 |
return $sizes;
|
| 3906 |
}
|
| 3907 |
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Tags: convert webp, optimize images, image optimization, resize, compressor, ima
|
|
| 4 |
Requires at least: 3.2.0
|
| 5 |
Tested up to: 5.7
|
| 6 |
Requires PHP: 5.3
|
| 7 |
-
Stable tag: 4.21.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -257,6 +257,12 @@ filters the URLs that will be sent to optimisation, `$URLs` is a plain array;
|
|
| 257 |
`apply_filters('shortpixel/db/chunk_size', $chunk);`
|
| 258 |
the `$chunk` is the value ShortPixel chooses to use as number of selected records in one query (based on total table size), some hosts work better with a different value;
|
| 259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
In order to define custom thumbnails to be picked up by the optimization you have two options, both comma separated defines:
|
| 261 |
|
| 262 |
`define('SHORTPIXEL_CUSTOM_THUMB_SUFFIXES', '_tl,_tr');`
|
|
@@ -300,6 +306,16 @@ Hide the Cloudflare settings by defining these constants in wp-config.php:
|
|
| 300 |
9. Check other optimized images status - themes or other plugins' images. (Media>Other Media)
|
| 301 |
|
| 302 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
|
| 304 |
= 4.21.1 =
|
| 305 |
|
| 4 |
Requires at least: 3.2.0
|
| 5 |
Tested up to: 5.7
|
| 6 |
Requires PHP: 5.3
|
| 7 |
+
Stable tag: 4.21.2
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 257 |
`apply_filters('shortpixel/db/chunk_size', $chunk);`
|
| 258 |
the `$chunk` is the value ShortPixel chooses to use as number of selected records in one query (based on total table size), some hosts work better with a different value;
|
| 259 |
|
| 260 |
+
`apply_filters('shortpixel/backup/paths', $PATHs, $mainPath);`
|
| 261 |
+
filters the array of paths of the images sent for backup and can be used to exclude certain paths/images/thumbs from being backed up, based on the image path. `$mainPath` is the path of the main image, while `$PATHs` is an array with all files to be backed up (including thumbnails);
|
| 262 |
+
|
| 263 |
+
`apply_filters('shortpixel/settings/image_sizes', $sizes);`
|
| 264 |
+
filters the array (`$sizes`) of image sizes which can be excluded from processing (displayed in the plugin Advanced settings).
|
| 265 |
+
|
| 266 |
In order to define custom thumbnails to be picked up by the optimization you have two options, both comma separated defines:
|
| 267 |
|
| 268 |
`define('SHORTPIXEL_CUSTOM_THUMB_SUFFIXES', '_tl,_tr');`
|
| 306 |
9. Check other optimized images status - themes or other plugins' images. (Media>Other Media)
|
| 307 |
|
| 308 |
== Changelog ==
|
| 309 |
+
= 4.21.2 =
|
| 310 |
+
|
| 311 |
+
Release date March 15th, 2021
|
| 312 |
+
* New: added 2 new filters, one for the backup paths and one for the full list of image sizes displayed by the plugin in the Advanced settings;
|
| 313 |
+
* Fix: png2jpg wouldn't update post_mime_type to image/jpeg when converting;
|
| 314 |
+
* Fix: replaced Get_home_path in GetBackupDirectory to use our solution;
|
| 315 |
+
* Fix: unlisted images were not working properly when adding an unlisted image after optimizing other unlisted images;
|
| 316 |
+
* Fix: double WebP path files (e.g. filename.jpg.webp) will now be removed correctly when the original image is deleted;
|
| 317 |
+
* Tweak: various updates to the readme file;
|
| 318 |
+
* Language: 0 new strings added, 0 updated, 0 fuzzed, and 0 obsoleted.
|
| 319 |
|
| 320 |
= 4.21.1 =
|
| 321 |
|
shortpixel_api.php
CHANGED
|
@@ -470,6 +470,8 @@ class ShortPixelAPI {
|
|
| 470 |
return array("Status" => self::STATUS_SUCCESS);
|
| 471 |
}
|
| 472 |
|
|
|
|
|
|
|
| 473 |
//$fullSubDir = str_replace(wp_normalize_path(get_home_path()), "", wp_normalize_path(dirname($itemHandler->getMeta()->getPath()))) . '/';
|
| 474 |
//$SubDir = ShortPixelMetaFacade::returnSubDir($itemHandler->getMeta()->getPath(), $itemHandler->getType());
|
| 475 |
$fullSubDir = ShortPixelMetaFacade::returnSubDir($mainPath);
|
| 470 |
return array("Status" => self::STATUS_SUCCESS);
|
| 471 |
}
|
| 472 |
|
| 473 |
+
$PATHs = apply_filters('shortpixel/backup/paths', $PATHs, $mainPath);
|
| 474 |
+
|
| 475 |
//$fullSubDir = str_replace(wp_normalize_path(get_home_path()), "", wp_normalize_path(dirname($itemHandler->getMeta()->getPath()))) . '/';
|
| 476 |
//$SubDir = ShortPixelMetaFacade::returnSubDir($itemHandler->getMeta()->getPath(), $itemHandler->getType());
|
| 477 |
$fullSubDir = ShortPixelMetaFacade::returnSubDir($mainPath);
|
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.21.
|
| 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.21.
|
| 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.21.2
|
| 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.21.2");
|
| 37 |
define('SHORTPIXEL_MAX_TIMEOUT', 10);
|
| 38 |
define('SHORTPIXEL_VALIDATE_MAX_TIMEOUT', 15);
|
| 39 |
define('SHORTPIXEL_BACKUP', 'ShortpixelBackups');
|
