| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* XHTML 1.1 Iframe Module provides inline frames. |
| 5 |
* |
| 6 |
* @note This module is not considered safe unless an Iframe |
| 7 |
* whitelisting mechanism is specified. Currently, the only |
| 8 |
* such mechanism is %URL.SafeIframeRegexp |
| 9 |
*/ |
| 10 |
class HTMLPurifier_HTMLModule_Iframe extends HTMLPurifier_HTMLModule |
| 11 |
{ |
| 12 |
|
| 13 |
/** |
| 14 |
* @type string |
| 15 |
*/ |
| 16 |
public $name = 'Iframe'; |
| 17 |
|
| 18 |
/** |
| 19 |
* @type bool |
| 20 |
*/ |
| 21 |
public $safe = false; |
| 22 |
|
| 23 |
/** |
| 24 |
* @param HTMLPurifier_Config $config |
| 25 |
*/ |
| 26 |
public function setup($config) |
| 27 |
{ |
| 28 |
if ($config->get('HTML.SafeIframe')) { |
| 29 |
$this->safe = true; |
| 30 |
} |
| 31 |
$attrs = array( |
| 32 |
'src' => 'URI#embedded', |
| 33 |
'width' => 'Length', |
| 34 |
'height' => 'Length', |
| 35 |
'name' => 'ID', |
| 36 |
'scrolling' => 'Enum#yes,no,auto', |
| 37 |
'frameborder' => 'Enum#0,1', |
| 38 |
'longdesc' => 'URI', |
| 39 |
'marginheight' => 'Pixels', |
| 40 |
'marginwidth' => 'Pixels', |
| 41 |
); |
| 42 |
|
| 43 |
if ($config->get('HTML.Trusted')) { |
| 44 |
$attrs['allowfullscreen'] = 'Bool#allowfullscreen'; |
| 45 |
} |
| 46 |
|
| 47 |
$this->addElement( |
| 48 |
'iframe', |
| 49 |
'Inline', |
| 50 |
'Flow', |
| 51 |
'Common', |
| 52 |
$attrs |
| 53 |
); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
// vim: et sw=4 sts=4 |