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