1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 03:10:09 +02:00

Add NumberSpan definition (non-DTD, but applies to enough to be useful). All widely used non-deprecated attributes have been implemented (except for rel/rev, but that's tricky). Add note about quirky COL handling and possible implementation of a workaround.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@174 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-08-06 03:58:48 +00:00
parent d429989f86
commit d5e75f2616
6 changed files with 75 additions and 7 deletions

View File

@@ -0,0 +1,23 @@
<?php
require_once 'HTMLPurifier/AttrDef.php';
// for col and row spans, essentially, a positive integer
class HTMLPurifier_AttrDef_NumberSpan extends HTMLPurifier_AttrDef
{
function validate($string) {
$string = trim($string);
if ($string === '') return false;
if ($string === '1') return false; // this is the default value
if (!is_numeric($string)) return false;
$int = (int) $string;
if ($int <= 0) return false;
return (string) $int;
}
}
?>