Version Description
(2022-01-19) =
* [Fixed]
Loading images with special character in filename using Pass Thru method
* [Changed]
Error messages on plugin settings page
* [Added]
Value hiding for access token in plugin settings
Download this release
Release Info
Developer | mateuszgbiorczyk |
Plugin | Converter for Media – Optimize images | Convert WebP & AVIF |
Version | 4.1.1 |
Comparing to | |
See all releases |
Code changes from version 4.1.0 to 4.1.1
- changelog.txt +5 -0
- includes/passthru.php +9 -1
- readme.txt +7 -2
- src/Error/Notice/BypassingApacheNotice.php +9 -1
- src/Service/DeactivationModalGenerator.php +8 -1
- src/Settings/SettingsSave.php +4 -1
- templates/components/fields/token.php +5 -1
- vendor/composer/installed.php +2 -2
- webp-converter-for-media.php +2 -2
changelog.txt
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
= 4.1.0 (2022-01-12) =
|
4 |
* `[Fixed]` Auto-generation of rewrite rules for Multisite Network
|
5 |
* `[Fixed]` Detection of server configuration error related to non-working rewrites
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 4.1.1 (2022-01-19) =
|
4 |
+
* `[Fixed]` Loading images with special character in filename using Pass Thru method
|
5 |
+
* `[Changed]` Error messages on plugin settings page
|
6 |
+
* `[Added]` Value hiding for access token in plugin settings
|
7 |
+
|
8 |
= 4.1.0 (2022-01-12) =
|
9 |
* `[Fixed]` Auto-generation of rewrite rules for Multisite Network
|
10 |
* `[Fixed]` Detection of server configuration error related to non-working rewrites
|
includes/passthru.php
CHANGED
@@ -19,7 +19,7 @@ class PassthruLoader {
|
|
19 |
|
20 |
public function __construct() {
|
21 |
$image_url = $_GET['src'] ?? null; // phpcs:ignore WordPress.Security
|
22 |
-
if ( ! $image_url || !
|
23 |
return;
|
24 |
} elseif ( ! $this->validate_src_param( $image_url ) ) {
|
25 |
$this->load_image_default( $image_url );
|
@@ -28,6 +28,14 @@ class PassthruLoader {
|
|
28 |
$this->load_converted_image( $image_url );
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
private function validate_src_param( string $image_url ): bool {
|
32 |
$image_host = parse_url( $image_url, PHP_URL_HOST );
|
33 |
if ( $image_host !== ( $_SERVER['HTTP_HOST'] ?? '' ) ) { // phpcs:ignore WordPress.Security
|
19 |
|
20 |
public function __construct() {
|
21 |
$image_url = $_GET['src'] ?? null; // phpcs:ignore WordPress.Security
|
22 |
+
if ( ! $image_url || ! $this->validate_url( $image_url ) ) {
|
23 |
return;
|
24 |
} elseif ( ! $this->validate_src_param( $image_url ) ) {
|
25 |
$this->load_image_default( $image_url );
|
28 |
$this->load_converted_image( $image_url );
|
29 |
}
|
30 |
|
31 |
+
private function validate_url( string $image_url ): bool {
|
32 |
+
$url_path = parse_url( $image_url, PHP_URL_PATH ) ?: '';
|
33 |
+
$encoded_path = array_map( 'urlencode', explode( '/', $url_path ) );
|
34 |
+
$encoded_url = str_replace( $url_path, implode( '/', $encoded_path ), $image_url );
|
35 |
+
|
36 |
+
return ( filter_var( $encoded_url, FILTER_VALIDATE_URL ) !== false );
|
37 |
+
}
|
38 |
+
|
39 |
private function validate_src_param( string $image_url ): bool {
|
40 |
$image_host = parse_url( $image_url, PHP_URL_HOST );
|
41 |
if ( $image_host !== ( $_SERVER['HTTP_HOST'] ?? '' ) ) { // phpcs:ignore WordPress.Security
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mateuszgbiorczyk
|
|
3 |
Donate link: https://ko-fi.com/gbiorczyk/?utm_source=webp-converter-for-media&utm_medium=readme-donate
|
4 |
Tags: convert webp, webp, optimize images, compress images, webp converter
|
5 |
Requires at least: 4.9
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 7.0
|
8 |
Stable tag: trunk
|
9 |
License: GPLv2 or later
|
@@ -120,7 +120,7 @@ Practically every hosting meets these requirements. You must use PHP at least 7.
|
|
120 |
|
121 |
They are required native PHP extensions, used among others by WordPress to generate thumbnails. Your server must also have the modules `mod_mime`, `mod_rewrite` and `mod_expires` enabled.
|
122 |
|
123 |
-
An example of the correct server configuration can be found [here](https://
|
124 |
|
125 |
**Note the items marked in red.** If the values marked in red do not appear in your case, it means that your server does not meet the technical requirements. Pay attention to the **WebP Support** value for the GD library and **WEBP in the list of supported extensions** for the Imagick library.
|
126 |
|
@@ -392,6 +392,11 @@ This is all very important to us and allows us to do even better things for you!
|
|
392 |
|
393 |
== Changelog ==
|
394 |
|
|
|
|
|
|
|
|
|
|
|
395 |
= 4.1.0 (2022-01-12) =
|
396 |
* `[Fixed]` Auto-generation of rewrite rules for Multisite Network
|
397 |
* `[Fixed]` Detection of server configuration error related to non-working rewrites
|
3 |
Donate link: https://ko-fi.com/gbiorczyk/?utm_source=webp-converter-for-media&utm_medium=readme-donate
|
4 |
Tags: convert webp, webp, optimize images, compress images, webp converter
|
5 |
Requires at least: 4.9
|
6 |
+
Tested up to: 5.9
|
7 |
Requires PHP: 7.0
|
8 |
Stable tag: trunk
|
9 |
License: GPLv2 or later
|
120 |
|
121 |
They are required native PHP extensions, used among others by WordPress to generate thumbnails. Your server must also have the modules `mod_mime`, `mod_rewrite` and `mod_expires` enabled.
|
122 |
|
123 |
+
An example of the correct server configuration can be found [here](https://mattplugins.com/files/webp-server-config.png). Link to your current configuration can be found in the administration panel, on the management plugin page in the section **"We are waiting for your message"** *(or using the URL path: `/wp-admin/options-general.php?page=webpc_admin_page&action=server`)*.
|
124 |
|
125 |
**Note the items marked in red.** If the values marked in red do not appear in your case, it means that your server does not meet the technical requirements. Pay attention to the **WebP Support** value for the GD library and **WEBP in the list of supported extensions** for the Imagick library.
|
126 |
|
392 |
|
393 |
== Changelog ==
|
394 |
|
395 |
+
= 4.1.1 (2022-01-19) =
|
396 |
+
* `[Fixed]` Loading images with special character in filename using Pass Thru method
|
397 |
+
* `[Changed]` Error messages on plugin settings page
|
398 |
+
* `[Added]` Value hiding for access token in plugin settings
|
399 |
+
|
400 |
= 4.1.0 (2022-01-12) =
|
401 |
* `[Fixed]` Auto-generation of rewrite rules for Multisite Network
|
402 |
* `[Fixed]` Detection of server configuration error related to non-working rewrites
|
src/Error/Notice/BypassingApacheNotice.php
CHANGED
@@ -22,7 +22,15 @@ class BypassingApacheNotice implements ErrorNotice {
|
|
22 |
public function get_message(): array {
|
23 |
return [
|
24 |
__( 'Requests to images are processed by your server bypassing Apache. When loading images, rules from the .htaccess file are not executed. Change the server settings to handle the rules in the .htaccess file when loading static files.', 'webp-converter-for-media' ),
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
__( 'In this case, please contact your server administrator.', 'webp-converter-for-media' ),
|
27 |
];
|
28 |
}
|
22 |
public function get_message(): array {
|
23 |
return [
|
24 |
__( 'Requests to images are processed by your server bypassing Apache. When loading images, rules from the .htaccess file are not executed. Change the server settings to handle the rules in the .htaccess file when loading static files.', 'webp-converter-for-media' ),
|
25 |
+
sprintf(
|
26 |
+
'%2$s %1$s - %3$s %1$s - %4$s %1$s - %5$s',
|
27 |
+
'<br>',
|
28 |
+
__( 'Potential settings in the server or hosting configuration (usually you will find them in your hosting control panel) that may be causing this issue:', 'webp-converter-for-media' ),
|
29 |
+
__( '"Smart static files processing" and "Serve static files directly by Nginx" or similar in the section related to Apache and Nginx configuration', 'webp-converter-for-media' ),
|
30 |
+
__( '"Nginx Direct Delivery" or similar in the section related to speed or caching', 'webp-converter-for-media' ),
|
31 |
+
__( '"Nginx Caching" or similar (you can instead of disabling this setting remove the following extensions from the list of saved to the cache: .jpg, .jpeg, .png and .gif)', 'webp-converter-for-media' )
|
32 |
+
),
|
33 |
+
__( 'If you have any of the above settings active, you must disable them for .htaccess rules to work properly.', 'webp-converter-for-media' ),
|
34 |
__( 'In this case, please contact your server administrator.', 'webp-converter-for-media' ),
|
35 |
];
|
36 |
}
|
src/Service/DeactivationModalGenerator.php
CHANGED
@@ -6,6 +6,7 @@ use WebpConverter\Error\Notice\LibsNotInstalledNotice;
|
|
6 |
use WebpConverter\Error\Notice\LibsWithoutWebpSupportNotice;
|
7 |
use WebpConverter\PluginData;
|
8 |
use WebpConverter\PluginInfo;
|
|
|
9 |
use WebpConverter\Settings\Page\PageIntegration;
|
10 |
use WebpConverterVendor\MattPlugins\DeactivationModal;
|
11 |
|
@@ -133,7 +134,13 @@ class DeactivationModalGenerator {
|
|
133 |
new DeactivationModal\Model\FormValue(
|
134 |
'request_plugin_settings',
|
135 |
function () {
|
136 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
return base64_encode( $settings_json ?: '' ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions
|
138 |
}
|
139 |
)
|
6 |
use WebpConverter\Error\Notice\LibsWithoutWebpSupportNotice;
|
7 |
use WebpConverter\PluginData;
|
8 |
use WebpConverter\PluginInfo;
|
9 |
+
use WebpConverter\Settings\Option\AccessTokenOption;
|
10 |
use WebpConverter\Settings\Page\PageIntegration;
|
11 |
use WebpConverterVendor\MattPlugins\DeactivationModal;
|
12 |
|
134 |
new DeactivationModal\Model\FormValue(
|
135 |
'request_plugin_settings',
|
136 |
function () {
|
137 |
+
$plugin_settings = $this->plugin_data->get_plugin_settings();
|
138 |
+
$access_token = $plugin_settings[ AccessTokenOption::OPTION_NAME ] ?? '';
|
139 |
+
if ( $access_token ) {
|
140 |
+
$plugin_settings[ AccessTokenOption::OPTION_NAME ] = substr( $access_token, 0, 32 ) . str_repeat( '*', 32 );
|
141 |
+
}
|
142 |
+
|
143 |
+
$settings_json = json_encode( $plugin_settings );
|
144 |
return base64_encode( $settings_json ?: '' ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions
|
145 |
}
|
146 |
)
|
src/Settings/SettingsSave.php
CHANGED
@@ -57,16 +57,19 @@ class SettingsSave {
|
|
57 |
return;
|
58 |
}
|
59 |
|
|
|
60 |
if ( isset( $_POST[ self::SUBMIT_VALUE ] ) ) {
|
61 |
$plugin_settings = ( new PluginOptions() )->get_values( false, $_POST );
|
62 |
} else {
|
63 |
-
$plugin_settings = $
|
64 |
}
|
65 |
|
66 |
if ( isset( $_POST[ self::SUBMIT_TOKEN_ACTIVATE ] ) ) {
|
67 |
$plugin_settings[ AccessTokenOption::OPTION_NAME ] = sanitize_text_field( $_POST[ AccessTokenOption::OPTION_NAME ] ?: '' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
68 |
} elseif ( isset( $_POST[ self::SUBMIT_TOKEN_DEACTIVATE ] ) ) {
|
69 |
$plugin_settings[ AccessTokenOption::OPTION_NAME ] = '';
|
|
|
|
|
70 |
}
|
71 |
|
72 |
$token = $this->token_validator->validate_token( $plugin_settings[ AccessTokenOption::OPTION_NAME ] );
|
57 |
return;
|
58 |
}
|
59 |
|
60 |
+
$saved_settings = $this->plugin_data->get_plugin_settings();
|
61 |
if ( isset( $_POST[ self::SUBMIT_VALUE ] ) ) {
|
62 |
$plugin_settings = ( new PluginOptions() )->get_values( false, $_POST );
|
63 |
} else {
|
64 |
+
$plugin_settings = $saved_settings;
|
65 |
}
|
66 |
|
67 |
if ( isset( $_POST[ self::SUBMIT_TOKEN_ACTIVATE ] ) ) {
|
68 |
$plugin_settings[ AccessTokenOption::OPTION_NAME ] = sanitize_text_field( $_POST[ AccessTokenOption::OPTION_NAME ] ?: '' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
69 |
} elseif ( isset( $_POST[ self::SUBMIT_TOKEN_DEACTIVATE ] ) ) {
|
70 |
$plugin_settings[ AccessTokenOption::OPTION_NAME ] = '';
|
71 |
+
} elseif ( substr( $plugin_settings[ AccessTokenOption::OPTION_NAME ], -32 ) === str_repeat( '*', 32 ) ) {
|
72 |
+
$plugin_settings[ AccessTokenOption::OPTION_NAME ] = $saved_settings[ AccessTokenOption::OPTION_NAME ];
|
73 |
}
|
74 |
|
75 |
$token = $this->token_validator->validate_token( $plugin_settings[ AccessTokenOption::OPTION_NAME ] );
|
templates/components/fields/token.php
CHANGED
@@ -11,6 +11,10 @@
|
|
11 |
* @package WebP Converter for Media
|
12 |
*/
|
13 |
|
|
|
|
|
|
|
|
|
14 |
?>
|
15 |
<?php if ( $option['info'] ) : ?>
|
16 |
<p><?php echo wp_kses_post( $option['info'] ); ?></p>
|
@@ -18,7 +22,7 @@
|
|
18 |
<div class="webpInput">
|
19 |
<input type="text"
|
20 |
name="<?php echo esc_attr( $option['name'] ); ?>"
|
21 |
-
value="<?php echo esc_attr( $
|
22 |
id="<?php echo esc_attr( $option['name'] ); ?>"
|
23 |
class="webpInput__field"
|
24 |
<?php echo ( $token_valid_status ) ? 'readonly' : ''; ?>
|
11 |
* @package WebP Converter for Media
|
12 |
*/
|
13 |
|
14 |
+
$token_value = ( $token_valid_status )
|
15 |
+
? substr( $option['value'], 0, 32 ) . str_repeat( '*', 32 )
|
16 |
+
: $option['value'];
|
17 |
+
|
18 |
?>
|
19 |
<?php if ( $option['info'] ) : ?>
|
20 |
<p><?php echo wp_kses_post( $option['info'] ); ?></p>
|
22 |
<div class="webpInput">
|
23 |
<input type="text"
|
24 |
name="<?php echo esc_attr( $option['name'] ); ?>"
|
25 |
+
value="<?php echo esc_attr( $token_value ); ?>"
|
26 |
id="<?php echo esc_attr( $option['name'] ); ?>"
|
27 |
class="webpInput__field"
|
28 |
<?php echo ( $token_valid_status ) ? 'readonly' : ''; ?>
|
vendor/composer/installed.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
'type' => 'library',
|
6 |
'install_path' => __DIR__ . '/../../',
|
7 |
'aliases' => array(),
|
8 |
-
'reference' => '
|
9 |
'name' => 'gbiorczyk/webp-converter-for-media',
|
10 |
'dev' => false,
|
11 |
),
|
@@ -16,7 +16,7 @@
|
|
16 |
'type' => 'library',
|
17 |
'install_path' => __DIR__ . '/../../',
|
18 |
'aliases' => array(),
|
19 |
-
'reference' => '
|
20 |
'dev_requirement' => false,
|
21 |
),
|
22 |
'matt-plugins/deactivation-modal' => array(
|
5 |
'type' => 'library',
|
6 |
'install_path' => __DIR__ . '/../../',
|
7 |
'aliases' => array(),
|
8 |
+
'reference' => 'fc539b18cc283e9063bdb3b9ec0badab031b4317',
|
9 |
'name' => 'gbiorczyk/webp-converter-for-media',
|
10 |
'dev' => false,
|
11 |
),
|
16 |
'type' => 'library',
|
17 |
'install_path' => __DIR__ . '/../../',
|
18 |
'aliases' => array(),
|
19 |
+
'reference' => 'fc539b18cc283e9063bdb3b9ec0badab031b4317',
|
20 |
'dev_requirement' => false,
|
21 |
),
|
22 |
'matt-plugins/deactivation-modal' => array(
|
webp-converter-for-media.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
* Plugin Name: WebP Converter for Media
|
5 |
* Description: Speed up your website by serving WebP and AVIF images instead of standard formats JPEG, PNG and GIF. Reduce image sizes just now!
|
6 |
-
* Version: 4.1.
|
7 |
* Author: Mateusz Gbiorczyk
|
8 |
* Author URI: https://mattplugins.com/
|
9 |
* Text Domain: webp-converter-for-media
|
@@ -13,5 +13,5 @@
|
|
13 |
require_once __DIR__ . '/vendor/autoload.php';
|
14 |
|
15 |
new WebpConverter\WebpConverter(
|
16 |
-
new WebpConverter\PluginInfo( __FILE__, '4.1.
|
17 |
);
|
3 |
/**
|
4 |
* Plugin Name: WebP Converter for Media
|
5 |
* Description: Speed up your website by serving WebP and AVIF images instead of standard formats JPEG, PNG and GIF. Reduce image sizes just now!
|
6 |
+
* Version: 4.1.1
|
7 |
* Author: Mateusz Gbiorczyk
|
8 |
* Author URI: https://mattplugins.com/
|
9 |
* Text Domain: webp-converter-for-media
|
13 |
require_once __DIR__ . '/vendor/autoload.php';
|
14 |
|
15 |
new WebpConverter\WebpConverter(
|
16 |
+
new WebpConverter\PluginInfo( __FILE__, '4.1.1' )
|
17 |
);
|