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);
55 public function validate($string, $config, $context)
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,
', ');