diff options
50 files changed, 198 insertions, 157 deletions
diff --git a/engine/lib/output.php b/engine/lib/output.php index 3b82447b0..3280517b0 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -138,9 +138,29 @@ function elgg_format_url($url) { * * @param string $title The title * @return string The optimised title + * @deprecated 1.8 */ function friendly_title($title) { - return elgg_view('output/friendlytitle', array('title' => $title)); + elgg_deprecated_notice('friendly_title was deprecated by elgg_get_friendly_title', 1.8); + return elgg_get_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) { + //$title = iconv('UTF-8', 'ASCII//TRANSLIT', $title); + $title = preg_replace("/[^\w ]/","",$title); + $title = str_replace(" ","-",$title); + $title = str_replace("--","-",$title); + $title = trim($title); + $title = strtolower($title); + return $title; } /** @@ -148,8 +168,74 @@ function friendly_title($title) { * * @param int $time A UNIX epoch timestamp * @return string The friendly time + * @deprecated 1.8 */ function friendly_time($time) { + elgg_deprecated_notice('friendly_time was deprecated by elgg_view_friendly_time', 1.8); + return elgg_view_friendly_time($time); +} + +/** + * Displays 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 + * @since 1.7.2 + */ +function elgg_get_friendly_time($time) { + $diff = time() - (int)$time; + + $minute = 60; + $hour = $minute * 60; + $day = $hour * 24; + + if ($diff < $minute) { + return elgg_echo("friendlytime:justnow"); + } else if ($diff < $hour) { + $diff = round($diff / $minute); + if ($diff == 0) { + $diff = 1; + } + + if ($diff > 1) { + return sprintf(elgg_echo("friendlytime:minutes"), $diff); + } else { + return sprintf(elgg_echo("friendlytime:minutes:singular"), $diff); + } + } else if ($diff < $day) { + $diff = round($diff / $hour); + if ($diff == 0) { + $diff = 1; + } + + if ($diff > 1) { + return sprintf(elgg_echo("friendlytime:hours"), $diff); + } else { + return sprintf(elgg_echo("friendlytime:hours:singular"), $diff); + } + } else { + $diff = round($diff / $day); + if ($diff == 0) { + $diff = 1; + } + + if ($diff > 1) { + return sprintf(elgg_echo("friendlytime:days"), $diff); + } else { + return sprintf(elgg_echo("friendlytime:days:singular"), $diff); + } + } +} + +/** + * Displays a UNIX timestamp in a friendly way + * + * @param int $time A UNIX epoch timestamp + * @return string The friendly time HTML + * @since 1.7.2 + */ +function elgg_view_friendly_time($time) { return elgg_view('output/friendlytime', array('time' => $time)); } diff --git a/mod/blog/start.php b/mod/blog/start.php index 6b9f500a2..a30bf633b 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -178,7 +178,7 @@ function blog_url_handler($entity) { return FALSE; } - $friendly_title = friendly_title($entity->title); + $friendly_title = elgg_get_friendly_title($entity->title); $url = "{$CONFIG->site->url}pg/blog/{$user->username}/read/{$entity->getGUID()}/$friendly_title"; return $url; diff --git a/mod/blog/views/default/blog/sidebar_edit.php b/mod/blog/views/default/blog/sidebar_edit.php index d75c28aad..6d75b85a0 100644 --- a/mod/blog/views/default/blog/sidebar_edit.php +++ b/mod/blog/views/default/blog/sidebar_edit.php @@ -34,7 +34,7 @@ if ($revisions) { $load_base_url = "{$vars['url']}pg/blog/{$owner->username}/edit/{$blog->getGUID()}/"; foreach ($revisions as $revision) { - $time = friendly_time($revision->time_created); + $time = elgg_view_friendly_time($revision->time_created); $load = elgg_view('output/url', array( 'href' => $load_base_url . $revision->id, 'text' => elgg_echo('load') diff --git a/mod/blog/views/default/blog/sidebar_revisions.php b/mod/blog/views/default/blog/sidebar_revisions.php index 3481e444d..618f7d26a 100644 --- a/mod/blog/views/default/blog/sidebar_revisions.php +++ b/mod/blog/views/default/blog/sidebar_revisions.php @@ -44,7 +44,7 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { 'text' => elgg_echo('blog:status:published') )); - $time = "<span class='entity_subtext'>".friendly_time($blog->publish_date)."</span>"; + $time = "<span class='entity_subtext'>".elgg_view_friendly_time($blog->publish_date)."</span>"; echo '<li> ' . $load . ": $time @@ -52,7 +52,7 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { } foreach ($revisions as $revision) { - $time = "<span class='entity_subtext'>".friendly_time($revision->time_created)."</span>"; + $time = "<span class='entity_subtext'>".elgg_view_friendly_time($revision->time_created)."</span>"; if ($revision->name == 'blog_auto_save') { $revision_lang = elgg_echo('blog:auto_saved_revision'); } else { diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php index 5f238cdc1..91a81ae53 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -31,7 +31,7 @@ if($blog->tags){ }else{ $tags = ""; } -$date = friendly_time($blog->publish_date); +$date = elgg_view_friendly_time($blog->publish_date); // The "on" status changes for comments, so best to check for !Off if ($blog->comments_on != 'Off') { diff --git a/mod/blog/views/default/river/object/blog/create.php b/mod/blog/views/default/river/object/blog/create.php index eadd4381d..3a521894f 100644 --- a/mod/blog/views/default/river/object/blog/create.php +++ b/mod/blog/views/default/river/object/blog/create.php @@ -10,7 +10,7 @@ $contents = strip_tags($object->excerpt); $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; $title = sprintf(elgg_echo('blog:river:create'), $url); -$string .= $title . " <a href=\"{$object->getURL()}\">{$object->title}</a> <span class='entity_subtext'>" . friendly_time($object->time_created); +$string .= $title . " <a href=\"{$object->getURL()}\">{$object->title}</a> <span class='entity_subtext'>" . elgg_view_friendly_time($object->time_created); if (isloggedin()) { $string .= '<a class="river_comment_form_button link">' . elgg_echo('generic_comments:text') . '</a>'; diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index de7a95e8f..880979e6d 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -260,9 +260,8 @@ function bookmark_url($entity) { global $CONFIG; $title = $entity->title; - $title = friendly_title($title); + $title = elgg_get_friendly_title($title); return $CONFIG->url . "pg/bookmarks/" . $entity->getOwnerEntity()->username . "/read/" . $entity->getGUID() . "/" . $title; - } /** diff --git a/mod/bookmarks/views/default/bookmarks/group_bookmarks.php b/mod/bookmarks/views/default/bookmarks/group_bookmarks.php index b9c9d27a8..652743b7b 100755 --- a/mod/bookmarks/views/default/bookmarks/group_bookmarks.php +++ b/mod/bookmarks/views/default/bookmarks/group_bookmarks.php @@ -15,7 +15,7 @@ if($bookmarks){ $owner = $b->getOwnerEntity(); //get the time - $friendlytime = friendly_time($b->time_created); + $friendlytime = elgg_view_friendly_time($b->time_created); $info = "<div class='entity_listing_icon'>" . elgg_view('profile/icon',array('entity' => $b->getOwnerEntity(), 'size' => 'tiny')) . "</div>"; diff --git a/mod/bookmarks/views/default/object/bookmarks.php b/mod/bookmarks/views/default/object/bookmarks.php index 23aad799c..67ba1bd91 100644 --- a/mod/bookmarks/views/default/object/bookmarks.php +++ b/mod/bookmarks/views/default/object/bookmarks.php @@ -1,7 +1,7 @@ <?php /** * Elgg bookmark view - * + * * @package ElggBookmarks * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider <info@elgg.com> @@ -10,7 +10,7 @@ */ $owner = $vars['entity']->getOwnerEntity(); -$friendlytime = friendly_time($vars['entity']->time_created); +$friendlytime = elgg_view_friendly_time($vars['entity']->time_created); $parsed_url = parse_url($vars['entity']->address); $faviconurl = $parsed_url['scheme'] . "://" . $parsed_url['host'] . "/favicon.ico"; @@ -51,7 +51,7 @@ if (@file_exists($faviconurl)) { //delete if($vars['entity']->canEdit()){ -$delete .= "<span class='delete_button'>" . elgg_view('output/confirmlink',array( +$delete .= "<span class='delete_button'>" . elgg_view('output/confirmlink',array( 'href' => $vars['url'] . "action/bookmarks/delete?bookmark_guid=" . $vars['entity']->guid, 'text' => elgg_echo("delete"), 'confirm' => elgg_echo("bookmarks:delete:confirm"), @@ -63,11 +63,11 @@ $info = "<div class='entity_metadata'><span {$access_level}>{$object_acl}</span> // include a view for plugins to extend $info .= elgg_view("bookmarks/options",array('entity' => $vars['entity'])); $info .= elgg_view_likes($vars['entity']); // include likes - + //include edit and delete options if($vars['entity']->canEdit()){ $info .= "<span class='entity_edit'><a href=\"{$vars['url']}pg/bookmarks/{$owner->username}/edit/{$vars['entity']->getGUID()}\">" . elgg_echo('edit') . "</a></span>"; - $info .= $delete; + $info .= $delete; } $info .= "</div>"; @@ -82,6 +82,6 @@ if (!empty($tags)) { if($view_notes != ''){ $info .= "<div class='note hidden'>". $vars['entity']->description . "</div>"; } - + //display echo elgg_view_listing($icon, $info);
\ No newline at end of file diff --git a/mod/bookmarks/views/default/river/object/bookmarks/create.php b/mod/bookmarks/views/default/river/object/bookmarks/create.php index 2e27961c0..dec4ab4d1 100644 --- a/mod/bookmarks/views/default/river/object/bookmarks/create.php +++ b/mod/bookmarks/views/default/river/object/bookmarks/create.php @@ -13,7 +13,7 @@ $string .= "<a href=\"" . $object->address . "\">" . $object->title . "</a>"; if(($is_group instanceof ElggGroup) && (get_context() != 'groups')){ $string .= " " . elgg_echo('bookmarks:ingroup') . " <a href=\"{$is_group->getURL()}\">" . $is_group->name . "</a>"; } -$string .= " <span class='entity_subtext'>" . friendly_time($object->time_created); +$string .= " <span class='entity_subtext'>" . elgg_view_friendly_time($object->time_created); if (isloggedin()){ $string .= "<a class='river_comment_form_button link'>Comment</a>"; $string .= elgg_view('likes/forms/link', array('entity' => $object)); diff --git a/mod/bookmarks/views/default/widgets/bookmarks/view.php b/mod/bookmarks/views/default/widgets/bookmarks/view.php index 4240b95f0..e3ae74681 100644 --- a/mod/bookmarks/views/default/widgets/bookmarks/view.php +++ b/mod/bookmarks/views/default/widgets/bookmarks/view.php @@ -27,7 +27,7 @@ if($bookmarks){ $owner = $b->getOwnerEntity(); //get the time - $friendlytime = friendly_time($b->time_created); + $friendlytime = elgg_view_friendly_time($s->time_created); //get the bookmark title $info = "<div class='river_object_bookmarks_create'><p class=\"shares_title\"><a href=\"{$b->address}\">{$b->title}</a></p></div>"; diff --git a/mod/embed/views/default/embed/item/list.php b/mod/embed/views/default/embed/item/list.php index 258e01aed..c45b42e19 100644 --- a/mod/embed/views/default/embed/item/list.php +++ b/mod/embed/views/default/embed/item/list.php @@ -42,7 +42,7 @@ if ($ecml_keyword) { $icon = "<img src=\"{$item->getIcon($icon_size)}\" />"; $info = "<p class='entity_title'>" . htmlentities($title, ENT_QUOTES, 'UTF-8') . "</p>"; -$info .= "<p class='entity_subtext'>" . friendly_time($vars['item']->time_created) . "</p>"; +$info .= "<p class='entity_subtext'>" . elgg_view_friendly_time($vars['item']->time_created) . "</p>"; // @todo is this approach better than inline js? echo "<div class=\"embed_data\" id=\"embed_{$item->getGUID()}\">" . elgg_view_listing($icon, $info) . '</div>'; diff --git a/mod/embed/views/default/object/file/embedlist.php b/mod/embed/views/default/object/file/embedlist.php index 345e69b4b..1f287b938 100644 --- a/mod/embed/views/default/object/file/embedlist.php +++ b/mod/embed/views/default/object/file/embedlist.php @@ -1,6 +1,6 @@ <?php $file = $vars['entity']; - $friendlytime = friendly_time($vars['entity']->time_created); + $friendlytime = elgg_view_friendly_time($vars['entity']->time_created); $info = "<p class='entity_title'> <a href=\"{$file->getURL()}\">{$file->title}</a></p>"; $info .= "<p class='entity_subtext'>{$friendlytime}"; diff --git a/mod/file/start.php b/mod/file/start.php index a2785386f..06f64fddf 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -294,9 +294,8 @@ global $CONFIG; $title = $entity->title; - $title = friendly_title($title); - return $CONFIG->url . "pg/file/" . $entity->getOwnerEntity()->username . "/read/" . $entity->getGUID() . "/" . $title; - + $title = elgg_get_friendly_title($title); + return $CONFIG->url . "pg/file/" . $entity->getOwnerEntity()->username . "/read/" . $entity->getGUID() . "/" . $title; } // Make sure test_init is called on initialisation diff --git a/mod/file/views/default/file/groupprofile_files.php b/mod/file/views/default/file/groupprofile_files.php index 81fb88588..27f6f5d33 100644 --- a/mod/file/views/default/file/groupprofile_files.php +++ b/mod/file/views/default/file/groupprofile_files.php @@ -1,12 +1,12 @@ <?php - + // Files on group profile page //check to make sure group files is activated if($vars['entity']->files_enable != 'no'){ ?> -<div class="group_tool_widget files"> +<div class="group_tool_widget files"> <h3><?php echo elgg_echo("file:group"); ?></h3> <?php @@ -15,38 +15,38 @@ $number = (int) $vars['entity']->num_display; if (!$number) $number = 6; - + //get the group's files $files = elgg_get_entities(array('type' => 'object', 'subtype' => 'file', 'container_guid' => $vars['entity']->guid, 'limit' => $number )); - + //if there are some files, go get them if ($files) { - + //display in list mode foreach($files as $f){ - + $mime = $f->mimetype; echo "<div class='entity_listing clearfloat'>"; echo "<div class='entity_listing_icon'><a href=\"{$f->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $f->thumbnail, 'file_guid' => $f->guid)) . "</a></div>"; echo "<div class='entity_listing_info'>"; echo "<p class='entity_title'>" . $f->title . "</p>"; - echo "<p class='entity_subtext'>" . friendly_time($f->time_created) . "</p>"; + echo "<p class='entity_subtext'>" . elgg_view_friendly_time($f->time_created) . "</p>"; echo "</div></div>"; - + } - - + + //get a link to the users files $users_file_url = $vars['url'] . "pg/file/" . page_owner_entity()->username; - + echo "<p><a href=\"{$users_file_url}\">" . elgg_echo('file:more') . "</a></p>"; - + } else { - + echo "<p class='margin_top'>" . elgg_echo("file:none") . "</p>"; } diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php index f92c2bfc5..ef5c2df07 100644 --- a/mod/file/views/default/object/file.php +++ b/mod/file/views/default/object/file.php @@ -18,7 +18,7 @@ $title = $file->title; $desc = $file->description; $owner = $vars['entity']->getOwnerEntity(); - $friendlytime = friendly_time($vars['entity']->time_created); + $friendlytime = elgg_view_friendly_time($vars['entity']->time_created); $mime = $file->mimetype; if (!$title) { diff --git a/mod/file/views/default/widgets/filerepo/view.php b/mod/file/views/default/widgets/filerepo/view.php index 6763d2536..74c7810d9 100644 --- a/mod/file/views/default/widgets/filerepo/view.php +++ b/mod/file/views/default/widgets/filerepo/view.php @@ -2,13 +2,13 @@ //the page owner $owner = $vars['entity']->owner_guid; - + //the number of files to display $number = (int) $vars['entity']->num_display; if (!$number) { $number = 4; } - + //get the layout view which is set by the user in the edit panel $get_view = (int) $vars['entity']->gallery_list; if (!$get_view || $get_view == 1) { @@ -19,55 +19,55 @@ //get the user's files $files = get_user_objects($vars['entity']->owner_guid, "file", $number, 0); - + //if there are some files, go get them if ($files) { - + echo "<div id='filerepo_widget_layout'>"; - + if($view == "gallery"){ - + echo "<div class='filerepo_widget_galleryview'>"; - + //display in gallery mode foreach($files as $f){ - + $mime = $f->mimetype; echo "<a href=\"{$f->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $f->thumbnail, 'file_guid' => $f->guid)) . "</a>"; - + } - + echo "</div>"; - + }else{ - + //display in list mode foreach($files as $f){ - + $mime = $f->mimetype; echo "<div class='filerepo_widget_singleitem clearfloat'>"; echo "<div class='filerepo_listview_icon'><a href=\"{$f->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $f->thumbnail, 'file_guid' => $f->guid)) . "</a></div>"; echo "<div class='filerepo_widget_content'>"; echo "<div class='filerepo_listview_title'><p class='filerepo_title'>" . $f->title . "</p></div>"; - echo "<div class='filerepo_listview_date'><p class='filerepo_timestamp'><small>" . friendly_time($f->time_created) . "</small></p></div>"; + echo "<div class='filerepo_listview_date'><p class='filerepo_timestamp'><small>" . elgg_view_friendly_time($f->time_created) . "</small></p></div>"; echo "</div></div>"; - + } - + } - - + + //get a link to the users files $users_file_url = $vars['url'] . "pg/file/" . get_user($f->owner_guid)->username; - + echo "<div class='filerepo_widget_singleitem_more'><a href=\"{$users_file_url}\">" . elgg_echo('file:more') . "</a></div>"; echo "</div>"; - - + + } else { - + echo "<p class='margin_top'>" . elgg_echo("file:none") . "</p>"; - + } ?>
\ No newline at end of file diff --git a/mod/groups/start.php b/mod/groups/start.php index 215311ef9..c199b954a 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -342,10 +342,9 @@ global $CONFIG; - $title = friendly_title($entity->name); + $title = elgg_get_friendly_title($entity->name); return $CONFIG->url . "pg/groups/{$entity->guid}/$title/"; - } function groups_groupforumtopic_url($entity) { diff --git a/mod/groups/views/default/forum/maintopic.php b/mod/groups/views/default/forum/maintopic.php index ecb7286e8..9d97def97 100644 --- a/mod/groups/views/default/forum/maintopic.php +++ b/mod/groups/views/default/forum/maintopic.php @@ -46,7 +46,7 @@ }
//display the date of the comment
- echo "<p class='entity_subtext'>" . friendly_time($vars['entity']->time_created) . "</p>";
+ echo "<p class='entity_subtext'>" . elgg_view_friendly_time($vars['entity']->time_created) . "</p>";
echo "</div>"; // close entity_listing_info
echo "</div>"; // close entity_listing.topic
diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php index e32f83cd4..9ebf81642 100644 --- a/mod/groups/views/default/object/groupforumtopic.php +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -1,17 +1,17 @@ <?php /** * Elgg Groups latest discussion listing - * + * * @package ElggGroups * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 */ - + //get the required variables $title = htmlentities($vars['entity']->title, ENT_QUOTES, 'UTF-8'); //$description = get_entity($vars['entity']->description); $topic_owner = get_user($vars['entity']->owner_guid); $group = get_entity($vars['entity']->container_guid); -$forum_created = friendly_time($vars['entity']->time_created); +$forum_created = elgg_view_friendly_time($vars['entity']->time_created); $counter = $vars['entity']->countAnnotations("generic_comment"); $last_post = $vars['entity']->getAnnotations("generic_comment", 1, 0, "desc"); //get the time and user @@ -32,7 +32,7 @@ if(get_context() == "search"){ }else{ $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created'), $forum_created, $counter) . "<br />"; } - if (($last_time) && ($u)) $info.= sprintf(elgg_echo('groups:lastupdated'), friendly_time($last_time), " <a href=\"" . $u->getURL() . "\">" . $u->name . "</a>"); + if (($last_time) && ($u)) $info.= sprintf(elgg_echo('groups:lastupdated'), elgg_view_friendly_time($last_time), " <a href=\"" . $u->getURL() . "\">" . $u->name . "</a>"); $info .= '</p>'; //get the group avatar $icon = elgg_view("profile/icon",array('entity' => $u, 'size' => 'tiny')); @@ -41,7 +41,7 @@ if(get_context() == "search"){ if ($group instanceof ElggGroup) { $info .= "<p class='entity_title'><b>" . elgg_echo('group') . ":</b> <a href=\"{$group->getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."</a></p>"; } - + }else{ if($counter == 1){ $info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created:single'), $forum_created, $counter) . "</p>"; @@ -57,15 +57,15 @@ if(get_context() == "search"){ 'text' => " ", 'confirm' => elgg_echo('deleteconfirm'), )) . "</div>"; - - } + + } if (($last_time) && ($u)) { - $info.= "<p class='entity_subtext'>" . elgg_echo('groups:updated') . " " . friendly_time($last_time) . " by <a href=\"" . $u->getURL() . "\">" . $u->name . "</a></p>"; + $info.= "<p class='entity_subtext'>" . elgg_echo('groups:updated') . " " . elgg_view_friendly_time($last_time) . " by <a href=\"" . $u->getURL() . "\">" . $u->name . "</a></p>"; } //get the user avatar - $icon = elgg_view("profile/icon",array('entity' => $topic_owner, 'size' => 'tiny')); + $icon = elgg_view("profile/icon",array('entity' => $topic_owner, 'size' => 'tiny')); } - + //display echo elgg_view_listing($icon, $info);
\ No newline at end of file diff --git a/mod/groups/views/default/river/forum/create.php b/mod/groups/views/default/river/forum/create.php index e99c77a4e..7fc3affe7 100644 --- a/mod/groups/views/default/river/forum/create.php +++ b/mod/groups/views/default/river/forum/create.php @@ -16,7 +16,7 @@ $url = $vars['url'] . "mod/groups/topicposts.php?topic=" . $forumtopic . "&group_guid=" . $group_guid; $url_user = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; $string = sprintf(elgg_echo("groupforum:river:posted"),$url_user) . " "; - $string .= elgg_echo("groupforum:river:annotate:create") . " | <a href=\"" . $url . "\">" . $object->title . "</a> <span class='entity_subtext'>". friendly_time($object->time_created) ."<a class='river_comment_form_button link' href=\"{$object_url}\">Visit discussion</a>"; + $string .= elgg_echo("groupforum:river:annotate:create") . " | <a href=\"" . $url . "\">" . $object->title . "</a> <span class='entity_subtext'>". elgg_view_friendly_time($object->time_created) ."<a class='river_comment_form_button link' href=\"{$object_url}\">Visit discussion</a>"; $string .= elgg_view('likes/forms/link', array('entity' => $object)); $string .= "</span>"; $string .= "<div class=\"river_content_display\">"; diff --git a/mod/groups/views/default/river/forum/topic/create.php b/mod/groups/views/default/river/forum/topic/create.php index b44922022..0d70ad718 100644 --- a/mod/groups/views/default/river/forum/topic/create.php +++ b/mod/groups/views/default/river/forum/topic/create.php @@ -16,7 +16,7 @@ $string = sprintf(elgg_echo("groupforum:river:postedtopic"),$url_user) . ": "; $string .= "<a href=\"" . $url . "\">" . $object->title . "</a>"; $string .= " " . elgg_echo('groups:ingroup') . " <a href=\"{$group->getURL()}\">" . $group->name . "</a>"; - $string .= " <span class='entity_subtext'>". friendly_time($object->time_created); + $string .= " <span class='entity_subtext'>". elgg_view_friendly_time($object->time_created); if (isloggedin() && $object->status != "closed") { $string .= '<a class="river_comment_form_button link">' . elgg_echo('generic_comments:text') . '</a>'; $string .= elgg_view('likes/forms/link', array('entity' => $object)); diff --git a/mod/groups/views/default/river/group/create.php b/mod/groups/views/default/river/group/create.php index 3f34605ac..961750974 100644 --- a/mod/groups/views/default/river/group/create.php +++ b/mod/groups/views/default/river/group/create.php @@ -7,7 +7,7 @@ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; $string = sprintf(elgg_echo("groups:river:created"),$url) . " "; $string .= " <a href=\"" . $object->getURL() . "\">" . $object->name . "</a>"; - $string .= " <span class='entity_subtext'>". friendly_time($object->time_created); + $string .= " <span class='entity_subtext'>". elgg_view_friendly_time($object->time_created); if (isloggedin()) { $string .= elgg_view('likes/forms/link', array('entity' => $object)); } diff --git a/mod/messageboard/views/default/messageboard/messageboard_content.php b/mod/messageboard/views/default/messageboard/messageboard_content.php index 41a308892..5f3a191ae 100644 --- a/mod/messageboard/views/default/messageboard/messageboard_content.php +++ b/mod/messageboard/views/default/messageboard/messageboard_content.php @@ -23,7 +23,7 @@ <!-- display the user's name who posted and the date/time --> <p class="message_item_timestamp"> - <?php echo get_entity($vars['annotation']->owner_guid)->name . " " . friendly_time($vars['annotation']->time_created); ?> + <?php echo get_entity($vars['annotation']->owner_guid)->name . " " . elgg_view_friendly_time($vars['annotation']->time_created); ?> </p> <!-- output the actual comment --> diff --git a/mod/messages/views/default/messages/messages.php b/mod/messages/views/default/messages/messages.php index 46747faa3..984655540 100644 --- a/mod/messages/views/default/messages/messages.php +++ b/mod/messages/views/default/messages/messages.php @@ -77,7 +77,7 @@ if (isloggedin()) ?> <div class="entity_listing_icon"><?php echo $message_icon ?></div> <div class="entity_listing_info"><p><?php echo $message_owner ?></p> - <p class="entity_subtext"><?php echo friendly_time($vars['entity']->time_created); ?></p> + <p class="entity_subtext"><?php echo elgg_view_friendly_time($vars['entity']->time_created); ?></p> </div> </div> diff --git a/mod/messages/views/default/messages/view.php b/mod/messages/views/default/messages/view.php index 2de060e33..3cbcec943 100644 --- a/mod/messages/views/default/messages/view.php +++ b/mod/messages/views/default/messages/view.php @@ -27,7 +27,7 @@ if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) { foreach($vars['entity'] as $message) { if ($message->owner_guid == $vars['user']->guid || $message->toId == $vars['user']->guid) { - + //make sure to only display the messages that have not been 'deleted' (1 = deleted) if($message->hiddenFrom != 1){ // check to see if the message has been read, if so, set the correct container class @@ -40,7 +40,7 @@ if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) { $from = get_entity($message->fromId); echo "<div class='entity_listing_icon'>".elgg_view("profile/icon",array('entity' => $from, 'size' => 'tiny'))."</div>"; // message block (message sender, message subject, delete checkbox) - echo "<div class='entity_listing_info'><div class='message_sender'>".$from->name."<p class='entity_subtext'>".friendly_time($message->time_created)."</p></div>"; + echo "<div class='entity_listing_info'><div class='message_sender'>".$from->name."<p class='entity_subtext'>".elgg_view_friendly_time($message->time_created)."</p></div>"; // display message subject echo "<div class='message_subject'>"; // display delete button @@ -50,10 +50,10 @@ if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) { 'confirm' => elgg_echo('deleteconfirm'), )) . "</span>"; echo "<p class='entity_title'><input type='checkbox' name=\"message_id[]\" value=\"{$message->guid}\" />"; - echo "<a href=\"{$message->getURL()}\">" . $message->title . "</a></p>"; + echo "<a href=\"{$message->getURL()}\">" . $message->title . "</a></p>"; echo "</div></div></div>"; // close the message container }//end of hiddenFrom if statement - } // end of user check + } // end of user check $counter++; if ($counter == $limit) break; @@ -72,10 +72,10 @@ if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) { //get the correct user entity $user = get_entity($message->toId); - echo "<div class='message sent clearfloat'>"; + echo "<div class='message sent clearfloat'>"; //get the icon for the user the message was sent to echo "<div class='entity_listing_icon'>".elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny'))."</div>"; - echo "<div class='entity_listing_info'><div class='message_sender'>".$_SESSION['user']->name."<p class='entity_subtext'>".friendly_time($message->time_created)."</p></div>"; + echo "<div class='entity_listing_info'><div class='message_sender'>".$_SESSION['user']->name."<p class='entity_subtext'>".elgg_view_friendly_time($message->time_created)."</p></div>"; // display message subject echo "<div class='message_subject'>"; //display the link to 'delete' diff --git a/mod/pages/views/default/annotation/page.php b/mod/pages/views/default/annotation/page.php index c59c80567..cc0f67746 100644 --- a/mod/pages/views/default/annotation/page.php +++ b/mod/pages/views/default/annotation/page.php @@ -19,7 +19,7 @@ $owner_guid = $annotation->owner_guid; $owner = get_entity($owner_guid); $rev = sprintf(elgg_echo('pages:revision'), - friendly_time($annotation->time_created), + elgg_view_friendly_time($annotation->time_created), "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>" ); diff --git a/mod/pages/views/default/pages/pagelisting.php b/mod/pages/views/default/pages/pagelisting.php index 4dc5dc3b3..419fc8d23 100644 --- a/mod/pages/views/default/pages/pagelisting.php +++ b/mod/pages/views/default/pages/pagelisting.php @@ -24,7 +24,7 @@ if ($latest) { $info .= "<p class=\"owner_timestamp\">".sprintf(elgg_echo("pages:strapline"), - friendly_time($time_updated), + elgg_view_friendly_time($time_updated), "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>" ) . "</p>"; } diff --git a/mod/pages/views/default/pages/pageprofile.php b/mod/pages/views/default/pages/pageprofile.php index cc3113b4e..5702ec415 100644 --- a/mod/pages/views/default/pages/pageprofile.php +++ b/mod/pages/views/default/pages/pageprofile.php @@ -63,7 +63,7 @@ if ($rev) { $owner = get_entity($owner_guid); echo sprintf(elgg_echo("pages:strapline"), - friendly_time($time_updated), + elgg_view_friendly_time($time_updated), "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>" ); diff --git a/mod/pages/views/default/river/object/page/create.php b/mod/pages/views/default/river/object/page/create.php index dc4554404..728978178 100644 --- a/mod/pages/views/default/river/object/page/create.php +++ b/mod/pages/views/default/river/object/page/create.php @@ -13,7 +13,7 @@ $url = $object->getURL(); $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; $contents = strip_tags($object->description); //strip tags from the contents to stop large images etc blowing out the river view $string = sprintf(elgg_echo("pages:river:created"),$url) . " "; -$string .= elgg_echo("pages:river:create") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a> <span class='entity_subtext'>". friendly_time($object->time_created) ."</span> <a class='river_comment_form_button link'>Comment</a>"; +$string .= elgg_echo("pages:river:create") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a> <span class='entity_subtext'>". elgg_view_friendly_time($object->time_created) ."</span> <a class='river_comment_form_button link'>Comment</a>"; $string .= elgg_view('likes/forms/link', array('entity' => $object)); $string .= "<div class=\"river_content_display\">"; $string .= elgg_make_excerpt($contents, 200); diff --git a/mod/profile/views/default/profile/commentwall/commentwall_content.php b/mod/profile/views/default/profile/commentwall/commentwall_content.php index cacea117c..360627c0c 100644 --- a/mod/profile/views/default/profile/commentwall/commentwall_content.php +++ b/mod/profile/views/default/profile/commentwall/commentwall_content.php @@ -24,7 +24,7 @@ ?> <!-- display the user's name who posted and the date/time --> <p class="entity_subtext"> - <?php echo get_entity($vars['annotation']->owner_guid)->name . " " . friendly_time($vars['annotation']->time_created); ?> + <?php echo get_entity($vars['annotation']->owner_guid)->name . " " . elgg_view_friendly_time($vars['annotation']->time_created); ?> </p> <!-- output the actual comment --> <?php echo elgg_view("output/longtext",array("value" => parse_urls($vars['annotation']->value))); ?> diff --git a/mod/profile/views/default/river/user/default/profileiconupdate.php b/mod/profile/views/default/river/user/default/profileiconupdate.php index 1dca77df6..b1e5baf88 100644 --- a/mod/profile/views/default/river/user/default/profileiconupdate.php +++ b/mod/profile/views/default/river/user/default/profileiconupdate.php @@ -3,6 +3,6 @@ $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("profile:river:update"),$url) ." <span class='entity_subtext'>" . friendly_time($vars['item']->posted) . "</span>"; + $string = sprintf(elgg_echo("profile:river:update"),$url) ." <span class='entity_subtext'>" . elgg_view_friendly_time($vars['item']->posted) . "</span>"; echo $string;
\ No newline at end of file diff --git a/mod/profile/views/default/river/user/default/profileupdate.php b/mod/profile/views/default/river/user/default/profileupdate.php index e609e1a40..5da11c4b3 100644 --- a/mod/profile/views/default/river/user/default/profileupdate.php +++ b/mod/profile/views/default/river/user/default/profileupdate.php @@ -3,7 +3,7 @@ $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("profile:river:update"),$url) ." <span class='entity_subtext'>" . friendly_time($vars['item']->posted) . "</span>"; + $string = sprintf(elgg_echo("profile:river:update"),$url) ." <span class='entity_subtext'>" . elgg_view_friendly_time($vars['item']->posted) . "</span>"; ?> diff --git a/mod/reportedcontent/views/default/reportedcontent/listing.php b/mod/reportedcontent/views/default/reportedcontent/listing.php index 99069cb8c..33c546397 100644 --- a/mod/reportedcontent/views/default/reportedcontent/listing.php +++ b/mod/reportedcontent/views/default/reportedcontent/listing.php @@ -1,7 +1,7 @@ <?php /** * Elgg report content listing - * + * * @package ElggReportContent * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider <info@elgg.com> @@ -12,27 +12,27 @@ if($vars['entity']){ $id = 0; foreach($vars['entity'] as $report){ - + // increment our id counter $id++; - + //get the user making the report $user = get_user($report->owner_guid)->name; $user_url = get_user($report->owner_guid)->getURL(); - + //find out if the report is current or archive if($report->state == 'archived'){ $reportedcontent_background = "archived_report"; }else{ $reportedcontent_background = "active_report"; } - + echo "<div class='admin_settings reported_content {$reportedcontent_background}'>"; echo "<div class='clearfloat controls'>"; if($report->state != 'archived') echo "<a class='action_button' href=\"" . elgg_add_action_tokens_to_url($vars['url'] . "action/reportedcontent/archive?item={$report->guid}") . "\">" . elgg_echo('reportedcontent:archive') . "</a>"; echo "<a class='action_button disabled' href=\"" . elgg_add_action_tokens_to_url($vars['url'] . "action/reportedcontent/delete?item={$report->guid}") . "\" onclick=\"return confirm('" . elgg_echo('reportedcontent:areyousure') . "')\">" . elgg_echo('reportedcontent:delete') . "</a></div>"; - echo "<p><b>" . elgg_echo('reportedcontent:by') . ": </b><a href=\"{$user_url}\">" . $user . "</a>, " . friendly_time($report->time_created) . "</p>"; + echo "<p><b>" . elgg_echo('reportedcontent:by') . ": </b><a href=\"{$user_url}\">" . $user . "</a>, " . elgg_view_friendly_time($report->time_created) . "</p>"; echo "<p><b>" . elgg_echo('reportedcontent:objecttitle') . ": </b>" . $report->title; echo "<br /><a onclick=\"elgg_slide_toggle(this,'.reported_content','.container{$id}');\" class='details_link'>" . elgg_echo('reportedcontent:moreinfo') . "</a></p>"; echo "<div class='details container{$id} hidden'>"; @@ -40,7 +40,7 @@ if($vars['entity']){ echo "<p><b>" . elgg_echo('reportedcontent:reason') . ": </b>" .$report->description . "</p>"; echo "</div></div>"; } - + } else { echo "<p class='margin_top'>".elgg_echo('reportedcontent:none')."</p>"; }
\ No newline at end of file diff --git a/mod/riverdashboard/endpoint/get_comments.php b/mod/riverdashboard/endpoint/get_comments.php index b6f4b565a..017591fa5 100644 --- a/mod/riverdashboard/endpoint/get_comments.php +++ b/mod/riverdashboard/endpoint/get_comments.php @@ -35,6 +35,6 @@ foreach ($comments as $comment) { echo "<div class='river_comment_contents'>"; echo "<a href=\"{$comment_owner_url}\">" . $comment_owner->name . '</a> <span class="twitter_anywhere">' . parse_urls($contents) . '</span>'; - echo "<span class='entity_subtext'>" . friendly_time($comment->time_created) . "</span>"; + echo "<span class='entity_subtext'>" . elgg_view_friendly_time($comment->time_created) . "</span>"; echo "</div></div>"; }
\ No newline at end of file diff --git a/mod/riverdashboard/views/default/river/item/wrapper.php b/mod/riverdashboard/views/default/river/item/wrapper.php index 482057ed4..2b964510d 100644 --- a/mod/riverdashboard/views/default/river/item/wrapper.php +++ b/mod/riverdashboard/views/default/river/item/wrapper.php @@ -105,7 +105,7 @@ if ($comments){ echo "<div class='river_comment_contents'>"; echo "<a href=\"{$comment_owner_url}\">" . $comment_owner->name . '</a> <span class="elgg_excerpt">' . parse_urls($contents) . '</span>'; - echo "<span class='entity_subtext'>" . friendly_time($comment->time_created) . "</span>"; + echo "<span class='entity_subtext'>" . elgg_view_friendly_time($comment->time_created) . "</span>"; echo "</div></div>"; $counter++; } diff --git a/mod/riverdashboard/views/default/riverdashboard/sitemessage.php b/mod/riverdashboard/views/default/riverdashboard/sitemessage.php index 4d1eea2af..fa582bab3 100644 --- a/mod/riverdashboard/views/default/riverdashboard/sitemessage.php +++ b/mod/riverdashboard/views/default/riverdashboard/sitemessage.php @@ -16,7 +16,7 @@ $site_message = elgg_get_entities(array('types' => 'object', 'subtypes' => 'site if ($site_message) { $mes = $site_message[0]; $message = $mes->description; - $dateStamp = friendly_time($mes->time_created); + $dateStamp = elgg_view_friendly_time($mes->time_created); $delete = elgg_view("output/confirmlink",array( 'href' => $vars['url'] . "action/riverdashboard/delete?message=" . $mes->guid, 'text' => elgg_echo('delete'), diff --git a/mod/search/views/default/search/comments/entity.php b/mod/search/views/default/search/comments/entity.php index 0d253c567..001c9c431 100644 --- a/mod/search/views/default/search/comments/entity.php +++ b/mod/search/views/default/search/comments/entity.php @@ -44,7 +44,7 @@ if ($entity->getVolatileData('search_unavailable_entity')) { $description = $entity->getVolatileData('search_matched_comment'); $tc = $entity->getVolatileData('search_matched_comment_time_created');; -$time = friendly_time($tc); +$time = elgg_view_friendly_time($tc); echo <<<___END <div class="search_listing clearfloat"> diff --git a/mod/search/views/default/search/entity.php b/mod/search/views/default/search/entity.php index df929ef0b..1c282c747 100644 --- a/mod/search/views/default/search/entity.php +++ b/mod/search/views/default/search/entity.php @@ -52,7 +52,7 @@ $time = $entity->getVolatileData('search_time'); if (!$time) { $tc = $entity->time_created; $tu = $entity->time_updated; - $time = friendly_time(($tu > $tc) ? $tu : $tc); + $time = elgg_view_friendly_time(($tu > $tc) ? $tu : $tc); } ?> <div class="search_listing clearfloat"> diff --git a/mod/thewire/views/default/object/thewire.php b/mod/thewire/views/default/object/thewire.php index 170c0484a..d87d8f8e3 100644 --- a/mod/thewire/views/default/object/thewire.php +++ b/mod/thewire/views/default/object/thewire.php @@ -58,7 +58,7 @@ if (isset($vars['entity'])) { <p class="entity_subtext"> <?php echo elgg_echo("thewire:wired") . " " . sprintf(elgg_echo("thewire:strapline"), - friendly_time($vars['entity']->time_created) + elgg_view_friendly_time($vars['entity']->time_created) ); echo " via " . elgg_echo($vars['entity']->method) . "."; ?> diff --git a/mod/thewire/views/default/river/object/thewire/create.php b/mod/thewire/views/default/river/object/thewire/create.php index d8d8ba3b5..9dee87274 100644 --- a/mod/thewire/views/default/river/object/thewire/create.php +++ b/mod/thewire/views/default/river/object/thewire/create.php @@ -8,7 +8,7 @@ $string = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}:</a> "; $desc = $object->description; //$desc = preg_replace('/\@([A-Za-z0-9\_\.\-]*)/i','@<a href="' . $vars['url'] . 'pg/thewire/$1">$1</a>',$desc); $string .= parse_urls($desc); -$string .= " <span class='entity_subtext'>" . friendly_time($object->time_created); +$string .= " <span class='entity_subtext'>" . elgg_view_friendly_time($object->time_created); if (isloggedin()){ $string .= "<a class='river_comment_form_button link'>Comment</a>"; $string .= elgg_view('likes/forms/link', array('entity' => $object)); diff --git a/mod/thewire/views/default/thewire/profile_status.php b/mod/thewire/views/default/thewire/profile_status.php index fa8ccd76b..24f6c447b 100644 --- a/mod/thewire/views/default/thewire/profile_status.php +++ b/mod/thewire/views/default/thewire/profile_status.php @@ -13,7 +13,7 @@ if($latest_wire){ foreach($latest_wire as $lw){ $content = $lw->description; - $time = "<p class='entity_subtext'> (" . friendly_time($lw->time_created) . ")</p>"; + $time = "<p class='entity_subtext'> (" . elgg_view_friendly_time($lw->time_created) . ")</p>"; } } diff --git a/views/default/annotation/annotate.php b/views/default/annotation/annotate.php index 5cd2879c2..bfef8e08e 100644 --- a/views/default/annotation/annotate.php +++ b/views/default/annotation/annotate.php @@ -12,7 +12,7 @@ $comment = get_annotation($vars['item']->annotation_id)->value; $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; $string = sprintf(elgg_echo("river:posted:generic"),$url) . " "; - $string .= elgg_echo("{$subtype}:river:annotate") . " <a href=\"{$object->getURL()}\">" . $title . "</a> <span class='entity_subtext'>". friendly_time($object->time_created) ."<a class='river_comment_form_button link'>Comment</a>"; + $string .= elgg_echo("{$subtype}:river:annotate") . " <a href=\"{$object->getURL()}\">" . $title . "</a> <span class='entity_subtext'>". elgg_view_friendly_time($object->time_created) ."<a class='river_comment_form_button link'>Comment</a>"; $string .= elgg_view('likes/forms/link', array('entity' => $object)); $string .= "</span>"; if(get_context() != 'riverdashboard'){ diff --git a/views/default/annotation/annotatelike.php b/views/default/annotation/annotatelike.php index 6a2dcd4ca..43655ba6e 100644 --- a/views/default/annotation/annotatelike.php +++ b/views/default/annotation/annotatelike.php @@ -6,6 +6,6 @@ $url = $object->getURL(); $title = $object->title; $string = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a> "; -$string .= elgg_echo("likes:river:annotate") . " <a href=\"{$object->getURL()}\">" . $title . "</a> <span class='entity_subtext'>" . friendly_time($object->time_created)."</span>"; +$string .= elgg_echo("likes:river:annotate") . " <a href=\"{$object->getURL()}\">" . $title . "</a> <span class='entity_subtext'>" . elgg_view_friendly_time($object->time_created)."</span>"; echo $string;
\ No newline at end of file diff --git a/views/default/annotation/generic_comment.php b/views/default/annotation/generic_comment.php index 56948aaf4..5b9c62840 100644 --- a/views/default/annotation/generic_comment.php +++ b/views/default/annotation/generic_comment.php @@ -36,7 +36,7 @@ $owner = get_user($vars['annotation']->owner_guid); <p class="generic_comment_owner"> <a href="<?php echo $owner->getURL(); ?>"><?php echo $owner->name; ?></a> <span class="entity_subtext"> - <?php echo friendly_time($vars['annotation']->time_created); ?> + <?php echo elgg_view_friendly_time($vars['annotation']->time_created); ?> </span> </p> <!-- output the actual comment --> diff --git a/views/default/annotation/latest_comments.php b/views/default/annotation/latest_comments.php index e1181b63e..79a50fea1 100644 --- a/views/default/annotation/latest_comments.php +++ b/views/default/annotation/latest_comments.php @@ -11,7 +11,7 @@ if($vars['comments']){ $entity = get_entity($comment->entity_guid); //comment owner $comment_owner = get_user($comment->owner_guid); - $friendlytime = friendly_time($comment->time_created); // get timestamp for comment + $friendlytime = elgg_view_friendly_time($comment->time_created); // get timestamp for comment //set the title if($entity->title){ diff --git a/views/default/annotation/likes.php b/views/default/annotation/likes.php index 2808664df..cb7424f7d 100644 --- a/views/default/annotation/likes.php +++ b/views/default/annotation/likes.php @@ -34,7 +34,7 @@ $owner = get_user($vars['annotation']->owner_guid); ?> <p class="elgg_likes_owner"> <a href="<?php echo $owner->getURL(); ?>"><?php echo $owner->name; ?></a> <?php echo elgg_echo('likes:this') . - " <span class=\"entity_subtext\">" . friendly_time($vars['annotation']->time_created) . "</span>"; ?> + " <span class=\"entity_subtext\">" . elgg_view_friendly_time($vars['annotation']->time_created) . "</span>"; ?> </p> </div> </div>
\ No newline at end of file diff --git a/views/default/object/default.php b/views/default/object/default.php index d49463bf8..cc3dd1e72 100644 --- a/views/default/object/default.php +++ b/views/default/object/default.php @@ -50,7 +50,7 @@ if ($vars['full']) { } $info .= "<div>".sprintf(elgg_echo("entity:default:strapline"), - friendly_time($vars['entity']->time_created), + elgg_view_friendly_time($vars['entity']->time_created), $ownertxt ); diff --git a/views/default/output/friendlytime.php b/views/default/output/friendlytime.php index 282d94c41..710079c2a 100644 --- a/views/default/output/friendlytime.php +++ b/views/default/output/friendlytime.php @@ -6,49 +6,7 @@ * @uses string $vars['time'] Unix-style epoch timestamp */ -$diff = time() - ((int) $vars['time']); - -$minute = 60; -$hour = $minute * 60; -$day = $hour * 24; - -if ($diff < $minute) { - $friendly_time = elgg_echo("friendlytime:justnow"); -} else if ($diff < $hour) { - $diff = round($diff / $minute); - if ($diff == 0) { - $diff = 1; - } - - if ($diff > 1) { - $friendly_time = sprintf(elgg_echo("friendlytime:minutes"), $diff); - } else { - $friendly_time = sprintf(elgg_echo("friendlytime:minutes:singular"), $diff); - } -} else if ($diff < $day) { - $diff = round($diff / $hour); - if ($diff == 0) { - $diff = 1; - } - - if ($diff > 1) { - $friendly_time = sprintf(elgg_echo("friendlytime:hours"), $diff); - } else { - $friendly_time = sprintf(elgg_echo("friendlytime:hours:singular"), $diff); - } -} else { - $diff = round($diff / $day); - if ($diff == 0) { - $diff = 1; - } - - if ($diff > 1) { - $friendly_time = sprintf(elgg_echo("friendlytime:days"), $diff); - } else { - $friendly_time = sprintf(elgg_echo("friendlytime:days:singular"), $diff); - } -} - +$friendly_time = elgg_get_friendly_time($vars['time']); $timestamp = htmlentities(date(elgg_echo('friendlytime:date_format'), $vars['time'])); echo "<acronym title=\"$timestamp\">$friendly_time</acronym>"; diff --git a/views/default/river/item/wrapper.php b/views/default/river/item/wrapper.php index a00273648..6391f23fb 100644 --- a/views/default/river/item/wrapper.php +++ b/views/default/river/item/wrapper.php @@ -28,7 +28,7 @@ if($avatar_icon == "icon"){ ?> <span class="entity_subtext"> (<?php - echo friendly_time($vars['item']->posted); + echo elgg_view_friendly_time($vars['item']->posted); ?>) </span> </p> @@ -53,7 +53,7 @@ if($avatar_icon == "icon"){ ?> <span class="entity_subtext"> (<?php - echo friendly_time($vars['item']->posted); + echo elgg_view_friendly_time($vars['item']->posted); ?>) </span> </p> |