| 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: | |
| 19: | |
| 20: |
|
| 21: | public $name = 'Scripting';
|
| 22: |
|
| 23: | |
| 24: | |
| 25: |
|
| 26: | public $elements = array('script', 'noscript');
|
| 27: |
|
| 28: | |
| 29: | |
| 30: |
|
| 31: | public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript');
|
| 32: |
|
| 33: | |
| 34: | |
| 35: |
|
| 36: | public $safe = false;
|
| 37: |
|
| 38: | |
| 39: | |
| 40: |
|
| 41: | public function setup($config)
|
| 42: | {
|
| 43: |
|
| 44: |
|
| 45: |
|
| 46: |
|
| 47: |
|
| 48: |
|
| 49: |
|
| 50: |
|
| 51: |
|
| 52: |
|
| 53: |
|
| 54: | $this->info['noscript'] = new HTMLPurifier_ElementDef();
|
| 55: | $this->info['noscript']->attr = array(0 => array('Common'));
|
| 56: | $this->info['noscript']->content_model = 'Heading | List | Block';
|
| 57: | $this->info['noscript']->content_model_type = 'required';
|
| 58: |
|
| 59: | $this->info['script'] = new HTMLPurifier_ElementDef();
|
| 60: | $this->info['script']->attr = array(
|
| 61: | 'defer' => new HTMLPurifier_AttrDef_Enum(array('defer')),
|
| 62: | 'src' => new HTMLPurifier_AttrDef_URI(true),
|
| 63: | 'type' => new HTMLPurifier_AttrDef_Enum(array('text/javascript'))
|
| 64: | );
|
| 65: | $this->info['script']->content_model = '#PCDATA';
|
| 66: | $this->info['script']->content_model_type = 'optional';
|
| 67: | $this->info['script']->attr_transform_pre[] =
|
| 68: | $this->info['script']->attr_transform_post[] =
|
| 69: | new HTMLPurifier_AttrTransform_ScriptRequired();
|
| 70: | }
|
| 71: | }
|
| 72: |
|
| 73: |
|
| 74: | |