Version Description
- Affiliate codes
- Solve conflict with wp-ses plugin
- skip image on _FAIL message
- mixed content warning fix
Download this release
Release Info
Developer | ShortPixel |
Plugin | ShortPixel Image Optimizer |
Version | 3.0.7 |
Comparing to | |
See all releases |
Code changes from version 3.0.6 to 3.0.7
- js/short-pixel.js +4 -3
- readme.txt +10 -3
- shortpixel_queue.php +1 -1
- wp-shortpixel.php +28 -16
js/short-pixel.js
CHANGED
@@ -112,13 +112,13 @@ function checkBulkProcessingCallApi(){
|
|
112 |
+ ShortPixel.API_KEY + ")\">Extend Quota</a>");
|
113 |
showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED);
|
114 |
break;
|
115 |
-
case ShortPixel.STATUS_FAIL:
|
116 |
setCellMessage(id, data["Message"]);
|
117 |
if(isBulkPage) {
|
118 |
showToolBarAlert(ShortPixel.STATUS_FAIL, data["Message"]);
|
119 |
}
|
120 |
console.log(data["Message"]);
|
121 |
-
break
|
122 |
case ShortPixel.STATUS_EMPTY_QUEUE:
|
123 |
console.log(data["Message"]);
|
124 |
clearBulkProcessor(); //nothing to process, leave the role. Next page load will check again
|
@@ -147,6 +147,7 @@ function checkBulkProcessingCallApi(){
|
|
147 |
}
|
148 |
//fall through
|
149 |
case ShortPixel.STATUS_ERROR: //for error and skip also we retry
|
|
|
150 |
case ShortPixel.STATUS_SKIP:
|
151 |
console.log('Server response: ' + response);
|
152 |
setTimeout(checkBulkProgress, 2000);
|
@@ -168,7 +169,7 @@ function setCellMessage(id, message){
|
|
168 |
}
|
169 |
|
170 |
function manualOptimization(id) {
|
171 |
-
setCellMessage(id, "<img src='" + ShortPixel.WP_PLUGIN_URL + "/
|
172 |
jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide");
|
173 |
jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");
|
174 |
var data = { action : 'shortpixel_manual_optimization',
|
112 |
+ ShortPixel.API_KEY + ")\">Extend Quota</a>");
|
113 |
showToolBarAlert(ShortPixel.STATUS_QUOTA_EXCEEDED);
|
114 |
break;
|
115 |
+
/* case ShortPixel.STATUS_FAIL:
|
116 |
setCellMessage(id, data["Message"]);
|
117 |
if(isBulkPage) {
|
118 |
showToolBarAlert(ShortPixel.STATUS_FAIL, data["Message"]);
|
119 |
}
|
120 |
console.log(data["Message"]);
|
121 |
+
break;*/
|
122 |
case ShortPixel.STATUS_EMPTY_QUEUE:
|
123 |
console.log(data["Message"]);
|
124 |
clearBulkProcessor(); //nothing to process, leave the role. Next page load will check again
|
147 |
}
|
148 |
//fall through
|
149 |
case ShortPixel.STATUS_ERROR: //for error and skip also we retry
|
150 |
+
case ShortPixel.STATUS_FAIL:
|
151 |
case ShortPixel.STATUS_SKIP:
|
152 |
console.log('Server response: ' + response);
|
153 |
setTimeout(checkBulkProgress, 2000);
|
169 |
}
|
170 |
|
171 |
function manualOptimization(id) {
|
172 |
+
setCellMessage(id, "<img src='" + ShortPixel.WP_PLUGIN_URL + "/img/loading.gif'>Image waiting to be processed");
|
173 |
jQuery("li.shortpixel-toolbar-processing").removeClass("shortpixel-hide");
|
174 |
jQuery("li.shortpixel-toolbar-processing").addClass("shortpixel-processing");
|
175 |
var data = { action : 'shortpixel_manual_optimization',
|
readme.txt
CHANGED
@@ -4,12 +4,12 @@ Contributors: AlexSP
|
|
4 |
Tags: picture, optimization, image editor, pngout, upload speed, shortpixel, compression, jpegmini, webp, lossless, cwebp, media, 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, optimizer, optimiser, compresion, optimization, cruncher, image cruncher, compress png, compress jpg, compress jpeg, faster loading times, image optimiser, improve pagerank, optimise, optimize animated gif, optimise jpeg, optimize jpeg, optimize png, optimise png, tinyjpg, short pixel, shortpixel
|
5 |
|
6 |
Requires at least: 3.0.1
|
7 |
-
Tested up to: 4.
|
8 |
-
Stable tag: 3.0.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
-
Fast, easy-to-use and lightweight plugin that optimizes images & PDFs. Preserve a high visual quality of images and make your website load faster
|
13 |
|
14 |
== Description ==
|
15 |
|
@@ -119,6 +119,13 @@ The ShortPixel team is here to help. <a href="https://shortpixel.com/contact">Co
|
|
119 |
|
120 |
== Changelog ==
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
= 3.0.6 =
|
123 |
|
124 |
* Optimized bulk processor behaviour when navigating from one admin page to another.
|
4 |
Tags: picture, optimization, image editor, pngout, upload speed, shortpixel, compression, jpegmini, webp, lossless, cwebp, media, 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, optimizer, optimiser, compresion, optimization, cruncher, image cruncher, compress png, compress jpg, compress jpeg, faster loading times, image optimiser, improve pagerank, optimise, optimize animated gif, optimise jpeg, optimize jpeg, optimize png, optimise png, tinyjpg, short pixel, shortpixel
|
5 |
|
6 |
Requires at least: 3.0.1
|
7 |
+
Tested up to: 4.3
|
8 |
+
Stable tag: 3.0.7
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
+
Fast, easy-to-use and lightweight plugin that optimizes images & PDFs. Preserve a high visual quality of images and make your website load faster!
|
13 |
|
14 |
== Description ==
|
15 |
|
119 |
|
120 |
== Changelog ==
|
121 |
|
122 |
+
= 3.0.7 =
|
123 |
+
|
124 |
+
* Affiliate codes
|
125 |
+
* Solve conflict with wp-ses plugin
|
126 |
+
* skip image on _FAIL message
|
127 |
+
* mixed content warning fix
|
128 |
+
|
129 |
= 3.0.6 =
|
130 |
|
131 |
* Optimized bulk processor behaviour when navigating from one admin page to another.
|
shortpixel_queue.php
CHANGED
@@ -262,7 +262,7 @@ class ShortPixelQueue {
|
|
262 |
|
263 |
public function getTimeRemaining (){
|
264 |
$p = $this->getBulkPercent();
|
265 |
-
$pAlready = round($this->bulkAlreadyDoneCount / $this->bulkCount * 100);
|
266 |
// die("" . ($this->lastBulkSuccessTime - $this->lastBulkStartTime));
|
267 |
if(($p - $pAlready) == 0) return 0;
|
268 |
return round(((100 - $p) / ($p - $pAlready)) * ($this->bulkRunningTime + $this->lastBulkSuccessTime - $this->lastBulkStartTime)/60);
|
262 |
|
263 |
public function getTimeRemaining (){
|
264 |
$p = $this->getBulkPercent();
|
265 |
+
$pAlready = $this->bulkCount == 0 ? 0 : round($this->bulkAlreadyDoneCount / $this->bulkCount * 100);
|
266 |
// die("" . ($this->lastBulkSuccessTime - $this->lastBulkStartTime));
|
267 |
if(($p - $pAlready) == 0) return 0;
|
268 |
return round(((100 - $p) / ($p - $pAlready)) * ($this->bulkRunningTime + $this->lastBulkSuccessTime - $this->lastBulkStartTime)/60);
|
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 > ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
|
6 |
-
* Version: 3.0.
|
7 |
* Author: ShortPixel
|
8 |
* Author URI: https://shortpixel.com
|
9 |
*/
|
@@ -13,19 +13,21 @@ require_once('shortpixel_queue.php');
|
|
13 |
require_once('shortpixel_view.php');
|
14 |
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
15 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
16 |
-
if ( !is_plugin_active( 'wpmandrill/wpmandrill.php' ) ) {
|
17 |
require_once( ABSPATH . 'wp-includes/pluggable.php' );//to avoid conflict with wpmandrill plugin
|
18 |
}
|
19 |
|
20 |
define('SP_RESET_ON_ACTIVATE', false);
|
21 |
|
22 |
-
define('
|
|
|
|
|
23 |
define('SP_MAX_TIMEOUT', 10);
|
24 |
define('SP_BACKUP', 'ShortpixelBackups');
|
25 |
define('SP_BACKUP_FOLDER', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . SP_BACKUP);
|
26 |
define('MAX_API_RETRIES', 5);
|
27 |
$MAX_EXECUTION_TIME = ini_get('max_execution_time');
|
28 |
-
if ( is_numeric($MAX_EXECUTION_TIME) )
|
29 |
define('MAX_EXECUTION_TIME', $MAX_EXECUTION_TIME - 5 ); //in seconds
|
30 |
else
|
31 |
define('MAX_EXECUTION_TIME', 25 );
|
@@ -36,6 +38,7 @@ class WPShortPixel {
|
|
36 |
const BULK_EMPTY_QUEUE = 0;
|
37 |
|
38 |
private $_apiKey = '';
|
|
|
39 |
private $_compressionType = 1;
|
40 |
private $_processThumbnails = 1;
|
41 |
private $_CMYKtoRGBconversion = 1;
|
@@ -52,14 +55,12 @@ class WPShortPixel {
|
|
52 |
}
|
53 |
|
54 |
public function __construct() {
|
55 |
-
if(!is_admin()) {
|
56 |
-
return;
|
57 |
-
}
|
58 |
if (!session_id()) {
|
59 |
session_start();
|
60 |
}
|
61 |
$this->populateOptions();
|
62 |
-
|
|
|
63 |
$this->_apiInterface = new ShortPixelAPI($this->_apiKey, $this->_compressionType, $this->_CMYKtoRGBconversion);
|
64 |
$this->prioQ = new ShortPixelQueue($this);
|
65 |
$this->view = new ShortPixelView($this);
|
@@ -184,7 +185,7 @@ class WPShortPixel {
|
|
184 |
STATUS_FAIL: <?= ShortPixelAPI::STATUS_FAIL ?>,
|
185 |
STATUS_SKIP: <?= ShortPixelAPI::STATUS_SKIP ?>,
|
186 |
STATUS_QUOTA_EXCEEDED: <?= ShortPixelAPI::STATUS_QUOTA_EXCEEDED ?>,
|
187 |
-
WP_PLUGIN_URL: '<?=
|
188 |
API_KEY: "<?= $this->_apiKey ?>"
|
189 |
});
|
190 |
});
|
@@ -217,7 +218,7 @@ class WPShortPixel {
|
|
217 |
$args = array(
|
218 |
'id' => 'shortpixel_processing',
|
219 |
'title' => '<div title="' . $tooltip . '" ><img src="'
|
220 |
-
.
|
221 |
'href' => $link,
|
222 |
'meta' => array('target'=> $blank, 'class' => 'shortpixel-toolbar-processing' . $extraClasses)
|
223 |
);
|
@@ -877,7 +878,8 @@ HTML;
|
|
877 |
if(!$this->_verifiedKey) {
|
878 |
|
879 |
//if invalid key we display the link to the API Key
|
880 |
-
$formHTML .= '<tr><td style="padding-left: 0px;" colspan="2">Don’t have an API Key? <a href="https://shortpixel.com/wp-apikey
|
|
|
881 |
$formHTML .= '</form>';
|
882 |
} else {
|
883 |
//if valid key we display the rest of the options
|
@@ -908,7 +910,7 @@ clip art and comics.
|
|
908 |
</p>
|
909 |
<table class="form-table">
|
910 |
<tbody><tr>
|
911 |
-
<th scope="row"><label for="thumbnails">
|
912 |
<td><input name="thumbnails" type="checkbox" id="thumbnails" {$checked}> Apply compression also to image thumbnails.</td>
|
913 |
</tr>
|
914 |
<tr>
|
@@ -939,7 +941,7 @@ for(var i = 0; i < rad.length; i++) {
|
|
939 |
if(this !== prev) {
|
940 |
prev = this;
|
941 |
}
|
942 |
-
alert('This type of optimization will apply to new uploaded images
|
943 |
};
|
944 |
}
|
945 |
</script>
|
@@ -1223,7 +1225,7 @@ HTML;
|
|
1223 |
}
|
1224 |
else
|
1225 |
{
|
1226 |
-
print "<img src=\"" .
|
1227 |
| <a href=\"javascript:manualOptimization({$id})\">Retry</a></div>";
|
1228 |
$this->prioQ->push($id); //should be there but just to make sure
|
1229 |
}
|
@@ -1523,7 +1525,17 @@ HTML;
|
|
1523 |
|
1524 |
}
|
1525 |
|
1526 |
-
|
1527 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1528 |
|
1529 |
?>
|
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 > ShortPixel</a> page on how to start optimizing your image library and make your website load faster.
|
6 |
+
* Version: 3.0.7
|
7 |
* Author: ShortPixel
|
8 |
* Author URI: https://shortpixel.com
|
9 |
*/
|
13 |
require_once('shortpixel_view.php');
|
14 |
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
15 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
16 |
+
if ( !is_plugin_active( 'wpmandrill/wpmandrill.php' ) && !is_plugin_active( 'wp-ses/wp-ses.php' ) ) {
|
17 |
require_once( ABSPATH . 'wp-includes/pluggable.php' );//to avoid conflict with wpmandrill plugin
|
18 |
}
|
19 |
|
20 |
define('SP_RESET_ON_ACTIVATE', false);
|
21 |
|
22 |
+
define('SP_AFFILIATE_CODE', '');
|
23 |
+
|
24 |
+
define('PLUGIN_VERSION', "3.0.7");
|
25 |
define('SP_MAX_TIMEOUT', 10);
|
26 |
define('SP_BACKUP', 'ShortpixelBackups');
|
27 |
define('SP_BACKUP_FOLDER', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . SP_BACKUP);
|
28 |
define('MAX_API_RETRIES', 5);
|
29 |
$MAX_EXECUTION_TIME = ini_get('max_execution_time');
|
30 |
+
if ( is_numeric($MAX_EXECUTION_TIME) && $MAX_EXECUTION_TIME > 10 )
|
31 |
define('MAX_EXECUTION_TIME', $MAX_EXECUTION_TIME - 5 ); //in seconds
|
32 |
else
|
33 |
define('MAX_EXECUTION_TIME', 25 );
|
38 |
const BULK_EMPTY_QUEUE = 0;
|
39 |
|
40 |
private $_apiKey = '';
|
41 |
+
private $_affiliateSufix;
|
42 |
private $_compressionType = 1;
|
43 |
private $_processThumbnails = 1;
|
44 |
private $_CMYKtoRGBconversion = 1;
|
55 |
}
|
56 |
|
57 |
public function __construct() {
|
|
|
|
|
|
|
58 |
if (!session_id()) {
|
59 |
session_start();
|
60 |
}
|
61 |
$this->populateOptions();
|
62 |
+
|
63 |
+
$this->_affiliateSufix = (strlen(SP_AFFILIATE_CODE)) ? "/affiliate/" . SP_AFFILIATE_CODE : "";
|
64 |
$this->_apiInterface = new ShortPixelAPI($this->_apiKey, $this->_compressionType, $this->_CMYKtoRGBconversion);
|
65 |
$this->prioQ = new ShortPixelQueue($this);
|
66 |
$this->view = new ShortPixelView($this);
|
185 |
STATUS_FAIL: <?= ShortPixelAPI::STATUS_FAIL ?>,
|
186 |
STATUS_SKIP: <?= ShortPixelAPI::STATUS_SKIP ?>,
|
187 |
STATUS_QUOTA_EXCEEDED: <?= ShortPixelAPI::STATUS_QUOTA_EXCEEDED ?>,
|
188 |
+
WP_PLUGIN_URL: '<?= plugins_url( '', __FILE__ ) ?>',
|
189 |
API_KEY: "<?= $this->_apiKey ?>"
|
190 |
});
|
191 |
});
|
218 |
$args = array(
|
219 |
'id' => 'shortpixel_processing',
|
220 |
'title' => '<div title="' . $tooltip . '" ><img src="'
|
221 |
+
. plugins_url( 'img/'.$icon, __FILE__ ) . '"><span class="shp-alert">!</span></div>',
|
222 |
'href' => $link,
|
223 |
'meta' => array('target'=> $blank, 'class' => 'shortpixel-toolbar-processing' . $extraClasses)
|
224 |
);
|
878 |
if(!$this->_verifiedKey) {
|
879 |
|
880 |
//if invalid key we display the link to the API Key
|
881 |
+
$formHTML .= '<tr><td style="padding-left: 0px;" colspan="2">Don’t have an API Key? <a href="https://shortpixel.com/wp-apikey'
|
882 |
+
. $this->_affiliateSufix . '" target="_blank">Sign up, it’s free.</a></td></tr>';
|
883 |
$formHTML .= '</form>';
|
884 |
} else {
|
885 |
//if valid key we display the rest of the options
|
910 |
</p>
|
911 |
<table class="form-table">
|
912 |
<tbody><tr>
|
913 |
+
<th scope="row"><label for="thumbnails">Also include thumbnails:</label></th>
|
914 |
<td><input name="thumbnails" type="checkbox" id="thumbnails" {$checked}> Apply compression also to image thumbnails.</td>
|
915 |
</tr>
|
916 |
<tr>
|
941 |
if(this !== prev) {
|
942 |
prev = this;
|
943 |
}
|
944 |
+
alert('This type of optimization will apply to new uploaded images.\\nImages that were already processed will not be re-optimized.');
|
945 |
};
|
946 |
}
|
947 |
</script>
|
1225 |
}
|
1226 |
else
|
1227 |
{
|
1228 |
+
print "<img src=\"" . plugins_url( 'img/loading.gif', __FILE__ ) . "\">Image waiting to be processed
|
1229 |
| <a href=\"javascript:manualOptimization({$id})\">Retry</a></div>";
|
1230 |
$this->prioQ->push($id); //should be there but just to make sure
|
1231 |
}
|
1525 |
|
1526 |
}
|
1527 |
|
1528 |
+
function onInit() {
|
1529 |
+
if ( ! is_admin() || !is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
1530 |
+
return;
|
1531 |
+
}
|
1532 |
+
$pluginInstance = new WPShortPixel;
|
1533 |
+
global $pluginInstance;
|
1534 |
+
}
|
1535 |
+
|
1536 |
+
add_action( 'init', 'onInit');
|
1537 |
+
|
1538 |
+
//$pluginInstance = new WPShortPixel();
|
1539 |
+
//global $pluginInstance;
|
1540 |
|
1541 |
?>
|