‪TYPO3CMS  11.5
TYPO3\CMS\Core\Utility\PathUtility Class Reference

Static Public Member Functions

static string null getRelativePathTo ($targetPath)
 
static string getAbsoluteWebPath ($targetPath, bool $prefixWithSitePath=true)
 
static string getPublicResourceWebPath (string $resourcePath, bool $prefixWithSitePath=true)
 
static bool isExtensionPath (string $path)
 
static string null getRelativePath ($sourcePath, $targetPath)
 
static string null getCommonPrefix (array $paths)
 
static string sanitizeTrailingSeparator ($path, $separator='/')
 
static string basename ($path)
 
static string dirname ($path)
 
static string string[] pathinfo ($path, $options=null)
 
static bool isAbsolutePath ($path)
 
static string getAbsolutePathOfRelativeReferencedFileOrPath ($baseFilenameOrPath, $includeFileName)
 
static string dirnameDuringBootstrap ($path)
 
static string basenameDuringBootstrap ($path)
 
static string getCanonicalPath ($path)
 
static string stripPathSitePrefix ($path)
 
static bool hasProtocolAndScheme (string $path)
 
static isAllowedAdditionalPath (string $path)
 

Detailed Description

Class with helper functions for file paths.

Definition at line 24 of file PathUtility.php.

Member Function Documentation

◆ basename()

static string TYPO3\CMS\Core\Utility\PathUtility::basename (   $path)
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.

See also
http://www.php.net/manual/en/function.basename.php
Parameters
string$path
Returns
‪string

