芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal-back/vendor/codeception/codeception/src/Codeception/Util/PathResolver.php
0) && (count($relProjDirParts) > 0) && (self::fsCaseStrCmp($relPathParts[0], $relProjDirParts[0], $dirSep) == 0) ) { array_shift($relPathParts); array_shift($relProjDirParts); } if (count($relProjDirParts) > 0) { // prefix $relPath with '..' for all remaining unmatched $projDir // subdirectories $relPathParts = array_merge(array_fill(0, count($relProjDirParts), '..'), $relPathParts); } // only append a trailing seperator if one is already present $trailingSep = preg_match('/'.preg_quote($dirSep, '/').'$/', $path) ? $dirSep : ''; // convert array of dir paths back into a string path return implode($dirSep, $relPathParts).$trailingSep; } /** * FileSystem Case String Compare * compare two strings with the filesystem's case-sensitiveness * * @param string $str1 * @param string $str2 * @param string $dirSep * @return int -1 / 0 / 1 for < / = / > respectively */ private static function fsCaseStrCmp($str1, $str2, $dirSep = DIRECTORY_SEPARATOR) { $cmpFn = self::isWindows($dirSep) ? 'strcasecmp' : 'strcmp'; return $cmpFn($str1, $str2); } /** * What part of this path (leftmost 0-3 characters) what * it is absolute relative to: * * On Unix: * This is simply '/' for an absolute path or * '' for a relative path * * On Windows this is more complicated: * If the first two characters are a letter followed * by a ':', this indicates that the path is * on a specific device. * With or without a device specified, a path MAY * start with a '\\' to indicate an absolute path * on the device or '' to indicate a path relative * to the device's CWD * * @param string $path * @param string $dirSep * @return string */ private static function getPathAbsolutenessPrefix($path, $dirSep = DIRECTORY_SEPARATOR) { $devLetterPrefixPattern = ''; if (self::isWindows($dirSep)) { $devLetterPrefixPattern = '([A-Za-z]:|)'; } $matches = []; if (!preg_match('/^'.$devLetterPrefixPattern.preg_quote($dirSep, '/').'?/', $path, $matches)) { // This should match, even if it matches 0 characters throw new ConfigurationException("INTERNAL ERROR: This must be a regex problem."); } return [ 'wholePrefix' => $matches[0], // The optional device letter followed by the optional $dirSep 'devicePrefix' => self::isWindows($dirSep) ? $matches[1] : '']; } /** * Are we in a Windows style filesystem? * * @param string $dirSep * @return bool */ private static function isWindows($dirSep = DIRECTORY_SEPARATOR) { return ($dirSep == '\\'); } public static function isPathAbsolute($path) { if (DIRECTORY_SEPARATOR === '/') { return substr($path, 0, 1) === DIRECTORY_SEPARATOR; } return preg_match('#^[A-Z]:(?![^/\\\])#i', $path) === 1; } }