aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/output.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-22 20:58:21 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-22 20:58:21 +0000
commit46c278c3603765b623fa441e2435274fbeda05ad (patch)
treec2b926d3195aa71524f9c8b692e567cfd4605b9b /engine/lib/output.php
parentf9ee6f1429f800c3eed3c0ef59d98219be32fba8 (diff)
downloadelgg-46c278c3603765b623fa441e2435274fbeda05ad.tar.gz
elgg-46c278c3603765b623fa441e2435274fbeda05ad.tar.bz2
Merged r6620:6653 from 1.7 branch into trunk
git-svn-id: http://code.elgg.org/elgg/trunk@6846 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/output.php')
-rw-r--r--engine/lib/output.php24
1 files changed, 19 insertions, 5 deletions
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;