XOOPS API 2.5.11 Beta1  UI v0.5
Réalisé par monxoops.fr
Référence de la classe HTMLPurifier_UnitConverter

Fonctions membres publiques

 __construct ($output_precision=4, $internal_precision=10, $force_no_bcmath=false)
 
 convert ($length, $to_unit)
 
 getSigFigs ($n)
 

Champs de données

const ENGLISH = 1
 
const METRIC = 2
 
const DIGITAL = 3
 

Attributs protégés

 $outputPrecision
 
 $internalPrecision
 

Attributs protégés statiques

static $units
 

Fonctions membres privées

 add ($s1, $s2, $scale)
 
 mul ($s1, $s2, $scale)
 
 div ($s1, $s2, $scale)
 
 round ($n, $sigfigs)
 
 scale ($r, $scale)
 

Attributs privés

 $bcmath
 

Description détaillée

Class for converting between different unit-lengths as specified by CSS.

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $output_precision = 4,
  $internal_precision = 10,
  $force_no_bcmath = false 
)

Documentation des fonctions membres

◆ add()

add (   $s1,
  $s2,
  $scale 
)
private

Adds two numbers, using arbitrary precision when available.

Paramètres
string$s1
string$s2
int$scale
Renvoie
string
+ Voici le graphe d'appel pour cette fonction :

◆ convert()

convert (   $length,
  $to_unit 
)

Converts a length object of one unit into another unit.

Paramètres
HTMLPurifier_Length$lengthInstance of HTMLPurifier_Length to convert. You must validate() it before passing it here!
string$to_unitUnit to convert to.
Renvoie
HTMLPurifier_Length|bool
Note
About precision: This conversion function pays very special attention to the incoming precision of values and attempts to maintain a number of significant figure. Results are fairly accurate up to nine digits. Some caveats:
  • If a number is zero-padded as a result of this significant figure tracking, the zeroes will be eliminated.
  • If a number contains less than four sigfigs ($outputPrecision) and this causes some decimals to be excluded, those decimals will be added on.
+ Voici le graphe d'appel pour cette fonction :

◆ div()

div (   $s1,
  $s2,
  $scale 
)
private

Divides two numbers, using arbitrary precision when available.

Paramètres
string$s1
string$s2
int$scale
Renvoie
string
+ Voici le graphe d'appel pour cette fonction :
+ Voici le graphe des appelants de cette fonction :

◆ getSigFigs()

getSigFigs (   $n)

Returns the number of significant figures in a string number.

Paramètres
string$nDecimal number
Renvoie
int number of sigfigs
+ Voici le graphe des appelants de cette fonction :

◆ mul()

mul (   $s1,
  $s2,
  $scale 
)
private

Multiples two numbers, using arbitrary precision when available.

Paramètres
string$s1
string$s2
int$scale
Renvoie
string
+ Voici le graphe d'appel pour cette fonction :
+ Voici le graphe des appelants de cette fonction :

◆ round()

round (   $n,
  $sigfigs 
)
private

Rounds a number according to the number of sigfigs it should have, using arbitrary precision when available.

Paramètres
float$n
int$sigfigs
Renvoie
string
+ Voici le graphe d'appel pour cette fonction :
+ Voici le graphe des appelants de cette fonction :

◆ scale()

scale (   $r,
  $scale 
)
private

Scales a float to $scale digits right of decimal point, like BCMath.

Paramètres
float$r
int$scale
Renvoie
string
+ Voici le graphe d'appel pour cette fonction :
+ Voici le graphe des appelants de cette fonction :

Documentation des champs

◆ $bcmath

$bcmath
private

Whether or not BCMath is available. @type bool

◆ $internalPrecision

$internalPrecision
protected

Bcmath precision for internal calculations. @type int

◆ $outputPrecision

$outputPrecision
protected

Minimum bcmath precision for output. @type int

◆ $units

$units
staticprotected
Valeur initiale :
= array(
self::ENGLISH => array(
'px' => 3,
'pt' => 4,
'pc' => 48,
'in' => 288,
self::METRIC => array('pt', '0.352777778', 'mm'),
),
self::METRIC => array(
'mm' => 1,
'cm' => 10,
self::ENGLISH => array('mm', '2.83464567', 'pt'),
),
)

Units information array. Units are grouped into measuring systems (English, Metric), and are assigned an integer representing the conversion factor between that unit and the smallest unit in the system. Numeric indexes are actually magical constants that encode conversion data from one system to the next, with a O(n^2) constraint on memory (this is generally not a problem, since the number of measuring systems is small.)

◆ DIGITAL

const DIGITAL = 3

◆ ENGLISH

const ENGLISH = 1

◆ METRIC

const METRIC = 2

La documentation de cette classe a été générée à partir du fichier suivant :