PHP Class CSSmin, vip-mu-plugins-public

The copyrights embodied in the content of this file are licensed by Yahoo! Inc. under the BSD (revised) open source license.
Afficher le fichier Open project: Automattic/vip-mu-plugins-public Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( boolean | integer $raise_php_limits = TRUE )
run ( string $css = '', integer | boolean $linebreak_pos = FALSE ) : string Minify a string of CSS
set_max_execution_time ( integer | string $seconds ) Sets the maximum execution time for this script
set_memory_limit ( integer | string $limit ) Sets the memory limit for this script
set_pcre_backtrack_limit ( integer $limit ) Sets the PCRE backtrack limit for this script
set_pcre_recursion_limit ( integer $limit ) Sets the PCRE recursion limit for this script

Private Methods

Méthode Description
clamp_number ( $n, $min, $max )
compress_hex_colors ( string $css ) : string Utility method to compress hex color values of the form #AABBCC to #ABC or short color name.
do_raise_php_limits ( ) Try to configure PHP to use at least the suggested minimum settings
extract_data_urls ( string $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.
hsl_to_hex ( $matches )
hue_to_rgb ( $v1, $v2, $vh ) * HELPERS ---------------------------------------------------------------------------------------------
index_of ( string $haystack, string $needle, integer $offset ) : integer PHP port of Javascript's "indexOf" function for strings only Author: Tubal Martin http://blog.margenn.com
lowercase_common_functions ( $matches )
lowercase_common_functions_values ( $matches )
lowercase_directives ( $matches )
lowercase_properties ( $matches )
lowercase_pseudo_elements ( $matches )
lowercase_pseudo_first ( $matches )
minify ( string $css, integer | boolean $linebreak_pos ) : string Does bulk of the minification
normalize_int ( mixed $size ) : integer Convert strings like "64M" or "30" to int values
preserve_old_IE_specific_matrix_definition ( $matches )
replace_calc ( $matches )
replace_colon ( $matches )
replace_keyframe_zero ( $matches )
replace_string ( $matches ) * CALLBACKS ---------------------------------------------------------------------------------------------
rgb_to_hex ( $matches )
round_number ( $n )
str_slice ( string $str, integer $start, integer | boolean $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/

Method Details

__construct() public méthode

public __construct ( boolean | integer $raise_php_limits = TRUE )
$raise_php_limits boolean | integer If true, PHP settings will be raised if needed

run() public méthode

Minify a string of CSS
public run ( string $css = '', integer | boolean $linebreak_pos = FALSE ) : string
$css string
$linebreak_pos integer | boolean
Résultat string

set_max_execution_time() public méthode

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

set_memory_limit() public méthode

Sets the memory limit for this script
public set_memory_limit ( integer | string $limit )
$limit integer | string

set_pcre_backtrack_limit() public méthode

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

set_pcre_recursion_limit() public méthode

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