0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-09 23:28:42 +00:00

Add name class member variable to modules.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@749 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2007-02-14 22:30:17 +00:00
parent a827cbc3ba
commit 9c031b5c1e
16 changed files with 26 additions and 3 deletions

View File

@ -282,9 +282,8 @@ class HTMLPurifier_HTMLDefinition
trigger_error('Order keyword does not exist', E_USER_ERROR);
return;
}
$name = strtolower(get_class($module));
$this->modules[$name] = $module;
$this->modules_order[$name] = $order;
$this->modules[$module->name] = $module;
$this->modules_order[$module->name] = $order;
}
/**

View File

@ -16,6 +16,11 @@
class HTMLPurifier_HTMLModule
{
/**
* Short unique string identifier of the module
*/
var $name;
/**
* List of elements that the module implements.
* @note This is only for convention, as a module will often loop

View File

@ -10,6 +10,7 @@ require_once 'HTMLPurifier/AttrTransform/BdoDir.php';
class HTMLPurifier_HTMLModule_Bdo extends HTMLPurifier_HTMLModule
{
var $name = 'Bdo';
var $elements = array('bdo');
var $info = array();
var $content_sets = array('Inline' => 'bdo');

View File

@ -10,6 +10,7 @@ require_once 'HTMLPurifier/ChildDef/Chameleon.php';
class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
{
var $name = 'Edit';
var $elements = array('del', 'ins');
var $info = array();
var $content_sets = array('Inline' => 'del | ins');

View File

@ -8,6 +8,7 @@ require_once 'HTMLPurifier/HTMLModule.php';
class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule
{
var $name = 'Hypertext';
var $elements = array('a');
var $info = array();
var $content_sets = array('Inline' => 'a');

View File

@ -13,6 +13,7 @@ require_once 'HTMLPurifier/AttrTransform/ImgRequired.php';
class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
{
var $name = 'Image';
var $elements = array('img');
var $info = array();
var $content_sets = array('Inline' => 'img');

View File

@ -21,6 +21,7 @@ class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
// incomplete
var $name = 'Legacy';
var $elements = array('u', 's', 'strike');
var $non_standalone_elements = array('li', 'ol', 'address', 'blockquote');

View File

@ -8,6 +8,7 @@ require_once 'HTMLPurifier/HTMLModule.php';
class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
{
var $name = 'List';
var $elements = array('dl', 'dt', 'dd', 'ol', 'ul', 'li');
var $info = array();
// According to the abstract schema, the List content set is a fully formed

View File

@ -15,6 +15,7 @@ require_once 'HTMLPurifier/HTMLModule.php';
class HTMLPurifier_HTMLModule_Presentation extends HTMLPurifier_HTMLModule
{
var $name = 'Presentation';
var $elements = array('b', 'big', 'hr', 'i', 'small', 'sub', 'sup', 'tt');
var $info = array();
var $content_sets = array(

View File

@ -15,6 +15,8 @@ HTMLPurifier_ConfigSchema::define(
class HTMLPurifier_HTMLModule_SetParent extends HTMLPurifier_HTMLModule
{
var $name = 'SetParent';
function postProcess(&$definition) {
$parent = $definition->config->get('HTML', 'Parent');
if (isset($definition->info[$parent])) {

View File

@ -9,6 +9,8 @@ require_once 'HTMLPurifier/AttrDef/CSS.php';
*/
class HTMLPurifier_HTMLModule_StyleAttribute extends HTMLPurifier_HTMLModule
{
var $name = 'StyleAttribute';
var $attr_collections = array(
// The inclusion routine differs from the Abstract Modules but
// is in line with the DTD and XML Schemas.

View File

@ -9,6 +9,7 @@ require_once 'HTMLPurifier/ChildDef/Table.php';
class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
{
var $name = 'Tables';
var $elements = array('caption', 'table', 'td', 'th', 'tr', 'col',
'colgroup', 'tbody', 'thead', 'tfoot');
var $info = array();

View File

@ -15,6 +15,8 @@ require_once 'HTMLPurifier/HTMLModule.php';
class HTMLPurifier_HTMLModule_Text extends HTMLPurifier_HTMLModule
{
var $name = 'Text';
var $elements = array('abbr', 'acronym', 'address', 'blockquote',
'br', 'cite', 'code', 'dfn', 'div', 'em', 'h1', 'h2', 'h3',
'h4', 'h5', 'h6', 'kbd', 'p', 'pre', 'q', 'samp', 'span', 'strong',

View File

@ -10,6 +10,8 @@ require_once 'HTMLPurifier/ChildDef/StrictBlockquote.php';
class HTMLPurifier_HTMLModule_TransformToStrict extends HTMLPurifier_HTMLModule
{
var $name = 'TransformToStrict';
// we're actually modifying these elements, not defining them
var $elements = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'blockquote');

View File

@ -14,6 +14,7 @@
class HTMLPurifier_HTMLModule_TransformToXHTML11 extends HTMLPurifier_HTMLModule
{
var $name = 'TransformToXHTML11';
var $attr_collections = array(
'Lang' => array(
'lang' => false // remove it

View File

@ -35,6 +35,8 @@ HTMLPurifier_ConfigSchema::define(
class HTMLPurifier_HTMLModule_TweakSubtractiveWhitelist extends HTMLPurifier_HTMLModule
{
var $name = 'TweakSubtractiveWhitelist';
function postProcess(&$definition) {
// setup allowed elements, SubtractiveWhitelist module