Source for file Length.php
Documentation is available at Length.php
* Represents a Length as defined by CSS.
* @param HTMLPurifier_Length $max Minimum length, or null for no bound. String is also acceptable.
* @param HTMLPurifier_Length $max Maximum length, or null for no bound. String is also acceptable.
public function __construct($min =
null, $max =
null) {
public function validate($string, $config, $context) {
if ($string ===
'') return false;
if ($string ===
'0') return '0';
if (strlen($string) ===
1) return false;
if (!$length->isValid()) return false;
$c =
$length->compareTo($this->min);
if ($c ===
false) return false;
if ($c <
0) return false;
$c =
$length->compareTo($this->max);
if ($c ===
false) return false;
if ($c >
0) return false;
return $length->toString();
Documentation generated on Thu, 19 Jun 2008 18:49:43 -0400 by phpDocumentor 1.4.2