HTMLPurifier_Length Class Reference

Represents a measurable length, with a string numeric magnitude and a unit. More...

List of all members.

Public Member Functions

 __construct ($n= '0', $u=false)
 
Parameters:
number $n Magnitude

 toString ()
 Returns string representation of number.
 getN ()
 Retrieves string numeric magnitude.
 getUnit ()
 Retrieves string unit.
 isValid ()
 Returns true if this length unit is valid.
 compareTo ($l)
 Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.
 __construct ($n= '0', $u=false)
 
Parameters:
number $n Magnitude

 toString ()
 Returns string representation of number.
 getN ()
 Retrieves string numeric magnitude.
 getUnit ()
 Retrieves string unit.
 isValid ()
 Returns true if this length unit is valid.
 compareTo ($l)
 Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.

Static Public Member Functions

static make ($s)
 
Parameters:
string $s Unit string, like '2em' or '3.4in'

static make ($s)
 
Parameters:
string $s Unit string, like '2em' or '3.4in'


Protected Member Functions

 validate ()
 Validates the number and unit.
 validate ()
 Validates the number and unit.

Protected Attributes

 $n
 String numeric magnitude.
 $unit
 String unit.
 $isValid
 Whether or not this length is valid.

Static Protected Attributes

static $allowedUnits
 Lookup array of units recognized by CSS 2.1.


Detailed Description

Represents a measurable length, with a string numeric magnitude and a unit.

This object is immutable.

Definition at line 7 of file Length.php.


Constructor & Destructor Documentation

HTMLPurifier_Length::__construct ( n = '0',
u = false 
)

Parameters:
number $n Magnitude

Parameters:
string $u Unit

Definition at line 37 of file Length.php.

References $n, and n.

HTMLPurifier_Length::__construct ( n = '0',
u = false 
)

Parameters:
number $n Magnitude

Parameters:
string $u Unit

Definition at line 5286 of file HTMLPurifier.standalone.php.

References n.


Member Function Documentation

static HTMLPurifier_Length::make ( s  )  [static]

Parameters:
string $s Unit string, like '2em' or '3.4in'

Warning:
Does not perform validation.

Definition at line 46 of file Length.php.

References $n, and $unit.

Referenced by HTMLPurifier_AttrDef_CSS_Length::__construct(), and HTMLPurifier_AttrDef_CSS_Length::validate().

HTMLPurifier_Length::validate (  )  [protected]

Validates the number and unit.

Definition at line 58 of file Length.php.

References $allowedUnits, and n.

Referenced by isValid().

HTMLPurifier_Length::toString (  ) 

Returns string representation of number.

Definition at line 75 of file Length.php.

References isValid(), and n.

HTMLPurifier_Length::getN (  ) 

Retrieves string numeric magnitude.

Definition at line 83 of file Length.php.

References n.

HTMLPurifier_Length::getUnit (  ) 

Retrieves string unit.

Definition at line 88 of file Length.php.

HTMLPurifier_Length::isValid (  ) 

Returns true if this length unit is valid.

Definition at line 93 of file Length.php.

References validate().

Referenced by toString().

HTMLPurifier_Length::compareTo ( l  ) 

Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.

Warning:
If both values are too large or small, this calculation will not work properly

Definition at line 103 of file Length.php.

References n.

static HTMLPurifier_Length::make ( s  )  [static]

Parameters:
string $s Unit string, like '2em' or '3.4in'

Warning:
Does not perform validation.

Definition at line 5295 of file HTMLPurifier.standalone.php.

HTMLPurifier_Length::validate (  )  [protected]

Validates the number and unit.

Definition at line 5307 of file HTMLPurifier.standalone.php.

References $allowedUnits, and n.

HTMLPurifier_Length::toString (  ) 

Returns string representation of number.

Definition at line 5324 of file HTMLPurifier.standalone.php.

References n.

HTMLPurifier_Length::getN (  ) 

Retrieves string numeric magnitude.

Definition at line 5332 of file HTMLPurifier.standalone.php.

References n.

HTMLPurifier_Length::getUnit (  ) 

Retrieves string unit.

Definition at line 5337 of file HTMLPurifier.standalone.php.

HTMLPurifier_Length::isValid (  ) 

Returns true if this length unit is valid.

Definition at line 5342 of file HTMLPurifier.standalone.php.

HTMLPurifier_Length::compareTo ( l  ) 

Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.

Warning:
If both values are too large or small, this calculation will not work properly

Definition at line 5352 of file HTMLPurifier.standalone.php.

References n.


Member Data Documentation

HTMLPurifier_Length::$n [protected]

String numeric magnitude.

Definition at line 13 of file Length.php.

Referenced by __construct(), and make().

HTMLPurifier_Length::$unit [protected]

String unit.

False is permitted if $n = 0.

Definition at line 18 of file Length.php.

Referenced by make().

HTMLPurifier_Length::$isValid [protected]

Whether or not this length is valid.

Null if not calculated yet.

Definition at line 23 of file Length.php.

HTMLPurifier_Length::$allowedUnits [static, protected]

Initial value:

 array(
        'em' => true, 'ex' => true, 'px' => true, 'in' => true,
        'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true
    )
Lookup array of units recognized by CSS 2.1.

Definition at line 28 of file Length.php.

Referenced by validate().


The documentation for this class was generated from the following files:
Generated on Thu Jun 19 18:47:31 2008 for HTMLPurifier by  doxygen 1.5.3