diff --git a/h5p.classes.php b/h5p.classes.php index 4b88008..3a754f0 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -2536,6 +2536,7 @@ class H5PContentValidator { public $h5pF; public $h5pC; private $typeMap, $libraries, $dependencies, $nextWeight; + private static $allowed_stylable_tags = array('span', 'p', 'div'); /** * Constructor for the H5PContentValidator @@ -2625,6 +2626,9 @@ class H5PContentValidator { } } + // Aligment is allowed for all wysiwyg texts + $stylePatterns[] = '/^text-align: *(center|left|right);?$/i'; + // Strip invalid HTML tags. $text = $this->filter_xss($text, $tags, $stylePatterns); } @@ -3159,7 +3163,8 @@ class H5PContentValidator { $xhtml_slash = $count ? ' /' : ''; // Clean up attributes. - $attr2 = implode(' ', $this->_filter_xss_attributes($attrlist, ($elem === 'span' ? $this->allowedStyles : FALSE))); + + $attr2 = implode(' ', $this->_filter_xss_attributes($attrlist, (in_array($elem, self::$allowed_stylable_tags) ? $this->allowedStyles : FALSE))); $attr2 = preg_replace('/[<>]/', '', $attr2); $attr2 = strlen($attr2) ? ' ' . $attr2 : ''; diff --git a/js/h5p-resizer.js b/js/h5p-resizer.js index a1cf418..ab35e19 100644 --- a/js/h5p-resizer.js +++ b/js/h5p-resizer.js @@ -74,7 +74,7 @@ }; /** - * Keyup event handler. Exits full screen on escape.asdasd a + * Keyup event handler. Exits full screen on escape. * * @param {Event} event */