WebP Express - Version 0.14.13

Version Description

(released: 26 jun 2019)

  • Fixed errors in conversion scripts
Download this release

Release Info

Developer rosell.dk
Plugin Icon 128x128 WebP Express
Version 0.14.13
Comparing to
See all releases

Code changes from version 0.14.12 to 0.14.13

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://ko-fi.com/rosell
4
Tags: webp, images, performance
5
Requires at least: 4.0
6
Tested up to: 5.2
7
- Stable tag: 0.14.12
8
Requires PHP: 5.6
9
License: GPLv3
10
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -605,6 +605,11 @@ Easy enough! - [Go here!](https://ko-fi.com/rosell). Or [here](https://buymeacof
605
606
== Changelog ==
607
608
= 0.14.12 =
609
*(released: 26 jun 2019)*
610
@@ -859,6 +864,9 @@ For older releases, check out changelog.txt
859
860
== Upgrade Notice ==
861
862
= 0.14.12 =
863
Fixed critical bug
864
4
Tags: webp, images, performance
5
Requires at least: 4.0
6
Tested up to: 5.2
7
+ Stable tag: 0.14.13
8
Requires PHP: 5.6
9
License: GPLv3
10
License URI: https://www.gnu.org/licenses/gpl-3.0.html
605
606
== Changelog ==
607
608
+ = 0.14.13 =
609
+ *(released: 26 jun 2019)*
610
+
611
+ * Fixed errors in conversion scripts
612
+
613
= 0.14.12 =
614
*(released: 26 jun 2019)*
615
864
865
== Upgrade Notice ==
866
867
+ = 0.14.13 =
868
+ Fixed errors in conversion scripts
869
+
870
= 0.14.12 =
871
Fixed critical bug
872
lib/classes/Config.php CHANGED
@@ -139,7 +139,7 @@ class Config
139
if ($config['operation-mode'] == 'varied-image-responses') {
140
$config = array_merge($config, [
141
//'redirect-to-existing-in-htaccess' => true, // this can now be configured, so do not apply
142
- 'enable-redirection-to-converter' => true,
143
'only-redirect-to-converter-for-webp-enabled-browsers' => true,
144
'only-redirect-to-converter-on-cache-miss' => false,
145
'do-not-pass-source-in-query-string' => true, // Will be removed in 0.13
139
if ($config['operation-mode'] == 'varied-image-responses') {
140
$config = array_merge($config, [
141
//'redirect-to-existing-in-htaccess' => true, // this can now be configured, so do not apply
142
+ //'enable-redirection-to-converter' => true, // this can now be configured, so do not apply
143
'only-redirect-to-converter-for-webp-enabled-browsers' => true,
144
'only-redirect-to-converter-on-cache-miss' => false,
145
'do-not-pass-source-in-query-string' => true, // Will be removed in 0.13
lib/classes/ConvertHelperIndependent.php CHANGED
@@ -132,7 +132,7 @@ class ConvertHelperIndependent
132
// TODO: This does not work on Windows yet.
133
// NOTE: WE CANNOT DO AS WITH sourceIsInsideDocRoot, because it relies on realpath, which only translates EXISTING paths.
134
// $destination does not exist yet, when this method is called from webp-realizer.php
135
- if (strpos($destination, $imageRoot . '/doc-root/') === 0) {
136
137
// "Eat" the left part off the $destination parameter. $destination is for example:
138
// "/var/www/webp-express-tests/we0/wp-content-moved/webp-express/webp-images/doc-root/wordpress/uploads-moved/2018/12/tegning5-300x265.jpg.webp"
@@ -142,7 +142,10 @@ class ConvertHelperIndependent
142
$docRoot = rtrim(realpath($_SERVER["DOCUMENT_ROOT"]), '/');
143
$source = $docRoot . '/' . $sourceRel;
144
$source = preg_replace('/\\.(webp)#x2F;', '', $source);
145
}
146
$source = SanityCheck::absPathExistsAndIsFileInDocRoot($source);
147
148
} catch (SanityException $e) {
@@ -317,7 +320,7 @@ APACHE
317
318
$text = preg_replace('#' . preg_quote($_SERVER["DOCUMENT_ROOT"]) . '#', '[doc-root]', $text);
319
320
- $text = 'WebP Express 0.14.12. ' . $msgTop . ', ' . date("Y-m-d H:i:s") . "\n\r\n\r" . $text;
321
322
$logFile = self::getLogFilename($source, $logDir);
323
132
// TODO: This does not work on Windows yet.
133
// NOTE: WE CANNOT DO AS WITH sourceIsInsideDocRoot, because it relies on realpath, which only translates EXISTING paths.
134
// $destination does not exist yet, when this method is called from webp-realizer.php
135
+ if (strpos($destination, $imageRoot . '/') === 0) {
136
137
// "Eat" the left part off the $destination parameter. $destination is for example:
138
// "/var/www/webp-express-tests/we0/wp-content-moved/webp-express/webp-images/doc-root/wordpress/uploads-moved/2018/12/tegning5-300x265.jpg.webp"
142
$docRoot = rtrim(realpath($_SERVER["DOCUMENT_ROOT"]), '/');
143
$source = $docRoot . '/' . $sourceRel;
144
$source = preg_replace('/\\.(webp)#x2F;', '', $source);
145
+ } else {
146
+ return false;
147
}
148
+
149
$source = SanityCheck::absPathExistsAndIsFileInDocRoot($source);
150
151
} catch (SanityException $e) {
320
321
$text = preg_replace('#' . preg_quote($_SERVER["DOCUMENT_ROOT"]) . '#', '[doc-root]', $text);
322
323
+ $text = 'WebP Express 0.14.13. ' . $msgTop . ', ' . date("Y-m-d H:i:s") . "\n\r\n\r" . $text;
324
325
$logFile = self::getLogFilename($source, $logDir);
326
lib/classes/SanityCheck.php CHANGED
@@ -115,6 +115,11 @@ class SanityCheck
115
return $input;
116
}
117
118
public static function absPathIsInDocRoot($input, $errorMsg = 'Path is outside allowed path')
119
{
120
$docRoot = self::absPath($_SERVER["DOCUMENT_ROOT"]);
@@ -132,11 +137,6 @@ class SanityCheck
132
return $input;
133
}
134
135
- public static function absPath($input)
136
- {
137
- return self::path($input);
138
- }
139
-
140
public static function absPathExists($input, $errorMsg = 'Path does not exist')
141
{
142
self::absPath($input);
115
return $input;
116
}
117
118
+ public static function absPath($input)
119
+ {
120
+ return self::path($input);
121
+ }
122
+
123
public static function absPathIsInDocRoot($input, $errorMsg = 'Path is outside allowed path')
124
{
125
$docRoot = self::absPath($_SERVER["DOCUMENT_ROOT"]);
137
return $input;
138
}
139
140
public static function absPathExists($input, $errorMsg = 'Path does not exist')
141
{
142
self::absPath($input);
lib/options/submit.php CHANGED
@@ -583,6 +583,7 @@ switch ($sanitized['operation-mode']) {
583
'redirect-to-existing-in-htaccess' => $sanitized['redirect-to-existing-in-htaccess'],
584
'destination-folder' => $sanitized['destination-folder'],
585
'destination-extension' => (($sanitized['destination-folder'] == 'mingled') ? $sanitized['destination-extension'] : 'append'),
586
]);
587
break;
588
case 'cdn-friendly':
583
'redirect-to-existing-in-htaccess' => $sanitized['redirect-to-existing-in-htaccess'],
584
'destination-folder' => $sanitized['destination-folder'],
585
'destination-extension' => (($sanitized['destination-folder'] == 'mingled') ? $sanitized['destination-extension'] : 'append'),
586
+ 'enable-redirection-to-converter' => $sanitized['enable-redirection-to-converter'],
587
]);
588
break;
589
case 'cdn-friendly':
webp-express.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: WebP Express
4
* Plugin URI: https://github.com/rosell-dk/webp-express
5
* Description: Serve autogenerated WebP images instead of jpeg/png to browsers that supports WebP. Works on anything (media library images, galleries, theme images etc).
6
- * Version: 0.14.12
7
* Author: Bjørn Rosell
8
* Author URI: https://www.bitwise-it.dk
9
* License: GPL2
3
* Plugin Name: WebP Express
4
* Plugin URI: https://github.com/rosell-dk/webp-express
5
* Description: Serve autogenerated WebP images instead of jpeg/png to browsers that supports WebP. Works on anything (media library images, galleries, theme images etc).
6
+ * Version: 0.14.13
7
* Author: Bjørn Rosell
8
* Author URI: https://www.bitwise-it.dk
9
* License: GPL2
wod/webp-on-demand.php CHANGED
@@ -7,6 +7,8 @@ use \WebPExpress\ConvertHelperIndependent;
7
use \WebPExpress\Sanitize;
8
use \WebPExpress\SanityCheck;
9
use \WebPExpress\SanityException;
10
11
class WebPOnDempand
12
{
@@ -44,6 +46,8 @@ class WebPOnDempand
44
include_once __DIR__ . '/../lib/classes/Sanitize.php';
45
include_once __DIR__ . '/../lib/classes/SanityCheck.php';
46
include_once __DIR__ . '/../lib/classes/SanityException.php';
47
48
// Check input
49
// --------------
7
use \WebPExpress\Sanitize;
8
use \WebPExpress\SanityCheck;
9
use \WebPExpress\SanityException;
10
+ use \WebPExpress\ValidateException;
11
+ use \WebPExpress\Validate;
12
13
class WebPOnDempand
14
{
46
include_once __DIR__ . '/../lib/classes/Sanitize.php';
47
include_once __DIR__ . '/../lib/classes/SanityCheck.php';
48
include_once __DIR__ . '/../lib/classes/SanityException.php';
49
+ include_once __DIR__ . '/../lib/classes/Validate.php';
50
+ include_once __DIR__ . '/../lib/classes/ValidateException.php';
51
52
// Check input
53
// --------------
wod/webp-realizer.php CHANGED
@@ -7,6 +7,8 @@ use \WebPExpress\ConvertHelperIndependent;
7
use \WebPExpress\Sanitize;
8
use \WebPExpress\SanityCheck;
9
use \WebPExpress\SanityException;
10
11
class WebPRealizer
12
{
@@ -44,6 +46,8 @@ class WebPRealizer
44
include_once __DIR__ . '/../lib/classes/Sanitize.php';
45
include_once __DIR__ . '/../lib/classes/SanityCheck.php';
46
include_once __DIR__ . '/../lib/classes/SanityException.php';
47
48
// Check input
49
// --------------
@@ -109,8 +113,8 @@ class WebPRealizer
109
// Validate that WebPExpress was configured to redirect to this conversion script
110
// ------------------------------------------------------------------------------
111
$checking = 'settings';
112
- if (!isset($wodOptions['enable-redirection-to-converter']) || ($wodOptions['enable-redirection-to-converter'] === false)) {
113
- throw new ValidateException('Redirection to conversion script is not enabled');
114
}
115
116
7
use \WebPExpress\Sanitize;
8
use \WebPExpress\SanityCheck;
9
use \WebPExpress\SanityException;
10
+ use \WebPExpress\ValidateException;
11
+ use \WebPExpress\Validate;
12
13
class WebPRealizer
14
{
46
include_once __DIR__ . '/../lib/classes/Sanitize.php';
47
include_once __DIR__ . '/../lib/classes/SanityCheck.php';
48
include_once __DIR__ . '/../lib/classes/SanityException.php';
49
+ include_once __DIR__ . '/../lib/classes/Validate.php';
50
+ include_once __DIR__ . '/../lib/classes/ValidateException.php';
51
52
// Check input
53
// --------------
113
// Validate that WebPExpress was configured to redirect to this conversion script
114
// ------------------------------------------------------------------------------
115
$checking = 'settings';
116
+ if (!isset($wodOptions['enable-redirection-to-webp-realizer']) || ($wodOptions['enable-redirection-to-webp-realizer'] === false)) {
117
+ throw new ValidateException('Redirection to webp realizer is not enabled');
118
}
119
120