MediaWiki
1.23.5
|
Transforms CSS data. More...
Static Public Member Functions | |
static | buildUrlValue ( $url) |
Build a CSS 'url()' value for the given URL, quoting parentheses (and other funny characters) and escaping quotes as necessary. More... | |
static | encodeImageAsDataURI ( $file, $type=null, $sizeLimit=self::EMBED_SIZE_LIMIT) |
Encode an image file as a base64 data URI. More... | |
static | getLocalFileReferences ( $source, $path=null) |
Gets a list of local file paths which are referenced in a CSS style sheet. More... | |
static | getMimeType ( $file) |
static | minify ( $css) |
Removes whitespace from CSS data. More... | |
static | remap ( $source, $local, $remote, $embedData=true) |
Remaps CSS URL paths and automatically embeds data URIs for CSS rules or url() values preceded by an / * @embed * / comment. More... | |
static | remapOne ( $file, $query, $local, $remote, $embed) |
Remap or embed a CSS URL path. More... | |
Public Attributes | |
const | EMBED_REGEX = '\/\*\s*\@embed\s*\*\/' |
const | EMBED_SIZE_LIMIT = 24576 |
Maximum file size to still qualify for in-line embedding as a data-URI. More... | |
const | URL_REGEX = 'url\(\s*[\'"]?(?P<file>[^\?\)\'"]*?)(?P<query>\?[^\)\'"]*?|)[\'"]?\s*\)' |
Static Protected Attributes | |
static | $mimeTypes |
Transforms CSS data.
This class provides minification, URL remapping, URL extracting, and data-URL embedding.
Definition at line 30 of file CSSMin.php.
|
static |
Build a CSS 'url()' value for the given URL, quoting parentheses (and other funny characters) and escaping quotes as necessary.
string | $url | URL to process |
"url($url)"
, quoted/escaped if necessary Definition at line 166 of file CSSMin.php.
References array().
Referenced by remap(), and CSSMinTest\testBuildUrlValue().
|
static |
Encode an image file as a base64 data URI.
If the image file has a suitable MIME type and size, encode it as a base64 data URI. Return false if the image type is unfamiliar or exceeds the size limit.
string | $file | Image file to encode. |
string | null | $type | File's MIME type or null. If null, CSSMin will try to autodetect the type. |
int | bool | $sizeLimit | If the size of the target file is greater than this value, decline to encode the image file and return false instead. If $sizeLimit is false, no limit is enforced. |
Definition at line 115 of file CSSMin.php.
References $file, $type, and getMimeType().
Referenced by ResourceLoaderLESSFunctions\embed(), and remapOne().
|
static |
Gets a list of local file paths which are referenced in a CSS style sheet.
This function will always return an empty array if the second parameter is not given or null for backwards-compatibility.
string | $source | CSS data to remap |
string | $path | File path where the source was read from (optional) |
Definition at line 71 of file CSSMin.php.
References $file, $files, $matches, $path, $source, array(), and as.
Referenced by ResourceLoaderFileModule\readStyleFile().
|
static |
$file | string |
Definition at line 133 of file CSSMin.php.
Referenced by ResourceLoaderLESSFunctions\embeddable(), and encodeImageAsDataURI().
|
static |
Removes whitespace from CSS data.
string | $css | CSS data to minify |
Definition at line 306 of file CSSMin.php.
Referenced by ResourceLoader\filter(), MinifyScript\minify(), CSSMinTest\testMinify(), and ResourcesTest\testStyleMedia().
|
static |
Remaps CSS URL paths and automatically embeds data URIs for CSS rules or url() values preceded by an / * @embed * / comment.
string | $source | CSS data to remap |
string | $local | File path where the source was read from |
string | $remote | URL path to the file |
bool | $embedData | If false, never do any data URI embedding, even if / * @embed * / is found |
Definition at line 187 of file CSSMin.php.
References $source, buildUrlValue(), EMBED_REGEX, remapOne(), and URL_REGEX.
Referenced by WebInstallerOutput\getCSS(), ResourceLoaderWikiModule\getStyles(), ResourceLoaderFileModule\readStyleFile(), and CSSMinTest\testRemapRemapping().
|
static |
Remap or embed a CSS URL path.
string | $file | URL to remap/embed |
string | $query | |
string | $local | File path where the source was read from |
string | $remote | URL path to the file |
bool | $embed | Whether to do any data URI embedding |
Definition at line 253 of file CSSMin.php.
References $file, $query, encodeImageAsDataURI(), PROTO_RELATIVE, and wfExpandUrl().
Referenced by remap().
|
staticprotected |
Definition at line 47 of file CSSMin.php.
const CSSMin::EMBED_REGEX = '\/\*\s*\@embed\s*\*\/' |
Definition at line 42 of file CSSMin.php.
Referenced by remap().
const CSSMin::EMBED_SIZE_LIMIT = 24576 |
Maximum file size to still qualify for in-line embedding as a data-URI.
24,576 is used because Internet Explorer has a 32,768 byte limit for data URIs, which when base64 encoded will result in a 1/3 increase in size.
Definition at line 40 of file CSSMin.php.
Referenced by ResourceLoaderLESSFunctions\embeddable().
Definition at line 41 of file CSSMin.php.
Referenced by remap().