]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Prevent inserting duplicated tags
authorMiguel Rodríguez Pérez <Miguel.Rodriguez@det.uvigo.es>
Tue, 10 Jul 2012 15:09:35 +0000 (17:09 +0200)
committerMiguel Rodríguez Pérez <Miguel.Rodriguez@det.uvigo.es>
Tue, 10 Jul 2012 15:12:18 +0000 (17:12 +0200)
When htmlawed_tag_post_processor gets called, we check $attributed to
be passed. If it is not, then it is a closing tag. Return it without
further processing.

mod/htmlawed/start.php

index b52a390bb4273ec94ca59adfdfcf1d9ee555aefa..12b6470a3ef43289f21f127def3df7e86712fe05 100644 (file)
@@ -92,7 +92,13 @@ function htmLawedArray(&$v, $k, $htmlawed_config) {
  * @param array  $attributes An array of attributes
  * @return string
  */
-function htmlawed_tag_post_processor($element, $attributes = array()) {
+function htmlawed_tag_post_processor($element, $attributes = false) {
+    if ($attributes === false) {
+        // This is a closing tag. Prevent further processing to avoid inserting a duplicate tag
+
+        return "</${element}>";
+    }
+
        // these are the default styles used by tinymce.
        $allowed_styles = array(
                'color', 'cursor', 'text-align', 'vertical-align', 'font-size',