Validates a font family list according to CSS spec.
More...
Validates a font family list according to CSS spec.
Definition at line 6 of file FontFamily.php.
◆ __construct()
HTMLPurifier_AttrDef_CSS_FontFamily::__construct |
( |
| ) |
|
Definition at line 11 of file FontFamily.php.
References $i.
14 for ($c =
'a'; $c <=
'z'; $c++) {
17 for ($c =
'A'; $c <=
'Z'; $c++) {
20 for ($c =
'0'; $c <=
'9'; $c++) {
24 for (
$i = 0x80;
$i <= 0xFF;
$i++) {
28 $this->mask .= chr(
$i);
◆ validate()
HTMLPurifier_AttrDef_CSS_FontFamily::validate |
( |
|
$string, |
|
|
|
$config, |
|
|
|
$context |
|
) |
| |
- Parameters
-
- Returns
- bool|string
Definition at line 55 of file FontFamily.php.
References $config, $fonts, array, and HTMLPurifier_AttrDef\expandCSSEscape().
57 static $generic_names =
array(
64 $allowed_fonts =
$config->get(
'CSS.AllowedFonts');
67 $fonts = explode(
',', $string);
69 foreach (
$fonts as $font) {
75 if (isset($generic_names[$font])) {
76 if ($allowed_fonts === null || isset($allowed_fonts[$font])) {
77 $final .= $font .
', ';
82 if ($font[0] ===
'"' || $font[0] ===
"'") {
83 $length = strlen($font);
88 if ($font[$length - 1] !== $quote) {
91 $font = substr($font, 1, $length - 2);
98 if ($allowed_fonts !== null && !isset($allowed_fonts[$font])) {
102 if (ctype_alnum($font) && $font !==
'') {
104 $final .= $font .
', ';
110 $font = str_replace(
array(
"\n",
"\t",
"\r",
"\x0C"),
' ', $font);
191 if (strspn($font, $this->mask) !== strlen($font)) {
208 $final .=
"'$font', ";
210 $final = rtrim($final,
', ');
expandCSSEscape($string)
Parses a possibly escaped CSS string and returns the "pure" version of it.
Create styles array
The data for the language used.
◆ $mask
HTMLPurifier_AttrDef_CSS_FontFamily::$mask = null |
|
protected |
The documentation for this class was generated from the following file:
- libs/composer/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/FontFamily.php