From 8dffaa185c1744b8ddad732c57c2b36e8251c4b2 Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 3 Nov 2009 15:27:28 +0000 Subject: Updated htmlawed to allow the default TinyMCE styles. git-svn-id: http://code.elgg.org/elgg/trunk@3617 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/htmlawed/start.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'mod/htmlawed') diff --git a/mod/htmlawed/start.php b/mod/htmlawed/start.php index 52cefa1da..b28390fa4 100644 --- a/mod/htmlawed/start.php +++ b/mod/htmlawed/start.php @@ -30,12 +30,26 @@ register_plugin_hook('validate', 'input', 'htmlawed_filter_tags', 1); } + /** + * Hooked for all elements in htmlawed. + * Used to filter out style attributes we don't want. + * + * @param $element + * @param $attribute_array + * @return unknown_type + */ function htmlawed_hook($element, $attribute_array) { + // these are the default styles used by tinymce. $allowed_styles = array( - 'color', 'cursor', 'text-align', 'font-size', 'font-weight', 'font-style', 'border', 'margin', 'padding', 'float' + 'color', 'cursor', 'text-align', 'vertical-align', 'font-size', + 'font-weight', 'font-style', 'border', 'border-top', + 'border-bottom', 'border-left', 'border-right', + 'margin', 'margin-top', 'margin-bottom', 'margin-left', + 'margin-right', 'padding', 'float', 'text-decoration' ); - if (array_key_exists('style', $attribute_array)) { + // must return something. + //if (array_key_exists('style', $attribute_array)) { $string = ''; foreach ($attribute_array as $attr => $value) { @@ -44,7 +58,7 @@ $style_str = ''; foreach ($styles as $style) { - if (!$style) { + if (!trim($style)) { continue; } list($style_attr, $style_value) = explode(':', trim($style)); @@ -67,7 +81,7 @@ $string = trim($string); return "<$element $string >"; - } + //} } /** -- cgit v1.2.3