0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-23 08:51:53 +00:00

Implement Presentation module.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@711 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2007-02-04 04:41:34 +00:00
parent 77d9e05a07
commit d0018a2696
5 changed files with 38 additions and 3 deletions

View File

@ -3,7 +3,7 @@
require_once 'HTMLPurifier/HTMLModule.php'; require_once 'HTMLPurifier/HTMLModule.php';
/** /**
* XHTML 1.1 Hypertext Module, defines hypertext links. * XHTML 1.1 Hypertext Module, defines hypertext links. Core Module.
*/ */
class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule
{ {

View File

@ -3,7 +3,7 @@
require_once 'HTMLPurifier/HTMLModule.php'; require_once 'HTMLPurifier/HTMLModule.php';
/** /**
* XHTML 1.1 List Module, defines list-oriented elements. * XHTML 1.1 List Module, defines list-oriented elements. Core Module.
*/ */
class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
{ {

View File

@ -0,0 +1,33 @@
<?php
require_once 'HTMLPurifier/HTMLModule.php';
/**
* XHTML 1.1 Presentation Module, defines hypertext links. Text Extension Module.
*/
class HTMLPurifier_HTMLModule_Presentation extends HTMLPurifier_HTMLModule
{
var $elements = array('b', 'big', 'hr', 'i', 'small', 'sub', 'sup', 'tt');
var $info = array();
var $content_sets = array(
'Block' => 'hr',
'Inline' => 'b | big | i | small | sub | sup | tt'
);
function HTMLPurifier_HTMLModule_Presentation() {
foreach ($this->elements as $element) {
$this->info[$element] = new HTMLPurifier_ElementDef();
$this->info[$element]->attr = array(0 => array('Common'));
if ($element == 'hr') {
$this->info[$element]->content_model_type = 'empty';
} else {
$this->info[$element]->content_model = '#PCDATA | Inline';
$this->info[$element]->content_model_type = 'optional';
}
}
}
}
?>

View File

@ -3,7 +3,7 @@
require_once 'HTMLPurifier/HTMLModule.php'; require_once 'HTMLPurifier/HTMLModule.php';
/** /**
* XHTML 1.1 Text Module, defines basic text containers. Core module. * XHTML 1.1 Text Module, defines basic text containers. Core Module.
*/ */
class HTMLPurifier_HTMLModule_Text extends HTMLPurifier_HTMLModule class HTMLPurifier_HTMLModule_Text extends HTMLPurifier_HTMLModule
{ {

View File

@ -9,6 +9,7 @@ require_once 'HTMLPurifier/HTMLModule.php';
require_once 'HTMLPurifier/HTMLModule/Text.php'; require_once 'HTMLPurifier/HTMLModule/Text.php';
require_once 'HTMLPurifier/HTMLModule/Hypertext.php'; require_once 'HTMLPurifier/HTMLModule/Hypertext.php';
require_once 'HTMLPurifier/HTMLModule/List.php'; require_once 'HTMLPurifier/HTMLModule/List.php';
require_once 'HTMLPurifier/HTMLModule/Presentation.php';
/** /**
* Next-generation HTML definition that will supplant HTMLPurifier_HTMLDefinition * Next-generation HTML definition that will supplant HTMLPurifier_HTMLDefinition
@ -26,6 +27,7 @@ class HTMLPurifier_XHTMLDefinition extends HTMLPurifier_HTMLDefinition
$this->modules['Text'] = new HTMLPurifier_HTMLModule_Text(); $this->modules['Text'] = new HTMLPurifier_HTMLModule_Text();
$this->modules['Hypertext'] = new HTMLPurifier_HTMLModule_Hypertext(); $this->modules['Hypertext'] = new HTMLPurifier_HTMLModule_Hypertext();
$this->modules['List'] = new HTMLPurifier_HTMLModule_List(); $this->modules['List'] = new HTMLPurifier_HTMLModule_List();
$this->modules['Presentation'] = new HTMLPurifier_HTMLModule_Presentation();
$this->attr_types = new HTMLPurifier_AttrTypes(); $this->attr_types = new HTMLPurifier_AttrTypes();
$this->attr_collection = new HTMLPurifier_AttrCollection(); $this->attr_collection = new HTMLPurifier_AttrCollection();