XOOPS 2.5.6
Final
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
Percentage.php
Go to the documentation of this file.
1
<?php
2
6
class
HTMLPurifier_AttrDef_CSS_Percentage
extends
HTMLPurifier_AttrDef
7
{
8
12
protected
$number_def
;
13
17
public
function
__construct
($non_negative =
false
) {
18
$this->number_def =
new
HTMLPurifier_AttrDef_CSS_Number
($non_negative);
19
}
20
21
public
function
validate
($string,
$config
, $context) {
22
23
$string = $this->
parseCDATA
($string);
24
25
if
($string ===
''
)
return
false
;
26
$length = strlen($string);
27
if
($length === 1)
return
false
;
28
if
($string[$length - 1] !==
'%'
)
return
false
;
29
30
$number = substr($string, 0, $length - 1);
31
$number = $this->number_def->validate($number,
$config
, $context);
32
33
if
($number ===
false
)
return
false
;
34
return
"$number%"
;
35
36
}
37
38
}
39
40
// vim: et sw=4 sts=4
L:
0xoops
xoops-2.5.6
htdocs
xoops_lib
modules
protector
library
HTMLPurifier
AttrDef
CSS
Percentage.php
Generated on Fri May 10 2013 01:04:29 for XOOPS 2.5.6 by
1.8.3.1