Quellcode durchsuchen

Add zend filter to composer

Francis Gonzales vor 10 Jahren
Ursprung
Commit
2f7d1313f1
2 geänderte Dateien mit 8 neuen und 9 gelöschten Zeilen
  1. 1 2
      composer.json
  2. 7 7
      main/inc/lib/formvalidator/FormValidator.class.php

+ 1 - 2
composer.json

@@ -125,8 +125,7 @@
         "stof/doctrine-extensions-bundle": "~1.1@dev",
         "gedmo/doctrine-extensions": "~2.3",
 
-
-
+        "zendframework/zend-filter": "2.3.*@dev",
 
         "jbroadway/urlify": "1.0.0-stable",
         "composer/composer": "1.0.*@dev",

+ 7 - 7
main/inc/lib/formvalidator/FormValidator.class.php

@@ -1,6 +1,7 @@
 <?php
 /* For licensing terms, see /license.txt */
 
+use Zend\Filter\StripTags;
 /**
  * Objects of this class can be used to create/manipulate/validate user input.
  */
@@ -669,17 +670,16 @@ EOT;
 
 /**
  * Cleans HTML text
- * @param string $html                        HTML to clean
+ * @param string $html HTML to clean
  * @param int $mode (optional)
- * @return string                                The cleaned HTML
+ * @return string The cleaned HTML
  */
 function html_filter($html, $mode = NO_HTML)
 {
-    return $html;
-    //$filter = new Zend\Filter\StripTags(array('allowTags' => 'a'));
-    $allowed_tags = HTML_QuickForm_Rule_HTML::get_allowed_tags($mode);
-    $cleaned_html = kses($html, $allowed_tags);
-    return $cleaned_html;
+    $allowedTags = HTML_QuickForm_Rule_HTML::get_allowed_tags($mode);
+    $filter = new StripTags($allowedTags);
+    $cleanedHtml = $filter->filter($html);
+    return $cleanedHtml;
 }
 
 function html_filter_teacher($html)