1 | <?php |
||
13 | class Escape |
||
14 | { |
||
15 | /** |
||
16 | * argsForSite escapes each argument in an array for the given site. |
||
17 | */ |
||
18 | public static function argsForSite(SiteAliasInterface $siteAlias, $args) |
||
27 | |||
28 | /** |
||
29 | * forSite escapes the provided argument for the specified alias record. |
||
30 | */ |
||
31 | public static function forSite(SiteAliasInterface $siteAlias, $arg) |
||
35 | |||
36 | /** |
||
37 | * shellArg escapes the provided argument for the specified OS |
||
38 | * |
||
39 | * @param string|ShellOperatorInterface $arg The argument to escape |
||
40 | * @param string|null $os The OS to escape for. Optional; defaults to LINUX |
||
41 | * |
||
42 | * @return string The escaped string |
||
43 | */ |
||
44 | public static function shellArg($arg, $os = null) |
||
58 | |||
59 | /** |
||
60 | * isWindows determines whether the provided OS is Windows. |
||
61 | * |
||
62 | * @param string|null $os The OS to escape for. |
||
63 | * |
||
64 | * @return boolean |
||
65 | */ |
||
66 | public static function isWindows($os = null) |
||
73 | |||
74 | /** |
||
75 | * linuxArg is the Linux version of escapeshellarg(). |
||
76 | * |
||
77 | * This is intended to work the same way that escapeshellarg() does on |
||
78 | * Linux. If we need to escape a string that will be used remotely on |
||
79 | * a Linux system, then we need our own implementation of escapeshellarg, |
||
80 | * because the Windows version behaves differently. |
||
81 | * |
||
82 | * Note that we behave somewhat differently than the built-in escapeshellarg() |
||
83 | * with respect to whitespace replacement in order |
||
84 | * |
||
85 | * @param string $arg The argument to escape |
||
86 | * |
||
87 | * @return string The escaped string |
||
88 | */ |
||
89 | public static function linuxArg($arg) |
||
113 | |||
114 | /** |
||
115 | * windowsArg is the Windows version of escapeshellarg(). |
||
116 | * |
||
117 | * @param string $arg The argument to escape |
||
118 | * |
||
119 | * @return string The escaped string |
||
120 | */ |
||
121 | public static function windowsArg($arg) |
||
145 | } |
||
146 |