WebP Express - Version 0.15.1

Version Description

(released: 17 sep 2019)

  • Bug alert: Added alert about a bug when destination folder is set to "mingled" and File extension is set to "Set to .webp"
  • Bugfix: Plugin URL pointed to webpexpress - it should point to parent. This gave trouble with images located in plugins. Thanks to Guillaume Meyer from Switzerland for discovering and reporting.
  • Bugfix: Images with uppercase chars in extension did not get Vary:Accept
  • Bugfix: There were issues with "All content" and destination:document-root when webp-realizer is activated

For more info, see the closed issues on the 0.15.0 milestone on the github repository: https://github.com/rosell-dk/webp-express/milestone/23?closed=1

Download this release

Release Info

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

Code changes from version 0.15.0 to 0.15.1

README.md CHANGED
@@ -591,6 +591,15 @@ Here are my current plans ahead: 0.15 will probably be a file manager-like inter
591
 
592
  If you wish to affect priorities, it is certainly possible. You can try to argue your case in the forum or you can simply let the money do the talking. By donating as little as a cup of coffee on [ko-fi.com/rosell](https://ko-fi.com/rosell), you can leave a wish. I shall take these wishes into account when prioritizing between new features.
593
 
 
 
 
 
 
 
 
 
 
594
  ## Changes in 0.15.0
595
  - Provided test-buttons for checking if the redirects works.
596
  - You can now choose which folders WebP Express is active in. Ie "Uploads and Themes".
591
 
592
  If you wish to affect priorities, it is certainly possible. You can try to argue your case in the forum or you can simply let the money do the talking. By donating as little as a cup of coffee on [ko-fi.com/rosell](https://ko-fi.com/rosell), you can leave a wish. I shall take these wishes into account when prioritizing between new features.
593
 
594
+ ## Changes in 0.15.1
595
+ *(released: 17 sep 2019)*
596
+
597
+ - Bug alert: Added alert about a bug when destination folder is set to "mingled" and File extension is set to "Set to .webp"
598
+ - Bugfix: Plugin URL pointed to webpexpress - it should point to parent. This gave trouble with images located in plugins. Thanks to Guillaume Meyer from Switzerland for discovering and reporting.
599
+ - Bugfix: Images with uppercase chars in extension did not get Vary:Accept
600
+ - Bugfix: There were issues with "All content" and destination:document-root when webp-realizer is activated
601
+
602
+
603
  ## Changes in 0.15.0
604
  - Provided test-buttons for checking if the redirects works.
605
  - You can now choose which folders WebP Express is active in. Ie "Uploads and Themes".
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.15.0
8
  Requires PHP: 5.6
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -600,6 +600,16 @@ Easy enough! - [Go here!](https://ko-fi.com/rosell). Or [here](https://buymeacof
600
 
601
  == Changelog ==
602
 
 
 
 
 
 
 
 
 
 
 
603
  = 0.15.0 =
604
  *(released: 17 sep 2019)*
605
 
@@ -945,6 +955,9 @@ For older releases, check out changelog.txt
945
 
946
  == Upgrade Notice ==
947
 
 
 
 
948
  = 0.15.0 =
949
  * New "Scope" and "destination structure" options, nice test buttons and a lot of work behind the surface
950
 
4
  Tags: webp, images, performance
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
+ Stable tag: 0.15.1
8
  Requires PHP: 5.6
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
600
 
601
  == Changelog ==
602
 
603
+ = 0.15.1 =
604
+ *(released: 17 sep 2019)*
605
+
606
+ * Bug alert: Added alert about a bug when destination folder is set to "mingled" and File extension is set to "Set to .webp"
607
+ * Bugfix: Plugin URL pointed to webpexpress - it should point to parent. This gave trouble with images located in plugins. Thanks to Guillaume Meyer from Switzerland for discovering and reporting.
608
+ * Bugfix: Images with uppercase chars in extension did not get Vary:Accept
609
+ * Bugfix: There were issues with "All content" and destination:document-root when webp-realizer is activated
610
+
611
+ For more info, see the closed issues on the 0.15.0 milestone on the github repository: https://github.com/rosell-dk/webp-express/milestone/23?closed=1
612
+
613
  = 0.15.0 =
614
  *(released: 17 sep 2019)*
615
 
955
 
956
  == Upgrade Notice ==
957
 
958
+ = 0.15.1 =
959
+ * Multiple bug fixes
960
+
961
  = 0.15.0 =
962
  * New "Scope" and "destination structure" options, nice test buttons and a lot of work behind the surface
963
 
changelog.txt CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  = 0.15.0 =
2
  *(released: 17 sep 2019)*
3
 
1
+ = 0.15.1 =
2
+ *(released: 17 sep 2019)*
3
+
4
+ * Bug alert: Added alert about a bug when destination folder is set to "mingled" and File extension is set to "Set to .webp"
5
+ * Bugfix: Plugin URL pointed to webpexpress - it should point to parent. This gave trouble with images located in plugins. Thanks to Guillaume Meyer from Switzerland for discovering and reporting.
6
+ * Bugfix: Images with uppercase chars in extension did not get Vary:Accept
7
+ * Bugfix: There were issues with "All content" and destination:document-root when webp-realizer is activated
8
+
9
  = 0.15.0 =
10
  *(released: 17 sep 2019)*
11
 
lib/classes/AdminInit.php CHANGED
@@ -30,7 +30,7 @@ class AdminInit
30
  public static function runMigrationIfNeeded()
31
  {
32
  // When an update requires a migration, the number should be increased
33
- define('WEBPEXPRESS_MIGRATION_VERSION', '11');
34
 
35
  if (WEBPEXPRESS_MIGRATION_VERSION != Option::getOption('webp-express-migration-version', 0)) {
36
  // run migration logic
30
  public static function runMigrationIfNeeded()
31
  {
32
  // When an update requires a migration, the number should be increased
33
+ define('WEBPEXPRESS_MIGRATION_VERSION', '12');
34
 
35
  if (WEBPEXPRESS_MIGRATION_VERSION != Option::getOption('webp-express-migration-version', 0)) {
36
  // run migration logic
lib/classes/CapabilityTest.php CHANGED
@@ -41,7 +41,7 @@ class CapabilityTest
41
  if (!@file_exists(Paths::getWebPExpressContentDirAbs() . '/htaccess-capability-tests/' . $testDir)) {
42
  $testUrl = Paths::getContentUrl() . '/' . 'webp-express/htaccess-capability-tests/' . $testDir . '/test.php';
43
  } else {
44
- $testUrl = Paths::getPluginUrl() . '/' . 'htaccess-capability-tests/' . $testDir . '/test.php';
45
  }
46
 
47
  //echo 'test url: ' . $testUrl . '<br>';
41
  if (!@file_exists(Paths::getWebPExpressContentDirAbs() . '/htaccess-capability-tests/' . $testDir)) {
42
  $testUrl = Paths::getContentUrl() . '/' . 'webp-express/htaccess-capability-tests/' . $testDir . '/test.php';
43
  } else {
44
+ $testUrl = Paths::getWebPExpressPluginUrl() . '/' . 'htaccess-capability-tests/' . $testDir . '/test.php';
45
  }
46
 
47
  //echo 'test url: ' . $testUrl . '<br>';
lib/classes/ConvertHelperIndependent.php CHANGED
@@ -558,7 +558,7 @@ APACHE
558
 
559
  $text = preg_replace('#' . preg_quote($_SERVER["DOCUMENT_ROOT"]) . '#', '[doc-root]', $text);
560
 
561
- $text = 'WebP Express 0.15.0. ' . $msgTop . ', ' . date("Y-m-d H:i:s") . "\n\r\n\r" . $text;
562
 
563
  $logFile = self::getLogFilename($source, $logDir);
564
 
558
 
559
  $text = preg_replace('#' . preg_quote($_SERVER["DOCUMENT_ROOT"]) . '#', '[doc-root]', $text);
560
 
561
+ $text = 'WebP Express 0.15.1. ' . $msgTop . ', ' . date("Y-m-d H:i:s") . "\n\r\n\r" . $text;
562
 
563
  $logFile = self::getLogFilename($source, $logDir);
564
 
lib/classes/HTAccess.php CHANGED
@@ -30,7 +30,7 @@ class HTAccess
30
  if (isset($pathsGoingToBeUsedInHtaccess[$prop])) {
31
  if ($value != $pathsGoingToBeUsedInHtaccess[$prop]) {
32
  return true;
33
- }
34
  }
35
  }
36
  }
@@ -332,7 +332,7 @@ class HTAccess
332
  if (isset($_SERVER['HTTP_ACCEPT']) && (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false )) {
333
  if ($config['operation-mode'] != 'no-conversion') {
334
  if ($config['image-types'] != 0) {
335
- $webpExpressRoot = Paths::getPluginUrlPath();
336
  $links = '';
337
  if ($config['enable-redirection-to-converter']) {
338
  $links = '<br>';
@@ -391,7 +391,8 @@ class HTAccess
391
 
392
  $rootsToPutRewritesIn = $config['scope'];
393
  if ($config['destination-structure'] == 'doc-root') {
394
- $rootsToPutRewritesIn = Paths::filterOutSubRoots($rootsToPutRewritesIn);
 
395
  }
396
 
397
  $dirsContainingWebps = [];
30
  if (isset($pathsGoingToBeUsedInHtaccess[$prop])) {
31
  if ($value != $pathsGoingToBeUsedInHtaccess[$prop]) {
32
  return true;
33
+ }
34
  }
35
  }
36
  }
332
  if (isset($_SERVER['HTTP_ACCEPT']) && (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false )) {
333
  if ($config['operation-mode'] != 'no-conversion') {
334
  if ($config['image-types'] != 0) {
335
+ $webpExpressRoot = Paths::getWebPExpressPluginUrlPath();
336
  $links = '';
337
  if ($config['enable-redirection-to-converter']) {
338
  $links = '<br>';
391
 
392
  $rootsToPutRewritesIn = $config['scope'];
393
  if ($config['destination-structure'] == 'doc-root') {
394
+ // Commented out to quickfix #338
395
+ // $rootsToPutRewritesIn = Paths::filterOutSubRoots($rootsToPutRewritesIn);
396
  }
397
 
398
  $dirsContainingWebps = [];
lib/classes/HTAccessRules.php CHANGED
@@ -74,7 +74,7 @@ class HTAccessRules
74
  if ($cacheControlHeader != '') {
75
  $ccRules .= "# Set Cache-Control header for requests to webp images\n";
76
  $ccRules .= "<IfModule mod_headers.c>\n";
77
- $ccRules .= " <FilesMatch \"\.webp$\">\n";
78
  $ccRules .= " Header set Cache-Control \"" . $cacheControlHeader . "\"\n";
79
  $ccRules .= " </FilesMatch>\n";
80
  $ccRules .= "</IfModule>\n\n";
@@ -161,37 +161,44 @@ class HTAccessRules
161
 
162
  // self::$appendWebP cannot be used, we need this:
163
  // (because we are not sure there are a .htaccess in the uploads folder)
164
- $appendWebP = !(self::$config['destination-extension'] == 'set');
165
-
166
- $rules .= " RewriteCond %{REQUEST_FILENAME} (?i)(.*)(" . self::$fileExtIncludingDot . ")$\n";
167
- $rules .= " RewriteCond %1" . ($appendWebP ? "%2" : "") . "\.webp -f\n";
168
- $rules .= " RewriteRule (?i)(.*)(" . self::$fileExtIncludingDot . ")$ %1" . ($appendWebP ? "%2" : "") .
169
- "\.webp [T=image/webp,E=EXISTING:1," . (self::$addVary ? 'E=ADDVARY:1,' : '') . "L]\n\n";
170
 
171
- /*
172
- if (self::$config['destination-extension'] == 'append') {
173
- $rules .= " RewriteCond %{REQUEST_FILENAME}.webp -f\n";
174
- //$rules .= " RewriteCond %{DOCUMENT_ROOT}/" . self::$htaccessDirRelToDocRoot . "/$1.$2.webp -f\n";
175
- $rules .= " RewriteRule " . $rewriteRuleStart . "\.(" . self::$fileExt . ")$ $1.$2.webp [T=image/webp,E=EXISTING:1," . (self::$addVary ? 'E=ADDVARY:1,' : '') . "L]\n\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  } else {
177
- // extension: set to webp
178
 
179
- //$rules .= " RewriteCond %{DOCUMENT_ROOT}/" . self::$htaccessDirRelToDocRoot . "/$1.webp -f\n";
180
- //$rules .= " RewriteRule " . $rewriteRuleStart . "\.(" . self::$fileExt . ")$ $1.webp [T=image/webp,E=EXISTING:1," . (self::$addVary ? 'E=ADDVARY:1,' : '') . "L]\n\n";
 
 
181
 
182
- // Got these new rules here: https://www.digitalocean.com/community/tutorials/how-to-create-and-serve-webp-images-to-speed-up-your-website
183
- $rules .= " RewriteCond %{REQUEST_URI} (?i)(.*)(" . self::$fileExtIncludingDot . ")$\n";
184
- $rules .= " RewriteCond %{DOCUMENT_ROOT}%1\.webp -f\n";
185
- $rules .= " RewriteRule (?i)(.*)(" . self::$fileExtIncludingDot . ")$ %1\.webp [T=image/webp,E=EXISTING:1," . (self::$addVary ? 'E=ADDVARY:1,' : '') . "L]\n\n";
186
 
187
- // Instead of using REQUEST_URI, I can use REQUEST_FILENAME and remove DOCUMENT_ROOT
188
- // I suppose REQUEST_URI is what was requested (ie "/wp-content/uploads/image.jpg").
189
- // REQUEST_FILENAME is the filesystem path. (ie "/var/www/example.com/uploads-moved/image.jpg")
190
- // But it cant be, because then the digitalocean solution would not work in above case.
191
- // TODO: investigate
192
 
193
- // RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [T=image/webp,E=EXISTING:1,E=ADDVARY:1,L]
194
- }
195
  */
196
  }
197
 
@@ -785,7 +792,7 @@ class HTAccessRules
785
  " # when requesting images that would be redirected to webp on browsers that does.\n";
786
 
787
  $rules .= " <IfModule mod_headers.c>\n";
788
- $rules .= ' <FilesMatch "\.(jpe?g|png)$">' . "\n";
789
  $rules .= ' Header append "Vary" "Accept"' . "\n";
790
  $rules .= " </FilesMatch>\n";
791
  $rules .= " </IfModule>\n\n";
74
  if ($cacheControlHeader != '') {
75
  $ccRules .= "# Set Cache-Control header for requests to webp images\n";
76
  $ccRules .= "<IfModule mod_headers.c>\n";
77
+ $ccRules .= " <FilesMatch \"(?i)\.webp$\">\n";
78
  $ccRules .= " Header set Cache-Control \"" . $cacheControlHeader . "\"\n";
79
  $ccRules .= " </FilesMatch>\n";
80
  $ccRules .= "</IfModule>\n\n";
161
 
162
  // self::$appendWebP cannot be used, we need this:
163
  // (because we are not sure there are a .htaccess in the uploads folder)
 
 
 
 
 
 
164
 
165
+ if (self::$useDocRootForStructuringCacheDir) {
166
+ if (self::$config['destination-extension'] == 'append') {
167
+ $rules .= " RewriteCond %{REQUEST_FILENAME}.webp -f\n";
168
+ //$rules .= " RewriteCond %{DOCUMENT_ROOT}/" . self::$htaccessDirRelToDocRoot . "/$1.$2.webp -f\n";
169
+ $rules .= " RewriteRule ^/?(.*)\.(" . self::$fileExt . ")$ $1.$2.webp [NC,T=image/webp,E=EXISTING:1," . (self::$addVary ? 'E=ADDVARY:1,' : '') . "L]\n\n";
170
+ } else {
171
+ // extension: set to webp
172
+
173
+ //$rules .= " RewriteCond %{DOCUMENT_ROOT}/" . self::$htaccessDirRelToDocRoot . "/$1.webp -f\n";
174
+ //$rules .= " RewriteRule " . $rewriteRuleStart . "\.(" . self::$fileExt . ")$ $1.webp [T=image/webp,E=EXISTING:1," . (self::$addVary ? 'E=ADDVARY:1,' : '') . "L]\n\n";
175
+
176
+ // Got these new rules here: https://www.digitalocean.com/community/tutorials/how-to-create-and-serve-webp-images-to-speed-up-your-website
177
+ // (but are they actually better than the ones we use for append?)
178
+ $rules .= " RewriteCond %{REQUEST_URI} (?i)(.*)(" . self::$fileExtIncludingDot . ")$\n";
179
+ $rules .= " RewriteCond %{DOCUMENT_ROOT}%1\.webp -f\n";
180
+ $rules .= " RewriteRule (?i)(.*)(" . self::$fileExtIncludingDot . ")$ %1\.webp [T=image/webp,E=EXISTING:1," . (self::$addVary ? 'E=ADDVARY:1,' : '') . "L]\n\n";
181
+
182
+ // Instead of using REQUEST_URI, I can use REQUEST_FILENAME and remove DOCUMENT_ROOT
183
+ // I suppose REQUEST_URI is what was requested (ie "/wp-content/uploads/image.jpg").
184
+ // REQUEST_FILENAME is the filesystem path. (ie "/var/www/example.com/uploads-moved/image.jpg")
185
+ // But it cant be, because then the digitalocean solution would not work in above case.
186
+ // TODO: investigate
187
+
188
+ // RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [T=image/webp,E=EXISTING:1,E=ADDVARY:1,L]
189
+ }
190
  } else {
191
+ $appendWebP = !(self::$config['destination-extension'] == 'set');
192
 
193
+ $rules .= " RewriteCond %{REQUEST_FILENAME} (?i)(.*)(" . self::$fileExtIncludingDot . ")$\n";
194
+ $rules .= " RewriteCond %1" . ($appendWebP ? "%2" : "") . "\.webp -f\n";
195
+ $rules .= " RewriteRule (?i)(.*)(" . self::$fileExtIncludingDot . ")$ %1" . ($appendWebP ? "%2" : "") .
196
+ "\.webp [T=image/webp,E=EXISTING:1," . (self::$addVary ? 'E=ADDVARY:1,' : '') . "L]\n\n";
197
 
198
+ }
 
 
 
199
 
200
+ /*
 
 
 
 
201
 
 
 
202
  */
203
  }
204
 
792
  " # when requesting images that would be redirected to webp on browsers that does.\n";
793
 
794
  $rules .= " <IfModule mod_headers.c>\n";
795
+ $rules .= ' <FilesMatch "(?i)\.(jpe?g|png)$">' . "\n";
796
  $rules .= ' Header append "Vary" "Accept"' . "\n";
797
  $rules .= " </FilesMatch>\n";
798
  $rules .= " </IfModule>\n\n";
lib/classes/Paths.php CHANGED
@@ -553,7 +553,7 @@ APACHE
553
  case 'home':
554
  return self::getHomeUrl();
555
  case 'plugins':
556
- return self::getPluginUrl();
557
  case 'uploads':
558
  return self::getUploadUrl();
559
  case 'themes':
@@ -654,33 +654,41 @@ APACHE
654
  return self::getContentUrl() . '/themes';
655
  }
656
 
 
 
 
 
 
 
 
 
657
  /**
658
  * Get Url to WebP Express plugin (this is in fact an incomplete URL, you need to append ie '/webp-on-demand.php' to get a full URL)
659
  */
660
- public static function getPluginUrl()
661
  {
662
  return untrailingslashit(plugins_url(null, WEBPEXPRESS_PLUGIN));
663
  }
664
 
665
- public static function getPluginUrlPath()
666
  {
667
- return self::getUrlPathFromUrl(self::getPluginUrl());
668
  }
669
 
670
  public static function getWodUrlPath()
671
  {
672
- return self::getPluginUrlPath() . '/wod/webp-on-demand.php';
673
  //return self::getHomeUrlPath() . '/webp-on-demand';
674
  }
675
 
676
  public static function getWebPRealizerUrlPath()
677
  {
678
- return self::getPluginUrlPath() . '/wod/webp-realizer.php';
679
  }
680
 
681
  public static function getWebServiceUrl()
682
  {
683
- //return self::getPluginUrl() . '/wpc.php';
684
  //return self::getHomeUrl() . '/webp-express-server';
685
  return self::getHomeUrl() . '/webp-express-web-service';
686
  }
@@ -689,7 +697,7 @@ APACHE
689
  {
690
  return [
691
  'urls' => [
692
- 'webpExpressRoot' => self::getPluginUrlPath(),
693
  'content' => self::getContentUrlPath(),
694
  ],
695
  'filePaths' => [
553
  case 'home':
554
  return self::getHomeUrl();
555
  case 'plugins':
556
+ return self::getPluginsUrl();
557
  case 'uploads':
558
  return self::getUploadUrl();
559
  case 'themes':
654
  return self::getContentUrl() . '/themes';
655
  }
656
 
657
+ /**
658
+ * Get Url to plugins (base)
659
+ */
660
+ public static function getPluginsUrl()
661
+ {
662
+ return untrailingslashit(plugins_url());
663
+ }
664
+
665
  /**
666
  * Get Url to WebP Express plugin (this is in fact an incomplete URL, you need to append ie '/webp-on-demand.php' to get a full URL)
667
  */
668
+ public static function getWebPExpressPluginUrl()
669
  {
670
  return untrailingslashit(plugins_url(null, WEBPEXPRESS_PLUGIN));
671
  }
672
 
673
+ public static function getWebPExpressPluginUrlPath()
674
  {
675
+ return self::getUrlPathFromUrl(self::getWebPExpressPluginUrl());
676
  }
677
 
678
  public static function getWodUrlPath()
679
  {
680
+ return self::getWebPExpressPluginUrlPath() . '/wod/webp-on-demand.php';
681
  //return self::getHomeUrlPath() . '/webp-on-demand';
682
  }
683
 
684
  public static function getWebPRealizerUrlPath()
685
  {
686
+ return self::getWebPExpressPluginUrlPath() . '/wod/webp-realizer.php';
687
  }
688
 
689
  public static function getWebServiceUrl()
690
  {
691
+ //return self::getWebPExpressPluginUrl() . '/wpc.php';
692
  //return self::getHomeUrl() . '/webp-express-server';
693
  return self::getHomeUrl() . '/webp-express-web-service';
694
  }
697
  {
698
  return [
699
  'urls' => [
700
+ 'webpExpressRoot' => self::getWebPExpressPluginUrlPath(),
701
  'content' => self::getContentUrlPath(),
702
  ],
703
  'filePaths' => [
lib/classes/SelfTestHelper.php CHANGED
@@ -94,7 +94,7 @@ class SelfTestHelper
94
  break;
95
  }
96
  $testSource = Paths::getPluginDirAbs() . '/webp-express/test/' . $fileNameToCopy;
97
- $filenameOfDestination = self::randomDigitsAndLetters(6) . '.' . $imageType;
98
  $result[] = 'Copying ' . strtoupper($imageType) . ' to ' . $rootId . ' folder (*webp-express-test-images/' . $filenameOfDestination . '*)';
99
 
100
  $destDir = Paths::getAbsDirById($rootId) . '/webp-express-test-images';
@@ -332,7 +332,7 @@ class SelfTestHelper
332
 
333
  $result[] = '';
334
 
335
- $result[] = '#### Image roots:';
336
  foreach (Paths::getImageRootIds() as $rootId) {
337
  $absDir = Paths::getAbsDirById($rootId);
338
 
@@ -354,6 +354,13 @@ class SelfTestHelper
354
  }
355
  }
356
 
 
 
 
 
 
 
 
357
  return $result;
358
  }
359
 
94
  break;
95
  }
96
  $testSource = Paths::getPluginDirAbs() . '/webp-express/test/' . $fileNameToCopy;
97
+ $filenameOfDestination = self::randomDigitsAndLetters(6) . '.' . strtoupper($imageType);
98
  $result[] = 'Copying ' . strtoupper($imageType) . ' to ' . $rootId . ' folder (*webp-express-test-images/' . $filenameOfDestination . '*)';
99
 
100
  $destDir = Paths::getAbsDirById($rootId) . '/webp-express-test-images';
332
 
333
  $result[] = '';
334
 
335
+ $result[] = '#### Image roots (absolute paths)';
336
  foreach (Paths::getImageRootIds() as $rootId) {
337
  $absDir = Paths::getAbsDirById($rootId);
338
 
354
  }
355
  }
356
 
357
+ $result[] = '#### Image roots (URLs)';
358
+ foreach (Paths::getImageRootIds() as $rootId) {
359
+ $url = Paths::getUrlById($rootId);
360
+ $result[] = '*' . $rootId . '*: ' . $url;
361
+ }
362
+
363
+
364
  return $result;
365
  }
366
 
lib/dismissable-messages/0.15.1/problems-with-mingled-set.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WebPExpress;
4
+
5
+ DismissableMessages::printDismissableMessage(
6
+ 'error',
7
+ 'Sorry, due to a bug, the combination of having destination folder set to "mingled" and ' .
8
+ 'File extension set to "Set to .webp" ' .
9
+ 'does not currently work. Please change the settings. ' .
10
+ 'I shall fix this soon!',
11
+ '0.15.1/problems-with-mingled-set',
12
+ 'Got it!'
13
+ );
lib/migrate/migrate12.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WebPExpress;
4
+
5
+ function webpexpress_migrate12() {
6
+
7
+ $config = Config::loadConfigAndFix(false); // false, because we do not need to test if quality detection is working
8
+
9
+ if (($config['destination-extension'] == 'set') && ($config['destination-folder'] == 'mingled')) {
10
+ DismissableMessages::addDismissableMessage('0.15.1/problems-with-mingled-set');
11
+
12
+ Messenger::addMessage(
13
+ 'error',
14
+ 'WebP Express is experiencing technical problems with your particular setup. ' .
15
+ 'Please <a href="' . Paths::getSettingsUrl() . '">go to the settings page</a> to fix.'
16
+ );
17
+
18
+ }
19
+
20
+ $forceHtaccessRegeneration = true;
21
+ $result = Config::saveConfigurationAndHTAccess($config, $forceHtaccessRegeneration);
22
+
23
+ if ($result['saved-both-config']) {
24
+ Option::updateOption('webp-express-migration-version', '12');
25
+
26
+ } else {
27
+ Messenger::addMessage(
28
+ 'error',
29
+ 'Failed migrating webp express options to 0.15.1. Probably you need to grant write permissions in your wp-content folder.'
30
+ );
31
+ }
32
+
33
+ }
34
+
35
+ webpexpress_migrate12();
lib/options/submit.php CHANGED
@@ -21,6 +21,7 @@ DismissableMessages::dismissMessage('0.14.0/say-hello-to-vips');
21
  DismissableMessages::dismissMessage('0.15.0/new-scope-setting-no-uploads');
22
  DismissableMessages::dismissMessage('0.15.0/new-scope-setting-index');
23
  DismissableMessages::dismissMessage('0.15.0/new-scope-setting-content');
 
24
 
25
  /*
26
  --------------------------------
21
  DismissableMessages::dismissMessage('0.15.0/new-scope-setting-no-uploads');
22
  DismissableMessages::dismissMessage('0.15.0/new-scope-setting-index');
23
  DismissableMessages::dismissMessage('0.15.0/new-scope-setting-content');
24
+ DismissableMessages::dismissMessage('0.15.1/problems-with-mingled-set');
25
 
26
  /*
27
  --------------------------------
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.15.0
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.15.1
7
  * Author: Bjørn Rosell
8
  * Author URI: https://www.bitwise-it.dk
9
  * License: GPL2