PHP Класс Minify_CSS_UriRewriter, minify

Автор: Stephen Clay ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$debugText string rewrite() and rewriteRelative() append debugging information here

Защищенные свойства (Protected)

Свойство Тип Описание
$className string Defines which class to call as part of callbacks, change this if you extend Minify_CSS_UriRewriter

Открытые методы

Метод Описание
prepend ( string $css, string $path ) : string In CSS content, prepend a path to relative URIs
removeDots ( string $uri ) : string Remove instances of "./" and ".
rewrite ( string $css, string $currentDir, string $docRoot = null, array $symlinks = [] ) : string In CSS content, rewrite file relative URIs as root relative
rewriteRelative ( string $uri, string $realCurrentDir, string $realDocRoot, array $symlinks = [] ) : string Get a root relative URI from a file relative URI

Защищенные методы

Метод Описание
_realpath ( string $path ) : mixed Get realpath with any trailing slash removed. If realpath() fails, just remove the trailing slash.

Приватные методы

Метод Описание
_owlifySvgPaths ( string $css ) : string Mungs some inline SVG URL declarations so they won't be touched
_processUriCB ( array $m ) : string
_trimUrls ( string $css ) : string
_unOwlify ( string $css ) : string Undo work of _owlify

Описание методов

_realpath() защищенный статический Метод

Get realpath with any trailing slash removed. If realpath() fails, just remove the trailing slash.
protected static _realpath ( string $path ) : mixed
$path string
Результат mixed path with no trailing slash

prepend() публичный статический Метод

In CSS content, prepend a path to relative URIs
public static prepend ( string $css, string $path ) : string
$css string
$path string The path to prepend.
Результат string

removeDots() публичный статический Метод

./" where possible from a root-relative URI
public static removeDots ( string $uri ) : string
$uri string
Результат string

rewrite() публичный статический Метод

In CSS content, rewrite file relative URIs as root relative
public static rewrite ( string $css, string $currentDir, string $docRoot = null, array $symlinks = [] ) : string
$css string
$currentDir string The directory of the current CSS file.
$docRoot string The document root of the web site in which the CSS file resides (default = $_SERVER['DOCUMENT_ROOT']).
$symlinks array (default = array()) If the CSS file is stored in a symlink-ed directory, provide an array of link paths to target paths, where the link paths are within the document root. Because paths need to be normalized for this to work, use "//" to substitute the doc root in the link paths (the array keys). E.g.: array('//symlink' => '/real/target/path') // unix array('//static' => 'D:\\staticStorage') // Windows
Результат string

rewriteRelative() публичный статический Метод

Minify_CSS_UriRewriter::rewriteRelative( '../img/hello.gif' , '/home/user/www/css' // path of CSS file , '/home/user/www' // doc root ); returns '/img/hello.gif' example where static files are stored in a symlinked directory Minify_CSS_UriRewriter::rewriteRelative( 'hello.gif' , '/var/staticFiles/theme' , '/home/user/www' , array('/home/user/www/static' => '/var/staticFiles') ); returns '/static/theme/hello.gif'
public static rewriteRelative ( string $uri, string $realCurrentDir, string $realDocRoot, array $symlinks = [] ) : string
$uri string file relative URI
$realCurrentDir string realpath of the current file's directory.
$realDocRoot string realpath of the site document root.
$symlinks array (default = array()) If the file is stored in a symlink-ed directory, provide an array of link paths to real target paths, where the link paths "appear" to be within the document root. E.g.: array('/home/foo/www/not/real/path' => '/real/target/path') // unix array('C:\\htdocs\\not\\real' => 'D:\\real\\target\\path') // Windows
Результат string

Описание свойств

$className защищенное статическое свойство

Defines which class to call as part of callbacks, change this if you extend Minify_CSS_UriRewriter
protected static string $className
Результат string

$debugText публичное статическое свойство

rewrite() and rewriteRelative() append debugging information here
public static string $debugText
Результат string