Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
note.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 Note class for the Joomla Platform.
16  *
17  * @package Joomla.Platform
18  * @subpackage Facebook
19  *
20  * @see http://developers.facebook.com/docs/reference/api/note/
21  * @since 13.1
22  */
24 {
25  /**
26  * Method to get a note. Requires authentication and user_notes or friends_notes permission for non-public notes.
27  *
28  * @param string $note The note 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 getNote($note)
35  {
36  return $this->get($note);
37  }
38 
39  /**
40  * Method to get a note's comments. Requires authentication and user_notes or friends_notes permission for non-public notes.
41  *
42  * @param string $note The note 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($note, $limit = 0, $offset = 0, $until = null, $since = null)
53  {
54  return $this->getConnection($note, 'comments', '', $limit, $offset, $until, $since);
55  }
56 
57  /**
58  * Method to comment on a note. Requires authentication and publish_stream and user_notes or friends_notes permissions.
59  *
60  * @param string $note The note id.
61  * @param string $message The comment'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($note, $message)
68  {
69  // Set POST request parameters.
70  $data = array();
71  $data['message'] = $message;
72 
73  return $this->createConnection($note, 'comments', $data);
74  }
75 
76  /**
77  * Method to delete a comment. Requires authentication and publish_stream and user_notes or friends_notes permissions.
78  *
79  * @param string $comment The comment's id.
80  *
81  * @return boolean Returns true if successful, and false otherwise.
82  *
83  * @since 13.1
84  */
85  public function deleteComment($comment)
86  {
87  return $this->deleteConnection($comment);
88  }
89 
90  /**
91  * Method to get note's likes. Requires authentication and user_notes or friends_notes for non-public notes.
92  *
93  * @param string $note The note 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($note, $limit = 0, $offset = 0, $until = null, $since = null)
104  {
105  return $this->getConnection($note, 'likes', '', $limit, $offset, $until, $since);
106  }
107 
108  /**
109  * Method to like a note. Requires authentication and publish_stream and user_notes or friends_notes permissions.
110  *
111  * @param string $note The note id.
112  *
113  * @return boolean Returns true if successful, and false otherwise.
114  *
115  * @since 13.1
116  */
117  public function createLike($note)
118  {
119  return $this->createConnection($note, 'likes');
120  }
121 
122  /**
123  * Method to unlike a note. Requires authentication and publish_stream and user_notes or friends_notes permissions.
124  *
125  * @param string $note The note id.
126  *
127  * @return boolean Returns true if successful, and false otherwise.
128  *
129  * @since 13.1
130  */
131  public function deleteLike($note)
132  {
133  return $this->deleteConnection($note, 'likes');
134  }
135 }