0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-01-03 13:21:51 +00:00

__construct'ify all main library classes.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1459 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2007-11-29 04:29:51 +00:00
parent 43f01925cd
commit 3ef9bdf8a2
67 changed files with 75 additions and 74 deletions

1
NEWS
View File

@ -14,6 +14,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
until PHP 4 is completely deprecated, but no new features will be added until PHP 4 is completely deprecated, but no new features will be added
to it. to it.
+ Visibility declarations added + Visibility declarations added
+ Constructor methods renamed to __construct()
2.1.3, released 2007-11-05 2.1.3, released 2007-11-05
! tests/multitest.php allows you to test multiple versions by running ! tests/multitest.php allows you to test multiple versions by running

View File

@ -105,7 +105,7 @@ class HTMLPurifier
* The parameter can also be any type that * The parameter can also be any type that
* HTMLPurifier_Config::create() supports. * HTMLPurifier_Config::create() supports.
*/ */
public function HTMLPurifier($config = null) { public function __construct($config = null) {
$this->config = HTMLPurifier_Config::create($config); $this->config = HTMLPurifier_Config::create($config);

View File

@ -21,7 +21,7 @@ class HTMLPurifier_AttrCollections
* @param $attr_types HTMLPurifier_AttrTypes instance * @param $attr_types HTMLPurifier_AttrTypes instance
* @param $modules Hash array of HTMLPurifier_HTMLModule members * @param $modules Hash array of HTMLPurifier_HTMLModule members
*/ */
public function HTMLPurifier_AttrCollections($attr_types, $modules) { public function __construct($attr_types, $modules) {
// load extensions from the modules // load extensions from the modules
foreach ($modules as $module) { foreach ($modules as $module) {
foreach ($module->attr_collections as $coll_i => $coll) { foreach ($module->attr_collections as $coll_i => $coll) {

View File

@ -16,7 +16,7 @@ class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
*/ */
protected $info; protected $info;
public function HTMLPurifier_AttrDef_CSS_Background($config) { public function __construct($config) {
$def = $config->getCSSDefinition(); $def = $config->getCSSDefinition();
$this->info['background-color'] = $def->info['background-color']; $this->info['background-color'] = $def->info['background-color'];
$this->info['background-image'] = $def->info['background-image']; $this->info['background-image'] = $def->info['background-image'];

View File

@ -51,7 +51,7 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
protected $length; protected $length;
protected $percentage; protected $percentage;
public function HTMLPurifier_AttrDef_CSS_BackgroundPosition() { public function __construct() {
$this->length = new HTMLPurifier_AttrDef_CSS_Length(); $this->length = new HTMLPurifier_AttrDef_CSS_Length();
$this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage(); $this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
} }

View File

@ -13,7 +13,7 @@ class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
*/ */
protected $info = array(); protected $info = array();
public function HTMLPurifier_AttrDef_CSS_Border($config) { public function __construct($config) {
$def = $config->getCSSDefinition(); $def = $config->getCSSDefinition();
$this->info['border-width'] = $def->info['border-width']; $this->info['border-width'] = $def->info['border-width'];
$this->info['border-style'] = $def->info['border-style']; $this->info['border-style'] = $def->info['border-style'];

View File

@ -21,7 +21,7 @@ class HTMLPurifier_AttrDef_CSS_Composite extends HTMLPurifier_AttrDef
/** /**
* @param $defs List of HTMLPurifier_AttrDef objects * @param $defs List of HTMLPurifier_AttrDef objects
*/ */
public function HTMLPurifier_AttrDef_CSS_Composite($defs) { public function __construct($defs) {
$this->defs = $defs; $this->defs = $defs;
} }

View File

@ -18,7 +18,7 @@ class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
*/ */
protected $info = array(); protected $info = array();
public function HTMLPurifier_AttrDef_CSS_Font($config) { public function __construct($config) {
$def = $config->getCSSDefinition(); $def = $config->getCSSDefinition();
$this->info['font-style'] = $def->info['font-style']; $this->info['font-style'] = $def->info['font-style'];
$this->info['font-variant'] = $def->info['font-variant']; $this->info['font-variant'] = $def->info['font-variant'];

View File

@ -25,7 +25,7 @@ class HTMLPurifier_AttrDef_CSS_Length extends HTMLPurifier_AttrDef
* @param $non_negative Bool indication whether or not negative values are * @param $non_negative Bool indication whether or not negative values are
* allowed. * allowed.
*/ */
public function HTMLPurifier_AttrDef_CSS_Length($non_negative = false) { public function __construct($non_negative = false) {
$this->number_def = new HTMLPurifier_AttrDef_CSS_Number($non_negative); $this->number_def = new HTMLPurifier_AttrDef_CSS_Number($non_negative);
} }

View File

@ -15,7 +15,7 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
*/ */
protected $info; protected $info;
public function HTMLPurifier_AttrDef_CSS_ListStyle($config) { public function __construct($config) {
$def = $config->getCSSDefinition(); $def = $config->getCSSDefinition();
$this->info['list-style-type'] = $def->info['list-style-type']; $this->info['list-style-type'] = $def->info['list-style-type'];
$this->info['list-style-position'] = $def->info['list-style-position']; $this->info['list-style-position'] = $def->info['list-style-position'];

View File

@ -32,7 +32,7 @@ class HTMLPurifier_AttrDef_CSS_Multiple extends HTMLPurifier_AttrDef
* @param $single HTMLPurifier_AttrDef to multiply * @param $single HTMLPurifier_AttrDef to multiply
* @param $max Max number of values allowed (usually four) * @param $max Max number of values allowed (usually four)
*/ */
public function HTMLPurifier_AttrDef_CSS_Multiple($single, $max = 4) { public function __construct($single, $max = 4) {
$this->single = $single; $this->single = $single;
$this->max = $max; $this->max = $max;
} }

View File

@ -14,7 +14,7 @@ class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
/** /**
* @param $non_negative Bool indicating whether negatives are forbidden * @param $non_negative Bool indicating whether negatives are forbidden
*/ */
public function HTMLPurifier_AttrDef_CSS_Number($non_negative = false) { public function __construct($non_negative = false) {
$this->non_negative = $non_negative; $this->non_negative = $non_negative;
} }

View File

@ -17,7 +17,7 @@ class HTMLPurifier_AttrDef_CSS_Percentage extends HTMLPurifier_AttrDef
/** /**
* @param Bool indicating whether to forbid negative values * @param Bool indicating whether to forbid negative values
*/ */
public function HTMLPurifier_AttrDef_CSS_Percentage($non_negative = false) { public function __construct($non_negative = false) {
$this->number_def = new HTMLPurifier_AttrDef_CSS_Number($non_negative); $this->number_def = new HTMLPurifier_AttrDef_CSS_Number($non_negative);
} }

View File

@ -14,8 +14,8 @@ require_once 'HTMLPurifier/AttrDef/URI.php';
class HTMLPurifier_AttrDef_CSS_URI extends HTMLPurifier_AttrDef_URI class HTMLPurifier_AttrDef_CSS_URI extends HTMLPurifier_AttrDef_URI
{ {
public function HTMLPurifier_AttrDef_CSS_URI() { public function __construct() {
parent::HTMLPurifier_AttrDef_URI(true); // always embedded parent::__construct(true); // always embedded
} }
public function validate($uri_string, $config, &$context) { public function validate($uri_string, $config, &$context) {

View File

@ -28,7 +28,7 @@ class HTMLPurifier_AttrDef_Enum extends HTMLPurifier_AttrDef
* @param $valid_values List of valid values * @param $valid_values List of valid values
* @param $case_sensitive Bool indicating whether or not case sensitive * @param $case_sensitive Bool indicating whether or not case sensitive
*/ */
public function HTMLPurifier_AttrDef_Enum( public function __construct(
$valid_values = array(), $case_sensitive = false $valid_values = array(), $case_sensitive = false
) { ) {
$this->valid_values = array_flip($valid_values); $this->valid_values = array_flip($valid_values);

View File

@ -11,7 +11,7 @@ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
protected $name; protected $name;
public $minimized = true; public $minimized = true;
public function HTMLPurifier_AttrDef_HTML_Bool($name = false) {$this->name = $name;} public function __construct($name = false) {$this->name = $name;}
public function validate($string, $config, &$context) { public function validate($string, $config, &$context) {
if (empty($string)) return false; if (empty($string)) return false;

View File

@ -22,7 +22,7 @@ class HTMLPurifier_AttrDef_HTML_FrameTarget extends HTMLPurifier_AttrDef_Enum
public $valid_values = false; // uninitialized value public $valid_values = false; // uninitialized value
protected $case_sensitive = false; protected $case_sensitive = false;
public function HTMLPurifier_AttrDef_HTML_FrameTarget() {} public function __construct() {}
public function validate($string, $config, &$context) { public function validate($string, $config, &$context) {
if ($this->valid_values === false) $this->valid_values = $config->get('Attr', 'AllowedFrameTargets'); if ($this->valid_values === false) $this->valid_values = $config->get('Attr', 'AllowedFrameTargets');

View File

@ -29,7 +29,7 @@ class HTMLPurifier_AttrDef_HTML_LinkTypes extends HTMLPurifier_AttrDef
/** Name config attribute to pull. */ /** Name config attribute to pull. */
protected $name; protected $name;
public function HTMLPurifier_AttrDef_HTML_LinkTypes($name) { public function __construct($name) {
$configLookup = array( $configLookup = array(
'rel' => 'AllowedRel', 'rel' => 'AllowedRel',
'rev' => 'AllowedRev' 'rev' => 'AllowedRev'

View File

@ -32,7 +32,7 @@ class HTMLPurifier_AttrDef_Integer extends HTMLPurifier_AttrDef
* @param $zero Bool indicating whether or not zero is allowed * @param $zero Bool indicating whether or not zero is allowed
* @param $positive Bool indicating whether or not positive values are allowed * @param $positive Bool indicating whether or not positive values are allowed
*/ */
public function HTMLPurifier_AttrDef_Integer( public function __construct(
$negative = true, $zero = true, $positive = true $negative = true, $zero = true, $positive = true
) { ) {
$this->negative = $negative; $this->negative = $negative;

View File

@ -74,7 +74,7 @@ class HTMLPurifier_AttrDef_URI extends HTMLPurifier_AttrDef
/** /**
* @param $embeds_resource_resource Does the URI here result in an extra HTTP request? * @param $embeds_resource_resource Does the URI here result in an extra HTTP request?
*/ */
public function HTMLPurifier_AttrDef_URI($embeds_resource = false) { public function __construct($embeds_resource = false) {
$this->parser = new HTMLPurifier_URIParser(); $this->parser = new HTMLPurifier_URIParser();
$this->percentEncoder = new HTMLPurifier_PercentEncoder(); $this->percentEncoder = new HTMLPurifier_PercentEncoder();
$this->embedsResource = (bool) $embeds_resource; $this->embedsResource = (bool) $embeds_resource;

View File

@ -20,7 +20,7 @@ class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
*/ */
protected $ipv6; protected $ipv6;
public function HTMLPurifier_AttrDef_URI_Host() { public function __construct() {
$this->ipv4 = new HTMLPurifier_AttrDef_URI_IPv4(); $this->ipv4 = new HTMLPurifier_AttrDef_URI_IPv4();
$this->ipv6 = new HTMLPurifier_AttrDef_URI_IPv6(); $this->ipv6 = new HTMLPurifier_AttrDef_URI_IPv6();
} }

View File

@ -22,7 +22,7 @@ extends HTMLPurifier_AttrTransform {
* @param $attr string attribute name to convert from * @param $attr string attribute name to convert from
* @param $css string CSS declarations to add to style (needs semicolon) * @param $css string CSS declarations to add to style (needs semicolon)
*/ */
public function HTMLPurifier_AttrTransform_BoolToCSS($attr, $css) { public function __construct($attr, $css) {
$this->attr = $attr; $this->attr = $attr;
$this->css = $css; $this->css = $css;
} }

View File

@ -30,7 +30,7 @@ class HTMLPurifier_AttrTransform_EnumToCSS extends HTMLPurifier_AttrTransform {
* @param $enumToCSS Lookup array of attribute values to CSS * @param $enumToCSS Lookup array of attribute values to CSS
* @param $case_sensitive Boolean case sensitivity indicator, default false * @param $case_sensitive Boolean case sensitivity indicator, default false
*/ */
public function HTMLPurifier_AttrTransform_EnumToCSS($attr, $enum_to_css, $case_sensitive = false) { public function __construct($attr, $enum_to_css, $case_sensitive = false) {
$this->attr = $attr; $this->attr = $attr;
$this->enumToCSS = $enum_to_css; $this->enumToCSS = $enum_to_css;
$this->caseSensitive = (bool) $case_sensitive; $this->caseSensitive = (bool) $case_sensitive;

View File

@ -13,7 +13,7 @@ class HTMLPurifier_AttrTransform_ImgSpace extends HTMLPurifier_AttrTransform {
'vspace' => array('top', 'bottom') 'vspace' => array('top', 'bottom')
); );
public function HTMLPurifier_AttrTransform_ImgSpace($attr) { public function __construct($attr) {
$this->attr = $attr; $this->attr = $attr;
if (!isset($this->css[$attr])) { if (!isset($this->css[$attr])) {
trigger_error(htmlspecialchars($attr) . ' is not valid space attribute'); trigger_error(htmlspecialchars($attr) . ' is not valid space attribute');

View File

@ -11,7 +11,7 @@ class HTMLPurifier_AttrTransform_Length extends HTMLPurifier_AttrTransform
protected $name; protected $name;
protected $cssName; protected $cssName;
public function HTMLPurifier_AttrTransform_Length($name, $css_name = null) { public function __construct($name, $css_name = null) {
$this->name = $name; $this->name = $name;
$this->cssName = $css_name ? $css_name : $name; $this->cssName = $css_name ? $css_name : $name;
} }

View File

@ -27,7 +27,7 @@ class HTMLPurifier_AttrTypes
* Constructs the info array, supplying default implementations for attribute * Constructs the info array, supplying default implementations for attribute
* types. * types.
*/ */
public function HTMLPurifier_AttrTypes() { public function __construct() {
// pseudo-types, must be instantiated via shorthand // pseudo-types, must be instantiated via shorthand
$this->info['Enum'] = new HTMLPurifier_AttrDef_Enum(); $this->info['Enum'] = new HTMLPurifier_AttrDef_Enum();
$this->info['Bool'] = new HTMLPurifier_AttrDef_HTML_Bool(); $this->info['Bool'] = new HTMLPurifier_AttrDef_HTML_Bool();

View File

@ -30,7 +30,7 @@ class HTMLPurifier_ChildDef_Chameleon extends HTMLPurifier_ChildDef
* @param $inline List of elements to allow when inline. * @param $inline List of elements to allow when inline.
* @param $block List of elements to allow when block. * @param $block List of elements to allow when block.
*/ */
public function HTMLPurifier_ChildDef_Chameleon($inline, $block) { public function __construct($inline, $block) {
$this->inline = new HTMLPurifier_ChildDef_Optional($inline); $this->inline = new HTMLPurifier_ChildDef_Optional($inline);
$this->block = new HTMLPurifier_ChildDef_Optional($block); $this->block = new HTMLPurifier_ChildDef_Optional($block);
$this->elements = $this->block->elements; $this->elements = $this->block->elements;

View File

@ -26,7 +26,7 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
/** /**
* @param $dtd_regex Allowed child pattern from the DTD * @param $dtd_regex Allowed child pattern from the DTD
*/ */
public function HTMLPurifier_ChildDef_Custom($dtd_regex) { public function __construct($dtd_regex) {
$this->dtd_regex = $dtd_regex; $this->dtd_regex = $dtd_regex;
$this->_compileRegex(); $this->_compileRegex();
} }

View File

@ -13,7 +13,7 @@ class HTMLPurifier_ChildDef_Empty extends HTMLPurifier_ChildDef
{ {
public $allow_empty = true; public $allow_empty = true;
public $type = 'empty'; public $type = 'empty';
public function HTMLPurifier_ChildDef_Empty() {} public function __construct() {}
public function validateChildren($tokens_of_children, $config, &$context) { public function validateChildren($tokens_of_children, $config, &$context) {
return array(); return array();
} }

View File

@ -15,7 +15,7 @@ class HTMLPurifier_ChildDef_Required extends HTMLPurifier_ChildDef
/** /**
* @param $elements List of allowed element names (lowercase). * @param $elements List of allowed element names (lowercase).
*/ */
public function HTMLPurifier_ChildDef_Required($elements) { public function __construct($elements) {
if (is_string($elements)) { if (is_string($elements)) {
$elements = str_replace(' ', '', $elements); $elements = str_replace(' ', '', $elements);
$elements = explode('|', $elements); $elements = explode('|', $elements);

View File

@ -11,7 +11,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
public $type = 'table'; public $type = 'table';
public $elements = array('tr' => true, 'tbody' => true, 'thead' => true, public $elements = array('tr' => true, 'tbody' => true, 'thead' => true,
'tfoot' => true, 'caption' => true, 'colgroup' => true, 'col' => true); 'tfoot' => true, 'caption' => true, 'colgroup' => true, 'col' => true);
public function HTMLPurifier_ChildDef_Table() {} public function __construct() {}
public function validateChildren($tokens_of_children, $config, &$context) { public function validateChildren($tokens_of_children, $config, &$context) {
if (empty($tokens_of_children)) return false; if (empty($tokens_of_children)) return false;

View File

@ -91,7 +91,7 @@ class HTMLPurifier_Config
* @param $definition HTMLPurifier_ConfigSchema that defines what directives * @param $definition HTMLPurifier_ConfigSchema that defines what directives
* are allowed. * are allowed.
*/ */
public function HTMLPurifier_Config(&$definition) { public function __construct(&$definition) {
$this->conf = $definition->defaults; // set up, copy in defaults $this->conf = $definition->defaults; // set up, copy in defaults
$this->def = $definition; // keep a copy around for checking $this->def = $definition; // keep a copy around for checking
} }

View File

@ -11,7 +11,7 @@ class HTMLPurifier_ConfigDef_Directive extends HTMLPurifier_ConfigDef
public $class = 'directive'; public $class = 'directive';
public function HTMLPurifier_ConfigDef_Directive( public function __construct(
$type = null, $type = null,
$descriptions = null, $descriptions = null,
$allow_null = null, $allow_null = null,

View File

@ -18,7 +18,7 @@ class HTMLPurifier_ConfigDef_DirectiveAlias extends HTMLPurifier_ConfigDef
*/ */
public $name; public $name;
public function HTMLPurifier_ConfigDef_DirectiveAlias($namespace, $name) { public function __construct($namespace, $name) {
$this->namespace = $namespace; $this->namespace = $namespace;
$this->name = $name; $this->name = $name;
} }

View File

@ -38,7 +38,7 @@ class HTMLPurifier_ContentSets
* sets and populates the keys, values and lookup member variables. * sets and populates the keys, values and lookup member variables.
* @param $modules List of HTMLPurifier_HTMLModule * @param $modules List of HTMLPurifier_HTMLModule
*/ */
public function HTMLPurifier_ContentSets($modules) { public function __construct($modules) {
if (!is_array($modules)) $modules = array($modules); if (!is_array($modules)) $modules = array($modules);
// populate content_sets based on module hints // populate content_sets based on module hints
// sorry, no way of overloading // sorry, no way of overloading

View File

@ -24,7 +24,7 @@ abstract class HTMLPurifier_DefinitionCache
* @param $name Type of definition objects this instance of the * @param $name Type of definition objects this instance of the
* cache will handle. * cache will handle.
*/ */
public function HTMLPurifier_DefinitionCache($type) { public function __construct($type) {
$this->type = $type; $this->type = $type;
} }

View File

@ -10,7 +10,7 @@ class HTMLPurifier_DefinitionCache_Decorator extends HTMLPurifier_DefinitionCach
*/ */
public $cache; public $cache;
public function HTMLPurifier_DefinitionCache_Decorator() {} public function __construct() {}
/** /**
* Lazy decorator function * Lazy decorator function

View File

@ -44,7 +44,7 @@ class HTMLPurifier_Doctype
*/ */
public $dtdSystem; public $dtdSystem;
public function HTMLPurifier_Doctype($name = null, $xml = true, $modules = array(), public function __construct($name = null, $xml = true, $modules = array(),
$tidyModules = array(), $aliases = array(), $dtd_public = null, $dtd_system = null $tidyModules = array(), $aliases = array(), $dtd_public = null, $dtd_system = null
) { ) {
$this->name = $name; $this->name = $name;

View File

@ -58,7 +58,7 @@ class HTMLPurifier_Encoder
/** /**
* Constructor throws fatal error if you attempt to instantiate class * Constructor throws fatal error if you attempt to instantiate class
*/ */
private function HTMLPurifier_Encoder() { private function __construct() {
trigger_error('Cannot instantiate encoder, call methods statically', E_USER_ERROR); trigger_error('Cannot instantiate encoder, call methods statically', E_USER_ERROR);
} }

View File

@ -14,7 +14,7 @@ class HTMLPurifier_ErrorCollector
protected $generator; protected $generator;
protected $context; protected $context;
public function HTMLPurifier_ErrorCollector(&$context) { public function __construct(&$context) {
$this->locale =& $context->get('Locale'); $this->locale =& $context->get('Locale');
$this->generator =& $context->get('Generator'); $this->generator =& $context->get('Generator');
$this->context =& $context; $this->context =& $context;

View File

@ -273,7 +273,7 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
/** /**
* Performs low-cost, preliminary initialization. * Performs low-cost, preliminary initialization.
*/ */
public function HTMLPurifier_HTMLDefinition() { public function __construct() {
$this->manager = new HTMLPurifier_HTMLModuleManager(); $this->manager = new HTMLPurifier_HTMLModuleManager();
} }

View File

@ -15,7 +15,7 @@ class HTMLPurifier_HTMLModule_Bdo extends HTMLPurifier_HTMLModule
'I18N' => array('dir' => false) 'I18N' => array('dir' => false)
); );
public function HTMLPurifier_HTMLModule_Bdo() { public function __construct() {
$bdo =& $this->addElement( $bdo =& $this->addElement(
'bdo', true, 'Inline', 'Inline', array('Core', 'Lang'), 'bdo', true, 'Inline', 'Inline', array('Core', 'Lang'),
array( array(

View File

@ -12,7 +12,7 @@ class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
public $name = 'Edit'; public $name = 'Edit';
public function HTMLPurifier_HTMLModule_Edit() { public function __construct() {
$contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow'; $contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow';
$attr = array( $attr = array(
'cite' => 'URI', 'cite' => 'URI',

View File

@ -11,7 +11,7 @@ class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule
public $name = 'Hypertext'; public $name = 'Hypertext';
public function HTMLPurifier_HTMLModule_Hypertext() { public function __construct() {
$a =& $this->addElement( $a =& $this->addElement(
'a', true, 'Inline', 'Inline', 'Common', 'a', true, 'Inline', 'Inline', 'Common',
array( array(

View File

@ -15,7 +15,7 @@ class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
public $name = 'Image'; public $name = 'Image';
public function HTMLPurifier_HTMLModule_Image() { public function __construct() {
$img =& $this->addElement( $img =& $this->addElement(
'img', true, 'Inline', 'Empty', 'Common', 'img', true, 'Inline', 'Empty', 'Common',
array( array(

View File

@ -23,7 +23,7 @@ class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
public $name = 'Legacy'; public $name = 'Legacy';
public function HTMLPurifier_HTMLModule_Legacy() { public function __construct() {
$this->addElement('basefont', true, 'Inline', 'Empty', false, array( $this->addElement('basefont', true, 'Inline', 'Empty', false, array(
'color' => 'Color', 'color' => 'Color',

View File

@ -21,7 +21,7 @@ class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
public $content_sets = array('Flow' => 'List'); public $content_sets = array('Flow' => 'List');
public function HTMLPurifier_HTMLModule_List() { public function __construct() {
$this->addElement('ol', true, 'List', 'Required: li', 'Common'); $this->addElement('ol', true, 'List', 'Required: li', 'Common');
$this->addElement('ul', true, 'List', 'Required: li', 'Common'); $this->addElement('ul', true, 'List', 'Required: li', 'Common');
$this->addElement('dl', true, 'List', 'Required: dt | dd', 'Common'); $this->addElement('dl', true, 'List', 'Required: dt | dd', 'Common');

View File

@ -12,7 +12,7 @@ class HTMLPurifier_HTMLModule_Object extends HTMLPurifier_HTMLModule
public $name = 'Object'; public $name = 'Object';
public function HTMLPurifier_HTMLModule_Object() { public function __construct() {
$this->addElement('object', false, 'Inline', 'Optional: #PCDATA | Flow | param', 'Common', $this->addElement('object', false, 'Inline', 'Optional: #PCDATA | Flow | param', 'Common',
array( array(

View File

@ -17,7 +17,7 @@ class HTMLPurifier_HTMLModule_Presentation extends HTMLPurifier_HTMLModule
public $name = 'Presentation'; public $name = 'Presentation';
public function HTMLPurifier_HTMLModule_Presentation() { public function __construct() {
$this->addElement('b', true, 'Inline', 'Inline', 'Common'); $this->addElement('b', true, 'Inline', 'Inline', 'Common');
$this->addElement('big', true, 'Inline', 'Inline', 'Common'); $this->addElement('big', true, 'Inline', 'Inline', 'Common');
$this->addElement('hr', true, 'Block', 'Empty', 'Common'); $this->addElement('hr', true, 'Block', 'Empty', 'Common');

View File

@ -11,7 +11,7 @@ class HTMLPurifier_HTMLModule_Ruby extends HTMLPurifier_HTMLModule
public $name = 'Ruby'; public $name = 'Ruby';
public function HTMLPurifier_HTMLModule_Ruby() { public function __construct() {
$this->addElement('ruby', true, 'Inline', $this->addElement('ruby', true, 'Inline',
'Custom: ((rb, (rt | (rp, rt, rp))) | (rbc, rtc, rtc?))', 'Custom: ((rb, (rt | (rp, rt, rp))) | (rbc, rtc, rtc?))',
'Common'); 'Common');

View File

@ -32,7 +32,7 @@ class HTMLPurifier_HTMLModule_Scripting extends HTMLPurifier_HTMLModule
public $elements = array('script', 'noscript'); public $elements = array('script', 'noscript');
public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript'); public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript');
public function HTMLPurifier_HTMLModule_Scripting() { public function __construct() {
// TODO: create custom child-definition for noscript that // TODO: create custom child-definition for noscript that
// auto-wraps stray #PCDATA in a similar manner to // auto-wraps stray #PCDATA in a similar manner to
// blockquote's custom definition (we would use it but // blockquote's custom definition (we would use it but

View File

@ -18,7 +18,7 @@ class HTMLPurifier_HTMLModule_StyleAttribute extends HTMLPurifier_HTMLModule
'Core' => array(0 => array('Style')) 'Core' => array(0 => array('Style'))
); );
public function HTMLPurifier_HTMLModule_StyleAttribute() { public function __construct() {
$this->attr_collections['Style']['style'] = new HTMLPurifier_AttrDef_CSS(); $this->attr_collections['Style']['style'] = new HTMLPurifier_AttrDef_CSS();
} }

View File

@ -11,7 +11,7 @@ class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
public $name = 'Tables'; public $name = 'Tables';
public function HTMLPurifier_HTMLModule_Tables() { public function __construct() {
$this->addElement('caption', true, false, 'Inline', 'Common'); $this->addElement('caption', true, false, 'Inline', 'Common');

View File

@ -10,7 +10,7 @@ class HTMLPurifier_HTMLModule_Target extends HTMLPurifier_HTMLModule
public $name = 'Target'; public $name = 'Target';
public function HTMLPurifier_HTMLModule_Target() { public function __construct() {
$elements = array('a'); $elements = array('a');
foreach ($elements as $name) { foreach ($elements as $name) {
$e =& $this->addBlankElement($name); $e =& $this->addBlankElement($name);

View File

@ -22,7 +22,7 @@ class HTMLPurifier_HTMLModule_Text extends HTMLPurifier_HTMLModule
'Flow' => 'Heading | Block | Inline' 'Flow' => 'Heading | Block | Inline'
); );
public function HTMLPurifier_HTMLModule_Text() { public function __construct() {
// Inline Phrasal ------------------------------------------------- // Inline Phrasal -------------------------------------------------
$this->addElement('abbr', true, 'Inline', 'Inline', 'Common'); $this->addElement('abbr', true, 'Inline', 'Inline', 'Common');

View File

@ -157,7 +157,7 @@ class HTMLPurifier_HTMLModuleManager
/** If set to true, unsafe elements and attributes will be allowed */ /** If set to true, unsafe elements and attributes will be allowed */
public $trusted = false; public $trusted = false;
public function HTMLPurifier_HTMLModuleManager() { public function __construct() {
// editable internal objects // editable internal objects
$this->attrTypes = new HTMLPurifier_AttrTypes(); $this->attrTypes = new HTMLPurifier_AttrTypes();

View File

@ -36,7 +36,7 @@ class HTMLPurifier_Language
*/ */
protected $config, $context; protected $config, $context;
public function HTMLPurifier_Language($config, &$context) { public function __construct($config, &$context) {
$this->config = $config; $this->config = $config;
$this->context =& $context; $this->context =& $context;
} }

View File

@ -201,7 +201,7 @@ class HTMLPurifier_Lexer
// -- CONVENIENCE MEMBERS --------------------------------------------- // -- CONVENIENCE MEMBERS ---------------------------------------------
public function HTMLPurifier_Lexer() { public function __construct() {
$this->_entity_parser = new HTMLPurifier_EntityParser(); $this->_entity_parser = new HTMLPurifier_EntityParser();
} }

View File

@ -34,7 +34,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
public function __construct() { public function __construct() {
// setup the factory // setup the factory
parent::HTMLPurifier_Lexer(); parent::__construct();
$this->factory = new HTMLPurifier_TokenFactory(); $this->factory = new HTMLPurifier_TokenFactory();
} }

View File

@ -22,7 +22,7 @@ class HTMLPurifier_Printer
/** /**
* Initialize $generator. * Initialize $generator.
*/ */
public function HTMLPurifier_Printer() { public function __construct() {
$this->generator = new HTMLPurifier_Generator(); $this->generator = new HTMLPurifier_Generator();
} }

View File

@ -32,10 +32,10 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
* @param $doc_url String documentation URL, will have fragment tagged on * @param $doc_url String documentation URL, will have fragment tagged on
* @param $compress Integer max length before compressing a directive name, set to false to turn off * @param $compress Integer max length before compressing a directive name, set to false to turn off
*/ */
public function HTMLPurifier_Printer_ConfigForm( public function __construct(
$name, $doc_url = null, $compress = false $name, $doc_url = null, $compress = false
) { ) {
parent::HTMLPurifier_Printer(); parent::__construct();
$this->docURL = $doc_url; $this->docURL = $doc_url;
$this->name = $name; $this->name = $name;
$this->compress = $compress; $this->compress = $compress;

View File

@ -16,7 +16,7 @@ class HTMLPurifier_TagTransform_Simple extends HTMLPurifier_TagTransform
* @param $transform_to Tag name to transform to. * @param $transform_to Tag name to transform to.
* @param $style CSS style to add to the tag * @param $style CSS style to add to the tag
*/ */
public function HTMLPurifier_TagTransform_Simple($transform_to, $style = null) { public function __construct($transform_to, $style = null) {
$this->transform_to = $transform_to; $this->transform_to = $transform_to;
$this->style = $style; $this->style = $style;
} }

View File

@ -62,7 +62,7 @@ class HTMLPurifier_Token_Tag extends HTMLPurifier_Token // abstract
* @param $name String name. * @param $name String name.
* @param $attr Associative array of attributes. * @param $attr Associative array of attributes.
*/ */
public function HTMLPurifier_Token_Tag($name, $attr = array(), $line = null) { public function __construct($name, $attr = array(), $line = null) {
$this->name = ctype_lower($name) ? $name : strtolower($name); $this->name = ctype_lower($name) ? $name : strtolower($name);
foreach ($attr as $key => $value) { foreach ($attr as $key => $value) {
// normalization only necessary when key is not lowercase // normalization only necessary when key is not lowercase
@ -131,7 +131,7 @@ class HTMLPurifier_Token_Text extends HTMLPurifier_Token
* *
* @param $data String parsed character data. * @param $data String parsed character data.
*/ */
public function HTMLPurifier_Token_Text($data, $line = null) { public function __construct($data, $line = null) {
$this->data = $data; $this->data = $data;
$this->is_whitespace = ctype_space($data); $this->is_whitespace = ctype_space($data);
$this->line = $line; $this->line = $line;
@ -151,7 +151,7 @@ class HTMLPurifier_Token_Comment extends HTMLPurifier_Token
* *
* @param $data String comment data. * @param $data String comment data.
*/ */
public function HTMLPurifier_Token_Comment($data, $line = null) { public function __construct($data, $line = null) {
$this->data = $data; $this->data = $data;
$this->line = $line; $this->line = $line;
} }

View File

@ -42,7 +42,7 @@ class HTMLPurifier_TokenFactory
*/ */
public function createStart($name, $attr = array()) { public function createStart($name, $attr = array()) {
$p = clone $this->p_start; $p = clone $this->p_start;
$p->HTMLPurifier_Token_Tag($name, $attr); $p->__construct($name, $attr);
return $p; return $p;
} }
@ -53,7 +53,7 @@ class HTMLPurifier_TokenFactory
*/ */
public function createEnd($name) { public function createEnd($name) {
$p = clone $this->p_end; $p = clone $this->p_end;
$p->HTMLPurifier_Token_Tag($name); $p->__construct($name);
return $p; return $p;
} }
@ -65,7 +65,7 @@ class HTMLPurifier_TokenFactory
*/ */
public function createEmpty($name, $attr = array()) { public function createEmpty($name, $attr = array()) {
$p = clone $this->p_empty; $p = clone $this->p_empty;
$p->HTMLPurifier_Token_Tag($name, $attr); $p->__construct($name, $attr);
return $p; return $p;
} }
@ -76,7 +76,7 @@ class HTMLPurifier_TokenFactory
*/ */
public function createText($data) { public function createText($data) {
$p = clone $this->p_text; $p = clone $this->p_text;
$p->HTMLPurifier_Token_Text($data); $p->__construct($data);
return $p; return $p;
} }
@ -87,7 +87,7 @@ class HTMLPurifier_TokenFactory
*/ */
public function createComment($data) { public function createComment($data) {
$p = clone $this->p_comment; $p = clone $this->p_comment;
$p->HTMLPurifier_Token_Comment($data); $p->__construct($data);
return $p; return $p;
} }

View File

@ -14,7 +14,7 @@ class HTMLPurifier_URI
/** /**
* @note Automatically normalizes scheme and port * @note Automatically normalizes scheme and port
*/ */
public function HTMLPurifier_URI($scheme, $userinfo, $host, $port, $path, $query, $fragment) { public function __construct($scheme, $userinfo, $host, $port, $path, $query, $fragment) {
$this->scheme = is_null($scheme) || ctype_lower($scheme) ? $scheme : strtolower($scheme); $this->scheme = is_null($scheme) || ctype_lower($scheme) ? $scheme : strtolower($scheme);
$this->userinfo = $userinfo; $this->userinfo = $userinfo;
$this->host = $host; $this->host = $host;

View File

@ -91,7 +91,7 @@ class HTMLPurifier_URIDefinition extends HTMLPurifier_Definition
*/ */
public $defaultScheme; public $defaultScheme;
public function HTMLPurifier_URIDefinition() { public function __construct() {
$this->registerFilter(new HTMLPurifier_URIFilter_DisableExternal()); $this->registerFilter(new HTMLPurifier_URIFilter_DisableExternal());
$this->registerFilter(new HTMLPurifier_URIFilter_DisableExternalResources()); $this->registerFilter(new HTMLPurifier_URIFilter_DisableExternalResources());
$this->registerFilter(new HTMLPurifier_URIFilter_HostBlacklist()); $this->registerFilter(new HTMLPurifier_URIFilter_HostBlacklist());

View File

@ -44,7 +44,7 @@ class HTMLPurifier_AttrCollectionsTest extends HTMLPurifier_Harness
'Brocolli' => array() 'Brocolli' => array()
); );
$collections->HTMLPurifier_AttrCollections($types, $modules); $collections->__construct($types, $modules);
// this is without identifier expansion or inclusions // this is without identifier expansion or inclusions
$this->assertIdentical( $this->assertIdentical(
$collections->info, $collections->info,