[0924b6c] | 1 | <?php
|
---|
| 2 | /**
|
---|
| 3 | * Ok, glad you are here
|
---|
| 4 | * first we get a config instance, and set the settings
|
---|
| 5 | * $config = HTMLPurifier_Config::createDefault();
|
---|
| 6 | * $config->set('Core.Encoding', $this->config->get('purifier.encoding'));
|
---|
| 7 | * $config->set('Cache.SerializerPath', $this->config->get('purifier.cachePath'));
|
---|
| 8 | * if ( ! $this->config->get('purifier.finalize')) {
|
---|
| 9 | * $config->autoFinalize = false;
|
---|
| 10 | * }
|
---|
| 11 | * $config->loadArray($this->getConfig());
|
---|
| 12 | *
|
---|
| 13 | * You must NOT delete the default settings
|
---|
| 14 | * anything in settings should be compacted with params that needed to instance HTMLPurifier_Config.
|
---|
| 15 | *
|
---|
| 16 | * @link http://htmlpurifier.org/live/configdoc/plain.html
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | return [
|
---|
| 20 | 'encoding' => 'UTF-8',
|
---|
| 21 | 'finalize' => true,
|
---|
| 22 | 'cachePath' => storage_path('app/purifier'),
|
---|
| 23 | 'cacheFileMode' => 0755,
|
---|
| 24 | 'settings' => [
|
---|
| 25 | 'default' => [
|
---|
| 26 | 'HTML.Doctype' => 'HTML 4.01 Transitional',
|
---|
| 27 | 'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title|target],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',
|
---|
| 28 | 'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
|
---|
| 29 | 'AutoFormat.AutoParagraph' => true,
|
---|
| 30 | 'AutoFormat.RemoveEmpty' => true,
|
---|
| 31 | 'URI.AllowedSchemes' => [
|
---|
| 32 | 'data' => true,
|
---|
| 33 | 'http' => true,
|
---|
| 34 | 'https' => true,
|
---|
| 35 | ],
|
---|
| 36 | ],
|
---|
| 37 | 'test' => [
|
---|
| 38 | 'Attr.EnableID' => 'true',
|
---|
| 39 | ],
|
---|
| 40 | "youtube" => [
|
---|
| 41 | "HTML.SafeIframe" => 'true',
|
---|
| 42 | "URI.SafeIframeRegexp" => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%",
|
---|
| 43 | ],
|
---|
| 44 | 'custom_definition' => [
|
---|
| 45 | 'id' => 'html5-definitions',
|
---|
| 46 | 'rev' => 1,
|
---|
| 47 | 'debug' => false,
|
---|
| 48 | 'elements' => [
|
---|
| 49 | // http://developers.whatwg.org/sections.html
|
---|
| 50 | ['section', 'Block', 'Flow', 'Common'],
|
---|
| 51 | ['nav', 'Block', 'Flow', 'Common'],
|
---|
| 52 | ['article', 'Block', 'Flow', 'Common'],
|
---|
| 53 | ['aside', 'Block', 'Flow', 'Common'],
|
---|
| 54 | ['header', 'Block', 'Flow', 'Common'],
|
---|
| 55 | ['footer', 'Block', 'Flow', 'Common'],
|
---|
| 56 |
|
---|
| 57 | // Content model actually excludes several tags, not modelled here
|
---|
| 58 | ['address', 'Block', 'Flow', 'Common'],
|
---|
| 59 | ['hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common'],
|
---|
| 60 |
|
---|
| 61 | // http://developers.whatwg.org/grouping-content.html
|
---|
| 62 | ['figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common'],
|
---|
| 63 | ['figcaption', 'Inline', 'Flow', 'Common'],
|
---|
| 64 |
|
---|
| 65 | // http://developers.whatwg.org/the-video-element.html#the-video-element
|
---|
| 66 | ['video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [
|
---|
| 67 | 'src' => 'URI',
|
---|
| 68 | 'type' => 'Text',
|
---|
| 69 | 'width' => 'Length',
|
---|
| 70 | 'height' => 'Length',
|
---|
| 71 | 'poster' => 'URI',
|
---|
| 72 | 'preload' => 'Enum#auto,metadata,none',
|
---|
| 73 | 'controls' => 'Bool',
|
---|
| 74 | ]],
|
---|
| 75 | ['source', 'Block', 'Flow', 'Common', [
|
---|
| 76 | 'src' => 'URI',
|
---|
| 77 | 'type' => 'Text',
|
---|
| 78 | ]],
|
---|
| 79 |
|
---|
| 80 | // http://developers.whatwg.org/text-level-semantics.html
|
---|
| 81 | ['s', 'Inline', 'Inline', 'Common'],
|
---|
| 82 | ['var', 'Inline', 'Inline', 'Common'],
|
---|
| 83 | ['sub', 'Inline', 'Inline', 'Common'],
|
---|
| 84 | ['sup', 'Inline', 'Inline', 'Common'],
|
---|
| 85 | ['mark', 'Inline', 'Inline', 'Common'],
|
---|
| 86 | ['wbr', 'Inline', 'Empty', 'Core'],
|
---|
| 87 |
|
---|
| 88 | // http://developers.whatwg.org/edits.html
|
---|
| 89 | ['ins', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
|
---|
| 90 | ['del', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
|
---|
| 91 | ],
|
---|
| 92 | 'attributes' => [
|
---|
| 93 | ['iframe', 'allowfullscreen', 'Bool'],
|
---|
| 94 | ['table', 'height', 'Text'],
|
---|
| 95 | ['td', 'border', 'Text'],
|
---|
| 96 | ['th', 'border', 'Text'],
|
---|
| 97 | ['tr', 'width', 'Text'],
|
---|
| 98 | ['tr', 'height', 'Text'],
|
---|
| 99 | ['tr', 'border', 'Text'],
|
---|
| 100 | ],
|
---|
| 101 | ],
|
---|
| 102 | 'custom_attributes' => [
|
---|
| 103 | ['a', 'href', 'Enum#_blank,_self,_target,_top'],
|
---|
| 104 | ],
|
---|
| 105 | 'custom_elements' => [
|
---|
| 106 | ['u', 'Inline', 'Inline', 'Common'],
|
---|
| 107 | ],
|
---|
| 108 | ],
|
---|
| 109 |
|
---|
| 110 | ];
|
---|