diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-20 08:49:25 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-20 08:49:25 +0000 |
commit | 68957d21b50d99b25f23e17773599639738425e0 (patch) | |
tree | eca932c14ffdb2fd5451fcf0e82c641bc964a1d6 /mod | |
parent | 863c7044a223d101b29e630d048d0f53580f4096 (diff) | |
download | elgg-68957d21b50d99b25f23e17773599639738425e0.tar.gz elgg-68957d21b50d99b25f23e17773599639738425e0.tar.bz2 |
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
Diffstat (limited to 'mod')
-rw-r--r-- | mod/htmlawed/start.php | 30 |
1 files 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 = ""; |