]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2099. Added elgg_strip_tags() to allow plugins to remove extra formatting.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 15 Jul 2010 19:01:13 +0000 (19:01 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 15 Jul 2010 19:01:13 +0000 (19:01 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6718 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/output.php

index 6e861e4aca388a4c1ab9245192f6aa27686201dd..461f3405776ed6af0a6f6613c032baeeef42ea4c 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * Output functions
- * Processing text for output, formatting HTML, 
+ * Processing text for output, formatting HTML,
  *
  * @package Elgg
  * @subpackage Core
@@ -100,7 +100,7 @@ function autop($pee, $br = 1) {
 function elgg_make_excerpt($text, $num_chars = 250) {
        $text = trim(strip_tags($text));
        $string_length = elgg_strlen($text);
-       
+
        if ($string_length <= $num_chars) {
                return $text;
        }
@@ -152,3 +152,20 @@ function friendly_title($title) {
 function friendly_time($time) {
        return elgg_view('output/friendlytime', array('time' => $time));
 }
+
+/**
+ * Strip tags and offer plugins the chance.
+ * Plugins register for output:strip_tags plugin hook.
+ *     Original string included in $params['original_string']
+ *
+ * @param string $string Formatted string
+ * @return string String run through strip_tags() and any plugin hooks.
+ */
+function elgg_strip_tags($string) {
+       $params['original_string'] = $string;
+
+       $string = strip_tags($string);
+       $string = trigger_plugin_hook('output', 'strip_tags', $params, $string);
+
+       return $string;
+}
\ No newline at end of file