mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-10 07:38:41 +00:00
71c4a3c50c
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@235 48356398-32a2-884e-a903-53898d9a118a
37 lines
953 B
PHP
37 lines
953 B
PHP
<?php
|
|
|
|
require_once 'HTMLPurifier/AttrDef.php';
|
|
|
|
// appears to be a dud class: no currently allowed CSS uses this type
|
|
// Uses this: widows, orphans, z-index, counter-increment, counter-reset
|
|
|
|
class HTMLPurifier_AttrDef_Integer extends HTMLPurifier_AttrDef
|
|
{
|
|
|
|
var $non_negative = false;
|
|
|
|
function HTMLPurifier_AttrDef_Integer($non_negative = false) {
|
|
$this->non_negative = $non_negative;
|
|
}
|
|
|
|
function validate($integer, $config, &$context) {
|
|
|
|
$integer = $this->parseCDATA($integer);
|
|
if ($integer === '') return false;
|
|
|
|
if ( !$this->non_negative && $integer[0] === '-' ) {
|
|
$digits = substr($integer, 1);
|
|
} elseif( $integer[0] === '+' ) {
|
|
$digits = $integer = substr($integer, 1);
|
|
} else {
|
|
$digits = $integer;
|
|
}
|
|
|
|
if (!ctype_digit($digits)) return false;
|
|
return $integer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|