@@ -7,12 +7,12 @@ |
||
| 7 | 7 | class HTMLPurifier_HTMLModule_Nofollow extends HTMLPurifier_HTMLModule |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - public $name = 'Nofollow'; |
|
| 10 | + public $name = 'Nofollow'; |
|
| 11 | 11 | |
| 12 | - public function setup($config) { |
|
| 13 | - $a = $this->addBlankElement('a'); |
|
| 14 | - $a->attr_transform_post[] = new HTMLPurifier_AttrTransform_Nofollow(); |
|
| 15 | - } |
|
| 12 | + public function setup($config) { |
|
| 13 | + $a = $this->addBlankElement('a'); |
|
| 14 | + $a->attr_transform_post[] = new HTMLPurifier_AttrTransform_Nofollow(); |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | 17 | } |
| 18 | 18 | |
@@ -2,13 +2,13 @@ |
||
| 2 | 2 | |
| 3 | 3 | class HTMLPurifier_HTMLModule_NonXMLCommonAttributes extends HTMLPurifier_HTMLModule |
| 4 | 4 | { |
| 5 | - public $name = 'NonXMLCommonAttributes'; |
|
| 5 | + public $name = 'NonXMLCommonAttributes'; |
|
| 6 | 6 | |
| 7 | - public $attr_collections = array( |
|
| 8 | - 'Lang' => array( |
|
| 9 | - 'lang' => 'LanguageCode', |
|
| 10 | - ) |
|
| 11 | - ); |
|
| 7 | + public $attr_collections = array( |
|
| 8 | + 'Lang' => array( |
|
| 9 | + 'lang' => 'LanguageCode', |
|
| 10 | + ) |
|
| 11 | + ); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // vim: et sw=4 sts=4 |
@@ -8,39 +8,39 @@ |
||
| 8 | 8 | class HTMLPurifier_HTMLModule_Object extends HTMLPurifier_HTMLModule |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - public $name = 'Object'; |
|
| 12 | - public $safe = false; |
|
| 13 | - |
|
| 14 | - public function setup($config) { |
|
| 15 | - |
|
| 16 | - $this->addElement('object', 'Inline', 'Optional: #PCDATA | Flow | param', 'Common', |
|
| 17 | - array( |
|
| 18 | - 'archive' => 'URI', |
|
| 19 | - 'classid' => 'URI', |
|
| 20 | - 'codebase' => 'URI', |
|
| 21 | - 'codetype' => 'Text', |
|
| 22 | - 'data' => 'URI', |
|
| 23 | - 'declare' => 'Bool#declare', |
|
| 24 | - 'height' => 'Length', |
|
| 25 | - 'name' => 'CDATA', |
|
| 26 | - 'standby' => 'Text', |
|
| 27 | - 'tabindex' => 'Number', |
|
| 28 | - 'type' => 'ContentType', |
|
| 29 | - 'width' => 'Length' |
|
| 30 | - ) |
|
| 31 | - ); |
|
| 32 | - |
|
| 33 | - $this->addElement('param', false, 'Empty', false, |
|
| 34 | - array( |
|
| 35 | - 'id' => 'ID', |
|
| 36 | - 'name*' => 'Text', |
|
| 37 | - 'type' => 'Text', |
|
| 38 | - 'value' => 'Text', |
|
| 39 | - 'valuetype' => 'Enum#data,ref,object' |
|
| 40 | - ) |
|
| 41 | - ); |
|
| 42 | - |
|
| 43 | - } |
|
| 11 | + public $name = 'Object'; |
|
| 12 | + public $safe = false; |
|
| 13 | + |
|
| 14 | + public function setup($config) { |
|
| 15 | + |
|
| 16 | + $this->addElement('object', 'Inline', 'Optional: #PCDATA | Flow | param', 'Common', |
|
| 17 | + array( |
|
| 18 | + 'archive' => 'URI', |
|
| 19 | + 'classid' => 'URI', |
|
| 20 | + 'codebase' => 'URI', |
|
| 21 | + 'codetype' => 'Text', |
|
| 22 | + 'data' => 'URI', |
|
| 23 | + 'declare' => 'Bool#declare', |
|
| 24 | + 'height' => 'Length', |
|
| 25 | + 'name' => 'CDATA', |
|
| 26 | + 'standby' => 'Text', |
|
| 27 | + 'tabindex' => 'Number', |
|
| 28 | + 'type' => 'ContentType', |
|
| 29 | + 'width' => 'Length' |
|
| 30 | + ) |
|
| 31 | + ); |
|
| 32 | + |
|
| 33 | + $this->addElement('param', false, 'Empty', false, |
|
| 34 | + array( |
|
| 35 | + 'id' => 'ID', |
|
| 36 | + 'name*' => 'Text', |
|
| 37 | + 'type' => 'Text', |
|
| 38 | + 'value' => 'Text', |
|
| 39 | + 'valuetype' => 'Enum#data,ref,object' |
|
| 40 | + ) |
|
| 41 | + ); |
|
| 42 | + |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | |
@@ -13,23 +13,23 @@ |
||
| 13 | 13 | class HTMLPurifier_HTMLModule_Presentation extends HTMLPurifier_HTMLModule |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - public $name = 'Presentation'; |
|
| 16 | + public $name = 'Presentation'; |
|
| 17 | 17 | |
| 18 | - public function setup($config) { |
|
| 19 | - $this->addElement('hr', 'Block', 'Empty', 'Common'); |
|
| 20 | - $this->addElement('sub', 'Inline', 'Inline', 'Common'); |
|
| 21 | - $this->addElement('sup', 'Inline', 'Inline', 'Common'); |
|
| 22 | - $b = $this->addElement('b', 'Inline', 'Inline', 'Common'); |
|
| 23 | - $b->formatting = true; |
|
| 24 | - $big = $this->addElement('big', 'Inline', 'Inline', 'Common'); |
|
| 25 | - $big->formatting = true; |
|
| 26 | - $i = $this->addElement('i', 'Inline', 'Inline', 'Common'); |
|
| 27 | - $i->formatting = true; |
|
| 28 | - $small = $this->addElement('small', 'Inline', 'Inline', 'Common'); |
|
| 29 | - $small->formatting = true; |
|
| 30 | - $tt = $this->addElement('tt', 'Inline', 'Inline', 'Common'); |
|
| 31 | - $tt->formatting = true; |
|
| 32 | - } |
|
| 18 | + public function setup($config) { |
|
| 19 | + $this->addElement('hr', 'Block', 'Empty', 'Common'); |
|
| 20 | + $this->addElement('sub', 'Inline', 'Inline', 'Common'); |
|
| 21 | + $this->addElement('sup', 'Inline', 'Inline', 'Common'); |
|
| 22 | + $b = $this->addElement('b', 'Inline', 'Inline', 'Common'); |
|
| 23 | + $b->formatting = true; |
|
| 24 | + $big = $this->addElement('big', 'Inline', 'Inline', 'Common'); |
|
| 25 | + $big->formatting = true; |
|
| 26 | + $i = $this->addElement('i', 'Inline', 'Inline', 'Common'); |
|
| 27 | + $i->formatting = true; |
|
| 28 | + $small = $this->addElement('small', 'Inline', 'Inline', 'Common'); |
|
| 29 | + $small->formatting = true; |
|
| 30 | + $tt = $this->addElement('tt', 'Inline', 'Inline', 'Common'); |
|
| 31 | + $tt->formatting = true; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | } |
| 35 | 35 | |
@@ -16,18 +16,18 @@ |
||
| 16 | 16 | public $name = 'Presentation'; |
| 17 | 17 | |
| 18 | 18 | public function setup($config) { |
| 19 | - $this->addElement('hr', 'Block', 'Empty', 'Common'); |
|
| 20 | - $this->addElement('sub', 'Inline', 'Inline', 'Common'); |
|
| 21 | - $this->addElement('sup', 'Inline', 'Inline', 'Common'); |
|
| 22 | - $b = $this->addElement('b', 'Inline', 'Inline', 'Common'); |
|
| 19 | + $this->addElement('hr', 'Block', 'Empty', 'Common'); |
|
| 20 | + $this->addElement('sub', 'Inline', 'Inline', 'Common'); |
|
| 21 | + $this->addElement('sup', 'Inline', 'Inline', 'Common'); |
|
| 22 | + $b = $this->addElement('b', 'Inline', 'Inline', 'Common'); |
|
| 23 | 23 | $b->formatting = true; |
| 24 | - $big = $this->addElement('big', 'Inline', 'Inline', 'Common'); |
|
| 24 | + $big = $this->addElement('big', 'Inline', 'Inline', 'Common'); |
|
| 25 | 25 | $big->formatting = true; |
| 26 | - $i = $this->addElement('i', 'Inline', 'Inline', 'Common'); |
|
| 26 | + $i = $this->addElement('i', 'Inline', 'Inline', 'Common'); |
|
| 27 | 27 | $i->formatting = true; |
| 28 | - $small = $this->addElement('small', 'Inline', 'Inline', 'Common'); |
|
| 28 | + $small = $this->addElement('small', 'Inline', 'Inline', 'Common'); |
|
| 29 | 29 | $small->formatting = true; |
| 30 | - $tt = $this->addElement('tt', 'Inline', 'Inline', 'Common'); |
|
| 30 | + $tt = $this->addElement('tt', 'Inline', 'Inline', 'Common'); |
|
| 31 | 31 | $tt->formatting = true; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -7,26 +7,26 @@ |
||
| 7 | 7 | class HTMLPurifier_HTMLModule_Proprietary extends HTMLPurifier_HTMLModule |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - public $name = 'Proprietary'; |
|
| 10 | + public $name = 'Proprietary'; |
|
| 11 | 11 | |
| 12 | - public function setup($config) { |
|
| 12 | + public function setup($config) { |
|
| 13 | 13 | |
| 14 | - $this->addElement('marquee', 'Inline', 'Flow', 'Common', |
|
| 15 | - array( |
|
| 16 | - 'direction' => 'Enum#left,right,up,down', |
|
| 17 | - 'behavior' => 'Enum#alternate', |
|
| 18 | - 'width' => 'Length', |
|
| 19 | - 'height' => 'Length', |
|
| 20 | - 'scrolldelay' => 'Number', |
|
| 21 | - 'scrollamount' => 'Number', |
|
| 22 | - 'loop' => 'Number', |
|
| 23 | - 'bgcolor' => 'Color', |
|
| 24 | - 'hspace' => 'Pixels', |
|
| 25 | - 'vspace' => 'Pixels', |
|
| 26 | - ) |
|
| 27 | - ); |
|
| 14 | + $this->addElement('marquee', 'Inline', 'Flow', 'Common', |
|
| 15 | + array( |
|
| 16 | + 'direction' => 'Enum#left,right,up,down', |
|
| 17 | + 'behavior' => 'Enum#alternate', |
|
| 18 | + 'width' => 'Length', |
|
| 19 | + 'height' => 'Length', |
|
| 20 | + 'scrolldelay' => 'Number', |
|
| 21 | + 'scrollamount' => 'Number', |
|
| 22 | + 'loop' => 'Number', |
|
| 23 | + 'bgcolor' => 'Color', |
|
| 24 | + 'hspace' => 'Pixels', |
|
| 25 | + 'vspace' => 'Pixels', |
|
| 26 | + ) |
|
| 27 | + ); |
|
| 28 | 28 | |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | } |
| 32 | 32 | |
@@ -7,20 +7,20 @@ |
||
| 7 | 7 | class HTMLPurifier_HTMLModule_Ruby extends HTMLPurifier_HTMLModule |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - public $name = 'Ruby'; |
|
| 10 | + public $name = 'Ruby'; |
|
| 11 | 11 | |
| 12 | - public function setup($config) { |
|
| 13 | - $this->addElement('ruby', 'Inline', |
|
| 14 | - 'Custom: ((rb, (rt | (rp, rt, rp))) | (rbc, rtc, rtc?))', |
|
| 15 | - 'Common'); |
|
| 16 | - $this->addElement('rbc', false, 'Required: rb', 'Common'); |
|
| 17 | - $this->addElement('rtc', false, 'Required: rt', 'Common'); |
|
| 18 | - $rb = $this->addElement('rb', false, 'Inline', 'Common'); |
|
| 19 | - $rb->excludes = array('ruby' => true); |
|
| 20 | - $rt = $this->addElement('rt', false, 'Inline', 'Common', array('rbspan' => 'Number')); |
|
| 21 | - $rt->excludes = array('ruby' => true); |
|
| 22 | - $this->addElement('rp', false, 'Optional: #PCDATA', 'Common'); |
|
| 23 | - } |
|
| 12 | + public function setup($config) { |
|
| 13 | + $this->addElement('ruby', 'Inline', |
|
| 14 | + 'Custom: ((rb, (rt | (rp, rt, rp))) | (rbc, rtc, rtc?))', |
|
| 15 | + 'Common'); |
|
| 16 | + $this->addElement('rbc', false, 'Required: rb', 'Common'); |
|
| 17 | + $this->addElement('rtc', false, 'Required: rt', 'Common'); |
|
| 18 | + $rb = $this->addElement('rb', false, 'Inline', 'Common'); |
|
| 19 | + $rb->excludes = array('ruby' => true); |
|
| 20 | + $rt = $this->addElement('rt', false, 'Inline', 'Common', array('rbspan' => 'Number')); |
|
| 21 | + $rt->excludes = array('ruby' => true); |
|
| 22 | + $this->addElement('rp', false, 'Optional: #PCDATA', 'Common'); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
@@ -6,28 +6,28 @@ |
||
| 6 | 6 | class HTMLPurifier_HTMLModule_SafeEmbed extends HTMLPurifier_HTMLModule |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - public $name = 'SafeEmbed'; |
|
| 9 | + public $name = 'SafeEmbed'; |
|
| 10 | 10 | |
| 11 | - public function setup($config) { |
|
| 11 | + public function setup($config) { |
|
| 12 | 12 | |
| 13 | - $max = $config->get('HTML.MaxImgLength'); |
|
| 14 | - $embed = $this->addElement( |
|
| 15 | - 'embed', 'Inline', 'Empty', 'Common', |
|
| 16 | - array( |
|
| 17 | - 'src*' => 'URI#embedded', |
|
| 18 | - 'type' => 'Enum#application/x-shockwave-flash', |
|
| 19 | - 'width' => 'Pixels#' . $max, |
|
| 20 | - 'height' => 'Pixels#' . $max, |
|
| 21 | - 'allowscriptaccess' => 'Enum#never', |
|
| 22 | - 'allownetworking' => 'Enum#internal', |
|
| 23 | - 'flashvars' => 'Text', |
|
| 24 | - 'wmode' => 'Enum#window,transparent,opaque', |
|
| 25 | - 'name' => 'ID', |
|
| 26 | - ) |
|
| 27 | - ); |
|
| 28 | - $embed->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeEmbed(); |
|
| 13 | + $max = $config->get('HTML.MaxImgLength'); |
|
| 14 | + $embed = $this->addElement( |
|
| 15 | + 'embed', 'Inline', 'Empty', 'Common', |
|
| 16 | + array( |
|
| 17 | + 'src*' => 'URI#embedded', |
|
| 18 | + 'type' => 'Enum#application/x-shockwave-flash', |
|
| 19 | + 'width' => 'Pixels#' . $max, |
|
| 20 | + 'height' => 'Pixels#' . $max, |
|
| 21 | + 'allowscriptaccess' => 'Enum#never', |
|
| 22 | + 'allownetworking' => 'Enum#internal', |
|
| 23 | + 'flashvars' => 'Text', |
|
| 24 | + 'wmode' => 'Enum#window,transparent,opaque', |
|
| 25 | + 'name' => 'ID', |
|
| 26 | + ) |
|
| 27 | + ); |
|
| 28 | + $embed->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeEmbed(); |
|
| 29 | 29 | |
| 30 | - } |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
@@ -16,8 +16,8 @@ |
||
| 16 | 16 | array( |
| 17 | 17 | 'src*' => 'URI#embedded', |
| 18 | 18 | 'type' => 'Enum#application/x-shockwave-flash', |
| 19 | - 'width' => 'Pixels#' . $max, |
|
| 20 | - 'height' => 'Pixels#' . $max, |
|
| 19 | + 'width' => 'Pixels#'.$max, |
|
| 20 | + 'height' => 'Pixels#'.$max, |
|
| 21 | 21 | 'allowscriptaccess' => 'Enum#never', |
| 22 | 22 | 'allownetworking' => 'Enum#internal', |
| 23 | 23 | 'flashvars' => 'Text', |
@@ -9,43 +9,43 @@ |
||
| 9 | 9 | class HTMLPurifier_HTMLModule_SafeObject extends HTMLPurifier_HTMLModule |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - public $name = 'SafeObject'; |
|
| 13 | - |
|
| 14 | - public function setup($config) { |
|
| 15 | - |
|
| 16 | - // These definitions are not intrinsically safe: the attribute transforms |
|
| 17 | - // are a vital part of ensuring safety. |
|
| 18 | - |
|
| 19 | - $max = $config->get('HTML.MaxImgLength'); |
|
| 20 | - $object = $this->addElement( |
|
| 21 | - 'object', |
|
| 22 | - 'Inline', |
|
| 23 | - 'Optional: param | Flow | #PCDATA', |
|
| 24 | - 'Common', |
|
| 25 | - array( |
|
| 26 | - // While technically not required by the spec, we're forcing |
|
| 27 | - // it to this value. |
|
| 28 | - 'type' => 'Enum#application/x-shockwave-flash', |
|
| 29 | - 'width' => 'Pixels#' . $max, |
|
| 30 | - 'height' => 'Pixels#' . $max, |
|
| 31 | - 'data' => 'URI#embedded', |
|
| 32 | - 'codebase' => new HTMLPurifier_AttrDef_Enum(array( |
|
| 33 | - 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0')), |
|
| 34 | - ) |
|
| 35 | - ); |
|
| 36 | - $object->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeObject(); |
|
| 37 | - |
|
| 38 | - $param = $this->addElement('param', false, 'Empty', false, |
|
| 39 | - array( |
|
| 40 | - 'id' => 'ID', |
|
| 41 | - 'name*' => 'Text', |
|
| 42 | - 'value' => 'Text' |
|
| 43 | - ) |
|
| 44 | - ); |
|
| 45 | - $param->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeParam(); |
|
| 46 | - $this->info_injector[] = 'SafeObject'; |
|
| 47 | - |
|
| 48 | - } |
|
| 12 | + public $name = 'SafeObject'; |
|
| 13 | + |
|
| 14 | + public function setup($config) { |
|
| 15 | + |
|
| 16 | + // These definitions are not intrinsically safe: the attribute transforms |
|
| 17 | + // are a vital part of ensuring safety. |
|
| 18 | + |
|
| 19 | + $max = $config->get('HTML.MaxImgLength'); |
|
| 20 | + $object = $this->addElement( |
|
| 21 | + 'object', |
|
| 22 | + 'Inline', |
|
| 23 | + 'Optional: param | Flow | #PCDATA', |
|
| 24 | + 'Common', |
|
| 25 | + array( |
|
| 26 | + // While technically not required by the spec, we're forcing |
|
| 27 | + // it to this value. |
|
| 28 | + 'type' => 'Enum#application/x-shockwave-flash', |
|
| 29 | + 'width' => 'Pixels#' . $max, |
|
| 30 | + 'height' => 'Pixels#' . $max, |
|
| 31 | + 'data' => 'URI#embedded', |
|
| 32 | + 'codebase' => new HTMLPurifier_AttrDef_Enum(array( |
|
| 33 | + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0')), |
|
| 34 | + ) |
|
| 35 | + ); |
|
| 36 | + $object->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeObject(); |
|
| 37 | + |
|
| 38 | + $param = $this->addElement('param', false, 'Empty', false, |
|
| 39 | + array( |
|
| 40 | + 'id' => 'ID', |
|
| 41 | + 'name*' => 'Text', |
|
| 42 | + 'value' => 'Text' |
|
| 43 | + ) |
|
| 44 | + ); |
|
| 45 | + $param->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeParam(); |
|
| 46 | + $this->info_injector[] = 'SafeObject'; |
|
| 47 | + |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | } |
| 51 | 51 | |
@@ -26,8 +26,8 @@ |
||
| 26 | 26 | // While technically not required by the spec, we're forcing |
| 27 | 27 | // it to this value. |
| 28 | 28 | 'type' => 'Enum#application/x-shockwave-flash', |
| 29 | - 'width' => 'Pixels#' . $max, |
|
| 30 | - 'height' => 'Pixels#' . $max, |
|
| 29 | + 'width' => 'Pixels#'.$max, |
|
| 30 | + 'height' => 'Pixels#'.$max, |
|
| 31 | 31 | 'data' => 'URI#embedded', |
| 32 | 32 | 'codebase' => new HTMLPurifier_AttrDef_Enum(array( |
| 33 | 33 | 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0')), |
@@ -15,40 +15,40 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class HTMLPurifier_HTMLModule_Scripting extends HTMLPurifier_HTMLModule |
| 17 | 17 | { |
| 18 | - public $name = 'Scripting'; |
|
| 19 | - public $elements = array('script', 'noscript'); |
|
| 20 | - public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript'); |
|
| 21 | - public $safe = false; |
|
| 22 | - |
|
| 23 | - public function setup($config) { |
|
| 24 | - // TODO: create custom child-definition for noscript that |
|
| 25 | - // auto-wraps stray #PCDATA in a similar manner to |
|
| 26 | - // blockquote's custom definition (we would use it but |
|
| 27 | - // blockquote's contents are optional while noscript's contents |
|
| 28 | - // are required) |
|
| 29 | - |
|
| 30 | - // TODO: convert this to new syntax, main problem is getting |
|
| 31 | - // both content sets working |
|
| 32 | - |
|
| 33 | - // In theory, this could be safe, but I don't see any reason to |
|
| 34 | - // allow it. |
|
| 35 | - $this->info['noscript'] = new HTMLPurifier_ElementDef(); |
|
| 36 | - $this->info['noscript']->attr = array( 0 => array('Common') ); |
|
| 37 | - $this->info['noscript']->content_model = 'Heading | List | Block'; |
|
| 38 | - $this->info['noscript']->content_model_type = 'required'; |
|
| 39 | - |
|
| 40 | - $this->info['script'] = new HTMLPurifier_ElementDef(); |
|
| 41 | - $this->info['script']->attr = array( |
|
| 42 | - 'defer' => new HTMLPurifier_AttrDef_Enum(array('defer')), |
|
| 43 | - 'src' => new HTMLPurifier_AttrDef_URI(true), |
|
| 44 | - 'type' => new HTMLPurifier_AttrDef_Enum(array('text/javascript')) |
|
| 45 | - ); |
|
| 46 | - $this->info['script']->content_model = '#PCDATA'; |
|
| 47 | - $this->info['script']->content_model_type = 'optional'; |
|
| 48 | - $this->info['script']->attr_transform_pre['type'] = |
|
| 49 | - $this->info['script']->attr_transform_post['type'] = |
|
| 50 | - new HTMLPurifier_AttrTransform_ScriptRequired(); |
|
| 51 | - } |
|
| 18 | + public $name = 'Scripting'; |
|
| 19 | + public $elements = array('script', 'noscript'); |
|
| 20 | + public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript'); |
|
| 21 | + public $safe = false; |
|
| 22 | + |
|
| 23 | + public function setup($config) { |
|
| 24 | + // TODO: create custom child-definition for noscript that |
|
| 25 | + // auto-wraps stray #PCDATA in a similar manner to |
|
| 26 | + // blockquote's custom definition (we would use it but |
|
| 27 | + // blockquote's contents are optional while noscript's contents |
|
| 28 | + // are required) |
|
| 29 | + |
|
| 30 | + // TODO: convert this to new syntax, main problem is getting |
|
| 31 | + // both content sets working |
|
| 32 | + |
|
| 33 | + // In theory, this could be safe, but I don't see any reason to |
|
| 34 | + // allow it. |
|
| 35 | + $this->info['noscript'] = new HTMLPurifier_ElementDef(); |
|
| 36 | + $this->info['noscript']->attr = array( 0 => array('Common') ); |
|
| 37 | + $this->info['noscript']->content_model = 'Heading | List | Block'; |
|
| 38 | + $this->info['noscript']->content_model_type = 'required'; |
|
| 39 | + |
|
| 40 | + $this->info['script'] = new HTMLPurifier_ElementDef(); |
|
| 41 | + $this->info['script']->attr = array( |
|
| 42 | + 'defer' => new HTMLPurifier_AttrDef_Enum(array('defer')), |
|
| 43 | + 'src' => new HTMLPurifier_AttrDef_URI(true), |
|
| 44 | + 'type' => new HTMLPurifier_AttrDef_Enum(array('text/javascript')) |
|
| 45 | + ); |
|
| 46 | + $this->info['script']->content_model = '#PCDATA'; |
|
| 47 | + $this->info['script']->content_model_type = 'optional'; |
|
| 48 | + $this->info['script']->attr_transform_pre['type'] = |
|
| 49 | + $this->info['script']->attr_transform_post['type'] = |
|
| 50 | + new HTMLPurifier_AttrTransform_ScriptRequired(); |
|
| 51 | + } |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // vim: et sw=4 sts=4 |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | // In theory, this could be safe, but I don't see any reason to |
| 34 | 34 | // allow it. |
| 35 | 35 | $this->info['noscript'] = new HTMLPurifier_ElementDef(); |
| 36 | - $this->info['noscript']->attr = array( 0 => array('Common') ); |
|
| 36 | + $this->info['noscript']->attr = array(0 => array('Common')); |
|
| 37 | 37 | $this->info['noscript']->content_model = 'Heading | List | Block'; |
| 38 | 38 | $this->info['noscript']->content_model_type = 'required'; |
| 39 | 39 | |