Add vim modelines to all files.
[htmlpurifier.git] / library / HTMLPurifier / AttrDef / CSS / AlphaValue.php
blob292c040d4bd525f708add43159301302eb717ff1
1 <?php
3 class HTMLPurifier_AttrDef_CSS_AlphaValue extends HTMLPurifier_AttrDef_CSS_Number
6 public function __construct() {
7 parent::__construct(false); // opacity is non-negative, but we will clamp it
10 public function validate($number, $config, $context) {
11 $result = parent::validate($number, $config, $context);
12 if ($result === false) return $result;
13 $float = (float) $result;
14 if ($float < 0.0) $result = '0';
15 if ($float > 1.0) $result = '1';
16 return $result;
21 // vim: et sw=4 sts=4