TYPO3
7.6
|
Static Public Member Functions | |
static | getRelativePathTo ($targetPath) |
static | getAbsoluteWebPath ($targetPath) |
static | getRelativePath ($sourcePath, $targetPath) |
static | getCommonPrefix (array $paths) |
static | sanitizeTrailingSeparator ($path, $separator= '/') |
static | basename ($path) |
static | dirname ($path) |
static | pathinfo ($path, $options=null) |
static | isAbsolutePath ($path) |
static | getAbsolutePathOfRelativeReferencedFileOrPath ($baseFilenameOrPath, $includeFileName) |
static | getCanonicalPath ($path) |
static | stripPathSitePrefix ($path) |
Static Protected Member Functions | |
static | isWindows () |
Class with helper functions for file paths.
Definition at line 20 of file PathUtility.php.
|
static |
Returns trailing name component of path Since basename() is locale dependent we need to access the filesystem with the same locale of the system, not the rendering context.
string | $path |
Definition at line 163 of file PathUtility.php.
References $GLOBALS.
Referenced by Folder\addFile(), LocalDriver\addFile(), ResourceStorage\addFile(), ImportExport\addThumbnail(), ImportExport\export_addFile(), ImportExport\export_addFilesFromRelations(), PlainTextExtractor\extractText(), LocalDriver\getFolderInfoByIdentifier(), LocalDriver\getRole(), ImportExport\processSoftReferences_saveFile(), ImportExport\processSoftReferences_saveFile_createRelFile(), and ResourceFactory\retrieveFileOrFolderObject().
|
static |
Returns parent directory's path Since dirname() is locale dependent we need to access the filesystem with the same locale of the system, not the rendering context.
string | $path |
Definition at line 185 of file PathUtility.php.
References $GLOBALS.
Referenced by ResourceCompressor\compressCssFile(), ResourceCompressor\createMergedFile(), ImportExport\export_addFile(), PathUtility\getAbsoluteWebPath(), LocalDriver\getFileInfoByIdentifier(), ResourceStorage\getPublicUrl(), PathUtility\getRelativePathTo(), Image\getUrl(), ImportExport\processSoftReferences_saveFile(), ImportExport\processSoftReferences_saveFile_createRelFile(), LocalDriver\renameFile(), LocalDriver\renameFolder(), ResourceFactory\retrieveFileOrFolderObject(), and ImportExport\writeSysFileResourceForLegacyImport().
|
static |
Gets the (absolute) path of an include file based on the (absolute) path of a base file
Does NOT do any sanity checks. This is a task for the calling function, e.g. call GeneralUtility::getFileAbsFileName() on the result.
Resolves all dots and slashes between that paths of both files. Whether the result is absolute or not, depends of the base file name.
If the include file goes higher than a relative base file, then the result will contain dots as a relative part.
base: abc/one.txt include: ../../two.txt result: ../two.txt
The exact behavior, refer to getCanonicalPath().
string | $baseFilenameOrPath | The name of the file or a path that serves as a base; a path will need to have a '/' at the end |
string | $includeFileName | The name of the file that is included in the file |
Definition at line 256 of file PathUtility.php.
Referenced by TypoScriptParser\extractIncludes(), TypoScriptParser\includeDirectory(), and TypoScriptParser\includeFile().
|
static |
Creates an absolute URL out of really any input path, removes '../' parts for the targetPath
string | $targetPath | can be "../typo3conf/ext/myext/myfile.js" or "/myfile.js" |
Definition at line 40 of file PathUtility.php.
References StringUtility\beginsWith(), PathUtility\dirname(), elseif, GeneralUtility\getIndpEnv(), and GeneralUtility\resolveBackPath().
Referenced by UriBuilder\buildUri(), BitmapIconProvider\generateMarkup(), SvgIconProvider\generateMarkup(), LoginController\getUriForFileName(), and TaskModuleController\renderListMenu().
|
static |
Resolves all dots, slashes and removes spaces after or before a path...
string | $path | Input string |
Definition at line 278 of file PathUtility.php.
References elseif.
Referenced by ResourceStorage\addFile(), and BasicFileUtility\is_directory().
|
static |
Gets the common path prefix out of many paths.
array | $paths | Paths to be processed |
Definition at line 107 of file PathUtility.php.
References elseif.
Referenced by ResourceFactory\findBestMatchingStorageByLocalPath().
|
static |
Gets the relative path from a source directory to a target directory. The allowed TYPO3 path is checked as well, thus it's not possible to go to upper levels.
string | $sourcePath | Absolute source path |
string | $targetPath | Absolute target path |
Definition at line 70 of file PathUtility.php.
References GeneralUtility\fixWindowsFilePath(), and GeneralUtility\isAllowedAbsPath().
Referenced by ResourceFactory\retrieveFileOrFolderObject().
|
static |
Gets the relative path from the current used script to a given directory. The allowed TYPO3 path is checked as well, thus it's not possible to go to upper levels.
string | $targetPath | Absolute target path |
Definition at line 29 of file PathUtility.php.
References PathUtility\dirname().
Referenced by AbstractSpriteHandler\collectTcaSpriteIcons(), ResourceStorage\getPublicUrl(), and Image\getUrl().
|
static |
Checks if the $path is absolute or relative (detecting either '/' or 'x:/' as first part of string) and returns TRUE if so.
string | $path | File path to evaluate |
Definition at line 223 of file PathUtility.php.
Referenced by FileWriter\setLogFile().
|
staticprotected |
Wrapper method to be able to test windows path transformation on other systems
Definition at line 365 of file PathUtility.php.
|
static |
Returns parent directory's path Since dirname() is locale dependent we need to access the filesystem with the same locale of the system, not the rendering context.
string | $path | |
int | $options |
Definition at line 208 of file PathUtility.php.
References $GLOBALS.
Referenced by ResourceStorage\checkFileExtensionPermission(), AbstractSpriteHandler\collectTcaSpriteIcons(), ResourceCompressor\compressCssFile(), ResourceCompressor\compressJsFile(), AbstractFile\getExtension(), AbstractFile\getNameWithoutExtension(), AbstractDriver\getTemporaryPathForFile(), and ResourceStorage\getUniqueName().
|
static |
Sanitizes a trailing separator. (e.g. 'some/path' -> 'some/path/')
string | $path | The path to be sanitized |
string | $separator | The separator to be used |
Definition at line 145 of file PathUtility.php.
Referenced by FileHandlingUtility\createZipFileFromExtension(), PackageManager\registerPackagesFromConfiguration(), and PackageManager\scanPackagesInPath().
|
static |
Strip first part of a path, equal to the length of PATH_site
string | $path |
Definition at line 343 of file PathUtility.php.
Referenced by AbstractItemProvider\addItemsFromFolder(), AbstractItemProvider\addItemsFromSpecial(), ModuleLoader\checkExtensionModule(), ReferenceIndex\createEntryData_fileRels(), DebugUtility\debugTrail(), LocalDriver\determineBaseUrl(), ImportExport\export_addFile(), ExtendedTemplateService\ext_getTSCE_config_image(), ImportExport\fixFileIDsInRelations(), LocallangArrayParser\generateCacheFile(), LocallangArrayParser\generateCacheFileName(), TemplateService\getFileName(), FormEngineUtility\getIconHtml(), ImageViewHelper\getImageUri(), GeneralUtility\getIndpEnv(), FileHandlingUtility\getRelativePath(), ShortcutToolbarItem\getShortcutIcon(), ModulesController\getSubModuleData(), GeneralUtility\logDeprecatedFunction(), ImportExport\processSoftReferences_saveFile(), ImportExport\processSoftReferences_saveFile_createRelFile(), ExtensionManagementUtility\siteRelPath(), ImportExport\verifyFolderAccess(), and FileHandlingUtility\writeEmConfToFile().