aboutsummaryrefslogtreecommitdiff
path: root/mod/htmlawed
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-03 15:27:28 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-03 15:27:28 +0000
commit8dffaa185c1744b8ddad732c57c2b36e8251c4b2 (patch)
treebaa8110bab1b5cb8513d66920b4d127b6866f115 /mod/htmlawed
parentea9488f7f50515956fc62c4f066010b04c4c5502 (diff)
downloadelgg-8dffaa185c1744b8ddad732c57c2b36e8251c4b2.tar.gz
elgg-8dffaa185c1744b8ddad732c57c2b36e8251c4b2.tar.bz2
Updated htmlawed to allow the default TinyMCE styles.
git-svn-id: http://code.elgg.org/elgg/trunk@3617 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/htmlawed')
-rw-r--r--mod/htmlawed/start.php22
1 files changed, 18 insertions, 4 deletions
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 >";
- }
+ //}
}
/**