API - XOOPS 2.5.11 Beta 2
By monxoops.fr
HTMLPurifier_Length Class Reference

Public Member Functions

 __construct ($n='0', $u=false)
 
 toString ()
 
 getN ()
 
 getUnit ()
 
 isValid ()
 
 compareTo ($l)
 

Static Public Member Functions

static make ($s)
 

Protected Member Functions

 validate ()
 

Protected Attributes

 $n
 
 $unit
 
 $isValid
 

Static Protected Attributes

static $allowedUnits
 

Detailed Description

Represents a measurable length, with a string numeric magnitude and a unit. This object is immutable.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $n = '0',
  $u = false 
)
Parameters
string$nMagnitude
bool | string$uUnit

Member Function Documentation

◆ compareTo()

compareTo (   $l)

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

Parameters
HTMLPurifier_Length$l
Returns
int
Warning
If both values are too large or small, this calculation will not work properly

◆ getN()

getN ( )

Retrieves string numeric magnitude.

Returns
string

◆ getUnit()

getUnit ( )

Retrieves string unit.

Returns
string

◆ isValid()

isValid ( )

Returns true if this length unit is valid.

Returns
bool
Here is the call graph for this function:
Here is the caller graph for this function:

◆ make()

static make (   $s)
static
Parameters
string$sUnit string, like '2em' or '3.4in'
Returns
HTMLPurifier_Length
Warning
Does not perform validation.
Here is the caller graph for this function:

◆ toString()

toString ( )

Returns string representation of number.

Returns
string
Here is the call graph for this function:

◆ validate()

validate ( )
protected

Validates the number and unit.

Returns
bool
Here is the caller graph for this function:

Field Documentation

◆ $allowedUnits

$allowedUnits
staticprotected
Initial value:
= array(
'em' => true, 'ex' => true, 'px' => true, 'in' => true,
'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true,
'ch' => true, 'rem' => true, 'vw' => true, 'vh' => true,
'vmin' => true, 'vmax' => true
)

Array Lookup array of units recognized by CSS 3 @type array

◆ $isValid

$isValid
protected

Whether or not this length is valid. Null if not calculated yet. @type bool

◆ $n

$n
protected

String numeric magnitude. @type string

◆ $unit

$unit
protected

String unit. False is permitted if $n = 0. @type string|bool


The documentation for this class was generated from the following file: