PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/libraries/joomla/facebook/link.php

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