forked from Wavyzz/dolibarr
Fix phpunit
This commit is contained in:
@@ -7384,11 +7384,20 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
|
||||
*
|
||||
* @see dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_onlythesehtmltags() dol_string_neverthesehtmltags()
|
||||
*/
|
||||
function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes = array("allow", "allowfullscreen", "alt", "class", "contenteditable", "data-html", "frameborder", "height", "href", "id", "name", "src", "style", "target", "title", "width"))
|
||||
function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes = null)
|
||||
{
|
||||
if (is_null($allowed_attributes)) {
|
||||
$allowed_attributes = array(
|
||||
"allow", "allowfullscreen", "alt", "class", "contenteditable", "data-html", "frameborder", "height", "href", "id", "name", "src", "style", "target", "title", "width",
|
||||
// HTML5
|
||||
"header", "footer", "nav", "section", "menu", "menuitem"
|
||||
);
|
||||
}
|
||||
|
||||
if (class_exists('DOMDocument') && !empty($stringtoclean)) {
|
||||
$stringtoclean = '<?xml encoding="UTF-8"><html><body>'.$stringtoclean.'</body></html>';
|
||||
|
||||
// Warning: loadHTML does not support HTML5 on old libxml versions.
|
||||
$dom = new DOMDocument(null, 'UTF-8');
|
||||
$dom->loadHTML($stringtoclean, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user