Add X13 WebP module for image conversion to next-generation formats
- Implemented the main module class with essential properties and methods. - Added translation support for various user interface strings. - Created XML configuration file for module versioning. - Ensured compatibility with different PHP versions and PrestaShop versions.
This commit is contained in:
39
modules/x13webp/vendor/rosell-dk/exec-with-fallback/src/Availability.php
vendored
Normal file
39
modules/x13webp/vendor/rosell-dk/exec-with-fallback/src/Availability.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace ExecWithFallback;
|
||||
|
||||
/**
|
||||
* Check if any of the methods are available on the system.
|
||||
*
|
||||
* @package ExecWithFallback
|
||||
* @author Bjørn Rosell <it@rosell.dk>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user