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