1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-12 17:13:57 +02: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

View File

@@ -16,7 +16,7 @@ class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
*/
protected $info;
public function HTMLPurifier_AttrDef_CSS_Background($config) {
public function __construct($config) {
$def = $config->getCSSDefinition();
$this->info['background-color'] = $def->info['background-color'];
$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 $percentage;
public function HTMLPurifier_AttrDef_CSS_BackgroundPosition() {
public function __construct() {
$this->length = new HTMLPurifier_AttrDef_CSS_Length();
$this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
}

View File

@@ -13,7 +13,7 @@ class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
*/
protected $info = array();
public function HTMLPurifier_AttrDef_CSS_Border($config) {
public function __construct($config) {
$def = $config->getCSSDefinition();
$this->info['border-width'] = $def->info['border-width'];
$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
*/
public function HTMLPurifier_AttrDef_CSS_Composite($defs) {
public function __construct($defs) {
$this->defs = $defs;
}

View File

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

View File

@@ -15,7 +15,7 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
*/
protected $info;
public function HTMLPurifier_AttrDef_CSS_ListStyle($config) {
public function __construct($config) {
$def = $config->getCSSDefinition();
$this->info['list-style-type'] = $def->info['list-style-type'];
$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 $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->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
*/
public function HTMLPurifier_AttrDef_CSS_Number($non_negative = false) {
public function __construct($non_negative = false) {
$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
*/
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);
}

View File

@@ -14,8 +14,8 @@ require_once 'HTMLPurifier/AttrDef/URI.php';
class HTMLPurifier_AttrDef_CSS_URI extends HTMLPurifier_AttrDef_URI
{
public function HTMLPurifier_AttrDef_CSS_URI() {
parent::HTMLPurifier_AttrDef_URI(true); // always embedded
public function __construct() {
parent::__construct(true); // always embedded
}
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 $case_sensitive Bool indicating whether or not case sensitive
*/
public function HTMLPurifier_AttrDef_Enum(
public function __construct(
$valid_values = array(), $case_sensitive = false
) {
$this->valid_values = array_flip($valid_values);

View File

@@ -11,7 +11,7 @@ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
protected $name;
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) {
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
protected $case_sensitive = false;
public function HTMLPurifier_AttrDef_HTML_FrameTarget() {}
public function __construct() {}
public function validate($string, $config, &$context) {
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. */
protected $name;
public function HTMLPurifier_AttrDef_HTML_LinkTypes($name) {
public function __construct($name) {
$configLookup = array(
'rel' => 'AllowedRel',
'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 $positive Bool indicating whether or not positive values are allowed
*/
public function HTMLPurifier_AttrDef_Integer(
public function __construct(
$negative = true, $zero = true, $positive = true
) {
$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?
*/
public function HTMLPurifier_AttrDef_URI($embeds_resource = false) {
public function __construct($embeds_resource = false) {
$this->parser = new HTMLPurifier_URIParser();
$this->percentEncoder = new HTMLPurifier_PercentEncoder();
$this->embedsResource = (bool) $embeds_resource;

View File

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