WebP Express - Version 0.25.0

Version Description

(released 7 dec 2021, on my daughters 10 year birthday!) * No exec()? - We don't give up easily, but now emulates it if possible, using proc_open(), passthru() or other alternatives. The result is that the cwebp converter now is available on more systems. Quality detection of jpegs also works on more systems now. The fallback feature with the emulations is btw implemented in a new library, exec-with-fallback * Bugfix: Our WP CLI command "webp-express" has a quality option, but it was not working

Download this release

Release Info

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

Code changes from version 0.24.2 to 0.25.0

Files changed (51) hide show
  1. README.txt +53 -14
  2. changelog.txt +8 -0
  3. composer.json +1 -1
  4. docs/publishing.md +2 -2
  5. lib/classes/CLI.php +1 -1
  6. lib/classes/ConvertHelperIndependent.php +1 -1
  7. lib/classes/FileHelper.php +1 -1
  8. vendor/composer/InstalledVersions.php +13 -0
  9. vendor/composer/autoload_classmap.php +6 -0
  10. vendor/composer/autoload_psr4.php +1 -0
  11. vendor/composer/autoload_static.php +14 -0
  12. vendor/composer/installed.json +88 -7
  13. vendor/composer/installed.php +14 -5
  14. vendor/rosell-dk/exec-with-fallback/LICENSE +674 -0
  15. vendor/rosell-dk/exec-with-fallback/README.md +56 -0
  16. vendor/rosell-dk/exec-with-fallback/composer.json +67 -0
  17. vendor/rosell-dk/exec-with-fallback/docs/notes.md +116 -0
  18. vendor/rosell-dk/exec-with-fallback/phpstan.neon +3 -0
  19. vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist +21 -0
  20. vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist.bak +28 -0
  21. vendor/rosell-dk/exec-with-fallback/src/Availability.php +39 -0
  22. vendor/rosell-dk/exec-with-fallback/src/ExecWithFallback.php +76 -0
  23. vendor/rosell-dk/exec-with-fallback/src/POpen.php +60 -0
  24. vendor/rosell-dk/exec-with-fallback/src/Passthru.php +58 -0
  25. vendor/rosell-dk/exec-with-fallback/src/ProcOpen.php +67 -0
  26. vendor/rosell-dk/exec-with-fallback/src/ShellExec.php +71 -0
  27. vendor/rosell-dk/exec-with-fallback/test.php +9 -0
  28. vendor/rosell-dk/webp-convert/README.md +12 -5
  29. vendor/rosell-dk/webp-convert/composer.json +7 -5
  30. vendor/rosell-dk/webp-convert/docs/development.md +1 -1
  31. vendor/rosell-dk/webp-convert/docs/v2.0/converting/options.md +1 -0
  32. vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/cwebp.md +3 -0
  33. vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/ffmpeg.md +15 -0
  34. vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gd.md +19 -0
  35. vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gmagick-extension.md +40 -0
  36. vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/imagick-extension.md +80 -0
  37. vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/vips.md +35 -0
  38. vendor/rosell-dk/webp-convert/phpunit-with-coverage.xml.dist +25 -0
  39. vendor/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php +12 -7
  40. vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php +14 -2
  41. vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php +8 -5
  42. vendor/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php +4 -3
  43. vendor/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php +5 -4
  44. vendor/rosell-dk/webp-convert/src/Convert/Converters/Gd.php +68 -9
  45. vendor/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php +6 -5
  46. vendor/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php +6 -5
  47. vendor/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php +11 -7
  48. vendor/rosell-dk/webp-convert/src/Convert/Helpers/JpegQualityDetector.php +37 -16
  49. vendor/rosell-dk/webp-convert/src/Helpers/BinaryDiscovery.php +4 -3
  50. vendor/rosell-dk/webp-convert/src/Helpers/FileExists.php +7 -3
  51. webp-express.php +1 -1
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.8
7
- Stable tag: 0.24.2
8
  Requires PHP: 5.6
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -135,24 +135,26 @@ There are several ways:
135
 
136
  ### WP CLI command
137
  WebP Express currently supports commands for converting and flushing webp images throug the CLI. You can use the --help option to learn about the options:
138
- `wp webp-express --help`. Displays the available commands
139
- `wp webp-express convert --help`. Displays the available options for the "convert" command.
140
 
141
  A few examples:
142
- `wp webp-express convert`: Creates webp images for all unconverted images
143
- `wp webp-express convert --reconvert`: Also convert images that are already converted
144
- `wp webp-express convert themes`: Only images in the themes folder
145
- `wp webp-express convert uploads/2021`: Only images in the "2021" folder inside the uploads folder
146
- `wp webp-express convert --only-png`: Only the PNG images
147
- `wp webp-express convert --quality=50`: Use quality 50 (instead of what was entered in settings screen)
148
- `wp webp-express convert --converter=cwebp`: Specifically use cwebp converter.
149
 
150
- `wp webp-express flushwebp`: Remove all webp images
151
- `wp webp-express flushwebp --only-png`: Remove all webp images that are conversions of PNG images
152
 
153
  Synopsises:
154
- `wp webp-express convert [<location>] [--reconvert] [--only-png] [--only-jpeg] [--quality=<number>] [--near-lossless=<number>] [--alpha-quality=<number>] [--encoding=<auto|lossy|lossless>] [--converter=<converter>]`
155
- `wp webp-express flushwebp [--only-png]`
 
 
156
 
157
  I'm considering adding commands for viewing status, viewing conversion stats, generating the .htaccess files and modifying the settings. Please let me know if you need any of these or perhaps something else.
158
 
@@ -250,6 +252,35 @@ Easy enough. Browsers looks at the *content type* header rather than the URL to
250
 
251
  I am btw considering making an option to have the plugin redirect to the webp instead of serving immediately. That would remove the apparent mismatch between file extension and content type header. However, the cost of doing that will be an extra request for each image, which means extra time and worse performance. I believe you'd be ill advised to use that option, so I guess I will not implement it. But perhaps you have good reasons to use it? If you do, please let me know!
252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  = Blank images in Safari? =
254
  WebP Express has three ways of distributing webp to webp-enabled browsers while still sending the originals to webp-disabled browsers. While method 1 can be combined with any of the other methods, you would usually just pick method 1 or one of the others if method 1 cannot be used for you.
255
 
@@ -782,6 +813,11 @@ If you want to make sure that my coffee supplies don't run dry, you can even buy
782
 
783
  == Changelog ==
784
 
 
 
 
 
 
785
  = 0.24.2 =
786
  *(released: 25 Nov 2021)*
787
  * Bugfix: In FileManager, the original image wasn't showing on all systems
@@ -870,6 +906,9 @@ For older releases, check out changelog.txt
870
 
871
  == Upgrade Notice ==
872
 
 
 
 
873
  = 0.24.2 =
874
  * Minor bugfix
875
 
4
  Tags: webp, images, performance
5
  Requires at least: 4.0
6
  Tested up to: 5.8
7
+ Stable tag: 0.25.0
8
  Requires PHP: 5.6
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
135
 
136
  ### WP CLI command
137
  WebP Express currently supports commands for converting and flushing webp images throug the CLI. You can use the --help option to learn about the options:
138
+ *wp webp-express --help*. Displays the available commands
139
+ *wp webp-express convert --help*. Displays the available options for the "convert" command.
140
 
141
  A few examples:
142
+ *wp webp-express convert*: Creates webp images for all unconverted images
143
+ *wp webp-express convert --reconvert*: Also convert images that are already converted
144
+ *wp webp-express convert themes*: Only images in the themes folder
145
+ *wp webp-express convert uploads/2021*: Only images in the "2021" folder inside the uploads folder
146
+ *wp webp-express convert --only-png*: Only the PNG images
147
+ *wp webp-express convert --quality=50*: Use quality 50 (instead of what was entered in settings screen)
148
+ *wp webp-express convert --converter=cwebp*: Specifically use cwebp converter.
149
 
150
+ *wp webp-express flushwebp*: Remove all webp images
151
+ *wp webp-express flushwebp --only-png*: Remove all webp images that are conversions of PNG images
152
 
153
  Synopsises:
154
+ `
155
+ wp webp-express convert [<location>] [--reconvert] [--only-png] [--only-jpeg] [--quality=<number>] [--near-lossless=<number>] [--alpha-quality=<number>] [--encoding=<auto|lossy|lossless>] [--converter=<converter>]
156
+ wp webp-express flushwebp [--only-png]
157
+ `
158
 
159
  I'm considering adding commands for viewing status, viewing conversion stats, generating the .htaccess files and modifying the settings. Please let me know if you need any of these or perhaps something else.
160
 
252
 
253
  I am btw considering making an option to have the plugin redirect to the webp instead of serving immediately. That would remove the apparent mismatch between file extension and content type header. However, the cost of doing that will be an extra request for each image, which means extra time and worse performance. I believe you'd be ill advised to use that option, so I guess I will not implement it. But perhaps you have good reasons to use it? If you do, please let me know!
254
 
255
+ = You mention that I can bulk convert through WP CLI, but how do I use it? =
256
+ Well, first, if you don't know WP CLI, here is a [quick start](https://make.wordpress.org/cli/handbook/guides/quick-start/)
257
+
258
+ WebP Express currently supports commands for converting and flushing webp images throug the CLI. You can use the --help option to learn about the options:
259
+ *wp webp-express --help*. Displays the available commands
260
+ *wp webp-express convert --help*. Displays the available options for the "convert" command.
261
+
262
+ A few examples:
263
+ *wp webp-express convert*: Creates webp images for all unconverted images
264
+ *wp webp-express convert --reconvert*: Also convert images that are already converted
265
+ *wp webp-express convert themes*: Only images in the themes folder
266
+ *wp webp-express convert uploads/2021*: Only images in the "2021" folder inside the uploads folder
267
+ *wp webp-express convert --only-png*: Only the PNG images
268
+ *wp webp-express convert --quality=50*: Use quality 50 (instead of what was entered in settings screen)
269
+ *wp webp-express convert --quality=50 --near-lossless=50 --alpha-quality=50 --encoding=lossy*: More conversion options. encoding can be "lossy", "lossless" or "auto"
270
+ *wp webp-express convert --converter=cwebp*: Specifically use cwebp converter. Other options: "vips", "imagemagick", "ffmpeg". PS: For "ewww" and "wpc" (remote webp express) does not work here.
271
+
272
+ *wp webp-express flushwebp*: Remove all webp images
273
+ *wp webp-express flushwebp --only-png*: Remove all webp images that are conversions of PNG images
274
+
275
+ Synopsises:
276
+ `
277
+ wp webp-express convert [<location>] [--reconvert] [--only-png] [--only-jpeg] [--quality=<number>] [--near-lossless=<number>] [--alpha-quality=<number>] [--encoding=<auto|lossy|lossless>] [--converter=<converter>]
278
+ wp webp-express flushwebp [--only-png]
279
+ `
280
+
281
+ I'm considering adding commands for viewing status, viewing conversion stats, generating the .htaccess files and modifying the settings. Please let me know if you need any of these or perhaps something else.
282
+
283
+
284
  = Blank images in Safari? =
285
  WebP Express has three ways of distributing webp to webp-enabled browsers while still sending the originals to webp-disabled browsers. While method 1 can be combined with any of the other methods, you would usually just pick method 1 or one of the others if method 1 cannot be used for you.
286
 
813
 
814
  == Changelog ==
815
 
816
+ = 0.25.0 =
817
+ (released 7 dec 2021, on my daughters 10 year birthday!)
818
+ * No exec()? - We don't give up easily, but now emulates it if possible, using proc_open(), passthru() or other alternatives. The result is that the cwebp converter now is available on more systems. Quality detection of jpegs also works on more systems now. The fallback feature with the emulations is btw implemented in a new library, [exec-with-fallback](https://github.com/rosell-dk/exec-with-fallback)
819
+ * Bugfix: Our WP CLI command "webp-express" has a quality option, but it was not working
820
+
821
  = 0.24.2 =
822
  *(released: 25 Nov 2021)*
823
  * Bugfix: In FileManager, the original image wasn't showing on all systems
906
 
907
  == Upgrade Notice ==
908
 
909
+ = 0.25.0 =
910
+ * No exec()? - We don't give up so easily anymore.
911
+
912
  = 0.24.2 =
913
  * Minor bugfix
914
 
changelog.txt CHANGED
@@ -1,10 +1,18 @@
 
 
 
 
 
1
  = 0.24.2 =
 
2
  * Bugfix: In FileManager, the original image wasn't showing on all systems
3
 
4
  = 0.24.1 =
 
5
  * Bugfix: On some systems, the converter test run that is done when showing the settings page could result in an uncatched error.
6
 
7
  = 0.24.0 =
 
8
  * Improved file manager: You can now tweak conversion settings, delete conversion and see mime type of images.
9
  * Conversions logs are made more readable
10
  * Bumped webp-convert to 0.24.0
1
+ = 0.25.0 =
2
+ (released 7 dec 2021, on my daughters 10 year birthday!)
3
+ * No exec()? - We don't give up easily, but now emulates it if possible, using proc_open(), passthru() or other alternatives. The result is that the cwebp converter now is available on more systems. Quality detection of jpegs also works on more systems now. The fallback feature with the emulations is btw implemented in a new library, [exec-with-fallback](https://github.com/rosell-dk/exec-with-fallback)
4
+ * Bugfix: Our WP CLI command "webp-express" has a quality option, but it was not working
5
+
6
  = 0.24.2 =
7
+ *(released: 25 Nov 2021)*
8
  * Bugfix: In FileManager, the original image wasn't showing on all systems
9
 
10
  = 0.24.1 =
11
+ *(released: 24 Nov 2021)*
12
  * Bugfix: On some systems, the converter test run that is done when showing the settings page could result in an uncatched error.
13
 
14
  = 0.24.0 =
15
+ *(pre-released: 20 Nov 2021, not "released", in the sense that stable tag never pointed to this release)*
16
  * Improved file manager: You can now tweak conversion settings, delete conversion and see mime type of images.
17
  * Conversions logs are made more readable
18
  * Bumped webp-convert to 0.24.0
composer.json CHANGED
@@ -5,7 +5,7 @@
5
  "license": "MIT",
