Source for file Length.php
Documentation is available at Length.php
* Validates the HTML type length (not to be confused with CSS's length).
* This accepts integer pixels or percentages as lengths for certain
public function validate($string, $config, $context) {
if ($string ===
'') return false;
$parent_result =
parent::validate($string, $config, $context);
if ($parent_result !==
false) return $parent_result;
$last_char =
$string[$length -
1];
if ($last_char !==
'%') return false;
$points =
substr($string, 0, $length -
1);
if ($points <
0) return '0%';
if ($points >
100) return '100%';
return ((string)
$points) .
'%';
Documentation generated on Thu, 19 Jun 2008 18:49:42 -0400 by phpDocumentor 1.4.2