Allowing text-align on wysiwygs [HPN-115]
parent
47d0f830d3
commit
cb59b9b79f
|
@ -2536,6 +2536,7 @@ class H5PContentValidator {
|
||||||
public $h5pF;
|
public $h5pF;
|
||||||
public $h5pC;
|
public $h5pC;
|
||||||
private $typeMap, $libraries, $dependencies, $nextWeight;
|
private $typeMap, $libraries, $dependencies, $nextWeight;
|
||||||
|
private static $allowed_stylable_tags = array('span', 'p', 'div');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the H5PContentValidator
|
* 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.
|
// Strip invalid HTML tags.
|
||||||
$text = $this->filter_xss($text, $tags, $stylePatterns);
|
$text = $this->filter_xss($text, $tags, $stylePatterns);
|
||||||
}
|
}
|
||||||
|
@ -3159,7 +3163,8 @@ class H5PContentValidator {
|
||||||
$xhtml_slash = $count ? ' /' : '';
|
$xhtml_slash = $count ? ' /' : '';
|
||||||
|
|
||||||
// Clean up attributes.
|
// 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 = preg_replace('/[<>]/', '', $attr2);
|
||||||
$attr2 = strlen($attr2) ? ' ' . $attr2 : '';
|
$attr2 = strlen($attr2) ? ' ' . $attr2 : '';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue