From 68957d21b50d99b25f23e17773599639738425e0 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Sat, 20 Nov 2010 08:49:25 +0000 Subject: Fixes #2497: htmLawed now uses a plugin hook for allowed_styles and htmlawed_config git-svn-id: http://code.elgg.org/elgg/trunk@7370 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/htmlawed/start.php | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/mod/htmlawed/start.php b/mod/htmlawed/start.php index 04c363968..04a654998 100644 --- a/mod/htmlawed/start.php +++ b/mod/htmlawed/start.php @@ -10,19 +10,6 @@ * */ function htmlawed_init() { - /** For now declare allowed tags and protocols here, @todo Make this configurable */ - global $CONFIG; - $CONFIG->htmlawed_config = array( - // seems to handle about everything we need. - 'safe' => true, - 'deny_attribute' => 'class, on*', - 'hook_tag' => 'htmlawed_hook', - - 'schemes' => '*:http,https,ftp,news,mailto,rtsp,teamspeak,gopher,mms,callto' - // apparent this doesn't work. - //. 'style:color,cursor,text-align,font-size,font-weight,font-style,border,margin,padding,float' - ); - elgg_register_plugin_hook_handler('validate', 'input', 'htmlawed_filter_tags', 1); } @@ -43,6 +30,8 @@ function htmlawed_hook($element, $attribute_array) { 'margin', 'margin-top', 'margin-bottom', 'margin-left', 'margin-right', 'padding', 'float', 'text-decoration' ); + + $allowed_styles = elgg_trigger_plugin_hook('allowed_styles', 'htmlawed', NULL, $allowed_styles); // must return something. $string = ''; @@ -96,9 +85,18 @@ function htmlawed_filter_tags($hook, $entity_type, $returnvalue, $params) { if (include_once(dirname(__FILE__) . "/vendors/htmLawed/htmLawed.php")) { - global $CONFIG; - - $htmlawed_config = $CONFIG->htmlawed_config; + $htmlawed_config = array( + // seems to handle about everything we need. + 'safe' => true, + 'deny_attribute' => 'class, on*', + 'hook_tag' => 'htmlawed_hook', + + 'schemes' => '*:http,https,ftp,news,mailto,rtsp,teamspeak,gopher,mms,callto' + // apparent this doesn't work. + //. 'style:color,cursor,text-align,font-size,font-weight,font-style,border,margin,padding,float' + ); + + $htmlawed_config = elgg_trigger_plugin_hook('config', 'htmlawed', NULL, $htmlawed_config); if (!is_array($var)) { $return = ""; -- cgit v1.2.3