Version Description
(2020-04-05) =
* [Changed]
Moving rules from .htaccess file in root directory of WordPress to /wp-content/uploads
directory
* [Added]
Ability to disable automatic removal of WebP files larger than original
* [Added]
Error validation for a non-writable .htaccess file
* [Added]
Filter webpc_uploads_root
to change path for root installation directory of WordPress
Download this release
Release Info
Developer | mateuszgbiorczyk |
Plugin | Converter for Media – Optimize images | Convert WebP & AVIF |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.2.0
- app/Admin/Activation.php +3 -3
- app/Admin/Deactivation.php +1 -0
- app/Admin/Notice.php +4 -4
- app/Admin/Uninstall.php +2 -1
- app/Admin/Update.php +47 -0
- app/Admin/_Core.php +1 -0
- app/Convert/Directory.php +2 -2
- app/Convert/Gd.php +1 -0
- app/Media/Htaccess.php +34 -19
- app/Regenerate/Regenerate.php +2 -1
- app/Settings/Errors.php +15 -6
- app/Settings/Options.php +2 -1
- app/Settings/Paths.php +15 -11
- app/Settings/Save.php +1 -1
- app/Settings/Values.php +1 -1
- readme.txt +109 -40
- resources/components/widgets/errors.php +8 -0
- webp-converter-for-media.php +2 -2
app/Admin/Activation.php
CHANGED
@@ -30,13 +30,13 @@
|
|
30 |
|
31 |
public function addDefaultOptions()
|
32 |
{
|
33 |
-
if (get_option('webpc_notice_hidden', false)
|
34 |
-
|
35 |
-
}
|
36 |
}
|
37 |
|
38 |
public function refreshRewriteRules()
|
39 |
{
|
|
|
40 |
flush_rewrite_rules(true);
|
41 |
}
|
42 |
}
|
30 |
|
31 |
public function addDefaultOptions()
|
32 |
{
|
33 |
+
if (get_option('webpc_notice_hidden', false) !== false) return;
|
34 |
+
add_option('webpc_notice_hidden', strtotime('+ 1 week'));
|
|
|
35 |
}
|
36 |
|
37 |
public function refreshRewriteRules()
|
38 |
{
|
39 |
+
do_action('webpc_rewrite_htaccess', true);
|
40 |
flush_rewrite_rules(true);
|
41 |
}
|
42 |
}
|
app/Admin/Deactivation.php
CHANGED
@@ -15,6 +15,7 @@
|
|
15 |
|
16 |
public function refreshRewriteRules()
|
17 |
{
|
|
|
18 |
flush_rewrite_rules(true);
|
19 |
}
|
20 |
}
|
15 |
|
16 |
public function refreshRewriteRules()
|
17 |
{
|
18 |
+
do_action('webpc_rewrite_htaccess', false);
|
19 |
flush_rewrite_rules(true);
|
20 |
}
|
21 |
}
|
app/Admin/Notice.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
class Notice
|
6 |
{
|
7 |
-
private $
|
8 |
|
9 |
public function __construct()
|
10 |
{
|
@@ -26,7 +26,7 @@
|
|
26 |
public function showAdminNotice()
|
27 |
{
|
28 |
if (($_SERVER['PHP_SELF'] !== '/wp-admin/index.php') ||
|
29 |
-
(get_option($this->
|
30 |
|
31 |
require_once WEBPC_PATH . 'resources/components/notices/thanks.php';
|
32 |
}
|
@@ -41,7 +41,7 @@
|
|
41 |
|
42 |
public function saveOption($value)
|
43 |
{
|
44 |
-
if (get_option($this->
|
45 |
-
else add_option($this->
|
46 |
}
|
47 |
}
|
4 |
|
5 |
class Notice
|
6 |
{
|
7 |
+
private $optionKey = 'webpc_notice_hidden';
|
8 |
|
9 |
public function __construct()
|
10 |
{
|
26 |
public function showAdminNotice()
|
27 |
{
|
28 |
if (($_SERVER['PHP_SELF'] !== '/wp-admin/index.php') ||
|
29 |
+
(get_option($this->optionKey, 0) >= time())) return;
|
30 |
|
31 |
require_once WEBPC_PATH . 'resources/components/notices/thanks.php';
|
32 |
}
|
41 |
|
42 |
public function saveOption($value)
|
43 |
{
|
44 |
+
if (get_option($this->optionKey, false) !== false) update_option($this->optionKey, $value);
|
45 |
+
else add_option($this->optionKey, $value);
|
46 |
}
|
47 |
}
|
app/Admin/Uninstall.php
CHANGED
@@ -17,13 +17,14 @@
|
|
17 |
{
|
18 |
delete_option('webpc_settings');
|
19 |
delete_option('webpc_notice_hidden');
|
|
|
20 |
|
21 |
self::removeWebpFiles();
|
22 |
}
|
23 |
|
24 |
public static function removeWebpFiles()
|
25 |
{
|
26 |
-
$path =
|
27 |
$paths = self::getPathsFromLocation($path);
|
28 |
$paths[] = $path;
|
29 |
self::removeFiles($paths);
|
17 |
{
|
18 |
delete_option('webpc_settings');
|
19 |
delete_option('webpc_notice_hidden');
|
20 |
+
delete_option('webpc_latest_version');
|
21 |
|
22 |
self::removeWebpFiles();
|
23 |
}
|
24 |
|
25 |
public static function removeWebpFiles()
|
26 |
{
|
27 |
+
$path = apply_filters('webpc_uploads_webp', '');
|
28 |
$paths = self::getPathsFromLocation($path);
|
29 |
$paths[] = $path;
|
30 |
self::removeFiles($paths);
|
app/Admin/Update.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WebpConverter\Admin;
|
4 |
+
|
5 |
+
class Update
|
6 |
+
{
|
7 |
+
private $optionVersion = 'webpc_latest_version';
|
8 |
+
private $optionSettings = 'webpc_settings';
|
9 |
+
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
add_action('admin_init', [$this, 'runActionsAfterUpdate']);
|
13 |
+
}
|
14 |
+
|
15 |
+
/* ---
|
16 |
+
Functions
|
17 |
+
--- */
|
18 |
+
|
19 |
+
public function runActionsAfterUpdate()
|
20 |
+
{
|
21 |
+
$version = get_option($this->optionVersion, '0.0.0');
|
22 |
+
if ($version === WEBPC_VERSION) return;
|
23 |
+
|
24 |
+
$this->saveOptionValue($this->optionSettings, $this->updateSettingsForOldVersions($version));
|
25 |
+
$this->saveOptionValue($this->optionVersion, WEBPC_VERSION);
|
26 |
+
|
27 |
+
do_action('webpc_rewrite_htaccess', true);
|
28 |
+
flush_rewrite_rules(true);
|
29 |
+
}
|
30 |
+
|
31 |
+
private function updateSettingsForOldVersions($version)
|
32 |
+
{
|
33 |
+
$settings = apply_filters('webpc_get_values', []);
|
34 |
+
|
35 |
+
if (version_compare($version, '1.1.2', '>')) return $settings;
|
36 |
+
$settings['features'][] = 'only_smaller';
|
37 |
+
|
38 |
+
$settings['features'] = array_unique($settings['features']);
|
39 |
+
return $settings;
|
40 |
+
}
|
41 |
+
|
42 |
+
private function saveOptionValue($optionKey, $value)
|
43 |
+
{
|
44 |
+
if (get_option($optionKey, false) !== false) update_option($optionKey, $value);
|
45 |
+
else add_option($optionKey, $value);
|
46 |
+
}
|
47 |
+
}
|
app/Admin/_Core.php
CHANGED
@@ -12,5 +12,6 @@
|
|
12 |
new Notice();
|
13 |
new Plugin();
|
14 |
new Uninstall();
|
|
|
15 |
}
|
16 |
}
|
12 |
new Notice();
|
13 |
new Plugin();
|
14 |
new Uninstall();
|
15 |
+
new Update();
|
16 |
}
|
17 |
}
|
app/Convert/Directory.php
CHANGED
@@ -10,8 +10,8 @@
|
|
10 |
|
11 |
public function getPath($path, $createDirectory = false)
|
12 |
{
|
13 |
-
$pathSource = apply_filters('webpc_uploads_path', '');
|
14 |
-
$pathOutput = apply_filters('webpc_uploads_webp', '');
|
15 |
$newPath = str_replace("/${pathSource}/", "/${pathOutput}/", $path) . '.webp';
|
16 |
if (!$createDirectory) return $newPath;
|
17 |
|
10 |
|
11 |
public function getPath($path, $createDirectory = false)
|
12 |
{
|
13 |
+
$pathSource = apply_filters('webpc_uploads_path', '', true);
|
14 |
+
$pathOutput = apply_filters('webpc_uploads_webp', '', true);
|
15 |
$newPath = str_replace("/${pathSource}/", "/${pathOutput}/", $path) . '.webp';
|
16 |
if (!$createDirectory) return $newPath;
|
17 |
|
app/Convert/Gd.php
CHANGED
@@ -115,6 +115,7 @@
|
|
115 |
throw new \Exception(sprintf('Error occurred while converting image: "%s".', $path));
|
116 |
}
|
117 |
|
|
|
118 |
return [
|
119 |
'success' => true,
|
120 |
'data' => [
|
115 |
throw new \Exception(sprintf('Error occurred while converting image: "%s".', $path));
|
116 |
}
|
117 |
|
118 |
+
if (filesize($output) % 2 === 1) file_put_contents($output, "\0", FILE_APPEND);
|
119 |
return [
|
120 |
'success' => true,
|
121 |
'data' => [
|
app/Media/Htaccess.php
CHANGED
@@ -6,28 +6,32 @@
|
|
6 |
{
|
7 |
public function __construct()
|
8 |
{
|
9 |
-
|
10 |
}
|
11 |
|
12 |
/* ---
|
13 |
Functions
|
14 |
--- */
|
15 |
|
16 |
-
public function addRewriteRules($
|
17 |
{
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
$values = apply_filters('webpc_get_values', []);
|
22 |
$rows = [];
|
23 |
-
|
24 |
$rows[] = $this->getModMimeRules($values);
|
25 |
$rows[] = $this->getModRewriteRules($values);
|
26 |
$rows[] = $this->getModExpiresRules($values);
|
|
|
27 |
|
28 |
-
$rows = array_filter($rows);
|
29 |
$content = $this->addCommentsToRules($rows);
|
30 |
-
return $content
|
31 |
}
|
32 |
|
33 |
private function getModMimeRules($settings)
|
@@ -48,16 +52,15 @@
|
|
48 |
$content = '';
|
49 |
if (!$settings['extensions']) return $content;
|
50 |
|
51 |
-
$
|
52 |
-
$
|
53 |
-
$pathOutput = apply_filters('webpc_uploads_webp', '');
|
54 |
|
55 |
$content .= '<IfModule mod_rewrite.c>' . PHP_EOL;
|
56 |
$content .= ' RewriteEngine On' . PHP_EOL;
|
57 |
foreach ($settings['extensions'] as $ext) {
|
58 |
$content .= ' RewriteCond %{HTTP_ACCEPT} image/webp' . PHP_EOL;
|
59 |
-
$content .= " RewriteCond %{DOCUMENT_ROOT}${
|
60 |
-
$content .= " RewriteRule
|
61 |
}
|
62 |
$content .= '</IfModule>';
|
63 |
|
@@ -81,18 +84,30 @@
|
|
81 |
|
82 |
private function addCommentsToRules($rules)
|
83 |
{
|
84 |
-
|
85 |
-
if (!$rules) return $content;
|
86 |
|
87 |
$rows = [];
|
88 |
-
$rows[] =
|
89 |
$rows[] = '# BEGIN WebP Converter';
|
|
|
90 |
$rows = array_merge($rows, $rules);
|
|
|
91 |
$rows[] = '# END WebP Converter';
|
92 |
-
$rows[] =
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
}
|
6 |
{
|
7 |
public function __construct()
|
8 |
{
|
9 |
+
add_action('webpc_rewrite_htaccess', [$this, 'addRewriteRules'], 10, 1);
|
10 |
}
|
11 |
|
12 |
/* ---
|
13 |
Functions
|
14 |
--- */
|
15 |
|
16 |
+
public function addRewriteRules($isActive)
|
17 |
{
|
18 |
+
$rules = $this->getRewriteRules($isActive);
|
19 |
+
$this->saveRewritesInUploads($rules);
|
20 |
+
}
|
21 |
+
|
22 |
+
private function getRewriteRules($isActive)
|
23 |
+
{
|
24 |
+
if (!$isActive) return '';
|
25 |
|
26 |
$values = apply_filters('webpc_get_values', []);
|
27 |
$rows = [];
|
|
|
28 |
$rows[] = $this->getModMimeRules($values);
|
29 |
$rows[] = $this->getModRewriteRules($values);
|
30 |
$rows[] = $this->getModExpiresRules($values);
|
31 |
+
$rows = array_filter($rows);
|
32 |
|
|
|
33 |
$content = $this->addCommentsToRules($rows);
|
34 |
+
return apply_filters('webpc_htaccess_rules', $content);
|
35 |
}
|
36 |
|
37 |
private function getModMimeRules($settings)
|
52 |
$content = '';
|
53 |
if (!$settings['extensions']) return $content;
|
54 |
|
55 |
+
$path = apply_filters('webpc_uploads_prefix', parse_url(site_url('/'), PHP_URL_PATH));
|
56 |
+
$path .= apply_filters('webpc_uploads_webp', '', true);
|
|
|
57 |
|
58 |
$content .= '<IfModule mod_rewrite.c>' . PHP_EOL;
|
59 |
$content .= ' RewriteEngine On' . PHP_EOL;
|
60 |
foreach ($settings['extensions'] as $ext) {
|
61 |
$content .= ' RewriteCond %{HTTP_ACCEPT} image/webp' . PHP_EOL;
|
62 |
+
$content .= " RewriteCond %{DOCUMENT_ROOT}${path}/$1.${ext}.webp -f" . PHP_EOL;
|
63 |
+
$content .= " RewriteRule (.+)\.${ext}$ ${path}/$1.${ext}.webp [T=image/webp]" . PHP_EOL;
|
64 |
}
|
65 |
$content .= '</IfModule>';
|
66 |
|
84 |
|
85 |
private function addCommentsToRules($rules)
|
86 |
{
|
87 |
+
if (!$rules) return '';
|
|
|
88 |
|
89 |
$rows = [];
|
90 |
+
$rows[] = '';
|
91 |
$rows[] = '# BEGIN WebP Converter';
|
92 |
+
$rows[] = '# ! --- DO NOT EDIT PREVIOUS LINE --- !';
|
93 |
$rows = array_merge($rows, $rules);
|
94 |
+
$rows[] = '# ! --- DO NOT EDIT NEXT LINE --- !';
|
95 |
$rows[] = '# END WebP Converter';
|
96 |
+
$rows[] = '';
|
97 |
|
98 |
+
return implode(PHP_EOL, $rows);
|
99 |
+
}
|
100 |
+
|
101 |
+
private function saveRewritesInUploads($rules)
|
102 |
+
{
|
103 |
+
$pathDir = apply_filters('webpc_uploads_path', '');
|
104 |
+
$pathFile = $pathDir . '/.htaccess';
|
105 |
+
|
106 |
+
$code = (is_readable($pathFile)) ? file_get_contents($pathFile) : '';
|
107 |
+
$code = preg_replace('/((:?[\r\n|\r|\n]?)# BEGIN WebP Converter(.*?)# END WebP Converter(:?(:?[\r\n|\r|\n]+)?))/s', '', $code);
|
108 |
+
if ($rules && $code) $code = PHP_EOL . $code;
|
109 |
+
$code = $rules . $code;
|
110 |
+
|
111 |
+
if (is_writable($pathDir)) file_put_contents($pathFile, $code);
|
112 |
}
|
113 |
}
|
app/Regenerate/Regenerate.php
CHANGED
@@ -23,7 +23,8 @@
|
|
23 |
|
24 |
foreach ($paths as $path) {
|
25 |
$response = $convert->convertImage($path, $settings['quality']);
|
26 |
-
if ($response['success'] &&
|
|
|
27 |
|
28 |
if ($response['success'] !== true) {
|
29 |
$errors[] = $response['message'];
|
23 |
|
24 |
foreach ($paths as $path) {
|
25 |
$response = $convert->convertImage($path, $settings['quality']);
|
26 |
+
if ($response['success'] && (in_array('only_smaller', $settings['features'])
|
27 |
+
&& !$this->checkFileSize($response['data']))) continue;
|
28 |
|
29 |
if ($response['success'] !== true) {
|
30 |
$errors[] = $response['message'];
|
app/Settings/Errors.php
CHANGED
@@ -16,23 +16,32 @@
|
|
16 |
public function getServerErrors()
|
17 |
{
|
18 |
$list = [
|
19 |
-
'path_uploads'
|
20 |
-
'
|
21 |
-
'
|
22 |
-
'
|
|
|
23 |
];
|
24 |
return array_keys(array_filter($list));
|
25 |
}
|
26 |
|
27 |
private function ifUploadsPathExists()
|
28 |
{
|
29 |
-
$path =
|
30 |
return (is_dir($path) && ($path !== ABSPATH));
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
private function ifWebpPathExists()
|
34 |
{
|
35 |
-
$path =
|
36 |
return ((is_dir($path) || is_writable(dirname($path))) && ($path !== ABSPATH));
|
37 |
}
|
38 |
|
16 |
public function getServerErrors()
|
17 |
{
|
18 |
$list = [
|
19 |
+
'path_uploads' => ($this->ifUploadsPathExists() !== true),
|
20 |
+
'path_htaccess' => ($this->ifHtaccessWriteAble() !== true),
|
21 |
+
'path_webp' => ($this->ifWebpPathExists() !== true),
|
22 |
+
'rest_api' => ($this->ifRestApiEnabled() !== true),
|
23 |
+
'methods' => ($this->ifMethodsAvailable() !== true),
|
24 |
];
|
25 |
return array_keys(array_filter($list));
|
26 |
}
|
27 |
|
28 |
private function ifUploadsPathExists()
|
29 |
{
|
30 |
+
$path = apply_filters('webpc_uploads_path', '');
|
31 |
return (is_dir($path) && ($path !== ABSPATH));
|
32 |
}
|
33 |
|
34 |
+
private function ifHtaccessWriteAble()
|
35 |
+
{
|
36 |
+
$pathDir = apply_filters('webpc_uploads_path', '');
|
37 |
+
$pathFile = $pathDir . '/.htaccess';
|
38 |
+
if (file_exists($pathFile)) return (is_readable($pathFile) && is_writable($pathFile));
|
39 |
+
else return is_writable($pathDir);
|
40 |
+
}
|
41 |
+
|
42 |
private function ifWebpPathExists()
|
43 |
{
|
44 |
+
$path = apply_filters('webpc_uploads_webp', '');
|
45 |
return ((is_dir($path) || is_writable(dirname($path))) && ($path !== ABSPATH));
|
46 |
}
|
47 |
|
app/Settings/Options.php
CHANGED
@@ -47,7 +47,8 @@
|
|
47 |
'label' => __('Extra features', 'webp-converter'),
|
48 |
'info' => __('The options allow you to enable new functionalities that will additionally speed up your website.', 'webp-converter'),
|
49 |
'values' => [
|
50 |
-
'
|
|
|
51 |
],
|
52 |
'disabled' => apply_filters('webpc_option_disabled', [], 'features'),
|
53 |
],
|
47 |
'label' => __('Extra features', 'webp-converter'),
|
48 |
'info' => __('The options allow you to enable new functionalities that will additionally speed up your website.', 'webp-converter'),
|
49 |
'values' => [
|
50 |
+
'only_smaller' => __('Automatic removal of WebP files larger than original', 'webp-converter'),
|
51 |
+
'mod_expires' => __('Browser Caching for WebP files (saving images in browser cache memory)', 'webp-converter'),
|
52 |
],
|
53 |
'disabled' => apply_filters('webpc_option_disabled', [], 'features'),
|
54 |
],
|
app/Settings/Paths.php
CHANGED
@@ -4,32 +4,36 @@
|
|
4 |
|
5 |
class Paths
|
6 |
{
|
7 |
-
private $
|
|
|
8 |
|
9 |
public function __construct()
|
10 |
{
|
11 |
-
add_filter('webpc_uploads_path', [$this, 'getSourcePath'], 0);
|
12 |
-
add_filter('webpc_uploads_webp', [$this, 'getOutputPath'], 0);
|
13 |
-
add_filter('webpc_uploads_path', [$this, 'parsePath'], 100);
|
14 |
-
add_filter('webpc_uploads_webp', [$this, 'parsePath'], 100);
|
15 |
}
|
16 |
|
17 |
/* ---
|
18 |
Functions
|
19 |
--- */
|
20 |
|
21 |
-
public function getSourcePath($value)
|
22 |
{
|
23 |
-
return $this->
|
24 |
}
|
25 |
|
26 |
-
public function getOutputPath($value)
|
27 |
{
|
28 |
-
return $this->
|
29 |
}
|
30 |
|
31 |
-
public function parsePath($value)
|
32 |
{
|
33 |
-
return trim($value, '\/');
|
|
|
|
|
|
|
34 |
}
|
35 |
}
|
4 |
|
5 |
class Paths
|
6 |
{
|
7 |
+
private $pathSource = 'wp-content/uploads';
|
8 |
+
private $pathOutput = 'wp-content/uploads-webpc';
|
9 |
|
10 |
public function __construct()
|
11 |
{
|
12 |
+
add_filter('webpc_uploads_path', [$this, 'getSourcePath'], 0, 2);
|
13 |
+
add_filter('webpc_uploads_webp', [$this, 'getOutputPath'], 0, 2);
|
14 |
+
add_filter('webpc_uploads_path', [$this, 'parsePath'], 100, 2);
|
15 |
+
add_filter('webpc_uploads_webp', [$this, 'parsePath'], 100, 2);
|
16 |
}
|
17 |
|
18 |
/* ---
|
19 |
Functions
|
20 |
--- */
|
21 |
|
22 |
+
public function getSourcePath($value, $skipRoot = false)
|
23 |
{
|
24 |
+
return $this->pathSource;
|
25 |
}
|
26 |
|
27 |
+
public function getOutputPath($value, $skipRoot = false)
|
28 |
{
|
29 |
+
return $this->pathOutput;
|
30 |
}
|
31 |
|
32 |
+
public function parsePath($value, $skipRoot = false)
|
33 |
{
|
34 |
+
if ($skipRoot) return trim($value, '\/');
|
35 |
+
|
36 |
+
$path = apply_filters('webpc_uploads_root', ABSPATH);
|
37 |
+
return $path . '/' . trim($value, '\/');
|
38 |
}
|
39 |
}
|
app/Settings/Save.php
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
|
21 |
$values = $this->getValues();
|
22 |
$this->saveOption('webpc_settings', $values);
|
23 |
-
|
24 |
}
|
25 |
|
26 |
private function getValues()
|
20 |
|
21 |
$values = $this->getValues();
|
22 |
$this->saveOption('webpc_settings', $values);
|
23 |
+
do_action('webpc_rewrite_htaccess', true);
|
24 |
}
|
25 |
|
26 |
private function getValues()
|
app/Settings/Values.php
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
$value = get_option('webpc_settings', [
|
24 |
'extensions' => ['jpg', 'jpeg', 'png'],
|
25 |
'method' => ($methods) ? $methods[0] : '',
|
26 |
-
'features' => ['mod_expires'],
|
27 |
'quality' => 85,
|
28 |
]);
|
29 |
$this->config = $value;
|
23 |
$value = get_option('webpc_settings', [
|
24 |
'extensions' => ['jpg', 'jpeg', 'png'],
|
25 |
'method' => ($methods) ? $methods[0] : '',
|
26 |
+
'features' => ['only_smaller', 'mod_expires'],
|
27 |
'quality' => 85,
|
28 |
]);
|
29 |
$this->config = $value;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mateuszgbiorczyk
|
|
3 |
Donate link: https://ko-fi.com/gbiorczyk/
|
4 |
Tags: webp, images, performance, compress, optimize
|
5 |
Requires at least: 5.0
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 7.0
|
8 |
Stable tag: trunk
|
9 |
License: GPLv2 or later
|
@@ -36,11 +36,17 @@ This will be a profit both for your users who will not have to download so much
|
|
36 |
|
37 |
Raise your website to a new level now! Install the plugin and enjoy the website that loads faster. Surely you and your users will appreciate it.
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
#### Please also read the FAQ below. Thank you for being with us!
|
40 |
|
41 |
== Installation ==
|
42 |
|
43 |
-
1. Upload the plugin files to `/wp-content/plugins/webp-converter-for-media
|
44 |
2. Activate plugin through `Plugins` screen in WordPress Admin Panel.
|
45 |
3. Use `Settings -> Settings -> WebP Converter` screen to configure the plugin.
|
46 |
4. Click on the button `Regenerate All`.
|
@@ -52,23 +58,29 @@ That's all! Your website is already loading faster!
|
|
52 |
|
53 |
= How to get technical support? (before you ask for help) =
|
54 |
|
55 |
-
We are happy to help you with any problem. Contact us about this matter.
|
56 |
-
|
57 |
Please always adding your thread, **read all other questions in the FAQ of plugin and other threads in support forum first**. Perhaps someone had a similar problem and it has been resolved.
|
58 |
|
59 |
-
This will save time repeating the same issues many times and solving the same problems.
|
60 |
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
When adding a thread, follow these steps and reply to each of them:
|
64 |
|
65 |
-
**1.**
|
66 |
|
67 |
-
**2.**
|
68 |
|
69 |
-
**3.** Do you use
|
70 |
|
71 |
-
**4.**
|
|
|
|
|
72 |
|
73 |
If not, please enable `WP_DEBUG_LOG` in your `wp-config.php` *(more about debugging: [https://codex.wordpress.org/WP_DEBUG](https://codex.wordpress.org/WP_DEBUG))*. That's what you should have in this file:
|
74 |
|
@@ -88,19 +100,13 @@ Then follow these steps:
|
|
88 |
|
89 |
Send a screenshot from console if an error occurred while converting images. Of you have errors in `/wp-content/debug.log` send their?
|
90 |
|
91 |
-
**
|
92 |
-
|
93 |
-
**6.** Configuration of your server *(link to it can be found on the settings page of plugin in the section **"We are waiting for your message"**)* - please take a screenshot of the ENTIRE page and send it to me.
|
94 |
-
|
95 |
-
Directly the URL path: `/wp-admin/options-general.php?page=webpc_admin_page&action=server`
|
96 |
-
|
97 |
-
**7.** Content of your `.htaccess` file.
|
98 |
|
99 |
-
**
|
100 |
|
101 |
-
Please remember to include the answers for all
|
102 |
|
103 |
-
And
|
104 |
|
105 |
= What are requirements of plugin? =
|
106 |
|
@@ -108,13 +114,15 @@ Practically every hosting meets these requirements. You must use PHP at least 7.
|
|
108 |
|
109 |
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.
|
110 |
|
111 |
-
Also REST API must be enabled and work without additional restrictions.
|
112 |
-
|
113 |
An example of the correct server configuration can be found [here](https://gbiorczyk.pl/webp-converter/serverinfo.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`)*.
|
114 |
|
115 |
**Note the items marked in red.** If your server does not meet the technical requirements, please contact your server Administrator.
|
116 |
|
117 |
-
|
|
|
|
|
|
|
|
|
118 |
|
119 |
= What are restrictions? =
|
120 |
|
@@ -124,13 +132,17 @@ Please remember that **Safari and Internet Explorer do not support the WebP form
|
|
124 |
|
125 |
You can find more about WebP support by browsers [here](https://caniuse.com/#feat=webp).
|
126 |
|
127 |
-
=
|
|
|
|
|
128 |
|
129 |
In the WordPress admin panel, on the `Settings -> WebP Converter` subpage there is a module that allows you to process all your images.
|
130 |
|
131 |
It uses the WordPress REST API by downloading addresses of all images and converting all files gradually.
|
132 |
|
133 |
-
This process may take few or more than ten minutes depending on the number of files.
|
|
|
|
|
134 |
|
135 |
= How to check if plugin works? =
|
136 |
|
@@ -145,7 +157,15 @@ When you have installed plugin and converted all images, follow these steps:
|
|
145 |
7. In addition, you can check weight of website before and after using plugin. The difference will be huge!
|
146 |
8. More information: [here](https://gbiorczyk.pl/webp-converter/check-devtools.png)
|
147 |
|
148 |
-
Please remember that
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
|
150 |
= Where are converted images stored? =
|
151 |
|
@@ -153,33 +173,71 @@ All WebP images are stored in the `/wp-content/uploads-webpc/` directory. Inside
|
|
153 |
|
154 |
In case the location of the original file is as follows: `/wp-content/uploads/2019/06/example.jpg` then its converted version will be in the following location: `/wp-content/uploads-webpc/2019/06/example.jpg.webp`.
|
155 |
|
156 |
-
Original images are not changed.
|
157 |
|
158 |
= How to change path to uploads? =
|
159 |
|
160 |
-
This is possible using
|
161 |
|
162 |
-
|
|
|
|
|
|
|
|
|
163 |
|
164 |
-
|
165 |
|
166 |
`add_filter('webpc_uploads_path', function($path) {
|
167 |
return 'wp-content/uploads';
|
168 |
});`
|
169 |
|
|
|
|
|
170 |
`add_filter('webpc_uploads_webp', function($path) {
|
171 |
return 'wp-content/uploads-webpc';
|
172 |
});`
|
173 |
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
-
|
177 |
|
178 |
-
=
|
179 |
|
180 |
-
|
181 |
|
182 |
-
If you do not want to use this functionality, you can turn it off at any time.
|
183 |
|
184 |
= Does plugin support CDN? =
|
185 |
|
@@ -230,9 +288,10 @@ and add below code in this file:
|
|
230 |
|
231 |
Yes, with one exception. In this mode it is not possible to automatically generate the contents of .htaccess file.
|
232 |
|
233 |
-
Please manually paste the following code **at the beginning of .htaccess file
|
234 |
|
235 |
`# BEGIN WebP Converter`
|
|
|
236 |
`<IfModule mod_mime.c>
|
237 |
AddType image/webp .webp
|
238 |
</IfModule>
|
@@ -240,18 +299,19 @@ Please manually paste the following code **at the beginning of .htaccess file**:
|
|
240 |
RewriteEngine On
|
241 |
RewriteCond %{HTTP_ACCEPT} image/webp
|
242 |
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.webp -f
|
243 |
-
RewriteRule
|
244 |
RewriteCond %{HTTP_ACCEPT} image/webp
|
245 |
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.webp -f
|
246 |
-
RewriteRule
|
247 |
RewriteCond %{HTTP_ACCEPT} image/webp
|
248 |
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.webp -f
|
249 |
-
RewriteRule
|
250 |
</IfModule>
|
251 |
<IfModule mod_expires.c>
|
252 |
ExpiresActive On
|
253 |
ExpiresByType image/webp "access plus 1 year"
|
254 |
</IfModule>`
|
|
|
255 |
`# END WebP Converter`
|
256 |
|
257 |
= Is the plugin completely free? =
|
@@ -273,6 +333,15 @@ This is all very important to us and allows us to do even better things for you!
|
|
273 |
|
274 |
== Changelog ==
|
275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
= 1.1.1 (2020-02-13) =
|
277 |
* `[Changed]` Unknown error handling when converting images
|
278 |
* `[Added]` Ability to skip converting existing images when `Regenerate All`
|
@@ -287,7 +356,7 @@ This is all very important to us and allows us to do even better things for you!
|
|
287 |
|
288 |
= 1.0.8 (2019-12-19) =
|
289 |
* `[Fixed]` File deletion for custom paths with converted WebP files
|
290 |
-
* `[Changed]` Rules management in .htaccess file when activating
|
291 |
* `[Added]` Error detection system in server configuration
|
292 |
* `[Added]` Blocking image conversion when `GD` or `Imagick` libraries are unavailable
|
293 |
|
3 |
Donate link: https://ko-fi.com/gbiorczyk/
|
4 |
Tags: webp, images, performance, compress, optimize
|
5 |
Requires at least: 5.0
|
6 |
+
Tested up to: 5.4
|
7 |
Requires PHP: 7.0
|
8 |
Stable tag: trunk
|
9 |
License: GPLv2 or later
|
36 |
|
37 |
Raise your website to a new level now! Install the plugin and enjoy the website that loads faster. Surely you and your users will appreciate it.
|
38 |
|
39 |
+
#### Support to the development of plugin
|
40 |
+
|
41 |
+
We spend hours working on the development of this plugin. Technical support also requires a lot of time, but we do it because we want to offer you the best plugin. We enjoy every new plugin installation.
|
42 |
+
|
43 |
+
If you would like to appreciate it, you can [provide us a coffee](https://ko-fi.com/gbiorczyk/). **If every user bought at least one, we could work on the plugin 24 hours a day!**
|
44 |
+
|
45 |
#### Please also read the FAQ below. Thank you for being with us!
|
46 |
|
47 |
== Installation ==
|
48 |
|
49 |
+
1. Upload the plugin files to `/wp-content/plugins/webp-converter-for-media` directory, or install plugin through the WordPress plugins screen directly.
|
50 |
2. Activate plugin through `Plugins` screen in WordPress Admin Panel.
|
51 |
3. Use `Settings -> Settings -> WebP Converter` screen to configure the plugin.
|
52 |
4. Click on the button `Regenerate All`.
|
58 |
|
59 |
= How to get technical support? (before you ask for help) =
|
60 |
|
|
|
|
|
61 |
Please always adding your thread, **read all other questions in the FAQ of plugin and other threads in support forum first**. Perhaps someone had a similar problem and it has been resolved.
|
62 |
|
63 |
+
This will save time repeating the same issues many times and solving the same problems. If you do not find anything and you still have a problem, then contact us.
|
64 |
|
65 |
+
We will be grateful if you appreciate our time and try to find an answer that may already be somewhere. And if it's not here, please describe your problem to us.
|
66 |
+
|
67 |
+
Please remember one thing - we work on it in our free time, with passion. We will be grateful for keeping culture and patience. We are not always able to respond immediately.
|
68 |
+
|
69 |
+
We want to help everyone very much, but we need cooperation between both sides. This is very important. We may have a deal like this?
|
70 |
+
|
71 |
+
And most importantly - **do not leave the thread unanswered**. If you add a thread, follow when you get a reply. Then let us know if we have helped you or not. This helps us improve technical support.
|
72 |
|
73 |
When adding a thread, follow these steps and reply to each of them:
|
74 |
|
75 |
+
**1.** URL of your website. If your site is not publicly available, add it to test environment.
|
76 |
|
77 |
+
**2.** Does your server meet the technical requirements described in the FAQ? Please send configuration of your server *(link to it can be found on the settings page of plugin in the section **"We are waiting for your message"**)* - please take a screenshot of the ENTIRE page and send it to me.
|
78 |
|
79 |
+
**3.** Do you use CDN? If so, please see the question **"Does the plugin support CDN?"** in plugin FAQ.
|
80 |
|
81 |
+
**4.** Do you use other plugins to optimize images? Please disable them and check this plugin without them. Remember not to combine several optimization plugins because they can be mutually exclusive.
|
82 |
+
|
83 |
+
**5.** Check if in `/wp-content/uploads-webpc` directory are all files that should be converted.
|
84 |
|
85 |
If not, please enable `WP_DEBUG_LOG` in your `wp-config.php` *(more about debugging: [https://codex.wordpress.org/WP_DEBUG](https://codex.wordpress.org/WP_DEBUG))*. That's what you should have in this file:
|
86 |
|
100 |
|
101 |
Send a screenshot from console if an error occurred while converting images. Of you have errors in `/wp-content/debug.log` send their?
|
102 |
|
103 |
+
**6.** Content of your `.htaccess` file from the `/wp-content/uploads` directory *(pasting the code using the `CODE` shortcode in the editor)*.
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
+
**7.** What plugin version are you using? If it is not the latest then update and check everything again. Please also provide the version of WordPress and the list of plugins you use.
|
106 |
|
107 |
+
Please remember to include the answers for all 7 questions by adding a thread. It is much easier and accelerate the solution of your problem.
|
108 |
|
109 |
+
And if we would help and would like to thank us, you can [provide us a coffee](https://ko-fi.com/gbiorczyk/).
|
110 |
|
111 |
= What are requirements of plugin? =
|
112 |
|
114 |
|
115 |
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.
|
116 |
|
|
|
|
|
117 |
An example of the correct server configuration can be found [here](https://gbiorczyk.pl/webp-converter/serverinfo.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`)*.
|
118 |
|
119 |
**Note the items marked in red.** If your server does not meet the technical requirements, please contact your server Administrator.
|
120 |
|
121 |
+
Please do not add threads regarding server configuration in the support section. Surely the server Administrator will be able to do it best.
|
122 |
+
|
123 |
+
He is the most competent to solve such problems. Due to the huge amount of possible server environments, we are not able to help you with its configuration.
|
124 |
+
|
125 |
+
Also REST API must be enabled and work without additional restrictions. If you have a problem with it, please contact the Developer who created your website. He should easily find the issue with the REST API not working.
|
126 |
|
127 |
= What are restrictions? =
|
128 |
|
132 |
|
133 |
You can find more about WebP support by browsers [here](https://caniuse.com/#feat=webp).
|
134 |
|
135 |
+
= What to do after installing plugin? =
|
136 |
+
|
137 |
+
After installing the plugin, you should convert all existing images.
|
138 |
|
139 |
In the WordPress admin panel, on the `Settings -> WebP Converter` subpage there is a module that allows you to process all your images.
|
140 |
|
141 |
It uses the WordPress REST API by downloading addresses of all images and converting all files gradually.
|
142 |
|
143 |
+
This process may take few or more than ten minutes depending on the number of files.
|
144 |
+
|
145 |
+
**It should be done once after installing the plugin.** All images added later will be converted automatically.
|
146 |
|
147 |
= How to check if plugin works? =
|
148 |
|
157 |
7. In addition, you can check weight of website before and after using plugin. The difference will be huge!
|
158 |
8. More information: [here](https://gbiorczyk.pl/webp-converter/check-devtools.png)
|
159 |
|
160 |
+
Please remember that URLs will remain unchanged. The difference will be only in the Type of file. This does not mean that the plugin does not work.
|
161 |
+
|
162 |
+
If the file type is `WebP`, then everything is working properly. You can also turn off the plugin for a moment and check the weight of your website, then turn it on and test again. The difference should be visible.
|
163 |
+
|
164 |
+
= Why are some images not in WebP? =
|
165 |
+
|
166 |
+
If the converted image in WebP format is larger than the original, the browser will use the original file. This converted file will be deleted. Therefore, you can also see files other than WebP on the list.
|
167 |
+
|
168 |
+
If you want to force the use of WebP files, uncheck the `Automatic removal of WebP files larger than original` option in the plugin settings. Then click on the `Regenerate All` button to convert all images again.
|
169 |
|
170 |
= Where are converted images stored? =
|
171 |
|
173 |
|
174 |
In case the location of the original file is as follows: `/wp-content/uploads/2019/06/example.jpg` then its converted version will be in the following location: `/wp-content/uploads-webpc/2019/06/example.jpg.webp`.
|
175 |
|
176 |
+
Original images are not changed. If you remove plugins, only WebP files will be deleted. Your images are not changed in any way.
|
177 |
|
178 |
= How to change path to uploads? =
|
179 |
|
180 |
+
This is possible using the following types of filters to change default paths. It is a solution for advanced users. If you are not, please skip this question.
|
181 |
|
182 |
+
Path to the root installation directory of WordPress *(`ABSPATH` by default)*:
|
183 |
+
|
184 |
+
`add_filter('webpc_uploads_root', function($path) {
|
185 |
+
return ABSPATH;
|
186 |
+
});`
|
187 |
|
188 |
+
Path to `/uploads` directory *(relative to the root directory)*:
|
189 |
|
190 |
`add_filter('webpc_uploads_path', function($path) {
|
191 |
return 'wp-content/uploads';
|
192 |
});`
|
193 |
|
194 |
+
Directory path with converted WebP files *(relative to the root directory)*:
|
195 |
+
|
196 |
`add_filter('webpc_uploads_webp', function($path) {
|
197 |
return 'wp-content/uploads-webpc';
|
198 |
});`
|
199 |
|
200 |
+
Prefix in URL of `/wp-content/` directory or equivalent *(used in .htaccess)*:
|
201 |
+
|
202 |
+
`add_filter('webpc_uploads_prefix', function($prefix) {
|
203 |
+
return parse_url(site_url('/'), PHP_URL_PATH);
|
204 |
+
});`
|
205 |
+
|
206 |
+
For the following sample custom WordPress structure:
|
207 |
+
|
208 |
+
`...
|
209 |
+
├── web
|
210 |
+
...
|
211 |
+
├── app
|
212 |
+
│ ├── mu-plugins
|
213 |
+
│ ├── plugins
|
214 |
+
│ ├── themes
|
215 |
+
│ └── uploads
|
216 |
+
├── wp-config.php
|
217 |
+
...`
|
218 |
+
|
219 |
+
Use the following filters:
|
220 |
+
|
221 |
+
`add_filter('webpc_uploads_root', function($path) {
|
222 |
+
return 'C:/WAMP/www/project/webp'; // your valid path
|
223 |
+
});
|
224 |
+
add_filter('webpc_uploads_path', function($path) {
|
225 |
+
return 'app/uploads';
|
226 |
+
});
|
227 |
+
add_filter('webpc_uploads_webp', function($path) {
|
228 |
+
return 'app/uploads-webpc';
|
229 |
+
});`
|
230 |
+
`add_filter('webpc_uploads_prefix', function($prefix) {
|
231 |
+
return '/';
|
232 |
+
});`
|
233 |
|
234 |
+
After setting the filters go to `Settings -> WebP Converter` in the admin panel and click the `Save Changes` button. `.htaccess` file with appropriate rules should be created in the `/uploads` directory.
|
235 |
|
236 |
+
= What is Browser Caching? =
|
237 |
|
238 |
+
This option allows you to speed up page loading time for returning users because they do not need to re-download files from the server. The plugin allows this by using the module `mod_expires`.
|
239 |
|
240 |
+
It is enabled by default. If you do not want to use this functionality, you can turn it off at any time.
|
241 |
|
242 |
= Does plugin support CDN? =
|
243 |
|
288 |
|
289 |
Yes, with one exception. In this mode it is not possible to automatically generate the contents of .htaccess file.
|
290 |
|
291 |
+
Please manually paste the following code **at the beginning of .htaccess file** in the `/wp-content/uploads` directory:
|
292 |
|
293 |
`# BEGIN WebP Converter`
|
294 |
+
`# ! --- DO NOT EDIT PREVIOUS LINE --- !`
|
295 |
`<IfModule mod_mime.c>
|
296 |
AddType image/webp .webp
|
297 |
</IfModule>
|
299 |
RewriteEngine On
|
300 |
RewriteCond %{HTTP_ACCEPT} image/webp
|
301 |
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.webp -f
|
302 |
+
RewriteRule (.+)\.jpg$ /wp-content/uploads-webpc/$1.jpg.webp [T=image/webp]
|
303 |
RewriteCond %{HTTP_ACCEPT} image/webp
|
304 |
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.webp -f
|
305 |
+
RewriteRule (.+)\.jpeg$ /wp-content/uploads-webpc/$1.jpeg.webp [T=image/webp]
|
306 |
RewriteCond %{HTTP_ACCEPT} image/webp
|
307 |
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.webp -f
|
308 |
+
RewriteRule (.+)\.png$ /wp-content/uploads-webpc/$1.png.webp [T=image/webp]
|
309 |
</IfModule>
|
310 |
<IfModule mod_expires.c>
|
311 |
ExpiresActive On
|
312 |
ExpiresByType image/webp "access plus 1 year"
|
313 |
</IfModule>`
|
314 |
+
`# ! --- DO NOT EDIT NEXT LINE --- !`
|
315 |
`# END WebP Converter`
|
316 |
|
317 |
= Is the plugin completely free? =
|
333 |
|
334 |
== Changelog ==
|
335 |
|
336 |
+
= 1.2.0 (2020-04-05) =
|
337 |
+
* `[Changed]` Moving rules from .htaccess file in root directory of WordPress to `/wp-content/uploads` directory
|
338 |
+
* `[Added]` Ability to disable automatic removal of WebP files larger than original
|
339 |
+
* `[Added]` Error validation for a non-writable .htaccess file
|
340 |
+
* `[Added]` Filter `webpc_uploads_root` to change path for root installation directory of WordPress
|
341 |
+
|
342 |
+
= 1.1.2 (2020-03-03) =
|
343 |
+
* `[Added]` Zero padding at end for odd-sized WebP files using `GD` library
|
344 |
+
|
345 |
= 1.1.1 (2020-02-13) =
|
346 |
* `[Changed]` Unknown error handling when converting images
|
347 |
* `[Added]` Ability to skip converting existing images when `Regenerate All`
|
356 |
|
357 |
= 1.0.8 (2019-12-19) =
|
358 |
* `[Fixed]` File deletion for custom paths with converted WebP files
|
359 |
+
* `[Changed]` Rules management in .htaccess file when activating or deactivating plugin
|
360 |
* `[Added]` Error detection system in server configuration
|
361 |
* `[Added]` Blocking image conversion when `GD` or `Imagick` libraries are unavailable
|
362 |
|
resources/components/widgets/errors.php
CHANGED
@@ -13,6 +13,14 @@
|
|
13 |
); ?>
|
14 |
</p>
|
15 |
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
<?php if (in_array('path_webp', $errors)) : ?>
|
17 |
<p>
|
18 |
<?= sprintf(
|
13 |
); ?>
|
14 |
</p>
|
15 |
<?php endif; ?>
|
16 |
+
<?php if (in_array('path_htaccess', $errors)) : ?>
|
17 |
+
<p>
|
18 |
+
<?= sprintf(
|
19 |
+
__('Unable to create or edit .htaccess file. Please change directory permissions. The default path of file is: %s.', 'webp-converter'),
|
20 |
+
'<strong>' . ABSPATH . 'wp-content/uploads/.htaccess</strong>'
|
21 |
+
); ?>
|
22 |
+
</p>
|
23 |
+
<?php endif; ?>
|
24 |
<?php if (in_array('path_webp', $errors)) : ?>
|
25 |
<p>
|
26 |
<?= sprintf(
|
webp-converter-for-media.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
/*
|
4 |
Plugin Name: WebP Converter for Media
|
5 |
Description: Speed up your website by serving WebP images instead of standard formats JPEG, PNG and GIF.
|
6 |
-
Version: 1.
|
7 |
Author: Mateusz Gbiorczyk
|
8 |
Author URI: https://gbiorczyk.pl/
|
9 |
Text Domain: webp-converter
|
10 |
*/
|
11 |
|
12 |
-
define('WEBPC_VERSION', '1.
|
13 |
define('WEBPC_FILE', __FILE__);
|
14 |
define('WEBPC_NAME', plugin_basename(__FILE__));
|
15 |
define('WEBPC_PATH', plugin_dir_path(__FILE__));
|
3 |
/*
|
4 |
Plugin Name: WebP Converter for Media
|
5 |
Description: Speed up your website by serving WebP images instead of standard formats JPEG, PNG and GIF.
|
6 |
+
Version: 1.2.0
|
7 |
Author: Mateusz Gbiorczyk
|
8 |
Author URI: https://gbiorczyk.pl/
|
9 |
Text Domain: webp-converter
|
10 |
*/
|
11 |
|
12 |
+
define('WEBPC_VERSION', '1.2.0');
|
13 |
define('WEBPC_FILE', __FILE__);
|
14 |
define('WEBPC_NAME', plugin_basename(__FILE__));
|
15 |
define('WEBPC_PATH', plugin_dir_path(__FILE__));
|