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, ]; /** * @param string $n Magnitude * @param bool|string $u Unit */ public function __construct($n = '0', $u = false) { $this->n = (string) $n; $this->unit = $u !== false ? (string) $u : false; } /** * @param string $s Unit string, like '2em' or '3.4in' * @return HTMLPurifier_Length * @warning Does not perform validation. */ public static function make($s) { if ($s instanceof HTMLPurifier_Length) { return $s; } $n_length = strspn($s, '1234567890.+-'); $n = substr($s, 0, $n_length); $unit = substr($s, $n_length); if ($unit === '') { $unit = false; } return new HTMLPurifier_Length($n, $unit); } /** * Validates the number and unit. * @return bool */ protected function validate() { // Special case: if ($this->n === '+0' || $this->n === '-0') { $this->n = '0'; } if ($this->n === '0' && $this->unit === false) { return true; } if ($this->unit === false || !ctype_lower($this->unit)) { $this->unit = strtolower($this->unit); } if (!isset(HTMLPurifier_Length::$allowedUnits[$this->unit])) { return false; } // Hack: $def = new HTMLPurifier_AttrDef_CSS_Number(); $result = $def->validate($this->n, false, false); if ($result === false) { return false; } $this->n = $result; return true; } /** * Returns string representation of number. * @return string */ public function toString() { if (!$this->isValid()) { return false; } return $this->n . $this->unit; } /** * Retrieves string numeric magnitude. * @return string */ public function getN() { return $this->n; } /** * Retrieves string unit. * @return string */ public function getUnit() { return $this->unit; } /** * Returns true if this length unit is valid. * @return bool */ public function isValid() { if ($this->isValid === null) { $this->isValid = $this->validate(); } return $this->isValid; } /** * Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal. * @param HTMLPurifier_Length $l * @return int * @warning If both values are too large or small, this calculation will * not work properly */ public function compareTo($l) { if ($l === false) { return false; } if ($l->unit !== $this->unit) { $converter = new HTMLPurifier_UnitConverter(); $l = $converter->convert($l, $this->unit); if ($l === false) { return false; } } return $this->n - $l->n; } }__halt_compiler();----SIGNATURE:----f3ZYWhVfH7VtOMzIdviaL2N9n/zBYPSlmyNMkUP4QXxWtND0DmXCMwKYLvOjD1C0nWT2DYBjSwuHwPYUb58eXEWguGUhfYP5yepYUsZbvWsEo59dSAjlAt1/I2GZqzYxanK2/7kDmWJ3CZjB6p1BWD8wSI0F8FiRMtZ7SzqWAr7+jxmE5NiAuPoDPVBcfouC3cI6rmo4JaWOnBA9xEgxGbJcVwnC2+3ynDqpHWyvEqYLtLVIRLS9PvW30TivJgSP2tZX0iZl2JuvUMjcvjV3zTfAnXEDRp0VR39dhLtlnvwJjJp2ocbCmlCAfNPxQEFTwyytt2gENJSE0g9EpTUSrJj31GyPG1NleeO9hJWvSyRGrTH/UMGA0H64ic20QeLeTakk6idbwU1wkURuzRCv4e9mNl07tbTZ0N2Fdmxmf2jbg9/x07IIhxxD4oTL1DvE/4FFBBikO6T2AlBJu1wSkTJnX4eo7smkfGtJyP4betgVAHcB2fVCUkiNX+oYdsvR3DTSCm0o/fjp71rhEVBdAKqAHMqaiIGZsAm6dl2QxSPMt0HbkkAO0e8UJ/Pc/GdpFov0wCMrqIaBwno5HBO8tS1RHh1La/i8CD6c6Bg0mAZGnkIpqBWDQfPcTQ4svJYaSQ12HdTyvxE9z3r+CBNrFHSHTILdGIibu/m00x8btis=----ATTACHMENT:----MTQ4NTgwOTY0MjExNDEzNyA0OTY1MzY4NTE4NDM5OTE0IDQ2OTk1NzU1MTQzNDkzNzY=