From 2c8a35d49416c90b3f5087327a410492730610bc Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 8 Mar 2023 20:23:42 +0100 Subject: [PATCH] [HtmlSanitizer] Fix API usage on PHP config files --- html_sanitizer.rst | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/html_sanitizer.rst b/html_sanitizer.rst index 429e4feef5e..d5dbf99fa81 100644 --- a/html_sanitizer.rst +++ b/html_sanitizer.rst @@ -364,16 +364,13 @@ attributes from the `W3C Standard Proposal`_ are allowed. $framework->htmlSanitizer() ->sanitizer('app.post_sanitizer') // allow the
element and 2 attributes - ->allowElement('article') - ->attribute('class') - ->attribute('data-attr') + ->allowElement('article', ['class', 'data-attr']) // allow the element and preserve the src attribute - ->allowElement('img') - ->attribute('src') + ->allowElement('img', 'src') // allow the

element with all safe attributes - ->allowElement('h1', '*') + ->allowElement('h1') ; }; @@ -528,12 +525,10 @@ on all elements allowed *before this setting*. $framework->htmlSanitizer() ->sanitizer('app.post_sanitizer') // allow "src' on