Advertisement
Guest User

Untitled

a guest
Feb 20th, 2013
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. /**
  2. * Output the post date and time of a reply
  3. *
  4. * @since bbPress (r4155)
  5. *
  6. * @param int $reply_id Optional. Reply id.
  7. * @param bool $humanize Optional. Humanize output using time_since
  8. * @param bool $gmt Optional. Use GMT
  9. * @uses bbp_get_reply_post_date() to get the output
  10. */
  11. function bbp_reply_post_date( $reply_id = 0, $humanize = false, $gmt = false ) {
  12. echo bbp_get_reply_post_date( $reply_id, $humanize, $gmt );
  13. }
  14. /**
  15. * Return the post date and time of a reply
  16. *
  17. * @since bbPress (r4155)
  18. *
  19. * @param int $reply_id Optional. Reply id.
  20. * @param bool $humanize Optional. Humanize output using time_since
  21. * @param bool $gmt Optional. Use GMT
  22. * @uses bbp_get_reply_id() To get the reply id
  23. * @uses get_post_time() to get the reply post time
  24. * @uses bbp_time_since() to maybe humanize the reply post time
  25. * @return string
  26. */
  27. function bbp_get_reply_post_date( $reply_id = 0, $humanize = false, $gmt = false ) {
  28. $reply_id = bbp_get_reply_id( $reply_id );
  29.  
  30. // 4 days, 4 hours ago
  31. if ( !empty( $humanize ) ) {
  32. $gmt = !empty( $gmt ) ? 'G' : 'U';
  33. $date = get_post_time( $gmt, $reply_id );
  34. $time = false; // For filter below
  35. $result = bbp_time_since( $date );
  36.  
  37. // August 4, 2012 at 2:37 pm
  38. } else {
  39. $date = get_post_time( get_option( 'date_format' ), $gmt, $reply_id );
  40. $time = get_post_time( get_option( 'time_format' ), $gmt, $reply_id );
  41. $result = sprintf( _x( '%1$s at %2$s', 'date at time', 'bbpress' ), $date, $time );
  42. }
  43.  
  44. return apply_filters( 'bbp_get_reply_post_date', $result, $reply_id, $humanize, $gmt, $date, $time );
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement