@@ -6,25 +6,25 @@ |
||
| 6 | 6 | class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - public $name = 'Hypertext'; |
|
| 9 | + public $name = 'Hypertext'; |
|
| 10 | 10 | |
| 11 | - public function setup($config) { |
|
| 12 | - $a = $this->addElement( |
|
| 13 | - 'a', 'Inline', 'Inline', 'Common', |
|
| 14 | - array( |
|
| 15 | - // 'accesskey' => 'Character', |
|
| 16 | - // 'charset' => 'Charset', |
|
| 17 | - 'href' => 'URI', |
|
| 18 | - // 'hreflang' => 'LanguageCode', |
|
| 19 | - 'rel' => new HTMLPurifier_AttrDef_HTML_LinkTypes('rel'), |
|
| 20 | - 'rev' => new HTMLPurifier_AttrDef_HTML_LinkTypes('rev'), |
|
| 21 | - // 'tabindex' => 'Number', |
|
| 22 | - // 'type' => 'ContentType', |
|
| 23 | - ) |
|
| 24 | - ); |
|
| 25 | - $a->formatting = true; |
|
| 26 | - $a->excludes = array('a' => true); |
|
| 27 | - } |
|
| 11 | + public function setup($config) { |
|
| 12 | + $a = $this->addElement( |
|
| 13 | + 'a', 'Inline', 'Inline', 'Common', |
|
| 14 | + array( |
|
| 15 | + // 'accesskey' => 'Character', |
|
| 16 | + // 'charset' => 'Charset', |
|
| 17 | + 'href' => 'URI', |
|
| 18 | + // 'hreflang' => 'LanguageCode', |
|
| 19 | + 'rel' => new HTMLPurifier_AttrDef_HTML_LinkTypes('rel'), |
|
| 20 | + 'rev' => new HTMLPurifier_AttrDef_HTML_LinkTypes('rev'), |
|
| 21 | + // 'tabindex' => 'Number', |
|
| 22 | + // 'type' => 'ContentType', |
|
| 23 | + ) |
|
| 24 | + ); |
|
| 25 | + $a->formatting = true; |
|
| 26 | + $a->excludes = array('a' => true); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | 29 | } |
| 30 | 30 | |
@@ -10,28 +10,28 @@ |
||
| 10 | 10 | class HTMLPurifier_HTMLModule_Iframe extends HTMLPurifier_HTMLModule |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - public $name = 'Iframe'; |
|
| 14 | - public $safe = false; |
|
| 13 | + public $name = 'Iframe'; |
|
| 14 | + public $safe = false; |
|
| 15 | 15 | |
| 16 | - public function setup($config) { |
|
| 17 | - if ($config->get('HTML.SafeIframe')) { |
|
| 18 | - $this->safe = true; |
|
| 19 | - } |
|
| 20 | - $this->addElement( |
|
| 21 | - 'iframe', 'Inline', 'Flow', 'Common', |
|
| 22 | - array( |
|
| 23 | - 'src' => 'URI#embedded', |
|
| 24 | - 'width' => 'Length', |
|
| 25 | - 'height' => 'Length', |
|
| 26 | - 'name' => 'ID', |
|
| 27 | - 'scrolling' => 'Enum#yes,no,auto', |
|
| 28 | - 'frameborder' => 'Enum#0,1', |
|
| 29 | - 'longdesc' => 'URI', |
|
| 30 | - 'marginheight' => 'Pixels', |
|
| 31 | - 'marginwidth' => 'Pixels', |
|
| 32 | - ) |
|
| 33 | - ); |
|
| 34 | - } |
|
| 16 | + public function setup($config) { |
|
| 17 | + if ($config->get('HTML.SafeIframe')) { |
|
| 18 | + $this->safe = true; |
|
| 19 | + } |
|
| 20 | + $this->addElement( |
|
| 21 | + 'iframe', 'Inline', 'Flow', 'Common', |
|
| 22 | + array( |
|
| 23 | + 'src' => 'URI#embedded', |
|
| 24 | + 'width' => 'Length', |
|
| 25 | + 'height' => 'Length', |
|
| 26 | + 'name' => 'ID', |
|
| 27 | + 'scrolling' => 'Enum#yes,no,auto', |
|
| 28 | + 'frameborder' => 'Enum#0,1', |
|
| 29 | + 'longdesc' => 'URI', |
|
| 30 | + 'marginheight' => 'Pixels', |
|
| 31 | + 'marginwidth' => 'Pixels', |
|
| 32 | + ) |
|
| 33 | + ); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | } |
| 37 | 37 | |
@@ -8,32 +8,32 @@ |
||
| 8 | 8 | class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - public $name = 'Image'; |
|
| 11 | + public $name = 'Image'; |
|
| 12 | 12 | |
| 13 | - public function setup($config) { |
|
| 14 | - $max = $config->get('HTML.MaxImgLength'); |
|
| 15 | - $img = $this->addElement( |
|
| 16 | - 'img', 'Inline', 'Empty', 'Common', |
|
| 17 | - array( |
|
| 18 | - 'alt*' => 'Text', |
|
| 19 | - // According to the spec, it's Length, but percents can |
|
| 20 | - // be abused, so we allow only Pixels. |
|
| 21 | - 'height' => 'Pixels#' . $max, |
|
| 22 | - 'width' => 'Pixels#' . $max, |
|
| 23 | - 'longdesc' => 'URI', |
|
| 24 | - 'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded |
|
| 25 | - ) |
|
| 26 | - ); |
|
| 27 | - if ($max === null || $config->get('HTML.Trusted')) { |
|
| 28 | - $img->attr['height'] = |
|
| 29 | - $img->attr['width'] = 'Length'; |
|
| 30 | - } |
|
| 13 | + public function setup($config) { |
|
| 14 | + $max = $config->get('HTML.MaxImgLength'); |
|
| 15 | + $img = $this->addElement( |
|
| 16 | + 'img', 'Inline', 'Empty', 'Common', |
|
| 17 | + array( |
|
| 18 | + 'alt*' => 'Text', |
|
| 19 | + // According to the spec, it's Length, but percents can |
|
| 20 | + // be abused, so we allow only Pixels. |
|
| 21 | + 'height' => 'Pixels#' . $max, |
|
| 22 | + 'width' => 'Pixels#' . $max, |
|
| 23 | + 'longdesc' => 'URI', |
|
| 24 | + 'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded |
|
| 25 | + ) |
|
| 26 | + ); |
|
| 27 | + if ($max === null || $config->get('HTML.Trusted')) { |
|
| 28 | + $img->attr['height'] = |
|
| 29 | + $img->attr['width'] = 'Length'; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - // kind of strange, but splitting things up would be inefficient |
|
| 33 | - $img->attr_transform_pre[] = |
|
| 34 | - $img->attr_transform_post[] = |
|
| 35 | - new HTMLPurifier_AttrTransform_ImgRequired(); |
|
| 36 | - } |
|
| 32 | + // kind of strange, but splitting things up would be inefficient |
|
| 33 | + $img->attr_transform_pre[] = |
|
| 34 | + $img->attr_transform_post[] = |
|
| 35 | + new HTMLPurifier_AttrTransform_ImgRequired(); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | 'alt*' => 'Text', |
| 19 | 19 | // According to the spec, it's Length, but percents can |
| 20 | 20 | // be abused, so we allow only Pixels. |
| 21 | - 'height' => 'Pixels#' . $max, |
|
| 22 | - 'width' => 'Pixels#' . $max, |
|
| 21 | + 'height' => 'Pixels#'.$max, |
|
| 22 | + 'width' => 'Pixels#'.$max, |
|
| 23 | 23 | 'longdesc' => 'URI', |
| 24 | 24 | 'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded |
| 25 | 25 | ) |
@@ -19,140 +19,140 @@ |
||
| 19 | 19 | class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - public $name = 'Legacy'; |
|
| 22 | + public $name = 'Legacy'; |
|
| 23 | 23 | |
| 24 | - public function setup($config) { |
|
| 25 | - |
|
| 26 | - $this->addElement('basefont', 'Inline', 'Empty', false, array( |
|
| 27 | - 'color' => 'Color', |
|
| 28 | - 'face' => 'Text', // extremely broad, we should |
|
| 29 | - 'size' => 'Text', // tighten it |
|
| 30 | - 'id' => 'ID' |
|
| 31 | - )); |
|
| 32 | - $this->addElement('center', 'Block', 'Flow', 'Common'); |
|
| 33 | - $this->addElement('dir', 'Block', 'Required: li', 'Common', array( |
|
| 34 | - 'compact' => 'Bool#compact' |
|
| 35 | - )); |
|
| 36 | - $this->addElement('font', 'Inline', 'Inline', array('Core', 'I18N'), array( |
|
| 37 | - 'color' => 'Color', |
|
| 38 | - 'face' => 'Text', // extremely broad, we should |
|
| 39 | - 'size' => 'Text', // tighten it |
|
| 40 | - )); |
|
| 41 | - $this->addElement('menu', 'Block', 'Required: li', 'Common', array( |
|
| 42 | - 'compact' => 'Bool#compact' |
|
| 43 | - )); |
|
| 44 | - |
|
| 45 | - $s = $this->addElement('s', 'Inline', 'Inline', 'Common'); |
|
| 46 | - $s->formatting = true; |
|
| 47 | - |
|
| 48 | - $strike = $this->addElement('strike', 'Inline', 'Inline', 'Common'); |
|
| 49 | - $strike->formatting = true; |
|
| 50 | - |
|
| 51 | - $u = $this->addElement('u', 'Inline', 'Inline', 'Common'); |
|
| 52 | - $u->formatting = true; |
|
| 53 | - |
|
| 54 | - // setup modifications to old elements |
|
| 55 | - |
|
| 56 | - $align = 'Enum#left,right,center,justify'; |
|
| 57 | - |
|
| 58 | - $address = $this->addBlankElement('address'); |
|
| 59 | - $address->content_model = 'Inline | #PCDATA | p'; |
|
| 60 | - $address->content_model_type = 'optional'; |
|
| 61 | - $address->child = false; |
|
| 62 | - |
|
| 63 | - $blockquote = $this->addBlankElement('blockquote'); |
|
| 64 | - $blockquote->content_model = 'Flow | #PCDATA'; |
|
| 65 | - $blockquote->content_model_type = 'optional'; |
|
| 66 | - $blockquote->child = false; |
|
| 67 | - |
|
| 68 | - $br = $this->addBlankElement('br'); |
|
| 69 | - $br->attr['clear'] = 'Enum#left,all,right,none'; |
|
| 70 | - |
|
| 71 | - $caption = $this->addBlankElement('caption'); |
|
| 72 | - $caption->attr['align'] = 'Enum#top,bottom,left,right'; |
|
| 73 | - |
|
| 74 | - $div = $this->addBlankElement('div'); |
|
| 75 | - $div->attr['align'] = $align; |
|
| 76 | - |
|
| 77 | - $dl = $this->addBlankElement('dl'); |
|
| 78 | - $dl->attr['compact'] = 'Bool#compact'; |
|
| 79 | - |
|
| 80 | - for ($i = 1; $i <= 6; $i++) { |
|
| 81 | - $h = $this->addBlankElement("h$i"); |
|
| 82 | - $h->attr['align'] = $align; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - $hr = $this->addBlankElement('hr'); |
|
| 86 | - $hr->attr['align'] = $align; |
|
| 87 | - $hr->attr['noshade'] = 'Bool#noshade'; |
|
| 88 | - $hr->attr['size'] = 'Pixels'; |
|
| 89 | - $hr->attr['width'] = 'Length'; |
|
| 90 | - |
|
| 91 | - $img = $this->addBlankElement('img'); |
|
| 92 | - $img->attr['align'] = 'IAlign'; |
|
| 93 | - $img->attr['border'] = 'Pixels'; |
|
| 94 | - $img->attr['hspace'] = 'Pixels'; |
|
| 95 | - $img->attr['vspace'] = 'Pixels'; |
|
| 96 | - |
|
| 97 | - // figure out this integer business |
|
| 98 | - |
|
| 99 | - $li = $this->addBlankElement('li'); |
|
| 100 | - $li->attr['value'] = new HTMLPurifier_AttrDef_Integer(); |
|
| 101 | - $li->attr['type'] = 'Enum#s:1,i,I,a,A,disc,square,circle'; |
|
| 102 | - |
|
| 103 | - $ol = $this->addBlankElement('ol'); |
|
| 104 | - $ol->attr['compact'] = 'Bool#compact'; |
|
| 105 | - $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer(); |
|
| 106 | - $ol->attr['type'] = 'Enum#s:1,i,I,a,A'; |
|
| 107 | - |
|
| 108 | - $p = $this->addBlankElement('p'); |
|
| 109 | - $p->attr['align'] = $align; |
|
| 110 | - |
|
| 111 | - $pre = $this->addBlankElement('pre'); |
|
| 112 | - $pre->attr['width'] = 'Number'; |
|
| 113 | - |
|
| 114 | - // script omitted |
|
| 115 | - |
|
| 116 | - $table = $this->addBlankElement('table'); |
|
| 117 | - $table->attr['align'] = 'Enum#left,center,right'; |
|
| 118 | - $table->attr['bgcolor'] = 'Color'; |
|
| 119 | - |
|
| 120 | - $tr = $this->addBlankElement('tr'); |
|
| 121 | - $tr->attr['bgcolor'] = 'Color'; |
|
| 122 | - |
|
| 123 | - $th = $this->addBlankElement('th'); |
|
| 124 | - $th->attr['bgcolor'] = 'Color'; |
|
| 125 | - $th->attr['height'] = 'Length'; |
|
| 126 | - $th->attr['nowrap'] = 'Bool#nowrap'; |
|
| 127 | - $th->attr['width'] = 'Length'; |
|
| 128 | - |
|
| 129 | - $td = $this->addBlankElement('td'); |
|
| 130 | - $td->attr['bgcolor'] = 'Color'; |
|
| 131 | - $td->attr['height'] = 'Length'; |
|
| 132 | - $td->attr['nowrap'] = 'Bool#nowrap'; |
|
| 133 | - $td->attr['width'] = 'Length'; |
|
| 24 | + public function setup($config) { |
|
| 25 | + |
|
| 26 | + $this->addElement('basefont', 'Inline', 'Empty', false, array( |
|
| 27 | + 'color' => 'Color', |
|
| 28 | + 'face' => 'Text', // extremely broad, we should |
|
| 29 | + 'size' => 'Text', // tighten it |
|
| 30 | + 'id' => 'ID' |
|
| 31 | + )); |
|
| 32 | + $this->addElement('center', 'Block', 'Flow', 'Common'); |
|
| 33 | + $this->addElement('dir', 'Block', 'Required: li', 'Common', array( |
|
| 34 | + 'compact' => 'Bool#compact' |
|
| 35 | + )); |
|
| 36 | + $this->addElement('font', 'Inline', 'Inline', array('Core', 'I18N'), array( |
|
| 37 | + 'color' => 'Color', |
|
| 38 | + 'face' => 'Text', // extremely broad, we should |
|
| 39 | + 'size' => 'Text', // tighten it |
|
| 40 | + )); |
|
| 41 | + $this->addElement('menu', 'Block', 'Required: li', 'Common', array( |
|
| 42 | + 'compact' => 'Bool#compact' |
|
| 43 | + )); |
|
| 44 | + |
|
| 45 | + $s = $this->addElement('s', 'Inline', 'Inline', 'Common'); |
|
| 46 | + $s->formatting = true; |
|
| 47 | + |
|
| 48 | + $strike = $this->addElement('strike', 'Inline', 'Inline', 'Common'); |
|
| 49 | + $strike->formatting = true; |
|
| 50 | + |
|
| 51 | + $u = $this->addElement('u', 'Inline', 'Inline', 'Common'); |
|
| 52 | + $u->formatting = true; |
|
| 53 | + |
|
| 54 | + // setup modifications to old elements |
|
| 55 | + |
|
| 56 | + $align = 'Enum#left,right,center,justify'; |
|
| 57 | + |
|
| 58 | + $address = $this->addBlankElement('address'); |
|
| 59 | + $address->content_model = 'Inline | #PCDATA | p'; |
|
| 60 | + $address->content_model_type = 'optional'; |
|
| 61 | + $address->child = false; |
|
| 62 | + |
|
| 63 | + $blockquote = $this->addBlankElement('blockquote'); |
|
| 64 | + $blockquote->content_model = 'Flow | #PCDATA'; |
|
| 65 | + $blockquote->content_model_type = 'optional'; |
|
| 66 | + $blockquote->child = false; |
|
| 67 | + |
|
| 68 | + $br = $this->addBlankElement('br'); |
|
| 69 | + $br->attr['clear'] = 'Enum#left,all,right,none'; |
|
| 70 | + |
|
| 71 | + $caption = $this->addBlankElement('caption'); |
|
| 72 | + $caption->attr['align'] = 'Enum#top,bottom,left,right'; |
|
| 73 | + |
|
| 74 | + $div = $this->addBlankElement('div'); |
|
| 75 | + $div->attr['align'] = $align; |
|
| 76 | + |
|
| 77 | + $dl = $this->addBlankElement('dl'); |
|
| 78 | + $dl->attr['compact'] = 'Bool#compact'; |
|
| 79 | + |
|
| 80 | + for ($i = 1; $i <= 6; $i++) { |
|
| 81 | + $h = $this->addBlankElement("h$i"); |
|
| 82 | + $h->attr['align'] = $align; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + $hr = $this->addBlankElement('hr'); |
|
| 86 | + $hr->attr['align'] = $align; |
|
| 87 | + $hr->attr['noshade'] = 'Bool#noshade'; |
|
| 88 | + $hr->attr['size'] = 'Pixels'; |
|
| 89 | + $hr->attr['width'] = 'Length'; |
|
| 90 | + |
|
| 91 | + $img = $this->addBlankElement('img'); |
|
| 92 | + $img->attr['align'] = 'IAlign'; |
|
| 93 | + $img->attr['border'] = 'Pixels'; |
|
| 94 | + $img->attr['hspace'] = 'Pixels'; |
|
| 95 | + $img->attr['vspace'] = 'Pixels'; |
|
| 96 | + |
|
| 97 | + // figure out this integer business |
|
| 98 | + |
|
| 99 | + $li = $this->addBlankElement('li'); |
|
| 100 | + $li->attr['value'] = new HTMLPurifier_AttrDef_Integer(); |
|
| 101 | + $li->attr['type'] = 'Enum#s:1,i,I,a,A,disc,square,circle'; |
|
| 102 | + |
|
| 103 | + $ol = $this->addBlankElement('ol'); |
|
| 104 | + $ol->attr['compact'] = 'Bool#compact'; |
|
| 105 | + $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer(); |
|
| 106 | + $ol->attr['type'] = 'Enum#s:1,i,I,a,A'; |
|
| 107 | + |
|
| 108 | + $p = $this->addBlankElement('p'); |
|
| 109 | + $p->attr['align'] = $align; |
|
| 110 | + |
|
| 111 | + $pre = $this->addBlankElement('pre'); |
|
| 112 | + $pre->attr['width'] = 'Number'; |
|
| 113 | + |
|
| 114 | + // script omitted |
|
| 115 | + |
|
| 116 | + $table = $this->addBlankElement('table'); |
|
| 117 | + $table->attr['align'] = 'Enum#left,center,right'; |
|
| 118 | + $table->attr['bgcolor'] = 'Color'; |
|
| 119 | + |
|
| 120 | + $tr = $this->addBlankElement('tr'); |
|
| 121 | + $tr->attr['bgcolor'] = 'Color'; |
|
| 122 | + |
|
| 123 | + $th = $this->addBlankElement('th'); |
|
| 124 | + $th->attr['bgcolor'] = 'Color'; |
|
| 125 | + $th->attr['height'] = 'Length'; |
|
| 126 | + $th->attr['nowrap'] = 'Bool#nowrap'; |
|
| 127 | + $th->attr['width'] = 'Length'; |
|
| 128 | + |
|
| 129 | + $td = $this->addBlankElement('td'); |
|
| 130 | + $td->attr['bgcolor'] = 'Color'; |
|
| 131 | + $td->attr['height'] = 'Length'; |
|
| 132 | + $td->attr['nowrap'] = 'Bool#nowrap'; |
|
| 133 | + $td->attr['width'] = 'Length'; |
|
| 134 | 134 | |
| 135 | - $ul = $this->addBlankElement('ul'); |
|
| 136 | - $ul->attr['compact'] = 'Bool#compact'; |
|
| 137 | - $ul->attr['type'] = 'Enum#square,disc,circle'; |
|
| 135 | + $ul = $this->addBlankElement('ul'); |
|
| 136 | + $ul->attr['compact'] = 'Bool#compact'; |
|
| 137 | + $ul->attr['type'] = 'Enum#square,disc,circle'; |
|
| 138 | 138 | |
| 139 | - // "safe" modifications to "unsafe" elements |
|
| 140 | - // WARNING: If you want to add support for an unsafe, legacy |
|
| 141 | - // attribute, make a new TrustedLegacy module with the trusted |
|
| 142 | - // bit set appropriately |
|
| 139 | + // "safe" modifications to "unsafe" elements |
|
| 140 | + // WARNING: If you want to add support for an unsafe, legacy |
|
| 141 | + // attribute, make a new TrustedLegacy module with the trusted |
|
| 142 | + // bit set appropriately |
|
| 143 | 143 | |
| 144 | - $form = $this->addBlankElement('form'); |
|
| 145 | - $form->content_model = 'Flow | #PCDATA'; |
|
| 146 | - $form->content_model_type = 'optional'; |
|
| 147 | - $form->attr['target'] = 'FrameTarget'; |
|
| 144 | + $form = $this->addBlankElement('form'); |
|
| 145 | + $form->content_model = 'Flow | #PCDATA'; |
|
| 146 | + $form->content_model_type = 'optional'; |
|
| 147 | + $form->attr['target'] = 'FrameTarget'; |
|
| 148 | 148 | |
| 149 | - $input = $this->addBlankElement('input'); |
|
| 150 | - $input->attr['align'] = 'IAlign'; |
|
| 149 | + $input = $this->addBlankElement('input'); |
|
| 150 | + $input->attr['align'] = 'IAlign'; |
|
| 151 | 151 | |
| 152 | - $legend = $this->addBlankElement('legend'); |
|
| 153 | - $legend->attr['align'] = 'LAlign'; |
|
| 152 | + $legend = $this->addBlankElement('legend'); |
|
| 153 | + $legend->attr['align'] = 'LAlign'; |
|
| 154 | 154 | |
| 155 | - } |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | 157 | } |
| 158 | 158 | |
@@ -6,37 +6,37 @@ |
||
| 6 | 6 | class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - public $name = 'List'; |
|
| 10 | - |
|
| 11 | - // According to the abstract schema, the List content set is a fully formed |
|
| 12 | - // one or more expr, but it invariably occurs in an optional declaration |
|
| 13 | - // so we're not going to do that subtlety. It might cause trouble |
|
| 14 | - // if a user defines "List" and expects that multiple lists are |
|
| 15 | - // allowed to be specified, but then again, that's not very intuitive. |
|
| 16 | - // Furthermore, the actual XML Schema may disagree. Regardless, |
|
| 17 | - // we don't have support for such nested expressions without using |
|
| 18 | - // the incredibly inefficient and draconic Custom ChildDef. |
|
| 19 | - |
|
| 20 | - public $content_sets = array('Flow' => 'List'); |
|
| 21 | - |
|
| 22 | - public function setup($config) { |
|
| 23 | - $ol = $this->addElement('ol', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); |
|
| 24 | - $ul = $this->addElement('ul', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); |
|
| 25 | - // XXX The wrap attribute is handled by MakeWellFormed. This is all |
|
| 26 | - // quite unsatisfactory, because we generated this |
|
| 27 | - // *specifically* for lists, and now a big chunk of the handling |
|
| 28 | - // is done properly by the List ChildDef. So actually, we just |
|
| 29 | - // want enough information to make autoclosing work properly, |
|
| 30 | - // and then hand off the tricky stuff to the ChildDef. |
|
| 31 | - $ol->wrap = 'li'; |
|
| 32 | - $ul->wrap = 'li'; |
|
| 33 | - $this->addElement('dl', 'List', 'Required: dt | dd', 'Common'); |
|
| 34 | - |
|
| 35 | - $this->addElement('li', false, 'Flow', 'Common'); |
|
| 36 | - |
|
| 37 | - $this->addElement('dd', false, 'Flow', 'Common'); |
|
| 38 | - $this->addElement('dt', false, 'Inline', 'Common'); |
|
| 39 | - } |
|
| 9 | + public $name = 'List'; |
|
| 10 | + |
|
| 11 | + // According to the abstract schema, the List content set is a fully formed |
|
| 12 | + // one or more expr, but it invariably occurs in an optional declaration |
|
| 13 | + // so we're not going to do that subtlety. It might cause trouble |
|
| 14 | + // if a user defines "List" and expects that multiple lists are |
|
| 15 | + // allowed to be specified, but then again, that's not very intuitive. |
|
| 16 | + // Furthermore, the actual XML Schema may disagree. Regardless, |
|
| 17 | + // we don't have support for such nested expressions without using |
|
| 18 | + // the incredibly inefficient and draconic Custom ChildDef. |
|
| 19 | + |
|
| 20 | + public $content_sets = array('Flow' => 'List'); |
|
| 21 | + |
|
| 22 | + public function setup($config) { |
|
| 23 | + $ol = $this->addElement('ol', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); |
|
| 24 | + $ul = $this->addElement('ul', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); |
|
| 25 | + // XXX The wrap attribute is handled by MakeWellFormed. This is all |
|
| 26 | + // quite unsatisfactory, because we generated this |
|
| 27 | + // *specifically* for lists, and now a big chunk of the handling |
|
| 28 | + // is done properly by the List ChildDef. So actually, we just |
|
| 29 | + // want enough information to make autoclosing work properly, |
|
| 30 | + // and then hand off the tricky stuff to the ChildDef. |
|
| 31 | + $ol->wrap = 'li'; |
|
| 32 | + $ul->wrap = 'li'; |
|
| 33 | + $this->addElement('dl', 'List', 'Required: dt | dd', 'Common'); |
|
| 34 | + |
|
| 35 | + $this->addElement('li', false, 'Flow', 'Common'); |
|
| 36 | + |
|
| 37 | + $this->addElement('dd', false, 'Flow', 'Common'); |
|
| 38 | + $this->addElement('dt', false, 'Inline', 'Common'); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
@@ -3,18 +3,18 @@ |
||
| 3 | 3 | class HTMLPurifier_HTMLModule_Name extends HTMLPurifier_HTMLModule |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | - public $name = 'Name'; |
|
| 6 | + public $name = 'Name'; |
|
| 7 | 7 | |
| 8 | - public function setup($config) { |
|
| 9 | - $elements = array('a', 'applet', 'form', 'frame', 'iframe', 'img', 'map'); |
|
| 10 | - foreach ($elements as $name) { |
|
| 11 | - $element = $this->addBlankElement($name); |
|
| 12 | - $element->attr['name'] = 'CDATA'; |
|
| 13 | - if (!$config->get('HTML.Attr.Name.UseCDATA')) { |
|
| 14 | - $element->attr_transform_post['NameSync'] = new HTMLPurifier_AttrTransform_NameSync(); |
|
| 15 | - } |
|
| 16 | - } |
|
| 17 | - } |
|
| 8 | + public function setup($config) { |
|
| 9 | + $elements = array('a', 'applet', 'form', 'frame', 'iframe', 'img', 'map'); |
|
| 10 | + foreach ($elements as $name) { |
|
| 11 | + $element = $this->addBlankElement($name); |
|
| 12 | + $element->attr['name'] = 'CDATA'; |
|
| 13 | + if (!$config->get('HTML.Attr.Name.UseCDATA')) { |
|
| 14 | + $element->attr_transform_post['NameSync'] = new HTMLPurifier_AttrTransform_NameSync(); |
|
| 15 | + } |
|
| 16 | + } |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | 19 | } |
| 20 | 20 | |
@@ -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 | |