diff --git a/includes/vendor/autoload.php b/includes/vendor/autoload.php index ca34841..276ef48 100644 --- a/includes/vendor/autoload.php +++ b/includes/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInita7e054cf16b6e0b04646a15cf900369a::getLoader(); +return ComposerAutoloaderInit0cfd50934fab6db77cbca852b15e5153::getLoader(); diff --git a/includes/vendor/composer.lock b/includes/vendor/composer.lock index a69ae22..77988a7 100644 --- a/includes/vendor/composer.lock +++ b/includes/vendor/composer.lock @@ -6,23 +6,179 @@ ], "content-hash": "7e11fa7cc85a00739f499ee70265fd83", "packages": [ + { + "name": "rosell-dk/exec-with-fallback", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/exec-with-fallback.git", + "reference": "f88a6b29abd0b580566056b7c1eb0434eb5db20d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/exec-with-fallback/zipball/f88a6b29abd0b580566056b7c1eb0434eb5db20d", + "reference": "f88a6b29abd0b580566056b7c1eb0434eb5db20d", + "shasum": "" + }, + "require": { + "php": "^5.6 | ^7.0 | ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "suggest": { + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { + "ExecWithFallback\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "An exec() with fallback to emulations (proc_open, etc)", + "keywords": [ + "command", + "exec", + "fallback", + "open_proc", + "resiliant", + "sturdy" + ], + "support": { + "issues": "https://github.com/rosell-dk/exec-with-fallback/issues", + "source": "https://github.com/rosell-dk/exec-with-fallback/tree/1.2.0" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2021-12-08T12:09:43+00:00" + }, + { + "name": "rosell-dk/file-util", + "version": "0.1.1", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/file-util.git", + "reference": "2ff895308c37f448b34b031cfbfd8e45f43936fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/file-util/zipball/2ff895308c37f448b34b031cfbfd8e45f43936fd", + "reference": "2ff895308c37f448b34b031cfbfd8e45f43936fd", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "rosell-dk/exec-with-fallback": "^1.0.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "mikey179/vfsstream": "^1.6", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { + "FileUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Functions for dealing with files and paths", + "keywords": [ + "files", + "path", + "util" + ], + "support": { + "issues": "https://github.com/rosell-dk/file-util/issues", + "source": "https://github.com/rosell-dk/file-util/tree/0.1.1" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2022-04-19T10:12:31+00:00" + }, { "name": "rosell-dk/image-mime-type-guesser", - "version": "0.3", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/rosell-dk/image-mime-type-guesser.git", - "reference": "204fd61ca81e3b0ba46c6165dab8f74816b1fe99" + "reference": "72f7040e95a78937ae2edece452530224fcacea6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rosell-dk/image-mime-type-guesser/zipball/204fd61ca81e3b0ba46c6165dab8f74816b1fe99", - "reference": "204fd61ca81e3b0ba46c6165dab8f74816b1fe99", + "url": "https://api.github.com/repos/rosell-dk/image-mime-type-guesser/zipball/72f7040e95a78937ae2edece452530224fcacea6", + "reference": "72f7040e95a78937ae2edece452530224fcacea6", "shasum": "" }, + "require": { + "php": "^5.6 | ^7.0 | ^8.0", + "rosell-dk/image-mime-type-sniffer": "^1.0" + }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.11", - "phpunit/phpunit": "^5.7.27", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", "squizlabs/php_codesniffer": "3.*" }, "type": "library", @@ -59,28 +215,195 @@ "mime", "mime type" ], - "time": "2019-03-29T09:33:28+00:00" + "support": { + "issues": "https://github.com/rosell-dk/image-mime-type-guesser/issues", + "source": "https://github.com/rosell-dk/image-mime-type-guesser/tree/1.1.1" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2022-05-19T09:57:15+00:00" + }, + { + "name": "rosell-dk/image-mime-type-sniffer", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/image-mime-type-sniffer.git", + "reference": "9ed14cc5d2c14c417660a4dd1946b5f056494691" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/image-mime-type-sniffer/zipball/9ed14cc5d2c14c417660a4dd1946b5f056494691", + "reference": "9ed14cc5d2c14c417660a4dd1946b5f056494691", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "mikey179/vfsstream": "^1.6", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { + "ImageMimeTypeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Sniff mime type (images only)", + "keywords": [ + "image", + "images", + "mime", + "mime type" + ], + "support": { + "issues": "https://github.com/rosell-dk/image-mime-type-sniffer/issues", + "source": "https://github.com/rosell-dk/image-mime-type-sniffer/tree/1.1.1" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2022-04-20T14:31:25+00:00" + }, + { + "name": "rosell-dk/locate-binaries", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/locate-binaries.git", + "reference": "bd2f493383ecd55aa519828dd2898e30f3b9cbb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/locate-binaries/zipball/bd2f493383ecd55aa519828dd2898e30f3b9cbb0", + "reference": "bd2f493383ecd55aa519828dd2898e30f3b9cbb0", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/file-util": "^0.1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { + "LocateBinaries\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Locate a binaries by means of exec() or similar", + "keywords": [ + "binary", + "discover", + "locate", + "whereis", + "which" + ], + "support": { + "issues": "https://github.com/rosell-dk/locate-binaries/issues", + "source": "https://github.com/rosell-dk/locate-binaries/tree/1.0" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "time": "2022-04-20T07:20:07+00:00" }, { "name": "rosell-dk/webp-convert", - "version": "2.7.0", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/rosell-dk/webp-convert.git", - "reference": "9f1677e56352b7aa23f00680d4ed41d53f3c4d8a" + "reference": "5ccba85ebe3b28ae229459fd0baed25314616ac9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/9f1677e56352b7aa23f00680d4ed41d53f3c4d8a", - "reference": "9f1677e56352b7aa23f00680d4ed41d53f3c4d8a", + "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/5ccba85ebe3b28ae229459fd0baed25314616ac9", + "reference": "5ccba85ebe3b28ae229459fd0baed25314616ac9", "shasum": "" }, "require": { "php": "^5.6 | ^7.0 | ^8.0", - "rosell-dk/image-mime-type-guesser": "^0.3" + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/image-mime-type-guesser": "^1.1.1", + "rosell-dk/locate-binaries": "^1.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.11", + "phpstan/phpstan": "^1.5", "phpunit/phpunit": "^9.3", "squizlabs/php_codesniffer": "3.*" }, @@ -137,7 +460,7 @@ ], "support": { "issues": "https://github.com/rosell-dk/webp-convert/issues", - "source": "https://github.com/rosell-dk/webp-convert/tree/2.7.0" + "source": "https://github.com/rosell-dk/webp-convert/tree/2.9.2" }, "funding": [ { @@ -149,33 +472,37 @@ "type": "ko_fi" } ], - "time": "2021-10-25T08:34:22+00:00" + "time": "2022-05-19T13:56:36+00:00" }, { "name": "sabberworm/php-css-parser", - "version": "8.3.0", + "version": "8.4.0", "source": { "type": "git", "url": "https://github.com/sabberworm/PHP-CSS-Parser.git", - "reference": "91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f" + "reference": "e41d2140031d533348b2192a83f02d8dd8a71d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f", - "reference": "91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f", + "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/e41d2140031d533348b2192a83f02d8dd8a71d30", + "reference": "e41d2140031d533348b2192a83f02d8dd8a71d30", "shasum": "" }, "require": { - "php": ">=5.3.2" + "ext-iconv": "*", + "php": ">=5.6.20" }, "require-dev": { "codacy/coverage": "^1.4", - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.36" + }, + "suggest": { + "ext-mbstring": "for parsing UTF-8 CSS" }, "type": "library", "autoload": { - "psr-0": { - "Sabberworm\\CSS": "lib/" + "psr-4": { + "Sabberworm\\CSS\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -188,13 +515,17 @@ } ], "description": "Parser for CSS Files written in PHP", - "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser", + "homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser", "keywords": [ "css", "parser", "stylesheet" ], - "time": "2019-02-22T07:42:52+00:00" + "support": { + "issues": "https://github.com/sabberworm/PHP-CSS-Parser/issues", + "source": "https://github.com/sabberworm/PHP-CSS-Parser/tree/8.4.0" + }, + "time": "2021-12-11T13:40:54+00:00" } ], "packages-dev": [], diff --git a/includes/vendor/composer/autoload-classmap.php b/includes/vendor/composer/autoload-classmap.php deleted file mode 100644 index c73ffcf..0000000 --- a/includes/vendor/composer/autoload-classmap.php +++ /dev/null @@ -1,9 +0,0 @@ - array($vendorDir . '/sabberworm/php-css-parser/lib'), -); diff --git a/includes/vendor/composer/autoload-real.php b/includes/vendor/composer/autoload-real.php deleted file mode 100644 index 8b25441..0000000 --- a/includes/vendor/composer/autoload-real.php +++ /dev/null @@ -1,52 +0,0 @@ -= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload-static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit8cc649ca1238d8fad15c0e7338cf29c3::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload-namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload-classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } - - $loader->register(true); - - return $loader; - } -} diff --git a/includes/vendor/composer/autoload-static.php b/includes/vendor/composer/autoload-static.php deleted file mode 100644 index 8783cc4..0000000 --- a/includes/vendor/composer/autoload-static.php +++ /dev/null @@ -1,50 +0,0 @@ - - array ( - 'WebPConvert\\' => 12, - ), - 'I' => - array ( - 'ImageMimeTypeGuesser\\' => 21, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'WebPConvert\\' => - array ( - 0 => __DIR__ . '/..' . '/rosell-dk/webp-convert/src', - ), - 'ImageMimeTypeGuesser\\' => - array ( - 0 => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src', - ), - ); - - public static $prefixesPsr0 = array ( - 'S' => - array ( - 'Sabberworm\\CSS' => - array ( - 0 => __DIR__ . '/..' . '/sabberworm/php-css-parser/lib', - ), - ), - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit8cc649ca1238d8fad15c0e7338cf29c3::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit8cc649ca1238d8fad15c0e7338cf29c3::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit8cc649ca1238d8fad15c0e7338cf29c3::$prefixesPsr0; - - }, null, ClassLoader::class); - } -} diff --git a/includes/vendor/composer/autoload_namespaces.php b/includes/vendor/composer/autoload_namespaces.php index ea06518..15a2ff3 100644 --- a/includes/vendor/composer/autoload_namespaces.php +++ b/includes/vendor/composer/autoload_namespaces.php @@ -6,5 +6,4 @@ $baseDir = dirname($vendorDir); return array( - 'Sabberworm\\CSS' => array($vendorDir . '/sabberworm/php-css-parser/lib'), ); diff --git a/includes/vendor/composer/autoload_psr4.php b/includes/vendor/composer/autoload_psr4.php index 5d81e01..cb9d511 100644 --- a/includes/vendor/composer/autoload_psr4.php +++ b/includes/vendor/composer/autoload_psr4.php @@ -7,5 +7,10 @@ return array( 'WebPConvert\\' => array($vendorDir . '/rosell-dk/webp-convert/src'), + 'Sabberworm\\CSS\\' => array($vendorDir . '/sabberworm/php-css-parser/src'), + 'LocateBinaries\\' => array($vendorDir . '/rosell-dk/locate-binaries/src'), + 'ImageMimeTypeSniffer\\' => array($vendorDir . '/rosell-dk/image-mime-type-sniffer/src'), 'ImageMimeTypeGuesser\\' => array($vendorDir . '/rosell-dk/image-mime-type-guesser/src'), + 'FileUtil\\' => array($vendorDir . '/rosell-dk/file-util/src'), + 'ExecWithFallback\\' => array($vendorDir . '/rosell-dk/exec-with-fallback/src'), ); diff --git a/includes/vendor/composer/autoload_real.php b/includes/vendor/composer/autoload_real.php index afc957a..7a5e160 100644 --- a/includes/vendor/composer/autoload_real.php +++ b/includes/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInita7e054cf16b6e0b04646a15cf900369a +class ComposerAutoloaderInit0cfd50934fab6db77cbca852b15e5153 { private static $loader; @@ -24,12 +24,12 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInita7e054cf16b6e0b04646a15cf900369a', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit0cfd50934fab6db77cbca852b15e5153', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInita7e054cf16b6e0b04646a15cf900369a', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit0cfd50934fab6db77cbca852b15e5153', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInita7e054cf16b6e0b04646a15cf900369a::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit0cfd50934fab6db77cbca852b15e5153::getInitializer($loader)); $loader->register(true); diff --git a/includes/vendor/composer/autoload_static.php b/includes/vendor/composer/autoload_static.php index 4e8a1cb..cb9d9c3 100644 --- a/includes/vendor/composer/autoload_static.php +++ b/includes/vendor/composer/autoload_static.php @@ -4,17 +4,34 @@ namespace Composer\Autoload; -class ComposerStaticInita7e054cf16b6e0b04646a15cf900369a +class ComposerStaticInit0cfd50934fab6db77cbca852b15e5153 { public static $prefixLengthsPsr4 = array ( 'W' => array ( 'WebPConvert\\' => 12, ), + 'S' => + array ( + 'Sabberworm\\CSS\\' => 15, + ), + 'L' => + array ( + 'LocateBinaries\\' => 15, + ), 'I' => array ( + 'ImageMimeTypeSniffer\\' => 21, 'ImageMimeTypeGuesser\\' => 21, ), + 'F' => + array ( + 'FileUtil\\' => 9, + ), + 'E' => + array ( + 'ExecWithFallback\\' => 17, + ), ); public static $prefixDirsPsr4 = array ( @@ -22,19 +39,29 @@ class ComposerStaticInita7e054cf16b6e0b04646a15cf900369a array ( 0 => __DIR__ . '/..' . '/rosell-dk/webp-convert/src', ), + 'Sabberworm\\CSS\\' => + array ( + 0 => __DIR__ . '/..' . '/sabberworm/php-css-parser/src', + ), + 'LocateBinaries\\' => + array ( + 0 => __DIR__ . '/..' . '/rosell-dk/locate-binaries/src', + ), + 'ImageMimeTypeSniffer\\' => + array ( + 0 => __DIR__ . '/..' . '/rosell-dk/image-mime-type-sniffer/src', + ), 'ImageMimeTypeGuesser\\' => array ( 0 => __DIR__ . '/..' . '/rosell-dk/image-mime-type-guesser/src', ), - ); - - public static $prefixesPsr0 = array ( - 'S' => + 'FileUtil\\' => + array ( + 0 => __DIR__ . '/..' . '/rosell-dk/file-util/src', + ), + 'ExecWithFallback\\' => array ( - 'Sabberworm\\CSS' => - array ( - 0 => __DIR__ . '/..' . '/sabberworm/php-css-parser/lib', - ), + 0 => __DIR__ . '/..' . '/rosell-dk/exec-with-fallback/src', ), ); @@ -45,10 +72,9 @@ class ComposerStaticInita7e054cf16b6e0b04646a15cf900369a public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInita7e054cf16b6e0b04646a15cf900369a::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInita7e054cf16b6e0b04646a15cf900369a::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInita7e054cf16b6e0b04646a15cf900369a::$prefixesPsr0; - $loader->classMap = ComposerStaticInita7e054cf16b6e0b04646a15cf900369a::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit0cfd50934fab6db77cbca852b15e5153::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit0cfd50934fab6db77cbca852b15e5153::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit0cfd50934fab6db77cbca852b15e5153::$classMap; }, null, ClassLoader::class); } diff --git a/includes/vendor/composer/installed.json b/includes/vendor/composer/installed.json index 120a17c..c0461b7 100644 --- a/includes/vendor/composer/installed.json +++ b/includes/vendor/composer/installed.json @@ -1,26 +1,188 @@ { "packages": [ + { + "name": "rosell-dk/exec-with-fallback", + "version": "1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/exec-with-fallback.git", + "reference": "f88a6b29abd0b580566056b7c1eb0434eb5db20d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/exec-with-fallback/zipball/f88a6b29abd0b580566056b7c1eb0434eb5db20d", + "reference": "f88a6b29abd0b580566056b7c1eb0434eb5db20d", + "shasum": "" + }, + "require": { + "php": "^5.6 | ^7.0 | ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "suggest": { + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "time": "2021-12-08T12:09:43+00:00", + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "ExecWithFallback\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "An exec() with fallback to emulations (proc_open, etc)", + "keywords": [ + "command", + "exec", + "fallback", + "open_proc", + "resiliant", + "sturdy" + ], + "support": { + "issues": "https://github.com/rosell-dk/exec-with-fallback/issues", + "source": "https://github.com/rosell-dk/exec-with-fallback/tree/1.2.0" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "install-path": "../rosell-dk/exec-with-fallback" + }, + { + "name": "rosell-dk/file-util", + "version": "0.1.1", + "version_normalized": "0.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/file-util.git", + "reference": "2ff895308c37f448b34b031cfbfd8e45f43936fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/file-util/zipball/2ff895308c37f448b34b031cfbfd8e45f43936fd", + "reference": "2ff895308c37f448b34b031cfbfd8e45f43936fd", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "rosell-dk/exec-with-fallback": "^1.0.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "mikey179/vfsstream": "^1.6", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "time": "2022-04-19T10:12:31+00:00", + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "FileUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Functions for dealing with files and paths", + "keywords": [ + "files", + "path", + "util" + ], + "support": { + "issues": "https://github.com/rosell-dk/file-util/issues", + "source": "https://github.com/rosell-dk/file-util/tree/0.1.1" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "install-path": "../rosell-dk/file-util" + }, { "name": "rosell-dk/image-mime-type-guesser", - "version": "0.3", - "version_normalized": "0.3.0.0", + "version": "1.1.1", + "version_normalized": "1.1.1.0", "source": { "type": "git", "url": "https://github.com/rosell-dk/image-mime-type-guesser.git", - "reference": "204fd61ca81e3b0ba46c6165dab8f74816b1fe99" + "reference": "72f7040e95a78937ae2edece452530224fcacea6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rosell-dk/image-mime-type-guesser/zipball/204fd61ca81e3b0ba46c6165dab8f74816b1fe99", - "reference": "204fd61ca81e3b0ba46c6165dab8f74816b1fe99", + "url": "https://api.github.com/repos/rosell-dk/image-mime-type-guesser/zipball/72f7040e95a78937ae2edece452530224fcacea6", + "reference": "72f7040e95a78937ae2edece452530224fcacea6", "shasum": "" }, + "require": { + "php": "^5.6 | ^7.0 | ^8.0", + "rosell-dk/image-mime-type-sniffer": "^1.0" + }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.11", - "phpunit/phpunit": "^5.7.27", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", "squizlabs/php_codesniffer": "3.*" }, - "time": "2019-03-29T09:33:28+00:00", + "time": "2022-05-19T09:57:15+00:00", "type": "library", "extra": { "scripts-descriptions": { @@ -56,29 +218,202 @@ "mime", "mime type" ], + "support": { + "issues": "https://github.com/rosell-dk/image-mime-type-guesser/issues", + "source": "https://github.com/rosell-dk/image-mime-type-guesser/tree/1.1.1" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], "install-path": "../rosell-dk/image-mime-type-guesser" }, + { + "name": "rosell-dk/image-mime-type-sniffer", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/image-mime-type-sniffer.git", + "reference": "9ed14cc5d2c14c417660a4dd1946b5f056494691" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/image-mime-type-sniffer/zipball/9ed14cc5d2c14c417660a4dd1946b5f056494691", + "reference": "9ed14cc5d2c14c417660a4dd1946b5f056494691", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "mikey179/vfsstream": "^1.6", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "time": "2022-04-20T14:31:25+00:00", + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "ImageMimeTypeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Sniff mime type (images only)", + "keywords": [ + "image", + "images", + "mime", + "mime type" + ], + "support": { + "issues": "https://github.com/rosell-dk/image-mime-type-sniffer/issues", + "source": "https://github.com/rosell-dk/image-mime-type-sniffer/tree/1.1.1" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "install-path": "../rosell-dk/image-mime-type-sniffer" + }, + { + "name": "rosell-dk/locate-binaries", + "version": "1.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/rosell-dk/locate-binaries.git", + "reference": "bd2f493383ecd55aa519828dd2898e30f3b9cbb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rosell-dk/locate-binaries/zipball/bd2f493383ecd55aa519828dd2898e30f3b9cbb0", + "reference": "bd2f493383ecd55aa519828dd2898e30f3b9cbb0", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/file-util": "^0.1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "time": "2022-04-20T07:20:07+00:00", + "type": "library", + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "LocateBinaries\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "description": "Locate a binaries by means of exec() or similar", + "keywords": [ + "binary", + "discover", + "locate", + "whereis", + "which" + ], + "support": { + "issues": "https://github.com/rosell-dk/locate-binaries/issues", + "source": "https://github.com/rosell-dk/locate-binaries/tree/1.0" + }, + "funding": [ + { + "url": "https://github.com/rosell-dk", + "type": "github" + }, + { + "url": "https://ko-fi.com/rosell", + "type": "ko_fi" + } + ], + "install-path": "../rosell-dk/locate-binaries" + }, { "name": "rosell-dk/webp-convert", - "version": "2.7.0", - "version_normalized": "2.7.0.0", + "version": "2.9.2", + "version_normalized": "2.9.2.0", "source": { "type": "git", "url": "https://github.com/rosell-dk/webp-convert.git", - "reference": "9f1677e56352b7aa23f00680d4ed41d53f3c4d8a" + "reference": "5ccba85ebe3b28ae229459fd0baed25314616ac9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/9f1677e56352b7aa23f00680d4ed41d53f3c4d8a", - "reference": "9f1677e56352b7aa23f00680d4ed41d53f3c4d8a", + "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/5ccba85ebe3b28ae229459fd0baed25314616ac9", + "reference": "5ccba85ebe3b28ae229459fd0baed25314616ac9", "shasum": "" }, "require": { "php": "^5.6 | ^7.0 | ^8.0", - "rosell-dk/image-mime-type-guesser": "^0.3" + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/image-mime-type-guesser": "^1.1.1", + "rosell-dk/locate-binaries": "^1.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.11", + "phpstan/phpstan": "^1.5", "phpunit/phpunit": "^9.3", "squizlabs/php_codesniffer": "3.*" }, @@ -88,7 +423,7 @@ "ext-vips": "to use Vips extension for converting.", "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" }, - "time": "2021-10-25T08:34:22+00:00", + "time": "2022-05-19T13:56:36+00:00", "type": "library", "extra": { "scripts-descriptions": { @@ -137,7 +472,7 @@ ], "support": { "issues": "https://github.com/rosell-dk/webp-convert/issues", - "source": "https://github.com/rosell-dk/webp-convert/tree/2.7.0" + "source": "https://github.com/rosell-dk/webp-convert/tree/2.9.2" }, "funding": [ { @@ -153,32 +488,36 @@ }, { "name": "sabberworm/php-css-parser", - "version": "8.3.0", - "version_normalized": "8.3.0.0", + "version": "8.4.0", + "version_normalized": "8.4.0.0", "source": { "type": "git", "url": "https://github.com/sabberworm/PHP-CSS-Parser.git", - "reference": "91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f" + "reference": "e41d2140031d533348b2192a83f02d8dd8a71d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f", - "reference": "91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f", + "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/e41d2140031d533348b2192a83f02d8dd8a71d30", + "reference": "e41d2140031d533348b2192a83f02d8dd8a71d30", "shasum": "" }, "require": { - "php": ">=5.3.2" + "ext-iconv": "*", + "php": ">=5.6.20" }, "require-dev": { "codacy/coverage": "^1.4", - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.36" + }, + "suggest": { + "ext-mbstring": "for parsing UTF-8 CSS" }, - "time": "2019-02-22T07:42:52+00:00", + "time": "2021-12-11T13:40:54+00:00", "type": "library", "installation-source": "dist", "autoload": { - "psr-0": { - "Sabberworm\\CSS": "lib/" + "psr-4": { + "Sabberworm\\CSS\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -191,12 +530,16 @@ } ], "description": "Parser for CSS Files written in PHP", - "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser", + "homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser", "keywords": [ "css", "parser", "stylesheet" ], + "support": { + "issues": "https://github.com/sabberworm/PHP-CSS-Parser/issues", + "source": "https://github.com/sabberworm/PHP-CSS-Parser/tree/8.4.0" + }, "install-path": "../sabberworm/php-css-parser" } ], diff --git a/includes/vendor/composer/installed.php b/includes/vendor/composer/installed.php index 2a0eed7..ecd60b4 100644 --- a/includes/vendor/composer/installed.php +++ b/includes/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => '1.0.17.x-dev', 'version' => '1.0.17.9999999-dev', - 'reference' => '838f8a43d778e4c1b320b5695a7d62cd85ac00e8', + 'reference' => '111936a2ca5626946948892cb770609d2cd8b394', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,34 +13,70 @@ '__root__' => array( 'pretty_version' => '1.0.17.x-dev', 'version' => '1.0.17.9999999-dev', - 'reference' => '838f8a43d778e4c1b320b5695a7d62cd85ac00e8', + 'reference' => '111936a2ca5626946948892cb770609d2cd8b394', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), + 'rosell-dk/exec-with-fallback' => array( + 'pretty_version' => '1.2.0', + 'version' => '1.2.0.0', + 'reference' => 'f88a6b29abd0b580566056b7c1eb0434eb5db20d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rosell-dk/exec-with-fallback', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'rosell-dk/file-util' => array( + 'pretty_version' => '0.1.1', + 'version' => '0.1.1.0', + 'reference' => '2ff895308c37f448b34b031cfbfd8e45f43936fd', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rosell-dk/file-util', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'rosell-dk/image-mime-type-guesser' => array( - 'pretty_version' => '0.3', - 'version' => '0.3.0.0', - 'reference' => '204fd61ca81e3b0ba46c6165dab8f74816b1fe99', + 'pretty_version' => '1.1.1', + 'version' => '1.1.1.0', + 'reference' => '72f7040e95a78937ae2edece452530224fcacea6', 'type' => 'library', 'install_path' => __DIR__ . '/../rosell-dk/image-mime-type-guesser', 'aliases' => array(), 'dev_requirement' => false, ), + 'rosell-dk/image-mime-type-sniffer' => array( + 'pretty_version' => '1.1.1', + 'version' => '1.1.1.0', + 'reference' => '9ed14cc5d2c14c417660a4dd1946b5f056494691', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rosell-dk/image-mime-type-sniffer', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'rosell-dk/locate-binaries' => array( + 'pretty_version' => '1.0', + 'version' => '1.0.0.0', + 'reference' => 'bd2f493383ecd55aa519828dd2898e30f3b9cbb0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rosell-dk/locate-binaries', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'rosell-dk/webp-convert' => array( - 'pretty_version' => '2.7.0', - 'version' => '2.7.0.0', - 'reference' => '9f1677e56352b7aa23f00680d4ed41d53f3c4d8a', + 'pretty_version' => '2.9.2', + 'version' => '2.9.2.0', + 'reference' => '5ccba85ebe3b28ae229459fd0baed25314616ac9', 'type' => 'library', 'install_path' => __DIR__ . '/../rosell-dk/webp-convert', 'aliases' => array(), 'dev_requirement' => false, ), 'sabberworm/php-css-parser' => array( - 'pretty_version' => '8.3.0', - 'version' => '8.3.0.0', - 'reference' => '91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f', + 'pretty_version' => '8.4.0', + 'version' => '8.4.0.0', + 'reference' => 'e41d2140031d533348b2192a83f02d8dd8a71d30', 'type' => 'library', 'install_path' => __DIR__ . '/../sabberworm/php-css-parser', 'aliases' => array(), diff --git a/includes/vendor/composer/platform_check.php b/includes/vendor/composer/platform_check.php index 8b379f4..12f8be9 100644 --- a/includes/vendor/composer/platform_check.php +++ b/includes/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 50600)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 50620)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.20". You are running ' . PHP_VERSION . '.'; } if ($issues) { diff --git a/includes/vendor/rosell-dk/exec-with-fallback/.github/FUNDING.yml b/includes/vendor/rosell-dk/exec-with-fallback/.github/FUNDING.yml new file mode 100644 index 0000000..8dd1d30 --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: rosell-dk +ko_fi: rosell diff --git a/includes/vendor/rosell-dk/exec-with-fallback/.github/workflows/php.yml b/includes/vendor/rosell-dk/exec-with-fallback/.github/workflows/php.yml new file mode 100644 index 0000000..db74bc2 --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/.github/workflows/php.yml @@ -0,0 +1,36 @@ +name: PHP + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + php80: + name: PHP 8.1 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test diff --git a/includes/vendor/rosell-dk/exec-with-fallback/.github/workflows/release.yml b/includes/vendor/rosell-dk/exec-with-fallback/.github/workflows/release.yml new file mode 100644 index 0000000..f82c28f --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/.github/workflows/release.yml @@ -0,0 +1,262 @@ +name: Large testsuite (run manually before releases) + +on: workflow_dispatch + +jobs: + php81: + name: PHP 8.1 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, windows-2016, macos-11, macos-10.15] + php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + php80: + name: PHP 8.0 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-2022] + php: [8.0] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + php74: + name: PHP 7.4 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2019, windows-2016] + php: [7.4] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + php73: + name: PHP 7.3 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + php: [7.3] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + php72: + name: PHP 7.2 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + php: [7.2] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Downgrade PHP unit to a version that supports PHP 7.2 + run: composer require "phpunit/phpunit:^8.0" --dev + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + php71: + name: PHP 7.1 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + php: [7.1] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Downgrade PHP unit to a version that supports PHP 7.1 + run: composer require "phpunit/phpunit:^7.0" --dev + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + + php70: + name: PHP 7.0 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04] + php: [7.0] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + + - name: Downgrade PHP unit to a version that supports PHP 7.1 + run: composer require "phpunit/phpunit:^6.0" --dev + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + + disabled: + name: Disabled functions + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, windows-2019] + php: [8.0, 7.4] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Setup PHP (disable some functions) + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + # PS: I would have liked to test disabling ini_get, but then composer fails + # composer alse needs proc_open, so I cannot test without that either + ini-values: disable_functions="exec,passthru" + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test + + - name: Re-setup PHP (disable other functions) + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + ini-values: disable_functions="exec" + + - name: Run test suite + run: composer run-script test + + - name: Re-setup PHP (disable yet other functions) + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring + ini-values: disable_functions="passthru" + + - name: Run test suite + run: composer run-script test diff --git a/includes/vendor/rosell-dk/exec-with-fallback/LICENSE b/includes/vendor/rosell-dk/exec-with-fallback/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/includes/vendor/rosell-dk/exec-with-fallback/README.md b/includes/vendor/rosell-dk/exec-with-fallback/README.md new file mode 100644 index 0000000..bdd7106 --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/README.md @@ -0,0 +1,69 @@ +# Exec with fallback + +[![Latest Stable Version](http://poser.pugx.org/rosell-dk/exec-with-fallback/v)](https://packagist.org/packages/rosell-dk/exec-with-fallback) +[![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) +[![Software License](http://poser.pugx.org/rosell-dk/exec-with-fallback/license)](https://github.com/rosell-dk/exec-with-fallback/blob/master/LICENSE) +[![PHP Version Require](http://poser.pugx.org/rosell-dk/exec-with-fallback/require/php)](https://packagist.org/packages/rosell-dk/exec-with-fallback) +[![Daily Downloads](http://poser.pugx.org/rosell-dk/exec-with-fallback/d/daily)](https://packagist.org/packages/rosell-dk/exec-with-fallback) + +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. + +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. + +## Usage: +Simply swap out your current *exec()* calls with *ExecWithFallback::exec()*. The signatures are exactly the same. + +```php +use ExecWithFallback\ExecWithFallback; +$result = ExecWithFallback::exec('echo "hi"', $output, $result_code); +// $output (array) now holds the output +// $result_code (int) now holds the result code +// $return (string | false) is now false in case of failure or the last line of the output +``` + +Note that while the signatures are the same, errors are not exactly the same. There is a reason for that. On some systems, a real `exec()` call results in a FATAL error when the function has been disabled. That is: An error, that cannot be catched. You probably don't want to halt execution on some systems, but not on other. But if you do, use `ExecWithFallback::execNoMercy` instead of `ExecWithFallback::exec`. In case no emulations are available, it calls *exec()*, ensuring exact same error handling as normal *exec()*. + +If you have `function_exists('exec')` in your code, you probably want to change them to `ExecWithFallback::anyAvailable()` + +## Installing +`composer require rosell-dk/exec-with-fallback` + +## Implementation +*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: +- exec() +- passthru() +- popen() +- proc_open() +- shell_exec() + +In case all functions are unavailable, a normal exception is thrown (class: Exception). This is more gentle behavior than real exec(), which on some systems throws FATAL error when the function is disabled. If you want exactly same errors, use `ExecWithFallback::execNoMercy` instead, which instead of throwing an exception calls *exec*, which will result in a throw (to support older PHP, you need to catch both Exception and Throwable. And note that you cannot catch on all systems, because some throws FATAL) + +In case none succeeded, but at least one failed by returning false, false is returned. Again to mimic *exec()* behavior. + +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. + +If you for some reason want to run a specific exec() emulation, you can use the corresponding class directly, ie *ProcOpen::exec()*. + +## Is it worth it? +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. + +**easily installed**\ +Install with composer (`composer require rosell-dk/exec-with-fallback`) and substitute your *exec()* calls. + +**lightweight**\ +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. + +**well tested**\ +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. + +**going to be maintained**\ +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. + +**Con: risk of being recognized as malware** +There is a slight risk that a lazy malware creator uses this library for his malware. The risk is however very small, as the library isn't suitable for malware. First off, the library doesn't try *system()*, as that function does not return output and thus cannot be used to emulate *exec()*. A malware creator would desire to try all possible ways to get his malware executed. Secondly, malware creators probably don't use composer for their malware and would probably want a single function instead of having it spread over multiple files. Third, the library here use a lot of efford in getting the emululated functions to behave exactly as exec(). This concern is probably non-existant for malware creators, who probably cares more about the effect of running the malware. Lastly, a malware creator would want to write his own function instead of copying code found on the internet. Copying stuff would impose a chance that the code is used by another malware creator which increases the risk of anti malware software recognizing it as malware. + +## Do you like what I do? +Perhaps you want to support my work, so I can continue doing it :) + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/rosell). +- [Buy me a Coffee](https://ko-fi.com/rosell) diff --git a/includes/vendor/rosell-dk/exec-with-fallback/composer.json b/includes/vendor/rosell-dk/exec-with-fallback/composer.json new file mode 100644 index 0000000..a2224ca --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/composer.json @@ -0,0 +1,67 @@ +{ + "name": "rosell-dk/exec-with-fallback", + "description": "An exec() with fallback to emulations (proc_open, etc)", + "type": "library", + "license": "MIT", + "keywords": ["exec", "open_proc", "command", "fallback", "sturdy", "resiliant"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan-global" + ], + "test": "./vendor/bin/phpunit --coverage-text", + "test-41": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'", + "phpunit": "phpunit --coverage-text", + "test-no-cov": "phpunit --no-coverage", + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "phpcs": "phpcs --standard=PSR2", + "phpcs-all": "phpcs --standard=PSR2 src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4", + "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4", + "phpstan-global": "~/.config/composer/vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "ExecWithFallback\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "ExecWithFallback\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "require": { + "php": "^5.6 | ^7.0 | ^8.0" + }, + "suggest": { + "php-stan/php-stan": "Suggested for dev, in order to analyse code before committing" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*" + }, + "config": { + "sort-packages": true + } +} diff --git a/includes/vendor/rosell-dk/exec-with-fallback/phpstan.neon b/includes/vendor/rosell-dk/exec-with-fallback/phpstan.neon new file mode 100644 index 0000000..e32c6ed --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/phpstan.neon @@ -0,0 +1,3 @@ +parameters: + ignoreErrors: + - '#PHPDoc tag @param.*Unexpected token "&"#' diff --git a/includes/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist b/includes/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist new file mode 100644 index 0000000..0d4d964 --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist @@ -0,0 +1,21 @@ + + + + + src/ + + + + + + + + + + ./tests/ + + + + + + diff --git a/includes/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist.bak b/includes/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist.bak new file mode 100644 index 0000000..c2d24d1 --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/phpunit.xml.dist.bak @@ -0,0 +1,28 @@ + + + + + ./tests/ + + + + + src/ + + + + + + + + + diff --git a/includes/vendor/rosell-dk/exec-with-fallback/src/Availability.php b/includes/vendor/rosell-dk/exec-with-fallback/src/Availability.php new file mode 100644 index 0000000..db4302d --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/src/Availability.php @@ -0,0 +1,39 @@ + + */ +class Availability extends ExecWithFallback +{ + + /** + * Check if any of the methods are available on the system. + * + * @param boolean $needResultCode Whether the code using this library is going to supply $result_code to the exec + * call. This matters because shell_exec is only available when not. + */ + public static function anyAvailable($needResultCode = true) + { + foreach (self::$methods as $method) { + if (self::methodAvailable($method, $needResultCode)) { + return true; + } + } + return false; + } + + public static function methodAvailable($method, $needResultCode = true) + { + if (!ExecWithFallback::functionEnabled($method)) { + return false; + } + if ($needResultCode) { + return ($method != 'shell_exec'); + } + return true; + } +} diff --git a/includes/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallback.php b/includes/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallback.php new file mode 100644 index 0000000..ad571b9 --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallback.php @@ -0,0 +1,127 @@ + + */ +class ExecWithFallback +{ + + protected static $methods = ['exec', 'passthru', 'popen', 'proc_open', 'shell_exec']; + + /** + * Check if any of the methods are available on the system. + * + * @param boolean $needResultCode Whether the code using this library is going to supply $result_code to the exec + * call. This matters because shell_exec is only available when not. + */ + public static function anyAvailable($needResultCode = true) + { + return Availability::anyAvailable($needResultCode); + } + + /** + * Check if a function is enabled (function_exists as well as ini is tested) + * + * @param string $functionName The name of the function + * + * @return boolean If the function is enabled + */ + public static function functionEnabled($functionName) + { + if (!function_exists($functionName)) { + return false; + } + if (function_exists('ini_get')) { + if (ini_get('safe_mode')) { + return false; + } + $d = ini_get('disable_functions') . ',' . ini_get('suhosin.executor.func.blacklist'); + if ($d === false) { + $d = ''; + } + $d = preg_replace('/,\s*/', ',', $d); + if (strpos(',' . $d . ',', ',' . $functionName . ',') !== false) { + return false; + } + } + return is_callable($functionName); + } + + + /** + * Execute. - A substitute for exec() + * + * Same signature and results as exec(): https://www.php.net/manual/en/function.exec.php + * In case neither exec(), nor emulations are available, it throws an Exception. + * This is more gentle than real exec(), which on some systems throws a FATAL when exec() is disabled + * If you want the more acurate substitute, which might halt execution, use execNoMercy() instead. + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + * @throws \Exception If no methods are available + */ + public static function exec($command, &$output = null, &$result_code = null) + { + foreach (self::$methods as $method) { + if (self::functionEnabled($method)) { + if (func_num_args() >= 3) { + if ($method == 'shell_exec') { + continue; + } + $result = self::runExec($method, $command, $output, $result_code); + } else { + $result = self::runExec($method, $command, $output); + } + if ($result !== false) { + return $result; + } + } + } + if (isset($result) && ($result === false)) { + return false; + } + throw new \Exception('exec() is not available'); + } + + /** + * Execute. - A substitute for exec(), with exact same errors thrown if exec() is missing. + * + * Danger: On some systems, this results in a fatal (non-catchable) error. + */ + public static function execNoMercy($command, &$output = null, &$result_code = null) + { + if (func_num_args() == 3) { + return ExecWithFallbackNoMercy::exec($command, $output, $result_code); + } else { + return ExecWithFallbackNoMercy::exec($command, $output); + } + } + + public static function runExec($method, $command, &$output = null, &$result_code = null) + { + switch ($method) { + case 'exec': + return exec($command, $output, $result_code); + case 'passthru': + return Passthru::exec($command, $output, $result_code); + case 'popen': + return POpen::exec($command, $output, $result_code); + case 'proc_open': + return ProcOpen::exec($command, $output, $result_code); + case 'shell_exec': + if (func_num_args() == 4) { + return ShellExec::exec($command, $output, $result_code); + } else { + return ShellExec::exec($command, $output); + } + } + return false; + } +} diff --git a/includes/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallbackNoMercy.php b/includes/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallbackNoMercy.php new file mode 100644 index 0000000..888bc1a --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/src/ExecWithFallbackNoMercy.php @@ -0,0 +1,56 @@ + + */ +class ExecWithFallbackNoMercy +{ + + /** + * Execute. - A substitute for exec() + * + * Same signature and results as exec(): https://www.php.net/manual/en/function.exec.php + * + * This is our hardcore version of our exec(). It does not merely throw an Exception, if + * no methods are available. It calls exec(). + * This ensures exactly same behavior as normal exec() - the same error is thrown. + * You might want that. But do you really? + * DANGER: On some systems, calling a disabled exec() results in a fatal (non-catchable) error. + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + * @throws \Exception|\Error If no methods are available. Note: On some systems, it is FATAL! + */ + public static function exec($command, &$output = null, &$result_code = null) + { + foreach (self::$methods as $method) { + if (self::functionEnabled($method)) { + if (func_num_args() >= 3) { + if ($method == 'shell_exec') { + continue; + } + $result = self::runExec($method, $command, $output, $result_code); + } else { + $result = self::runExec($method, $command, $output); + } + if ($result !== false) { + return $result; + } + } + } + if (isset($result) && ($result === false)) { + return false; + } + // MIGHT THROW FATAL! + return exec($command, $output, $result_code); + } + + +} diff --git a/includes/vendor/rosell-dk/exec-with-fallback/src/POpen.php b/includes/vendor/rosell-dk/exec-with-fallback/src/POpen.php new file mode 100644 index 0000000..8d0d047 --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/src/POpen.php @@ -0,0 +1,60 @@ + + */ +class POpen +{ + + /** + * Emulate exec() with system() + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + */ + public static function exec($command, &$output = null, &$result_code = null) + { + + $handle = @popen($command, "r"); + if ($handle === false) { + return false; + } + + $result = ''; + while (!@feof($handle)) { + $result .= fread($handle, 1024); + } + + //Note: Unix Only: + // pclose() is internally implemented using the waitpid(3) system call. + // To obtain the real exit status code the pcntl_wexitstatus() function should be used. + $result_code = pclose($handle); + + $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result); + + // remove the last element if it is blank + if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) { + array_pop($theOutput); + } + + if (count($theOutput) == 0) { + return ''; + } + if (gettype($output) == 'array') { + foreach ($theOutput as $line) { + $output[] = $line; + } + } else { + $output = $theOutput; + } + return $theOutput[count($theOutput) -1]; + } +} diff --git a/includes/vendor/rosell-dk/exec-with-fallback/src/Passthru.php b/includes/vendor/rosell-dk/exec-with-fallback/src/Passthru.php new file mode 100644 index 0000000..0cbfea1 --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/src/Passthru.php @@ -0,0 +1,58 @@ + + */ +class Passthru +{ + + /** + * Emulate exec() with passthru() + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + */ + public static function exec($command, &$output = null, &$result_code = null) + { + ob_start(); + // Note: We use try/catch in order to close output buffering in case it throws + try { + passthru($command, $result_code); + } catch (\Exception $e) { + ob_get_clean(); + passthru($command, $result_code); + } catch (\Throwable $e) { + ob_get_clean(); + passthru($command, $result_code); + } + $result = ob_get_clean(); + + // split new lines. Also remove trailing space, as exec() does + $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result); + + // remove the last element if it is blank + if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) { + array_pop($theOutput); + } + + if (count($theOutput) == 0) { + return ''; + } + if (gettype($output) == 'array') { + foreach ($theOutput as $line) { + $output[] = $line; + } + } else { + $output = $theOutput; + } + return $theOutput[count($theOutput) -1]; + } +} diff --git a/includes/vendor/rosell-dk/exec-with-fallback/src/ProcOpen.php b/includes/vendor/rosell-dk/exec-with-fallback/src/ProcOpen.php new file mode 100644 index 0000000..213c7bb --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/src/ProcOpen.php @@ -0,0 +1,67 @@ + + */ +class ProcOpen +{ + + /** + * Emulate exec() with proc_open() + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + */ + public static function exec($command, &$output = null, &$result_code = null) + { + $descriptorspec = array( + //0 => array("pipe", "r"), + 1 => array("pipe", "w"), + //2 => array("pipe", "w"), + //2 => array("file", "/tmp/error-output.txt", "a") + ); + + $cwd = getcwd(); // or is "/tmp" better? + $processHandle = proc_open($command, $descriptorspec, $pipes, $cwd); + $result = ""; + if (is_resource($processHandle)) { + // Got this solution here: + // https://stackoverflow.com/questions/5673740/php-or-apache-exec-popen-system-and-proc-open-commands-do-not-execute-any-com + //fclose($pipes[0]); + $result = stream_get_contents($pipes[1]); + fclose($pipes[1]); + //fclose($pipes[2]); + $result_code = proc_close($processHandle); + + // split new lines. Also remove trailing space, as exec() does + $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result); + + // remove the last element if it is blank + if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) { + array_pop($theOutput); + } + + if (count($theOutput) == 0) { + return ''; + } + if (gettype($output) == 'array') { + foreach ($theOutput as $line) { + $output[] = $line; + } + } else { + $output = $theOutput; + } + return $theOutput[count($theOutput) -1]; + } else { + return false; + } + } +} diff --git a/includes/vendor/rosell-dk/exec-with-fallback/src/ShellExec.php b/includes/vendor/rosell-dk/exec-with-fallback/src/ShellExec.php new file mode 100644 index 0000000..a16715e --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/src/ShellExec.php @@ -0,0 +1,69 @@ + + */ +class ShellExec +{ + + /** + * Emulate exec() with shell_exec() + * + * @param string $command The command to execute + * @param string &$output (optional) + * @param int &$result_code (optional) + * + * @return string | false The last line of output or false in case of failure + */ + public static function exec($command, &$output = null, &$result_code = null) + { + $resultCodeSupplied = (func_num_args() >= 3); + if ($resultCodeSupplied) { + throw new \Exception('ShellExec::exec() does not support $result_code argument'); + } + + $result = shell_exec($command); + + // result: + // - A string containing the output from the executed command, + // - false if the pipe cannot be established + // - or null if an error occurs or the command produces no output. + + if ($result === false) { + return false; + } + if (is_null($result)) { + // hm, "null if an error occurs or the command produces no output." + // What were they thinking? + // And yes, it does return null, when no output, which is confirmed in the test "echo hi 1>/dev/null" + // What should we do? Throw or accept? + // Perhaps shell_exec throws in newer versions of PHP instead of returning null. + // We are counting on it until proved wrong. + return ''; + } + + $theOutput = preg_split('/\s*\r\n|\s*\n\r|\s*\n|\s*\r/', $result); + + // remove the last element if it is blank + if ((count($theOutput) > 0) && ($theOutput[count($theOutput) -1] == '')) { + array_pop($theOutput); + } + + if (count($theOutput) == 0) { + return ''; + } + if (gettype($output) == 'array') { + foreach ($theOutput as $line) { + $output[] = $line; + } + } else { + $output = $theOutput; + } + return $theOutput[count($theOutput) -1]; + } +} diff --git a/includes/vendor/rosell-dk/exec-with-fallback/test.php b/includes/vendor/rosell-dk/exec-with-fallback/test.php new file mode 100644 index 0000000..89addb0 --- /dev/null +++ b/includes/vendor/rosell-dk/exec-with-fallback/test.php @@ -0,0 +1,9 @@ + /dev/null; then XDEBUG=xdebug2; else XDEBUG=xdebug; fi + + # Store XDEBUG in github env, so we can access it later through env.XDEBUG + echo "XDEBUG=$XDEBUG" >> $GITHUB_ENV + + echo "Result: ${{ env.XDEBUG }}" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ env.XDEBUG }} + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key, and for install + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + - name: Create coverage badge json + run: | + # Extract total coverage + COVERAGE=$(grep -oP -m 1 'Lines:\s*\K[0-9.%]+' build/coverage.txt) + + # Set COLOR based on COVERAGE + # 0-49%: red, 50%-69%: orange, 70%-80%: yellow, 90%-100%: brightgreen + if grep -oP '(^9\d.)|(^100.)' <<< "$COVERAGE" > /dev/null; then COLOR=brightgreen; elif grep -oP '[87]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=yellow; elif grep -oP '[65]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=orange; else COLOR=red; fi; + + # Generate bagde json + echo \{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"$COVERAGE\",\"color\":\"$COLOR\"\} | tee build/coverage-badge.json + + # PS: If we needed COVERAGE elsewhere, we could store in ENV like this: + # echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV + + - name: Install SSH Key (for deployment of code coverage) + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.DEPLOY_KEY }} + known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + + - name: Upload code coverage report + run: | + sh -c "rsync -rtog --chown :www-data $GITHUB_WORKSPACE/build/ $DEPLOY_DESTINATION --delete" + env: + DEPLOY_DESTINATION: ${{ secrets.DEPLOY_DESTINATION }} diff --git a/includes/vendor/rosell-dk/file-util/.github/workflows/release.yml b/includes/vendor/rosell-dk/file-util/.github/workflows/release.yml new file mode 100644 index 0000000..6c90335 --- /dev/null +++ b/includes/vendor/rosell-dk/file-util/.github/workflows/release.yml @@ -0,0 +1,83 @@ +name: Big test (trigger manually before releasing) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15] + php: [8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + #os: [windows-2022, macos-10.15] + #php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all diff --git a/includes/vendor/rosell-dk/file-util/LICENSE b/includes/vendor/rosell-dk/file-util/LICENSE new file mode 100644 index 0000000..78457aa --- /dev/null +++ b/includes/vendor/rosell-dk/file-util/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2018 Bjørn Rosell + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/includes/vendor/rosell-dk/file-util/README.md b/includes/vendor/rosell-dk/file-util/README.md new file mode 100644 index 0000000..a26d86a --- /dev/null +++ b/includes/vendor/rosell-dk/file-util/README.md @@ -0,0 +1,22 @@ +# File Util + +[![Build Status](https://github.com/rosell-dk/file-util/workflows/build/badge.svg)](https://github.com/rosell-dk/file-util/actions/workflows/php.yml) +[![Software License](https://img.shields.io/badge/license-MIT-418677.svg)](https://github.com/rosell-dk/file-util/blob/master/LICENSE) +[![Coverage](https://img.shields.io/endpoint?url=https://little-b.it/file-util/code-coverage/coverage-badge.json)](http://little-b.it/file-util/code-coverage/coverage/index.html) +[![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/file-util.svg)](https://packagist.org/packages/rosell-dk/file-util) +[![Minimum PHP Version](https://img.shields.io/packagist/php-v/rosell-dk/file-util)](https://php.net) + +Just a bunch of handy methods for dealing with files and paths: + + +- *FileExists::fileExists($path)*:\ +A well-behaved version of *file_exists* that throws upon failure rather than emitting a warning + +- *FileExists::fileExistsTryHarder($path)*:\ +Also well-behaved. Tries FileExists::fileExists(). In case of failure, tries exec()-based implementation + +- *PathValidator::checkPath($path)*:\ +Check if path looks valid and doesn't contain suspecious patterns + +- *PathValidator::checkFilePathIsRegularFile($path)*:\ +Check if path points to a regular file (and doesnt match suspecious patterns) diff --git a/includes/vendor/rosell-dk/file-util/composer.json b/includes/vendor/rosell-dk/file-util/composer.json new file mode 100644 index 0000000..346b78a --- /dev/null +++ b/includes/vendor/rosell-dk/file-util/composer.json @@ -0,0 +1,69 @@ +{ + "name": "rosell-dk/file-util", + "description": "Functions for dealing with files and paths", + "type": "library", + "license": "MIT", + "keywords": ["files", "path", "util"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan-global" + ], + "phpunit": "phpunit --coverage-text", + "test": "phpunit --coverage-text=build/coverage.txt --coverage-clover=build/coverage.clover --coverage-html=build/coverage --whitelist=src tests", + "test-no-cov": "phpunit --no-coverage tests", + "test-41": "phpunit --no-coverage --configuration 'phpunit-41.xml.dist'", + "test-with-coverage": "phpunit --coverage-text --configuration 'phpunit-with-coverage.xml.dist'", + "test-41-with-coverage": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'", + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "phpcs": "phpcs --standard=phpcs-ruleset.xml", + "phpcs-all": "phpcs --standard=phpcs-ruleset.xml src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4", + "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4", + "phpstan-global": "~/.config/composer/vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "FileUtil\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "FileUtil\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "require": { + "php": ">=5.4", + "rosell-dk/exec-with-fallback": "^1.0.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*", + "phpstan/phpstan": "^1.5", + "mikey179/vfsstream": "^1.6" + }, + "config": { + "sort-packages": true + } +} diff --git a/includes/vendor/rosell-dk/file-util/phpcs-ruleset.xml b/includes/vendor/rosell-dk/file-util/phpcs-ruleset.xml new file mode 100644 index 0000000..37d5689 --- /dev/null +++ b/includes/vendor/rosell-dk/file-util/phpcs-ruleset.xml @@ -0,0 +1,8 @@ + + + PSR2 without line ending rule - let git manage the EOL cross the platforms + + + + + diff --git a/includes/vendor/rosell-dk/webp-convert/src/Helpers/FileExists.php b/includes/vendor/rosell-dk/file-util/src/FileExists.php similarity index 63% rename from includes/vendor/rosell-dk/webp-convert/src/Helpers/FileExists.php rename to includes/vendor/rosell-dk/file-util/src/FileExists.php index 79fc3fa..2ecdd4c 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Helpers/FileExists.php +++ b/includes/vendor/rosell-dk/file-util/src/FileExists.php @@ -1,13 +1,14 @@ - * @since Class available since Release 2.3.0 */ class FileExists { @@ -36,18 +37,18 @@ public static function warningHandler($errno, $errstr, $errfile, $errline) } /** - * A well behaved replacement for file_exist that throws upon failure rather than emmitting a warning. + * A well behaved replacement for file_exist that throws upon failure rather than emitting a warning. * - * @throws \Exception If file_exists threw a warning - * @return boolean|null True if file exists. False if it doesn't. + * @throws \Exception Throws an exception in case file_exists emits a warning + * @return boolean True if file exists. False if it doesn't. */ - public static function honestFileExists($path) + public static function fileExists($path) { // There is a challenges here: // We want to suppress warnings, but at the same time we want to know that it happened. // We achieve this by registering an error handler set_error_handler( - array('WebPConvert\Helpers\FileExists', "warningHandler"), + array('FileUtil\FileExists', "warningHandler"), E_WARNING | E_USER_WARNING | E_NOTICE | E_USER_NOTICE ); self::$lastWarning = null; @@ -71,31 +72,6 @@ public static function honestFileExists($path) throw new \Exception($errstr, $errno); } - /** - * A fileExist based on an exec call. - * - * @throws \Exception If exec cannot be called - * @return boolean|null True if file exists. False if it doesn't. - */ - public static function fileExistsUsingExec($path) - { - if (!function_exists('exec')) { - throw new \Exception( - 'cannot determine if file exists using exec() - the function is unavailable' - ); - } - - // Lets try to find out by executing "ls path/to/cwebp" - exec('ls ' . $path, $output, $returnCode); - if (($returnCode == 0) && (isset($output[0]))) { - return true; - } - - // We assume that "ls" command is general available! - // As that failed, we can conclude the file does not exist. - return false; - } - /** * A fileExist doing the best it can. * @@ -105,12 +81,14 @@ public static function fileExistsUsingExec($path) public static function fileExistsTryHarder($path) { try { - $result = self::honestFileExists($path); + $result = self::fileExists($path); } catch (\Exception $e) { try { - $result = self::fileExistsUsingExec($path); + $result = FileExistsUsingExec::fileExists($path); } catch (\Exception $e) { throw new \Exception('Cannot determine if file exists or not'); + } catch (\Throwable $e) { + throw new \Exception('Cannot determine if file exists or not'); } } return $result; diff --git a/includes/vendor/rosell-dk/file-util/src/FileExistsUsingExec.php b/includes/vendor/rosell-dk/file-util/src/FileExistsUsingExec.php new file mode 100644 index 0000000..493316b --- /dev/null +++ b/includes/vendor/rosell-dk/file-util/src/FileExistsUsingExec.php @@ -0,0 +1,40 @@ + + */ +class FileExistsUsingExec +{ + + /** + * A fileExist based on an exec call. + * + * @throws \Exception If exec cannot be called + * @return boolean|null True if file exists. False if it doesn't. + */ + public static function fileExists($path) + { + if (!ExecWithFallback::anyAvailable()) { + throw new \Exception( + 'cannot determine if file exists using exec() or similar - the function is unavailable' + ); + } + + // Lets try to find out by executing "ls path/to/cwebp" + ExecWithFallback::exec('ls ' . $path, $output, $returnCode); + if (($returnCode == 0) && (isset($output[0]))) { + return true; + } + + // We assume that "ls" command is general available! + // As that failed, we can conclude the file does not exist. + return false; + } +} diff --git a/includes/vendor/rosell-dk/file-util/src/PathValidator.php b/includes/vendor/rosell-dk/file-util/src/PathValidator.php new file mode 100644 index 0000000..a68598c --- /dev/null +++ b/includes/vendor/rosell-dk/file-util/src/PathValidator.php @@ -0,0 +1,70 @@ + + */ +class PathValidator +{ + /** + * Check if path looks valid and doesn't contain suspecious patterns. + + * The path must meet the following criteria: + * + * - It must be a string + * - No NUL character + * - No control characters between 0-20 + * - No phar stream wrapper + * - No php stream wrapper + * - No glob stream wrapper + * - Not empty path + * + * @throws \Exception In case the path doesn't meet all criteria + */ + public static function checkPath($path) + { + if (gettype($path) !== 'string') { + throw new \Exception('File path must be string'); + } + if (strpos($path, chr(0)) !== false) { + throw new \Exception('NUL character is not allowed in file path!'); + } + if (preg_match('#[\x{0}-\x{1f}]#', $path)) { + // prevents line feed, new line, tab, charater return, tab, ets. + throw new \Exception('Control characters #0-#20 not allowed in file path!'); + } + // Prevent phar stream wrappers (security threat) + if (preg_match('#^phar://#', $path)) { + throw new \Exception('phar stream wrappers are not allowed in file path'); + } + if (preg_match('#^(php|glob)://#', $path)) { + throw new \Exception('php and glob stream wrappers are not allowed in file path'); + } + if (empty($path)) { + throw new \Exception('File path is empty!'); + } + } + + /** + * Check if path points to a regular file (and doesnt match suspecious patterns). + * + * @throws \Exception In case the path doesn't point to a regular file or matches suspecious patterns + */ + public static function checkFilePathIsRegularFile($path) + { + self::checkPath($path); + + if (!FileExists::fileExists($path)) { + throw new \Exception('File does not exist'); + } + if (@is_dir($path)) { + throw new \Exception('Expected a regular file, not a dir'); + } + } +} diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/.circleci/config.yml b/includes/vendor/rosell-dk/image-mime-type-guesser/.circleci/config.yml new file mode 100644 index 0000000..a656400 --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/.circleci/config.yml @@ -0,0 +1,76 @@ +# PHP CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-php/ for more details +# +version: 2 +jobs: + build71: + docker: + - image: circleci/php:7.1 + + steps: + - checkout + + - run: sudo apt update + - run: sudo docker-php-ext-install zip + + - restore_cache: + keys: + # "composer.lock" can be used if it is committed to the repo + - v1-dependencies-{{ checksum "composer.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: composer install -n --prefer-dist + + - save_cache: + key: v1-dependencies-{{ checksum "composer.json" }} + paths: + - ./vendor + + - run: ./vendor/bin/phpunit + - run: wget https://scrutinizer-ci.com/ocular.phar + - run: php ocular.phar code-coverage:upload --format=php-clover coverage.clover + + + build70: + docker: + - image: circleci/php:7.0 + steps: + - checkout + - run: sudo apt update + - restore_cache: + keys: + - v0-dependencies-{{ checksum "composer.json" }} + - v0-dependencies- + - run: composer install -n --prefer-dist + - save_cache: + key: v0-dependencies-{{ checksum "composer.json" }} + paths: + - ./vendor + - run: composer test + + build56: + docker: + - image: circleci/php:5.6 + steps: + - checkout + - run: sudo apt update + - restore_cache: + keys: + - v56-dependencies-{{ checksum "composer.json" }} + - v56-dependencies- + - run: composer install -n --prefer-dist + - save_cache: + key: v56-dependencies-{{ checksum "composer.json" }} + paths: + - ./vendor + - run: composer test + +workflows: + version: 2 + build_and_test_all: + jobs: + #- build71 + #- build70 + #- build56 diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/.github/FUNDING.yml b/includes/vendor/rosell-dk/image-mime-type-guesser/.github/FUNDING.yml new file mode 100644 index 0000000..8dd1d30 --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: rosell-dk +ko_fi: rosell diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/php.yml b/includes/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/php.yml new file mode 100644 index 0000000..00766a6 --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/php.yml @@ -0,0 +1,123 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest] + php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Determine which version of xdebug to use + run: | + # Set XDEBUG to "xdebug2" for PHP 7.2-7.4, but to "xdebug" for + if grep -oP '^7.[234]' <<< "$PHP" > /dev/null; then XDEBUG=xdebug2; else XDEBUG=xdebug; fi + + # Store XDEBUG in github env, so we can access it later through env.XDEBUG + echo "XDEBUG=$XDEBUG" >> $GITHUB_ENV + + echo "Result: ${{ env.XDEBUG }}" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ env.XDEBUG }} + extensions: exif, mbstring, fileinfo, gd + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key, and for install + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + - name: Create coverage badge json + run: | + # Extract total coverage + COVERAGE=$(grep -oP -m 1 'Lines:\s*\K[0-9.%]+' build/coverage.txt) + + # Set COLOR based on COVERAGE + # 0-49%: red, 50%-69%: orange, 70%-80%: yellow, 90%-100%: brightgreen + if grep -oP '(^9\d.)|(^100.)' <<< "$COVERAGE" > /dev/null; then COLOR=brightgreen; elif grep -oP '[87]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=yellow; elif grep -oP '[65]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=orange; else COLOR=red; fi; + + # Generate bagde json + echo \{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"$COVERAGE\",\"color\":\"$COLOR\"\} | tee build/coverage-badge.json + + # PS: If we needed COVERAGE elsewhere, we could store in ENV like this: + # echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV + + - name: Install SSH Key (for deployment of code coverage) + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.DEPLOY_KEY }} + known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + + - name: Upload code coverage report + run: | + sh -c "rsync -rtog --chown :www-data $GITHUB_WORKSPACE/build/ $DEPLOY_DESTINATION --delete" + env: + DEPLOY_DESTINATION: ${{ secrets.DEPLOY_DESTINATION }} diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/release.yml b/includes/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/release.yml new file mode 100644 index 0000000..785a7d9 --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/.github/workflows/release.yml @@ -0,0 +1,85 @@ +name: Big test (trigger manually before releasing) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15] + #os: [windows-2022, windows-2019] + php: [8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + #os: [windows-2022] + #php: [8.1, 7.0] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: exif, mbstring, fileinfo, gd + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/README.md b/includes/vendor/rosell-dk/image-mime-type-guesser/README.md index 0662e0d..d7eea84 100644 --- a/includes/vendor/rosell-dk/image-mime-type-guesser/README.md +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/README.md @@ -2,107 +2,109 @@ [![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/image-mime-type-guesser.svg?style=flat-square)](https://packagist.org/packages/rosell-dk/image-mime-type-guesser) [![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net) -[![Build Status](https://img.shields.io/travis/rosell-dk/image-mime-type-guesser/master.svg?style=flat-square)](https://travis-ci.org/rosell-dk/image-mime-type-guesser) -[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/rosell-dk/image-mime-type-guesser.svg?style=flat-square)](https://scrutinizer-ci.com/g/rosell-dk/image-mime-type-guesser/code-structure/master) -[![Quality Score](https://img.shields.io/scrutinizer/g/rosell-dk/image-mime-type-guesser.svg?style=flat-square)](https://scrutinizer-ci.com/g/rosell-dk/image-mime-type-guesser/) +[![Build Status](https://img.shields.io/github/workflow/status/rosell-dk/image-mime-type-guesser/PHP?logo=GitHub&style=flat-square)](https://github.com/rosell-dk/image-mime-type-guesser/actions/workflows/php.yml) +[![Coverage](https://img.shields.io/endpoint?url=https://little-b.it/image-mime-type-guesser/code-coverage/coverage-badge.json)](http://little-b.it/image-mime-type-guesser/code-coverage/coverage/index.html) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/rosell-dk/image-mime-type-guesser/blob/master/LICENSE) +[![Monthly Downloads](http://poser.pugx.org/rosell-dk/image-mime-type-guesser/d/monthly)](https://packagist.org/packages/rosell-dk/image-mime-type-guesser) +[![Dependents](http://poser.pugx.org/rosell-dk/image-mime-type-guesser/dependents)](https://packagist.org/packages/rosell-dk/image-mime-type-guesser/dependents?order_by=downloads) *Detect / guess mime type of an image* Do you need to determine if a file is an image?
And perhaps you also want to know the mime type of the image?
-Do you basically need [exif_imagetype](https://www.php.net/manual/en/function.exif-imagetype.php), but which also works when PHP is compiled without exif? – You come to the right library. Ok, actually the library cannot offer mime type detection for images which works *on all platforms*, but it can try a whole stack of methods and optionally fall back to guess from the file extension. The stack of detect methods are currently (and in that order): -- [`exif_imagetype`](https://www.php.net/manual/en/function.exif-imagetype.php) *(PHP 4 >= 4.3.0, PHP 5, PHP 7) - unless PHP is compiled without exif* -- [`finfo`](https://www.php.net/manual/en/class.finfo.php) *(PHP 5 >= 5.3.0, PHP 7, PECL fileinfo >= 0.1.0) - requires fileinfo extension to be enabled* -- Our custom 4 byte sniffer (based on [this code](http://phil.lavin.me.uk/2011/12/php-accurately-detecting-the-type-of-a-file/)) *(PHP 4, PHP 5, PHP 7) - only detects png, gif and jpeg* -- [`getimagesize`](https://www.php.net/getimagesize) *(PHP 4, PHP 5, PHP 7)* -- [`mime_content_type`](https://www.php.net/manual/en/function.mime-content-type.php) *(PHP 4 >= 4.3.0, PHP 5, PHP 7)* +- [This signature sniffer](https://github.com/rosell-dk/image-mime-type-sniffer) *Does not require any extensions. Recognizes popular image formats only* +- [`finfo`](https://www.php.net/manual/en/class.finfo.php) *Requires fileinfo extension to be enabled. (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0)* +- [`exif_imagetype`](https://www.php.net/manual/en/function.exif-imagetype.php) *Requires that PHP is compiled with exif (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)* +- [`mime_content_type`](https://www.php.net/manual/en/function.mime-content-type.php) *Requires fileinfo. (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)* -Note that these methods all uses the mime type mapping on the server. Not all servers for example detects `image/webp`. +Note that all these methods except the signature sniffer relies on the mime type mapping on the server (the `mime.types` file in Apache). If the server doesn't know about a certain mime type, it will not be detected. This does however not mean that the methods relies on the file extension. A png file renamed to "png.jpeg" will be correctly identified as *image/png*. +Besides the detection methods, the library also comes with a method for mapping file extension to mime type. It is rather limited, though. ## Installation -Install with composer - +Install with composer: +``` +composer require rosell-dk/image-mime-type-guesser +``` ## Usage -Use `ImageMimeTypeGuesser::detect` if you do not want the library to make a wild guess based on file extension, but in return are willing to accept the increased probability of the library not returning a mime type as an answer. +To detect the mime type of a file, use `ImageMimeTypeGuesser::detect($filePath)`. It returns the mime-type, if the file is recognized as an image. *false* is returned if it is not recognized as an image. *null* is returned if the mime type could not be determined (ie due to none of the methods being available). Example: ```php +use ImageMimeTypeGuesser\ImageMimeTypeGuesser; $result = ImageMimeTypeGuesser::detect($filePath); if (is_null($result)) { // the mime type could not be determined } elseif ($result === false) { // it is NOT an image (not a mime type that the server knows about anyway) + // This happens when: + // a) The mime type is identified as something that is not an image (ie text) + // b) The mime type isn't identified (ie if the image type is not known by the server) } else { // it is an image, and we know its mime type! $mimeType = $result; } ``` -If you are ok with wild guessing from file extension, use `ImageMimeTypeGuesser::guess` or `ImageMimeTypeGuesser::lenientGuess`. Lets start with the first. +For convenience, you can use *detectIsIn* method to test if a detection is in a list of mimetypes. + +```php +if (ImageMimeTypeGuesser::detectIsIn($filePath, ['image/jpeg','image/png'])) { + // The file is a jpeg or a png +} +``` -`ImageMimeTypeGuesser::guess` will first try detection. If detection fails (void is returned), it will fall back to guessing from extension using `GuessFromExtension::guess`. +The `detect` method does not resort to mapping from file extension. In most cases you do not want to do that. In some cases it can be insecure to do that. For example, if you want to prevent a user from uploading executable files, you probably do not want to allow her to upload executable files with innocent looking file extenions, such as "evil-exe.jpg". -As with the detect method, it also has three possible outcomes: a mime type, false or void. +In some cases, though, you simply want a best guess, and in that case, falling back to mapping from file extension makes sense. In that case, you can use the *guess* method instead of the *detect* method. Or you can use *lenientGuess*. Lenient guess is even more slacky and will turn to mapping not only when dectect return *null*, but even when it returns *false*. *Warning*: Beware that guessing from file extension is unsuited when your aim is to protect the server from harmful uploads. -*Notice*: Only a limited set of image extensions is recognized by the extension to mimetype mapper - namely the following: { bmp, gif, ico, jpg, jpeg, png, tif, tiff, webp, svg }. If you need some other specifically, feel free to add a PR, or ask me to do it by creating an issue. +*Notice*: Only a limited set of image extensions is recognized by the extension to mimetype mapper - namely the following: { apng, avif, bmp, gif, ico, jpg, jpeg, png, tif, tiff, webp, svg }. If you need some other specifically, feel free to add a PR, or ask me to do it by creating an issue. Example: ```php $result = ImageMimeTypeGuesser::guess($filePath); if ($result !== false) { - // it is an image, and we know its mime type (well, we don't really know, because we allowed guessing from extension) + // It appears to be an image + // BEWARE: This is only a guess, as we resort to mapping from file extension, + // when the file cannot be properly detected. + // DO NOT USE THIS GUESS FOR PROTECTING YOUR SERVER $mimeType = $result; } else { - // not an image + // It does not appear to be an image } ``` -If you do not want your servers limited knowledge about image types to be decisive, you can use lenientGuess. It tries to detect. If detection fails (void *or false* is returned), it will fall back to guessing based on file extension. - -Say for example that your server does not recognize the image/webp format, and you are examining a file "test.webp". In that case, a detection with *detect* will return false (provided that one of the detection methods are operational). The *guess* method will *also* return false, as it never gets to fall back to file extension mapping. However, *lenientGuess* will nail it, and return 'image/webp'. - -For those who speaks code, the logic is perhaps best described with the code itself: +The guess functions also have convenience methods for testing against a list of mime types. They are called `ImageMimeTypeGuesser::guessIsIn` and `ImageMimeTypeGuesser::lenientGuessIsIn`. +Example: ```php -public static function lenientGuess($filePath) -{ - $detectResult = self::detect($filePath); - if ($detectResult === false) { - // The server does not recognize this image type. - // - but perhaps it is because it does not know about this image type. - // - so we turn to mapping the file extension - return GuessFromExtension::guess($filePath); - } elseif (is_null($detectResult)) { - // the mime type could not be determined - // perhaps we also in this case want to turn to mapping the file extension - return GuessFromExtension::guess($filePath); - } - return $detectResult; +if (ImageMimeTypeGuesser::guessIsIn($filePath, ['image/jpeg','image/png'])) { + // The file appears to be a jpeg or a png } ``` +## Alternatives -Finally, for convenience, there are three methods for testing if a detection / guess / lenient guess is in a list of mime types. They are called `ImageMimeTypeGuesser::detectIsIn`, `ImageMimeTypeGuesser::guessIsIn` and `ImageMimeTypeGuesser::lenientGuessIsIn`. +Other sniffers: +- https://github.com/Intervention/mimesniffer +- https://github.com/zjsxwc/mime-type-sniffer +- https://github.com/Tinram/File-Identifier -Example: +## Do you like what I do? +Perhaps you want to support my work, so I can continue doing it :) -```php -if (ImageMimeTypeGuesser::guessIsIn($filePath, ['image/jpeg','image/png']) { - // Image is either a jpeg or a png (probably) -} -``` +- [Become a backer or sponsor on Patreon](https://www.patreon.com/rosell). +- [Buy me a Coffee](https://ko-fi.com/rosell) diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/composer.json b/includes/vendor/rosell-dk/image-mime-type-guesser/composer.json index f486392..3b16065 100644 --- a/includes/vendor/rosell-dk/image-mime-type-guesser/composer.json +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/composer.json @@ -8,18 +8,21 @@ "ci": [ "@test", "@phpcs-all", - "@composer validate --no-check-all --strict" + "@composer validate --no-check-all --strict", + "@phpstan" ], "cs-fix-all": [ "php-cs-fixer fix src" ], "cs-fix": "php-cs-fixer fix", "cs-dry": "php-cs-fixer fix --dry-run --diff", - "test": "phpunit tests --coverage-text --coverage-clover=coverage.clover", + "test": "phpunit --coverage-text=build/coverage.txt --coverage-clover=build/coverage.clover --coverage-html=build/coverage --whitelist=src tests", + "test-no-cov": "phpunit tests", "test2": "phpunit tests", - "phpcs": "phpcs --standard=PSR2", - "phpcs-all": "phpcs --standard=PSR2 src", - "phpcbf": "phpcbf --standard=PSR2" + "phpcs": "phpcs --standard=phpcs-ruleset.xml", + "phpcs-all": "phpcs --standard=phpcs-ruleset.xml src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4" }, "extra": { "scripts-descriptions": { @@ -44,10 +47,15 @@ "role": "Project Author" } ], + "require": { + "php": "^5.6 | ^7.0 | ^8.0", + "rosell-dk/image-mime-type-sniffer": "^1.0" + }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.11", - "phpunit/phpunit": "^5.7.27", - "squizlabs/php_codesniffer": "3.*" + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*", + "phpstan/phpstan": "^1.5" }, "config": { "sort-packages": true diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/phpcs-ruleset.xml b/includes/vendor/rosell-dk/image-mime-type-guesser/phpcs-ruleset.xml new file mode 100644 index 0000000..37d5689 --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/phpcs-ruleset.xml @@ -0,0 +1,8 @@ + + + PSR2 without line ending rule - let git manage the EOL cross the platforms + + + + + diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/phpstan.neon b/includes/vendor/rosell-dk/image-mime-type-guesser/phpstan.neon new file mode 100644 index 0000000..a471b0f --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + reportUnmatchedIgnoredErrors: false + ignoreErrors: + - '#Unsafe usage of new static#' diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/phpunit.xml.dist b/includes/vendor/rosell-dk/image-mime-type-guesser/phpunit.xml.dist index c2d24d1..1a03a9e 100644 --- a/includes/vendor/rosell-dk/image-mime-type-guesser/phpunit.xml.dist +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/phpunit.xml.dist @@ -19,10 +19,4 @@ src/ - - - - - - diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/AbstractDetector.php b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/AbstractDetector.php index 1e76628..56fd1fa 100644 --- a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/AbstractDetector.php +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/AbstractDetector.php @@ -24,7 +24,6 @@ abstract protected function doDetect($filePath); /** * Create an instance of this class * - * @param string $filePath The path to the file * @return static */ public static function createInstance() diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/ExifImageType.php b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/ExifImageType.php index 0442883..8082098 100644 --- a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/ExifImageType.php +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/ExifImageType.php @@ -30,9 +30,12 @@ protected function doDetect($filePath) return ($imageType ? image_type_to_mime_type($imageType) : false); } catch (\Exception $e) { // Might for example get "Read error!" + // (for some reason, this happens on very small files) + // We handle such errors as indeterminable (null) + return null; // well well, don't let this stop us //echo $e->getMessage(); -// throw($e); + //throw($e); } } return null; diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/FInfo.php b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/FInfo.php index ed4ab8e..1712ad3 100644 --- a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/FInfo.php +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/FInfo.php @@ -24,13 +24,19 @@ protected function doDetect($filePath) if (class_exists('finfo')) { // phpcs:ignore PHPCompatibility.PHP.NewClasses.finfoFound $finfo = new \finfo(FILEINFO_MIME); - $mime = explode('; ', $finfo->file($filePath)); - $result = $mime[0]; - - if (strpos($result, 'image/') === 0) { - return $result; + $result = $finfo->file($filePath); + if ($result === false) { + // false means an error occured + return null; } else { - return false; + $mime = explode('; ', $result); + $result = $mime[0]; + + if (strpos($result, 'image/') === 0) { + return $result; + } else { + return false; + } } } return null; diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/GetImageSize.php b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/GetImageSize.php index 46369b9..cc3a2e8 100644 --- a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/GetImageSize.php +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/GetImageSize.php @@ -27,7 +27,7 @@ protected function doDetect($filePath) $imageSize = getimagesize($filePath); return (isset($imageSize['mime']) ? $imageSize['mime'] : false); } catch (\Exception $e) { - // well well, don't let this stop us either + // well well, don't let this stop us either return null; } } diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/MimeContentType.php b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/MimeContentType.php index 32a7b97..e9b7f9b 100644 --- a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/MimeContentType.php +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/MimeContentType.php @@ -34,6 +34,10 @@ protected function doDetect($filePath) } } catch (\Exception $e) { // we are unstoppable! + + // TODO: + // We should probably throw... - we will do in version 1.0.0 + //throw $e; } } return null; diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/SignatureSniffer.php b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/SignatureSniffer.php new file mode 100644 index 0000000..4200cd3 --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/SignatureSniffer.php @@ -0,0 +1,28 @@ + 'image/png', - '47494638' => 'image/gif', - 'FFD8FFE0' => 'image/jpeg', // JFIF JPEG - 'FFD8FFE1' => 'image/jpeg', // EXIF JPEG - ]; - - $handle = @fopen($filePath, 'r'); - if ($handle === false) { - return null; - } - $firstFour = @fread($handle, 4); - if ($firstFour === false) { - return null; - } - $key = strtoupper(bin2hex($firstFour)); - if (isset($known[$key])) { - return $known[$key]; - } - } -} diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/Stack.php b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/Stack.php index 468419c..d492a97 100644 --- a/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/Stack.php +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/src/Detectors/Stack.php @@ -20,10 +20,10 @@ class Stack extends AbstractDetector protected function doDetect($filePath) { $detectors = [ - 'ExifImageType', + 'SignatureSniffer', 'FInfo', - 'SniffFirstFourBytes', - 'GetImageSize', + 'ExifImageType', + //'GetImageSize', // Disabled, as documentation says it is unreliable 'MimeContentType', ]; diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/src/GuessFromExtension.php b/includes/vendor/rosell-dk/image-mime-type-guesser/src/GuessFromExtension.php index 36574cb..8b63dd4 100644 --- a/includes/vendor/rosell-dk/image-mime-type-guesser/src/GuessFromExtension.php +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/src/GuessFromExtension.php @@ -24,7 +24,6 @@ class GuessFromExtension * * If no mapping found, nothing is returned * - * TODO: jp2, jpx, ... * Returns: * - mimetype (if file extension could be mapped to an image type), * - false (if file extension could be mapped to a type known not to be an image type) @@ -52,39 +51,6 @@ public static function guess($filePath) $fileExtension = strtolower($fileExtension); }*/ - $result = preg_match('#\\.([^.]*)$#', $filePath, $matches); - if ($result !== 1) { - return null; - } - $fileExtension = $matches[1]; - - // Trivial image mime types - if (in_array($fileExtension, ['bmp', 'gif', 'jpeg', 'png', 'tiff', 'webp'])) { - return 'image/' . $fileExtension; - } - - // Common extensions that are definitely not images - if (in_array($fileExtension, ['txt', 'doc', 'zip', 'gz', 'exe'])) { - return false; - } - - // Non-trivial image mime types - switch ($fileExtension) { - case 'ico': - return 'image/vnd.microsoft.icon'; // or perhaps 'x-icon' ? - - case 'jpg': - return 'image/jpeg'; - - case 'svg': - return 'image/svg+xml'; - - case 'tif': - return 'image/tiff'; - } - - // We do not know this extension, return null - return null; + return MimeMap::filenameToMime($filePath); } - } diff --git a/includes/vendor/rosell-dk/image-mime-type-guesser/src/MimeMap.php b/includes/vendor/rosell-dk/image-mime-type-guesser/src/MimeMap.php new file mode 100644 index 0000000..d32cced --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-guesser/src/MimeMap.php @@ -0,0 +1,77 @@ + /dev/null; then XDEBUG=xdebug2; else XDEBUG=xdebug; fi + + # Store XDEBUG in github env, so we can access it later through env.XDEBUG + echo "XDEBUG=$XDEBUG" >> $GITHUB_ENV + + echo "Result: ${{ env.XDEBUG }}" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ env.XDEBUG }} + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key, and for install + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + - name: Create coverage badge json + run: | + # Extract total coverage + COVERAGE=$(grep -oP -m 1 'Lines:\s*\K[0-9.%]+' build/coverage.txt) + + # Set COLOR based on COVERAGE + # 0-49%: red, 50%-69%: orange, 70%-80%: yellow, 90%-100%: brightgreen + if grep -oP '(^9\d.)|(^100.)' <<< "$COVERAGE" > /dev/null; then COLOR=brightgreen; elif grep -oP '[87]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=yellow; elif grep -oP '[65]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=orange; else COLOR=red; fi; + + # Generate bagde json + echo \{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"$COVERAGE\",\"color\":\"$COLOR\"\} | tee build/coverage-badge.json + + # PS: If we needed COVERAGE elsewhere, we could store in ENV like this: + # echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV + + - name: Install SSH Key (for deployment of code coverage) + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.DEPLOY_KEY }} + known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + + - name: Upload code coverage report + run: | + sh -c "rsync -rtog --chown :www-data $GITHUB_WORKSPACE/build/ $DEPLOY_DESTINATION --delete" + env: + DEPLOY_DESTINATION: ${{ secrets.DEPLOY_DESTINATION }} diff --git a/includes/vendor/rosell-dk/image-mime-type-sniffer/.github/workflows/release.yml b/includes/vendor/rosell-dk/image-mime-type-sniffer/.github/workflows/release.yml new file mode 100644 index 0000000..6f53be3 --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-sniffer/.github/workflows/release.yml @@ -0,0 +1,83 @@ +name: Big test (trigger manually before releasing) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15] + php: [8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + #os: [ubuntu-20.04] + #php: [8.1] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all diff --git a/includes/vendor/rosell-dk/image-mime-type-sniffer/LICENSE b/includes/vendor/rosell-dk/image-mime-type-sniffer/LICENSE new file mode 100644 index 0000000..78457aa --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-sniffer/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2018 Bjørn Rosell + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/includes/vendor/rosell-dk/image-mime-type-sniffer/README.md b/includes/vendor/rosell-dk/image-mime-type-sniffer/README.md new file mode 100644 index 0000000..24b350d --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-sniffer/README.md @@ -0,0 +1,65 @@ +# Image Mime Type Sniffer + +[![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/image-mime-type-sniffer.svg)](https://packagist.org/packages/rosell-dk/image-mime-type-sniffer) +[![Minimum PHP Version](https://img.shields.io/packagist/php-v/rosell-dk/image-mime-type-sniffer)](https://php.net) +[![Build Status](https://github.com/rosell-dk/image-mime-type-sniffer/actions/workflows/php.yml/badge.svg)](https://github.com/rosell-dk/image-mime-type-sniffer/actions/workflows/php.yml) +[![Software License](https://img.shields.io/badge/license-MIT-418677.svg)](https://github.com/rosell-dk/image-mime-type-sniffer/blob/master/LICENSE) +[![Coverage](https://img.shields.io/endpoint?url=https://little-b.it/image-mime-type-sniffer/code-coverage/coverage-badge.json)](http://little-b.it/image-mime-type-sniffer/code-coverage/coverage/index.html) +[![Monthly Downloads](http://poser.pugx.org/rosell-dk/image-mime-type-sniffer/d/monthly)](https://packagist.org/packages/rosell-dk/image-mime-type-sniffer) +[![Dependents](http://poser.pugx.org/rosell-dk/image-mime-type-sniffer/dependents)](https://packagist.org/packages/rosell-dk/image-mime-type-sniffer/dependents?order_by=downloads) + + +Gets mime type of common *image* files by sniffing the file content, looking for signatures. + +The fact that this library limits its ambition to sniff images makes it light and simple. It is also quite fast. Most other sniffers iterates through all common signatures, however this library uses a mix of finite-state machine approach and iteration to achieve a good balance of speed, compactness, simplicity and readability. + +The library recognizes the most widespread image formats, such as GIF, JPEG, WEBP, AVIF, JPEG-2000 and HEIC. + +# Usage + +```php +use \ImageMimeTypeSniffer\ImageMimeTypeSniffer; + +$mimeType = ImageMimeTypeSniffer::detect($fileName); +if (is_null($mimeType)) { + // mimetype was not detected, which means the file is probably not an image (unless it is a rare type) +} else { + // It is an image, and we know the mimeType +} +``` + +PS: An `\Exception` is thrown if the file is unreadable. + +# List of recognized image types: + +- application/psd +- image/avif +- image/bmp +- image/gif +- image/heic +- image/jp2 +- image/jp20 +- image/jpeg +- image/jpm +- image/jpx +- image/png +- image/svg+xml +- image/tiff +- image/webp +- image/x-icon +- video/mj2 + +TODO: image/heif + + +# Alternatives + +I have created a library that uses this library as well as other methods (*finfo*, *exif_imagetype*, etc) for determining image type. You might want to use that instead, to cover all bases. It is available here: [image-mime-type-guesser](https://github.com/rosell-dk/image-mime-type-guesser). + +There are also other PHP mime type sniffers out there: + +- https://github.com/Intervention/mimesniffer +- https://github.com/Tinram/File-Identifier +- https://github.com/shanept/MimeSniffer +- https://github.com/zjsxwc/mime-type-sniffer +- https://github.com/thephpleague/mime-type-detection/tree/main/src diff --git a/includes/vendor/rosell-dk/image-mime-type-sniffer/composer.json b/includes/vendor/rosell-dk/image-mime-type-sniffer/composer.json new file mode 100644 index 0000000..47cdd2e --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-sniffer/composer.json @@ -0,0 +1,63 @@ +{ + "name": "rosell-dk/image-mime-type-sniffer", + "description": "Sniff mime type (images only)", + "type": "library", + "license": "MIT", + "keywords": ["mime", "mime type", "image", "images"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan" + ], + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "test": "phpunit --coverage-text=build/coverage.txt --coverage-clover=build/coverage.clover --coverage-html=build/coverage --whitelist=src tests", + "test-no-cov": "phpunit --no-coverage tests", + "test2": "phpunit tests", + "phpcs": "phpcs --standard=phpcs-ruleset.xml", + "phpcs-all": "phpcs --standard=phpcs-ruleset.xml src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "ImageMimeTypeSniffer\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "ImageMimeTypeSniffer\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "require": { + "php": ">=5.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*", + "phpstan/phpstan": "^1.5", + "mikey179/vfsstream": "^1.6" + }, + "config": { + "sort-packages": true + } +} diff --git a/includes/vendor/rosell-dk/image-mime-type-sniffer/phpcs-ruleset.xml b/includes/vendor/rosell-dk/image-mime-type-sniffer/phpcs-ruleset.xml new file mode 100644 index 0000000..37d5689 --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-sniffer/phpcs-ruleset.xml @@ -0,0 +1,8 @@ + + + PSR2 without line ending rule - let git manage the EOL cross the platforms + + + + + diff --git a/includes/vendor/rosell-dk/image-mime-type-sniffer/phpunit.xml.dist b/includes/vendor/rosell-dk/image-mime-type-sniffer/phpunit.xml.dist new file mode 100644 index 0000000..b29fdd5 --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-sniffer/phpunit.xml.dist @@ -0,0 +1,8 @@ + + + + + ./tests/ + + + diff --git a/includes/vendor/rosell-dk/image-mime-type-sniffer/src/ImageMimeTypeSniffer.php b/includes/vendor/rosell-dk/image-mime-type-sniffer/src/ImageMimeTypeSniffer.php new file mode 100644 index 0000000..b3b318e --- /dev/null +++ b/includes/vendor/rosell-dk/image-mime-type-sniffer/src/ImageMimeTypeSniffer.php @@ -0,0 +1,177 @@ + tag might be big too... - so we read in 200 extra + $moreBytes = @fread($handle, 200); + if ($moreBytes !== false) { + $sampleBin .= $moreBytes; + } + $binPatterns[] = ['image/svg+xml', "/^(<\?xml[^>]*\?>.*)? /dev/null; then XDEBUG=xdebug2; else XDEBUG=xdebug; fi + + # Store XDEBUG in github env, so we can access it later through env.XDEBUG + echo "XDEBUG=$XDEBUG" >> $GITHUB_ENV + + echo "Result: ${{ env.XDEBUG }}" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ env.XDEBUG }} + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key, and for install + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + - name: Create coverage badge json + run: | + # Extract total coverage + COVERAGE=$(grep -oP -m 1 'Lines:\s*\K[0-9.%]+' build/coverage.txt) + + # Set COLOR based on COVERAGE + # 0-49%: red, 50%-69%: orange, 70%-80%: yellow, 90%-100%: brightgreen + if grep -oP '(^9\d.)|(^100.)' <<< "$COVERAGE" > /dev/null; then COLOR=brightgreen; elif grep -oP '[87]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=yellow; elif grep -oP '[65]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=orange; else COLOR=red; fi; + + # Generate bagde json + echo \{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"$COVERAGE\",\"color\":\"$COLOR\"\} | tee build/coverage-badge.json + + # PS: If we needed COVERAGE elsewhere, we could store in ENV like this: + # echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV + + - name: Install SSH Key (for deployment of code coverage) + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.DEPLOY_KEY }} + known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + + - name: Upload code coverage report + run: | + sh -c "rsync -rtog --chown :www-data $GITHUB_WORKSPACE/build/ $DEPLOY_DESTINATION --delete" + env: + DEPLOY_DESTINATION: ${{ secrets.DEPLOY_DESTINATION }} diff --git a/includes/vendor/rosell-dk/locate-binaries/.github/workflows/release.yml b/includes/vendor/rosell-dk/locate-binaries/.github/workflows/release.yml new file mode 100644 index 0000000..54ebc66 --- /dev/null +++ b/includes/vendor/rosell-dk/locate-binaries/.github/workflows/release.yml @@ -0,0 +1,84 @@ +name: Big test (trigger manually before releasing) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15] + #os: [macos-11, macos-10.15, windows-2022, windows-2019] + php: [8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + #os: [windows-2022] + #php: [8.1, 7.0] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all diff --git a/includes/vendor/rosell-dk/locate-binaries/LICENSE b/includes/vendor/rosell-dk/locate-binaries/LICENSE new file mode 100644 index 0000000..78457aa --- /dev/null +++ b/includes/vendor/rosell-dk/locate-binaries/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2018 Bjørn Rosell + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/includes/vendor/rosell-dk/locate-binaries/README.md b/includes/vendor/rosell-dk/locate-binaries/README.md new file mode 100644 index 0000000..36673e5 --- /dev/null +++ b/includes/vendor/rosell-dk/locate-binaries/README.md @@ -0,0 +1,39 @@ +# Locate Binaries + +[![Build Status](https://github.com/rosell-dk/locate-binaries/workflows/build/badge.svg)](https://github.com/rosell-dk/locate-binaries/actions/workflows/php.yml) +[![Coverage](https://img.shields.io/endpoint?url=https://little-b.it/locate-binaries/code-coverage/coverage-badge.json)](http://little-b.it/locate-binaries/code-coverage/coverage/index.html) +[![Software License](https://img.shields.io/badge/license-MIT-418677.svg)](https://github.com/rosell-dk/locate-binary/blob/master/LICENSE) +[![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/locate-binaries.svg)](https://packagist.org/packages/rosell-dk/locate-binaries) +[![Minimum PHP Version](https://img.shields.io/packagist/php-v/rosell-dk/locate-binaries)](https://php.net) + +Just a little class for locating binaries. +You need `exec()`, `shell_exec()` or similar enabled for it to work. Otherwise, it will throw. + +Works on Linux, Windows and Mac. + +## Usage + +To locate installed `cwebp` binaries (found on Linux with `which -a`, falling back to `whereis -b`; on Windows found using `where`): +``` +$cwebBinariesFound = LocateBinaries::locateInstalledBinaries('cwebp'); +``` +Note that you get an array of matches - there may be several versions of a binary on a system. + +The library also adds another method for locating binaries by peeking in common system paths, such as *usr/bin* and `C:\Windows\System32` +However, beware that these dirs could be subject to open_basedir restrictions which can lead to warning entries in the error log. The other method is therefore best. + +Well warned, here it is the alternative, which you in some cases might want to fall back to after trying the first. +``` +$imagickBinariesFound = LocateBinaries::locateInCommonSystemPaths('convert'); +``` + +## Notes +The library uses the [exec-with-fallback](https://github.com/rosell-dk/exec-with-fallback) library in order to be able to use alternatives to exec() when exec() is disabled. + +## Do you like what I do? +Perhaps you want to support my work, so I can continue doing it :) + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/rosell). +- [Buy me a Coffee](https://ko-fi.com/rosell) + +Thanks! diff --git a/includes/vendor/rosell-dk/locate-binaries/composer.json b/includes/vendor/rosell-dk/locate-binaries/composer.json new file mode 100644 index 0000000..c4bdc1c --- /dev/null +++ b/includes/vendor/rosell-dk/locate-binaries/composer.json @@ -0,0 +1,69 @@ +{ + "name": "rosell-dk/locate-binaries", + "description": "Locate a binaries by means of exec() or similar", + "type": "library", + "license": "MIT", + "keywords": ["locate", "binary", "whereis", "which", "discover"], + "scripts": { + "ci": [ + "@test", + "@phpcs-all", + "@composer validate --no-check-all --strict", + "@phpstan" + ], + "phpunit": "phpunit --coverage-text", + "test": "phpunit --coverage-text=build/coverage.txt --coverage-clover=build/coverage.clover --coverage-html=build/coverage --whitelist=src tests", + "test-no-cov": "phpunit --no-coverage tests", + "test-41": "phpunit --no-coverage --configuration 'phpunit-41.xml.dist'", + "test-with-coverage": "phpunit --coverage-text --configuration 'phpunit-with-coverage.xml.dist'", + "test-41-with-coverage": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'", + "cs-fix-all": [ + "php-cs-fixer fix src" + ], + "cs-fix": "php-cs-fixer fix", + "cs-dry": "php-cs-fixer fix --dry-run --diff", + "phpcs": "phpcs --standard=phpcs-ruleset.xml", + "phpcs-all": "phpcs --standard=phpcs-ruleset.xml src", + "phpcbf": "phpcbf --standard=PSR2", + "phpstan": "vendor/bin/phpstan analyse src --level=4", + "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4", + "phpstan-global": "~/.config/composer/vendor/bin/phpstan analyse src --level=4" + }, + "extra": { + "scripts-descriptions": { + "ci": "Run tests before CI", + "phpcs": "Checks coding styles (PSR2) of file/dir, which you must supply. To check all, supply 'src'", + "phpcbf": "Fix coding styles (PSR2) of file/dir, which you must supply. To fix all, supply 'src'", + "cs-fix-all": "Fix the coding style of all the source files, to comply with the PSR-2 coding standard", + "cs-fix": "Fix the coding style of a PHP file or directory, which you must specify.", + "test": "Launches the preconfigured PHPUnit" + } + }, + "autoload": { + "psr-4": { "LocateBinaries\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "LocateBinaries\\Tests\\": "tests/" } + }, + "authors": [ + { + "name": "Bjørn Rosell", + "homepage": "https://www.bitwise-it.dk/contact", + "role": "Project Author" + } + ], + "require": { + "php": ">=5.6", + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/file-util": "^0.1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "3.*", + "phpstan/phpstan": "^1.5" + }, + "config": { + "sort-packages": true + } +} diff --git a/includes/vendor/rosell-dk/locate-binaries/phpcs-ruleset.xml b/includes/vendor/rosell-dk/locate-binaries/phpcs-ruleset.xml new file mode 100644 index 0000000..37d5689 --- /dev/null +++ b/includes/vendor/rosell-dk/locate-binaries/phpcs-ruleset.xml @@ -0,0 +1,8 @@ + + + PSR2 without line ending rule - let git manage the EOL cross the platforms + + + + + diff --git a/includes/vendor/rosell-dk/locate-binaries/src/LocateBinaries.php b/includes/vendor/rosell-dk/locate-binaries/src/LocateBinaries.php new file mode 100644 index 0000000..9707cde --- /dev/null +++ b/includes/vendor/rosell-dk/locate-binaries/src/LocateBinaries.php @@ -0,0 +1,163 @@ + + */ +class LocateBinaries +{ + + /** + * Locate binaries by looking in common system paths. + * + * We try a small set of common system paths, such as "/usr/bin". + * On Windows, we only try C:\Windows\System32 + * Note that you do not have to add ".exe" file extension on Windows, it is taken care of + * + * @param string $binary the binary to look for (ie "cwebp") + * + * @return array binaries found in common system locations + */ + public static function locateInCommonSystemPaths($binary) + { + $binaries = []; + + $commonSystemPaths = []; + + if (stripos(PHP_OS, 'WIN') === 0) { + $commonSystemPaths = [ + 'C:\Windows\System32', + ]; + $binary .= '.exe'; + } else { + $commonSystemPaths = [ + '/usr/bin', + '/usr/local/bin', + '/usr/gnu/bin', + '/usr/syno/bin', + '/bin', + ]; + } + + foreach ($commonSystemPaths as $dir) { + // PS: FileExists might throw if exec() or similar is unavailable. We let it. + // - this class assumes exec is available + if (FileExists::fileExistsTryHarder($dir . DIRECTORY_SEPARATOR . $binary)) { + $binaries[] = $dir . DIRECTORY_SEPARATOR . $binary; + } + } + return $binaries; + } + + /** + * Locate installed binaries using ie "whereis -b cwebp" (for Linux, Mac, etc) + * + * @return array Array of paths locateed (possibly empty) + */ + private static function locateBinariesUsingWhereIs($binary) + { + $isMac = (PHP_OS == 'Darwin'); + $command = 'whereis ' . ($isMac ? '' : '-b ') . $binary . ' 2>&1'; + + ExecWithFallback::exec($command, $output, $returnCode); + //echo 'command:' . $command; + //echo 'output:' . print_r($output, true); + + if (($returnCode == 0) && (isset($output[0]))) { + // On linux, result looks like this: + // "cwebp: /usr/bin/cwebp /usr/local/bin/cwebp" + // or, for empty: "cwebp:" + + if ($output[0] == ($binary . ':')) { + return []; + } + + // On mac, it is not prepended with name of binary. + // I don't know if mac returns one result per line or is space seperated + // As I don't know if some systems might return several lines, + // I assume that some do and convert to space-separation: + $result = implode(' ', $output); + + // Next, lets remove the prepended binary (if exists) + $result = preg_replace('#\b' . $binary . ':\s?#', '', $result); + + // And back to array + return explode(' ', $result); + } + return []; + } + + /** + * locate installed binaries using "which -a cwebp" + * + * @param string $binary the binary to look for (ie "cwebp") + * + * @return array Array of paths locateed (possibly empty) + */ + private static function locateBinariesUsingWhich($binary) + { + // As suggested by @cantoute here: + // https://wordpress.org/support/topic/sh-1-usr-local-bin-cwebp-not-found/ + ExecWithFallback::exec('which -a ' . $binary . ' 2>&1', $output, $returnCode); + if ($returnCode == 0) { + return $output; + } + return []; + } + + /** + * Locate binaries using where.exe (for Windows) + * + * @param string $binary the binary to look for (ie "cwebp") + * + * @return array binaries found + */ + private static function locateBinariesUsingWhere($binary) + { + ExecWithFallback::exec('where.exe ' . $binary . ' 2>&1', $output, $returnCode); + if ($returnCode == 0) { + return $output; + } + return []; + } + + /** + * Locate installed binaries + * + * For linuk, we use "which -a" or, if that fails "whereis -b" + * For Windows, we use "where.exe" + * These commands only searces within $PATH. So it only finds installed binaries (which is good, + * as it would be unsafe to deal with binaries found scattered around) + * + * @param string $binary the binary to look for (ie "cwebp") + * + * @return array binaries found + */ + public static function locateInstalledBinaries($binary) + { + if (stripos(PHP_OS, 'WIN') === 0) { + $paths = self::locateBinariesUsingWhere($binary); + if (count($paths) > 0) { + return $paths; + } + } else { + $paths = self::locateBinariesUsingWhich($binary); + if (count($paths) > 0) { + return $paths; + } + + $paths = self::locateBinariesUsingWhereIs($binary); + if (count($paths) > 0) { + return $paths; + } + } + return []; + } +} diff --git a/includes/vendor/rosell-dk/webp-convert/.github/install-gmagick-with-webp.sh b/includes/vendor/rosell-dk/webp-convert/.github/install-gmagick-with-webp.sh new file mode 100644 index 0000000..bab5aa6 --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/.github/install-gmagick-with-webp.sh @@ -0,0 +1,74 @@ +# https://duntuk.com/how-install-graphicsmagick-gmagick-php-extension +# https://gist.github.com/basimhennawi/21c39f9758b0b1cb5e0bd5ee08b5be58 +# https://github.com/rosell-dk/webp-convert/wiki/Installing-gmagick-extension + +#if [ -d "$HOME/vips/bin" ]; then +#fi; + + +$HOME/opt/bin/gm -version | grep -i 'WebP.*yes' && { + gmagick_installed_with_webp=1 +} + +if [[ $gmagick_installed_with_webp == 1 ]]; then + echo "Gmagick is already compiled with webp. Nothing to do :)" + echo ":)" +else + echo "Gmagick is is not installed or not compiled with webp." + compile_libwebp=1 + compile_gmagick=1 +fi; +#ls $HOME/opt/bin + + +cores=$(nproc) +LIBWEBP_VERSION=1.0.2 + +if [[ $compile_libwebp == 2 ]]; then + echo "We are going to be compiling libwebp..." + echo "Using $cores cores." + echo "Downloading libwebp version $LIBWEBP_VERSION" + cd /tmp + curl -O https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$LIBWEBP_VERSION.tar.gz + tar xzf libwebp-$LIBWEBP_VERSION.tar.gz + cd libwebp-* + + echo "./configure --prefix=$HOME/opt" + ./configure --prefix=$HOME/opt + + echo "make -j$CORES" + make -j$CORES + + echo "make install -j$CORES" + make install -j$CORES +fi; + +if [[ $compile_gmagick == 2 ]]; then + echo "Compiling Gmagick" + echo "Using $cores cores." + cd /tmp + echo "Downloading GraphicsMagick-LATEST.tar.gz" + wget http://78.108.103.11/MIRROR/ftp/GraphicsMagick/GraphicsMagick-LATEST.tar.gz + tar xfz GraphicsMagick-LATEST.tar.gz + cd GraphicsMagick-* + + echo "Configuring" + ./configure --prefix=$HOME/opt --enable-shared --with-webp=yes + + echo "make -j$CORES" + make -j$CORES + + echo "make install -j$CORES" + make install -j$CORES +fi; + + +#./configure --prefix=$HOME/opt --with-webp=yes && + +#$HOME/opt/bin/gm -version + +#convert -version | grep 'webp' || { + +#convert -list delegate | grep 'webp =>' || { +#} +##libgraphicsmagick1-dev diff --git a/includes/vendor/rosell-dk/webp-convert/.github/install-imagemagick-with-webp.sh b/includes/vendor/rosell-dk/webp-convert/.github/install-imagemagick-with-webp.sh new file mode 100644 index 0000000..5dfc8ba --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/.github/install-imagemagick-with-webp.sh @@ -0,0 +1,40 @@ + +# Install imagick with webp support (if not already there) and update library paths +# Got the script from here: +# https://stackoverflow.com/questions/41138404/how-to-install-newer-imagemagick-with-webp-support-in-travis-ci-container + +if ! [[ $IMAGEMAGICK_VERSION ]]; then + export IMAGEMAGICK_VERSION="7.0.8-43" +fi; + +convert -list delegate | grep 'webp =>' && { + echo "Imagick is already compiled with webp. Nothing to do :)" && + echo ":)" +} + +#convert -version | grep 'webp' || { + +convert -list delegate | grep 'webp =>' || { + export CORES=$(nproc) && + export LIBWEBP_VERSION=1.0.2 && + echo "Using $CORES cores for compiling..." && + cd /tmp && + curl -O https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$LIBWEBP_VERSION.tar.gz && + tar xzf libwebp-$LIBWEBP_VERSION.tar.gz && + cd libwebp-* && + ./configure --prefix=$HOME/opt && + make -j$CORES && + make install -j$CORES && + cd /tmp && + curl -O https://www.imagemagick.org/download/ImageMagick-$IMAGEMAGICK_VERSION.tar.gz && + tar xzf ImageMagick-$IMAGEMAGICK_VERSION.tar.gz && + cd ImageMagick-* && + ./configure --prefix=$HOME/opt --with-webp=yes && + make -j$CORES && + make install -j$CORES && + $HOME/opt/bin/magick -version | grep $IMAGEMAGICK_VERSION +} + +export LD_FLAGS=-L$HOME/opt/lib +export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$HOME/opt/lib +export CPATH=$CPATH:$HOME/opt/include diff --git a/includes/vendor/rosell-dk/webp-convert/.github/install-vips.sh b/includes/vendor/rosell-dk/webp-convert/.github/install-vips.sh new file mode 100644 index 0000000..ef081c6 --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/.github/install-vips.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +if ! [[ $VIPS_VERSION ]]; then + export VIPS_VERSION="8.10.6" +fi; + +export PATH=$HOME/vips/bin:$PATH +export LD_LIBRARY_PATH=$HOME/vips/lib:$LD_LIBRARY_PATH +export PKG_CONFIG_PATH=$HOME/vips/lib/pkgconfig:$PKG_CONFIG_PATH +export PYTHONPATH=$HOME/vips/lib/python2.7/site-packages:$PYTHONPATH +export GI_TYPELIB_PATH=$HOME/vips/lib/girepository-1.0:$GI_TYPELIB_PATH + +vips_site=https://github.com/libvips/libvips/releases/download + +set -e + +# do we already have the correct vips built? early exit if yes +# we could check the configure params as well I guess +if [ -d "$HOME/vips/bin" ]; then + installed_version=$($HOME/vips/bin/vips --version) + escaped_version="${VIPS_VERSION//\./\\.}" + echo "Need vips-$version" + echo "Found $installed_version" + if [[ "$installed_version" =~ ^vips-$escaped_version ]]; then + echo "Using cached directory" + exit 0 + fi +fi + +rm -rf $HOME/vips +echo "wget: $vips_site/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz" +wget $vips_site/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz +tar xf vips-$VIPS_VERSION.tar.gz +cd vips-$VIPS_VERSION +CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 ./configure --prefix=$HOME/vips --disable-debug --disable-dependency-tracking --disable-introspection --disable-static --enable-gtk-doc-html=no --enable-gtk-doc=no --enable-pyvips8=no --without-orc --without-python +make && make install + +# Install PHP extension +# ---------------------- +yes '' | pecl install vips diff --git a/includes/vendor/rosell-dk/webp-convert/.github/workflows/code-coverage.yml b/includes/vendor/rosell-dk/webp-convert/.github/workflows/code-coverage.yml new file mode 100644 index 0000000..ec773cf --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/.github/workflows/code-coverage.yml @@ -0,0 +1,61 @@ +name: Code Coverage + +on: workflow_dispatch + +jobs: + + codecov: + runs-on: ubuntu-20.04 + env: + WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} + WEBPCONVERT_WPC_API_URL: ${{ secrets.WEBPCONVERT_WPC_API_URL }} + WEBPCONVERT_WPC_API_KEY: ${{ secrets.WEBPCONVERT_WPC_API_KEY }} + WEBPCONVERT_WPC_API_URL_API0: ${{ secrets.WEBPCONVERT_WPC_API_URL_API0 }} + steps: + - name: Checkout + uses: actions/checkout@v2 + +# - name: Setup vips +# run: | +# chmod +x ./.github/install-vips.sh +# ./.github/install-vips.sh + + - name: Setup ffmpeg + uses: FedericoCarboni/setup-ffmpeg@v1 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + # Note: Currently, gmagick and imagick are mutually exclusive. + # It seems they are installed in the order indicated in "extensions" and the latter cancels the former + extensions: exif, mbstring, fileinfo, gd, vips, gmagick, imagick + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-codecov-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-codecov- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test-with-coverage + + - name: Upload Scrutinizer coverage + uses: sudo-bot/action-scrutinizer@latest + with: + cli-args: "--format=php-clover build/coverage.clover" diff --git a/includes/vendor/rosell-dk/webp-convert/.github/workflows/php-debug.yml b/includes/vendor/rosell-dk/webp-convert/.github/workflows/php-debug.yml new file mode 100644 index 0000000..551555d --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/.github/workflows/php-debug.yml @@ -0,0 +1,51 @@ +name: Debug + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + php73: + runs-on: ${{ matrix.os }} + env: + WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} + strategy: + fail-fast: true + matrix: + os: [macos-11] + php: [7.3] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: exif, mbstring, fileinfo, gd + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php73-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php73- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test diff --git a/includes/vendor/rosell-dk/webp-convert/.github/workflows/php.yml b/includes/vendor/rosell-dk/webp-convert/.github/workflows/php.yml index 6f49f1a..cfd3189 100644 --- a/includes/vendor/rosell-dk/webp-convert/.github/workflows/php.yml +++ b/includes/vendor/rosell-dk/webp-convert/.github/workflows/php.yml @@ -1,4 +1,4 @@ -name: PHP +name: build on: push: @@ -6,125 +6,126 @@ on: pull_request: branches: [ master ] -jobs: - php80: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.0' - extensions: exif, mbstring, fileinfo, gd +permissions: + contents: read - - name: Setup problem matchers for PHP - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" +jobs: + build: - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + runs-on: ${{ matrix.os }} + env: + WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} - - name: Validate composer.json and composer.lock - run: composer validate --strict + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest] + php: [8.1] - #- name: Downgrade PHP unit to a version that supports PHP 7.4 - # run: composer require "phpunit/phpunit:^8.0" --dev + steps: + - name: Checkout + uses: actions/checkout@v3 - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 + - name: Setup ffmpeg + uses: FedericoCarboni/setup-ffmpeg@v1 with: - path: vendor - key: ${{ runner.os }}-php80-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php80- + token: ${{ secrets.GITHUB_TOKEN }} - - name: Install dependencies - run: composer install --prefer-dist --no-progress + - name: Determine which version of xdebug to use + run: | + # Set XDEBUG to "xdebug2" for PHP 7.2-7.4, but to "xdebug" for + if grep -oP '^7.[234]' <<< "$PHP" > /dev/null; then XDEBUG=xdebug2; else XDEBUG=xdebug; fi - - name: Run test suite - run: composer run-script test + # Store XDEBUG in github env, so we can access it later through env.XDEBUG + echo "XDEBUG=$XDEBUG" >> $GITHUB_ENV - php74andcodecov: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 + echo "Result: ${{ env.XDEBUG }}" - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' - extensions: exif, mbstring, fileinfo, gd + php-version: ${{ matrix.php }} + coverage: ${{ env.XDEBUG }} + extensions: exif, mbstring, fileinfo, gd, vips, imagick, gmagick + + - name: Validate composer.json + run: composer validate --strict - - name: Setup problem matchers for PHP - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update - - name: Validate composer.json and composer.lock - run: composer validate --strict + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update - - name: Downgrade PHP unit to a version that supports PHP 7.4 - run: composer require "phpunit/phpunit:^8.0" --dev + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key, and for install + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install - name: Cache Composer packages id: composer-cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: vendor - key: ${{ runner.os }}-php74-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-php74- + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- - - name: Install dependencies + - name: Composer install run: composer install --prefer-dist --no-progress - - name: Run test suite + - name: Run phpunit (test cases) run: composer run-script test - - name: Upload Scrutinizer coverage - uses: sudo-bot/action-scrutinizer@latest - with: - cli-args: "--format=php-clover build/logs/coverage.clover" + #- name: Run phpstan on PHP>=7.2 (to check php syntax) + # if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + # run: composer run-script phpstan - php71: - runs-on: ubuntu-18.04 - steps: - - name: Checkout - uses: actions/checkout@v2 + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '7.1' - extensions: exif, mbstring, fileinfo, gd + - name: Create coverage badge json + run: | + # Extract total coverage + COVERAGE=$(grep -oP -m 1 'Lines:\s*\K[0-9.%]+' build/coverage.txt) - - name: Setup problem matchers for PHP - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + # Set COLOR based on COVERAGE + # 0-49%: red, 50%-69%: orange, 70%-80%: yellow, 90%-100%: brightgreen + if grep -oP '(^9\d.)|(^100.)' <<< "$COVERAGE" > /dev/null; then COLOR=brightgreen; elif grep -oP '[87]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=yellow; elif grep -oP '[65]\d.' <<< "$COVERAGE" > /dev/null; then COLOR=orange; else COLOR=red; fi; - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + # Generate bagde json + echo \{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"$COVERAGE\",\"color\":\"$COLOR\"\} | tee build/coverage-badge.json - - name: Validate composer.json and composer.lock - run: composer validate --strict + # PS: If we needed COVERAGE elsewhere, we could store in ENV like this: + # echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 + - name: Install SSH Key (for deployment of code coverage) + uses: shimataro/ssh-key-action@v2 with: - path: vendor - key: ${{ runner.os }}-php71-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php71- - - - name: Downgrade PHP unit to a version that supports PHP 7.1 - run: composer require "phpunit/phpunit:^7.0" --dev - - - name: Install dependencies - run: composer install --prefer-dist --no-progress - - - name: Run test suite - run: composer run-script test + key: ${{ secrets.DEPLOY_KEY }} + known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + + - name: Upload code coverage report + run: | + sh -c "rsync -rtog --chown :www-data $GITHUB_WORKSPACE/build/ $DEPLOY_DESTINATION --delete" + env: + DEPLOY_DESTINATION: ${{ secrets.DEPLOY_DESTINATION }} diff --git a/includes/vendor/rosell-dk/webp-convert/.github/workflows/release.yml b/includes/vendor/rosell-dk/webp-convert/.github/workflows/release.yml new file mode 100644 index 0000000..6847aba --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/.github/workflows/release.yml @@ -0,0 +1,186 @@ +name: Big test (trigger manually before releasing) + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + + runs-on: ${{ matrix.os }} + env: + WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} + #WEBPCONVERT_WPC_API_URL: ${{ secrets.WEBPCONVERT_WPC_API_URL }} + #WEBPCONVERT_WPC_API_KEY: ${{ secrets.WEBPCONVERT_WPC_API_KEY }} + #WEBPCONVERT_WPC_API_URL_API0: ${{ secrets.WEBPCONVERT_WPC_API_URL_API0 }} + + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, ubuntu-20.04, ubuntu-18.04, windows-2022, windows-2019, macos-11, macos-10.15] + php: [8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + #php: [8.1, 7.0] + #os: [windows-2022, macos-11] + #os: [windows-2022, windows-2019] + #os: [macos-11] + os: [macos-11, macos-10.15] + #os: [ubuntu-18.04] + #os: [ubuntu-18.04] + #os: [ubuntu-latest] + #os: [ubuntu-18.04,windows-2022, macos-11] + #php: [8.1] + + # For some reason PHP 7.0 testing fails on Windows, so we exclude + exclude: + - os: windows-2019 + php: 7.0 + - os: windows-2022 + php: 7.0 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup ffmpeg + uses: FedericoCarboni/setup-ffmpeg@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: exif, mbstring, fileinfo, gd, vips, imagick, gmagick + + - name: Validate composer.json + run: composer validate --strict + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Removing phpstan, as it does not work on PHP 7.1" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Remove phpstan, as it does not work on PHP 7.0" + composer remove phpstan/phpstan --dev --no-update + + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-${{ matrix.php }} + ${{ runner.os }}-php- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov + + - name: Run phpstan on PHP>=7.2 (to check php syntax) + if: (matrix.php != '7.0') && (matrix.php != '7.1') && (matrix.php != '7.2') + run: composer run-script phpstan + + - name: run phpcs (to check coding style) + run: composer run-script phpcs-all + + with_disabled_functions: + runs-on: ${{ matrix.os }} + env: + WEBPCONVERT_EWWW_API_KEY: ${{ secrets.WEBPCONVERT_EWWW_API_KEY }} + strategy: + fail-fast: true + matrix: + #os: [ubuntu-18.04,windows-2022, windows-2019, macos-11] + #php: [8.1, 7.1] + os: [ubuntu-18.04] + php: [8.1] + # unfortunately, proc_open is needed by phpunit, so we cannot disable proc_open + disabled_functions: ["exec", "exec,passthru,shell_exec,popen"] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup ffmpeg + uses: FedericoCarboni/setup-ffmpeg@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: exif, mbstring, fileinfo, gd, vips, imagick, gmagick + ini-values: disable_functions="${{ matrix.disabled_functions }}" + + - name: Validate composer.json + run: composer validate --strict + + - name: Remove PHP stan + run: | + echo "Removing phpstan, as we have PHP stan test in other tests" + composer remove phpstan/phpstan --dev --no-update + + - name: Composer alterations for PHP 7.2 + if: matrix.php == '7.2' + run: | + echo "Downgrading phpunit to ^8.0, which is the highest version that supports PHP 7.2" + composer require "phpunit/phpunit:^8.0" --dev --no-update + + - name: Composer alterations for PHP 7.1 + if: matrix.php == '7.1' + run: | + echo "Downgrading phpunit to ^7.0, which is the highest version that supports PHP 7.1" + composer require "phpunit/phpunit:^7.0" --dev --no-update + + - name: Composer alterations for PHP 7.0 + if: matrix.php == '7.0' + run: | + echo "Downgrading phpunit to ^6.0, which is the highest version that supports PHP 7.0" + composer require "phpunit/phpunit:^6.0" --dev --no-update + + # Create composer.lock, which is going to be used in the cache key + - name: Create composer.lock for cache key (this is a library, so composer.lock is not part of repo) + run: composer update --no-install + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-disabled-functions-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-disabled-functions-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + ${{ runner.os }}-php-disabled-functions-${{ matrix.php }} + ${{ runner.os }}-php-disabled-functions- + + - name: Composer install + run: composer install --prefer-dist --no-progress + + - name: Run phpunit (test cases) + run: composer run-script test-no-cov diff --git a/includes/vendor/rosell-dk/webp-convert/README.md b/includes/vendor/rosell-dk/webp-convert/README.md index 5cad7f8..b127f6e 100644 --- a/includes/vendor/rosell-dk/webp-convert/README.md +++ b/includes/vendor/rosell-dk/webp-convert/README.md @@ -1,11 +1,12 @@ # WebP Convert -[![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/webp-convert.svg?style=flat-square)](https://packagist.org/packages/rosell-dk/webp-convert) -[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net) -[![Build Status](https://travis-ci.org/rosell-dk/webp-convert.png?branch=master)](https://travis-ci.org/rosell-dk/webp-convert) -[![Coverage Status](https://img.shields.io/github/workflow/status/rosell-dk/webp-convert/PHP?logo=GitHub&style=flat-square)](https://github.com/rosell-dk/webp-convert/actions/workflows/php.yml) -[![Quality Score](https://img.shields.io/scrutinizer/g/rosell-dk/webp-convert.svg?style=flat-square)](https://scrutinizer-ci.com/g/rosell-dk/webp-convert/) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/rosell-dk/webp-convert/blob/master/LICENSE) +[![Latest Stable Version](https://img.shields.io/packagist/v/rosell-dk/webp-convert.svg)](https://packagist.org/packages/rosell-dk/webp-convert) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg)](https://php.net) +[![Build Status](https://img.shields.io/github/workflow/status/rosell-dk/webp-convert/PHP?logo=GitHub)](https://github.com/rosell-dk/webp-convert/actions/workflows/php.yml) +[![Coverage](https://img.shields.io/endpoint?url=https://little-b.it/webp-convert/code-coverage/coverage-badge.json)](http://little-b.it/webp-convert/code-coverage/coverage/index.html) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/rosell-dk/webp-convert/blob/master/LICENSE) +[![Monthly Downloads](http://poser.pugx.org/rosell-dk/webp-convert/d/monthly)](https://packagist.org/packages/rosell-dk/webp-convert) +[![Dependents](http://poser.pugx.org/rosell-dk/webp-convert/dependents)](https://packagist.org/packages/rosell-dk/webp-convert/dependents?order_by=downloads) *Convert JPEG & PNG to WebP with PHP* @@ -125,11 +126,12 @@ Bread on the table don't come for free, even though this library does, and alway - [Mathieu Gollain-Dupont](https://www.linkedin.com/in/mathieu-gollain-dupont-9938a4a/) - Ruben Solvang -*Persons who contributed with coffee within the last 30 days:* - -- Anon -- Eder Ribeiro -- Christian +*Persons who recently contributed with [ko-fi](https://ko-fi.com/rosell) - Thanks!* +* 3 Dec: Dallas +* 29 Nov: tadesco.org +* 20 Nov: Ben J +* 13 Nov: @sween +* 9 Nov: @utrenkner *Persons who contributed with extra generously amounts of coffee / lifetime backing (>50$) - thanks!:* @@ -139,6 +141,18 @@ Bread on the table don't come for free, even though this library does, and alway - Max Kreminsky ($65) - Steven Sullivan ($51) +## New in 2.9.0 (released 7 dec 2021, on my daughters 10 years birthday!) +- 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. +- 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 +- Improved CI tests. It is now tested on Windows, Mac and with deactivated functions (such as when exec() is disabled) +- And more (view closed issues [here](https://github.com/rosell-dk/webp-convert/milestone/25?closed=1) + +## New in 2.8.0: +- 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()` +- The part of the log that displays the options are made more readable. It also now warns about deprecated options. +- Bumped image-mime-type guesser library to 0.4. This version is able to dectect more mime types by sniffing the first couple of bytes. +- And more (view closed issues [here](https://github.com/rosell-dk/webp-convert/milestone/23?closed=1) + ## New in 2.7.0: - ImageMagick now supports the "near-lossless" option (provided Imagick >= 7.0.10-54) [#299](https://github.com/rosell-dk/webp-convert/issues/299) - Added "try-common-system-paths" option for ImageMagick (default: true). So ImageMagick will now peek for "convert" in common system paths [#293](https://github.com/rosell-dk/webp-convert/issues/293) diff --git a/includes/vendor/rosell-dk/webp-convert/composer.json b/includes/vendor/rosell-dk/webp-convert/composer.json index 757c497..1515bfe 100644 --- a/includes/vendor/rosell-dk/webp-convert/composer.json +++ b/includes/vendor/rosell-dk/webp-convert/composer.json @@ -11,17 +11,19 @@ "@composer validate --no-check-all --strict", "@phpstan-global" ], - "test": "phpunit --coverage-text", - "test-41": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'", "phpunit": "phpunit --coverage-text", - "test-no-cov": "phpunit --no-coverage", + "test": "phpunit --coverage-text=build/coverage.txt --coverage-clover=build/coverage.clover --coverage-html=build/coverage --whitelist=src tests", + "test-41": "phpunit --no-coverage --configuration 'phpunit-41.xml.dist'", + "test-with-coverage": "phpunit --coverage-text --configuration 'phpunit-with-coverage.xml.dist'", + "test-41-with-coverage": "phpunit --coverage-text --configuration 'phpunit-41.xml.dist'", + "test-no-cov": "phpunit --no-coverage tests", "cs-fix-all": [ "php-cs-fixer fix src" ], "cs-fix": "php-cs-fixer fix", "cs-dry": "php-cs-fixer fix --dry-run --diff", - "phpcs": "phpcs --standard=PSR2", - "phpcs-all": "phpcs --standard=PSR2 src", + "phpcs": "phpcs --standard=phpcs-ruleset.xml", + "phpcs-all": "phpcs --standard=phpcs-ruleset.xml src", "phpcbf": "phpcbf --standard=PSR2", "phpstan": "vendor/bin/phpstan analyse src --level=4", "phpstan-global-old": "~/.composer/vendor/bin/phpstan analyse src --level=4", @@ -56,8 +58,10 @@ } ], "require": { - "php": "^5.6 | ^7.0 | ^8.0", - "rosell-dk/image-mime-type-guesser": "^0.3" + "php": "^5.6 | ^7.0 | ^8.0", + "rosell-dk/exec-with-fallback": "^1.0.0", + "rosell-dk/image-mime-type-guesser": "^1.1.1", + "rosell-dk/locate-binaries": "^1.0" }, "suggest": { "ext-gd": "to use GD extension for converting. Note: Gd must be compiled with webp support", @@ -68,7 +72,8 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^2.11", "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "3.*" + "squizlabs/php_codesniffer": "3.*", + "phpstan/phpstan": "^1.5" }, "config": { "sort-packages": true diff --git a/includes/vendor/rosell-dk/webp-convert/docs/development.md b/includes/vendor/rosell-dk/webp-convert/docs/development.md index 236b624..2e56c49 100644 --- a/includes/vendor/rosell-dk/webp-convert/docs/development.md +++ b/includes/vendor/rosell-dk/webp-convert/docs/development.md @@ -72,7 +72,7 @@ Before committing, first make sure to: ## Releasing Before releasing: - Update the version number in `Converters/AbstractConverter.php` (search for "WebP Convert") -- Make sure that travis build is successful +- Make sure that ci build is successful When releasing: - update the [webp-convert-concat](https://github.com/rosell-dk/webp-convert-concat) library diff --git a/includes/vendor/rosell-dk/webp-convert/docs/v2.0/converting/introduction-for-converting.md b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/converting/introduction-for-converting.md index b1788e3..5958e3e 100644 --- a/includes/vendor/rosell-dk/webp-convert/docs/v2.0/converting/introduction-for-converting.md +++ b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/converting/introduction-for-converting.md @@ -108,17 +108,6 @@ The following low quality (q=50) jpeg weighs 54 kb. If this is converted to webp ![A low quality jpeg](https://raw.githubusercontent.com/rosell-dk/webp-convert/master/docs/v2.0/converting/architecture-q50-w600.jpg) -**Q:** What do you get if you convert an excessively high quality jpeg into an excessively high quality webp?\ -**A:** An excessively big file - -The size of a webp file grows enormously with the quality setting. For the web however, a quality above 75 is rarely needed. For this reason the library has a per default sets the quality to 75 for jpegs. - -So, how much can be gained? A lot! -The following excessively high quality jpeg (q=100) weighs 146 kb. Converting it to webp with quality=100 results in a 99kb image. Converting it to quality=85 results in a 40kb image. - -![A (too) high quality jpeg](https://raw.githubusercontent.com/rosell-dk/webp-convert/master/docs/v2.0/converting/mouse-q100.jpg) - - ### Auto selecting between lossless/lossy encoding WebP files can be encoded using either *lossless* or *lossy* encoding. The JPEG format is lossy and the PNG is lossless. However, this does not mean that you necessarily get the best conversion by always encoding JPEG to lossy and PNG to lossless. With JPEGs it is often the case, as they are usually pictures and pictures usually best encoded as lossy. With PNG it is however a different story, as you often can get a better compression using lossy encoding, also when using high quality level of say 85, which should be enough for the web. @@ -153,6 +142,17 @@ You can read more about the alpha-quality option [here](https://developers.googl ### Sharp YUV libwebp has an overlooked option which improves accuracy for RGB to YUV mapping at the price for longer conversion time. You can control it with the new 'sharp-yuv' option (introduced in webp-convert 2.6.0). Read an appraisal of the option [here](https://www.ctrl.blog/entry/webp-sharp-yuv.html). +### Tip: don't set quality too high... +**Q:** What do you get if you convert an excessively high quality jpeg into an excessively high quality webp?\ +**A:** An excessively big file + +The size of a webp file grows enormously with the quality setting. For the web however, a quality above 75 is rarely needed. For this reason the library has a per default sets the quality to 75 for jpegs. + +So, how much can be gained? A lot! +The following excessively high quality jpeg (q=100) weighs 146 kb. Converting it to webp with quality=100 results in a 99kb image. Converting it to quality=85 results in a 40kb image. + +![A (too) high quality jpeg](https://raw.githubusercontent.com/rosell-dk/webp-convert/master/docs/v2.0/converting/mouse-q100.jpg) + ### PNG og JPEG-specific options. To have options depending on the image type of the source, you can use the `png` and `jpeg` keys. diff --git a/includes/vendor/rosell-dk/webp-convert/docs/v2.0/converting/options.md b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/converting/options.md index bdfa816..4ff4292 100644 --- a/includes/vendor/rosell-dk/webp-convert/docs/v2.0/converting/options.md +++ b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/converting/options.md @@ -30,6 +30,14 @@ Supported by: all ``` Limits the quality to be no more than that of the jpeg. The option is only relevant when converting jpegs to lossy webp. To be functional, webp-convert needs to be able to detect the quality of the jpeg, which requires ImageMagick or GraphicsMagick. Read about the option in the [introduction](https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#auto-quality). In 2.7.0, it will become possible to adjust the limit with a new option. I'm currently debating with myself how this should work. Your comments and opinions would be appreciated - [here](https://github.com/rosell-dk/webp-convert/issues/289) +### `converter` (new in 2.8.0) +``` +Type: string +Default: null +Supported by: WebPConvert::convert method +``` +Simplifies using a specific converter. Before this option, you would either need to call the converter class (ie `Ewww::convert`) (not very flexible), or set the stack to contain just one converter (unnecessary overhead). If you do not use this option, `WebPConvert::convert` works as normal (it calls `Stack::convert`), if you do use it, it hands over the converting to the converter specified (specified by id, ie. "cwebp"). + ### `default-quality` (DEPRECATED) ``` Type: integer (0-100) @@ -375,6 +383,7 @@ Type: integer (0 - 1 - 2) Default: 2 Supported by: wpc ``` +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
### `wpc-crypt-api-key-in-transfer` diff --git a/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/cwebp.md b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/cwebp.md new file mode 100644 index 0000000..c749a08 --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/cwebp.md @@ -0,0 +1,3 @@ +# Installing cwebp using official precompilations + +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! diff --git a/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/ffmpeg.md b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/ffmpeg.md new file mode 100644 index 0000000..73cba30 --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/ffmpeg.md @@ -0,0 +1,15 @@ +# Installing FFMpeg +Its very easy. + + +# Ubuntu +Here is a tutorial for ubuntu: https://linuxize.com/post/how-to-install-ffmpeg-on-ubuntu-18-04/ + +## GitHub actions workflow +As easy as adding this step to your workflow yaml: + +```yaml +- name: Setup ffmpeg + uses: FedericoCarboni/setup-ffmpeg@v1 +``` +docs: https://github.com/marketplace/actions/setup-ffmpeg diff --git a/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gd.md b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gd.md new file mode 100644 index 0000000..4198175 --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gd.md @@ -0,0 +1,19 @@ +# Installing Gd extension with WebP support + +## Ubuntu 18.04 + +On Ubuntu 18.04, I did not have to do anything special to configure Gd for WebP support. The following worked right away: +``` +sudo apt-get install php7.2-gd +``` + +## Ubuntu 16.04 +The official page with installation instructions is [available here](http://il1.php.net/manual/en/image.installation.php) + +In summary: + +PHP 5.5.0: +To get WebP support for `gd` in PHP 5.5.0, PHP must be configured with the `--with-vpx-dir` flag. + +PHP >7.0.0: +PHP has to be configured with the `--with-webp-dir` flag diff --git a/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gmagick-extension.md b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gmagick-extension.md new file mode 100644 index 0000000..ea1ee9d --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/gmagick-extension.md @@ -0,0 +1,40 @@ +# Installing GMagick PHP extension with WebP support + +See: +https://github.com/rosell-dk/webp-convert/issues/37 + +## MX-19.4 +I succeeded by simply doing the following after installing graphicsmagick, libwebp and libwebp-dev: +``` +sudo apt install php-gmagick +sudo service apache2 restart +``` +Note: For some reason this disables the imagick extension. It seems they cannot both be installed at the same time. + + +## Ubuntu 18.04, using *PECL* +In Ubuntu 18.04, you will not have to do any special steps in order to compile with webp :) + +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();` +2. Find out which is the latest version of *gmagick* on pecl. https://pecl.php.net/package/gmagick +3. Do the following - but alter to use the info you just collected + +``` +sudo apt-get update +sudo apt-get install graphicsmagick gcc libgraphicsmagick1-dev php-pear php7.2-dev +sudo pecl install gmagick-2.0.5RC1 +sudo echo "extension=gmagick.so" >> /etc/php/7.2/apache2/php.ini +sudo service apache2 restart +``` + +Notes: +- The php-pear contains *pecl*. +- *php7.2-dev* provides *phpize*, which is needed by pecl. Use *php7.1-dev*, if you are on PHP 7.1 +- 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. +- If you are on *fpm*, remember to restart that as well (ie `sudo service php7.2-fpm restart`) + +## Plesk +https://support.plesk.com/hc/en-us/articles/115003511013-How-to-install-Gmagick-PHP-extension-on-Ubuntu-Debian- + +## From source +https://duntuk.com/how-install-graphicsmagick-gmagick-php-extension diff --git a/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/imagick-extension.md b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/imagick-extension.md new file mode 100644 index 0000000..9453be8 --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/imagick-extension.md @@ -0,0 +1,80 @@ +# Installing Imagick extension with WebP support + +## MX-19.4 +I succeeded by simply doing the following after installing imagemagick, libwebp and libwebp-dev: +``` +sudo apt install php-imagick +sudo service apache2 restart +``` + +## Ubuntu 16.04 +In order to get imagick with WebP on Ubuntu 16.04, you (currently) need to: +1. [Compile libwebp from source](https://developers.google.com/speed/webp/docs/compiling) +2. [Compile imagemagick from source](https://www.imagemagick.org/script/install-source.php) (```./configure --with-webp=yes```) +3. Compile php-imagick from source, phpize it and add ```extension=/path/to/imagick.so``` to php.ini + +## Ubuntu 18.04 (from source) +A simple `sudo apt-get install php-imagick` unfortunately does not give you webp support. +Again, you must: + +### 1. Compile libwebp from source +Instructions are [here](https://developers.google.com/speed/webp/docs/compiling). +In short, you need to: +``` +sudo apt-get install libjpeg-dev libpng-dev +wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.1.0.tar.gz +tar xvzf libwebp-1.1.0.tar.gz +cd into the dir +./configure +make +sudo make install +``` + +### 2. Compile *imagemagick* from source, configured with *webp* +See tutorial [here](https://linuxconfig.org/how-to-install-imagemagick-7-on-ubuntu-18-04-linux), but configure with *webp* (`./configure --with-webp=yes`) + +``` +sudo apt-get update +sudo apt build-dep imagemagick +wget https://imagemagick.org/download/ImageMagick.tar.gz +tar xvzf ImageMagick.tar.gz +cd into the dir +./configure --with-webp=yes +sudo make +sudo make install +sudo ldconfig /usr/local/lib +sudo identify -version # to check if installed ok +make check # optional run in-depth check +``` +Check it this way: `identify -list format | grep WEBP` +- It should print a line + +### 3a. Install extension with pecl +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): + +``` +sudo apt-get update +sudo apt-get install imagemagick gcc libmagickwand-dev php-pear php7.2-dev +sudo pecl install imagick +sudo echo "extension=imagick.so" >> /etc/php/7.2/apache2/php.ini +sudo service apache2 restart +``` +Related: +https://askubuntu.com/questions/769396/how-to-install-imagemagick-for-php7-on-ubuntu-16-04 + + +### 3b. Alternively to using pecl, compile php-imagick from source +https://github.com/mkoppanen/imagick +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): + +``` +wget https://pecl.php.net/get/imagick-3.4.3.tgz +tar xvzf imagick-3.4.3.tgz +cd into the dir +sudo /usr/bin/phpize7.2 # note: find you version of phpize with locate phpize +./configure +make +make install +sudo echo "extension=imagick.so" >> /etc/php/7.2/apache2/php.ini +sudo service apache2 restart +``` diff --git a/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/vips.md b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/vips.md new file mode 100644 index 0000000..e7353a0 --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/docs/v2.0/installing-converters/vips.md @@ -0,0 +1,35 @@ +# Installing vips extension + +### Step 1: Install the vips library +Follow the instructions on the [vips library github page](https://github.com/libvips/libvips/) + +Don't forget to install required packages before running `./configure`: +``` +sudo apt-get install libglib2.0-dev pkg-config build-essential libexpat1-dev libjpeg-dev libpng-dev libwebp-dev gobject-introspection libgs-dev +``` + +### Step 2: Install the vips extension + +``` +sudo pecl install vips +``` +– And add the following to the relevant php.ini: +``` +extension=vips +``` + +(or `extension=vips.so` if you are in older PHP) + +The vips extension is btw [also on github](https://github.com/libvips/php-vips-ext): + + +## GitHub actions workflow +As easy as adding "vips" to the extensions for `setup-php@v2`: + +```yaml +- name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + extensions: vips +``` diff --git a/includes/vendor/rosell-dk/webp-convert/phpcs-ruleset.xml b/includes/vendor/rosell-dk/webp-convert/phpcs-ruleset.xml new file mode 100644 index 0000000..37d5689 --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/phpcs-ruleset.xml @@ -0,0 +1,8 @@ + + + PSR2 without line ending rule - let git manage the EOL cross the platforms + + + + + diff --git a/includes/vendor/rosell-dk/webp-convert/phpunit-with-coverage.xml.dist b/includes/vendor/rosell-dk/webp-convert/phpunit-with-coverage.xml.dist new file mode 100644 index 0000000..15c9673 --- /dev/null +++ b/includes/vendor/rosell-dk/webp-convert/phpunit-with-coverage.xml.dist @@ -0,0 +1,25 @@ + + + + + src/ + + + ./vendor + ./tests + + + + + + + + + + ./tests/ + + + + + + diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php index 13bb226..d11284b 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/AbstractConverter.php @@ -120,14 +120,19 @@ final public function __construct($source = '', $destination = '', $options = [] $this->setProvidedOptions($options); if (!isset($this->options['_skip_input_check'])) { - $this->log('WebP Convert 2.7.0', 'italic'); - $this->logLn(' ignited.'); - $this->logLn('- PHP version: ' . phpversion()); + $this->logLn('WebP Convert 2.9.0 ignited', 'bold'); + $this->logLn('PHP version: ' . phpversion()); if (isset($_SERVER['SERVER_SOFTWARE'])) { - $this->logLn('- Server software: ' . $_SERVER['SERVER_SOFTWARE']); + $this->logLn('Server software: ' . $_SERVER['SERVER_SOFTWARE']); } $this->logLn(''); - $this->logLn(self::getConverterDisplayName() . ' converter ignited'); + if (isset($this->options['log-call-arguments']) && $this->options['log-call-arguments']) { + $this->logLn('source: ' . $this->source); + $this->logLn('destination: ' . $this->destination); + $this->logLn(''); + } + + $this->logLn(self::getConverterDisplayName() . ' converter ignited', 'bold'); } } @@ -277,7 +282,7 @@ private function doConvertImplementation() /** * Start conversion. * - * Usually you would rather call the static convert method, but alternatively you can call + * Usually it would be more convenience to call the static convert method, but alternatively you can call * call ::createInstance to get an instance and then ::doConvert(). * * @return void @@ -301,14 +306,12 @@ public function doConvert() throw $e; } catch (\Exception $e) { $className = get_class($e); - $classNameParts = explode("\\", $className); $shortClassName = array_pop($classNameParts); $this->logLn(''); $this->logLn($shortClassName . ' thrown in ' . $e->getFile() . ':' . $e->getLine(), 'bold'); $this->logLn('Message: "' . $e->getMessage() . '"', 'bold'); - //$this->logLn('Exception class: ' . $className); $this->logLn('Trace:'); foreach ($e->getTrace() as $trace) { @@ -320,9 +323,16 @@ public function doConvert() } } throw $e; - } /*catch (\Error $e) { - $this->logLn('ERROR'); - }*/ + } catch (\Throwable $e) { + $className = get_class($e); + $classNameParts = explode("\\", $className); + $shortClassName = array_pop($classNameParts); + + $this->logLn(''); + $this->logLn($shortClassName . ' thrown in ' . $e->getFile() . ':' . $e->getLine(), 'bold'); + $this->logLn('Message: "' . $e->getMessage() . '"', 'bold'); + throw $e; + } } /** diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php index a4ef539..71eee64 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/AutoQualityTrait.php @@ -101,6 +101,7 @@ private function processQualityOption() becomes: quality: 80, auto-limit: false */ $q = $options['quality']; + $useDeprecatedDefaultQuality = false; if ($q == 'auto') { $q = $options['quality'] = $options['max-quality']; $this->logLn( @@ -120,6 +121,7 @@ private function processQualityOption() '*PS: "auto-limit" is set to false, as it was set explicitly to false in the options."*' ); } + $useDeprecatedDefaultQuality = true; } if ($options['auto-limit']) { @@ -130,11 +132,21 @@ private function processQualityOption() ); $q = JpegQualityDetector::detectQualityOfJpg($source); if (is_null($q)) { - $q = $options['quality']; $this->/** @scrutinizer ignore-call */logLn( 'Quality of source image could not be established (Imagick or GraphicsMagick is required). ' . - 'Sorry, no auto-limit functionality for you. Using supplied quality (' . $q . ').' + 'Sorry, no auto-limit functionality for you. ' ); + if ($useDeprecatedDefaultQuality) { + $q = $options['default-quality']; + $this->/** @scrutinizer ignore-call */logLn( + 'Using default-quality (' . $q . ').' + ); + } else { + $q = $options['quality']; + $this->/** @scrutinizer ignore-call */logLn( + 'Using supplied quality (' . $q . ').' + ); + } $this->qualityCouldNotBeDetected = true; } else { diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/LoggerTrait.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/LoggerTrait.php index c6c45f5..79329fe 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/LoggerTrait.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/LoggerTrait.php @@ -15,7 +15,7 @@ trait LoggerTrait { - /** @var \WebPConvert\Loggers\BaseLogger The logger (or null if not set) */ + /** @var \WebPConvert\Loggers\BaseLogger|null The logger (or null if not set) */ protected $logger; /** diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/OptionsTrait.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/OptionsTrait.php index 02f24b0..2606f44 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/OptionsTrait.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/OptionsTrait.php @@ -77,7 +77,9 @@ public function getGeneralOptions($imageType) ]], ['quality', 'int', [ 'title' => 'Quality (Lossy)', - 'description' => 'Quality for lossy encoding. ', + 'description' => + 'Quality for lossy encoding. ' . + 'In case you enable "auto-limit", you can consider this property a maximum quality.', 'default' => ($isPng ? 85 : 75), 'default-png' => 85, 'default-jpeg' => 75, @@ -89,14 +91,23 @@ public function getGeneralOptions($imageType) ], 'ui' => [ 'component' => 'slider', - 'display' => "option.encoding != 'lossless'" + 'display' => "option('encoding') != 'lossless'" ] ]], ['auto-limit', 'boolean', [ 'title' => 'Auto-limit', 'description' => 'Enable this option to prevent an unnecessarily high quality setting for low ' . - 'quality jpegs. You really should enable this.', + 'quality jpegs. It works by adjusting quality setting down to the quality of the jpeg. ' . + 'Converting ie a jpeg with quality:50 to ie quality:80 does not get you better quality ' . + 'than converting it to quality:80, but it does get you a much bigger file - so you ' . + 'really should enable this option.' . "\n\n" . + 'The option is ignored for PNG and never adjusts quality up. ' . "\n\n" . + 'The feature requires Imagick, ImageMagick or Gmagick in order to detect the quality of ' . + 'the jpeg. ' . "\n\n" . + 'PS: The "auto-limit" option is relative new. However, before this option, you could achieve ' . + 'the same by setting quality to "auto" and specifying a "max-quality" and a "default-quality". ' . + 'These are deprecated now, but still works.', 'default' => true, 'ui' => [ 'component' => 'checkbox', @@ -107,7 +118,7 @@ public function getGeneralOptions($imageType) $introMd . '#preventing-unnecessarily-high-quality-setting-for-low-quality-jpegs' ] ], - 'display' => "option.encoding != 'lossless'" + 'display' => "option('encoding') != 'lossless'" ] ]], ['alpha-quality', 'int', [ @@ -123,7 +134,7 @@ public function getGeneralOptions($imageType) 'ui' => [ 'component' => 'slider', 'links' => [['Guide', $introMd . '#alpha-quality']], - 'display' => "(option.encoding != 'lossless') && (imageType!='jpeg')" + 'display' => "(option('encoding') != 'lossless') && (imageType!='jpeg')" ] ]], ['near-lossless', 'int', [ @@ -138,7 +149,7 @@ public function getGeneralOptions($imageType) 'ui' => [ 'component' => 'slider', 'links' => [['Guide', $introMd . '#near-lossless']], - 'display' => "option.encoding != 'lossy'" + 'display' => "option('encoding') != 'lossy'" ] ]], ['metadata', 'string', [ @@ -195,8 +206,8 @@ public function getGeneralOptions($imageType) '2 seconds to convert, will takes about 15 seconds to convert with auto-filter. ', 'default' => false, 'ui' => [ - 'component' => 'checkbox', - 'advanced' => true, + 'component' => 'checkbox', + 'advanced' => true, ] ]], ['low-memory', 'boolean', [ @@ -209,7 +220,7 @@ public function getGeneralOptions($imageType) 'ui' => [ 'component' => 'checkbox', 'advanced' => true, - 'display' => "(option.encoding != 'lossless') && (option.method>2)" + 'display' => "(option('encoding') != 'lossless') && (option('method')>2)" ] ]], ['preset', 'string', [ @@ -219,17 +230,17 @@ public function getGeneralOptions($imageType) 'source material. It even overrides them. It does however not override the quality option. ' . '"none" means that no preset will be set', 'default' => 'none', - 'enum' => ['none', 'default', 'photo', 'picture', 'drawing', 'icon', 'text']], + 'enum' => ['none', 'default', 'photo', 'picture', 'drawing', 'icon', 'text'], 'ui' => [ 'component' => 'select', 'advanced' => true, ] - ], + ]], ['size-in-percentage', 'int', ['default' => null, 'minimum' => 0, 'maximum' => 100, 'allow-null' => true]], ['skip', 'boolean', ['default' => false]], ['log-call-arguments', 'boolean', ['default' => false]], // TODO: use-nice should not be a "general" option - ['use-nice', 'boolean', ['default' => false]], + //['use-nice', 'boolean', ['default' => false]], ['jpeg', 'array', ['default' => []]], ['png', 'array', ['default' => []]], @@ -244,43 +255,6 @@ public function getGeneralOptions($imageType) ]); } - /** - * Get ui definitions for the general options. - * - * You can automatically build a gui with these (suggested) components - * - * @param string $imageType (png | jpeg) The image type - determines the defaults - * - * @return array Hash of ui definitions indexed by option id - */ - public function getUIForGeneralOptions($imageType) - { - return [ - /* - ['preset', 'string', [ - 'default' => 'none', - 'enum' => ['none', 'default', 'photo', 'picture', 'drawing', 'icon', 'text']] - ], -*/ - /* { - "id": "metadata", - "type": "string", - "default": 'exif', - "ui": { - "component": "multi-select", - "label": "Metadata", - "options": ['all', 'none', 'exif', 'icc', 'xmp'], - "optionLabels": { - 'all': 'All', - 'none': 'None', - 'exif': 'Exif', - 'icc': 'ICC', - 'xmp': 'XMP' - } - },*/ - ]; - } - /** * Get the unique options for a converter * @@ -349,6 +323,7 @@ public function setProvidedOptions($providedOptions = []) foreach ($this->providedOptions as $optionKey => $optionValue) { if (substr($optionKey, 0, $strLen + 1) == ($converterId . '-')) { $this->providedOptions[substr($optionKey, $strLen + 1)] = $optionValue; + unset($this->providedOptions[$optionKey]); } } @@ -427,74 +402,73 @@ public function logOptions() $this->logLn(''); $this->logLn('Options:'); $this->logLn('------------'); - $this->logLn( - 'The following options have been set explicitly. ' . - 'Note: it is the resulting options after merging down the "jpeg" and "png" options and any ' . - 'converter-prefixed options.' - ); - $this->logLn('- source: ' . $this->source); - $this->logLn('- destination: ' . $this->destination); $unsupported = $this->getUnsupportedDefaultOptions(); - //$this->logLn('Unsupported:' . print_r($this->getUnsupportedDefaultOptions(), true)); - $ignored = []; - $implicit = []; + $received = []; + $implicitlySet = []; foreach ($this->options2->getOptionsMap() as $id => $option) { - if (($id == 'png') || ($id == 'jpeg')) { + if (in_array($id, [ + 'png', 'jpeg', '_skip_input_check', '_suppress_success_message', 'skip', 'log_call_arguments' + ])) { continue; } if ($option->isValueExplicitlySet()) { + $received[] = $option; + } else { if (($option instanceof GhostOption) || in_array($id, $unsupported)) { - //$this->log(' (note: this option is ignored by this converter)'); - if (($id != '_skip_input_check') && ($id != '_suppress_success_message')) { - $ignored[] = $option; - } + //$received[] = $option; } else { - $this->log('- ' . $id . ': '); - $this->log($option->getValueForPrint()); + if (!$option->isDeprecated()) { + $implicitlySet[] = $option; + } + } + } + } + + if (count($received) > 0) { + foreach ($received as $option) { + $this->log('- ' . $option->getId() . ': '); + if ($option instanceof GhostOption) { + $this->log(' (unknown to ' . $this->getConverterId() . ')', 'bold'); $this->logLn(''); + continue; } - } else { - if (($option instanceof GhostOption) || in_array($id, $unsupported)) { - } else { - $implicit[] = $option; + $this->log($option->getValueForPrint()); + if ($option->isDeprecated()) { + $this->log(' (deprecated)', 'bold'); } + if (in_array($option->getId(), $unsupported)) { + if ($this instanceof Stack) { + //$this->log(' *(passed on)*'); + } else { + $this->log(' (unsupported by ' . $this->getConverterId() . ')', 'bold'); + } + } + $this->logLn(''); } + $this->logLn(''); + $this->logLn( + 'Note that these are the resulting options after merging down the "jpeg" and "png" options and any ' . + 'converter-prefixed options' + ); } - if (count($implicit) > 0) { + if (count($implicitlySet) > 0) { $this->logLn(''); + $this->logLn('Defaults:'); + $this->logLn('------------'); $this->logLn( - 'The following options have not been explicitly set, so using the following defaults:' + 'The following options was not set, so using the following defaults:' ); - foreach ($implicit as $option) { + foreach ($implicitlySet as $option) { $this->log('- ' . $option->getId() . ': '); $this->log($option->getValueForPrint()); + /*if ($option instanceof GhostOption) { + $this->log(' **(ghost)**'); + }*/ $this->logLn(''); } } - if (count($ignored) > 0) { - $this->logLn(''); - if ($this instanceof Stack) { - $this->logLn( - 'The following options were supplied and are passed on to the converters in the stack:' - ); - foreach ($ignored as $option) { - $this->log('- ' . $option->getId() . ': '); - $this->log($option->getValueForPrint()); - $this->logLn(''); - } - } else { - $this->logLn( - 'The following options were supplied but are ignored because they are not supported by this ' . - 'converter:' - ); - foreach ($ignored as $option) { - $this->logLn('- ' . $option->getId()); - } - } - } - $this->logLn('------------'); } // to be overridden by converters @@ -509,40 +483,60 @@ public function getUnsupportedGeneralOptions() } /** - * Get unique option definitions. - * - * Gets definitions of the converters "unique" options (that is, those options that - * are not general). It was added in order to give GUI's a way to automatically adjust - * their setting screens. - * - * @param string $imageType (png | jpeg) The image type - determines the defaults - * - * @return array Array of options definitions - ready to be json encoded, or whatever - */ - public function getUniqueOptionDefinitions($imageType = 'png') + * Get unique option definitions. + * + * Gets definitions of the converters "unique" options (that is, those options that + * are not general). It was added in order to give GUI's a way to automatically adjust + * their setting screens. + * + * @param bool $filterOutOptionsWithoutUI If options without UI defined should be filtered out + * @param string $imageType (png | jpeg) The image type - determines the defaults + * + * @return array Array of options definitions - ready to be json encoded, or whatever + */ + public function getUniqueOptionDefinitions($filterOutOptionsWithoutUI = true, $imageType = 'jpeg') { $uniqueOptions = new Options(); - $uniqueOptions->addOptions(... $this->getUniqueOptions($imageType)); - //$uniqueOptions->setUI($this->getUniqueOptionsUI($imageType)); - return $uniqueOptions->getDefinitions(); + //$uniqueOptions->addOptions(... $this->getUniqueOptions($imageType)); + foreach ($this->getUniqueOptions($imageType) as $uoption) { + $uoption->setId(self::getConverterId() . '-' . $uoption->getId()); + $uniqueOptions->addOption($uoption); + } + + $optionDefinitions = $uniqueOptions->getDefinitions(); + if ($filterOutOptionsWithoutUI) { + $optionDefinitions = array_filter($optionDefinitions, function ($value) { + return !is_null($value['ui']); + }); + $optionDefinitions = array_values($optionDefinitions); // re-index + } + return $optionDefinitions; } /** - * Get general option definitions. + * Get general option definitions. * - * Gets definitions of all general options (not just the ones supported by current converter) - * For UI's, as a way to automatically adjust their setting screens. + * Gets definitions of all general options (not just the ones supported by current converter) + * For UI's, as a way to automatically adjust their setting screens. * - * @param string $imageType (png | jpeg) The image type - determines the defaults + * @param bool $filterOutOptionsWithoutUI If options without UI defined should be filtered out + * @param string $imageType (png | jpeg) The image type - determines the defaults * - * @return array Array of options definitions - ready to be json encoded, or whatever + * @return array Array of options definitions - ready to be json encoded, or whatever */ - public function getGeneralOptionDefinitions($imageType = 'png') + public function getGeneralOptionDefinitions($filterOutOptionsWithoutUI = true, $imageType = 'jpeg') { $generalOptions = new Options(); $generalOptions->addOptions(... $this->getGeneralOptions($imageType)); //$generalOptions->setUI($this->getUIForGeneralOptions($imageType)); - return $generalOptions->getDefinitions(); + $optionDefinitions = $generalOptions->getDefinitions(); + if ($filterOutOptionsWithoutUI) { + $optionDefinitions = array_filter($optionDefinitions, function ($value) { + return !is_null($value['ui']); + }); + $optionDefinitions = array_values($optionDefinitions); // re-index + } + return $optionDefinitions; } public function getSupportedGeneralOptions($imageType = 'png') @@ -584,40 +578,4 @@ public function getSupportedGeneralOptionIds() } return $supportedGeneralIds; } - - /** - * Get option definitions. - * - * Added in order to give GUI's a way to automatically adjust their setting screens. - * - * @param string $imageType (png | jpeg) The image type - determines the defaults - * @param bool $returnGeneral Whether the general setting definitions should be returned - * @param bool $returnGeneralSupport Whether the ids of supported/unsupported general options - * should be returned - * - * @return array Array of options definitions - ready to be json encoded, or whatever - */ - public function getOptionDefinitions($imageType = 'png', $returnGeneral = true, $returnGeneralSupport = true) - { - $result = [ - 'unique' => $this->getUniqueOptionDefinitions($imageType), - ]; - if ($returnGeneral) { - $result['general'] = $this->getSupportedGeneralOptionDefinitions($imageType); - } - if ($returnGeneralSupport) { - $result['supported-general'] = $this->getSupportedGeneralOptionIds(); - $result['unsupported-general'] = $this->getUnsupportedDefaultOptions(); - } - return $result; - } -/* - public static function getUniqueOptions($imageType = 'png') - { - $options = new Options(); -// $options->addOptions(... self::getGeneralOptions($imageType)); -// $options->addOptions(... self::getUniqueOptions($imageType)); - - return $options->getDefinitions(); - }*/ } diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-103-linux-x86-64 b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-103-linux-x86-64 deleted file mode 100644 index 98cc1ac..0000000 Binary files a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-103-linux-x86-64 and /dev/null differ diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-103-mac-10_14 b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-103-mac-10_14 deleted file mode 100644 index 9a928e5..0000000 Binary files a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-103-mac-10_14 and /dev/null differ diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php index 35f0f14..aa6c856 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/ConverterTraits/ExecTrait.php @@ -3,9 +3,10 @@ namespace WebPConvert\Convert\Converters\ConverterTraits; use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException; +use ExecWithFallback\ExecWithFallback; /** - * Trait for converters that uses exec() + * Trait for converters that uses exec() or similar * * @package WebPConvert * @author Bjørn Rosell @@ -16,6 +17,7 @@ trait ExecTrait abstract protected function logLn($msg, $style = ''); + /** * Helper function for examining if "nice" command is available * @@ -23,7 +25,7 @@ abstract protected function logLn($msg, $style = ''); */ protected static function hasNiceSupport() { - exec("nice 2>&1", $niceOutput); + ExecWithFallback::exec("nice 2>&1", $niceOutput); if (is_array($niceOutput) && isset($niceOutput[0])) { if (preg_match('/usage/', $niceOutput[0]) || (preg_match('/^\d+$/', $niceOutput[0]))) { @@ -40,6 +42,35 @@ protected static function hasNiceSupport() return false; // to satisfy phpstan } + protected function checkNiceSupport() + { + $ok = self::hasNiceSupport(); + if ($ok) { + $this->logLn('Tested "nice" command - it works :)'); + } else { + $this->logLn( + '**No "nice" support. To save a few ms, you can disable the "use-nice" option.**' + ); + } + return $ok; + } + + protected static function niceOption() + { + return ['use-nice', 'boolean', [ + 'title' => 'Use nice', + 'description' => + 'If *use-nice* is set, it will be examined if the *nice* command is available. ' . + 'If it is, the binary is executed using *nice*. This assigns low priority to the process and ' . + 'will save system resources - but result in slower conversion.', + 'default' => true, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true + ] + ]]; + } + /** * Logs output from the exec call. * @@ -60,15 +91,17 @@ protected function logExecOutput($output) } /** - * Check basic operationality of exec converters (that the "exec" function is available) + * Check basic operationality of exec converters (that the "exec" or similar function is available) * * @throws WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException * @return void */ public function checkOperationalityExecTrait() { - if (!function_exists('exec')) { - throw new SystemRequirementsNotMetException('exec() is not enabled.'); + if (!ExecWithFallback::anyAvailable()) { + throw new SystemRequirementsNotMetException( + 'exec() is not enabled (nor is alternative methods, such as proc_open())' + ); } } } diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php index b962675..03e293b 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php @@ -2,6 +2,9 @@ namespace WebPConvert\Convert\Converters; +use ExecWithFallback\ExecWithFallback; +use LocateBinaries\LocateBinaries; + use WebPConvert\Convert\Converters\AbstractConverter; use WebPConvert\Convert\Converters\BaseTraits\WarningLoggerTrait; use WebPConvert\Convert\Converters\ConverterTraits\EncodingAutoTrait; @@ -9,7 +12,6 @@ use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException; use WebPConvert\Convert\Exceptions\ConversionFailedException; use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperationalException; -use WebPConvert\Helpers\BinaryDiscovery; use WebPConvert\Options\OptionFactory; /** @@ -45,6 +47,7 @@ public function getUniqueOptions($imageType) } return OptionFactory::createOptions([ + self::niceOption(), ['try-cwebp', 'boolean', [ 'title' => 'Try plain cwebp command', 'description' => @@ -110,7 +113,7 @@ public function getUniqueOptions($imageType) 'component' => 'multi-select', 'advanced' => true, 'options' => $binariesForOS, - 'display' => "notEquals(state('option', 'try-supplied-binary-for-os'), false)" + 'display' => "option('cwebp-try-supplied-binary-for-os') == true" ] ]], @@ -122,7 +125,7 @@ public function getUniqueOptions($imageType) 'ui' => [ 'component' => '', 'advanced' => true, - 'display' => "option['try-supplied-binary-for-os'] == true" + 'display' => "option('cwebp-try-supplied-binary-for-os') == true" ], 'sensitive' => true ]], @@ -247,7 +250,7 @@ private function executeBinary($binary, $commandOptions, $useNice) $startExecuteBinaryTime = self::startTimer(); ; $this->logLn($command); - exec($command, $output, $returnCode); + ExecWithFallback::exec($command, $output, $returnCode); $this->logExecOutput($output); $this->logTimeSpent($startExecuteBinaryTime, 'Executing cwebp binary took: '); $this->logLn(''); @@ -554,7 +557,7 @@ private function getSuppliedBinaryInfoForCurrentOS() private function who() { - exec('whoami 2>&1', $whoOutput, $whoReturnCode); + ExecWithFallback::exec('whoami 2>&1', $whoOutput, $whoReturnCode); if (($whoReturnCode == 0) && (isset($whoOutput[0]))) { return 'user: "' . $whoOutput[0] . '"'; } else { @@ -573,7 +576,7 @@ private function detectVersion($binary) { $command = $binary . ' -version 2>&1'; $this->log('- Executing: ' . $command); - exec($command, $output, $returnCode); + ExecWithFallback::exec($command, $output, $returnCode); if ($returnCode == 0) { if (isset($output[0])) { @@ -711,13 +714,13 @@ private function discoverCwebpBinaries() if (defined('WEBPCONVERT_CWEBP_PATH')) { $this->logLn('WEBPCONVERT_CWEBP_PATH was defined, so using that path and ignoring any other'); - return [constant('WEBPCONVERT_CWEBP_PATH')]; + return [[constant('WEBPCONVERT_CWEBP_PATH')],[[], []]]; } if (!empty(getenv('WEBPCONVERT_CWEBP_PATH'))) { $this->logLn( 'WEBPCONVERT_CWEBP_PATH environment variable was set, so using that path and ignoring any other' ); - return [getenv('WEBPCONVERT_CWEBP_PATH')]; + return [[getenv('WEBPCONVERT_CWEBP_PATH')],[[], []]]; } if ($this->options['try-cwebp']) { @@ -744,7 +747,7 @@ private function discoverCwebpBinaries() $startTime = self::startTimer(); $this->logDiscoverAction('try-discovering-cwebp', 'using "which -a cwebp" command.'); if ($this->options['try-discovering-cwebp']) { - $moreBinaries = BinaryDiscovery::discoverInstalledBinaries('cwebp'); + $moreBinaries = LocateBinaries::locateInstalledBinaries('cwebp'); $this->logBinariesFound($moreBinaries, $startTime); $binaries = array_merge($binaries, $moreBinaries); } @@ -753,7 +756,7 @@ private function discoverCwebpBinaries() $startTime = self::startTimer(); $this->logDiscoverAction('try-common-system-paths', 'by peeking in common system paths'); if ($this->options['try-common-system-paths']) { - $moreBinaries = BinaryDiscovery::discoverInCommonSystemPaths('cwebp'); + $moreBinaries = LocateBinaries::locateInCommonSystemPaths('cwebp'); $this->logBinariesFound($moreBinaries, $startTime); $binaries = array_merge($binaries, $moreBinaries); } @@ -938,7 +941,8 @@ protected function doActualConvert() 'Starting conversion, using the first of these. If that should fail, ' . 'the next will be tried and so on.' ); - $useNice = (($this->options['use-nice']) && self::hasNiceSupport()); + $useNice = ($this->options['use-nice'] && $this->checkNiceSupport()); + $success = false; foreach ($binaryVersions as $binary => $version) { if (isset($suppliedBinariesHash[$binary])) { diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Ewww.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Ewww.php index 99c996c..2fc885a 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Ewww.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Ewww.php @@ -25,7 +25,7 @@ class Ewww extends AbstractConverter use CloudConverterTrait; use CurlTrait; - /** @var array Array of invalid or exceeded api keys discovered during conversions (during the request) */ + /** @var array|null Array of invalid or exceeded api keys discovered during conversions (during the request) */ public static $nonFunctionalApiKeysDiscoveredDuringConversion; public function getUniqueOptions($imageType) @@ -39,7 +39,7 @@ public function getUniqueOptions($imageType) 'default' => '', 'sensitive' => true, 'ui' => [ - 'component' => 'input', + 'component' => 'password', ] ]], ['check-key-status-before-converting', 'boolean', [ @@ -70,7 +70,6 @@ protected function getUnsupportedDefaultOptions() 'preset', 'sharp-yuv', 'size-in-percentage', - 'use-nice' ]; } @@ -347,7 +346,11 @@ public static function getKeyStatus($key) if ($responseObj->error == 'invalid') { return 'invalid'; } else { - throw new \Exception('Ewww returned unexpected error: ' . $response); + if ($responseObj->error == 'bye invalid') { + return 'invalid'; + } else { + throw new \Exception('Ewww returned unexpected error: ' . $response); + } } } if (!isset($responseObj->status)) { diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php index 07cdcfa..bfaaf08 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/FFMpeg.php @@ -7,6 +7,8 @@ use WebPConvert\Convert\Converters\ConverterTraits\EncodingAutoTrait; use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException; use WebPConvert\Convert\Exceptions\ConversionFailedException; +use WebPConvert\Options\OptionFactory; +use ExecWithFallback\ExecWithFallback; //use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\TargetNotFoundException; @@ -27,17 +29,26 @@ protected function getUnsupportedDefaultOptions() return [ 'alpha-quality', 'auto-filter', - 'encoding', 'low-memory', 'metadata', 'near-lossless', - 'preset', 'sharp-yuv', 'size-in-percentage', - 'use-nice' ]; } + /** + * Get the options unique for this converter + * + * @return array Array of options + */ + public function getUniqueOptions($imageType) + { + return OptionFactory::createOptions([ + self::niceOption() + ]); + } + private function getPath() { if (defined('WEBPCONVERT_FFMPEG_PATH')) { @@ -51,14 +62,14 @@ private function getPath() public function isInstalled() { - exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); return ($returnCode == 0); } // Check if webp delegate is installed public function isWebPDelegateInstalled() { - exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); foreach ($output as $line) { if (preg_match('# --enable-libwebp#i', $line)) { return true; @@ -143,13 +154,12 @@ protected function doActualConvert() $command = $this->getPath() . ' ' . $this->createCommandLineOptions() . ' 2>&1'; - $useNice = (($this->options['use-nice']) && self::hasNiceSupport()) ? true : false; + $useNice = ($this->options['use-nice'] && $this->checkNiceSupport()); if ($useNice) { - $this->logLn('using nice'); $command = 'nice ' . $command; } $this->logLn('Executing command: ' . $command); - exec($command, $output, $returnCode); + ExecWithFallback::exec($command, $output, $returnCode); $this->logExecOutput($output); if ($returnCode == 0) { @@ -162,7 +172,7 @@ protected function doActualConvert() throw new SystemRequirementsNotMetException('ffmpeg is not installed'); } if ($returnCode != 0) { - throw new SystemRequirementsNotMetException('The exec call failed'); + throw new SystemRequirementsNotMetException('The exec() call failed'); } } } diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gd.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gd.php index ae59c2b..101acce 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gd.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gd.php @@ -34,7 +34,6 @@ protected function getUnsupportedDefaultOptions() 'preset', 'sharp-yuv', 'size-in-percentage', - 'use-nice' ]; } @@ -57,6 +56,21 @@ public function checkOperationality() 'Gd has been compiled without webp support.' ); } + + if (!function_exists('imagepalettetotruecolor')) { + if (!self::functionsExist([ + 'imagecreatetruecolor', 'imagealphablending', 'imagecolorallocatealpha', + 'imagefilledrectangle', 'imagecopy', 'imagedestroy', 'imagesx', 'imagesy' + ])) { + throw new SystemRequirementsNotMetException( + 'Gd cannot convert palette color images to RGB. ' . + 'Even though it would be possible to convert RGB images to webp with Gd, ' . + 'we refuse to do it. A partial working converter causes more trouble than ' . + 'a non-working. To make this converter work, you need the imagepalettetotruecolor() ' . + 'function to be enabled on your system.' + ); + } + } } /** @@ -218,17 +232,20 @@ private function createImageResource() * Try to make image resource true color if it is not already. * * @param resource|\GdImage $image The image to work on - * @return void + * @return boolean|null True if it is now true color. False if it is NOT true color. null, if we cannot tell */ protected function tryToMakeTrueColorIfNot(&$image) { + $whatIsItNow = null; $mustMakeTrueColor = false; if (function_exists('imageistruecolor')) { if (imageistruecolor($image)) { $this->logLn('image is true color'); + $whatIsItNow = true; } else { $this->logLn('image is not true color'); $mustMakeTrueColor = true; + $whatIsItNow = false; } } else { $this->logLn('It can not be determined if image is true color'); @@ -238,13 +255,15 @@ protected function tryToMakeTrueColorIfNot(&$image) if ($mustMakeTrueColor) { $this->logLn('converting color palette to true color'); $success = $this->makeTrueColor($image); - if (!$success) { + if ($success) { + return true; + } else { $this->logLn( - 'Warning: FAILED converting color palette to true color. ' . - 'Continuing, but this does NOT look good.' + 'FAILED converting color palette to true color. ' ); } } + return $whatIsItNow; } /** @@ -330,9 +349,27 @@ protected function tryConverting($image) ob_start(); - //$success = imagewebp($image, $this->destination, $q); - $success = imagewebp($image, null, $q); - + // Adding this try/catch is perhaps not neccessary. + // I'm not certain that the error handler takes care of Throwable errors. + // and - sorry - was to lazy to find out right now. So for now: better safe than sorry. #320 + $error = null; + $success = false; + + try { + // Beware: This call can throw FATAL on windows (cannot be catched) + // This for example happens on palette images + $success = imagewebp($image, null, $q); + } catch (\Exception $e) { + $error = $e; + } catch (\Throwable $e) { + $error = $e; + } + if (!is_null($error)) { + restore_error_handler(); + ob_end_clean(); + $this->destroyAndRemove($image); + throw $error; + } if (!$success) { $this->destroyAndRemove($image); ob_end_clean(); @@ -444,8 +481,29 @@ protected function doActualConvert() $image = $this->createImageResource(); // Try to convert color palette if it is not true color - $this->tryToMakeTrueColorIfNot($image); - + $isItTrueColorNow = $this->tryToMakeTrueColorIfNot($image); + if ($isItTrueColorNow === false) { + // our tests shows that converting palette fails on all systems, + throw new ConversionFailedException( + 'Cannot convert image because it is a palette image and the palette image cannot ' . + 'be converted to RGB (which is required). To convert to RGB, we would need ' . + 'imagepalettetotruecolor(), which is not available on your system. ' . + 'Our workaround does not have the neccasary functions for converting to RGB either.' + ); + } + if (is_null($isItTrueColorNow)) { + $isWindows = preg_match('/^win/i', PHP_OS); + $isMacDarwin = preg_match('/^darwin/i', PHP_OS); // actually no problem in PHP 7.4 and 8.0 + if ($isWindows || $isMacDarwin) { + throw new ConversionFailedException( + 'Cannot convert image because it appears to be a palette image and the palette image ' . + 'cannot be converted to RGB, as you do not have imagepalettetotruecolor() enabled. ' . + 'Converting palette on ' . + ($isWindows ? 'Windows causes FATAL error' : 'Mac causes halt') . + 'So we abort now' + ); + } + } if ($this->getMimeTypeOfSource() == 'image/png') { if (function_exists('version_compare')) { diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gmagick.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gmagick.php index 5cb8896..0108c72 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gmagick.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Gmagick.php @@ -25,7 +25,6 @@ protected function getUnsupportedDefaultOptions() return [ 'near-lossless', 'size-in-percentage', - 'use-nice' ]; } diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php index 787ba90..86d1e30 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/GraphicsMagick.php @@ -5,9 +5,10 @@ use WebPConvert\Convert\Converters\AbstractConverter; use WebPConvert\Convert\Converters\ConverterTraits\EncodingAutoTrait; use WebPConvert\Convert\Converters\ConverterTraits\ExecTrait; - use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException; use WebPConvert\Convert\Exceptions\ConversionFailedException; +use WebPConvert\Options\OptionFactory; +use ExecWithFallback\ExecWithFallback; //use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\TargetNotFoundException; @@ -31,6 +32,18 @@ protected function getUnsupportedDefaultOptions() ]; } + /** + * Get the options unique for this converter + * + * @return array Array of options + */ + public function getUniqueOptions($imageType) + { + return OptionFactory::createOptions([ + self::niceOption() + ]); + } + private function getPath() { if (defined('WEBPCONVERT_GRAPHICSMAGICK_PATH')) { @@ -44,13 +57,13 @@ private function getPath() public function isInstalled() { - exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); return ($returnCode == 0); } public function getVersion() { - exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); if (($returnCode == 0) && isset($output[0])) { return preg_replace('#http.*#', '', $output[0]); } @@ -60,7 +73,7 @@ public function getVersion() // Check if webp delegate is installed public function isWebPDelegateInstalled() { - exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); foreach ($output as $line) { if (preg_match('#WebP.*yes#i', $line)) { return true; @@ -180,13 +193,12 @@ protected function doActualConvert() $command = $this->getPath() . ' convert ' . $this->createCommandLineOptions() . ' 2>&1'; - $useNice = (($this->options['use-nice']) && self::hasNiceSupport()) ? true : false; + $useNice = ($this->options['use-nice'] && $this->checkNiceSupport()); if ($useNice) { - $this->logLn('using nice'); $command = 'nice ' . $command; } $this->logLn('Executing command: ' . $command); - exec($command, $output, $returnCode); + ExecWithFallback::exec($command, $output, $returnCode); $this->logExecOutput($output); if ($returnCode == 0) { @@ -202,7 +214,7 @@ protected function doActualConvert() $this->logLn('command:' . $command); $this->logLn('return code:' . $returnCode); $this->logLn('output:' . print_r(implode("\n", $output), true)); - throw new SystemRequirementsNotMetException('The exec call failed'); + throw new SystemRequirementsNotMetException('The exec() call failed'); } } } diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php index b0c2ac0..2470b8e 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/ImageMagick.php @@ -2,12 +2,14 @@ namespace WebPConvert\Convert\Converters; +use ExecWithFallback\ExecWithFallback; +use LocateBinaries\LocateBinaries; + use WebPConvert\Convert\Converters\AbstractConverter; use WebPConvert\Convert\Converters\ConverterTraits\ExecTrait; use WebPConvert\Convert\Converters\ConverterTraits\EncodingAutoTrait; use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException; use WebPConvert\Convert\Exceptions\ConversionFailedException; -use WebPConvert\Helpers\BinaryDiscovery; use WebPConvert\Options\OptionFactory; //use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\TargetNotFoundException; @@ -39,6 +41,7 @@ protected function getUnsupportedDefaultOptions() public function getUniqueOptions($imageType) { return OptionFactory::createOptions([ + self::niceOption(), ['try-common-system-paths', 'boolean', [ 'title' => 'Try locating ImageMagick in common system paths', 'description' => @@ -67,7 +70,7 @@ private function getPath() } if ($this->options['try-common-system-paths']) { - $binaries = BinaryDiscovery::discoverInCommonSystemPaths('convert'); + $binaries = LocateBinaries::locateInCommonSystemPaths('convert'); if (!empty($binaries)) { return $binaries[0]; } @@ -78,7 +81,7 @@ private function getPath() private function getVersion() { - exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); if (($returnCode == 0) && isset($output[0])) { return $output[0]; } else { @@ -88,14 +91,14 @@ private function getVersion() public function isInstalled() { - exec($this->getPath() . ' -version 2>&1', $output, $returnCode); + ExecWithFallback::exec($this->getPath() . ' -version 2>&1', $output, $returnCode); return ($returnCode == 0); } // Check if webp delegate is installed public function isWebPDelegateInstalled() { - exec($this->getPath() . ' -list delegate 2>&1', $output, $returnCode); + ExecWithFallback::exec($this->getPath() . ' -list delegate 2>&1', $output, $returnCode); foreach ($output as $line) { if (preg_match('#webp\\s*=#i', $line)) { return true; @@ -103,7 +106,7 @@ public function isWebPDelegateInstalled() } // try other command - exec($this->getPath() . ' -list configure 2>&1', $output, $returnCode); + ExecWithFallback::exec($this->getPath() . ' -list configure 2>&1', $output, $returnCode); foreach ($output as $line) { if (preg_match('#DELEGATE.*webp#i', $line)) { return true; @@ -248,13 +251,12 @@ protected function doActualConvert() $command = $this->getPath() . ' ' . $this->createCommandLineOptions($versionNumber) . ' 2>&1'; - $useNice = (($this->options['use-nice']) && self::hasNiceSupport()) ? true : false; + $useNice = ($this->options['use-nice'] && $this->checkNiceSupport()); if ($useNice) { - $this->logLn('using nice'); $command = 'nice ' . $command; } $this->logLn('Executing command: ' . $command); - exec($command, $output, $returnCode); + ExecWithFallback::exec($command, $output, $returnCode); $this->logExecOutput($output); if ($returnCode == 0) { diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Imagick.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Imagick.php index 35ac4d6..eee71c5 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Imagick.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Imagick.php @@ -25,7 +25,6 @@ protected function getUnsupportedDefaultOptions() { return [ 'size-in-percentage', - 'use-nice' ]; } diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Stack.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Stack.php index 56b1968..c81cf4e 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Stack.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Stack.php @@ -8,10 +8,7 @@ use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperationalException; use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException; use WebPConvert\Convert\Exceptions\ConversionFailed\ConversionSkippedException; -use WebPConvert\Options\BooleanOption; -use WebPConvert\Options\ArrayOption; -use WebPConvert\Options\GhostOption; -use WebPConvert\Options\SensitiveArrayOption; +use WebPConvert\Options\OptionFactory; //use WebPConvert\Convert\Exceptions\ConversionFailed\InvalidInput\TargetNotFoundException; @@ -38,7 +35,6 @@ protected function getUnsupportedDefaultOptions() 'preset', 'sharp-yuv', 'size-in-percentage', - 'use-nice', 'skip', 'default-quality', 'quality', @@ -48,13 +44,64 @@ protected function getUnsupportedDefaultOptions() public function getUniqueOptions($imageType) { + return OptionFactory::createOptions([ + ['converters', 'array', [ + 'title' => 'Converters', + 'description' => 'Converters to try, ordered by priority.', + 'default' => self::getAvailableConverters(), + 'sensitive' => true, + 'ui' => [ + 'component' => 'multi-select', + 'options' => self::getAvailableConverters(), + 'advanced' => true + ] + ]], + ['converter-options', 'array', [ + 'title' => 'Converter options', + 'description' => + 'Extra options for specific converters.', + 'default' => [], + 'sensitive' => true, + 'ui' => null + ]], + ['preferred-converters', 'array', [ + 'title' => 'Preferred converters', + 'description' => + 'With this option you can move specified converters to the top of the stack. ' . + 'The converters are specified by id.', + 'default' => [], + 'ui' => null + ]], + ['extra-converters', 'array', [ + 'title' => 'Extra converters', + 'description' => + 'Add extra converters to the bottom of the stack', + 'default' => [], + 'sensitive' => true, + 'ui' => null + ]], + ['shuffle', 'boolean', [ + 'title' => 'Shuffle', + 'description' => + 'Shuffles the converter order on each conversion. ' . + 'Can for example be used to spread out requests on multiple cloud converters', + 'default' => false, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true + ] + ]], + ]); + + +/* return [ new SensitiveArrayOption('converters', self::getAvailableConverters()), new SensitiveArrayOption('converter-options', []), new BooleanOption('shuffle', false), new ArrayOption('preferred-converters', []), new SensitiveArrayOption('extra-converters', []) - ]; + ];*/ } /** @@ -183,7 +230,7 @@ protected function doActualConvert() $beginTime = microtime(true); $this->ln(); - $this->logLn('Trying: ' . $converterId, 'italic'); + $this->logLn($converterId . ' converter ignited', 'bold'); $converter = ConverterFactory::makeConverter( $converterId, diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Vips.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Vips.php index 3dd9916..dd3fd9b 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Vips.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Vips.php @@ -27,7 +27,6 @@ protected function getUnsupportedDefaultOptions() return [ 'auto-filter', 'size-in-percentage', - 'use-nice' ]; } @@ -78,9 +77,9 @@ public function checkOperationality() } - /** @scrutinizer ignore-call */ vips_error_buffer(); // clear error buffer - $result = /** @scrutinizer ignore-call */ vips_call('webpsave', null); - if ($result == -1) { + vips_error_buffer(); // clear error buffer + $result = vips_call('webpsave', null); + if ($result === -1) { $message = vips_error_buffer(); if (strpos($message, 'VipsOperation: class "webpsave" not found') === 0) { throw new SystemRequirementsNotMetException( @@ -209,9 +208,9 @@ private function createParamsForVipsWebPSave() } /** - * Convert with vips extension. + * Save as webp, using vips extension. * - * Tries to create image resource and save it as webp using the calculated options. + * Tries to save image resource as webp, using the supplied options. * Vips fails when a parameter is not supported, but we detect this and unset that parameter and try again * (recursively call itself until there is no more of these kind of errors). * @@ -246,7 +245,8 @@ private function webpsave($im, $options) } if ($nameOfPropertyNotFound != '') { - $msg = 'Your version of vipslib does not support the "' . $nameOfPropertyNotFound . '" property'; + $msg = 'Note: Your version of vipslib does not support the "' . + $nameOfPropertyNotFound . '" property'; switch ($nameOfPropertyNotFound) { case 'alpha_q': @@ -268,7 +268,7 @@ private function webpsave($im, $options) $msg .= '. The option is ignored.'; - $this->logLn($msg); + $this->logLn($msg, 'bold'); unset($options[$nameOfPropertyNotFound]); $this->webpsave($im, $options); @@ -279,11 +279,11 @@ private function webpsave($im, $options) } /** - * Convert with vips extension. + * Convert, using vips extension. * * Tries to create image resource and save it as webp using the calculated options. - * Vips fails when a parameter is not supported, but we detect this and unset that parameter and try again - * (repeat until success). + * PS: The Vips "webpsave" call fails when a parameter is not supported, but our webpsave() method + * detect this and unset that parameter and try again (repeat until success). * * @throws ConversionFailedException if conversion fails. */ diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php index dc5de49..5b9fd47 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Converters/Wpc.php @@ -13,6 +13,7 @@ use WebPConvert\Options\BooleanOption; use WebPConvert\Options\IntegerOption; use WebPConvert\Options\SensitiveStringOption; +use WebPConvert\Options\OptionFactory; /** * Convert images to webp using Wpc (a cloud converter based on WebP Convert). @@ -34,14 +35,75 @@ protected function getUnsupportedDefaultOptions() public function getUniqueOptions($imageType) { - return [ - new SensitiveStringOption('api-key', ''), /* for communicating with wpc api v.1+ */ - new SensitiveStringOption('secret', ''), /* for communicating with wpc api v.0 */ + return OptionFactory::createOptions([ + ['api-key', 'string', [ + 'title' => 'API key', + 'description' => 'The API key is set up on the remote. Copy that.', + 'default' => '', + 'sensitive' => true, + 'ui' => [ + 'component' => 'password', + 'advanced' => false, + 'display' => "option('wpc-api-version') != 0" + ] + ]], + ['secret', 'string', [ + 'title' => 'Secret', + 'description' => '', + 'default' => '', + 'sensitive' => true, + 'ui' => [ + 'component' => 'password', + 'advanced' => false, + 'display' => "option('wpc-api-version') == 0" + ] + ]], + ['api-url', 'string', [ + 'title' => 'API url', + 'description' => 'The endpoint of the web service. Copy it from the remote setup', + 'default' => '', + 'sensitive' => true, + 'ui' => [ + 'component' => 'password', + 'advanced' => false, + ] + ]], + ['api-version', 'int', [ + 'title' => 'API version', + 'description' => + 'Refers to the major version of Wpc. ' . + 'It is probably 2, as it is a long time since 2.0 was released', + 'default' => 2, + 'minimum' => 0, + 'maximum' => 2, + 'ui' => [ + 'component' => 'select', + 'advanced' => false, + 'options' => [0, 1, 2], + ] + ]], + ['crypt-api-key-in-transfer', 'boolean', [ + 'title' => 'Crypt API key in transfer', + 'description' => + 'If checked, the api key will be crypted in requests. ' . + 'Crypting the api-key protects it from being stolen during transfer', + 'default' => false, + 'ui' => [ + 'component' => 'checkbox', + 'advanced' => true, + 'display' => "option('wpc-api-version') >= 1" + ] + ]], + ]); + + /*return [ + new SensitiveStringOption('api-key', ''), + new SensitiveStringOption('secret', ''), new SensitiveStringOption('api-url', ''), - new SensitiveStringOption('url', ''), /* DO NOT USE. Only here to keep the protection */ + new SensitiveStringOption('url', ''), // DO NOT USE. Only here to keep the protection new IntegerOption('api-version', 2, 0, 2), - new BooleanOption('crypt-api-key-in-transfer', false) /* new in api v.1 */ - ]; + new BooleanOption('crypt-api-key-in-transfer', false) // new in api v.1 + ];*/ } public function supportsLossless() @@ -160,7 +222,7 @@ public function checkOperationality() ); } } - } elseif ($apiVersion >= 1) { + } else { if ($options['crypt-api-key-in-transfer']) { if (!function_exists('crypt')) { throw new ConverterNotOperationalException( @@ -242,7 +304,7 @@ private function createPostData() if ($apiVersion == 0) { $postData['hash'] = md5(md5_file($this->source) . $apiKey); - } elseif ($apiVersion == 1) { + } else { //$this->logLn('api key: ' . $apiKey); if ($options['crypt-api-key-in-transfer']) { diff --git a/includes/vendor/rosell-dk/webp-convert/src/Convert/Helpers/JpegQualityDetector.php b/includes/vendor/rosell-dk/webp-convert/src/Convert/Helpers/JpegQualityDetector.php index 4affdd1..8b8325f 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Convert/Helpers/JpegQualityDetector.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Convert/Helpers/JpegQualityDetector.php @@ -2,6 +2,8 @@ namespace WebPConvert\Convert\Helpers; +use ExecWithFallback\ExecWithFallback; + /** * Try to detect quality of a jpeg image using various tools. * @@ -44,6 +46,7 @@ private static function detectQualityOfJpgUsingImagick($filename) } catch (\Exception $e) { // Well well, it just didn't work out. // - But perhaps next method will work... + } catch (\Throwable $e) { } } return null; @@ -68,12 +71,22 @@ private static function detectQualityOfJpgUsingImagick($filename) */ private static function detectQualityOfJpgUsingImageMagick($filename) { - if (function_exists('exec')) { + if (ExecWithFallback::anyAvailable()) { // Try Imagick using exec, and routing stderr to stdout (the "2>$1" magic) - exec("identify -format '%Q' " . escapeshellarg($filename) . " 2>&1", $output, $returnCode); - //echo 'out:' . print_r($output, true); - if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) { - return intval($output[0]); + + try { + ExecWithFallback::exec( + "identify -format '%Q' " . escapeshellarg($filename) . " 2>&1", + $output, + $returnCode + ); + //echo 'out:' . print_r($output, true); + if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) { + return intval($output[0]); + } + } catch (\Exception $e) { + // its ok, there are other fish in the sea + } catch (\Throwable $e) { } } return null; @@ -93,19 +106,27 @@ private static function detectQualityOfJpgUsingImageMagick($filename) */ private static function detectQualityOfJpgUsingGraphicsMagick($filename) { - if (function_exists('exec')) { + if (ExecWithFallback::anyAvailable()) { // Try GraphicsMagick - exec("gm identify -format '%Q' " . escapeshellarg($filename) . " 2>&1", $output, $returnCode); - if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) { - $quality = intval($output[0]); - - // It seems that graphicsmagick is (currently) never able to detect the quality! - // - and always returns 75 as a fallback - // We shall therefore treat 75 as a failure to detect. (#209) - if ($quality == 75) { - return null; + try { + ExecWithFallback::exec( + "gm identify -format '%Q' " . escapeshellarg($filename) . " 2>&1", + $output, + $returnCode + ); + if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) { + $quality = intval($output[0]); + + // It seems that graphicsmagick is (currently) never able to detect the quality! + // - and always returns 75 as a fallback + // We shall therefore treat 75 as a failure to detect. (#209) + if ($quality == 75) { + return null; + } + return $quality; } - return $quality; + } catch (\Exception $e) { + } catch (\Throwable $e) { } } return null; diff --git a/includes/vendor/rosell-dk/webp-convert/src/Helpers/BinaryDiscovery.php b/includes/vendor/rosell-dk/webp-convert/src/Helpers/BinaryDiscovery.php deleted file mode 100644 index 0e554c2..0000000 --- a/includes/vendor/rosell-dk/webp-convert/src/Helpers/BinaryDiscovery.php +++ /dev/null @@ -1,108 +0,0 @@ - - * @since Class available since Release 2.3.0 - */ -class BinaryDiscovery -{ - - // Common system paths - private static $commonSystemPaths = [ - '/usr/bin', - '/usr/local/bin', - '/usr/gnu/bin', - '/usr/syno/bin', - '/bin', - ]; - - /** - * Discover binaries by looking in common system paths. - * - * We try a small set of common system paths, such as "/usr/bin". - * - * @param string $binary the binary to look for (ie "cwebp") - * - * @return array binaries found in common system locations - */ - public static function discoverInCommonSystemPaths($binary) - { - $binaries = []; - foreach (self::$commonSystemPaths as $dir) { - // PS: FileExists might throw if exec() is unavailable. We let it. - // - this class assumes exec is available - if (FileExists::fileExistsTryHarder($dir . '/' . $binary)) { - $binaries[] = $dir . '/' . $binary; - } - } - return $binaries; - } - - /** - * Discover installed binaries using ie "whereis -b cwebp" - * - * @return array Array of cwebp paths discovered (possibly empty) - */ - private static function discoverBinariesUsingWhereIs($binary) - { - // This method was added due to #226. - exec('whereis -b ' . $binary . ' 2>&1', $output, $returnCode); - if (($returnCode == 0) && (isset($output[0]))) { - $result = $output[0]; - // Ie: "cwebp: /usr/bin/cwebp /usr/local/bin/cwebp" - if (preg_match('#^' . $binary . ':\s(.*)$#', $result, $matches)) { - return explode(' ', $matches[1]); - } - } - return []; - } - - /** - * Discover installed binaries using "which -a cwebp" - * - * @param string $binary the binary to look for (ie "cwebp") - * - * @return array Array of paths discovered (possibly empty) - */ - private static function discoverBinariesUsingWhich($binary) - { - // As suggested by @cantoute here: - // https://wordpress.org/support/topic/sh-1-usr-local-bin-cwebp-not-found/ - exec('which -a ' . $binary . ' 2>&1', $output, $returnCode); - if ($returnCode == 0) { - return $output; - } - return []; - } - - /** - * Discover binaries using "which -a" or, if that fails "whereis -b" - * - * These commands only searces within $PATH. So it only finds installed binaries (which is good, - * as it would be unsafe to deal with binaries found scattered around) - * - * @param string $binary the binary to look for (ie "cwebp") - * - * @return array binaries found in common system locations - */ - public static function discoverInstalledBinaries($binary) - { - $paths = self::discoverBinariesUsingWhich($binary); - if (count($paths) > 0) { - return $paths; - } - - $paths = self::discoverBinariesUsingWhereIs($binary); - if (count($paths) > 0) { - return $paths; - } - return []; - } -} diff --git a/includes/vendor/rosell-dk/webp-convert/src/Options/Option.php b/includes/vendor/rosell-dk/webp-convert/src/Options/Option.php index 1850776..0d874ae 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Options/Option.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Options/Option.php @@ -44,7 +44,7 @@ class Option /** @var array UI Def */ protected $ui; - /** @var array Extra Schema Def (ie holding 'title', 'description' or other)*/ + /** @var array|null Extra Schema Def (ie holding 'title', 'description' or other)*/ protected $extraSchemaDefs; @@ -76,6 +76,16 @@ public function getId() return $this->id; } + /** + * Get Id. + * + * @param string $id The id of the option + */ + public function setId($id) + { + $this->id = $id; + } + /** * Get default value. * diff --git a/includes/vendor/rosell-dk/webp-convert/src/Options/OptionFactory.php b/includes/vendor/rosell-dk/webp-convert/src/Options/OptionFactory.php index 5bdbb4c..f69cfd9 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Options/OptionFactory.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Options/OptionFactory.php @@ -60,7 +60,11 @@ public static function createOption($optionName, $optionType, $def) break; case 'array': - $option = new ArrayOption($optionName, $def['default']); + if (isset($def['sensitive']) && ($def['sensitive'] == true)) { + $option = new SensitiveArrayOption($optionName, $def['default']); + } else { + $option = new ArrayOption($optionName, $def['default']); + } break; } unset($def['default']); diff --git a/includes/vendor/rosell-dk/webp-convert/src/Serve/ServeConvertedWebP.php b/includes/vendor/rosell-dk/webp-convert/src/Serve/ServeConvertedWebP.php index 01a01bd..d123d30 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/Serve/ServeConvertedWebP.php +++ b/includes/vendor/rosell-dk/webp-convert/src/Serve/ServeConvertedWebP.php @@ -4,6 +4,7 @@ use WebPConvert\Convert\Exceptions\ConversionFailedException; use WebPConvert\Helpers\InputValidator; use WebPConvert\Helpers\MimeType; +use WebPConvert\Helpers\PathChecker; use WebPConvert\Serve\Exceptions\ServeFailedException; use WebPConvert\Serve\Header; use WebPConvert\Serve\Report; @@ -72,7 +73,14 @@ private static function processOptions($options) */ public static function serveOriginal($source, $serveImageOptions = []) { - InputValidator::checkSource($source); + // PS: We do not use InputValidator::checkSource($source) because we want to be + // a bit more lenient here and allow any image to be served (even though ie webp does not + // qualify for being used as a source when converting) + + // Check that the filename is ok (no control chars, streamwrappers), and that the file exists + // and is not a dir + PathChecker::checkSourcePath($source); + $contentType = MimeType::getMimeTypeDetectionResult($source); if (is_null($contentType)) { throw new ServeFailedException('Rejecting to serve original (mime type cannot be determined)'); diff --git a/includes/vendor/rosell-dk/webp-convert/src/WebPConvert.php b/includes/vendor/rosell-dk/webp-convert/src/WebPConvert.php index 9f014d2..a65a6cf 100644 --- a/includes/vendor/rosell-dk/webp-convert/src/WebPConvert.php +++ b/includes/vendor/rosell-dk/webp-convert/src/WebPConvert.php @@ -41,7 +41,14 @@ class WebPConvert */ public static function convert($source, $destination, $options = [], $logger = null) { - Stack::convert($source, $destination, $options, $logger); + if (isset($options['converter'])) { + $converter = $options['converter']; + unset($options['converter']); + $c = ConverterFactory::makeConverter($converter, $source, $destination, $options, $logger); + $c->doConvert(); + } else { + Stack::convert($source, $destination, $options, $logger); + } } /** @@ -90,53 +97,39 @@ public static function getConverterIds() } /** - * Get option definitions for all converters + * Get option definitions for all converters * - * Added in order to give GUI's a way to automatically adjust their setting screens. + * Added in order to give GUI's a way to automatically adjust their setting screens. * - * @param string $imageType (png | jpeg) The image type - determines the defaults - * @param bool $returnGeneral Whether the general setting definitions should be returned - * @param bool $returnGeneralSupport Whether the ids of supported/unsupported general options - * should be returned + * @param bool $filterOutOptionsWithoutUI If options without UI defined should be filtered out * - * @return array Array of options definitions - ready to be json encoded, or whatever + * @return array Array of options definitions - ready to be json encoded, or whatever + * @since 2.8.0 */ - /* - Commented out, as it is not ready for release yet - - - public static function getConverterOptionDefinitions( - $imageType = 'png', - $returnGeneral = true, - $returnGeneralSupport = true - ) { - - // TODO: Return converter too - even though it is no a "real" option - + public static function getConverterOptionDefinitions($filterOutOptionsWithoutUI = true) + { $converterIds = self::getConverterIds(); $result = []; $ewww = ConverterFactory::makeConverter('ewww', '', ''); + $result['general'] = $ewww->getGeneralOptionDefinitions($filterOutOptionsWithoutUI); - //$result['general'] = $ewww->getGeneralOptionDefinitions(); - $result['general'] = $ewww->getGeneralOptionDefinitions(); $generalOptionHash = []; $generalOptionIds = []; foreach ($result['general'] as &$option) { $generalOptionIds[] = $option['id']; - //$option['supportedBy'] = $converterIds; // we will remove the unsupported below $option['unsupportedBy'] = []; $generalOptionHash[$option['id']] = &$option; } //$result['general'] = $generalOptionIds; array_unshift($result['general'], OptionFactory::createOption('converter', 'string', [ 'title' => 'Converter', - 'description' => 'Conversion method', - 'description' => "Cwebp and vips are best. " . + 'description' => 'Conversion method. ' . + "Cwebp and vips are best. " . 'the *magick are nearly as good, but only recent versions supports near-lossless. ' . 'gd is poor, as it does not support any webp options. ' . 'For full discussion, check the guide', - 'default' => 'cwebp', // TODO: set to best working + 'default' => 'stack', 'enum' => $converterIds, 'ui' => [ 'component' => 'select', @@ -149,28 +142,18 @@ public static function getConverterOptionDefinitions( ] ])->getDefinition()); - - //getUIForGeneralOptions - //$generalOption->addOptions(... $this->getGeneralOptions($imageType)); - $supportedBy = []; + $uniqueOptions = []; foreach ($converterIds as $converterId) { $c = ConverterFactory::makeConverter($converterId, '', ''); - - //$supports = $generalOptionIds; foreach ($c->getUnsupportedGeneralOptions() as $optionId) { - //$result['general'] - //if ()$support[] - //unsupportedBy $generalOptionHash[$optionId]['unsupportedBy'][] = $converterId; } - - - //$optionDefinitions = $c->getOptionDefinitions($imageType, $returnGeneral, $returnGeneralSupport); - $optionDefinitions = $c->getUniqueOptionDefinitions($imageType); - $result[$converterId] = $optionDefinitions; + $optionDefinitions = $c->getUniqueOptionDefinitions($filterOutOptionsWithoutUI); + $uniqueOptions[$converterId] = $optionDefinitions; } + $result['unique'] = $uniqueOptions; return $result; - }*/ + } } diff --git a/includes/vendor/sabberworm/php-css-parser/.gitignore b/includes/vendor/sabberworm/php-css-parser/.gitignore deleted file mode 100644 index 48b8bf9..0000000 --- a/includes/vendor/sabberworm/php-css-parser/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor/ diff --git a/includes/vendor/sabberworm/php-css-parser/.travis.yml b/includes/vendor/sabberworm/php-css-parser/.travis.yml deleted file mode 100644 index 622f22b..0000000 --- a/includes/vendor/sabberworm/php-css-parser/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: php -php: - - "5.4" - - "5.5" - - "5.6" - - "7.0" - - "7.1" - - "7.2" - - "7.3" - - hhvm -sudo: false -dist: trusty -matrix: - include: - - - php: "5.3" - dist: precise - sudo: false -before_script: rm composer.lock && composer install -script: ./vendor/bin/phpunit --coverage-clover build/coverage/xml -after_script: ./vendor/bin/codacycoverage clover build/coverage/xml - diff --git a/includes/vendor/sabberworm/php-css-parser/CHANGELOG.md b/includes/vendor/sabberworm/php-css-parser/CHANGELOG.md index 524fcd6..a23fd0e 100644 --- a/includes/vendor/sabberworm/php-css-parser/CHANGELOG.md +++ b/includes/vendor/sabberworm/php-css-parser/CHANGELOG.md @@ -1,26 +1,47 @@ # Revision History -## 8.0 +## 8.4.0 -### 8.0.0 (2016-06-30) +### Features -* Store source CSS line numbers in tokens and parsing exceptions. +* Support for PHP 8.x +* PHPDoc annotations +* Allow usage of CSS variables inside color functions (by parsing them as regular functions) +* Use PSR-12 code style * *No deprecations* -#### Backwards-incompatible changes +### Bugfixes -* Unrecoverable parser errors throw an exception of type `Sabberworm\CSS\Parsing\SourceException` instead of `\Exception`. +* Improved handling of whitespace in `calc()` +* Fix parsing units whose prefix is also a valid unit, like `vmin` +* Allow passing an object to `CSSList#replace` +* Fix PHP 7.3 warnings +* Correctly parse keyframes with `%` +* Don’t convert large numbers to scientific notation +* Allow a file to end after an `@import` +* Preserve case of CSS variables as specced +* Allow identifiers to use escapes the same way as strings +* No longer use `eval` for the comparison in `getSelectorsBySpecificity`, in case it gets passed untrusted input (CVE-2020-13756). Also fixed in 8.3.1, 8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, 1.0.1. +* Prevent an infinite loop when parsing invalid grid line names +* Remove invalid unit `vm` +* Retain rule order after expanding shorthands -### 8.1.0 (2016-07-19) +### Backwards-incompatible changes -* Comments are no longer silently ignored but stored with the object with which they appear (no render support, though). Thanks to @FMCorz. -* The IE hacks using `\0` and `\9` can now be parsed (and rendered) in lenient mode. Thanks (again) to @FMCorz. -* Media queries with or without spaces before the query are parsed. Still no *real* parsing support, though. Sorry… -* PHPUnit is now listed as a dev-dependency in composer.json. +* PHP ≥ 5.6 is now required +* HHVM compatibility target dropped + +## 8.3.0 (2019-02-22) + +* Refactor parsing logic to mostly reside in the class files whose data structure is to be parsed (this should eventually allow us to unit-test specific parts of the parsing logic individually). +* Fix error in parsing `calc` expessions when the first operand is a negative number, thanks to @raxbg. +* Support parsing CSS4 colors in hex notation with alpha values, thanks to @raxbg. +* Swallow more errors in lenient mode, thanks to @raxbg. +* Allow specifying arbitrary strings to output before and after declaration blocks, thanks to @westonruter. * *No backwards-incompatible changes* * *No deprecations* -### 8.2.0 (2018-07-13) +## 8.2.0 (2018-07-13) * Support parsing `calc()`, thanks to @raxbg. * Support parsing grid-lines, again thanks to @raxbg. @@ -29,188 +50,184 @@ * *No backwards-incompatible changes* * *No deprecations* -### 8.3.0 (2019-02-22) +## 8.1.0 (2016-07-19) -* Refactor parsing logic to mostly reside in the class files whose data structure is to be parsed (this should eventually allow us to unit-test specific parts of the parsing logic individually). -* Fix error in parsing `calc` expessions when the first operand is a negative number, thanks to @raxbg. -* Support parsing CSS4 colors in hex notation with alpha values, thanks to @raxbg. -* Swallow more errors in lenient mode, thanks to @raxbg. -* Allow specifying arbitrary strings to output before and after declaration blocks, thanks to @westonruter. +* Comments are no longer silently ignored but stored with the object with which they appear (no render support, though). Thanks to @FMCorz. +* The IE hacks using `\0` and `\9` can now be parsed (and rendered) in lenient mode. Thanks (again) to @FMCorz. +* Media queries with or without spaces before the query are parsed. Still no *real* parsing support, though. Sorry… +* PHPUnit is now listed as a dev-dependency in composer.json. * *No backwards-incompatible changes* * *No deprecations* -## 7.0 - -### 7.0.0 (2015-08-24) +## 8.0.0 (2016-06-30) -* Compatibility with PHP 7. Well timed, eh? +* Store source CSS line numbers in tokens and parsing exceptions. * *No deprecations* -#### Backwards-incompatible changes +### Backwards-incompatible changes -* The `Sabberworm\CSS\Value\String` class has been renamed to `Sabberworm\CSS\Value\CSSString`. +* Unrecoverable parser errors throw an exception of type `Sabberworm\CSS\Parsing\SourceException` instead of `\Exception`. -### 7.0.1 (2015-12-25) +## 7.0.3 (2016-04-27) -* No more suppressed `E_NOTICE` +* Fixed parsing empty CSS when multibyte is off * *No backwards-incompatible changes* * *No deprecations* -### 7.0.2 (2016-02-11) +## 7.0.2 (2016-02-11) * 150 time performance boost thanks to @[ossinkine](https://github.com/ossinkine) * *No backwards-incompatible changes* * *No deprecations* -### 7.0.3 (2016-04-27) +## 7.0.1 (2015-12-25) -* Fixed parsing empty CSS when multibyte is off +* No more suppressed `E_NOTICE` * *No backwards-incompatible changes* * *No deprecations* -## 6.0 +## 7.0.0 (2015-08-24) -### 6.0.0 (2014-07-03) - -* Format output using Sabberworm\CSS\OutputFormat -* *No backwards-incompatible changes* +* Compatibility with PHP 7. Well timed, eh? +* *No deprecations* -#### Deprecations +### Backwards-incompatible changes -* The parse() method replaces __toString with an optional argument (instance of the OutputFormat class) +* The `Sabberworm\CSS\Value\String` class has been renamed to `Sabberworm\CSS\Value\CSSString`. -### 6.0.1 (2015-08-24) +## 6.0.1 (2015-08-24) * Remove some declarations in interfaces incompatible with PHP 5.3 (< 5.3.9) * *No deprecations* -## 5.0 +## 6.0.0 (2014-07-03) + +* Format output using Sabberworm\CSS\OutputFormat +* *No backwards-incompatible changes* + +### Deprecations -### 5.0.0 (2013-03-20) +* The parse() method replaces __toString with an optional argument (instance of the OutputFormat class) + +## 5.2.0 (2014-06-30) + +* Support removing a selector from a declaration block using `$oBlock->removeSelector($mSelector)` +* Introduce a specialized exception (Sabberworm\CSS\Parsing\OuputException) for exceptions during output rendering -* Correctly parse all known CSS 3 units (including Hz and kHz). -* Output RGB colors in short (#aaa or #ababab) notation -* Be case-insensitive when parsing identifiers. * *No deprecations* #### Backwards-incompatible changes -* `Sabberworm\CSS\Value\Color`’s `__toString` method overrides `CSSList`’s to maybe return something other than `type(value, …)` (see above). +* Outputting a declaration block that has no selectors throws an OuputException instead of outputting an invalid ` {…}` into the CSS document. -### 5.0.1 (2013-03-20) +## 5.1.2 (2013-10-30) -* Internal cleanup +* Remove the use of consumeUntil in comment parsing. This makes it possible to parse comments such as `/** Perfectly valid **/` +* Add fr relative size unit +* Fix some issues with HHVM * *No backwards-incompatible changes* * *No deprecations* -### 5.0.2 (2013-03-21) +## 5.1.1 (2013-10-28) -* CHANGELOG.md file added to distribution +* Updated CHANGELOG.md to reflect changes since 5.0.4 * *No backwards-incompatible changes* * *No deprecations* -### 5.0.3 (2013-03-21) +## 5.1.0 (2013-10-24) -* More size units recognized +* Performance enhancements by Michael M Slusarz +* More rescue entry points for lenient parsing (unexpected tokens between declaration blocks and unclosed comments) * *No backwards-incompatible changes* * *No deprecations* -### 5.0.4 (2013-03-21) +## 5.0.8 (2013-08-15) -* Don’t output floats with locale-aware separator chars +* Make default settings’ multibyte parsing option dependent on whether or not the mbstring extension is actually installed. * *No backwards-incompatible changes* * *No deprecations* -### 5.0.5 (2013-04-17) +## 5.0.7 (2013-08-04) -* Initial support for lenient parsing (setting this parser option will catch some exceptions internally and recover the parser’s state as neatly as possible). +* Fix broken decimal point output optimization * *No backwards-incompatible changes* * *No deprecations* -### 5.0.6 (2013-05-31) +## 5.0.6 (2013-05-31) * Fix broken unit test * *No backwards-incompatible changes* * *No deprecations* -### 5.0.7 (2013-08-04) +## 5.0.5 (2013-04-17) -* Fix broken decimal point output optimization +* Initial support for lenient parsing (setting this parser option will catch some exceptions internally and recover the parser’s state as neatly as possible). * *No backwards-incompatible changes* * *No deprecations* -### 5.0.8 (2013-08-15) +## 5.0.4 (2013-03-21) -* Make default settings’ multibyte parsing option dependent on whether or not the mbstring extension is actually installed. +* Don’t output floats with locale-aware separator chars * *No backwards-incompatible changes* * *No deprecations* -### 5.1.0 (2013-10-24) +## 5.0.3 (2013-03-21) -* Performance enhancements by Michael M Slusarz -* More rescue entry points for lenient parsing (unexpected tokens between declaration blocks and unclosed comments) +* More size units recognized * *No backwards-incompatible changes* * *No deprecations* -### 5.1.1 (2013-10-28) +## 5.0.2 (2013-03-21) -* Updated CHANGELOG.md to reflect changes since 5.0.4 +* CHANGELOG.md file added to distribution * *No backwards-incompatible changes* * *No deprecations* -### 5.1.2 (2013-10-30) +## 5.0.1 (2013-03-20) -* Remove the use of consumeUntil in comment parsing. This makes it possible to parse comments such as `/** Perfectly valid **/` -* Add fr relative size unit -* Fix some issues with HHVM +* Internal cleanup * *No backwards-incompatible changes* * *No deprecations* -### 5.2.0 (2014-06-30) - -* Support removing a selector from a declaration block using `$oBlock->removeSelector($mSelector)` -* Introduce a specialized exception (Sabberworm\CSS\Parsing\OuputException) for exceptions during output rendering +## 5.0.0 (2013-03-20) +* Correctly parse all known CSS 3 units (including Hz and kHz). +* Output RGB colors in short (#aaa or #ababab) notation +* Be case-insensitive when parsing identifiers. * *No deprecations* -#### Backwards-incompatible changes - -* Outputting a declaration block that has no selectors throws an OuputException instead of outputting an invalid ` {…}` into the CSS document. +### Backwards-incompatible changes -## 4.0 +* `Sabberworm\CSS\Value\Color`’s `__toString` method overrides `CSSList`’s to maybe return something other than `type(value, …)` (see above). -### 4.0.0 (2013-03-19) +## 4.0.0 (2013-03-19) * Support for more @-rules * Generic interface `Sabberworm\CSS\Property\AtRule`, implemented by all @-rule classes * *No deprecations* -#### Backwards-incompatible changes +### Backwards-incompatible changes * `Sabberworm\CSS\RuleSet\AtRule` renamed to `Sabberworm\CSS\RuleSet\AtRuleSet` * `Sabberworm\CSS\CSSList\MediaQuery` renamed to `Sabberworm\CSS\RuleSet\CSSList\AtRuleBlockList` with differing semantics and API (which also works for other block-list-based @-rules like `@supports`). -## 3.0 - -### 3.0.0 (2013-03-06) +## 3.0.0 (2013-03-06) * Support for lenient parsing (on by default) * *No deprecations* -#### Backwards-incompatible changes +### Backwards-incompatible changes * All properties (like whether or not to use `mb_`-functions, which default charset to use and – new – whether or not to be forgiving when parsing) are now encapsulated in an instance of `Sabberworm\CSS\Settings` which can be passed as the second argument to `Sabberworm\CSS\Parser->__construct()`. * Specifying a charset as the second argument to `Sabberworm\CSS\Parser->__construct()` is no longer supported. Use `Sabberworm\CSS\Settings::create()->withDefaultCharset('some-charset')` instead. * Setting `Sabberworm\CSS\Parser->bUseMbFunctions` has no effect. Use `Sabberworm\CSS\Settings::create()->withMultibyteSupport(true/false)` instead. * `Sabberworm\CSS\Parser->parse()` may throw a `Sabberworm\CSS\Parsing\UnexpectedTokenException` when in strict parsing mode. -## 2.0 - -### 2.0.0 (2013-01-29) +## 2.0.0 (2013-01-29) * Allow multiple rules of the same type per rule set -#### Backwards-incompatible changes +### Backwards-incompatible changes * `Sabberworm\CSS\RuleSet->getRules()` returns an index-based array instead of an associative array. Use `Sabberworm\CSS\RuleSet->getRulesAssoc()` (which eliminates duplicate rules and lets the later rule of the same name win). * `Sabberworm\CSS\RuleSet->removeRule()` works as it did before except when passed an instance of `Sabberworm\CSS\Rule\Rule`, in which case it would only remove the exact rule given instead of all the rules of the same type. To get the old behaviour, use `Sabberworm\CSS\RuleSet->removeRule($oRule->getRule()`; diff --git a/includes/vendor/sabberworm/php-css-parser/Doxyfile b/includes/vendor/sabberworm/php-css-parser/Doxyfile deleted file mode 100644 index acc9d3b..0000000 --- a/includes/vendor/sabberworm/php-css-parser/Doxyfile +++ /dev/null @@ -1,2310 +0,0 @@ -# Doxyfile 1.8.7 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "Sabberworm/PHP-CSS-Parser" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = "7.0.3" - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "A Parser for CSS Files written in PHP. Allows extraction of CSS files into a data structure, manipulation of said structure and output as (optimized) CSS" - -# With the PROJECT_LOGO tag one can specify an logo or icon that is included in -# the documentation. The maximum height of the logo should not exceed 55 pixels -# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo -# to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = "../PHP-CSS-Parser-Documentation" - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = ./lib - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = YES - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a -# new page for each member. If set to NO, the documentation of a member will be -# part of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 2 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by by putting a % sign in front of the word -# or globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO these classes will be included in the various overviews. This option has -# no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = YES - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the -# todo list. This list is created by putting \todo commands in the -# documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the -# test list. This list is created by putting \test commands in the -# documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES the list -# will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. Do not use file names with spaces, bibtex cannot handle them. See -# also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO doxygen will only warn about wrong or incomplete parameter -# documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. -# Note: If this tag is empty the current directory is searched. - -INPUT = - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = tests - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER ) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = README.md - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES, then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = . - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- -# defined cascading style sheet that is included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefor more robust against future updates. -# Doxygen will copy the style sheet file to the output directory. For an example -# see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the stylesheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler ( hhc.exe). If non-empty -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated ( -# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /