]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Updated htmlawed to allow the default TinyMCE styles.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 3 Nov 2009 15:27:28 +0000 (15:27 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 3 Nov 2009 15:27:28 +0000 (15:27 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3617 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/htmlawed/start.php

index 52cefa1da06182ad5a1ded02f14b4697e5b6a11c..b28390fa436d6e3a76dc2a8b59786b9e326c2fca 100644 (file)
                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 >";
-               }
+               //}
        }
 
        /**