rdusnr

Untitled

Jul 10th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. /**
  2. * Print rtmedia who like html
  3. *
  4. * @param int $like_count ( Total like Count )
  5. * @param bool|string $user_like_it ( login user like it or not )
  6. *
  7. * @return string HTML
  8. */
  9. if ( ! function_exists( 'rtmedia_who_like_html' ) ) {
  10. function rtmedia_who_like_html( $like_count, $user_like_it ) {
  11. $like_count = ( $like_count ) ? $like_count : false;
  12. $user_like_it = ( $user_like_it ) ? true : false;
  13. $like_count_new = $like_count;
  14. $html = '';
  15. if ( $like_count == 1 && $user_like_it ) {
  16. /**
  17. * rtmedia you like text
  18. * @param $html TEXT
  19. * @param int $like_count Total Like
  20. * @param int $user_like_it User Like it or Not
  21. * @return html TEXT to display
  22. */
  23. $html = apply_filters( 'rtmedia_like_html_you_only_like', esc_html__( 'You like this', 'buddypress-media' ), $like_count, $user_like_it );
  24. } elseif ( $like_count ) {
  25. if ( $like_count > 1 && $user_like_it ) {
  26. /**
  27. * rtmedia you and
  28. * @param $html TEXT
  29. * @param int $like_count Total Like
  30. * @param int $user_like_it User Like it or Not
  31. * @return html TEXT to display
  32. */
  33. $html .= apply_filters( 'rtmedia_like_html_you_and_more_like', esc_html__( 'You and ', 'buddypress-media' ), $like_count, $user_like_it );
  34. $like_count_new--;
  35. }
  36.  
  37. /**
  38. * rtmedia Disaply count
  39. * @param int $like_count Total Like
  40. * @param int $user_like_it User Like it or Not
  41. * @return INT Count to display
  42. */
  43. $html .= apply_filters( 'rtmedia_like_html_you_and_more_like', $like_count, $user_like_it );
  44.  
  45. /**
  46. * rtmedia person or people likes it
  47. * @param $html TEXT
  48. * @param int $like_count Total Like
  49. * @param int $user_like_it User Like it or Not
  50. * @return html TEXT to display
  51. */
  52. $html .= apply_filters( 'rtmedia_like_html_othe_likes_this', _n( ' person likes this', ' people like this', $like_count_new, 'buddypress-media' ) ,$like_count, $user_like_it );
  53. }
  54.  
  55. /**
  56. * rtmedia return whole HTML
  57. * @param $html TEXT
  58. * @param int $like_count Total Like
  59. * @param int $user_like_it User Like it or Not
  60. * @return html TEXT to display
  61. */
  62. $html = apply_filters( 'rtmedia_who_like_html', $html ,$like_count, $user_like_it );
  63. return $html;
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment