Version Description
- Added settings option to disable check for home url.
- for PHP 5.4.x reordered class WpSmushit contructors to prevent Strict Standards Exception
Download this release
Release Info
Developer | WPMUDEV |
Plugin | Smush Image Compression and Optimization |
Version | 1.6.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.6.5.3 to 1.6.5.4
- readme.txt +8 -4
- wp-smushit.php +32 -13
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== WP Smush.it ===
|
2 |
Plugin Name: WP Smush.it
|
3 |
-
Version: 1.6.5.
|
4 |
Author: WPMU DEV
|
5 |
Author URI: http://premium.wpmudev.org
|
6 |
Contributors: WPMUDEV, alexdunae
|
7 |
-
Tags:
|
8 |
Requires at least: 3.5
|
9 |
-
Tested up to:
|
10 |
-
Stable tag: 1.6.5.
|
11 |
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
12 |
|
13 |
Reduce image file sizes and improve performance using the <a href="http://smush.it/">Smush.it</a> API within WordPress.
|
@@ -72,6 +72,10 @@ This will give us a good foundation to start adding some new features!
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
75 |
= 1.6.5.3 =
|
76 |
* Removed check for file within local site home path.
|
77 |
|
1 |
=== WP Smush.it ===
|
2 |
Plugin Name: WP Smush.it
|
3 |
+
Version: 1.6.5.4
|
4 |
Author: WPMU DEV
|
5 |
Author URI: http://premium.wpmudev.org
|
6 |
Contributors: WPMUDEV, alexdunae
|
7 |
+
Tags: Compress, Image Files, Compress Image Size,Compress JPG, Photo Optimization, Optimize Photos, Smush, Smush.it, Yahoo Smush.it
|
8 |
Requires at least: 3.5
|
9 |
+
Tested up to: 4.0
|
10 |
+
Stable tag: 1.6.5.4
|
11 |
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
12 |
|
13 |
Reduce image file sizes and improve performance using the <a href="http://smush.it/">Smush.it</a> API within WordPress.
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 1.6.5.4 =
|
76 |
+
* Added settings option to disable check for home url.
|
77 |
+
* for PHP 5.4.x reordered class WpSmushit contructors to prevent Strict Standards Exception
|
78 |
+
|
79 |
= 1.6.5.3 =
|
80 |
* Removed check for file within local site home path.
|
81 |
|
wp-smushit.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Smush.it
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/wp-smushit/
|
5 |
Description: Reduce image file sizes and improve performance using the <a href="http://smush.it/">Smush.it</a> API within WordPress.
|
6 |
Author: WPMU DEV
|
7 |
-
Version: 1.6.5.
|
8 |
Author URI: http://premium.wpmudev.org/
|
9 |
Textdomain: wp_smushit
|
10 |
*/
|
@@ -39,14 +39,11 @@ if ( !class_exists( 'WpSmushit' ) ) {
|
|
39 |
|
40 |
class WpSmushit {
|
41 |
|
42 |
-
var $version = "1.6.5.
|
43 |
|
44 |
/**
|
45 |
* Constructor
|
46 |
*/
|
47 |
-
function WpSmushit( ) {
|
48 |
-
$this->__construct( );
|
49 |
-
}
|
50 |
function __construct( ) {
|
51 |
|
52 |
/**
|
@@ -67,6 +64,7 @@ class WpSmushit {
|
|
67 |
|
68 |
define( 'WP_SMUSHIT_AUTO', intval( get_option( 'wp_smushit_smushit_auto', 0) ) );
|
69 |
define( 'WP_SMUSHIT_TIMEOUT', intval( get_option( 'wp_smushit_smushit_timeout', 60) ) );
|
|
|
70 |
|
71 |
if ((!isset($_GET['action'])) || ($_GET['action'] != "wp_smushit_manual")) {
|
72 |
define( 'WP_SMUSHIT_DEBUG', get_option( 'wp_smushit_smushit_debug', '') );
|
@@ -101,6 +99,10 @@ class WpSmushit {
|
|
101 |
add_action( 'admin_init', array( &$this, 'register_settings' ) );
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
104 |
/**
|
105 |
* Plugin setting functions
|
106 |
*/
|
@@ -113,11 +115,15 @@ class WpSmushit {
|
|
113 |
add_settings_field( 'wp_smushit_smushit_timeout', __( 'How many seconds should we wait for a response from Smush.it?', WP_SMUSHIT_DOMAIN ),
|
114 |
array( &$this, 'render_timeout_opts' ), 'media', 'wp_smushit_settings' );
|
115 |
|
|
|
|
|
|
|
116 |
add_settings_field( 'wp_smushit_smushit_debug', __( 'Enable debug processing', WP_SMUSHIT_DOMAIN ),
|
117 |
array( &$this, 'render_debug_opts' ), 'media', 'wp_smushit_settings' );
|
118 |
|
119 |
register_setting( 'media', 'wp_smushit_smushit_auto' );
|
120 |
register_setting( 'media', 'wp_smushit_smushit_timeout' );
|
|
|
121 |
register_setting( 'media', 'wp_smushit_smushit_debug' );
|
122 |
}
|
123 |
|
@@ -144,9 +150,16 @@ class WpSmushit {
|
|
144 |
printf( "<input type='text' name='%1\$s' id='%1\$s' value='%2\%d'>", esc_attr( $key ), intval( get_option( $key, 60 ) ) );
|
145 |
}
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
function render_debug_opts( ) {
|
148 |
$key = 'wp_smushit_smushit_debug';
|
149 |
-
$val = get_option( $key );
|
150 |
?><input type="checkbox" name="<?php echo $key ?>" <?php if ($val) { echo ' checked="checked" '; } ?>/> <?php _e( 'If you are having trouble with the plugin enable this option can reveal some information about your system needed for support.', WP_SMUSHIT_DOMAIN );
|
151 |
}
|
152 |
|
@@ -368,16 +381,22 @@ class WpSmushit {
|
|
368 |
*/
|
369 |
// The Yahoo! Smush.it service does not working with https images.
|
370 |
$file_url = str_replace('https://', 'http://', $file_url);
|
371 |
-
$home_url = str_replace('https://', 'http://', get_option('home'));
|
372 |
-
if (WP_SMUSHIT_DEBUG) {
|
373 |
-
echo "DEBUG: file_url [". $file_url ."] home_url [". $home_url ."]<br />";
|
374 |
-
}
|
375 |
|
376 |
-
|
377 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
htmlentities( $file_url ), $home_url);
|
|
|
379 |
}
|
380 |
-
|
381 |
//echo "calling _post(". $file_url .")<br />";
|
382 |
$data = $this->_post( $file_url );
|
383 |
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/wp-smushit/
|
5 |
Description: Reduce image file sizes and improve performance using the <a href="http://smush.it/">Smush.it</a> API within WordPress.
|
6 |
Author: WPMU DEV
|
7 |
+
Version: 1.6.5.4
|
8 |
Author URI: http://premium.wpmudev.org/
|
9 |
Textdomain: wp_smushit
|
10 |
*/
|
39 |
|
40 |
class WpSmushit {
|
41 |
|
42 |
+
var $version = "1.6.5.4";
|
43 |
|
44 |
/**
|
45 |
* Constructor
|
46 |
*/
|
|
|
|
|
|
|
47 |
function __construct( ) {
|
48 |
|
49 |
/**
|
64 |
|
65 |
define( 'WP_SMUSHIT_AUTO', intval( get_option( 'wp_smushit_smushit_auto', 0) ) );
|
66 |
define( 'WP_SMUSHIT_TIMEOUT', intval( get_option( 'wp_smushit_smushit_timeout', 60) ) );
|
67 |
+
define( 'WP_SMUSHIT_ENFORCE_SAME_URL', get_option( 'wp_smushit_smushit_enforce_same_url', 'on') );
|
68 |
|
69 |
if ((!isset($_GET['action'])) || ($_GET['action'] != "wp_smushit_manual")) {
|
70 |
define( 'WP_SMUSHIT_DEBUG', get_option( 'wp_smushit_smushit_debug', '') );
|
99 |
add_action( 'admin_init', array( &$this, 'register_settings' ) );
|
100 |
}
|
101 |
|
102 |
+
function WpSmushit( ) {
|
103 |
+
$this->__construct( );
|
104 |
+
}
|
105 |
+
|
106 |
/**
|
107 |
* Plugin setting functions
|
108 |
*/
|
115 |
add_settings_field( 'wp_smushit_smushit_timeout', __( 'How many seconds should we wait for a response from Smush.it?', WP_SMUSHIT_DOMAIN ),
|
116 |
array( &$this, 'render_timeout_opts' ), 'media', 'wp_smushit_settings' );
|
117 |
|
118 |
+
add_settings_field( 'wp_smushit_smushit_enforce_same_url', __( 'Enforce image URL is same as Home', WP_SMUSHIT_DOMAIN ),
|
119 |
+
array( &$this, 'render_enforce_same_url_opts' ), 'media', 'wp_smushit_settings' );
|
120 |
+
|
121 |
add_settings_field( 'wp_smushit_smushit_debug', __( 'Enable debug processing', WP_SMUSHIT_DOMAIN ),
|
122 |
array( &$this, 'render_debug_opts' ), 'media', 'wp_smushit_settings' );
|
123 |
|
124 |
register_setting( 'media', 'wp_smushit_smushit_auto' );
|
125 |
register_setting( 'media', 'wp_smushit_smushit_timeout' );
|
126 |
+
register_setting( 'media', 'wp_smushit_smushit_enforce_same_url' );
|
127 |
register_setting( 'media', 'wp_smushit_smushit_debug' );
|
128 |
}
|
129 |
|
150 |
printf( "<input type='text' name='%1\$s' id='%1\$s' value='%2\%d'>", esc_attr( $key ), intval( get_option( $key, 60 ) ) );
|
151 |
}
|
152 |
|
153 |
+
function render_enforce_same_url_opts( ) {
|
154 |
+
$key = 'wp_smushit_smushit_enforce_same_url';
|
155 |
+
$val = get_option( $key, WP_SMUSHIT_ENFORCE_SAME_URL );
|
156 |
+
?><input type="checkbox" name="<?php echo $key ?>" <?php if ($val == 'on') { echo ' checked="checked" '; } ?>/> <?php
|
157 |
+
echo '<strong>'. get_option('home'). '</strong><br />'.__( 'By default the plugin will enforce that the image URL is the same domain as the home. If you are using a sub-domain pointed to this same host or an external Content Delivery Network (CDN) you want to unset this option.', WP_SMUSHIT_DOMAIN );
|
158 |
+
}
|
159 |
+
|
160 |
function render_debug_opts( ) {
|
161 |
$key = 'wp_smushit_smushit_debug';
|
162 |
+
$val = get_option( $key, WP_SMUSHIT_DEBUG );
|
163 |
?><input type="checkbox" name="<?php echo $key ?>" <?php if ($val) { echo ' checked="checked" '; } ?>/> <?php _e( 'If you are having trouble with the plugin enable this option can reveal some information about your system needed for support.', WP_SMUSHIT_DOMAIN );
|
164 |
}
|
165 |
|
381 |
*/
|
382 |
// The Yahoo! Smush.it service does not working with https images.
|
383 |
$file_url = str_replace('https://', 'http://', $file_url);
|
|
|
|
|
|
|
|
|
384 |
|
385 |
+
// File URL check disabled 2013-10-11 - The assumption here is the URL may not be the local site URL. The image may be served via a sub-domain pointed
|
386 |
+
// to this same host or may be an external CDN. In either case the image would be the same. So we let the Yahoo! Smush.it service use the image URL with
|
387 |
+
// the assumption the remote image and the local file are the same. Also with the assumption that the CDN service will somehow be updated when the image
|
388 |
+
// is changed.
|
389 |
+
if ((defined('WP_SMUSHIT_ENFORCE_SAME_URL')) && (WP_SMUSHIT_ENFORCE_SAME_URL == 'on')) {
|
390 |
+
$home_url = str_replace('https://', 'http://', get_option('home'));
|
391 |
+
if (WP_SMUSHIT_DEBUG) {
|
392 |
+
echo "DEBUG: file_url [". $file_url ."] home_url [". $home_url ."]<br />";
|
393 |
+
}
|
394 |
+
|
395 |
+
if (stripos($file_url, $home_url) !== 0) {
|
396 |
+
return sprintf( __( "ERROR: <span class='code'>%s</span> must be within the website home URL (<span class='code'>%s</span>)", WP_SMUSHIT_DOMAIN ),
|
397 |
htmlentities( $file_url ), $home_url);
|
398 |
+
}
|
399 |
}
|
|
|
400 |
//echo "calling _post(". $file_url .")<br />";
|
401 |
$data = $this->_post( $file_url );
|
402 |
|