Exercise / HTMLPurifierBundle

HTML Purifier is a standards-compliant HTML filter library written in PHP.
http://htmlpurifier.org/
Other
275 stars 56 forks source link

Custom config for Youtube's iframe #42

Closed lionelbzv closed 6 years ago

lionelbzv commented 7 years ago

Env / SF2.8 I'm trying to add config for allowing iframe from YouTube, here's my config.yml:

# HTMLPurifierBundle
exercise_html_purifier:
    default:
        Cache.SerializerPath: "%kernel.root_dir%/cache/htmlpurifier"
    custom:
        HTML.SafeIframe: true
        URI.SafeIframeRegexp: '%^http://www.youtube.com/embed/%'

But I've got this error:

ParameterNotFoundException in ParameterBag.php line 84:
You have requested a non-existent parameter "^http://www.youtube.com/embed/".

What's wrong? Thanks!

lionelbzv commented 6 years ago

OK with this config

exercise_html_purifier:
    default:
        Cache.SerializerPath: "%kernel.root_dir%/cache/htmlpurifier"
    custom:
        Cache.SerializerPath: "%kernel.root_dir%/cache/htmlpurifier"
        HTML.SafeIframe: true
        URI.SafeIframeRegexp: "#^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)#"