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 Link class for the Joomla Platform.
14 *
15 * @link http://developers.facebook.com/docs/reference/api/link/
16 * @since 13.1
17 * @deprecated 4.0 Use the `joomla/facebook` package via Composer instead
18 */
19 class JFacebookLink extends JFacebookObject
20 {
21 /**
22 * Method to get a link. Requires authentication and read_stream permission for non-public links.
23 *
24 * @param string $link The link 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 getLink($link)
31 {
32 return $this->get($link);
33 }
34
35 /**
36 * Method to get a link's comments. Requires authentication and read_stream permission for non-public links.
37 *
38 * @param string $link The link id.
39 * @param integer $limit The number of objects per page.
40 * @param integer $offset The object's number on the page.
41 * @param string $until A unix timestamp or any date accepted by strtotime.
42 * @param string $since A unix timestamp or any date accepted by strtotime.
43 *
44 * @return mixed The decoded JSON response or false if the client is not authenticated.
45 *
46 * @since 13.1
47 */
48 public function getComments($link, $limit = 0, $offset = 0, $until = null, $since = null)
49 {
50 return $this->getConnection($link, 'comments', '', $limit, $offset, $until, $since);
51 }
52
53 /**
54 * Method to comment on a link. Requires authentication and publish_stream permission.
55 *
56 * @param string $link The link id.
57 * @param string $message The comment's text.
58 *
59 * @return mixed The decoded JSON response or false if the client is not authenticated.
60 *
61 * @since 13.1
62 */
63 public function createComment($link, $message)
64 {
65 // Set POST request parameters.
66 $data = array();
67 $data['message'] = $message;
68
69 return $this->createConnection($link, 'comments', $data);
70 }
71
72 /**
73 * Method to delete a comment. Requires authentication and publish_stream permission.
74 *
75 * @param string $comment The comment's id.
76 *
77 * @return mixed The decoded JSON response or false if the client is not authenticated.
78 *
79 * @since 13.1
80 */
81 public function deleteComment($comment)
82 {
83 return $this->deleteConnection($comment);
84 }
85
86 /**
87 * Method to get link's likes. Requires authentication and read_stream permission for non-public links.
88 *
89 * @param string $link The link 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($link, $limit = 0, $offset = 0, $until = null, $since = null)
100 {
101 return $this->getConnection($link, 'likes', '', $limit, $offset, $until, $since);
102 }
103
104 /**
105 * Method to like a link. Requires authentication and publish_stream permission.
106 *
107 * @param string $link The link id.
108 *
109 * @return boolean Returns true if successful, and false otherwise.
110 *
111 * @since 13.1
112 */
113 public function createLike($link)
114 {
115 return $this->createConnection($link, 'likes');
116 }
117
118 /**
119 * Method to unlike a link. Requires authentication and publish_stream permission.
120 *
121 * @param string $link The link id.
122 *
123 * @return boolean Returns true if successful, and false otherwise.
124 *
125 * @since 13.1
126 */
127 public function deleteLike($link)
128 {
129 return $this->deleteConnection($link, 'likes');
130 }
131 }
132