1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-10 09:16:20 +02:00
Files
php-htmlpurifier/library/HTMLPurifier/HTMLModule/SetParent.php
Edward Z. Yang 9c031b5c1e Add name class member variable to modules.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@749 48356398-32a2-884e-a903-53898d9a118a
2007-02-14 22:30:17 +00:00

33 lines
971 B
PHP

<?php
HTMLPurifier_ConfigSchema::define(
'HTML', 'Parent', 'div', 'string',
'String name of element that HTML fragment passed to library will be '.
'inserted in. An interesting variation would be using span as the '.
'parent element, meaning that only inline tags would be allowed. '.
'This directive has been available since 1.3.0.'
);
/**
* Proprietary module that sets up the parent definitions.
*/
class HTMLPurifier_HTMLModule_SetParent extends HTMLPurifier_HTMLModule
{
var $name = 'SetParent';
function postProcess(&$definition) {
$parent = $definition->config->get('HTML', 'Parent');
if (isset($definition->info[$parent])) {
$definition->info_parent = $parent;
} else {
trigger_error('Cannot use unrecognized element as parent.',
E_USER_ERROR);
}
$definition->info_parent_def = $definition->info[$definition->info_parent];
}
}
?>