Version Description
(2021-12-20) =
* [Fixed]
Auto-conversion images with unsupported extensions when uploading files
* [Fixed]
Generating directory paths when ABSPATH constant is invalid
* [Added]
URL validation for Pass Thru loading mode
Download this release
Release Info
Developer | mateuszgbiorczyk |
Plugin | Converter for Media – Optimize images | Convert WebP & AVIF |
Version | 4.0.3 |
Comparing to | |
See all releases |
Code changes from version 4.0.2 to 4.0.3
- changelog.txt +5 -0
- includes/passthru.php +20 -6
- readme.txt +6 -1
- src/Conversion/Directory/DirectoryAbstract.php +10 -2
- src/Conversion/Directory/DirectoryFactory.php +14 -7
- src/Conversion/Directory/DirectoryIntegration.php +14 -6
- src/Conversion/Directory/DirectoryInterface.php +7 -7
- src/Conversion/Directory/PathsGenerator.php +19 -0
- src/Conversion/Media/Upload.php +7 -0
- src/Error/Detector/PathsErrorsDetector.php +11 -1
- src/Settings/Page/DebugPage.php +15 -3
- templates/components/server/filters.php +2 -1
- templates/components/server/wordpress.php +6 -0
- templates/components/widgets/server.php +1 -0
- templates/views/settings-debug.php +1 -0
- vendor/composer/autoload_classmap.php +1 -0
- vendor/composer/autoload_static.php +1 -0
- webp-converter-for-media.php +3 -3
changelog.txt
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
= 4.0.2 (2021-12-17) =
|
4 |
* `[Fixed]` Fetching large list of files to conversion
|
5 |
* `[Fixed]` Rewrites caching for some servers
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 4.0.3 (2021-12-20) =
|
4 |
+
* `[Fixed]` Auto-conversion images with unsupported extensions when uploading files
|
5 |
+
* `[Fixed]` Generating directory paths when ABSPATH constant is invalid
|
6 |
+
* `[Added]` URL validation for Pass Thru loading mode
|
7 |
+
|
8 |
= 4.0.2 (2021-12-17) =
|
9 |
* `[Fixed]` Fetching large list of files to conversion
|
10 |
* `[Fixed]` Rewrites caching for some servers
|
includes/passthru.php
CHANGED
@@ -17,19 +17,33 @@ class PassthruLoader {
|
|
17 |
const PATH_UPLOADS_WEBP = '';
|
18 |
const MIME_TYPES = '';
|
19 |
|
20 |
-
/**
|
21 |
-
* PassthruLoader constructor.
|
22 |
-
*/
|
23 |
public function __construct() {
|
24 |
-
|
|
|
25 |
return;
|
26 |
-
} elseif ( ! filter_var( $image_url, FILTER_VALIDATE_URL ) ) {
|
27 |
-
$this->load_image_default( $image_url );
|
28 |
}
|
29 |
|
30 |
$this->load_converted_image( $image_url );
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
/**
|
34 |
* Initializes loading of image in supported output format.
|
35 |
*
|
17 |
const PATH_UPLOADS_WEBP = '';
|
18 |
const MIME_TYPES = '';
|
19 |
|
|
|
|
|
|
|
20 |
public function __construct() {
|
21 |
+
$image_url = $_GET['src'] ?? null; // phpcs:ignore WordPress.Security
|
22 |
+
if ( ! $this->validate_src_param( $image_url ) ) {
|
23 |
return;
|
|
|
|
|
24 |
}
|
25 |
|
26 |
$this->load_converted_image( $image_url );
|
27 |
}
|
28 |
|
29 |
+
private function validate_src_param( string $image_url = null ): bool {
|
30 |
+
if ( ! $image_url || ! filter_var( $image_url, FILTER_VALIDATE_URL ) ) {
|
31 |
+
return false;
|
32 |
+
}
|
33 |
+
|
34 |
+
$image_host = parse_url( $image_url, PHP_URL_HOST );
|
35 |
+
if ( $image_host !== ( $_SERVER['HTTP_HOST'] ?? '' ) ) { // phpcs:ignore WordPress.Security
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
|
39 |
+
$image_extension = strtolower( pathinfo( $image_url, PATHINFO_EXTENSION ) );
|
40 |
+
if ( ! in_array( $image_extension, [ 'jpg', 'jpeg', 'png', 'gif', 'png2' ] ) ) {
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
|
44 |
+
return true;
|
45 |
+
}
|
46 |
+
|
47 |
/**
|
48 |
* Initializes loading of image in supported output format.
|
49 |
*
|
readme.txt
CHANGED
@@ -9,7 +9,7 @@ Stable tag: trunk
|
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
-
|
13 |
|
14 |
== Description ==
|
15 |
|
@@ -481,6 +481,11 @@ This is all very important to us and allows us to do even better things for you!
|
|
481 |
|
482 |
== Changelog ==
|
483 |
|
|
|
|
|
|
|
|
|
|
|
484 |
= 4.0.2 (2021-12-17) =
|
485 |
* `[Fixed]` Fetching large list of files to conversion
|
486 |
* `[Fixed]` Rewrites caching for some servers
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
+
Speed up your website by serving WebP and AVIF images instead of standard formats JPEG, PNG and GIF. Reduce image sizes just now!
|
13 |
|
14 |
== Description ==
|
15 |
|
481 |
|
482 |
== Changelog ==
|
483 |
|
484 |
+
= 4.0.3 (2021-12-20) =
|
485 |
+
* `[Fixed]` Auto-conversion images with unsupported extensions when uploading files
|
486 |
+
* `[Fixed]` Generating directory paths when ABSPATH constant is invalid
|
487 |
+
* `[Added]` URL validation for Pass Thru loading mode
|
488 |
+
|
489 |
= 4.0.2 (2021-12-17) =
|
490 |
* `[Fixed]` Fetching large list of files to conversion
|
491 |
* `[Fixed]` Rewrites caching for some servers
|
src/Conversion/Directory/DirectoryAbstract.php
CHANGED
@@ -7,6 +7,15 @@ namespace WebpConverter\Conversion\Directory;
|
|
7 |
*/
|
8 |
abstract class DirectoryAbstract implements DirectoryInterface {
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
/**
|
11 |
* {@inheritdoc}
|
12 |
*/
|
@@ -32,9 +41,8 @@ abstract class DirectoryAbstract implements DirectoryInterface {
|
|
32 |
* {@inheritdoc}
|
33 |
*/
|
34 |
public function get_server_path(): string {
|
35 |
-
$source_path = apply_filters( 'webpc_site_root', realpath( ABSPATH ) );
|
36 |
$directory_name = apply_filters( 'webpc_dir_name', $this->get_relative_path(), $this->get_type() );
|
37 |
-
return sprintf( '%1$s/%2$s', $
|
38 |
}
|
39 |
|
40 |
/**
|
7 |
*/
|
8 |
abstract class DirectoryAbstract implements DirectoryInterface {
|
9 |
|
10 |
+
/**
|
11 |
+
* @var PathsGenerator
|
12 |
+
*/
|
13 |
+
protected $paths_generator;
|
14 |
+
|
15 |
+
public function __construct( PathsGenerator $paths_generator ) {
|
16 |
+
$this->paths_generator = $paths_generator;
|
17 |
+
}
|
18 |
+
|
19 |
/**
|
20 |
* {@inheritdoc}
|
21 |
*/
|
41 |
* {@inheritdoc}
|
42 |
*/
|
43 |
public function get_server_path(): string {
|
|
|
44 |
$directory_name = apply_filters( 'webpc_dir_name', $this->get_relative_path(), $this->get_type() );
|
45 |
+
return sprintf( '%1$s/%2$s', $this->paths_generator->get_wordpress_root_path(), $directory_name );
|
46 |
}
|
47 |
|
48 |
/**
|
src/Conversion/Directory/DirectoryFactory.php
CHANGED
@@ -10,6 +10,11 @@ use WebpConverter\Plugin\Uninstall\WebpFiles;
|
|
10 |
*/
|
11 |
class DirectoryFactory implements HookableInterface {
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* Object of directories integration.
|
15 |
*
|
@@ -17,12 +22,14 @@ class DirectoryFactory implements HookableInterface {
|
|
17 |
*/
|
18 |
private $directories_integration;
|
19 |
|
20 |
-
public function __construct() {
|
21 |
-
$this->
|
22 |
-
|
23 |
-
$this->set_integration( new
|
24 |
-
$this->set_integration( new
|
25 |
-
$this->set_integration( new
|
|
|
|
|
26 |
}
|
27 |
|
28 |
/**
|
@@ -34,7 +41,7 @@ class DirectoryFactory implements HookableInterface {
|
|
34 |
*/
|
35 |
private function set_integration( DirectoryInterface $directory ) {
|
36 |
if ( $this->directories_integration === null ) {
|
37 |
-
$this->directories_integration = new DirectoryIntegration();
|
38 |
}
|
39 |
$this->directories_integration->add_directory( $directory );
|
40 |
}
|
10 |
*/
|
11 |
class DirectoryFactory implements HookableInterface {
|
12 |
|
13 |
+
/**
|
14 |
+
* @var PathsGenerator
|
15 |
+
*/
|
16 |
+
private $paths_generator;
|
17 |
+
|
18 |
/**
|
19 |
* Object of directories integration.
|
20 |
*
|
22 |
*/
|
23 |
private $directories_integration;
|
24 |
|
25 |
+
public function __construct( PathsGenerator $paths_generator = null ) {
|
26 |
+
$this->paths_generator = $paths_generator ?: new PathsGenerator();
|
27 |
+
|
28 |
+
$this->set_integration( new GalleryDirectory( $this->paths_generator ) );
|
29 |
+
$this->set_integration( new PluginsDirectory( $this->paths_generator ) );
|
30 |
+
$this->set_integration( new ThemesDirectory( $this->paths_generator ) );
|
31 |
+
$this->set_integration( new UploadsDirectory( $this->paths_generator ) );
|
32 |
+
$this->set_integration( new UploadsWebpcDirectory( $this->paths_generator ) );
|
33 |
}
|
34 |
|
35 |
/**
|
41 |
*/
|
42 |
private function set_integration( DirectoryInterface $directory ) {
|
43 |
if ( $this->directories_integration === null ) {
|
44 |
+
$this->directories_integration = new DirectoryIntegration( $this->paths_generator );
|
45 |
}
|
46 |
$this->directories_integration->add_directory( $directory );
|
47 |
}
|
src/Conversion/Directory/DirectoryIntegration.php
CHANGED
@@ -10,6 +10,11 @@ use WebpConverter\HookableInterface;
|
|
10 |
*/
|
11 |
class DirectoryIntegration implements HookableInterface {
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* Objects of supported directories.
|
15 |
*
|
@@ -17,6 +22,10 @@ class DirectoryIntegration implements HookableInterface {
|
|
17 |
*/
|
18 |
private $directories = [];
|
19 |
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* {@inheritdoc}
|
22 |
*/
|
@@ -106,8 +115,7 @@ class DirectoryIntegration implements HookableInterface {
|
|
106 |
}
|
107 |
}
|
108 |
|
109 |
-
|
110 |
-
return sprintf( '%1$s/%2$s', $source_path, $directory_name );
|
111 |
}
|
112 |
|
113 |
/**
|
@@ -140,10 +148,10 @@ class DirectoryIntegration implements HookableInterface {
|
|
140 |
* @internal
|
141 |
*/
|
142 |
public function get_prefix_path(): string {
|
143 |
-
$
|
144 |
-
$
|
145 |
-
$diff_dir
|
146 |
-
$diff_path
|
147 |
|
148 |
return str_replace( '//', '/', $diff_path );
|
149 |
}
|
10 |
*/
|
11 |
class DirectoryIntegration implements HookableInterface {
|
12 |
|
13 |
+
/**
|
14 |
+
* @var PathsGenerator
|
15 |
+
*/
|
16 |
+
private $paths_generator;
|
17 |
+
|
18 |
/**
|
19 |
* Objects of supported directories.
|
20 |
*
|
22 |
*/
|
23 |
private $directories = [];
|
24 |
|
25 |
+
public function __construct( PathsGenerator $paths_generator ) {
|
26 |
+
$this->paths_generator = $paths_generator;
|
27 |
+
}
|
28 |
+
|
29 |
/**
|
30 |
* {@inheritdoc}
|
31 |
*/
|
115 |
}
|
116 |
}
|
117 |
|
118 |
+
return sprintf( '%1$s/%2$s', $this->paths_generator->get_wordpress_root_path(), $directory_name );
|
|
|
119 |
}
|
120 |
|
121 |
/**
|
148 |
* @internal
|
149 |
*/
|
150 |
public function get_prefix_path(): string {
|
151 |
+
$document_root = realpath( $_SERVER['DOCUMENT_ROOT'] ) ?: ''; // phpcs:ignore
|
152 |
+
$root_directory = $this->paths_generator->get_wordpress_root_path();
|
153 |
+
$diff_dir = trim( str_replace( $document_root, '', $root_directory ), '\/' );
|
154 |
+
$diff_path = sprintf( '/%s/', $diff_dir );
|
155 |
|
156 |
return str_replace( '//', '/', $diff_path );
|
157 |
}
|
src/Conversion/Directory/DirectoryInterface.php
CHANGED
@@ -10,49 +10,49 @@ interface DirectoryInterface {
|
|
10 |
/**
|
11 |
* Returns type of directory.
|
12 |
*
|
13 |
-
* @return string
|
14 |
*/
|
15 |
public function get_type(): string;
|
16 |
|
17 |
/**
|
18 |
* Returns label of directory.
|
19 |
*
|
20 |
-
* @return string
|
21 |
*/
|
22 |
public function get_label(): string;
|
23 |
|
24 |
/**
|
25 |
* Returns status if directory is available.
|
26 |
*
|
27 |
-
* @return bool
|
28 |
*/
|
29 |
public function is_available(): bool;
|
30 |
|
31 |
/**
|
32 |
* Returns status if directory is destined for output.
|
33 |
*
|
34 |
-
* @return bool
|
35 |
*/
|
36 |
public function is_output_directory(): bool;
|
37 |
|
38 |
/**
|
39 |
* Returns relative path of directory.
|
40 |
*
|
41 |
-
* @return string
|
42 |
*/
|
43 |
public function get_relative_path(): string;
|
44 |
|
45 |
/**
|
46 |
* Returns server path of directory.
|
47 |
*
|
48 |
-
* @return string
|
49 |
*/
|
50 |
public function get_server_path(): string;
|
51 |
|
52 |
/**
|
53 |
* Returns URL of directory.
|
54 |
*
|
55 |
-
* @return string
|
56 |
*/
|
57 |
public function get_path_url(): string;
|
58 |
}
|
10 |
/**
|
11 |
* Returns type of directory.
|
12 |
*
|
13 |
+
* @return string
|
14 |
*/
|
15 |
public function get_type(): string;
|
16 |
|
17 |
/**
|
18 |
* Returns label of directory.
|
19 |
*
|
20 |
+
* @return string
|
21 |
*/
|
22 |
public function get_label(): string;
|
23 |
|
24 |
/**
|
25 |
* Returns status if directory is available.
|
26 |
*
|
27 |
+
* @return bool
|
28 |
*/
|
29 |
public function is_available(): bool;
|
30 |
|
31 |
/**
|
32 |
* Returns status if directory is destined for output.
|
33 |
*
|
34 |
+
* @return bool
|
35 |
*/
|
36 |
public function is_output_directory(): bool;
|
37 |
|
38 |
/**
|
39 |
* Returns relative path of directory.
|
40 |
*
|
41 |
+
* @return string
|
42 |
*/
|
43 |
public function get_relative_path(): string;
|
44 |
|
45 |
/**
|
46 |
* Returns server path of directory.
|
47 |
*
|
48 |
+
* @return string
|
49 |
*/
|
50 |
public function get_server_path(): string;
|
51 |
|
52 |
/**
|
53 |
* Returns URL of directory.
|
54 |
*
|
55 |
+
* @return string
|
56 |
*/
|
57 |
public function get_path_url(): string;
|
58 |
}
|
src/Conversion/Directory/PathsGenerator.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Conversion\Directory;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Manages generation of server paths.
|
7 |
+
*/
|
8 |
+
class PathsGenerator {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Returns path to root directory of WordPress installation.
|
12 |
+
*/
|
13 |
+
public function get_wordpress_root_path(): string {
|
14 |
+
return apply_filters(
|
15 |
+
'webpc_site_root',
|
16 |
+
realpath( dirname( wp_upload_dir()['basedir'], 2 ) )
|
17 |
+
);
|
18 |
+
}
|
19 |
+
}
|
src/Conversion/Media/Upload.php
CHANGED
@@ -5,6 +5,7 @@ namespace WebpConverter\Conversion\Media;
|
|
5 |
use WebpConverter\HookableInterface;
|
6 |
use WebpConverter\PluginData;
|
7 |
use WebpConverter\Settings\Option\ExtraFeaturesOption;
|
|
|
8 |
|
9 |
/**
|
10 |
* Initializes image conversion when uploading images to media library.
|
@@ -49,6 +50,12 @@ class Upload implements HookableInterface {
|
|
49 |
return $data;
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
$paths = $this->get_sizes_paths( $data );
|
53 |
$paths = apply_filters( 'webpc_attachment_paths', $paths, $attachment_id );
|
54 |
|
5 |
use WebpConverter\HookableInterface;
|
6 |
use WebpConverter\PluginData;
|
7 |
use WebpConverter\Settings\Option\ExtraFeaturesOption;
|
8 |
+
use WebpConverter\Settings\Option\SupportedExtensionsOption;
|
9 |
|
10 |
/**
|
11 |
* Initializes image conversion when uploading images to media library.
|
50 |
return $data;
|
51 |
}
|
52 |
|
53 |
+
$allowed_extensions = $this->plugin_data->get_plugin_settings()[ SupportedExtensionsOption::OPTION_NAME ];
|
54 |
+
$file_extension = strtolower( pathinfo( $data['file'], PATHINFO_EXTENSION ) );
|
55 |
+
if ( ! in_array( $file_extension, $allowed_extensions ) ) {
|
56 |
+
return $data;
|
57 |
+
}
|
58 |
+
|
59 |
$paths = $this->get_sizes_paths( $data );
|
60 |
$paths = apply_filters( 'webpc_attachment_paths', $paths, $attachment_id );
|
61 |
|
src/Error/Detector/PathsErrorsDetector.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
namespace WebpConverter\Error\Detector;
|
4 |
|
|
|
5 |
use WebpConverter\Error\Notice\PathHtaccessNotWritableNotice;
|
6 |
use WebpConverter\Error\Notice\PathUploadsUnavailableNotice;
|
7 |
use WebpConverter\Error\Notice\PathWebpDuplicatedNotice;
|
@@ -12,6 +13,15 @@ use WebpConverter\Error\Notice\PathWebpNotWritableNotice;
|
|
12 |
*/
|
13 |
class PathsErrorsDetector implements ErrorDetector {
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* {@inheritdoc}
|
17 |
*/
|
@@ -36,7 +46,7 @@ class PathsErrorsDetector implements ErrorDetector {
|
|
36 |
*/
|
37 |
private function if_uploads_path_exists(): bool {
|
38 |
$path = apply_filters( 'webpc_dir_path', '', 'uploads' );
|
39 |
-
return ( is_dir( $path ) && ( $path !==
|
40 |
}
|
41 |
|
42 |
/**
|
2 |
|
3 |
namespace WebpConverter\Error\Detector;
|
4 |
|
5 |
+
use WebpConverter\Conversion\Directory\PathsGenerator;
|
6 |
use WebpConverter\Error\Notice\PathHtaccessNotWritableNotice;
|
7 |
use WebpConverter\Error\Notice\PathUploadsUnavailableNotice;
|
8 |
use WebpConverter\Error\Notice\PathWebpDuplicatedNotice;
|
13 |
*/
|
14 |
class PathsErrorsDetector implements ErrorDetector {
|
15 |
|
16 |
+
/**
|
17 |
+
* @var PathsGenerator
|
18 |
+
*/
|
19 |
+
private $paths_generator;
|
20 |
+
|
21 |
+
public function __construct( PathsGenerator $paths_generator = null ) {
|
22 |
+
$this->paths_generator = $paths_generator ?: new PathsGenerator();
|
23 |
+
}
|
24 |
+
|
25 |
/**
|
26 |
* {@inheritdoc}
|
27 |
*/
|
46 |
*/
|
47 |
private function if_uploads_path_exists(): bool {
|
48 |
$path = apply_filters( 'webpc_dir_path', '', 'uploads' );
|
49 |
+
return ( is_dir( $path ) && ( $path !== $this->paths_generator->get_wordpress_root_path() ) );
|
50 |
}
|
51 |
|
52 |
/**
|
src/Settings/Page/DebugPage.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
|
4 |
namespace WebpConverter\Settings\Page;
|
5 |
|
|
|
6 |
use WebpConverter\Error\Detector\RewritesErrorsDetector;
|
7 |
use WebpConverter\Loader\LoaderAbstract;
|
8 |
use WebpConverter\PluginData;
|
@@ -28,9 +29,19 @@ class DebugPage extends PageAbstract {
|
|
28 |
*/
|
29 |
private $file_loader;
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
/**
|
@@ -63,6 +74,7 @@ class DebugPage extends PageAbstract {
|
|
63 |
'%s&action=server',
|
64 |
PageIntegration::get_settings_page_url()
|
65 |
),
|
|
|
66 |
'size_png_path' => $this->file_loader->get_file_size_by_path(
|
67 |
$uploads_path . RewritesErrorsDetector::PATH_OUTPUT_FILE_PNG
|
68 |
),
|
3 |
|
4 |
namespace WebpConverter\Settings\Page;
|
5 |
|
6 |
+
use WebpConverter\Conversion\Directory\PathsGenerator;
|
7 |
use WebpConverter\Error\Detector\RewritesErrorsDetector;
|
8 |
use WebpConverter\Loader\LoaderAbstract;
|
9 |
use WebpConverter\PluginData;
|
29 |
*/
|
30 |
private $file_loader;
|
31 |
|
32 |
+
/**
|
33 |
+
* @var PathsGenerator
|
34 |
+
*/
|
35 |
+
private $paths_generator;
|
36 |
+
|
37 |
+
public function __construct(
|
38 |
+
PluginInfo $plugin_info, PluginData $plugin_data,
|
39 |
+
FileLoader $file_loader = null,
|
40 |
+
PathsGenerator $paths_generator = null
|
41 |
+
) {
|
42 |
+
$this->plugin_info = $plugin_info;
|
43 |
+
$this->file_loader = $file_loader ?: new FileLoader( $plugin_info, $plugin_data );
|
44 |
+
$this->paths_generator = $paths_generator ?: new PathsGenerator();
|
45 |
}
|
46 |
|
47 |
/**
|
74 |
'%s&action=server',
|
75 |
PageIntegration::get_settings_page_url()
|
76 |
),
|
77 |
+
'site_root_path' => $this->paths_generator->get_wordpress_root_path(),
|
78 |
'size_png_path' => $this->file_loader->get_file_size_by_path(
|
79 |
$uploads_path . RewritesErrorsDetector::PATH_OUTPUT_FILE_PNG
|
80 |
),
|
templates/components/server/filters.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
/**
|
3 |
* Information about using filters displayed in server configuration widget.
|
4 |
*
|
|
|
5 |
* @package WebP Converter for Media
|
6 |
*/
|
7 |
|
@@ -12,7 +13,7 @@
|
|
12 |
<tr>
|
13 |
<td class="e">webpc_site_root</td>
|
14 |
<td class="v">
|
15 |
-
<?php echo esc_html( apply_filters( 'webpc_site_root',
|
16 |
</td>
|
17 |
</tr>
|
18 |
<tr>
|
2 |
/**
|
3 |
* Information about using filters displayed in server configuration widget.
|
4 |
*
|
5 |
+
* @var string $site_root_path Root path of WordPress installation.
|
6 |
* @package WebP Converter for Media
|
7 |
*/
|
8 |
|
13 |
<tr>
|
14 |
<td class="e">webpc_site_root</td>
|
15 |
<td class="v">
|
16 |
+
<?php echo esc_html( apply_filters( 'webpc_site_root', $site_root_path ) ); ?>
|
17 |
</td>
|
18 |
</tr>
|
19 |
<tr>
|
templates/components/server/wordpress.php
CHANGED
@@ -15,5 +15,11 @@
|
|
15 |
<?php echo esc_html( ABSPATH ); ?>
|
16 |
</td>
|
17 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
</tbody>
|
19 |
</table>
|
15 |
<?php echo esc_html( ABSPATH ); ?>
|
16 |
</td>
|
17 |
</tr>
|
18 |
+
<tr>
|
19 |
+
<td class="e">wp_upload_dir <em>(basedir)</em></td>
|
20 |
+
<td class="v">
|
21 |
+
<?php echo esc_html( wp_upload_dir()['basedir'] ); ?>
|
22 |
+
</td>
|
23 |
+
</tr>
|
24 |
</tbody>
|
25 |
</table>
|
templates/components/widgets/server.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
* Widget displayed server configuration on plugin settings page.
|
4 |
*
|
5 |
* @var string $settings_url URL of plugin settings page.
|
|
|
6 |
* @var string $size_png_path Size of file.
|
7 |
* @var string $size_png2_path Size of file.
|
8 |
* @var string $size_png_url Size of file.
|
3 |
* Widget displayed server configuration on plugin settings page.
|
4 |
*
|
5 |
* @var string $settings_url URL of plugin settings page.
|
6 |
+
* @var string $site_root_path Root path of WordPress installation.
|
7 |
* @var string $size_png_path Size of file.
|
8 |
* @var string $size_png2_path Size of file.
|
9 |
* @var string $size_png_url Size of file.
|
templates/views/settings-debug.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
* Debug tab of plugin settings page.
|
4 |
*
|
5 |
* @var string $settings_url URL of plugin settings page (default view).
|
|
|
6 |
* @var string $size_png_path Size of file.
|
7 |
* @var string $size_png2_path Size of file.
|
8 |
* @var string $size_png_url Size of file.
|
3 |
* Debug tab of plugin settings page.
|
4 |
*
|
5 |
* @var string $settings_url URL of plugin settings page (default view).
|
6 |
+
* @var string $site_root_path Root path of WordPress installation.
|
7 |
* @var string $size_png_path Size of file.
|
8 |
* @var string $size_png2_path Size of file.
|
9 |
* @var string $size_png_url Size of file.
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -19,6 +19,7 @@ return array(
|
|
19 |
'WebpConverter\\Conversion\\Directory\\DirectoryIntegration' => $baseDir . '/src/Conversion/Directory/DirectoryIntegration.php',
|
20 |
'WebpConverter\\Conversion\\Directory\\DirectoryInterface' => $baseDir . '/src/Conversion/Directory/DirectoryInterface.php',
|
21 |
'WebpConverter\\Conversion\\Directory\\GalleryDirectory' => $baseDir . '/src/Conversion/Directory/GalleryDirectory.php',
|
|
|
22 |
'WebpConverter\\Conversion\\Directory\\PluginsDirectory' => $baseDir . '/src/Conversion/Directory/PluginsDirectory.php',
|
23 |
'WebpConverter\\Conversion\\Directory\\ThemesDirectory' => $baseDir . '/src/Conversion/Directory/ThemesDirectory.php',
|
24 |
'WebpConverter\\Conversion\\Directory\\UploadsDirectory' => $baseDir . '/src/Conversion/Directory/UploadsDirectory.php',
|
19 |
'WebpConverter\\Conversion\\Directory\\DirectoryIntegration' => $baseDir . '/src/Conversion/Directory/DirectoryIntegration.php',
|
20 |
'WebpConverter\\Conversion\\Directory\\DirectoryInterface' => $baseDir . '/src/Conversion/Directory/DirectoryInterface.php',
|
21 |
'WebpConverter\\Conversion\\Directory\\GalleryDirectory' => $baseDir . '/src/Conversion/Directory/GalleryDirectory.php',
|
22 |
+
'WebpConverter\\Conversion\\Directory\\PathsGenerator' => $baseDir . '/src/Conversion/Directory/PathsGenerator.php',
|
23 |
'WebpConverter\\Conversion\\Directory\\PluginsDirectory' => $baseDir . '/src/Conversion/Directory/PluginsDirectory.php',
|
24 |
'WebpConverter\\Conversion\\Directory\\ThemesDirectory' => $baseDir . '/src/Conversion/Directory/ThemesDirectory.php',
|
25 |
'WebpConverter\\Conversion\\Directory\\UploadsDirectory' => $baseDir . '/src/Conversion/Directory/UploadsDirectory.php',
|
vendor/composer/autoload_static.php
CHANGED
@@ -34,6 +34,7 @@ class ComposerStaticInit80287993f128e7a857f0f2db132eda4f
|
|
34 |
'WebpConverter\\Conversion\\Directory\\DirectoryIntegration' => __DIR__ . '/../..' . '/src/Conversion/Directory/DirectoryIntegration.php',
|
35 |
'WebpConverter\\Conversion\\Directory\\DirectoryInterface' => __DIR__ . '/../..' . '/src/Conversion/Directory/DirectoryInterface.php',
|
36 |
'WebpConverter\\Conversion\\Directory\\GalleryDirectory' => __DIR__ . '/../..' . '/src/Conversion/Directory/GalleryDirectory.php',
|
|
|
37 |
'WebpConverter\\Conversion\\Directory\\PluginsDirectory' => __DIR__ . '/../..' . '/src/Conversion/Directory/PluginsDirectory.php',
|
38 |
'WebpConverter\\Conversion\\Directory\\ThemesDirectory' => __DIR__ . '/../..' . '/src/Conversion/Directory/ThemesDirectory.php',
|
39 |
'WebpConverter\\Conversion\\Directory\\UploadsDirectory' => __DIR__ . '/../..' . '/src/Conversion/Directory/UploadsDirectory.php',
|
34 |
'WebpConverter\\Conversion\\Directory\\DirectoryIntegration' => __DIR__ . '/../..' . '/src/Conversion/Directory/DirectoryIntegration.php',
|
35 |
'WebpConverter\\Conversion\\Directory\\DirectoryInterface' => __DIR__ . '/../..' . '/src/Conversion/Directory/DirectoryInterface.php',
|
36 |
'WebpConverter\\Conversion\\Directory\\GalleryDirectory' => __DIR__ . '/../..' . '/src/Conversion/Directory/GalleryDirectory.php',
|
37 |
+
'WebpConverter\\Conversion\\Directory\\PathsGenerator' => __DIR__ . '/../..' . '/src/Conversion/Directory/PathsGenerator.php',
|
38 |
'WebpConverter\\Conversion\\Directory\\PluginsDirectory' => __DIR__ . '/../..' . '/src/Conversion/Directory/PluginsDirectory.php',
|
39 |
'WebpConverter\\Conversion\\Directory\\ThemesDirectory' => __DIR__ . '/../..' . '/src/Conversion/Directory/ThemesDirectory.php',
|
40 |
'WebpConverter\\Conversion\\Directory\\UploadsDirectory' => __DIR__ . '/../..' . '/src/Conversion/Directory/UploadsDirectory.php',
|
webp-converter-for-media.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
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.
|
6 |
-
* Version: 4.0.
|
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.0.
|
17 |
);
|
2 |
|
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.0.3
|
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.0.3' )
|
17 |
);
|