\Hazaar\Controller\Response\Packer
CSSmin
Summary
Methods Properties Constants
run
NL
Constants
CLASSCOLON
CLASSCOLON
COMMENT
COMMENT
NL
NL
QUERY_FRACTION
QUERY_FRACTION
TOKEN
TOKEN
Properties
$comments
$comments
$max_execution_time
$max_execution_time
$memory_limit
$memory_limit
$pcre_backtrack_limit
$pcre_backtrack_limit
$pcre_recursion_limit
$pcre_recursion_limit
$preserved_tokens
$preserved_tokens
$raise_php_limits
$raise_php_limits
$remove_last_semicolon
$remove_last_semicolon
Methods
__construct()
__construct($raise_php_limits = true, $remove_last_semicolon = true)

Parameters

$raise_php_limits\Hazaar\Controller\Response\Packer\bool|int

If true, PHP settings will be raised if needed

$remove_last_semicolon

No description

clamp_number()
clamp_number($n, $min, $max)

Parameters

$n

No description

$min

No description

$max

No description

compress_hex_colors()
compress_hex_colors($css) : string
Utility method to compress hex color values of the form #AABBCC to #ABC or short color name.

DOES NOT compress CSS ID selectors which match the above pattern (which would break things). e.g. #AddressForm { … }

DOES NOT compress IE filters, which have hex color values (which would break things). e.g. filter: chroma(color=”#FFFFFF”);

DOES NOT compress invalid hex values. e.g. background-color: #aabbccdd

Parameters

$cssstring

No description

Returns

string
do_raise_php_limits()
do_raise_php_limits()
Try to configure PHP to use at least the suggested minimum settings
extract_data_urls()
extract_data_urls($css) : string
Utility method to replace all data urls with tokens before we start

compressing, to avoid performance issues running some of the subsequent regexes against large strings chunks.

Parameters

$cssstring

No description

Returns

string
hsl_to_hex()
hsl_to_hex($matches)

Parameters

$matches

No description

hue_to_rgb()
hue_to_rgb($v1, $v2, $vh)

Parameters

$v1

No description

$v2

No description

$vh

No description

index_of()
index_of($haystack, $needle, $offset = 0) : int
PHP port of Javascript's "indexOf" function for strings only

Author: Tubal Martin http://blog.margenn.com

Parameters

$haystackstring

No description

$needlestring

No description

$offsetint

index (optional)

Returns

int
lowercase_common_functions()
lowercase_common_functions($matches)

Parameters

$matches

No description

lowercase_common_functions_values()
lowercase_common_functions_values($matches)

Parameters

$matches

No description

lowercase_directives()
lowercase_directives($matches)

Parameters

$matches

No description

lowercase_properties()
lowercase_properties($matches)

Parameters

$matches

No description

lowercase_pseudo_elements()
lowercase_pseudo_elements($matches)

Parameters

$matches

No description

lowercase_pseudo_first()
lowercase_pseudo_first($matches)

Parameters

$matches

No description

minify()
minify($css, $linebreak_pos) : string
Does bulk of the minification

Parameters

$cssstring

No description

$linebreak_pos\Hazaar\Controller\Response\Packer\int|bool

No description

Returns

string
normalize_int()
normalize_int($size) : int
Convert strings like "64M" or "30" to int values

Parameters

$sizemixed

No description

Returns

int
replace_calc()
replace_calc($matches)

Parameters

$matches

No description

replace_colon()
replace_colon($matches)

Parameters

$matches

No description

replace_string()
replace_string($matches)

Parameters

$matches

No description

rgb_to_hex()
rgb_to_hex($matches)

Parameters

$matches

No description

round_number()
round_number($n)

Parameters

$n

No description

run()
run($css = '', $linebreak_pos = false) : string
Minify a string of CSS

Parameters

$cssstring

No description

$linebreak_pos\Hazaar\Controller\Response\Packer\int|bool

No description

Returns

string
set_max_execution_time()
set_max_execution_time($seconds)
Sets the maximum execution time for this script

Parameters

$seconds\Hazaar\Controller\Response\Packer\int|string

No description

set_memory_limit()
set_memory_limit($limit)
Sets the memory limit for this script

Parameters

$limit\Hazaar\Controller\Response\Packer\int|string

No description

set_pcre_backtrack_limit()
set_pcre_backtrack_limit($limit)
Sets the PCRE backtrack limit for this script

Parameters

$limitint

No description

set_pcre_recursion_limit()
set_pcre_recursion_limit($limit)
Sets the PCRE recursion limit for this script

Parameters

$limitint

No description

str_slice()
str_slice($str, $start = 0, $end = false) : string
PHP port of Javascript's "slice" function for strings only

Author: Tubal Martin http://blog.margenn.com Tests: http://margenn.com/tubal/str_slice/

Parameters

$strstring

No description

$startint

index

$end\Hazaar\Controller\Response\Packer\int|bool

index (optional)

Returns

string