Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
checkin.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 Checkin class for the Joomla Platform.
16  *
17  * @package Joomla.Platform
18  * @subpackage Facebook
19  *
20  * @see http://developers.facebook.com/docs/reference/api/checkin/
21  * @since 13.1
22  */
24 {
25  /**
26  * Method to get a checkin. Requires authentication and user_checkins or friends_checkins permission.
27  *
28  * @param string $checkin The checkin 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 getCheckin($checkin)
35  {
36  return $this->get($checkin);
37  }
38 
39  /**
40  * Method to get a checkin's comments. Requires authentication and user_checkins or friends_checkins permission.
41  *
42  * @param string $checkin The checkin id.
43  * @param integer $limit The number of objects per page.
44  * @param integer $offset The object's number on the page.
45  * @param string $until A unix timestamp or any date accepted by strtotime.
46  * @param string $since A unix timestamp or any date accepted by strtotime.
47  *
48  * @return mixed The decoded JSON response or false if the client is not authenticated.
49  *
50  * @since 13.1
51  */
52  public function getComments($checkin, $limit=0, $offset=0, $until=null, $since=null)
53  {
54  return $this->getConnection($checkin, 'comments', '', $limit, $offset, $until, $since);
55  }
56 
57  /**
58  * Method to post a comment to the checkin. Requires authentication and publish_stream and user_checkins or friends_checkins permission.
59  *
60  * @param string $checkin The checkin id.
61  * @param string $message The checkin's text.
62  *
63  * @return mixed The decoded JSON response or false if the client is not authenticated.
64  *
65  * @since 13.1
66  */
67  public function createComment($checkin, $message)
68  {
69  // Set POST request parameters.
70  $data = array();
71  $data['message'] = $message;
72 
73  return $this->createConnection($checkin, 'comments', $data);
74  }
75 
76  /**
77  * Method to delete a comment. Requires authentication and publish_stream permission.
78  *
79  * @param string $comment The comment's id.
80  *
81  * @return mixed The decoded JSON response or false if the client is not authenticated.
82  *
83  * @since 13.1
84  */
85  public function deleteComment($comment)
86  {
87  return $this->deleteConnection($comment);
88  }
89 
90  /**
91  * Method to get a checkin's likes. Requires authentication and user_checkins or friends_checkins permission.
92  *
93  * @param string $checkin The checkin 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($checkin, $limit=0, $offset=0, $until=null, $since=null)
104  {
105  return $this->getConnection($checkin, 'likes', '', $limit, $offset, $until, $since);
106  }
107 
108  /**
109  * Method to like a checkin. Requires authentication and publish_stream and user_checkins or friends_checkins permission.
110  *
111  * @param string $checkin The checkin id.
112  *
113  * @return mixed The decoded JSON response or false if the client is not authenticated.
114  *
115  * @since 13.1
116  */
117  public function createLike($checkin)
118  {
119  return $this->createConnection($checkin, 'likes');
120  }
121 
122  /**
123  * Method to unlike a checkin. Requires authentication and publish_stream permission.
124  *
125  * @param string $checkin The checkin id.
126  *
127  * @return mixed The decoded JSON response or false if the client is not authenticated.
128  *
129  * @since 13.1
130  */
131  public function deleteLike($checkin)
132  {
133  return $this->deleteConnection($checkin, 'likes');
134  }
135 }