Add documentation regarding stylePatterns

pull/25/head
Svein-Tore Griff With 2016-07-15 15:33:11 +02:00 committed by GitHub
parent 3d14588160
commit 43748bc4b8
1 changed files with 2 additions and 0 deletions

View File

@ -2863,6 +2863,7 @@ class H5PContentValidator {
// Determine allowed style tags // Determine allowed style tags
$stylePatterns = array(); $stylePatterns = array();
// All styles must be start to end patterns (^...$)
if (isset($semantics->font)) { if (isset($semantics->font)) {
if (isset($semantics->font->size) && $semantics->font->size) { if (isset($semantics->font->size) && $semantics->font->size) {
$stylePatterns[] = '/^font-size: *[0-9.]+(em|px|%) *;?$/i'; $stylePatterns[] = '/^font-size: *[0-9.]+(em|px|%) *;?$/i';
@ -3519,6 +3520,7 @@ class H5PContentValidator {
// Allow certain styles // Allow certain styles
foreach ($allowedStyles as $pattern) { foreach ($allowedStyles as $pattern) {
if (preg_match($pattern, $match[1])) { if (preg_match($pattern, $match[1])) {
// All patterns are start to end patterns, and CKEditor adds one span per style
$attrArr[] = 'style="' . $match[1] . '"'; $attrArr[] = 'style="' . $match[1] . '"';
break; break;
} }