62 $string = trim($string);
63 $string = str_replace(array(
"\n",
"\t",
"\r"),
' ', $string);
72 public function make($string)
89 $p =
'\s*(\d+(\.\d+)?([%]?))\s*';
91 if (preg_match(
'/(rgba|hsla)\(/', $string)) {
92 return preg_replace(
'/(rgba|hsla)\('.$p.
','.$p.
','.$p.
','.$p.
'\)/',
'\1(\2,\5,\8,\11)', $string);
95 return preg_replace(
'/(rgb|hsl)\('.$p.
','.$p.
','.$p.
'\)/',
'\1(\2,\5,\8)', $string);
106 for (
$i = 0,
$c = strlen($string);
$i <
$c;
$i++) {
107 if ($string[
$i] ===
'\\') {
113 if (ctype_xdigit($string[
$i])) {
115 for ($a = 1, $i++; $i < $c && $a < 6; $i++, $a++) {
116 if (!ctype_xdigit($string[$i])) {
129 if ($i < $c && trim($string[$i]) !==
'') {
134 if ($string[$i] ===
"\n") {
Base class for all validating attribute definitions.
static unichr($code)
Translates a Unicode codepoint into its corresponding UTF-8 character.
static cleanUTF8($str, $force_php=false)
Cleans a UTF-8 string for well-formedness and SGML validity.
validate($string, $config, $context)
Validates and cleans passed string according to a definition.
make($string)
Factory method for creating this class from a string.
parseCDATA($string)
Convenience method that parses a string as if it were CDATA.
expandCSSEscape($string)
Parses a possibly escaped CSS string and returns the "pure" version of it.
$minimized
Tells us whether or not an HTML attribute is minimized.
$required
Tells us whether or not an HTML attribute is required.
mungeRgb($string)
Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work properly.