From 46c278c3603765b623fa441e2435274fbeda05ad Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 22 Aug 2010 20:58:21 +0000 Subject: Merged r6620:6653 from 1.7 branch into trunk git-svn-id: http://code.elgg.org/elgg/trunk@6846 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/output.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'engine/lib/output.php') diff --git a/engine/lib/output.php b/engine/lib/output.php index 3280517b0..3d08f2a28 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -97,7 +97,7 @@ function autop($pee, $br = 1) { * @return string * @since 1.7.2 */ -function elgg_make_excerpt($text, $num_chars = 250) { +function elgg_get_excerpt($text, $num_chars = 250) { $text = trim(elgg_strip_tags($text)); $string_length = elgg_strlen($text); @@ -148,12 +148,19 @@ function friendly_title($title) { /** * When given a title, returns a version suitable for inclusion in a URL * - * @todo add plugin hook so that developers can provide their own friendly title * @param string $title The title * @return string The optimised title * @since 1.7.2 */ function elgg_get_friendly_title($title) { + + // return a URL friendly title to short circuit normal title formatting + $params = array('title' => $title); + $result = trigger_plugin_hook('format', 'friendly:title', $params, NULL); + if ($result) { + return $result; + } + //$title = iconv('UTF-8', 'ASCII//TRANSLIT', $title); $title = preg_replace("/[^\w ]/","",$title); $title = str_replace(" ","-",$title); @@ -176,14 +183,21 @@ function friendly_time($time) { } /** - * Displays a UNIX timestamp in a friendly way (eg "less than a minute ago") + * Formats a UNIX timestamp in a friendly way (eg "less than a minute ago") * - * @todo add plugin hook so that developers can provide their own friendly time * @param int $time A UNIX epoch timestamp - * @return string The friendly time + * @return string The friendly time string * @since 1.7.2 */ function elgg_get_friendly_time($time) { + + // return a time string to short circuit normal time formatting + $params = array('time' => $time); + $result = trigger_plugin_hook('format', 'friendly:time', $params, NULL); + if ($result) { + return $result; + } + $diff = time() - (int)$time; $minute = 60; -- cgit v1.2.3