PageRenderTime 27ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/libraries/joomla/facebook/video.php

https://bitbucket.org/pastor399/newcastleunifc
PHP | 149 lines | 39 code | 12 blank | 98 comment | 0 complexity | 5c02ee4c6272868fa3c634577c8fa40c MD5 | raw file
  1. <?php
  2. /**
  3. * @package Joomla.Platform
  4. * @subpackage Facebook
  5. *
  6. * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE
  8. */
  9. defined('JPATH_PLATFORM') or die();
  10. /**
  11. * Facebook API Video class for the Joomla Platform.
  12. *
  13. * @package Joomla.Platform
  14. * @subpackage Facebook
  15. *
  16. * @see http://developers.facebook.com/docs/reference/api/video/
  17. * @since 13.1
  18. */
  19. class JFacebookVideo extends JFacebookObject
  20. {
  21. /**
  22. * Method to get a video. Requires authentication and user_videos or friends_videos permission for private videos.
  23. *
  24. * @param string $video The video id.
  25. *
  26. * @return mixed The decoded JSON response or false if the client is not authenticated.
  27. *
  28. * @since 13.1
  29. */
  30. public function getVideo($video)
  31. {
  32. return $this->get($video);
  33. }
  34. /**
  35. * Method to get a video's comments. Requires authentication and user_videos or friends_videos permission for private videos.
  36. *
  37. * @param string $video The video id.
  38. * @param integer $limit The number of objects per page.
  39. * @param integer $offset The object's number on the page.
  40. * @param string $until A unix timestamp or any date accepted by strtotime.
  41. * @param string $since A unix timestamp or any date accepted by strtotime.
  42. *
  43. * @return mixed The decoded JSON response or false if the client is not authenticated.
  44. *
  45. * @since 13.1
  46. */
  47. public function getComments($video, $limit=0, $offset=0, $until=null, $since=null)
  48. {
  49. return $this->getConnection($video, 'comments', '', $limit, $offset, $until, $since);
  50. }
  51. /**
  52. * Method to comment on a video. Requires authentication and publish_stream permission, user_videos or friends_videos permission for private videos.
  53. *
  54. * @param string $video The video id.
  55. * @param string $message The comment's text.
  56. *
  57. * @return mixed The decoded JSON response or false if the client is not authenticated.
  58. *
  59. * @since 13.1
  60. */
  61. public function createComment($video, $message)
  62. {
  63. // Set POST request parameters.
  64. $data = array();
  65. $data['message'] = $message;
  66. return $this->createConnection($video, 'comments', $data);
  67. }
  68. /**
  69. * Method to delete a comment. Requires authentication and publish_stream permission, user_videos or friends_videos permission for private videos.
  70. *
  71. * @param string $comment The comment's id.
  72. *
  73. * @return boolean Returns true if successful, and false otherwise.
  74. *
  75. * @since 13.1
  76. */
  77. public function deleteComment($comment)
  78. {
  79. return $this->deleteConnection($comment);
  80. }
  81. /**
  82. * Method to get video's likes. Requires authentication and user_videos or friends_videos permission for private videos.
  83. *
  84. * @param string $video The video id.
  85. * @param integer $limit The number of objects per page.
  86. * @param integer $offset The object's number on the page.
  87. * @param string $until A unix timestamp or any date accepted by strtotime.
  88. * @param string $since A unix timestamp or any date accepted by strtotime.
  89. *
  90. * @return mixed The decoded JSON response or false if the client is not authenticated.
  91. *
  92. * @since 13.1
  93. */
  94. public function getLikes($video, $limit=0, $offset=0, $until=null, $since=null)
  95. {
  96. return $this->getConnection($video, 'likes', '', $limit, $offset, $until, $since);
  97. }
  98. /**
  99. * Method to like a video. Requires authentication and publish_stream permission, user_videos or friends_videos permission for private videos.
  100. *
  101. * @param string $video The video id.
  102. *
  103. * @return boolean Returns true if successful, and false otherwise.
  104. *
  105. * @since 13.1
  106. */
  107. public function createLike($video)
  108. {
  109. return $this->createConnection($video, 'likes');
  110. }
  111. /**
  112. * Method to unlike a video. Requires authentication and publish_stream permission, user_videos or friends_videos permission for private videos.
  113. *
  114. * @param string $video The video id.
  115. *
  116. * @return boolean Returns true if successful, and false otherwise.
  117. *
  118. * @since 13.1
  119. */
  120. public function deleteLike($video)
  121. {
  122. return $this->deleteConnection($video, 'likes');
  123. }
  124. /**
  125. * Method to get the album-sized view of the video. Requires authentication and user_videos or friends_videos permission for private photos.
  126. *
  127. * @param string $video The video id.
  128. *
  129. * @return string URL of the picture.
  130. *
  131. * @since 13.1
  132. */
  133. public function getPicture($video)
  134. {
  135. return $this->getConnection($video, 'picture');
  136. }
  137. }