RelativeCssPathFixer

class \TYPO3\CMS\Core\Resource\RelativeCssPathFixer

This fixes import paths in CSS files if their location changes, e.g. when inlining or compressing css

Table of Contents

Methods

__construct()  : mixed
fixRelativeUrlPaths()  : string
Fixes the relative paths inside of url() references in CSS files
findAndReplaceUrlPathsByRegex()  : string
Finds and replaces all URLs by using a given regex
resolveBackPath()  : string
Resolves "../" sections in the input path string.

Methods

fixRelativeUrlPaths()

Fixes the relative paths inside of url() references in CSS files

public fixRelativeUrlPaths(string $contents, string $newDir, ServerRequestInterface $request) : string

Parameters

$contents : string

Data to process

$newDir : string

directory referenced from current location

$request : ServerRequestInterface

Return values

string —

Processed data

findAndReplaceUrlPathsByRegex()

Finds and replaces all URLs by using a given regex

protected findAndReplaceUrlPathsByRegex(string $contents, string $regex, string $newDir, string $wrap, ServerRequestInterface $request) : string

Parameters

$contents : string

Data to process

$regex : string

Regex used to find URLs in content

$newDir : string

Path to prepend to the original file

$wrap : string

Wrap around replaced values

$request : ServerRequestInterface

Return values

string —

Processed data

resolveBackPath()

Resolves "../" sections in the input path string.

protected resolveBackPath(string $pathStr) : string

For example "fileadmin/directory/../other_directory/" will be resolved to "fileadmin/other_directory/"

Parameters

$pathStr : string

File path in which "/../" is resolved

Return values

string
On this page