1: <?php
2:
3: 4: 5: 6: 7: 8:
9:
10: 11: 12: 13: 14: 15:
16: class HTMLPurifier_HTMLModule_Scripting extends HTMLPurifier_HTMLModule
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:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
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: }
53:
54:
55: