]> git.mxchange.org Git - friendica.git/blob - library/HTMLPurifier/HTMLModule/Text.php
Merge branch 'master' of https://github.com/friendica/friendica
[friendica.git] / library / HTMLPurifier / HTMLModule / Text.php
1 <?php
2
3 /**
4  * XHTML 1.1 Text Module, defines basic text containers. Core Module.
5  * @note In the normative XML Schema specification, this module
6  *       is further abstracted into the following modules:
7  *          - Block Phrasal (address, blockquote, pre, h1, h2, h3, h4, h5, h6)
8  *          - Block Structural (div, p)
9  *          - Inline Phrasal (abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var)
10  *          - Inline Structural (br, span)
11  *       This module, functionally, does not distinguish between these
12  *       sub-modules, but the code is internally structured to reflect
13  *       these distinctions.
14  */
15 class HTMLPurifier_HTMLModule_Text extends HTMLPurifier_HTMLModule
16 {
17
18     public $name = 'Text';
19     public $content_sets = array(
20         'Flow' => 'Heading | Block | Inline'
21     );
22
23     public function setup($config) {
24
25         // Inline Phrasal -------------------------------------------------
26         $this->addElement('abbr',    'Inline', 'Inline', 'Common');
27         $this->addElement('acronym', 'Inline', 'Inline', 'Common');
28         $this->addElement('cite',    'Inline', 'Inline', 'Common');
29         $this->addElement('dfn',     'Inline', 'Inline', 'Common');
30         $this->addElement('kbd',     'Inline', 'Inline', 'Common');
31         $this->addElement('q',       'Inline', 'Inline', 'Common', array('cite' => 'URI'));
32         $this->addElement('samp',    'Inline', 'Inline', 'Common');
33         $this->addElement('var',     'Inline', 'Inline', 'Common');
34
35         $em = $this->addElement('em',      'Inline', 'Inline', 'Common');
36         $em->formatting = true;
37
38         $strong = $this->addElement('strong',  'Inline', 'Inline', 'Common');
39         $strong->formatting = true;
40
41         $code = $this->addElement('code',    'Inline', 'Inline', 'Common');
42         $code->formatting = true;
43
44         // Inline Structural ----------------------------------------------
45         $this->addElement('span', 'Inline', 'Inline', 'Common');
46         $this->addElement('br',   'Inline', 'Empty',  'Core');
47
48         // Block Phrasal --------------------------------------------------
49         $this->addElement('address',     'Block', 'Inline', 'Common');
50         $this->addElement('blockquote',  'Block', 'Optional: Heading | Block | List', 'Common', array('cite' => 'URI') );
51         $pre = $this->addElement('pre', 'Block', 'Inline', 'Common');
52         $pre->excludes = $this->makeLookup(
53             'img', 'big', 'small', 'object', 'applet', 'font', 'basefont' );
54         $this->addElement('h1', 'Heading', 'Inline', 'Common');
55         $this->addElement('h2', 'Heading', 'Inline', 'Common');
56         $this->addElement('h3', 'Heading', 'Inline', 'Common');
57         $this->addElement('h4', 'Heading', 'Inline', 'Common');
58         $this->addElement('h5', 'Heading', 'Inline', 'Common');
59         $this->addElement('h6', 'Heading', 'Inline', 'Common');
60
61         // Block Structural -----------------------------------------------
62         $p = $this->addElement('p', 'Block', 'Inline', 'Common');
63         $p->autoclose = array_flip(array("address", "blockquote", "center", "dir", "div", "dl", "fieldset", "ol", "p", "ul"));
64
65         $this->addElement('div', 'Block', 'Flow', 'Common');
66
67     }
68
69 }
70
71 // vim: et sw=4 sts=4