Commit d3998ae7 authored by Nigel McNie's avatar Nigel McNie
Browse files

Allow the target attribute on links. Fixes #1900.

parent f4da7744
......@@ -1980,6 +1980,20 @@ function clean_text($text) {
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache', 'SerializerPath', get_config('dataroot') . 'htmlpurifier');
$config->set('HTML', 'DefinitionID', 'Mahara customisations to default config');
// NOTE: this MUST be incremented if you change the configuration
// definition - Talk to Nigel about it
$config->set('HTML', 'DefinitionRev', 1);
// This disables caching of HTMLPurifier objects. Worth having off for
// development, but see note above once you're done messing with things
//$config->set('Core', 'DefinitionCache', null);
$config->set('Core', 'Encoding', 'UTF-8');
$config->set('HTML', 'Doctype', 'XHTML 1.0 Transitional');
$def =& $config->getHTMLDefinition(true);
$def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
$purifier = new HTMLPurifier($config);
return $purifier->purify($text);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment