Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

(no description)

File Size: 307 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

HTMLPurifier_UnitConverter:: (8 methods):
  __construct()
  convert()
  getSigFigs()
  add()
  mul()
  div()
  round()
  scale()


Class: HTMLPurifier_UnitConverter  - X-Ref

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

__construct($output_precision = 4, $internal_precision = 10, $force_no_bcmath = false)   X-Ref
Whether or not BCMath is available.


convert($length, $to_unit)   X-Ref
Converts a length object of one unit into another unit.

param: HTMLPurifier_Length $length
param: string $to_unit
return: HTMLPurifier_Length|bool

getSigFigs($n)   X-Ref
Returns the number of significant figures in a string number.

param: string $n Decimal number
return: int number of sigfigs

add($s1, $s2, $scale)   X-Ref
Adds two numbers, using arbitrary precision when available.

param: string $s1
param: string $s2
param: int $scale
return: string

mul($s1, $s2, $scale)   X-Ref
Multiples two numbers, using arbitrary precision when available.

param: string $s1
param: string $s2
param: int $scale
return: string

div($s1, $s2, $scale)   X-Ref
Divides two numbers, using arbitrary precision when available.

param: string $s1
param: string $s2
param: int $scale
return: string

round($n, $sigfigs)   X-Ref
Rounds a number according to the number of sigfigs it should have,
using arbitrary precision when available.

param: float $n
param: int $sigfigs
return: string

scale($r, $scale)   X-Ref
Scales a float to $scale digits right of decimal point, like BCMath.

param: float $r
param: int $scale
return: string