PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.3.1
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.3.1
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / rosell-dk / exec-with-fallback / src / Availability.php

Availability.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.3.1, at vendor/rosell-dk/exec-with-fallback/src/Availability.php

40 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ExecWithFallback;
3
4 /**
5 * Check if any of the methods are available on the system.
6 *
7 * @package ExecWithFallback
8 * @author Bjørn Rosell <[email protected]>
9 */
10 class Availability extends ExecWithFallback
11 {
12
13 /**
14 * Check if any of the methods are available on the system.
15 *
16 * @param boolean $needResultCode Whether the code using this library is going to supply $result_code to the exec
17 * call. This matters because shell_exec is only available when not.
18 */
19 public static function anyAvailable($needResultCode = true)
20 {
21 foreach (self::$methods as $method) {
22 if (self::methodAvailable($method, $needResultCode)) {
23 return true;
24 }
25 }
26 return false;
27 }
28
29 public static function methodAvailable($method, $needResultCode = true)
30 {
31 if (!ExecWithFallback::functionEnabled($method)) {
32 return false;
33 }
34 if ($needResultCode) {
35 return ($method != 'shell_exec');
36 }
37 return true;
38 }
39 }
40