Overview

Packages

  • None
  • Service
    • Facebook

Classes

  • Horde_Service_Facebook_Auth
  • Horde_Service_Facebook_Base
  • Horde_Service_Facebook_BatchRequest
  • Horde_Service_Facebook_ErrorCodes
  • Horde_Service_Facebook_Events
  • Horde_Service_Facebook_Exception
  • Horde_Service_Facebook_Fql
  • Horde_Service_Facebook_Friends
  • Horde_Service_Facebook_Groups
  • Horde_Service_Facebook_Links
  • Horde_Service_Facebook_Notes
  • Horde_Service_Facebook_Notifications
  • Horde_Service_Facebook_Photos
  • Horde_Service_Facebook_Request
  • Horde_Service_Facebook_Streams
  • Horde_Service_Facebook_Translation
  • Horde_Service_Facebook_UploadRequest
  • Horde_Service_Facebook_Users
  • Horde_Service_Facebook_Videos
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Links methods
 4:  *
 5:  * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
 6:  *
 7:  * @author Michael J. Rubinsky <mrubinsk@horde.org>
 8:  * @category Horde
 9:  * @package Service_Facebook
10:  */
11: class Horde_Service_Facebook_Links extends Horde_Service_Facebook_Base
12: {
13:     /**
14:      * Retrieves links posted by the given user.
15:      *
16:      * @param integer    $uid      The user whose links you wish to retrieve
17:      * @param integer    $limit    The maximimum number of links to retrieve
18:      * @param array      $link_ids (Optional) Array of specific link
19:      *                             IDs to retrieve by this user
20:      *
21:      * @return array  An array of links.
22:      */
23:     public function &get($uid, $limit, array $link_ids = null)
24:     {
25:         // Require a session
26:         if (!$skey = $this->_facebook->auth->getSessionKey()) {
27:             throw new Horde_Service_Facebook_Exception(
28:                 'session_key is required',
29:                 Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
30:         }
31:         return $this->_facebook->callMethod(
32:             'links.get',
33:             array('uid' => $uid,
34:                   'limit' => $limit,
35:                   'link_ids' => json_encode($link_ids)));
36:     }
37: 
38:     /**
39:      * Posts a link on Facebook.
40:      *
41:      * @param string  $url     URL/link you wish to post
42:      * @param string  $comment (Optional) A comment about this link
43:      * @param integer $uid     (Optional) User ID that is posting this link;
44:      *                         defaults to current session user
45:      *
46:      * @return boolean
47:      */
48:     public function &post($url, $comment = '', $uid = null)
49:     {
50:         // Require a session
51:         if (!$skey = $this->_facebook->auth->getSessionKey()) {
52:             throw new Horde_Service_Facebook_Exception(
53:                 'session_key is required',
54:                 Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
55:         }
56:         return $this->_facebook->callMethod(
57:             'links.post',
58:             array('uid' => $uid,
59:                   'url' => $url,
60:                   'comment' => $comment));
61:     }
62: 
63: }
API documentation generated by ApiGen