HumHub Documentation (unofficial)

HTMLPurifier_Length
in package

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

Table of Contents

Properties

$allowedUnits  : mixed
Array Lookup array of units recognized by CSS 3
$isValid  : mixed
Whether or not this length is valid. Null if not calculated yet.
$n  : mixed
String numeric magnitude.
$unit  : mixed
String unit. False is permitted if $n = 0.

Methods

__construct()  : mixed
compareTo()  : int
Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.
getN()  : string
Retrieves string numeric magnitude.
getUnit()  : string
Retrieves string unit.
isValid()  : bool
Returns true if this length unit is valid.
make()  : HTMLPurifier_Length
toString()  : string
Returns string representation of number.
validate()  : bool
Validates the number and unit.

Properties

$allowedUnits

Array Lookup array of units recognized by CSS 3

protected static mixed $allowedUnits = 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)
Tags
type

array

$isValid

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

protected mixed $isValid
Tags
type

bool

$n

String numeric magnitude.

protected mixed $n
Tags
type

string

$unit

String unit. False is permitted if $n = 0.

protected mixed $unit
Tags
type

string|bool

Methods

__construct()

public __construct([string $n = '0' ][, bool|string $u = false ]) : mixed
Parameters
$n : string = '0'

Magnitude

$u : bool|string = false

Unit

compareTo()

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

public compareTo(HTMLPurifier_Length $l) : int
Parameters
$l : HTMLPurifier_Length
Tags
warning

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

Return values
int

getN()

Retrieves string numeric magnitude.

public getN() : string
Return values
string

getUnit()

Retrieves string unit.

public getUnit() : string
Return values
string

isValid()

Returns true if this length unit is valid.

public isValid() : bool
Return values
bool

toString()

Returns string representation of number.

public toString() : string
Return values
string

validate()

Validates the number and unit.

protected validate() : bool
Return values
bool

        
On this page

Search results