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