HTMLPurifier_UnitConverter Klassenreferenz


Öffentliche Methoden

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

Datenfelder

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

Geschützte Attribute

 $outputPrecision
 $internalPrecision

Statische geschützte Attribute

static $units

Ausführliche Beschreibung

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

Definiert in Zeile 7 der Datei UnitConverter.php.


Beschreibung der Konstruktoren und Destruktoren

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

Definiert in Zeile 53 der Datei UnitConverter.php.


Dokumentation der Elementfunktionen

convert ( length,
to_unit 
)

Converts a length object of one unit into another unit.

Parameter:
HTMLPurifier_Length $length Instance of HTMLPurifier_Length to convert. You must validate() it before passing it here!
string $to_unit Unit to convert to.
Zu beachten:
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.

Definiert in Zeile 77 der Datei UnitConverter.php.

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

getSigFigs ( n  ) 

Returns the number of significant figures in a string number.

Parameter:
string $n Decimal number
Rückgabe:
int number of sigfigs

Definiert in Zeile 173 der Datei UnitConverter.php.

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:


Dokumentation der Datenelemente

$internalPrecision [protected]

Bcmath precision for internal calculations.

Definiert in Zeile 46 der Datei UnitConverter.php.

$outputPrecision [protected]

Minimum bcmath precision for output.

Definiert in Zeile 41 der Datei UnitConverter.php.

$units [static, protected]

Initialisierung:

 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.)

Definiert in Zeile 23 der Datei UnitConverter.php.

const DIGITAL = 3

Definiert in Zeile 12 der Datei UnitConverter.php.

const ENGLISH = 1

Definiert in Zeile 10 der Datei UnitConverter.php.

const METRIC = 2

Definiert in Zeile 11 der Datei UnitConverter.php.


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei:
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved.
MyOOS [Shopsystem] is Free Software released under the GNU/GPL License.

Webmaster: info@r23.de (Impressum)
doxygen