mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-02 12:21:09 +02:00
Move out SetParent and TweakSubtractiveWhitelist. Move out some other configurations, disable ID references.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@743 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
31
library/HTMLPurifier/HTMLModule/SetParent.php
Normal file
31
library/HTMLPurifier/HTMLModule/SetParent.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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
|
||||
{
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user