0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-09 23:28:42 +00:00

Implement HTML.FlashAllowFullScreen.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Edward Z. Yang 2010-09-08 23:39:20 -04:00
parent eac628f490
commit 7c91104532
8 changed files with 39 additions and 2 deletions

2
NEWS
View File

@ -16,6 +16,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
did nothing. Thanks David Rothstein for reporting. did nothing. Thanks David Rothstein for reporting.
! Add documentation about configuration directive types. ! Add documentation about configuration directive types.
! Add %CSS.ForbiddenProperties configuration directive. ! Add %CSS.ForbiddenProperties configuration directive.
! Add %HTML.FlashAllowFullScreen to permit embedded Flash objects
to utilize full-screen mode.
- Fix improper handling of Internet Explorer conditional comments - Fix improper handling of Internet Explorer conditional comments
by parser. Thanks zmonteca for reporting. by parser. Thanks zmonteca for reporting.
- Fix missing attributes bug when running on Mac Snow Leopard and APC. - Fix missing attributes bug when running on Mac Snow Leopard and APC.

View File

@ -347,6 +347,11 @@
<line>13</line> <line>13</line>
</file> </file>
</directive> </directive>
<directive id="HTML.FlashAllowFullScreen">
<file name="HTMLPurifier/AttrTransform/SafeParam.php">
<line>37</line>
</file>
</directive>
<directive id="Core.EscapeInvalidChildren"> <directive id="Core.EscapeInvalidChildren">
<file name="HTMLPurifier/ChildDef/Required.php"> <file name="HTMLPurifier/ChildDef/Required.php">
<line>62</line> <line>62</line>

View File

@ -33,6 +33,13 @@ class HTMLPurifier_AttrTransform_SafeParam extends HTMLPurifier_AttrTransform
case 'allowNetworking': case 'allowNetworking':
$attr['value'] = 'internal'; $attr['value'] = 'internal';
break; break;
case 'allowFullScreen':
if ($config->get('HTML.FlashAllowFullScreen')) {
$attr['value'] = ($attr['value'] == 'true') ? 'true' : 'false';
} else {
$attr['value'] = 'false';
}
break;
case 'wmode': case 'wmode':
$attr['value'] = 'window'; $attr['value'] = 'window';
break; break;

View File

@ -3,6 +3,11 @@ TYPE: bool
VERSION: 3.1.0 VERSION: 3.1.0
DEFAULT: false DEFAULT: false
--DESCRIPTION-- --DESCRIPTION--
<p>
<strong>Warning:</strong> Deprecated in favor of %HTML.SafeObject and
%Output.FlashCompat (turn both on to allow YouTube videos and other
Flash content).
</p>
<p> <p>
This directive enables YouTube video embedding in HTML Purifier. Check This directive enables YouTube video embedding in HTML Purifier. Check
<a href="http://htmlpurifier.org/docs/enduser-youtube.html">this document <a href="http://htmlpurifier.org/docs/enduser-youtube.html">this document

View File

@ -0,0 +1,11 @@
HTML.FlashAllowFullScreen
TYPE: bool
VERSION: 4.1.2
DEFAULT: false
--DESCRIPTION--
<p>
Whether or not to permit embedded Flash content from
%HTML.SafeObject to expand to the full screen. Corresponds to
the <code>allowFullScreen</code> parameter.
</p>
--# vim: et sw=4 sts=4

View File

@ -22,6 +22,7 @@ class HTMLPurifier_Injector_SafeObject extends HTMLPurifier_Injector
'movie' => true, 'movie' => true,
'flashvars' => true, 'flashvars' => true,
'src' => true, 'src' => true,
'allowFullScreen' => true, // if omitted, assume to be 'false'
); );
public function prepare($config, $context) { public function prepare($config, $context) {

View File

@ -6,8 +6,7 @@ class HTMLPurifier_HTMLModule_SafeObjectTest extends HTMLPurifier_HTMLModuleHarn
function setUp() { function setUp() {
parent::setUp(); parent::setUp();
$this->config->set('HTML.DefinitionID', 'HTMLPurifier_HTMLModule_SafeObjectTest'); $this->config->set('HTML.DefinitionID', 'HTMLPurifier_HTMLModule_SafeObjectTest');
$def = $this->config->getHTMLDefinition(true); $this->config->set('HTML.SafeObject', true);
$def->manager->addModule('SafeObject');
} }
function testMinimal() { function testMinimal() {
@ -38,6 +37,13 @@ class HTMLPurifier_HTMLModule_SafeObjectTest extends HTMLPurifier_HTMLModuleHarn
); );
} }
function testFullScreen() {
$this->config->set('HTML.FlashAllowFullScreen', true);
$this->assertResult(
'<b><object width="425" height="344" type="application/x-shockwave-flash" data="Foobar"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="flashvars" value="foobarbaz=bally" /><param name="movie" value="http://www.youtube.com/v/RVtEQxH7PWA&amp;hl=en" /><param name="wmode" value="window" /><param name="allowFullScreen" value="true" /></object></b>'
);
}
} }
// vim: et sw=4 sts=4 // vim: et sw=4 sts=4