Merge pull request #40 from cornelles/validate-text-font-family

Fixing font-family regex pattern when validating text
pull/42/head
Frode Petterson 2017-07-26 10:03:20 +02:00 committed by GitHub
commit b6019ade21
1 changed files with 1 additions and 1 deletions

View File

@ -3163,7 +3163,7 @@ class H5PContentValidator {
$stylePatterns[] = '/^font-size: *[0-9.]+(em|px|%) *;?$/i'; $stylePatterns[] = '/^font-size: *[0-9.]+(em|px|%) *;?$/i';
} }
if (isset($semantics->font->family) && $semantics->font->family) { if (isset($semantics->font->family) && $semantics->font->family) {
$stylePatterns[] = '/^font-family: *[a-z0-9," ]+;?$/i'; $stylePatterns[] = '/^font-family: *[-a-z0-9," ]+;?$/i';
} }
if (isset($semantics->font->color) && $semantics->font->color) { if (isset($semantics->font->color) && $semantics->font->color) {
$stylePatterns[] = '/^color: *(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\)) *;?$/i'; $stylePatterns[] = '/^color: *(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\)) *;?$/i';