1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-05 13:47:24 +02:00

Implement center, menu and dir tag transformations. Font transform pending.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@140 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-08-02 02:24:03 +00:00
parent d243545142
commit 626cfc1172
6 changed files with 220 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
require_once 'HTMLPurifier/Strategy.php';
require_once 'HTMLPurifier/Definition.php';
require_once 'HTMLPurifier/Generator.php';
require_once 'HTMLPurifier/TagTransform.php';
/**
* Removes all unrecognized tags from the list of tokens.
@@ -27,7 +28,18 @@ class HTMLPurifier_Strategy_RemoveForeignElements extends HTMLPurifier_Strategy
foreach($tokens as $token) {
if (!empty( $token->is_tag )) {
// DEFINITION CALL
if (!isset($this->definition->info[$token->name])) {
if (isset($this->definition->info[$token->name])) {
// leave untouched
} elseif (
isset($this->definition->info_tag_transform[$token->name])
) {
// there is a transformation for this tag
// DEFINITION CALL
$token = $this->
definition->
info_tag_transform[$token->name]->
transform($token);
} else {
// invalid tag, generate HTML and insert in
$token = new HTMLPurifier_Token_Text(
$this->generator->generateFromToken($token)