6
  "require": {
7
  "composer/installers": "^1.12.0",
8
- "rosell-dk/webp-convert": "^2.8.0",
9
  "rosell-dk/webp-convert-cloud-service": "^2.0.0",
10
  "rosell-dk/dom-util-for-webp": "^0.5.0",
11
  "rosell-dk/htaccess-capability-tester": "^0.9.0",
5
  "license": "MIT",
6
  "require": {
7
  "composer/installers": "^1.12.0",
8
+ "rosell-dk/webp-convert": "^2.9.0",
9
  "rosell-dk/webp-convert-cloud-service": "^2.0.0",
10
  "rosell-dk/dom-util-for-webp": "^0.5.0",
11
  "rosell-dk/htaccess-capability-tester": "^0.9.0",
docs/publishing.md CHANGED
@@ -114,12 +114,12 @@ svn status | grep '^!' | awk '{print $2}' | xargs svn delete --force (t
114
  Then add a new tag
115
  ```
116
  cd svn
117
- svn cp trunk tags/0.24.1 (this will copy trunk into a new tag)
118
  ```
119
 
120
  And commit!
121
  ```
122
- svn ci -m '0.24.1'
123
  ```
124
 
125
 
114
  Then add a new tag
115
  ```
116
  cd svn
117
+ svn cp trunk tags/0.24.2 (this will copy trunk into a new tag)
118
  ```
119
 
120
  And commit!
121
  ```
122
+ svn ci -m '0.24.2'
123
  ```
124
 
125
 
lib/classes/CLI.php CHANGED
@@ -26,7 +26,7 @@ class CLI extends \WP_CLI_Command
26
  * [--only-jpeg]
27
  * : Only convert jpeg images
28
  *
29
- * [--quality=]
30
  * : Override quality with specified (0-100)
31
  *
32
  * [--near-lossless]
26
  * [--only-jpeg]
27
  * : Only convert jpeg images
28
  *
29
+ * [--quality]
30
  * : Override quality with specified (0-100)
31
  *
32
  * [--near-lossless]
lib/classes/ConvertHelperIndependent.php CHANGED
@@ -571,7 +571,7 @@ APACHE
571
  $text = preg_replace('#' . preg_quote($_SERVER["DOCUMENT_ROOT"]) . '#', '[doc-root]', $text);
572
 
573
  // TODO: Put version number somewhere else. Ie \WebPExpress\VersionNumber::version
574
- $text = 'WebP Express 0.24.2. ' . $msgTop . ', ' . date("Y-m-d H:i:s") . "\n\r\n\r" . $text;
575
 
576
  $logFile = self::getLogFilename($source, $logDir);
577
 
571
  $text = preg_replace('#' . preg_quote($_SERVER["DOCUMENT_ROOT"]) . '#', '[doc-root]', $text);
572
 
573
  // TODO: Put version number somewhere else. Ie \WebPExpress\VersionNumber::version
574
+ $text = 'WebP Express 0.25.0. ' . $msgTop . ', ' . date("Y-m-d H:i:s") . "\n\r\n\r" . $text;
575
 
576
  $logFile = self::getLogFilename($source, $logDir);
577
 
lib/classes/FileHelper.php CHANGED
@@ -349,7 +349,7 @@ class FileHelper
349
  * @return true if windows; false if not.
350
  */
351
  public static function isWindows(){
352
- return (boolean) preg_match('/^win/i', PHP_OS);
353
  }
354
 
355
 
349
  * @return true if windows; false if not.
350
  */
351
  public static function isWindows(){
352
+ return preg_match('/^win/i', PHP_OS);
353
  }
354
 
355
 
vendor/composer/InstalledVersions.php CHANGED
@@ -24,8 +24,21 @@ use Composer\Semver\VersionParser;
24
  */
25
  class InstalledVersions
26
  {
 
 
 
 
27
  private static $installed;
 
 
 
 
28
  private static $canGetVendors;
 
 
 
 
 
29
  private static $installedByVendor = array();
30
 
31
  /**
24
  */
25
  class InstalledVersions
26
  {
27
+ /**
28
+ * @var mixed[]|null
29
+ * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
30
+ */
31
  private static $installed;
32
+
33
+ /**
34
+ * @var bool|null
35
+ */
36
  private static $canGetVendors;
37
+
38
+ /**
39
+ * @var array[]
40
+ * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
41
+ */
42
  private static $installedByVendor = array();
43
 
44
  /**
vendor/composer/autoload_classmap.php CHANGED
@@ -111,6 +111,12 @@ return array(
111
  'Composer\\Installers\\ZikulaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ZikulaInstaller.php',
112
  'DOMUtilForWebP\\ImageUrlReplacer' => $vendorDir . '/rosell-dk/dom-util-for-webp/src/ImageUrlReplacer.php',
113
  'DOMUtilForWebP\\PictureTags' => $vendorDir . '/rosell-dk/dom-util-for-webp/src/PictureTags.php',
 
 
 
 
 
 
114
  'HtaccessCapabilityTester\\HtaccessCapabilityTester' => $vendorDir . '/rosell-dk/htaccess-capability-tester/src/HtaccessCapabilityTester.php',
115
  'HtaccessCapabilityTester\\HttpRequesterInterface' => $vendorDir . '/rosell-dk/htaccess-capability-tester/src/HttpRequesterInterface.php',
116
  'HtaccessCapabilityTester\\HttpResponse' => $vendorDir . '/rosell-dk/htaccess-capability-tester/src/HttpResponse.php',
111
  'Composer\\Installers\\ZikulaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ZikulaInstaller.php',
112
  'DOMUtilForWebP\\ImageUrlReplacer' => $vendorDir . '/rosell-dk/dom-util-for-webp/src/ImageUrlReplacer.php',
113
  'DOMUtilForWebP\\PictureTags' => $vendorDir . '/rosell-dk/dom-util-for-webp/src/PictureTags.php',
114
+ 'ExecWithFallback\\Availability' => $vendorDir . '/rosell-dk/exec-with-fallback/src/Availability.php',
115
+ 'ExecWithFallback\\ExecWithFallback' => $vendorDir . '/rosell-dk/exec-with-fallback/src/ExecWithFallback.php',
116
+ 'ExecWithFallback\\POpen' => $vendorDir . '/rosell-dk/exec-with-fallback/src/POpen.php',
117
+ 'ExecWithFallback\\Passthru' => $vendorDir . '/rosell-dk/exec-with-fallback/src/Passthru.php',
118
+ 'ExecWithFallback\\ProcOpen' => $vendorDir . '/rosell-dk/exec-with-fallback/src/ProcOpen.php',
119
+ 'ExecWithFallback\\ShellExec' => $vendorDir . '/rosell-dk/exec-with-fallback/src/ShellExec.php',
120
  'HtaccessCapabilityTester\\HtaccessCapabilityTester' => $vendorDir . '/rosell-dk/htaccess-capability-tester/src/HtaccessCapabilityTester.php',
121
  'HtaccessCapabilityTester\\HttpRequesterInterface' => $vendorDir . '/rosell-dk/htaccess-capability-tester/src/HttpRequesterInterface.php',
122
  'HtaccessCapabilityTester\\HttpResponse' => $vendorDir . '/rosell-dk/htaccess-capability-tester/src/HttpResponse.php',
vendor/composer/autoload_psr4.php CHANGED
@@ -10,6 +10,7 @@ return array(
10
  'WebPConvertCloudService\\' => array($vendorDir . '/rosell-dk/webp-convert-cloud-service/src'),
11
  'ImageMimeTypeGuesser\\' => array($vendorDir . '/rosell-dk/image-mime-type-guesser/src'),
12
  'HtaccessCapabilityTester\\' => array($vendorDir . '/rosell-dk/htaccess-capability-tester/src'),
 
13
  'DOMUtilForWebP\\' => array($vendorDir . '/rosell-dk/dom-util-for-webp/src'),
14
  'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'),
15
  );
10
  'WebPConvertCloudService\\' => array($vendorDir . '/rosell-dk/webp-convert-cloud-service/src'),
11
  'ImageMimeTypeGuesser\\' => array($vendorDir . '/rosell-dk/image-mime-type-guesser/src'),
12
  'HtaccessCapabilityTester\\' => array($vendorDir . '/rosell-dk/htaccess-capability-tester/src'),
13
+ 'ExecWithFallback\\' => array($vendorDir . '/rosell-dk/exec-with-fallback/src'),
14
  'DOMUtilForWebP\\' => array($vendorDir . '/rosell-dk/dom-util-for-webp/src'),
15
  'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'),
16
  );
vendor/composer/autoload_static.php CHANGED
@@ -20,6 +20,10 @@ class ComposerStaticInit16597e36dd1bfcd787ed5a8e6d908243
20
  array (
21
  'HtaccessCapabilityTester\\' => 25,
22
  ),
 
 
 
 
23
  'D' =>
24
  array (
25
  'DOMUtilForWebP\\' => 15,
@@ -47,6 +51,10 @@ class ComposerStaticInit16597e36dd1bfcd787ed5a8e6d908243
47
  array (
48
  0 => __DIR__ . '/..' . '/rosell-dk/htaccess-capability-tester/src',
49
  ),
 
 
 
 
50
  'DOMUtilForWebP\\' =>
51
  array (
52
  0 => __DIR__ . '/..' . '/rosell-dk/dom-util-for-webp/src',
@@ -173,6 +181,12 @@ class ComposerStaticInit16597e36dd1bfcd787ed5a8e6d908243
173
  'Composer\\Installers\\ZikulaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ZikulaInstaller.php',
174
  'DOMUtilForWebP\\ImageUrlReplacer' => __DIR__ . '/..' . '/rosell-dk/dom-util-for-webp/src/ImageUrlReplacer.php',
175
  'DOMUtilForWebP\\PictureTags' => __DIR__ . '/..' . '/rosell-dk/dom-util-for-webp/src/PictureTags.php',
 
 
 
 
 
 
176
  'HtaccessCapabilityTester\\HtaccessCapabilityTester' => __DIR__ . '/..' . '/rosell-dk/htaccess-capability-tester/src/HtaccessCapabilityTester.php',
177
  'HtaccessCapabilityTester\\HttpRequesterInterface' => __DIR__ . '/..' . '/rosell-dk/htaccess-capability-tester/src/HttpRequesterInterface.php',
178
  'HtaccessCapabilityTester\\HttpResponse' => __DIR__ . '/..' . '/rosell-dk/htaccess-capability-tester/src/HttpResponse.php',
20
  array (
21
  'HtaccessCapabilityTester\\' => 25,
22
  ),
23
+ 'E' =>
24
+ array (
25
+ 'ExecWithFallback\\' => 17,
26
+ ),
27
  'D' =>
28
  array (
29
  'DOMUtilForWebP\\' => 15,
51
  array (
52
  0 => __DIR__ . '/..' . '/rosell-dk/htaccess-capability-tester/src',
53
  ),
54
+ 'ExecWithFallback\\' =>
55
+ array (
56
+ 0 => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src',
57
+ ),
58
  'DOMUtilForWebP\\' =>
59
  array (
60
  0 => __DIR__ . '/..' . '/rosell-dk/dom-util-for-webp/src',
181
  'Composer\\Installers\\ZikulaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ZikulaInstaller.php',
182
  'DOMUtilForWebP\\ImageUrlReplacer' => __DIR__ . '/..' . '/rosell-dk/dom-util-for-webp/src/ImageUrlReplacer.php',
183
  'DOMUtilForWebP\\PictureTags' => __DIR__ . '/..' . '/rosell-dk/dom-util-for-webp/src/PictureTags.php',
184
+ 'ExecWithFallback\\Availability' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/Availability.php',
185
+ 'ExecWithFallback\\ExecWithFallback' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/ExecWithFallback.php',
186
+ 'ExecWithFallback\\POpen' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/POpen.php',
187
+ 'ExecWithFallback\\Passthru' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/Passthru.php',
188
+ 'ExecWithFallback\\ProcOpen' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/ProcOpen.php',
189
+ 'ExecWithFallback\\ShellExec' => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src/ShellExec.php',
190
  'HtaccessCapabilityTester\\HtaccessCapabilityTester' => __DIR__ . '/..' . '/rosell-dk/htaccess-capability-tester/src/HtaccessCapabilityTester.php',
191
  'HtaccessCapabilityTester\\HttpRequesterInterface' => __DIR__ . '/..' . '/rosell-dk/htaccess-capability-tester/src/HttpRequesterInterface.php',
192
  'HtaccessCapabilityTester\\HttpResponse' => __DIR__ . '/..' . '/rosell-dk/htaccess-capability-tester/src/HttpResponse.php',
vendor/composer/installed.json CHANGED
@@ -282,6 +282,86 @@
282
  ],
283
  "install-path": "../rosell-dk/dom-util-for-webp"
284
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  {
286
  "name": "rosell-dk/htaccess-capability-tester",
287
  "version": "0.9.1",
@@ -432,21 +512,22 @@
432
  },
433
  {
434
  "name": "rosell-dk/webp-convert",
435
- "version": "2.8.0",
436
- "version_normalized": "2.8.0.0",
437
  "source": {
438
  "type": "git",
439
  "url": "https://github.com/rosell-dk/webp-convert.git",
440
- "reference": "d01977c3db60fe683e292b861c14f2611c3c1f27"
441
  },
442
  "dist": {
443
  "type": "zip",
444
- "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/d01977c3db60fe683e292b861c14f2611c3c1f27",
445
- "reference": "d01977c3db60fe683e292b861c14f2611c3c1f27",
446
  "shasum": ""
447
  },
448
  "require": {
449
  "php": "^5.6 | ^7.0 | ^8.0",
 
450
  "rosell-dk/image-mime-type-guesser": "^0.4.0"
451
  },
452
  "require-dev": {
@@ -460,7 +541,7 @@
460
  "ext-vips": "to use Vips extension for converting.",
461
  "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing"
462
  },
463
- "time": "2021-11-24T10:18:37+00:00",
464
  "type": "library",
465
  "extra": {
466
  "scripts-descriptions": {
@@ -509,7 +590,7 @@
509
  ],
510
  "support": {
511
  "issues": "https://github.com/rosell-dk/webp-convert/issues",
512
- "source": "https://github.com/rosell-dk/webp-convert/tree/2.8.0"
513
  },
514
  "funding": [
515
  {
282
  ],
283
  "install-path": "../rosell-dk/dom-util-for-webp"
284
  },
285
+ {
286
+ "name": "rosell-dk/exec-with-fallback",
287
+ "version": "1.1.0",
288
+ "version_normalized": "1.1.0.0",
289
+ "source": {
290
+ "type": "git",
291
+ "url": "https://github.com/rosell-dk/exec-with-fallback.git",
292
+ "reference": "f15871ff0a419ace7b034607adf483d7542fffeb"
293
+ },
294
+ "dist": {
295
+ "type": "zip",
296
+ "url": "https://api.github.com/repos/rosell-dk/exec-with-fallback/zipball/f15871ff0a419ace7b034607adf483d7542fffeb",
297
+ "reference": "f15871ff0a419ace7b034607adf483d7542fffeb",
298
+ "shasum": ""
299
+ },
300
+ "require": {
301
+ "php": "^5.6 | ^7.0 | ^8.0"
302
+ },
303
+ "require-dev": {
304
+ "friendsofphp/php-cs-fixer": "^2.11",
305
+ "phpunit/phpunit": "^9.3",
306
+ "squizlabs/php_codesniffer": "3.*"
307
+ },
308
+ "suggest": {
309
+ "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing"
310
+ },
311
+ "time": "2021-12-01T08:54:31+00:00",
312
+ "type": "library",
313
+ "extra": {
314
+ "scripts-descriptions": {
315
+ "ci": "Run tests before CI",
316
+ "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'",
317
+ "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'",
318
+ "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard",
319
+ "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.",
320
+ "test": "Launches the preconfigured PHPUnit"
321
+ }
322
+ },
323
+ "installation-source": "dist",
324
+ "autoload": {
325
+ "psr-4": {
326
+ "ExecWithFallback\\": "src/"
327
+ }
328
+ },
329
+ "notification-url": "https://packagist.org/downloads/",
330
+ "license": [
331
+ "MIT"
332
+ ],
333
+ "authors": [
334
+ {
335
+ "name": "Bjørn Rosell",
336
+ "homepage": "https://www.bitwise-it.dk/contact",
337
+ "role": "Project Author"
338
+ }
339
+ ],
340
+ "description": "An exec() with fallback to emulations (proc_open, etc)",
341
+ "keywords": [
342
+ "command",
343
+ "exec",
344
+ "fallback",
345
+ "open_proc",
346
+ "resiliant",
347
+ "sturdy"
348
+ ],
349
+ "support": {
350
+ "issues": "https://github.com/rosell-dk/exec-with-fallback/issues",
351
+ "source": "https://github.com/rosell-dk/exec-with-fallback/tree/1.1.0"
352
+ },
353
+ "funding": [
354
+ {
355
+ "url": "https://github.com/rosell-dk",
356
+ "type": "github"
357
+ },
358
+ {
359
+ "url": "https://ko-fi.com/rosell",
360
+ "type": "ko_fi"
361
+ }
362
+ ],
363
+ "install-path": "../rosell-dk/exec-with-fallback"
364
+ },
365
  {
366
  "name": "rosell-dk/htaccess-capability-tester",
367
  "version": "0.9.1",
512
  },
513
  {
514
  "name": "rosell-dk/webp-convert",
515
+ "version": "2.9.0",
516
+ "version_normalized": "2.9.0.0",
517
  "source": {
518
  "type": "git",
519
  "url": "https://github.com/rosell-dk/webp-convert.git",
520
+ "reference": "e8cb8d5bec49e85638d674f34b6eb4e2820d7aee"
521
  },
522
  "dist": {
523
  "type": "zip",
524
+ "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/e8cb8d5bec49e85638d674f34b6eb4e2820d7aee",
525
+ "reference": "e8cb8d5bec49e85638d674f34b6eb4e2820d7aee",
526
  "shasum": ""
527
  },
528
  "require": {
529
  "php": "^5.6 | ^7.0 | ^8.0",
530
+ "rosell-dk/exec-with-fallback": "^1.0.0",
531
  "rosell-dk/image-mime-type-guesser": "^0.4.0"
532
  },
533
  "require-dev": {
541
  "ext-vips": "to use Vips extension for converting.",
542
  "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing"
543
  },
544
+ "time": "2021-12-07T08:26:21+00:00",
545
  "type": "library",
546
  "extra": {
547
  "scripts-descriptions": {
590
  ],
591
  "support": {
592
  "issues": "https://github.com/rosell-dk/webp-convert/issues",
593
+ "source": "https://github.com/rosell-dk/webp-convert/tree/2.9.0"
594
  },
595
  "funding": [
596
  {
vendor/composer/installed.php CHANGED
@@ -5,7 +5,7 @@
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => 'd35df4914bfc907d27c5948d18cb05d9048ba3a0',
9
  'name' => 'rosell-dk/webp-express',
10
  'dev' => true,
11
  ),
@@ -37,6 +37,15 @@
37
  'reference' => 'd2554c79a0e6ffc710c2c0d646e217a9ac76dcaf',
38
  'dev_requirement' => false,
39
  ),
 
 
 
 
 
 
 
 
 
40
  'rosell-dk/htaccess-capability-tester' => array(
41
  'pretty_version' => '0.9.1',
42
  'version' => '0.9.1.0',
@@ -56,12 +65,12 @@
56
  'dev_requirement' => false,
57
  ),
58
  'rosell-dk/webp-convert' => array(
59
- 'pretty_version' => '2.8.0',
60
- 'version' => '2.8.0.0',
61
  'type' => 'library',
62
  'install_path' => __DIR__ . '/../rosell-dk/webp-convert',
63
  'aliases' => array(),
64
- 'reference' => 'd01977c3db60fe683e292b861c14f2611c3c1f27',
65
  'dev_requirement' => false,
66
  ),
67
  'rosell-dk/webp-convert-cloud-service' => array(
@@ -79,7 +88,7 @@
79
  'type' => 'wordpress-plugin',
80
  'install_path' => __DIR__ . '/../../',
81
  'aliases' => array(),
82
- 'reference' => 'd35df4914bfc907d27c5948d18cb05d9048ba3a0',
83
  'dev_requirement' => false,
84
  ),
85
  'roundcube/plugin-installer' => array(
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => '7f2f1fb55115c406a9142afaf571e9fc20249c4b',
9
  'name' => 'rosell-dk/webp-express',
10
  'dev' => true,
11
  ),
37
  'reference' => 'd2554c79a0e6ffc710c2c0d646e217a9ac76dcaf',
38
  'dev_requirement' => false,
39
  ),
40
+ 'rosell-dk/exec-with-fallback' => array(
41
+ 'pretty_version' => '1.1.0',
42
+ 'version' => '1.1.0.0',
43
+ 'type' => 'library',
44
+ 'install_path' => __DIR__ . '/../rosell-dk/exec-with-fallback',
45
+ 'aliases' => array(),
46
+ 'reference' => 'f15871ff0a419ace7b034607adf483d7542fffeb',
47
+ 'dev_requirement' => false,
48
+ ),
49
  'rosell-dk/htaccess-capability-tester' => array(
50
  'pretty_version' => '0.9.1',
51
  'version' => '0.9.1.0',
65
  'dev_requirement' => false,
66
  ),
67
  'rosell-dk/webp-convert' => array(
68
+ 'pretty_version' => '2.9.0',
69
+ 'version' => '2.9.0.0',
70
  'type' => 'library',
71
  'install_path' => __DIR__ . '/../rosell-dk/webp-convert',
72
  'aliases' => array(),
73
+ 'reference' => 'e8cb8d5bec49e85638d674f34b6eb4e2820d7aee',
74
  'dev_requirement' => false,
75
  ),
76
  'rosell-dk/webp-convert-cloud-service' => array(
88
  'type' => 'wordpress-plugin',
89
  'install_path' => __DIR__ . '/../../',
90
  'aliases' => array(),
91
+ 'reference' => '7f2f1fb55115c406a9142afaf571e9fc20249c4b',
92
  'dev_requirement' => false,
93
  ),
94
  'roundcube/plugin-installer' => array(
vendor/rosell-dk/exec-with-fallback/LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
vendor/rosell-dk/exec-with-fallback/README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Exec with fallback
2
+
3
+ [![Latest Stable Version](http://poser.pugx.org/rosell-dk/exec-with-fallback/v)](https://packagist.org/packages/rosell-dk/exec-with-fallback)
4
+ [![Build Status](https://github.com/rosell-dk/exec-with-fallback/actions/workflows/php.yml/badge.svg)](https://github.com/rosell-dk/exec-with-fallback/actions/workflows/php.yml)
5
+ [![Software License](http://poser.pugx.org/rosell-dk/exec-with-fallback/license)](https://github.com/rosell-dk/exec-with-fallback/blob/master/LICENSE)
6
+ [![PHP Version Require](http://poser.pugx.org/rosell-dk/exec-with-fallback/require/php)](https://packagist.org/packages/rosell-dk/exec-with-fallback)
7
+
8
+
9
+ Some shared hosts may have disabled *exec()*, but leaved *proc_open()*, *passthru()*, *popen()* or *shell_exec()* open. In case you want to easily fall back to emulating *exec()* with one of these, you have come to the right library.
10
+
11
+ This library can be useful if you a writing code that is meant to run on a broad spectrum of systems, as it makes your exec() call succeed on more of these systems.
12
+
13
+ ## Usage:
14
+ Simply swap out your current *exec()* calls with *ExecWithFallback::exec()*. The signatures are exactly the same and errors are handled the same way.
15
+
16
+ ```php
17
+ use ExecWithFallback\ExecWithFallback;
18
+ $result = ExecWithFallback::exec('echo "hi"', $output, $result_code);
19
+ // $output (array) now holds the output
20
+ // $result_code (int) now holds the result code
21
+ // $return (string | false) is now false in case of failure or the last line of the output
22
+ ```
23
+
24
+ If you have `function_exists('exec')` in your code, you can change it to `ExecWithFallback::anyAvailable()`
25
+
26
+ ## Installing
27
+ `composer require rosell-dk/exec-with-fallback`
28
+
29
+ ## Implementation
30
+ *ExecWithFallback::exec()* first checks if *exec()* is available and calls it, if it is. In case *exec* is unavailable (deactivated on server), or exec() returns false, it moves on to checking if *passthru()* is available and so on. The order is as follows:
31
+ - exec()
32
+ - passthru()
33
+ - popen()
34
+ - proc_open()
35
+ - shell_exec()
36
+
37
+ In case all functions are unavailable, *exec()* is called. This ensures that the error handling will be exactly as usual. In case none succeeded, but at least one failed by returning false, false is returned. Again to mimic *exec()* behavior.
38
+
39
+ PS: As *shell_exec()* does not support *$result_code*, it will only be used when $result_code isn't supplied. *system()* is not implemented, as it cannot return the last line of output and there is no way to detect if your code relies on that.
40
+
41
+ If you for some reason want to run a specific exec() emulation, you can use the corresponding class directly, ie *ProcOpen::exec()*.
42
+
43
+ ## Is it worth it?
44
+ Well, often these functions are often all enabled or all disabled. So on the majority of systems, it will not make a difference. But on the other hand: This library is easily installed, very lightweight and very well tested.
45
+
46
+ **easily installed**\
47
+ Install with composer (`composer require rosell-dk/exec-with-fallback`) and substitute your *exec()* calls.
48
+
49
+ **lightweight**\
50
+ The library is extremely lightweight. In case *exec()* is available, it is called immediately and only the main file is autoloaded. In case all are unavailable, it only costs a little loop, amounting to five *function_exists()* calls, and again, only the main file is autoloaded. In case *exec()* is unavailable, but one of the others are available, only that implementation is autoloaded, besides the main file.
51
+
52
+ **well tested**\
53
+ I made sure that the function behaves exactly like *exec()*, and wrote a lot of test cases. It is tested on ubuntu, windows, mac (all in several versions). It is tested in PHP 7.0, 7.1, 7.2, 7.3, 7.4 and 8.0. And it is tested in different combinations of disabled functions.
54
+
55
+ **going to be maintained**\
56
+ I'm going to use this library in [webp-convert](https://github.com/rosell-dk/webp-convert), which is used in many projects. So it is going to be widely used. While I don't expect much need for maintenance for this project, it is going to be there, if needed.
vendor/rosell-dk/exec-with-fallback/composer.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "rosell-dk/exec-with-fallback",
3
+ "description": "An exec() with fallback to emulations (proc_open, etc)",
4
+ "type": "library",
5
+ "license": "MIT",
6
+ "keywords": ["exec", "open_proc", "command", "fallback", "sturdy", "resiliant"],
7
+ "scripts": {
8
+ "ci": [
9
+ "@test",
10
+ "@phpcs-all",
11
+ "@composer validate --no-check-all --strict",
12
+ "@phpstan-global"
13
+ ],
14
+ "test": "./vendor/bin/phpunit --coverage-text",
15
+ "test-41": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'",
16
+ "phpunit": "phpunit --coverage-text",
17
+ "test-no-cov": "phpunit --no-coverage",
18
+ "cs-fix-all": [
19
+ "php-cs-fixer fix src"
20
+ ],
21
+ "cs-fix": "php-cs-fixer fix",
22
+ "cs-dry": "php-cs-fixer fix --dry-run --diff",
23
+ "phpcs": "phpcs --standard=PSR2",
24
+ "phpcs-all": "phpcs --standard=PSR2 src",
25
+ "phpcbf": "phpcbf --standard=PSR2",
26
+ "phpstan": "vendor/bin/phpstan analyse src --level=4",
27
+ "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4",
28
+ "phpstan-global": "~/.config/composer/vendor/bin/phpstan analyse src --level=4"
29
+ },
30
+ "extra": {
31
+ "scripts-descriptions": {
32
+ "ci": "Run tests before CI",
33
+ "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'",
34
+ "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'",
35
+ "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard",
36
+ "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.",
37
+ "test": "Launches the preconfigured PHPUnit"
38
+ }
39
+ },
40
+ "autoload": {
41
+ "psr-4": { "ExecWithFallback\\": "src/" }
42
+ },
43
+ "autoload-dev": {
44
+ "psr-4": { "ExecWithFallback\\Tests\\": "tests/" }
45
+ },
46
+ "authors": [
47
+ {
48
+ "name": "Bjørn Rosell",
49
+ "homepage": "https://www.bitwise-it.dk/contact",
50
+ "role": "Project Author"
51
+ }
52
+ ],
53
+ "require": {
54
+ "php": "^5.6 | ^7.0 | ^8.0"
55
+ },
56
+ "suggest": {
57
+ "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing"
58
+ },
59
+ "require-dev": {
60
+ "friendsofphp/php-cs-fixer": "^2.11",
61
+ "phpunit/phpunit": "^9.3",
62
+ "squizlabs/php_codesniffer": "3.*"
63
+ },
64
+ "config": {
65
+ "sort-packages": true
66
+ }
67
+ }
vendor/rosell-dk/exec-with-fallback/docs/notes.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Read up on proc_open
3
+ https://www.sitepoint.com/proc-open-communicate-with-the-outside-world/
4
+ https://www.php.net/manual/en/function.proc-open.php
5
+ https://www.php.net/manual/en/function.proc-close.php
6
+ https://www.php.net/manual/en/function.stream-set-blocking.php
7
+ https://www.php.net/manual/en/function.stream-select.php
8
+ https://stackoverflow.com/questions/21353611/how-to-wait-for-a-process-executed-by-proc-open-in-php
9
+ https://pretagteam.com/question/how-to-wait-for-a-process-executed-by-procopen-in-php
10
+ https://www.google.com/search?q=proc_open+wait&oq=proc_open+wait&aqs=chrome..69i57.2386j0j1&sourceid=chrome&ie=UTF-8
11
+ https://wuhzat.wordpress.com/2011/01/11/php-exec-vs-proc_open/
12
+ https://stackoverflow.com/questions/5673740/php-or-apache-exec-popen-system-and-proc-open-commands-do-not-execute-any-com
13
+ https://stackoverflow.com/questions/25424506/the-difference-between-exec-and-popen/25424608
14
+
15
+ And see how other uses it:
16
+ https://packagist.org/packages/tivie/command
17
+ https://github.com/tivie/command/blob/master/src/Command.php
18
+ https://packagist.org/packages/symfony/process
19
+ https://github.com/axute/process
20
+ https://packagist.org/?query=proc_open
21
+ https://stackoverflow.com/questions/6014819/how-to-get-output-of-proc-open
22
+
23
+
24
+ https://linuxhint.com/wait_command_linux/
25
+
26
+
27
+ #pcntl_exec
28
+ Should we use it?
29
+ https://www.php.net/manual/en/function.proc-open.php#102239
30
+ https://www.php.net/manual/en/function.pcntl-exec.php
31
+ https://www.php.net/manual/en/function.posix-mkfifo.php
32
+
33
+
34
+ #popen
35
+ https://www.php.net/manual/en/function.popen.php
36
+
37
+
38
+ #shell_exec
39
+ Hm... no exit code.. how to deal with that?
40
+ https://www.php.net/manual/en/function.shell-exec.php
41
+
42
+
43
+ # disable_functions
44
+ Perhaps check `ini_get('disable_functions')` too ?
45
+ https://stackoverflow.com/questions/3938120/check-if-exec-is-disabled
46
+ https://stackoverflow.com/questions/2749591/php-exec-check-if-enabled-or-disabled
47
+ https://www.py4u.net/discuss/26911
48
+
49
+ # passthrough
50
+ https://www.php.net/manual/en/function.passthru.php
51
+
52
+ According to this, you cannot store in variable:
53
+ https://stackoverflow.com/questions/732832/php-exec-vs-system-vs-passthru
54
+
55
+ However, it can be done with output buffering:
56
+ ```
57
+ function yemenEx($in)
58
+ {
59
+ $out = '';
60
+ if (function_exists('exec')) {
61
+ @exec($in, $out);
62
+ $out = @join("\n", $out);
63
+ } elseif (function_exists('passthru')) {
64
+ ob_start();
65
+ @passthru($in);
66
+ $out = ob_get_clean();
67
+ } elseif (function_exists('system')) {
68
+ ob_start();
69
+ @system($in);
70
+ $out = ob_get_clean();
71
+ } elseif (function_exists('shell_exec')) {
72
+ $out = shell_exec($in);
73
+ } elseif (is_resource($f = @popen($in, "r"))) {
74
+ $out = "";
75
+ while (!@feof($f)) {
76
+ $out .= fread($f, 1024);
77
+ }
78
+ pclose($f);
79
+ }
80
+ return $out;
81
+ }
82
+ ```
83
+ (got it from here: https://hotexamples.com/examples/-/-/passthru/php-passthru-function-examples.html)
84
+ Also check this little overview out: https://stackoverflow.com/questions/732832/php-exec-vs-system-vs-passthru
85
+ https://stackoverflow.com/questions/732832/php-exec-vs-system-vs-passthru
86
+
87
+
88
+
89
+ #system
90
+
91
+
92
+ Should I call the library ExecWithBackup or something like that instead? - nah, only if I find a better name than that
93
+
94
+
95
+ # What should this be called?
96
+ Simply what it does:
97
+ - ExecWithFallback
98
+ - ExecOrSimilar
99
+ - TryHarderExec / ExecTryHarder
100
+
101
+ The rat finds its way… And dont give up easily. Tries different ways
102
+ - ExecRat / RatExec
103
+
104
+ Eller navngiv efter Wolfe, “the fixer” i Pulp Fiction - a no nonense charactor who gets the job done (with style)
105
+ - WolfeExec / ExecWolfe
106
+
107
+ Nationality:
108
+ - GermanExec
109
+ - DanishExec
110
+
111
+ Material:
112
+ - RubberExec
113
+ - RubberbandExec
114
+
115
+ Other ideas:
116
+ StrongExec, ResilientExec, EmulatedExec, GoalOrientedExec, ExecContractor, ExecDeLuxe, DropInExec, BetterExec, ExecMaster, ExecDragon, CuteExec, PersistantExec, ToughExec, ExecWithFallback, AdaptableExec, CompliantExec, ImprovedExec, ResoluteExec, StautExec, ObstinateExec, KeenExec, AgileExec, Smooth, Flexible, ExecAndFriends, SturdyExex, ResilientExec
vendor/rosell-dk/exec-with-fallback/phpstan.neon ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ parameters:
2
+ ignoreErrors:
3
+ - '#PHPDoc tag @param.*Unexpected token "&"#'
vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3
+ <coverage>
4
+ <include>
5
+ <directory suffix=".php">src/</directory>
6
+ </include>
7
+ <report>
8
+ <clover outputFile="build/logs/clover.xml"/>
9
+ <html outputDirectory="build/coverage"/>
10
+ <text outputFile="build/coverage.txt"/>
11
+ </report>
12
+ </coverage>
13
+ <testsuites>
14
+ <testsuite name=":vendor Test Suite">
15
+ <directory suffix="Test.php">./tests/</directory>
16
+ </testsuite>
17
+ </testsuites>
18
+ <logging>
19
+ <junit outputFile="build/report.junit.xml"/>
20
+ </logging>
21
+ </phpunit>
vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist.bak ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit bootstrap="vendor/autoload.php"
3
+ backupGlobals="false"
4
+ backupStaticAttributes="false"
5
+ colors="true"
6
+ verbose="true"
7
+ convertErrorsToExceptions="true"
8
+ convertNoticesToExceptions="true"
9
+ convertWarningsToExceptions="true"
10
+ processIsolation="false"
11
+ stopOnFailure="false">
12
+ <testsuites>
13
+ <testsuite name=":vendor Test Suite">
14
+ <directory suffix="Test.php">./tests/</directory>
15
+ </testsuite>
16
+ </testsuites>
17
+ <filter>
18
+ <whitelist>
19
+ <directory suffix=".php">src/</directory>
20
+ </whitelist>
21
+ </filter>
22
+ <logging>
23
+ <log type="junit" target="build/report.junit.xml"/>
24
+ <log type="coverage-clover" target="build/logs/clover.xml"/>
25
+ <log type="coverage-text" target="build/coverage.txt"/>
26
+ <log type="coverage-html" target="build/coverage"/>
27
+ </logging>
28
+ </phpunit>
vendor/rosell-dk/exec-with-fallback/src/Availability.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace ExecWithFallback;
3
+
4
+ /**
5
+ * Check if any of the methods are available on the system.
6
+ *
7
+ * @package ExecWithFallback
8
+ * @author Bjørn Rosell <it@rosell.dk>
9
+ */
10
+ class Availability extends ExecWithFallback
11
+ {
12
+
13
+ /**
14
+ * Check if any of the methods are available on the system.
15
+ *
16
+ * @param boolean $needResultCode Whether the code using this library is going to supply $result_code to the exec
17
+ * call. This matters because shell_exec is only available when not.
18
+ */
19
+ public static function anyAvailable($needResultCode = true)
20
+ {
21
+ foreach (self::$methods as $method) {
22
+ if (self::methodAvailable($method, $needResultCode)) {
23
+ return true;
24
+ }
25
+ }
26
+ return false;
27
+ }
28
+
29
+ public static function methodAvailable($method, $needResultCode = true)
30
+ {
31
+ if (!function_exists($method)) {
32
+ return false;
33
+ }
34
+ if ($needResultCode) {
35
+ return ($method != 'shell_exec');
36
+ }
37
+ return true;
38
+ }
39
+ }
vendor/rosell-dk/exec-with-fallback/src/ExecWithFallback.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace ExecWithFallback;
3
+
4
+ /**
5
+ * Execute command with exec(), open_proc() or whatever available
6
+ *
7
+ * @package ExecWithFallback
8
+ * @author Bjørn Rosell <it@rosell.dk>
9
+ */
10
+ class ExecWithFallback
11
+ {
12
+
13
+ protected static $methods = ['exec', 'passthru', 'popen', 'proc_open', 'shell_exec'];
14
+
15
+ /**
16
+ * Check if any of the methods are available on the system.
17
+ *
18
+ * @param boolean $needResultCode Whether the code using this library is going to supply $result_code to the exec
19
+ * call. This matters because shell_exec is only available when not.
20
+ */
21
+ public static function anyAvailable($needResultCode = true)
22
+ {
23
+ return Availability::anyAvailable($needResultCode);
24
+ }
25
+
26
+ /**
27
+ * Execute. - A substitute for exec()
28
+ *
29
+ * Same signature and results as exec(): https://www.php.net/manual/en/function.exec.php
30
+ *
31
+ * @param string $command The command to execute
32
+ * @param string &$output (optional)
33
+ * @param int &$result_code (optional)
34
+ *
35
+ * @return string | false The last line of output or false in case of failure
36
+ */
37
+ public static function exec($command, &$output = null, &$result_code = null)
38
+ {
39
+ foreach (self::$methods as $method) {
40
+ if (function_exists($method)) {
41
+ if (($method == 'shell_exec') && (func_num_args() == 3)) {
42
+ continue;
43
+ }
44
+ $result = self::runExec($method, $command, $output, $result_code);
45
+ if ($result !== false) {
46
+ return $result;
47
+ }
48
+ }
49
+ }
50
+ if (isset($result) && ($result === false)) {
51
+ return false;
52
+ }
53
+ return exec($command, $output, $result_code);
54
+ }
55
+
56
+ public static function runExec($method, $command, &$output = null, &$result_code = null)
57
+ {
58
+ switch ($method) {
59
+ case 'exec':
60
+ return exec($command, $output, $result_code);
61
+ case 'passthru':
62
+ return Passthru::exec($command, $output, $result_code);
63
+ case 'popen':
64
+ return POpen::exec($command, $output, $result_code);
65
+ case 'proc_open':
66
+ return ProcOpen::exec($command, $output, $result_code);
67
+ case 'shell_exec':
68
+ if (func_num_args() == 4) {
69
+ return ShellExec::exec($command, $output, $result_code);
70
+ } else {
71
+ return ShellExec::exec($command, $output);
72
+ }
73
+ }
74
+ return false;
75
+ }
76
+ }
vendor/rosell-dk/exec-with-fallback/src/POpen.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace ExecWithFallback;
4
+
5
+ /**
6
+ * Emulate exec() with system()
7
+ *
8
+ * @package ExecWithFallback
9
+ * @author Bjørn Rosell <it@rosell.dk>
10
+ */
11
+ class POpen
12
+ {
13
+
14
+ /**
15
+ * Emulate exec() with system()
16
+ *
17
+ * @param string $command The command to execute
18
+ * @param string &$output (optional)
19
+ * @param int &$result_code (optional)
20
+ *
21
+ * @return string | false The last line of output or false in case of failure
22
+ */
23
+ public static function exec($command, &$output = null, &$result_code = null)
24
+ {
25
+
26
+ $handle = @popen($command, "r");
27
+ if ($handle === false) {
28
+ return false;
29
+ }
30
+
31
+ $result = '';
32
+ while (!@feof($handle)) {
33
+ $result .= fread($handle, 1024);
34
+ }
35
+
36
+ //Note: Unix Only:
37
+ // pclose() is internally implemented using the waitpid(3) system call.
38
+ // To obtain the real exit status code the pcntl_wexitstatus() function should be used.
39
+ $result_code = pclose($handle);
40
+
41
+ $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result);
42
+
43
+ // remove the last element if it is blank
44
+ if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) {
45
+ array_pop($theOutput);
46
+ }
47
+
48
+ if (count($theOutput) == 0) {
49
+ return '';
50
+ }
51
+ if (gettype($output) == 'array') {
52
+ foreach ($theOutput as $line) {
53
+ $output[] = $line;
54
+ }
55
+ } else {
56
+ $output = $theOutput;
57
+ }
58
+ return $theOutput[count($theOutput) -1];
59
+ }
60
+ }
vendor/rosell-dk/exec-with-fallback/src/Passthru.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace ExecWithFallback;
4
+
5
+ /**
6
+ * Emulate exec() with passthru()
7
+ *
8
+ * @package ExecWithFallback
9
+ * @author Bjørn Rosell <it@rosell.dk>
10
+ */
11
+ class Passthru
12
+ {
13
+
14
+ /**
15
+ * Emulate exec() with passthru()
16
+ *
17
+ * @param string $command The command to execute
18
+ * @param string &$output (optional)
19
+ * @param int &$result_code (optional)
20
+ *
21
+ * @return string | false The last line of output or false in case of failure
22
+ */
23
+ public static function exec($command, &$output = null, &$result_code = null)
24
+ {
25
+ ob_start();
26
+ // Note: We use try/catch in order to close output buffering in case it throws
27
+ try {
28
+ passthru($command, $result_code);
29
+ } catch (\Exception $e) {
30
+ ob_get_clean();
31
+ passthru($command, $result_code);
32
+ } catch (\Throwable $e) {
33
+ ob_get_clean();
34
+ passthru($command, $result_code);
35
+ }
36
+ $result = ob_get_clean();
37
+
38
+ // split new lines. Also remove trailing space, as exec() does
39
+ $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result);
40
+
41
+ // remove the last element if it is blank
42
+ if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) {
43
+ array_pop($theOutput);
44
+ }
45
+
46
+ if (count($theOutput) == 0) {
47
+ return '';
48
+ }
49
+ if (gettype($output) == 'array') {
50
+ foreach ($theOutput as $line) {
51
+ $output[] = $line;
52
+ }
53
+ } else {
54
+ $output = $theOutput;
55
+ }
56
+ return $theOutput[count($theOutput) -1];
57
+ }
58
+ }
vendor/rosell-dk/exec-with-fallback/src/ProcOpen.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace ExecWithFallback;
4
+
5
+ /**
6
+ * Emulate exec() with proc_open()
7
+ *
8
+ * @package ExecWithFallback
9
+ * @author Bjørn Rosell <it@rosell.dk>
10
+ */
11
+ class ProcOpen
12
+ {
13
+
14
+ /**
15
+ * Emulate exec() with proc_open()
16
+ *
17
+ * @param string $command The command to execute
18
+ * @param string &$output (optional)
19
+ * @param int &$result_code (optional)
20
+ *
21
+ * @return string | false The last line of output or false in case of failure
22
+ */
23
+ public static function exec($command, &$output = null, &$result_code = null)
24
+ {
25
+ $descriptorspec = array(
26
+ //0 => array("pipe", "r"),
27
+ 1 => array("pipe", "w"),
28
+ //2 => array("pipe", "w"),
29
+ //2 => array("file", "/tmp/error-output.txt", "a")
30
+ );
31
+
32
+ $cwd = getcwd(); // or is "/tmp" better?
33
+ $processHandle = proc_open($command, $descriptorspec, $pipes, $cwd);
34
+ $result = "";
35
+ if (is_resource($processHandle)) {
36
+ // Got this solution here:
37
+ // https://stackoverflow.com/questions/5673740/php-or-apache-exec-popen-system-and-proc-open-commands-do-not-execute-any-com
38
+ //fclose($pipes[0]);
39
+ $result = stream_get_contents($pipes[1]);
40
+ fclose($pipes[1]);
41
+ //fclose($pipes[2]);
42
+ $result_code = proc_close($processHandle);
43
+
44
+ // split new lines. Also remove trailing space, as exec() does
45
+ $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result);
46
+
47
+ // remove the last element if it is blank
48
+ if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) {
49
+ array_pop($theOutput);
50
+ }
51
+
52
+ if (count($theOutput) == 0) {
53
+ return '';
54
+ }
55
+ if (gettype($output) == 'array') {
56
+ foreach ($theOutput as $line) {
57
+ $output[] = $line;
58
+ }
59
+ } else {
60
+ $output = $theOutput;
61
+ }
62
+ return $theOutput[count($theOutput) -1];
63
+ } else {
64
+ return false;
65
+ }
66
+ }
67
+ }
vendor/rosell-dk/exec-with-fallback/src/ShellExec.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace ExecWithFallback;
4
+
5
+ /**
6
+ * Emulate exec() with system()
7
+ *
8
+ * @package ExecWithFallback
9
+ * @author Bjørn Rosell <it@rosell.dk>
10
+ */
11
+ class ShellExec
12
+ {
13
+
14
+ /**
15
+ * Emulate exec() with system()
16
+ *
17
+ * @param string $command The command to execute
18
+ * @param string &$output (optional)
19
+ * @param int &$result_code (optional)
20
+ *
21
+ * @return string | false The last line of output or false in case of failure
22
+ */
23
+ public static function exec($command, &$output = null, &$result_code = null)
24
+ {
25
+ //echo "\NSHELL:" . $command . ':' . func_num_args() . "\n";
26
+
27
+ $resultCodeSupplied = (func_num_args() >= 3);
28
+ if ($resultCodeSupplied) {
29
+ return false;
30
+ }
31
+
32
+ $result = shell_exec($command);
33
+
34
+ // result:
35
+ // - A string containing the output from the executed command,
36
+ // - false if the pipe cannot be established
37
+ // - or null if an error occurs or the command produces no output.
38
+
39
+ if ($result === false) {
40
+ return false;
41
+ }
42
+ if (is_null($result)) {
43
+ // hm, "null if an error occurs or the command produces no output."
44
+ // What were they thinking?
45
+ // And yes, it does return null, when no output, which is confirmed in the test "echo hi 1>/dev/null"
46
+ // What should we do? Throw or accept?
47
+ // Perhaps shell_exec throws in newer versions of PHP instead of returning null.
48
+ // We are counting on it until proved wrong.
49
+ return '';
50
+ }
51
+
52
+ $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result);
53
+
54
+ // remove the last element if it is blank
55
+ if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) {
56
+ array_pop($theOutput);
57
+ }
58
+
59
+ if (count($theOutput) == 0) {
60
+ return '';
61
+ }
62
+ if (gettype($output) == 'array') {
63
+ foreach ($theOutput as $line) {
64
+ $output[] = $line;
65
+ }
66
+ } else {
67
+ $output = $theOutput;
68
+ }
69
+ return $theOutput[count($theOutput) -1];
70
+ }
71
+ }
vendor/rosell-dk/exec-with-fallback/test.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ include 'vendor/autoload.php';
3
+ //include 'src/ExecWithFallback.php';
4
+ use ExecWithFallback\ExecWithFallback;
5
+ use ExecWithFallback\Tests\ExecWithFallbackTest;
6
+
7
+ ExecWithFallback::exec('echo hello');
8
+
9
+ ExecWithFallbackTest::testExec();
vendor/rosell-dk/webp-convert/README.md CHANGED
@@ -125,11 +125,12 @@ Bread on the table don't come for free, even though this library does, and alway
125
  - [Mathieu Gollain-Dupont](https://www.linkedin.com/in/mathieu-gollain-dupont-9938a4a/)
126
  - Ruben Solvang
127
 
128
- *Persons who contributed with coffee within the last 30 days:*
129
-
130
- - Anon
131
- - Eder Ribeiro
132
- - Christian
 
133
 
134
  *Persons who contributed with extra generously amounts of coffee / lifetime backing (>50$) - thanks!:*
135
 
@@ -139,6 +140,12 @@ Bread on the table don't come for free, even though this library does, and alway
139
  - Max Kreminsky ($65)
140
  - Steven Sullivan ($51)
141
 
 
 
 
 
 
 
142
  ## New in 2.8.0:
143
  - Converter option definitions are now accessible along with suggested UI and helptexts. This allows one to auto-generate a frontend based on conversion options. The feature is already in use in the [webp-convert file manager](https://github.com/rosell-dk/webp-convert-filemanager), which is used in WebP Express. New method: `WebPConvert::getConverterOptionDefinitions()`
144
  - The part of the log that displays the options are made more readable. It also now warns about deprecated options.
125
  - [Mathieu Gollain-Dupont](https://www.linkedin.com/in/mathieu-gollain-dupont-9938a4a/)
126
  - Ruben Solvang
127
 
128
+ *Persons who recently contributed with [ko-fi](https://ko-fi.com/rosell) - Thanks!*
129
+ * 20 Nov: Ben J
130
+ * 13 Nov: @sween
131
+ * 9 Nov: @utrenkner
132
+ * 26 Oct: Anonymous
133
+ * 29 Aug: Pawa Tecnologia
134
 
135
  *Persons who contributed with extra generously amounts of coffee / lifetime backing (>50$) - thanks!:*
136
 
140
  - Max Kreminsky ($65)
141
  - Steven Sullivan ($51)
142
 
143
+ ## New in 2.9.0 (released 7 dec 2021, on my daughters 10 years birthday!)
144
+ - When exec() is unavailable, alternatives are now tried (emulations with proc_open(), passthru() etc). Using [this library](https://github.com/rosell-dk/exec-with-fallback) to do it.
145
+ - Gd is now marked as not operational when the needed functions for converting palette images to RGB is missing. Rationale: A half-working converter causes more trouble than one that is marked as not operational
146
+ - Improved CI tests. It is now tested on Windows, Mac and with deactivated functions (such as when exec() is disabled)
147
+ - And more (view closed issues [here](https://github.com/rosell-dk/webp-convert/milestone/25?closed=1)
148
+
149
  ## New in 2.8.0:
150
  - Converter option definitions are now accessible along with suggested UI and helptexts. This allows one to auto-generate a frontend based on conversion options. The feature is already in use in the [webp-convert file manager](https://github.com/rosell-dk/webp-convert-filemanager), which is used in WebP Express. New method: `WebPConvert::getConverterOptionDefinitions()`
151
  - The part of the log that displays the options are made more readable. It also now warns about deprecated options.
vendor/rosell-dk/webp-convert/composer.json CHANGED
@@ -11,10 +11,11 @@
11
  "@composer validate --no-check-all --strict",
12
  "@phpstan-global"
13
  ],
14
- "test": "phpunit --coverage-text",
15
- "test-41": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'",
16
  "phpunit": "phpunit --coverage-text",
17
- "test-no-cov": "phpunit --no-coverage",
 
 
 
18
  "cs-fix-all": [
19
  "php-cs-fixer fix src"
20
  ],
@@ -56,8 +57,9 @@
56
  }
57
  ],
58
  "require": {
59
- "php": "^5.6 | ^7.0 | ^8.0",
60
- "rosell-dk/image-mime-type-guesser": "^0.4.0"
 
61
  },
62
  "suggest": {
63
  "ext-gd": "to use GD extension for converting. Note: Gd must be compiled with webp support",
11
  "@composer validate --no-check-all --strict",
12
  "@phpstan-global"
13
  ],
 
 
14
  "phpunit": "phpunit --coverage-text",
15
+ "test": "phpunit --no-coverage",
16
+ "test-41": "phpunit --no-coverage --configuration 'phpunit-41.xml.dist'",
17
+ "test-with-coverage": "phpunit --coverage-text --configuration 'phpunit-with-coverage.xml.dist'",
18
+ "test-41-with-coverage": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'",
19
  "cs-fix-all": [
20
  "php-cs-fixer fix src"
21
  ],
57
  }
58
  ],
59
  "require": {
60
+ "php": "^5.6 | ^7.0 | ^8.0",
61
+ "rosell-dk/exec-with-fallback": "^1.0.0",
62
+ "rosell-dk/image-mime-type-guesser": "^0.4.0"
63
  },
64
  "suggest": {
65
  "ext-gd": "to use GD extension for converting. Note: Gd must be compiled with webp support",
vendor/rosell-dk/webp-convert/docs/development.md CHANGED
@@ -72,7 +72,7 @@ Before committing, first make sure to:
72
  ## Releasing
73
  Before releasing:
74
  - Update the version number in `Converters/AbstractConverter.php` (search for "WebP Convert")
75
- - Make sure that travis build is successful
76
 
77
  When releasing:
78
  - update the [webp-convert-concat](https://github.com/rosell-dk/webp-convert-concat) library
72
  ## Releasing
73
  Before releasing:
74
  - Update the version number in `Converters/AbstractConverter.php` (search for "WebP Convert")
75
+ - Make sure that ci build is successful
76
 
77
  When releasing:
78
  - update the [webp-convert-concat](https://github.com/rosell-dk/webp-convert-concat) library
vendor/rosell-dk/webp-convert/docs/v2.0/converting/options.md CHANGED
@@ -383,6 +383,7 @@ Type: integer (0 - 1 - 2)
383
  Default: 2
384
  Supported by: wpc
385
  ```
 
386
  <br>
387
 
388
  ### `wpc-crypt-api-key-in-transfer`
383
  Default: 2
384
  Supported by: wpc
385
  ```
386
+ PS: In many releases, you had to set this to 1 even though you were running on 2. This will be fixed in 2.9.0
387
  <br>
388
 
389
  ### `wpc-crypt-api-key-in-transfer`
vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/cwebp.md ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ # Installing cwebp using official precompilations
2
+
3
+ Official precompilations are available [here](https://developers.google.com/speed/webp/docs/precompiled). Since `WebPConvert` compares each binary's checksum first, you will have to change the checksums hardcoded in `Converters/Cwebp.php` if you want to replace any of them. If you feel the need of using another binary, please let us know - chances are that it should be added to the project!
vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/ffmpeg.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Installing FFMpeg
2
+ Its very easy.
3
+
4
+
5
+ # Ubuntu
6
+ Here is a tutorial for ubuntu: https://linuxize.com/post/how-to-install-ffmpeg-on-ubuntu-18-04/
7
+
8
+ ## GitHub actions workflow
9
+ As easy as adding this step to your workflow yaml:
10
+
11
+ ```yaml
12
+ - name: Setup ffmpeg
13
+ uses: FedericoCarboni/setup-ffmpeg@v1
14
+ ```
15
+ docs: https://github.com/marketplace/actions/setup-ffmpeg
vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gd.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Installing Gd extension with WebP support
2
+
3
+ ## Ubuntu 18.04
4
+
5
+ On Ubuntu 18.04, I did not have to do anything special to configure Gd for WebP support. The following worked right away:
6
+ ```
7
+ sudo apt-get install php7.2-gd
8
+ ```
9
+
10
+ ## Ubuntu 16.04
11
+ The official page with installation instructions is [available here](http://il1.php.net/manual/en/image.installation.php)
12
+
13
+ In summary:
14
+
15
+ PHP 5.5.0:
16
+ To get WebP support for `gd` in PHP 5.5.0, PHP must be configured with the `--with-vpx-dir` flag.
17
+
18
+ PHP >7.0.0:
19
+ PHP has to be configured with the `--with-webp-dir` flag
vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gmagick-extension.md ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Installing GMagick PHP extension with WebP support
2
+
3
+ See:
4
+ https://github.com/rosell-dk/webp-convert/issues/37
5
+
6
+ ## MX-19.4
7
+ I succeeded by simply doing the following after installing graphicsmagick, libwebp and libwebp-dev:
8
+ ```
9
+ sudo apt install php-gmagick
10
+ sudo service apache2 restart
11
+ ```
12
+ Note: For some reason this disables the imagick extension. It seems they cannot both be installed at the same time.
13
+
14
+
15
+ ## Ubuntu 18.04, using *PECL*
16
+ In Ubuntu 18.04, you will not have to do any special steps in order to compile with webp :)
17
+
18
+ 1. Find out which version of PHP you are using and the location of the relevant php.ini file. Both of these can be obtained with `phpinfo();`
19
+ 2. Find out which is the latest version of *gmagick* on pecl. https://pecl.php.net/package/gmagick
20
+ 3. Do the following - but alter to use the info you just collected
21
+
22
+ ```
23
+ sudo apt-get update
24
+ sudo apt-get install graphicsmagick gcc libgraphicsmagick1-dev php-pear php7.2-dev
25
+ sudo pecl install gmagick-2.0.5RC1
26
+ sudo echo "extension=gmagick.so" >> /etc/php/7.2/apache2/php.ini
27
+ sudo service apache2 restart
28
+ ```
29
+
30
+ Notes:
31
+ - The php-pear contains *pecl*.
32
+ - *php7.2-dev* provides *phpize*, which is needed by pecl. Use *php7.1-dev*, if you are on PHP 7.1
33
+ - We do not simply do a `pecl install gmagick` because the latest package is in beta, and pecl would not allow. You should however be able to do *pecl install gmagick-beta*, which should install the latest beta.
34
+ - If you are on *fpm*, remember to restart that as well (ie `sudo service php7.2-fpm restart`)
35
+
36
+ ## Plesk
37
+ https://support.plesk.com/hc/en-us/articles/115003511013-How-to-install-Gmagick-PHP-extension-on-Ubuntu-Debian-
38
+
39
+ ## From source
40
+ https://duntuk.com/how-install-graphicsmagick-gmagick-php-extension
vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/imagick-extension.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Installing Imagick extension with WebP support
2
+
3
+ ## MX-19.4
4
+ I succeeded by simply doing the following after installing imagemagick, libwebp and libwebp-dev:
5
+ ```
6
+ sudo apt install php-imagick
7
+ sudo service apache2 restart
8
+ ```
9
+
10
+ ## Ubuntu 16.04
11
+ In order to get imagick with WebP on Ubuntu 16.04, you (currently) need to:
12
+ 1. [Compile libwebp from source](https://developers.google.com/speed/webp/docs/compiling)
13
+ 2. [Compile imagemagick from source](https://www.imagemagick.org/script/install-source.php) (```./configure --with-webp=yes```)
14
+ 3. Compile php-imagick from source, phpize it and add ```extension=/path/to/imagick.so``` to php.ini
15
+
16
+ ## Ubuntu 18.04 (from source)
17
+ A simple `sudo apt-get install php-imagick` unfortunately does not give you webp support.
18
+ Again, you must:
19
+
20
+ ### 1. Compile libwebp from source
21
+ Instructions are [here](https://developers.google.com/speed/webp/docs/compiling).
22
+ In short, you need to:
23
+ ```
24
+ sudo apt-get install libjpeg-dev libpng-dev
25
+ wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.1.0.tar.gz
26
+ tar xvzf libwebp-1.1.0.tar.gz
27
+ cd into the dir
28
+ ./configure
29
+ make
30
+ sudo make install
31
+ ```
32
+
33
+ ### 2. Compile *imagemagick* from source, configured with *webp*
34
+ See tutorial [here](https://linuxconfig.org/how-to-install-imagemagick-7-on-ubuntu-18-04-linux), but configure with *webp* (`./configure --with-webp=yes`)
35
+
36
+ ```
37
+ sudo apt-get update
38
+ sudo apt build-dep imagemagick
39
+ wget https://imagemagick.org/download/ImageMagick.tar.gz
40
+ tar xvzf ImageMagick.tar.gz
41
+ cd into the dir
42
+ ./configure --with-webp=yes
43
+ sudo make
44
+ sudo make install
45
+ sudo ldconfig /usr/local/lib
46
+ sudo identify -version # to check if installed ok
47
+ make check # optional run in-depth check
48
+ ```
49
+ Check it this way: `identify -list format | grep WEBP`
50
+ - It should print a line
51
+
52
+ ### 3a. Install extension with pecl
53
+ First find out which version of PHP you are using and the location of the relevant *php.ini* file. Both of these can be obtained with `phpinfo();`. Next do the following (but alter to use the info you just collected):
54
+
55
+ ```
56
+ sudo apt-get update
57
+ sudo apt-get install imagemagick gcc libmagickwand-dev php-pear php7.2-dev
58
+ sudo pecl install imagick
59
+ sudo echo "extension=imagick.so" >> /etc/php/7.2/apache2/php.ini
60
+ sudo service apache2 restart
61
+ ```
62
+ Related:
63
+ https://askubuntu.com/questions/769396/how-to-install-imagemagick-for-php7-on-ubuntu-16-04
64
+
65
+
66
+ ### 3b. Alternively to using pecl, compile php-imagick from source
67
+ https://github.com/mkoppanen/imagick
68
+ First find out which version of PHP you are using and the location of the relevant *php.ini* file. Both of these can be obtained with `phpinfo();`. Next do the following (but alter to use the info you just collected):
69
+
70
+ ```
71
+ wget https://pecl.php.net/get/imagick-3.4.3.tgz
72
+ tar xvzf imagick-3.4.3.tgz
73
+ cd into the dir
74
+ sudo /usr/bin/phpize7.2 # note: find you version of phpize with locate phpize
75
+ ./configure
76
+ make
77
+ make install
78
+ sudo echo "extension=imagick.so" >> /etc/php/7.2/apache2/php.ini
79
+ sudo service apache2 restart
80
+ ```
vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/vips.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Installing vips extension
2
+
3
+ ### Step 1: Install the vips library
4
+ Follow the instructions on the [vips library github page](https://github.com/libvips/libvips/)
5
+
6
+ Don't forget to install required packages before running `./configure`:
7
+ ```
8
+ sudo apt-get install libglib2.0-dev pkg-config build-essential libexpat1-dev libjpeg-dev libpng-dev libwebp-dev gobject-introspection libgs-dev
9
+ ```
10
+
11
+ ### Step 2: Install the vips extension
12
+
13
+ ```
14
+ sudo pecl install vips
15
+ ```
16
+ &ndash; And add the following to the relevant php.ini:
17
+ ```
18
+ extension=vips
19
+ ```
20
+
21
+ (or `extension=vips.so` if you are in older PHP)
22
+
23
+ The vips extension is btw [also on github](https://github.com/libvips/php-vips-ext):
24
+
25
+
26
+ ## GitHub actions workflow
27
+ As easy as adding "vips" to the extensions for `setup-php@v2`:
28
+
29
+ ```yaml
30
+ - name: Setup PHP
31
+ uses: shivammathur/setup-php@v2
32
+ with:
33
+ php-version: '8.0'
34
+ extensions: vips
35
+ ```
vendor/rosell-dk/webp-convert/phpunit-with-coverage.xml.dist ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="false" processIsolation="false" stopOnFailure="false" bootstrap="vendor/autoload.php">
3
+ <coverage>
4
+ <include>
5
+ <directory suffix=".php">src/</directory>
6
+ </include>
7
+ <exclude>
8
+ <directory>./vendor</directory>
9
+ <directory>./tests</directory>
10
+ </exclude>
11
+ <report>
12
+ <clover outputFile="build/coverage.clover"/>
13
+ <html outputDirectory="build/coverage"/>
14
+ <text outputFile="build/coverage.txt"/>
15
+ </report>
16
+ </coverage>
17
+ <testsuites>
18
+ <testsuite name="WebPConvert Test Suite">
19
+ <directory>./tests/</directory>
20
+ </testsuite>
21
+ </testsuites>
22
+ <logging>
23
+ <junit outputFile="build/report.junit.xml"/>
24
+ </logging>
25
+ </phpunit>
vendor/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php CHANGED
@@ -120,7 +120,7 @@ abstract class AbstractConverter
120
  $this->setProvidedOptions($options);
121
 
122
  if (!isset($this->options['_skip_input_check'])) {
123
- $this->logLn('WebP Convert 2.8.0 ignited', 'bold');
124
  $this->logLn('PHP version: ' . phpversion());
125
  if (isset($_SERVER['SERVER_SOFTWARE'])) {
126
  $this->logLn('Server software: ' . $_SERVER['SERVER_SOFTWARE']);
@@ -282,7 +282,7 @@ abstract class AbstractConverter
282
  /**
283
  * Start conversion.
284
  *
285
- * Usually you would rather call the static convert method, but alternatively you can call
286
  * call ::createInstance to get an instance and then ::doConvert().
287
  *
288
  * @return void
@@ -306,14 +306,12 @@ abstract class AbstractConverter
306
  throw $e;
307
  } catch (\Exception $e) {
308
  $className = get_class($e);
309
-
310
  $classNameParts = explode("\\", $className);
311
  $shortClassName = array_pop($classNameParts);
312
 
313
  $this->logLn('');
314
  $this->logLn($shortClassName . ' thrown in ' . $e->getFile() . ':' . $e->getLine(), 'bold');
315
  $this->logLn('Message: "' . $e->getMessage() . '"', 'bold');
316
- //$this->logLn('Exception class: ' . $className);
317
 
318
  $this->logLn('Trace:');
319
  foreach ($e->getTrace() as $trace) {
@@ -325,9 +323,16 @@ abstract class AbstractConverter
325
  }
326
  }
327
  throw $e;
328
- } /*catch (\Error $e) {
329
- $this->logLn('ERROR');
330
- }*/
 
 
 
 
 
 
 
331
  }
332
 
333
  /**
120
  $this->setProvidedOptions($options);
121
 
122
  if (!isset($this->options['_skip_input_check'])) {
123
+ $this->logLn('WebP Convert 2.9.0 ignited', 'bold');
124
  $this->logLn('PHP version: ' . phpversion());
125
  if (isset($_SERVER['SERVER_SOFTWARE'])) {
126
  $this->logLn('Server software: ' . $_SERVER['SERVER_SOFTWARE']);
282
  /**
283
  * Start conversion.
284
  *
285
+ * Usually it would be more convenience to call the static convert method, but alternatively you can call
286
  * call ::createInstance to get an instance and then ::doConvert().
287
  *
288
  * @return void
306
  throw $e;
307
  } catch (\Exception $e) {
308
  $className = get_class($e);
 
309
  $classNameParts = explode("\\", $className);
310
  $shortClassName = array_pop($classNameParts);
311
 
312
  $this->logLn('');
313
  $this->logLn($shortClassName . ' thrown in ' . $e->getFile() . ':' . $e->getLine(), 'bold');
314
  $this->logLn('Message: "' . $e->getMessage() . '"', 'bold');
 
315
 
316
  $this->logLn('Trace:');
317
  foreach ($e->getTrace() as $trace) {
323
  }
324
  }
325
  throw $e;
326
+ } catch (\Throwable $e) {
327
+ $className = get_class($e);
328
+ $classNameParts = explode("\\", $className);
329
+ $shortClassName = array_pop($classNameParts);
330
+
331
+ $this->logLn('');
332
+ $this->logLn($shortClassName . ' thrown in ' . $e->getFile() . ':' . $e->getLine(), 'bold');
333
+ $this->logLn('Message: "' . $e->getMessage() . '"', 'bold');
334
+ throw $e;
335
+ }
336
  }
337
 
338
  /**
vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php CHANGED
@@ -101,6 +101,7 @@ trait AutoQualityTrait
101
  becomes: quality: 80, auto-limit: false
102
  */
103
  $q = $options['quality'];
 
104
  if ($q == 'auto') {
105
  $q = $options['quality'] = $options['max-quality'];
106
  $this->logLn(
@@ -120,6 +121,7 @@ trait AutoQualityTrait
120
  '*PS: "auto-limit" is set to false, as it was set explicitly to false in the options."*'
121
  );
122
  }
 
123
  }
124
 
125
  if ($options['auto-limit']) {
@@ -130,11 +132,21 @@ trait AutoQualityTrait
130
  );
131
  $q = JpegQualityDetector::detectQualityOfJpg($source);
132
  if (is_null($q)) {
133
- $q = $options['quality'];
134
  $this->/** @scrutinizer ignore-call */logLn(
135
  'Quality of source image could not be established (Imagick or GraphicsMagick is required). ' .
136
- 'Sorry, no auto-limit functionality for you. Using supplied quality (' . $q . ').'
137
  );
 
 
 
 
 
 
 
 
 
 
 
138
 
139
  $this->qualityCouldNotBeDetected = true;
140
  } else {
101
  becomes: quality: 80, auto-limit: false
102
  */
103
  $q = $options['quality'];
104
+ $useDeprecatedDefaultQuality = false;
105
  if ($q == 'auto') {
106
  $q = $options['quality'] = $options['max-quality'];
107
  $this->logLn(
121
  '*PS: "auto-limit" is set to false, as it was set explicitly to false in the options."*'
122
  );
123
  }
124
+ $useDeprecatedDefaultQuality = true;
125
  }
126
 
127
  if ($options['auto-limit']) {
132
  );
133
  $q = JpegQualityDetector::detectQualityOfJpg($source);
134
  if (is_null($q)) {
 
135
  $this->/** @scrutinizer ignore-call */logLn(
136
  'Quality of source image could not be established (Imagick or GraphicsMagick is required). ' .
137
+ 'Sorry, no auto-limit functionality for you. '
138
  );
139
+ if ($useDeprecatedDefaultQuality) {
140
+ $q = $options['default-quality'];
141
+ $this->/** @scrutinizer ignore-call */logLn(
142
+ 'Using default-quality (' . $q . ').'
143
+ );
144
+ } else {
145
+ $q = $options['quality'];
146
+ $this->/** @scrutinizer ignore-call */logLn(
147
+ 'Using supplied quality (' . $q . ').'
148
+ );
149
+ }
150
 
151
  $this->qualityCouldNotBeDetected = true;
152
  } else {
vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php CHANGED
@@ -3,9 +3,10 @@
3
  namespace WebPConvert\Convert\Converters\ConverterTraits;
4
 
5
  use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException;
 
6
 
7
  /**
8
- * Trait for converters that uses exec()
9
  *
10
  * @package WebPConvert
11
  * @author Bjørn Rosell <it@rosell.dk>
@@ -24,7 +25,7 @@ trait ExecTrait
24
  */
25
  protected static function hasNiceSupport()
26
  {
27
- exec("nice 2>&1", $niceOutput);
28
 
29
  if (is_array($niceOutput) && isset($niceOutput[0])) {
30
  if (preg_match('/usage/', $niceOutput[0]) || (preg_match('/^\d+$/', $niceOutput[0]))) {
@@ -90,15 +91,17 @@ trait ExecTrait
90
  }
91
 
92
  /**
93
- * Check basic operationality of exec converters (that the "exec" function is available)
94
  *
95
  * @throws WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException
96
  * @return void
97
  */
98
  public function checkOperationalityExecTrait()
99
  {
100
- if (!function_exists('exec')) {
101
- throw new SystemRequirementsNotMetException('exec() is not enabled.');
 
 
102
  }
103
  }
104
  }
3
  namespace WebPConvert\Convert\Converters\ConverterTraits;
4
 
5
  use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException;
6
+ use ExecWithFallback\ExecWithFallback;
7
 
8
  /**
9
+ * Trait for converters that uses exec() or similar
10
  *
11
  * @package WebPConvert
12
  * @author Bjørn Rosell <it@rosell.dk>
25
  */
26
  protected static function hasNiceSupport()
27
  {
28
+ ExecWithFallback::exec("nice 2>&1", $niceOutput);
29
 
30
  if (is_array($niceOutput) && isset($niceOutput[0])) {
31
  if (preg_match('/usage/', $niceOutput[0]) || (preg_match('/^\d+$/', $niceOutput[0]))) {
91
  }
92
 
93
  /**
94
+ * Check basic operationality of exec converters (that the "exec" or similar function is available)
95
  *
96
  * @throws WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException
97
  * @return void
98
  */
99
  public function checkOperationalityExecTrait()
100
  {
101
+ if (!ExecWithFallback::anyAvailable()) {
102
+ throw new SystemRequirementsNotMetException(
103
+ 'exec() is not enabled (nor is alternative methods, such as proc_open())'
104
+ );
105
  }
106
  }
107
  }
vendor/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php CHANGED
@@ -11,6 +11,7 @@ use WebPConvert\Convert\Exceptions\ConversionFailedException;
11
  use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperationalException;
12
  use WebPConvert\Helpers\BinaryDiscovery;
13
  use WebPConvert\Options\OptionFactory;
 
14
 
15
  /**
16
  * Convert images to webp by calling cwebp binary.
@@ -248,7 +249,7 @@ class Cwebp extends AbstractConverter
248
  $startExecuteBinaryTime = self::startTimer();
249
  ;
250
  $this->logLn($command);
251
- exec($command, $output, $returnCode);
252
  $this->logExecOutput($output);
253
  $this->logTimeSpent($startExecuteBinaryTime, 'Executing cwebp binary took: ');
254
  $this->logLn('');
@@ -555,7 +556,7 @@ class Cwebp extends AbstractConverter
555
 
556
  private function who()
557
  {
558
- exec('whoami 2>&1', $whoOutput, $whoReturnCode);
559
  if (($whoReturnCode == 0) && (isset($whoOutput[0]))) {
560
  return 'user: "' . $whoOutput[0] . '"';
561
  } else {
@@ -574,7 +575,7 @@ class Cwebp extends AbstractConverter
574
  {
575
  $command = $binary . ' -version 2>&1';
576
  $this->log('- Executing: ' . $command);
577
- exec($command, $output, $returnCode);
578
 
579
  if ($returnCode == 0) {
580
  if (isset($output[0])) {
11
  use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperationalException;
12
  use WebPConvert\Helpers\BinaryDiscovery;
13
  use WebPConvert\Options\OptionFactory;
14
+ use ExecWithFallback\ExecWithFallback;
15
 
16
  /**
17
  * Convert images to webp by calling cwebp binary.
249
  $startExecuteBinaryTime = self::startTimer();
250
  ;
251
  $this->logLn($command);
252
+ ExecWithFallback::exec($command, $output, $returnCode);
253
  $this->logExecOutput($output);
254
  $this->logTimeSpent($startExecuteBinaryTime, 'Executing cwebp binary took: ');
255
  $this->logLn('');
556
 
557
  private function who()
558
  {
559
+ ExecWithFallback::exec('whoami 2>&1', $whoOutput, $whoReturnCode);
560
  if (($whoReturnCode == 0) && (isset($whoOutput[0]))) {
561
  return 'user: "' . $whoOutput[0] . '"';
562
  } else {
575
  {
576
  $command = $binary . ' -version 2>&1';
577
  $this->log('- Executing: ' . $command);
578
+ ExecWithFallback::exec($command, $output, $returnCode);
579
 
580
  if ($returnCode == 0) {
581
  if (isset($output[0])) {
vendor/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php CHANGED
@@ -8,6 +8,7 @@ use WebPConvert\Convert\Converters\ConverterTraits\EncodingAutoTrait;
8
  use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException;
9
  use WebPConvert\Convert\Exceptions\ConversionFailedException;
10
  use WebPConvert\Options\OptionFactory;
 
11
 
12
  //use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\TargetNotFoundException;
13
 
@@ -61,14 +62,14 @@ class FFMpeg extends AbstractConverter
61
 
62
  public function isInstalled()
63
  {
64
- exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
65
  return ($returnCode == 0);
66
  }
67
 
68
  // Check if webp delegate is installed
69
  public function isWebPDelegateInstalled()
70
  {
71
- exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
72
  foreach ($output as $line) {
73
  if (preg_match('# --enable-libwebp#i', $line)) {
74
  return true;
@@ -158,7 +159,7 @@ class FFMpeg extends AbstractConverter
158
  $command = 'nice ' . $command;
159
  }
160
  $this->logLn('Executing command: ' . $command);
161
- exec($command, $output, $returnCode);
162
 
163
  $this->logExecOutput($output);
164
  if ($returnCode == 0) {
@@ -171,7 +172,7 @@ class FFMpeg extends AbstractConverter
171
  throw new SystemRequirementsNotMetException('ffmpeg is not installed');
172
  }
173
  if ($returnCode != 0) {
174
- throw new SystemRequirementsNotMetException('The exec call failed');
175
  }
176
  }
177
  }
8
  use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException;
9
  use WebPConvert\Convert\Exceptions\ConversionFailedException;
10
  use WebPConvert\Options\OptionFactory;
11
+ use ExecWithFallback\ExecWithFallback;
12
 
13
  //use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\TargetNotFoundException;
14
 
62
 
63
  public function isInstalled()
64
  {
65
+ ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
66
  return ($returnCode == 0);
67
  }
68
 
69
  // Check if webp delegate is installed
70
  public function isWebPDelegateInstalled()
71
  {
72
+ ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
73
  foreach ($output as $line) {
74
  if (preg_match('# --enable-libwebp#i', $line)) {
75
  return true;
159
  $command = 'nice ' . $command;
160
  }
161
  $this->logLn('Executing command: ' . $command);
162
+ ExecWithFallback::exec($command, $output, $returnCode);
163
 
164
  $this->logExecOutput($output);
165
  if ($returnCode == 0) {
172
  throw new SystemRequirementsNotMetException('ffmpeg is not installed');
173
  }
174
  if ($returnCode != 0) {
175
+ throw new SystemRequirementsNotMetException('The exec() call failed');
176
  }
177
  }
178
  }
vendor/rosell-dk/webp-convert/src/Convert/Converters/Gd.php CHANGED
@@ -56,6 +56,21 @@ class Gd extends AbstractConverter
56
  'Gd has been compiled without webp support.'
57
  );
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
 
61
  /**
@@ -217,17 +232,20 @@ class Gd extends AbstractConverter
217
  * Try to make image resource true color if it is not already.
218
  *
219
  * @param resource|\GdImage $image The image to work on
220
- * @return void
221
  */
222
  protected function tryToMakeTrueColorIfNot(&$image)
223
  {
 
224
  $mustMakeTrueColor = false;
225
  if (function_exists('imageistruecolor')) {
226
  if (imageistruecolor($image)) {
227
  $this->logLn('image is true color');
 
228
  } else {
229
  $this->logLn('image is not true color');
230
  $mustMakeTrueColor = true;
 
231
  }
232
  } else {
233
  $this->logLn('It can not be determined if image is true color');
@@ -237,13 +255,15 @@ class Gd extends AbstractConverter
237
  if ($mustMakeTrueColor) {
238
  $this->logLn('converting color palette to true color');
239
  $success = $this->makeTrueColor($image);
240
- if (!$success) {
 
 
241
  $this->logLn(
242
- 'Warning: FAILED converting color palette to true color. ' .
243
- 'Continuing, but this does NOT look good.'
244
  );
245
  }
246
  }
 
247
  }
248
 
249
  /**
@@ -329,9 +349,27 @@ class Gd extends AbstractConverter
329
 
330
  ob_start();
331
 
332
- //$success = imagewebp($image, $this->destination, $q);
333
- $success = imagewebp($image, null, $q);
334
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  if (!$success) {
336
  $this->destroyAndRemove($image);
337
  ob_end_clean();
@@ -443,8 +481,29 @@ class Gd extends AbstractConverter
443
  $image = $this->createImageResource();
444
 
445
  // Try to convert color palette if it is not true color
446
- $this->tryToMakeTrueColorIfNot($image);
447
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
 
449
  if ($this->getMimeTypeOfSource() == 'image/png') {
450
  if (function_exists('version_compare')) {
56
  'Gd has been compiled without webp support.'
57
  );
58
  }
59
+
60
+ if (!function_exists('imagepalettetotruecolor')) {
61
+ if (!self::functionsExist([
62
+ 'imagecreatetruecolor', 'imagealphablending', 'imagecolorallocatealpha',
63
+ 'imagefilledrectangle', 'imagecopy', 'imagedestroy', 'imagesx', 'imagesy'
64
+ ])) {
65
+ throw new SystemRequirementsNotMetException(
66
+ 'Gd cannot convert palette color images to RGB. ' .
67
+ 'Even though it would be possible to convert RGB images to webp with Gd, ' .
68
+ 'we refuse to do it. A partial working converter causes more trouble than ' .
69
+ 'a non-working. To make this converter work, you need the imagepalettetotruecolor() ' .
70
+ 'function to be enabled on your system.'
71
+ );
72
+ }
73
+ }
74
  }
75
 
76
  /**
232
  * Try to make image resource true color if it is not already.
233
  *
234
  * @param resource|\GdImage $image The image to work on
235
+ * @return boolean|null True if it is now true color. False if it is NOT true color. null, if we cannot tell
236
  */
237
  protected function tryToMakeTrueColorIfNot(&$image)
238
  {
239
+ $whatIsItNow = null;
240
  $mustMakeTrueColor = false;
241
  if (function_exists('imageistruecolor')) {
242
  if (imageistruecolor($image)) {
243
  $this->logLn('image is true color');
244
+ return true;
245
  } else {
246
  $this->logLn('image is not true color');
247
  $mustMakeTrueColor = true;
248
+ $whatIsItNow = false;
249
  }
250
  } else {
251
  $this->logLn('It can not be determined if image is true color');
255
  if ($mustMakeTrueColor) {
256
  $this->logLn('converting color palette to true color');
257
  $success = $this->makeTrueColor($image);
258
+ if ($success) {
259
+ return true;
260
+ } else {
261
  $this->logLn(
262
+ 'FAILED converting color palette to true color. '
 
263
  );
264
  }
265
  }
266
+ return $whatIsItNow;
267
  }
268
 
269
  /**
349
 
350
  ob_start();
351
 
352
+ // Adding this try/catch is perhaps not neccessary.
353
+ // I'm not certain that the error handler takes care of Throwable errors.
354
+ // and - sorry - was to lazy to find out right now. So for now: better safe than sorry. #320
355
+ $error = null;
356
+ $success = false;
357
+
358
+ try {
359
+ // Beware: This call can throw FATAL on windows (cannot be catched)
360
+ // This for example happens on palette images
361
+ $success = imagewebp($image, null, $q);
362
+ } catch (\Exception $e) {
363
+ $error = $e;
364
+ } catch (\Throwable $e) {
365
+ $error = $e;
366
+ }
367
+ if (!is_null($error)) {
368
+ restore_error_handler();
369
+ ob_end_clean();
370
+ $this->destroyAndRemove($image);
371
+ throw $error;
372
+ }
373
  if (!$success) {
374
  $this->destroyAndRemove($image);
375
  ob_end_clean();
481
  $image = $this->createImageResource();
482
 
483
  // Try to convert color palette if it is not true color
484
+ $isItTrueColorNow = $this->tryToMakeTrueColorIfNot($image);
485
+ if ($isItTrueColorNow === false) {
486
+ // our tests shows that converting palette fails on all systems,
487
+ throw new ConversionFailedException(
488
+ 'Cannot convert image because it is a palette image and the palette image cannot ' .
489
+ 'be converted to RGB (which is required). To convert to RGB, we would need ' .
490
+ 'imagepalettetotruecolor(), which is not available on your system. ' .
491
+ 'Our workaround does not have the neccasary functions for converting to RGB either.'
492
+ );
493
+ }
494
+ if (is_null($isItTrueColorNow)) {
495
+ $isWindows = preg_match('/^win/i', PHP_OS);
496
+ $isMacDarwin = preg_match('/^darwin/i', PHP_OS); // actually no problem in PHP 7.4 and 8.0
497
+ if ($isWindows || $isMacDarwin) {
498
+ throw new ConversionFailedException(
499
+ 'Cannot convert image because it appears to be a palette image and the palette image ' .
500
+ 'cannot be converted to RGB, as you do not have imagepalettetotruecolor() enabled. ' .
501
+ 'Converting palette on ' .
502
+ ($isWindows ? 'Windows causes FATAL error' : 'Mac causes halt') .
503
+ 'So we abort now'
504
+ );
505
+ }
506
+ }
507
 
508
  if ($this->getMimeTypeOfSource() == 'image/png') {
509
  if (function_exists('version_compare')) {
vendor/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php CHANGED
@@ -8,6 +8,7 @@ use WebPConvert\Convert\Converters\ConverterTraits\ExecTrait;
8
  use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException;
9
  use WebPConvert\Convert\Exceptions\ConversionFailedException;
10
  use WebPConvert\Options\OptionFactory;
 
11
 
12
  //use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\TargetNotFoundException;
13
 
@@ -56,13 +57,13 @@ class GraphicsMagick extends AbstractConverter
56
 
57
  public function isInstalled()
58
  {
59
- exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
60
  return ($returnCode == 0);
61
  }
62
 
63
  public function getVersion()
64
  {
65
- exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
66
  if (($returnCode == 0) && isset($output[0])) {
67
  return preg_replace('#http.*#', '', $output[0]);
68
  }
@@ -72,7 +73,7 @@ class GraphicsMagick extends AbstractConverter
72
  // Check if webp delegate is installed
73
  public function isWebPDelegateInstalled()
74
  {
75
- exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
76
  foreach ($output as $line) {
77
  if (preg_match('#WebP.*yes#i', $line)) {
78
  return true;
@@ -197,7 +198,7 @@ class GraphicsMagick extends AbstractConverter
197
  $command = 'nice ' . $command;
198
  }
199
  $this->logLn('Executing command: ' . $command);
200
- exec($command, $output, $returnCode);
201
 
202
  $this->logExecOutput($output);
203
  if ($returnCode == 0) {
@@ -213,7 +214,7 @@ class GraphicsMagick extends AbstractConverter
213
  $this->logLn('command:' . $command);
214
  $this->logLn('return code:' . $returnCode);
215
  $this->logLn('output:' . print_r(implode("\n", $output), true));
216
- throw new SystemRequirementsNotMetException('The exec call failed');
217
  }
218
  }
219
  }
8
  use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException;
9
  use WebPConvert\Convert\Exceptions\ConversionFailedException;
10
  use WebPConvert\Options\OptionFactory;
11
+ use ExecWithFallback\ExecWithFallback;
12
 
13
  //use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\TargetNotFoundException;
14
 
57
 
58
  public function isInstalled()
59
  {
60
+ ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
61
  return ($returnCode == 0);
62
  }
63
 
64
  public function getVersion()
65
  {
66
+ ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
67
  if (($returnCode == 0) && isset($output[0])) {
68
  return preg_replace('#http.*#', '', $output[0]);
69
  }
73
  // Check if webp delegate is installed
74
  public function isWebPDelegateInstalled()
75
  {
76
+ ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
77
  foreach ($output as $line) {
78
  if (preg_match('#WebP.*yes#i', $line)) {
79
  return true;
198
  $command = 'nice ' . $command;
199
  }
200
  $this->logLn('Executing command: ' . $command);
201
+ ExecWithFallback::exec($command, $output, $returnCode);
202
 
203
  $this->logExecOutput($output);
204
  if ($returnCode == 0) {
214
  $this->logLn('command:' . $command);
215
  $this->logLn('return code:' . $returnCode);
216
  $this->logLn('output:' . print_r(implode("\n", $output), true));
217
+ throw new SystemRequirementsNotMetException('The exec() call failed');
218
  }
219
  }
220
  }
vendor/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php CHANGED
@@ -9,6 +9,7 @@ use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\Syst
9
  use WebPConvert\Convert\Exceptions\ConversionFailedException;
10
  use WebPConvert\Helpers\BinaryDiscovery;
11
  use WebPConvert\Options\OptionFactory;
 
12
 
13
  //use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\TargetNotFoundException;
14
 
@@ -79,7 +80,7 @@ class ImageMagick extends AbstractConverter
79
 
80
  private function getVersion()
81
  {
82
- exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
83
  if (($returnCode == 0) && isset($output[0])) {
84
  return $output[0];
85
  } else {
@@ -89,14 +90,14 @@ class ImageMagick extends AbstractConverter
89
 
90
  public function isInstalled()
91
  {
92
- exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
93
  return ($returnCode == 0);
94
  }
95
 
96
  // Check if webp delegate is installed
97
  public function isWebPDelegateInstalled()
98
  {
99
- exec($this->getPath() . ' -list delegate 2>&1', $output, $returnCode);
100
  foreach ($output as $line) {
101
  if (preg_match('#webp\\s*=#i', $line)) {
102
  return true;
@@ -104,7 +105,7 @@ class ImageMagick extends AbstractConverter
104
  }
105
 
106
  // try other command
107
- exec($this->getPath() . ' -list configure 2>&1', $output, $returnCode);
108
  foreach ($output as $line) {
109
  if (preg_match('#DELEGATE.*webp#i', $line)) {
110
  return true;
@@ -254,7 +255,7 @@ class ImageMagick extends AbstractConverter
254
  $command = 'nice ' . $command;
255
  }
256
  $this->logLn('Executing command: ' . $command);
257
- exec($command, $output, $returnCode);
258
 
259
  $this->logExecOutput($output);
260
  if ($returnCode == 0) {
9
  use WebPConvert\Convert\Exceptions\ConversionFailedException;
10
  use WebPConvert\Helpers\BinaryDiscovery;
11
  use WebPConvert\Options\OptionFactory;
12
+ use ExecWithFallback\ExecWithFallback;
13
 
14
  //use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\TargetNotFoundException;
15
 
80
 
81
  private function getVersion()
82
  {
83
+ ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
84
  if (($returnCode == 0) && isset($output[0])) {
85
  return $output[0];
86
  } else {
90
 
91
  public function isInstalled()
92
  {
93
+ ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode);
94
  return ($returnCode == 0);
95
  }
96
 
97
  // Check if webp delegate is installed
98
  public function isWebPDelegateInstalled()
99
  {
100
+ ExecWithFallback::exec($this->getPath() . ' -list delegate 2>&1', $output, $returnCode);
101
  foreach ($output as $line) {
102
  if (preg_match('#webp\\s*=#i', $line)) {
103
  return true;
105
  }
106
 
107
  // try other command
108
+ ExecWithFallback::exec($this->getPath() . ' -list configure 2>&1', $output, $returnCode);
109
  foreach ($output as $line) {
110
  if (preg_match('#DELEGATE.*webp#i', $line)) {
111
  return true;
255
  $command = 'nice ' . $command;
256
  }
257
  $this->logLn('Executing command: ' . $command);
258
+ ExecWithFallback::exec($command, $output, $returnCode);
259
 
260
  $this->logExecOutput($output);
261
  if ($returnCode == 0) {
vendor/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php CHANGED
@@ -38,7 +38,7 @@ class Wpc extends AbstractConverter
38
  return OptionFactory::createOptions([
39
  ['api-key', 'string', [
40
  'title' => 'API key',
41
- 'description' => '',
42
  'default' => '',
43
  'sensitive' => true,
44
  'ui' => [
@@ -60,7 +60,7 @@ class Wpc extends AbstractConverter
60
  ]],
61
  ['api-url', 'string', [
62
  'title' => 'API url',
63
- 'description' => 'URL to connect to',
64
  'default' => '',
65
  'sensitive' => true,
66
  'ui' => [
@@ -70,19 +70,23 @@ class Wpc extends AbstractConverter
70
  ]],
71
  ['api-version', 'int', [
72
  'title' => 'API version',
73
- 'description' => '',
 
 
74
  'default' => 2,
75
  'minimum' => 0,
76
  'maximum' => 2,
77
  'ui' => [
78
  'component' => 'select',
79
  'advanced' => false,
80
- 'options' => ['0', '1', '2'],
81
  ]
82
  ]],
83
  ['crypt-api-key-in-transfer', 'boolean', [
84
  'title' => 'Crypt API key in transfer',
85
- 'description' => '',
 
 
86
  'default' => false,
87
  'ui' => [
88
  'component' => 'checkbox',
@@ -218,7 +222,7 @@ class Wpc extends AbstractConverter
218
  );
219
  }
220
  }
221
- } elseif ($apiVersion >= 1) {
222
  if ($options['crypt-api-key-in-transfer']) {
223
  if (!function_exists('crypt')) {
224
  throw new ConverterNotOperationalException(
@@ -300,7 +304,7 @@ class Wpc extends AbstractConverter
300
 
301
  if ($apiVersion == 0) {
302
  $postData['hash'] = md5(md5_file($this->source) . $apiKey);
303
- } elseif ($apiVersion == 1) {
304
  //$this->logLn('api key: ' . $apiKey);
305
 
306
  if ($options['crypt-api-key-in-transfer']) {
38
  return OptionFactory::createOptions([
39
  ['api-key', 'string', [
40
  'title' => 'API key',
41
+ 'description' => 'The API key is set up on the remote. Copy that.',
42
  'default' => '',
43
  'sensitive' => true,
44
  'ui' => [
60
  ]],
61
  ['api-url', 'string', [
62
  'title' => 'API url',
63
+ 'description' => 'The endpoint of the web service. Copy it from the remote setup',
64
  'default' => '',
65
  'sensitive' => true,
66
  'ui' => [
70
  ]],
71
  ['api-version', 'int', [
72
  'title' => 'API version',
73
+ 'description' =>
74
+ 'Refers to the major version of Wpc. ' .
75
+ 'It is probably 2, as it is a long time since 2.0 was released',
76
  'default' => 2,
77
  'minimum' => 0,
78
  'maximum' => 2,
79
  'ui' => [
80
  'component' => 'select',
81
  'advanced' => false,
82
+ 'options' => [0, 1, 2],
83
  ]
84
  ]],
85
  ['crypt-api-key-in-transfer', 'boolean', [
86
  'title' => 'Crypt API key in transfer',
87
+ 'description' =>
88
+ 'If checked, the api key will be crypted in requests. ' .
89
+ 'Crypting the api-key protects it from being stolen during transfer',
90
  'default' => false,
91
  'ui' => [
92
  'component' => 'checkbox',
222
  );
223
  }
224
  }
225
+ } else {
226
  if ($options['crypt-api-key-in-transfer']) {
227
  if (!function_exists('crypt')) {
228
  throw new ConverterNotOperationalException(
304
 
305
  if ($apiVersion == 0) {
306
  $postData['hash'] = md5(md5_file($this->source) . $apiKey);
307
+ } else {
308
  //$this->logLn('api key: ' . $apiKey);
309
 
310
  if ($options['crypt-api-key-in-transfer']) {
vendor/rosell-dk/webp-convert/src/Convert/Helpers/JpegQualityDetector.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace WebPConvert\Convert\Helpers;
4
 
 
 
5
  /**
6
  * Try to detect quality of a jpeg image using various tools.
7
  *
@@ -44,6 +46,7 @@ class JpegQualityDetector
44
  } catch (\Exception $e) {
45
  // Well well, it just didn't work out.
46
  // - But perhaps next method will work...
 
47
  }
48
  }
49
  return null;
@@ -68,12 +71,22 @@ class JpegQualityDetector
68
  */
69
  private static function detectQualityOfJpgUsingImageMagick($filename)
70
  {
71
- if (function_exists('exec')) {
72
  // Try Imagick using exec, and routing stderr to stdout (the "2>$1" magic)
73
- exec("identify -format '%Q' " . escapeshellarg($filename) . " 2>&1", $output, $returnCode);
74
- //echo 'out:' . print_r($output, true);
75
- if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) {
76
- return intval($output[0]);
 
 
 
 
 
 
 
 
 
 
77
  }
78
  }
79
  return null;
@@ -93,19 +106,27 @@ class JpegQualityDetector
93
  */
94
  private static function detectQualityOfJpgUsingGraphicsMagick($filename)
95
  {
96
- if (function_exists('exec')) {
97
  // Try GraphicsMagick
98
- exec("gm identify -format '%Q' " . escapeshellarg($filename) . " 2>&1", $output, $returnCode);
99
- if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) {
100
- $quality = intval($output[0]);
101
-
102
- // It seems that graphicsmagick is (currently) never able to detect the quality!
103
- // - and always returns 75 as a fallback
104
- // We shall therefore treat 75 as a failure to detect. (#209)
105
- if ($quality == 75) {
106
- return null;
 
 
 
 
 
 
 
107
  }
108
- return $quality;
 
109
  }
110
  }
111
  return null;
2
 
3
  namespace WebPConvert\Convert\Helpers;
4
 
5
+ use ExecWithFallback\ExecWithFallback;
6
+
7
  /**
8
  * Try to detect quality of a jpeg image using various tools.
9
  *
46
  } catch (\Exception $e) {
47
  // Well well, it just didn't work out.
48
  // - But perhaps next method will work...
49
+ } catch (\Throwable $e) {
50
  }
51
  }
52
  return null;
71
  */
72
  private static function detectQualityOfJpgUsingImageMagick($filename)
73
  {
74
+ if (ExecWithFallback::anyAvailable()) {
75
  // Try Imagick using exec, and routing stderr to stdout (the "2>$1" magic)
76
+
77
+ try {
78
+ ExecWithFallback::exec(
79
+ "identify -format '%Q' " . escapeshellarg($filename) . " 2>&1",
80
+ $output,
81
+ $returnCode
82
+ );
83
+ //echo 'out:' . print_r($output, true);
84
+ if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) {
85
+ return intval($output[0]);
86
+ }
87
+ } catch (\Exception $e) {
88
+ // its ok, there are other fish in the sea
89
+ } catch (\Throwable $e) {
90
  }
91
  }
92
  return null;
106
  */
107
  private static function detectQualityOfJpgUsingGraphicsMagick($filename)
108
  {
109
+ if (ExecWithFallback::anyAvailable()) {
110
  // Try GraphicsMagick
111
+ try {
112
+ ExecWithFallback::exec(
113
+ "gm identify -format '%Q' " . escapeshellarg($filename) . " 2>&1",
114
+ $output,
115
+ $returnCode
116
+ );
117
+ if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) {
118
+ $quality = intval($output[0]);
119
+
120
+ // It seems that graphicsmagick is (currently) never able to detect the quality!
121
+ // - and always returns 75 as a fallback
122
+ // We shall therefore treat 75 as a failure to detect. (#209)
123
+ if ($quality == 75) {
124
+ return null;
125
+ }
126
+ return $quality;
127
  }
128
+ } catch (\Exception $e) {
129
+ } catch (\Throwable $e) {
130
  }
131
  }
132
  return null;
vendor/rosell-dk/webp-convert/src/Helpers/BinaryDiscovery.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace WebPConvert\Helpers;
4
 
5
  use WebPConvert\Helpers\FileExists;
 
6
 
7
  /**
8
  * Discover multiple paths of a binary
@@ -36,7 +37,7 @@ class BinaryDiscovery
36
  {
37
  $binaries = [];
38
  foreach (self::$commonSystemPaths as $dir) {
39
- // PS: FileExists might throw if exec() is unavailable. We let it.
40
  // - this class assumes exec is available
41
  if (FileExists::fileExistsTryHarder($dir . '/' . $binary)) {
42
  $binaries[] = $dir . '/' . $binary;
@@ -53,7 +54,7 @@ class BinaryDiscovery
53
  private static function discoverBinariesUsingWhereIs($binary)
54
  {
55
  // This method was added due to #226.
56
- exec('whereis -b ' . $binary . ' 2>&1', $output, $returnCode);
57
  if (($returnCode == 0) && (isset($output[0]))) {
58
  $result = $output[0];
59
  // Ie: "cwebp: /usr/bin/cwebp /usr/local/bin/cwebp"
@@ -75,7 +76,7 @@ class BinaryDiscovery
75
  {
76
  // As suggested by @cantoute here:
77
  // https://wordpress.org/support/topic/sh-1-usr-local-bin-cwebp-not-found/
78
- exec('which -a ' . $binary . ' 2>&1', $output, $returnCode);
79
  if ($returnCode == 0) {
80
  return $output;
81
  }
3
  namespace WebPConvert\Helpers;
4
 
5
  use WebPConvert\Helpers\FileExists;
6
+ use ExecWithFallback\ExecWithFallback;
7
 
8
  /**
9
  * Discover multiple paths of a binary
37
  {
38
  $binaries = [];
39
  foreach (self::$commonSystemPaths as $dir) {
40
+ // PS: FileExists might throw if exec() or similar is unavailable. We let it.
41
  // - this class assumes exec is available
42
  if (FileExists::fileExistsTryHarder($dir . '/' . $binary)) {
43
  $binaries[] = $dir . '/' . $binary;
54
  private static function discoverBinariesUsingWhereIs($binary)
55
  {
56
  // This method was added due to #226.
57
+ ExecWithFallback::exec('whereis -b ' . $binary . ' 2>&1', $output, $returnCode);
58
  if (($returnCode == 0) && (isset($output[0]))) {
59
  $result = $output[0];
60
  // Ie: "cwebp: /usr/bin/cwebp /usr/local/bin/cwebp"
76
  {
77
  // As suggested by @cantoute here:
78
  // https://wordpress.org/support/topic/sh-1-usr-local-bin-cwebp-not-found/
79
+ ExecWithFallback::exec('which -a ' . $binary . ' 2>&1', $output, $returnCode);
80
  if ($returnCode == 0) {
81
  return $output;
82
  }
vendor/rosell-dk/webp-convert/src/Helpers/FileExists.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace WebPConvert\Helpers;
4
 
 
 
5
  /**
6
  * A fileExist function free of deception
7
  *
@@ -79,14 +81,14 @@ class FileExists
79
  */
80
  public static function fileExistsUsingExec($path)
81
  {
82
- if (!function_exists('exec')) {
83
  throw new \Exception(
84
- 'cannot determine if file exists using exec() - the function is unavailable'
85
  );
86
  }
87
 
88
  // Lets try to find out by executing "ls path/to/cwebp"
89
- exec('ls ' . $path, $output, $returnCode);
90
  if (($returnCode == 0) && (isset($output[0]))) {
91
  return true;
92
  }
@@ -111,6 +113,8 @@ class FileExists
111
  $result = self::fileExistsUsingExec($path);
112
  } catch (\Exception $e) {
113
  throw new \Exception('Cannot determine if file exists or not');
 
 
114
  }
115
  }
116
  return $result;
2
 
3
  namespace WebPConvert\Helpers;
4
 
5
+ use ExecWithFallback\ExecWithFallback;
6
+
7
  /**
8
  * A fileExist function free of deception
9
  *
81
  */
82
  public static function fileExistsUsingExec($path)
83
  {
84
+ if (!ExecWithFallback::anyAvailable()) {
85
  throw new \Exception(
86
+ 'cannot determine if file exists using exec() or similar - the function is unavailable'
87
  );
88
  }
89
 
90
  // Lets try to find out by executing "ls path/to/cwebp"
91
+ ExecWithFallback::exec('ls ' . $path, $output, $returnCode);
92
  if (($returnCode == 0) && (isset($output[0]))) {
93
  return true;
94
  }
113
  $result = self::fileExistsUsingExec($path);
114
  } catch (\Exception $e) {
115
  throw new \Exception('Cannot determine if file exists or not');
116
+ } catch (\Throwable $e) {
117
+ throw new \Exception('Cannot determine if file exists or not');
118
  }
119
  }
120
  return $result;
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.24.2
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.25.0
7
  * Author: Bjørn Rosell
8
  * Author URI: https://www.bitwise-it.dk
9
  * License: GPL2