Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
post.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 Post class for the Joomla Platform.
16  *
17  * @package Joomla.Platform
18  * @subpackage Facebook
19  *
20  * @see http://developers.facebook.com/docs/reference/api/post/
21  * @since 13.1
22  */
24 {
25  /**
26  * Method to get a post. Requires authentication and read_stream permission for all data.
27  *
28  * @param string $post The post 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 getPost($post)
35  {
36  return $this->get($post);
37  }
38 
39  /**
40  * Method to delete a post if it was created by this application. Requires authentication and publish_stream permission
41  *
42  * @param string $post The post id.
43  *
44  * @return boolean Returns true if successful, and false otherwise.
45  *
46  * @since 13.1
47  */
48  public function deletePost($post)
49  {
50  return $this->deleteConnection($post);
51  }
52 
53  /**
54  * Method to get a post's comments. Requires authentication and read_stream permission.
55  *
56  * @param string $post The post 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($post, $limit = 0, $offset = 0, $until = null, $since = null)
67  {
68  return $this->getConnection($post, 'comments', '', $limit, $offset, $until, $since);
69  }
70 
71  /**
72  * Method to comment on a post. Requires authentication and publish_stream permission
73  *
74  * @param string $post The post 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($post, $message)
82  {
83  // Set POST request parameters.
84  $data['message'] = $message;
85 
86  return $this->createConnection($post, 'comments', $data);
87  }
88 
89  /**
90  * Method to delete a comment. Requires authentication and publish_stream permission
91  *
92  * @param string $comment The comment's id.
93  *
94  * @return boolean Returns true if successful, and false otherwise.
95  *
96  * @since 13.1
97  */
98  public function deleteComment($comment)
99  {
100  return $this->deleteConnection($comment);
101  }
102 
103  /**
104  * Method to get post's likes. Requires authentication and read_stream permission.
105  *
106  * @param string $post The post id.
107  * @param integer $limit The number of objects per page.
108  * @param integer $offset The object's number on the page.
109  * @param string $until A unix timestamp or any date accepted by strtotime.
110  * @param string $since A unix timestamp or any date accepted by strtotime.
111  *
112  * @return mixed The decoded JSON response or false if the client is not authenticated.
113  *
114  * @since 13.1
115  */
116  public function getLikes($post, $limit = 0, $offset = 0, $until = null, $since = null)
117  {
118  return $this->getConnection($post, 'likes', '', $limit, $offset, $until, $since);
119  }
120 
121  /**
122  * Method to like a post. Requires authentication and publish_stream permission
123  *
124  * @param string $post The post id.
125  *
126  * @return boolean Returns true if successful, and false otherwise.
127  *
128  * @since 13.1
129  */
130  public function createLike($post)
131  {
132  return $this->createConnection($post, 'likes');
133  }
134 
135  /**
136  * Method to unlike a post. Requires authentication and publish_stream permission
137  *
138  * @param string $post The post id.
139  *
140  * @return boolean Returns true if successful, and false otherwise.
141  *
142  * @since 13.1
143  */
144  public function deleteLike($post)
145  {
146  return $this->deleteConnection($post, 'likes');
147  }
148 }