aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/output.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-07-15 19:01:13 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-07-15 19:01:13 +0000
commit107df692108e1b3b1a70bfd9f7697282ebfa9fc3 (patch)
treeb3b958da98e15420a745d3e44b08df924ee6632d /engine/lib/output.php
parent58e4225d365d6813c803078235fcfc9f947bddef (diff)
downloadelgg-107df692108e1b3b1a70bfd9f7697282ebfa9fc3.tar.gz
elgg-107df692108e1b3b1a70bfd9f7697282ebfa9fc3.tar.bz2
Fixes #2099. Added elgg_strip_tags() to allow plugins to remove extra formatting.
git-svn-id: http://code.elgg.org/elgg/trunk@6718 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/output.php')
-rw-r--r--engine/lib/output.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/engine/lib/output.php b/engine/lib/output.php
index 6e861e4ac..461f34057 100644
--- a/engine/lib/output.php
+++ b/engine/lib/output.php
@@ -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