diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-23 21:47:04 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-23 21:47:04 +0000 |
commit | 45128b2322742d99bd4b1cc1bde6215ac6af7982 (patch) | |
tree | a83ba3ecb0b3ee40a64544f4fbb42ca1e1ffe5bc /modules/comment/helpers | |
parent | 55fc5993f0fbf0a5e4454b4533db20c74a7a9605 (diff) |
Prefer variable interpolation to sprintf where possible (less code, more readable)
Prefer url::abs_site() to atom::get_base_url()
Diffstat (limited to 'modules/comment/helpers')
-rw-r--r-- | modules/comment/helpers/comment.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index e150bbda..be44fc13 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -154,9 +154,9 @@ class comment_Core { ->author() ->name($comment->author) ->email($comment->email) - ->uri(sprintf("%susers/%s", atom::get_base_url(), $comment->id)); - $feed->link()->related_atom(sprintf("photos/%s", $comment->item_id)); - $feed->link()->related_image(sprintf("photos/%s", $comment->item_id)); + ->uri(url::abs_site("users/$comment->id")); + $feed->link()->related_atom("photos/$comment->item_id"); + $feed->link()->related_image("photos/$comment->item_id"); return $feed->as_xml(); } @@ -173,20 +173,20 @@ class comment_Core { $feed = new Gallery_Atom_Feed(); $feed->title(sprintf(_("Comments on photo %d"), $item_id)); $feed->updated($latest_comment); - $feed->link()->related_atom(sprintf("photos/%s", $item_id)); - $feed->link()->related_image(sprintf("photos/%s", $item_id)); + $feed->link()->related_atom("photos/$item_id"); + $feed->link()->related_image("photos/$item_id"); /* Add individual comments. */ foreach ($comments as $id => $comment) { $feed->entry() - ->id(sprintf("%scomments/%s", atom::get_base_url(), $comment->id)) + ->id(url::abs_site("comments/$comment->id")) ->updated($comment->datetime) ->title(sprintf(_("Comment #%d"), $comments->count() - $id)) ->content($comment->text) ->author() ->name($comment->author) ->email($comment->email) - ->uri(sprintf("%susers/%s", atom::get_base_url(), $comment->id)); + ->uri(url::abs_site("users/$comment->id")); } return $feed->as_xml(); } @@ -215,16 +215,16 @@ class comment_Core { /* Construct message depending on how much time passed. */ if ($elapsed_years > 0) { - $message = sprintf(_('said %d years ago'), $elapsed_years); + $message = sprintf(_("said %d years ago"), $elapsed_years); } else if ($elapsed_months > 0) { - $message = sprintf(_('said %d months ago'), $elapsed_months); + $message = sprintf(_("said %d months ago"), $elapsed_months); } else { if ($time_difference < $seconds_since_midnight) { - $message = _('said today'); + $message = _("said today"); } else if ($time_difference < $seconds_since_midnight + comment::SECONDS_IN_A_DAY) { - $message = _('said yesterday'); + $message = _("said yesterday"); } else { - $message = sprintf(_('said %d days ago'), $elapsed_days); + $message = sprintf(_("said %d days ago"), $elapsed_days); } } return $message; |