0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-01-18 11:41:52 +00:00

Convert handleStart to the new format.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1211 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2007-06-23 18:58:51 +00:00
parent 9191877740
commit ae83bebc98

View File

@ -34,6 +34,20 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
} }
} }
function handleStart(&$token, $config, &$context) {
// check if we're inside a tag already, if so, don't add
// paragraph tags
$current_nesting = $context->get('CurrentNesting');
if (!empty($current_nesting)) return;
// check if the start tag counts as a "block" element
$definition = $config->getHTMLDefinition();
if (isset($definition->info['p']->auto_close[$token->name])) return;
// append a paragraph tag before the token
$token = array(new HTMLPurifier_Token_Start('p'), $token);
}
/** /**
* Sub-function for auto-paragraphing that takes a token and splits it * Sub-function for auto-paragraphing that takes a token and splits it
* up into paragraphs unconditionally. Requires that a paragraph was * up into paragraphs unconditionally. Requires that a paragraph was
@ -117,16 +131,6 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
return $end_paragraph; return $end_paragraph;
} }
function handleStart(&$token, $config, &$context) {
$current_nesting =& $context->get('CurrentNesting');
if (!empty($current_nesting)) return;
$definition = $config->getHTMLDefinition();
// to be replaced with new auto-auto_close algorithm
if (isset($definition->info['p']->auto_close[$token->name])) return;
$result =& $context->get('OutputTokens');
$result[] = $current_nesting[] = new HTMLPurifier_Token_Start('p');
}
} }
?> ?>