diff --git a/library/HTMLPurifier/HTMLModule/Iframe.php b/library/HTMLPurifier/HTMLModule/Iframe.php index f7e7c91c..71dfc774 100644 --- a/library/HTMLPurifier/HTMLModule/Iframe.php +++ b/library/HTMLPurifier/HTMLModule/Iframe.php @@ -28,22 +28,28 @@ class HTMLPurifier_HTMLModule_Iframe extends HTMLPurifier_HTMLModule if ($config->get('HTML.SafeIframe')) { $this->safe = true; } + $attrs = array( + 'src' => 'URI#embedded', + 'width' => 'Length', + 'height' => 'Length', + 'name' => 'ID', + 'scrolling' => 'Enum#yes,no,auto', + 'frameborder' => 'Enum#0,1', + 'longdesc' => 'URI', + 'marginheight' => 'Pixels', + 'marginwidth' => 'Pixels', + ); + + if ($config->get('HTML.Trusted')) { + $attrs['allowfullscreen'] = 'Bool#allowfullscreen'; + } + $this->addElement( 'iframe', 'Inline', 'Flow', 'Common', - array( - 'src' => 'URI#embedded', - 'width' => 'Length', - 'height' => 'Length', - 'name' => 'ID', - 'scrolling' => 'Enum#yes,no,auto', - 'frameborder' => 'Enum#0,1', - 'longdesc' => 'URI', - 'marginheight' => 'Pixels', - 'marginwidth' => 'Pixels', - ) + $attrs ); } } diff --git a/tests/HTMLPurifier/HTMLT/safe-iframe-youtube-allowfullscreen.htmlt b/tests/HTMLPurifier/HTMLT/safe-iframe-youtube-allowfullscreen.htmlt new file mode 100644 index 00000000..ff1986b4 --- /dev/null +++ b/tests/HTMLPurifier/HTMLT/safe-iframe-youtube-allowfullscreen.htmlt @@ -0,0 +1,9 @@ +--INI-- +HTML.SafeIframe = true +HTML.Trusted = true +URI.SafeIframeRegexp = "%^http://www.youtube.com/embed/%" +--HTML-- + +--EXPECT-- + +--# vim: et sw=4 sts=4