Definition at line 226 of file PathUtility.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Resource\Folder\addFile(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\addFile(), TYPO3\CMS\Core\Resource\ResourceStorage\addFile(), TYPO3\CMS\Frontend\Imaging\GifBuilder\checkTextObj(), TYPO3\CMS\Backend\Clipboard\Clipboard\confirmMsgText(), TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand\copyMultipleReferencedFiles(), TYPO3\CMS\Extensionmanager\Controller\ActionController\downloadExtensionZipAction(), TYPO3\CMS\Impexp\Command\ExportCommand\execute(), TYPO3\CMS\Impexp\Export\exportAddFile(), TYPO3\CMS\Impexp\Export\exportAddFilesFromRelations(), TYPO3\CMS\Impexp\Controller\ExportController\exportData(), TYPO3\CMS\Core\Resource\TextExtraction\PlainTextExtractor\extractText(), TYPO3\CMS\Core\Cache\Backend\FileBackend\get(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\get(), TYPO3\CMS\Core\Utility\CommandUtility\getConfiguredApps(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\getFolderInfoByIdentifier(), TYPO3\CMS\Install\UpgradeAnalysis\DocumentationFile\getListEntry(), TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser\getLocalizedFileName(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\getRole(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\getSpecificFileInformation(), TYPO3\CMS\Core\Cache\Backend\FileBackend\has(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\has(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\imageMagickConvert(), TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser\importExternalTypoScriptFile(), TYPO3\CMS\IndexedSearch\Indexer\indexRegularDocument(), TYPO3\CMS\Impexp\Import\processSoftReferencesSaveFile(), TYPO3\CMS\Impexp\Import\processSoftReferencesSaveFileCreateRelFile(), TYPO3\CMS\IndexedSearch\FileContentParser\readFileContent(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\recycleFileOrFolder(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\remove(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\requireOnce(), TYPO3\CMS\Core\Cache\Backend\FileBackend\requireOnce(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\retrieveFileAndFoldersInPath(), TYPO3\CMS\Core\Resource\ResourceFactory\retrieveFileOrFolderObject(), TYPO3\CMS\Core\Cache\Backend\FileBackend\set(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\set(), TYPO3\CMS\Frontend\Imaging\GifBuilder\start(), TYPO3\CMS\Belog\ViewHelpers\FormatDetailsViewHelper\stripPathFromFilenames(), and TYPO3\CMS\IndexedSearch\Indexer\submitFilePage().

◆ basenameDuringBootstrap()

static string TYPO3\CMS\Core\Utility\PathUtility::basenameDuringBootstrap (   $path)
static

Returns filename part of a path Early during bootstrap there is no TYPO3_CONF_VARS yet so the setting for the system locale is also unavailable. The filename part is determined with a regular expression to avoid issues with locales.

Parameters
string$path
Returns
‪string

Definition at line 364 of file PathUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\PathUtilityTest\basenameDuringBootstrapCorrectlyFetchesBasename().

◆ dirname()

static string TYPO3\CMS\Core\Utility\PathUtility::dirname (   $path)
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.

See also
http://www.php.net/manual/en/function.dirname.php
Parameters
string$path
Returns
‪string

Definition at line 251 of file PathUtility.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Impexp\ImportExport\addFiles(), TYPO3\CMS\Core\Utility\CommandUtility\checkCommand(), TYPO3\CMS\Core\Tests\Unit\Resource\ResourceCompressorTest\compressCssFileContent(), TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand\copyMultipleReferencedFiles(), TYPO3\CMS\Core\Log\Writer\FileWriter\createLogFile(), TYPO3\CMS\Core\Resource\ResourceCompressor\cssFixRelativeUrlPaths(), TYPO3\CMS\Impexp\Export\exportAddFile(), TYPO3\CMS\Core\Utility\CommandUtility\getConfiguredApps(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\getFileInfoByIdentifier(), TYPO3\CMS\Install\UpgradeAnalysis\DocumentationFile\getListEntry(), TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver\getParentFolderIdentifierOfIdentifier(), TYPO3\CMS\Core\Resource\ResourceStorage\getPublicUrl(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\getRecycleDirectory(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\gifCompress(), TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser\importExternalTypoScriptFile(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_loadLL(), TYPO3\CMS\Impexp\Import\processSoftReferencesSaveFile(), TYPO3\CMS\Impexp\Import\processSoftReferencesSaveFileCreateRelFile(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\renameFile(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\renameFolder(), TYPO3\CMS\Core\Resource\ResourceFactory\retrieveFileOrFolderObject(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\set_no_cache(), TYPO3\CMS\Impexp\Import\writeFileVerify(), and TYPO3\CMS\Impexp\Import\writeSysFileRecords().

◆ dirnameDuringBootstrap()

static string TYPO3\CMS\Core\Utility\PathUtility::dirnameDuringBootstrap (   $path)
static

Returns parent directory's path Early during bootstrap there is no TYPO3_CONF_VARS yet so the setting for the system locale is also unavailable. The path of the parent directory is determined with a regular expression to avoid issues with locales.

Parameters
string$path
Returns
‪string Path without trailing slash

Definition at line 349 of file PathUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\PathUtilityTest\dirnameDuringBootstrapCorrectlyFetchesParent(), and TYPO3\CMS\Core\Core\SystemEnvironmentBuilder\getRootPathFromScriptPath().

◆ getAbsolutePathOfRelativeReferencedFileOrPath()

static string TYPO3\CMS\Core\Utility\PathUtility::getAbsolutePathOfRelativeReferencedFileOrPath (   $baseFilenameOrPath,
  $includeFileName 
)
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.

See also
‪\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName()

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().

Parameters
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
Returns
‪string The (absolute) path of the include file

Definition at line 329 of file PathUtility.php.

Referenced by TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser\addImportsFromExternalFiles(), TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser\checkIncludeLines(), TYPO3\CMS\Core\Tests\Unit\Utility\PathUtilityTest\getAbsolutePathOfRelativeReferencedFileOrPathResolvesFileCorrectly(), and TYPO3\CMS\Core\Configuration\Loader\YamlFileLoader\getStreamlinedFileName().

◆ getAbsoluteWebPath()

static string TYPO3\CMS\Core\Utility\PathUtility::getAbsoluteWebPath (   $targetPath,
bool  $prefixWithSitePath = true 
)
static

Creates an absolute URL out of really any input path, removes '../' parts for the targetPath TODO: And this exactly is a big issue as it mixes file system paths with (relative) URLs TODO: Additionally it depends on the current request and can not do its job on CLI TODO: deprecate entirely and replace with stricter API

Until we have a replacement for this API, the safest way to call this method is by providing absolute filesystem paths and use \TYPO3\CMS\Core\Utility\PathUtility::getPublicResourceWebPath whenever possible.

Parameters
string$targetPath‪can be "../typo3conf/ext/myext/myfile.js" or "/myfile.js"
bool$prefixWithSitePath‪Don't use this argument. It is only used by TYPO3 in one place, which are subject to removal.
Returns
‪string something like "/mysite/typo3conf/ext/myext/myfile.js"

Definition at line 51 of file PathUtility.php.

References TYPO3\CMS\Core\Core\Environment\getComposerRootPath(), TYPO3\CMS\Core\Core\Environment\getCurrentScript(), TYPO3\CMS\Core\Core\Environment\getPublicPath(), TYPO3\CMS\Core\Core\Environment\isCli(), TYPO3\CMS\Core\Core\Environment\isComposerMode(), and TYPO3\CMS\Core\Utility\PathUtility\stripPathSitePrefix().

Referenced by TYPO3\CMS\Install\SystemEnvironment\ServerResponse\FileLocation\__construct(), TYPO3\CMS\Backend\Controller\Wizard\EditController\__construct(), TYPO3\CMS\Backend\Routing\UriBuilder\buildUri(), TYPO3\CMS\Fluid\ViewHelpers\Link\FileViewHelper\createFileDumpUrl(), TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController\func_refindex(), TYPO3\CMS\Core\Page\AssetRenderer\getAbsoluteWebPath(), TYPO3\CMS\Extensionmanager\Utility\ListUtility\getAvailableExtensions(), TYPO3\CMS\Install\Service\LanguagePackService\getExtensionLanguagePackDetails(), TYPO3\CMS\Core\Resource\ResourceCompressor\getFilenameFromMainDir(), TYPO3\CMS\Backend\Form\Utility\FormEngineUtility\getIconHtml(), TYPO3\CMS\Backend\Domain\Repository\TableManualRepository\getImages(), TYPO3\CMS\Core\Imaging\IconProvider\AbstractSvgIconProvider\getPublicPath(), TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider\getPublicPath(), TYPO3\CMS\Core\Utility\PathUtility\getPublicResourceWebPath(), TYPO3\CMS\Core\Resource\ResourceStorage\getPublicUrl(), TYPO3\CMS\Backend\Controller\AbstractFormEngineAjaxController\getRelativePathToStylesheetFile(), TYPO3\CMS\Backend\Domain\Repository\TableManualRepository\getSeeAlsoLinks(), TYPO3\CMS\Form\Slot\ResourcePublicationSlot\getStreamUrl(), TYPO3\CMS\Backend\View\AuthenticationStyleInformation\getUriForFileName(), TYPO3\CMS\Seo\XmlSitemap\XmlSitemapRenderer\getXslFilePath(), TYPO3\CMS\Reports\Controller\ReportController\indexAction(), TYPO3\CMS\IndexedSearch\Controller\SearchController\makeItemTypeIcon(), TYPO3\CMS\Frontend\Http\RequestHandler\processHtmlBasedRenderingSettings(), TYPO3\CMS\Backend\Controller\NewRecordController\renderNewRecordControls(), TYPO3\CMS\Frontend\ContentObject\ScalableVectorGraphicsContentObject\renderObject(), TYPO3\CMS\Backend\Controller\BackendController\renderTopbar(), and TYPO3\CMS\Install\Controller\BackendModuleController\setAuthorizedAndRedirect().

◆ getCanonicalPath()

◆ getCommonPrefix()

static string null TYPO3\CMS\Core\Utility\PathUtility::getCommonPrefix ( array  $paths)
static

Gets the common path prefix out of many paths.

  • ‪/var/www/domain.com/typo3/sysext/frontend/
  • ‪/var/www/domain.com/typo3/sysext/em/
  • ‪/var/www/domain.com/typo3/sysext/file/ = /var/www/domain.com/typo3/sysext/
Parameters
array$paths‪Paths to be processed
Returns
‪string|null

Definition at line 171 of file PathUtility.php.

References TYPO3\CMS\Core\Utility\PathUtility\sanitizeTrailingSeparator().

Referenced by TYPO3\CMS\Filelist\Controller\FileDownloadController\collectFiles(), TYPO3\CMS\Core\Log\Writer\FileWriter\createLogFile(), TYPO3\CMS\Core\Resource\StorageRepository\findBestMatchingStorageByLocalPath(), TYPO3\CMS\Core\Utility\PathUtility\getRelativePath(), and TYPO3\CMS\Core\Tests\Unit\Utility\PathUtilityTest\isCommonPrefixResolvedCorrectly().

◆ getPublicResourceWebPath()

static string TYPO3\CMS\Core\Utility\PathUtility::getPublicResourceWebPath ( string  $resourcePath,
bool  $prefixWithSitePath = true 
)
static

Dedicated method to resolve the path of public extension resources

This method should not be used for now except for TYPO3 core. It may be removed or be changed any time

Parameters
string$resourcePath
bool$prefixWithSitePath‪Don't use this argument. It is only used by TYPO3 in one place, which are subject to removal.
Returns
‪string

Definition at line 98 of file PathUtility.php.

References TYPO3\CMS\Core\Utility\PathUtility\getAbsoluteWebPath(), and TYPO3\CMS\Core\Core\Environment\getPublicPath().

Referenced by TYPO3\CMS\RteCKEditor\Hook\PageRendererRenderPreProcess\addRequireJsConfiguration(), TYPO3\CMS\T3editor\Hook\PageRendererRenderPreProcess\addRequireJsConfiguration(), TYPO3\CMS\IndexedSearch\Controller\SearchController\compileSingleResultRow(), TYPO3\CMS\Backend\Controller\File\ThumbnailController\generateThumbnail(), TYPO3\CMS\Backend\Template\ModuleTemplate\getBackendFavicon(), TYPO3\CMS\Backend\Controller\EditDocumentController\getCloseUrl(), TYPO3\CMS\Core\Resource\ResourceCompressor\getFilenameFromMainDir(), TYPO3\CMS\Backend\Backend\Avatar\Avatar\getImgTag(), TYPO3\CMS\Core\Imaging\IconProvider\AbstractSvgIconProvider\getPublicPath(), TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider\getPublicPath(), TYPO3\CMS\Core\Tests\UnitDeprecated\Utility\PathUtilityPublicPathsTest\getPublicResourceWebPathResolvesUrlsCorrectly(), TYPO3\CMS\Core\Tests\Unit\Utility\PathUtilityPublicPathsTest\getPublicResourceWebPathResolvesUrlsCorrectly(), TYPO3\CMS\Backend\Controller\AbstractFormEngineAjaxController\getRelativePathToStylesheetFile(), TYPO3\CMS\Backend\Template\ModuleTemplate\getUriForFileName(), TYPO3\CMS\Reports\Controller\ReportController\indexAction(), TYPO3\CMS\Install\Controller\LayoutController\initAction(), TYPO3\CMS\Install\Controller\InstallerController\initAction(), TYPO3\CMS\Frontend\Resource\FilePathSanitizer\makeRelative(), TYPO3\CMS\Dashboard\Controller\DashboardController\preparePageRenderer(), TYPO3\CMS\Core\ViewHelpers\NormalizedUrlViewHelper\renderStatic(), TYPO3\CMS\Fluid\ViewHelpers\Uri\ResourceViewHelper\renderStatic(), TYPO3\CMS\Core\Http\Security\ReferrerEnforcer\resolveAbsoluteWebPath(), TYPO3\CMS\RteCKEditor\Form\Element\RichTextElement\resolveUrlPath(), TYPO3\CMS\Core\Resource\ResourceFactory\retrieveFileOrFolderObject(), TYPO3\CMS\Core\Tests\Unit\Utility\PathUtilityPublicPathsTest\tryingToResolveNonExtensionResourcesThrowsException(), and TYPO3\CMS\Core\Tests\Unit\Utility\PathUtilityPublicPathsTest\tryingToResolvePrivateResourcesFromComposerPackagesThrowsException().

◆ getRelativePath()

static string null TYPO3\CMS\Core\Utility\PathUtility::getRelativePath (   $sourcePath,
  $targetPath 
)
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.

Parameters
string$sourcePath‪Absolute source path
string$targetPath‪Absolute target path
Returns
‪string|null

Definition at line 134 of file PathUtility.php.

References TYPO3\CMS\Core\Utility\PathUtility\getCommonPrefix(), and TYPO3\CMS\Core\Utility\PathUtility\sanitizeTrailingSeparator().

Referenced by TYPO3\CMS\Core\Utility\PathUtility\getRelativePathTo(), TYPO3\CMS\Core\Tests\Unit\Utility\PathUtilityTest\isRelativePathResolvedCorrectly(), TYPO3\CMS\Core\Resource\ResourceFactory\retrieveFileOrFolderObject(), and TYPO3\CMS\Core\Resource\ResourceCompressor\returnFileReference().

◆ getRelativePathTo()

static string null TYPO3\CMS\Core\Utility\PathUtility::getRelativePathTo (   $targetPath)
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.

Parameters
string$targetPath‪Absolute target path
Returns
‪string|null

Definition at line 33 of file PathUtility.php.

References TYPO3\CMS\Core\Core\Environment\getCurrentScript(), and TYPO3\CMS\Core\Utility\PathUtility\getRelativePath().

Referenced by TYPO3\CMS\Core\Resource\ResourceCompressor\getFilenameFromMainDir(), TYPO3\CMS\Core\Resource\ResourceStorage\getPublicUrl(), and TYPO3\CMS\Backend\Controller\AbstractFormEngineAjaxController\getRelativePathToStylesheetFile().

◆ hasProtocolAndScheme()

static bool TYPO3\CMS\Core\Utility\PathUtility::hasProtocolAndScheme ( string  $path)
static

◆ isAbsolutePath()

◆ isAllowedAdditionalPath()

static TYPO3\CMS\Core\Utility\PathUtility::isAllowedAdditionalPath ( string  $path)
static

Evaluates a given path against the optional settings in ‘$GLOBALS['TYPO3_CONF_VARS’]['BE']['lockRootPath']. Albeit the nameBE/lockRootPath` is misleading, this setting was and is used in general and is not limited to the backend-scope. The setting actually allows defining additional paths, besides the project root path.

Parameters
string$path‪Absolute path to a file or directory

Definition at line 475 of file PathUtility.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\PathUtility\sanitizeTrailingSeparator().

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\PathUtilityTest\allowedAdditionalPathsAreEvaluated().

◆ isExtensionPath()

static bool TYPO3\CMS\Core\Utility\PathUtility::isExtensionPath ( string  $path)
static

Checks whether the given path is an extension resource

Parameters
string$path
Returns
‪bool

Definition at line 121 of file PathUtility.php.

Referenced by TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addModule(), TYPO3\CMS\Form\Mvc\Property\PropertyMappingConfiguration\checkSaveFileMountAccess(), TYPO3\CMS\Core\Configuration\Loader\PageTsConfigLoader\collect(), TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider\generateInlineMarkup(), TYPO3\CMS\Core\Imaging\IconProvider\SvgSpriteIconProvider\generateInlineMarkup(), TYPO3\CMS\Core\Resource\ResourceCompressor\getFilenameFromMainDir(), TYPO3\CMS\Core\Imaging\IconProvider\AbstractSvgIconProvider\getPublicPath(), TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider\getPublicPath(), TYPO3\CMS\Backend\Controller\AbstractFormEngineAjaxController\getRelativePathToStylesheetFile(), TYPO3\CMS\Core\Configuration\Loader\YamlFileLoader\getStreamlinedFileName(), TYPO3\CMS\Backend\Template\ModuleTemplate\getUriForFileName(), TYPO3\CMS\Core\TypoScript\TemplateService\includeStaticTypoScriptSources(), TYPO3\CMS\Form\Controller\FormEditorController\indexAction(), TYPO3\CMS\Reports\Controller\ReportController\indexAction(), TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager\load(), TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager\loadMetaData(), TYPO3\CMS\Core\Localization\LocalizationFactory\localizationOverride(), TYPO3\CMS\Form\SoftReference\FormPersistenceIdentifierSoftReferenceParser\parse(), TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager\pathIsIntendedAsExtensionPath(), TYPO3\CMS\Form\Hooks\FormPagePreviewRenderer\renderPageModulePreviewContent(), TYPO3\CMS\RteCKEditor\Form\Element\RichTextElement\replaceAbsolutePathsToRelativeResourcesPath(), TYPO3\CMS\Fluid\ViewHelpers\Uri\ResourceViewHelper\resolveExtensionPath(), TYPO3\CMS\Frontend\Resource\FilePathSanitizer\sanitize(), TYPO3\CMS\Core\Localization\LanguageStore\setConfiguration(), TYPO3\CMS\Core\Localization\LanguageService\sL(), and TYPO3\CMS\Form\Service\TranslationService\translate().

◆ pathinfo()

◆ sanitizeTrailingSeparator()

static string TYPO3\CMS\Core\Utility\PathUtility::sanitizeTrailingSeparator (   $path,
  $separator = '/' 
)
static

◆ stripPathSitePrefix()

static string TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix (   $path)
static

Strip first part of a path, equal to the length of public web path including trailing slash

Parameters
string$path
Returns
‪string

Definition at line 445 of file PathUtility.php.

References TYPO3\CMS\Core\Core\Environment\getPublicPath().

Referenced by TYPO3\CMS\Frontend\Resource\FilePathSanitizer\__construct(), TYPO3\CMS\Impexp\ImportExport\addFiles(), TYPO3\CMS\Core\Resource\ResourceCompressor\compressCssFile(), TYPO3\CMS\Lowlevel\Command\FilesWithMultipleReferencesCommand\copyMultipleReferencedFiles(), TYPO3\CMS\Core\Resource\ResourceCompressor\createMergedFile(), TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\createVersionNumberedFilenameKeepsInvalidAbsolutePathInFrontendAndAddsQueryString(), TYPO3\CMS\Core\Utility\DebugUtility\debugTrail(), TYPO3\CMS\Core\Resource\Driver\LocalDriver\determineBaseUrl(), TYPO3\CMS\Install\Service\CoreUpdateService\downloadVersion(), TYPO3\CMS\Impexp\Export\exportAddFile(), TYPO3\CMS\Impexp\Export\fixFileIdInRelations(), TYPO3\CMS\Core\Utility\PathUtility\getAbsoluteWebPath(), TYPO3\CMS\Core\Resource\ResourceFactory\getFolderObjectFromCombinedIdentifier(), TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility\getRelativePath(), TYPO3\CMS\Extensionmanager\Utility\InstallUtility\importInitialFiles(), TYPO3\CMS\Extensionmanager\Utility\InstallUtility\importStaticSqlFile(), TYPO3\CMS\Extensionmanager\Utility\InstallUtility\importT3DFile(), TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\InstallUtilityTest\importT3DFileDoesNotImportFileIfAlreadyImported(), TYPO3\CMS\Frontend\Resource\FilePathSanitizer\makeRelative(), TYPO3\CMS\Impexp\Import\processSoftReferencesSaveFileCreateRelFile(), TYPO3\CMS\Extensionmanager\Controller\ActionController\reloadExtensionDataAction(), TYPO3\CMS\Extensionmanager\ViewHelpers\ReloadSqlDataViewHelper\render(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\setAbsRefPrefix(), and TYPO3\CMS\Install\Service\CoreUpdateService\unpackVersion().