Class HTMLPurifier_UnitConverter

Description

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

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

Located in /library/HTMLPurifier/UnitConverter.php (line 7)


	
			
Class Constant Summary
 DIGITAL = 3
 ENGLISH = 1
 METRIC = 2
Variable Summary
static mixed $units
Method Summary
HTMLPurifier_UnitConverter __construct ([ $output_precision = 4], [ $internal_precision = 10], [ $force_no_bcmath = false])
void convert (HTMLPurifier_Length $length, string $to_unit)
int getSigFigs (string $n)
Variables
static mixed $units = array(
self::ENGLISH => array(
'px' => 3, // This is as per CSS 2.1 and Firefox. Your mileage may vary
'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'),),)
(line 23)

Units information array.

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

  • access: protected
mixed $internalPrecision (line 46)

Bcmath precision for internal calculations.

Bcmath precision for internal calculations.

  • access: protected
mixed $outputPrecision (line 41)

Minimum bcmath precision for output.

Minimum bcmath precision for output.

  • access: protected
Methods
Constructor __construct (line 53)
  • access: public
HTMLPurifier_UnitConverter __construct ([ $output_precision = 4], [ $internal_precision = 10], [ $force_no_bcmath = false])
  • $output_precision
  • $internal_precision
  • $force_no_bcmath
convert (line 77)

Converts a length object of one unit into another unit.

Converts a length object of one unit into another unit.

  • access: public
void convert (HTMLPurifier_Length $length, string $to_unit)
  • HTMLPurifier_Length $length: Instance of HTMLPurifier_Length to convert. You must validate() it before passing it here!
  • string $to_unit: Unit to convert to.
getSigFigs (line 173)

Returns the number of significant figures in a string number.

Returns the number of significant figures in a string number.

  • return: number of sigfigs
  • access: public
int getSigFigs (string $n)
  • string $n: Decimal number
Class Constants
DIGITAL = 3 (line 12)
ENGLISH = 1 (line 10)
METRIC = 2 (line 11)

Documentation generated on Thu, 19 Jun 2008 18:50:27 -0400 by phpDocumentor 1.4.2