RelativeCssPathFixer

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

Internal

This class is not part of the TYPO3 API.

Table of Contents

Methods

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) : string
Parameters
$contents : string

Data to process

$newDir : string

directory referenced from current location

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 = '|' ]) : 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

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

Search results