Révision fbb66ca6
Ajouté par Assos Assos il y a presque 5 ans
drupal7/misc/typo3/phar-stream-wrapper/src/Helper.php | ||
---|---|---|
11 | 11 |
* The TYPO3 project - inspiring people to share! |
12 | 12 |
*/ |
13 | 13 |
|
14 |
/** |
|
15 |
* Helper provides low-level tools on file name resolving. However it does not |
|
16 |
* (and should not) maintain any runtime state information. In order to resolve |
|
17 |
* Phar archive paths according resolvers have to be used. |
|
18 |
* |
|
19 |
* @see \TYPO3\PharStreamWrapper\Resolvable::resolve() |
|
20 |
*/ |
|
14 | 21 |
class Helper |
15 | 22 |
{ |
16 | 23 |
/* |
... | ... | |
54 | 61 |
return null; |
55 | 62 |
} |
56 | 63 |
|
64 |
/** |
|
65 |
* @param string $path |
|
66 |
* @return bool |
|
67 |
*/ |
|
68 |
public static function hasPharPrefix($path) |
|
69 |
{ |
|
70 |
return stripos($path, 'phar://') === 0; |
|
71 |
} |
|
72 |
|
|
57 | 73 |
/** |
58 | 74 |
* @param string $path |
59 | 75 |
* @return string |
... | ... | |
61 | 77 |
public static function removePharPrefix($path) |
62 | 78 |
{ |
63 | 79 |
$path = trim($path); |
64 |
if (stripos($path, 'phar://') !== 0) {
|
|
80 |
if (!static::hasPharPrefix($path)) {
|
|
65 | 81 |
return $path; |
66 | 82 |
} |
67 | 83 |
return substr($path, 7); |
... | ... | |
77 | 93 |
public static function normalizePath($path) |
78 | 94 |
{ |
79 | 95 |
return rtrim( |
80 |
static::getCanonicalPath(
|
|
96 |
static::normalizeWindowsPath(
|
|
81 | 97 |
static::removePharPrefix($path) |
82 | 98 |
), |
83 | 99 |
'/' |
Formats disponibles : Unified diff
Udpate to 7.67