Source for file user.php

Documentation is available at user.php

  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 User class for the Joomla Platform.
  16.  *
  17.  * @package     Joomla.Platform
  18.  * @subpackage  Facebook
  19.  *
  20.  * @see         http://developers.facebook.com/docs/reference/api/user/
  21.  * @since       13.1
  22.  */
  23. {
  24.     /**
  25.      * Method to get the specified user's details. Authentication is required only for some fields.
  26.      *
  27.      * @param   mixed  $user  Either an integer containing the user ID or a string containing the username.
  28.      *
  29.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  30.      *
  31.      * @since   13.1
  32.      */
  33.     public function getUser($user)
  34.     {
  35.         return $this->get($user);
  36.     }
  37.  
  38.     /**
  39.      * Method to get the specified user's friends. Requires authentication.
  40.      *
  41.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  42.      * @param   integer  $limit   The number of objects per page.
  43.      * @param   integer  $offset  The object's number on the page.
  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 getFriends($user$limit 0$offset 0)
  50.     {
  51.         return $this->getConnection($user'friends'''$limit$offset);
  52.     }
  53.  
  54.     /**
  55.      * Method to get the user's incoming friend requests. Requires authentication and read_requests permission.
  56.      *
  57.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  58.      * @param   integer  $limit   The number of objects per page.
  59.      * @param   integer  $offset  The object's number on the page.
  60.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  61.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  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 getFriendRequests($user$limit 0$offset 0$until null$since null)
  68.     {
  69.         return $this->getConnection($user'friendrequests'''$limit$offset$until$since);
  70.     }
  71.  
  72.     /**
  73.      * Method to get the user's friend lists. Requires authentication and read_friendlists permission.
  74.      *
  75.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  76.      * @param   integer  $limit   The number of objects per page.
  77.      * @param   integer  $offset  The object's number on the page.
  78.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  79.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  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 getFriendLists($user$limit 0$offset 0$until null$since null)
  86.     {
  87.         return $this->getConnection($user'friendlists'''$limit$offset$until$since);
  88.     }
  89.  
  90.     /**
  91.      * Method to get the user's wall. Requires authentication and read_stream permission.
  92.      *
  93.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  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 getFeed($user$limit 0$offset 0$until null$since null)
  104.     {
  105.         return $this->getConnection($user'feed'''$limit$offset$until$since);
  106.     }
  107.  
  108.     /**
  109.      * Method to get the user's news feed. Requires authentication and read_stream permission.
  110.      *
  111.      * @param   mixed    $user      Either an integer containing the user ID or a string containing the username.
  112.      * @param   string   $filter    User's stream filter.
  113.      * @param   boolean  $location  Retreive only posts with a location attached.
  114.      * @param   integer  $limit     The number of objects per page.
  115.      * @param   integer  $offset    The object's number on the page.
  116.      * @param   string   $until     A unix timestamp or any date accepted by strtotime.
  117.      * @param   string   $since     A unix timestamp or any date accepted by strtotime.
  118.      *
  119.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  120.      *
  121.      * @since   13.1
  122.      */
  123.     public function getHome($user$filter null$location false$limit 0$offset 0$until null$since null)
  124.     {
  125.         $extra_fields '';
  126.  
  127.         if ($filter != null)
  128.         {
  129.             $extra_fields '?filter=' $filter;
  130.         }
  131.  
  132.         if ($location == true)
  133.         {
  134.             $extra_fields .= (strpos($extra_fields'?'=== false'?with=location' '&with=location';
  135.         }
  136.  
  137.         return $this->getConnection($user'home'$extra_fields$limit$offset$until$since);
  138.     }
  139.  
  140.     /**
  141.      * Method to see if a user is a friend of the current user. Requires authentication.
  142.      *
  143.      * @param   mixed  $current_user  Either an integer containing the user ID or a string containing the username for the current user.
  144.      * @param   mixed  $user          Either an integer containing the user ID or a string containing the username for the user.
  145.      *
  146.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  147.      *
  148.      * @since   13.1
  149.      */
  150.     public function hasFriend($current_user$user)
  151.     {
  152.         return $this->getConnection($current_user'friends/' $user);
  153.     }
  154.  
  155.     /**
  156.      * Method to get mutual friends of one user and the current user. Requires authentication.
  157.      *
  158.      * @param   mixed    $current_user  Either an integer containing the user ID or a string containing the username for the current user.
  159.      * @param   mixed    $user          Either an integer containing the user ID or a string containing the username for the user.
  160.      * @param   integer  $limit         The number of objects per page.
  161.      * @param   integer  $offset        The object's number on the page.
  162.      *
  163.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  164.      *
  165.      * @since   13.1
  166.      */
  167.     public function getMutualFriends($current_user$user$limit 0$offset 0)
  168.     {
  169.         return $this->getConnection($current_user'mutualfriends/' $user''$limit$offset);
  170.     }
  171.  
  172.     /**
  173.      * Method to get the user's profile picture. Requires authentication.
  174.      *
  175.      * @param   mixed    $user      Either an integer containing the user ID or a string containing the username.
  176.      * @param   boolean  $redirect  If false this will return the URL of the profile picture without a 302 redirect.
  177.      * @param   string   $type      To request a different photo use square | small | normal | large.
  178.      *
  179.      * @return  string   The URL to the user's profile picture.
  180.      *
  181.      * @since   13.1
  182.      */
  183.     public function getPicture($user$redirect true$type null)
  184.     {
  185.         $extra_fields '';
  186.  
  187.         if ($redirect == false)
  188.         {
  189.             $extra_fields '?redirect=false';
  190.         }
  191.  
  192.         if ($type != null)
  193.         {
  194.             $extra_fields .= (strpos($extra_fields'?'=== false'?type=' $type '&type=' $type;
  195.         }
  196.  
  197.         return $this->getConnection($user'picture'$extra_fields);
  198.     }
  199.  
  200.     /**
  201.      * Method to get the user's family relationships. Requires authentication and user_relationships permission..
  202.      *
  203.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  204.      * @param   integer  $limit   The number of objects per page.
  205.      * @param   integer  $offset  The object's number on the page.
  206.      *
  207.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  208.      *
  209.      * @since   13.1
  210.      */
  211.     public function getFamily($user$limit 0$offset 0)
  212.     {
  213.         return $this->getConnection($user'family'''$limit$offset);
  214.     }
  215.  
  216.     /**
  217.      * Method to get the user's notifications. Requires authentication and manage_notifications permission.
  218.      *
  219.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  220.      * @param   boolean  $read    Enables you to see notifications that the user has already read.
  221.      * @param   integer  $limit   The number of objects per page.
  222.      * @param   integer  $offset  The object's number on the page.
  223.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  224.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  225.      *
  226.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  227.      *
  228.      * @since   13.1
  229.      */
  230.     public function getNotifications($user$read null$limit 0$offset 0$until null$since null)
  231.     {
  232.         if ($read == true)
  233.         {
  234.             $read '?include_read=1';
  235.         }
  236.  
  237.         // Send the request.
  238.         return $this->getConnection($user'notifications'$read$limit$offset$until$since);
  239.     }
  240.  
  241.     /**
  242.      * Method to mark a notification as read. Requires authentication and manage_notifications permission.
  243.      *
  244.      * @param   string  $notification  The notification id.
  245.      *
  246.      * @return  boolean   Returns true if successful, and false otherwise.
  247.      *
  248.      * @since   13.1
  249.      */
  250.     public function updateNotification($notification)
  251.     {
  252.         $data['unread'0;
  253.  
  254.         return $this->createConnection($notificationnull$data);
  255.     }
  256.  
  257.     /**
  258.      * Method to get the user's permissions. Requires authentication.
  259.      *
  260.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  261.      * @param   integer  $limit   The number of objects per page.
  262.      * @param   integer  $offset  The object's number on the page.
  263.      *
  264.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  265.      *
  266.      * @since   13.1
  267.      */
  268.     public function getPermissions($user$limit 0$offset 0)
  269.     {
  270.         return $this->getConnection($user'permissions'''$limit$offset);
  271.     }
  272.  
  273.     /**
  274.      * Method to revoke a specific permission on behalf of a user. Requires authentication.
  275.      *
  276.      * @param   mixed   $user        Either an integer containing the user ID or a string containing the username.
  277.      * @param   string  $permission  The permission to revoke. If none specified, then this will de-authorize the application completely.
  278.      *
  279.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  280.      *
  281.      * @since   13.1
  282.      */
  283.     public function deletePermission($user$permission '')
  284.     {
  285.         return $this->deleteConnection($user'permissions''?permission=' $permission);
  286.     }
  287.  
  288.     /**
  289.      * Method to get the user's albums. Requires authentication and user_photos or friends_photos permission.
  290.      *
  291.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  292.      * @param   integer  $limit   The number of objects per page.
  293.      * @param   integer  $offset  The object's number on the page.
  294.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  295.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  296.      *
  297.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  298.      *
  299.      * @since   13.1
  300.      */
  301.     public function getAlbums($user$limit 0$offset 0$until null$since null)
  302.     {
  303.         return $this->getConnection($user'albums'''$limit$offset$until$since);
  304.     }
  305.  
  306.     /**
  307.      * Method to create an album for a user.  Requires authentication and publish_stream permission.
  308.      *
  309.      * @param   mixed   $user         Either an integer containing the user ID or a string containing the username.
  310.      * @param   string  $name         Album name.
  311.      * @param   string  $description  Album description.
  312.      * @param   json    $privacy      A JSON-encoded object that defines the privacy setting for the album.
  313.      *
  314.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  315.      *
  316.      * @since   13.1
  317.      */
  318.     public function createAlbum($user$name$description null$privacy null)
  319.     {
  320.         // Set POST request parameters.
  321.         $data array();
  322.         $data['name'$name;
  323.         $data['description'$description;
  324.         $data['privacy'$privacy;
  325.  
  326.         return $this->createConnection($user'albums'$data);
  327.     }
  328.  
  329.     /**
  330.      * Method to get the user's checkins. Requires authentication and user_checkins or friends_checkins permission
  331.      *
  332.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  333.      * @param   integer  $limit   The number of objects per page.
  334.      * @param   integer  $offset  The object's number on the page.
  335.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  336.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  337.      *
  338.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  339.      *
  340.      * @since   13.1
  341.      */
  342.     public function getCheckins($user$limit 0$offset 0$until null$since null)
  343.     {
  344.         return $this->getConnection($user'checkins'''$limit$offset$until$since);
  345.     }
  346.  
  347.     /**
  348.      * Method to create a checkin for a user. Requires authentication and publish_checkins permission.
  349.      *
  350.      * @param   mixed   $user         Either an integer containing the user ID or a string containing the username.
  351.      * @param   string  $place        Id of the Place Page.
  352.      * @param   string  $coordinates  A JSON-encoded string containing latitute and longitude.
  353.      * @param   string  $tags         Comma separated list of USER_IDs.
  354.      * @param   string  $message      A message to add to the checkin.
  355.      * @param   string  $link         A link to add to the checkin.
  356.      * @param   string  $picture      A picture to add to the checkin.
  357.      *
  358.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  359.      *
  360.      * @since   13.1
  361.      */
  362.     public function createCheckin($user$place$coordinates$tags null$message null$link null$picture null)
  363.     {
  364.         // Set POST request parameters.
  365.         $data array();
  366.         $data['place'$place;
  367.         $data['coordinates'$coordinates;
  368.         $data['tags'$tags;
  369.         $data['message'$message;
  370.         $data['link'$link;
  371.         $data['picture'$picture;
  372.  
  373.         return $this->createConnection($user'checkins'$data);
  374.     }
  375.  
  376.     /**
  377.      * Method to get the user's likes. Requires authentication and user_likes or friends_likes permission.
  378.      *
  379.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  380.      * @param   integer  $limit   The number of objects per page.
  381.      * @param   integer  $offset  The object's number on the page.
  382.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  383.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  384.      *
  385.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  386.      *
  387.      * @since   13.1
  388.      */
  389.     public function getLikes($user$limit 0$offset 0$until null$since null)
  390.     {
  391.         return $this->getConnection($user'likes'''$limit$offset$until$since);
  392.     }
  393.  
  394.     /**
  395.      * Method to see if a user likes a specific Page. Requires authentication.
  396.      *
  397.      * @param   mixed   $user  Either an integer containing the user ID or a string containing the username.
  398.      * @param   string  $page  Facebook ID of the Page.
  399.      *
  400.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  401.      *
  402.      * @since   13.1
  403.      */
  404.     public function likesPage($user$page)
  405.     {
  406.         return $this->getConnection($user'likes/' $page);
  407.     }
  408.  
  409.     /**
  410.      * Method to get the current user's events. Requires authentication and user_events or friends_events permission.
  411.      *
  412.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  413.      * @param   integer  $limit   The number of objects per page.
  414.      * @param   integer  $offset  The object's number on the page.
  415.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  416.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  417.      *
  418.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  419.      *
  420.      * @since   13.1
  421.      */
  422.     public function getEvents($user$limit 0$offset 0$until null$since null)
  423.     {
  424.         return $this->getConnection($user'events'''$limit$offset$until$since);
  425.     }
  426.  
  427.     /**
  428.      * Method to create an event for a user. Requires authentication create_event permission.
  429.      *
  430.      * @param   mixed   $user          Either an integer containing the user ID or a string containing the username.
  431.      * @param   string  $name          Event name.
  432.      * @param   string  $start_time    Event start time as UNIX timestamp.
  433.      * @param   string  $end_time      Event end time as UNIX timestamp.
  434.      * @param   string  $description   Event description.
  435.      * @param   string  $location      Event location.
  436.      * @param   string  $location_id   Facebook Place ID of the place the Event is taking place.
  437.      * @param   string  $privacy_type  Event privacy setting, a string containing 'OPEN' (default), 'CLOSED', or 'SECRET'.
  438.      *
  439.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  440.      *
  441.      * @since   13.1
  442.      */
  443.     public function createEvent($user$name$start_time$end_time null$description null,
  444.         $location null$location_id null$privacy_type null)
  445.     {
  446.         // Set POST request parameters.
  447.         $data array();
  448.         $data['start_time'$start_time;
  449.         $data['name'$name;
  450.         $data['end_time'$end_time;
  451.         $data['description'$description;
  452.         $data['location'$location;
  453.         $data['location_id'$location_id;
  454.         $data['privacy_type'$privacy_type;
  455.  
  456.         return $this->createConnection($user'events'$data);
  457.     }
  458.  
  459.     /**
  460.      * Method to edit an event. Requires authentication create_event permission.
  461.      *
  462.      * @param   mixed   $event         Event ID.
  463.      * @param   string  $name          Event name.
  464.      * @param   string  $start_time    Event start time as UNIX timestamp.
  465.      * @param   string  $end_time      Event end time as UNIX timestamp.
  466.      * @param   string  $description   Event description.
  467.      * @param   string  $location      Event location.
  468.      * @param   string  $location_id   Facebook Place ID of the place the Event is taking place.
  469.      * @param   string  $privacy_type  Event privacy setting, a string containing 'OPEN' (default), 'CLOSED', or 'SECRET'.
  470.      *
  471.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  472.      *
  473.      * @since   13.1
  474.      */
  475.     public function editEvent($event$name null$start_time null$end_time null$description null,
  476.         $location null$location_id null$privacy_type null)
  477.     {
  478.         // Set POST request parameters.
  479.         $data array();
  480.         $data['start_time'$start_time;
  481.         $data['name'$name;
  482.         $data['end_time'$end_time;
  483.         $data['description'$description;
  484.         $data['location'$location;
  485.         $data['location_id'$location_id;
  486.         $data['privacy_type'$privacy_type;
  487.  
  488.         return $this->createConnection($eventnull$data);
  489.     }
  490.  
  491.     /**
  492.      * Method to delete an event. Note: you can only delete the event if it was created by the same app. Requires authentication create_event permission.
  493.      *
  494.      * @param   string  $event  Event ID.
  495.      *
  496.      * @return  boolean   Returns true if successful, and false otherwise.
  497.      *
  498.      * @since   13.1
  499.      */
  500.     public function deleteEvent($event)
  501.     {
  502.         return $this->deleteConnection($event);
  503.     }
  504.  
  505.     /**
  506.      * Method to get the groups that the user belongs to. Requires authentication and user_groups or friends_groups permission.
  507.      *
  508.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  509.      * @param   integer  $limit   The number of objects per page.
  510.      * @param   integer  $offset  The object's number on the page.
  511.      *
  512.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  513.      *
  514.      * @since   13.1
  515.      */
  516.     public function getGroups($user$limit 0$offset 0)
  517.     {
  518.         return $this->getConnection($user'groups'''$limit$offset);
  519.     }
  520.  
  521.     /**
  522.      * Method to get the user's posted links. Requires authentication and user_groups or friends_groups permission.
  523.      *
  524.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  525.      * @param   integer  $limit   The number of objects per page.
  526.      * @param   integer  $offset  The object's number on the page.
  527.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  528.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  529.      *
  530.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  531.      *
  532.      * @since   13.1
  533.      */
  534.     public function getLinks($user$limit 0$offset 0$until null$since null)
  535.     {
  536.         return $this->getConnection($user'links'''$limit$offset$until$since);
  537.     }
  538.  
  539.     /**
  540.      * Method to post a link on user's feed. Requires authentication and publish_stream permission.
  541.      *
  542.      * @param   mixed   $user     Either an integer containing the user ID or a string containing the username.
  543.      * @param   string  $link     Link URL.
  544.      * @param   strin   $message  Link message.
  545.      *
  546.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  547.      *
  548.      * @since   13.1
  549.      */
  550.     public function createLink($user$link$message null)
  551.     {
  552.         // Set POST request parameters.
  553.         $data array();
  554.         $data['link'$link;
  555.         $data['message'$message;
  556.  
  557.         return $this->createConnection($user'feed'$data);
  558.     }
  559.  
  560.     /**
  561.      * Method to delete a link. Requires authentication and publish_stream permission.
  562.      *
  563.      * @param   mixed  $link  The Link ID.
  564.      *
  565.      * @return  boolean   Returns true if successful, and false otherwise.
  566.      *
  567.      * @since   13.1
  568.      */
  569.     public function deleteLink($link)
  570.     {
  571.         return $this->deleteConnection($link);
  572.     }
  573.  
  574.     /**
  575.      * Method to get the user's notes. Requires authentication and user_groups or friends_groups permission.
  576.      *
  577.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  578.      * @param   integer  $limit   The number of objects per page.
  579.      * @param   integer  $offset  The object's number on the page.
  580.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  581.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  582.      *
  583.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  584.      *
  585.      * @since   13.1
  586.      */
  587.     public function getNotes($user$limit 0$offset 0$until null$since null)
  588.     {
  589.         return $this->getConnection($user'notes'''$limit$offset$until$since);
  590.     }
  591.  
  592.     /**
  593.      * Method to create a note on the behalf of the user.
  594.      * Requires authentication and publish_stream permission, user_groups or friends_groups permission.
  595.      *
  596.      * @param   mixed   $user     Either an integer containing the user ID or a string containing the username.
  597.      * @param   string  $subject  The subject of the note.
  598.      * @param   string  $message  Note content.
  599.      *
  600.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  601.      *
  602.      * @since   13.1
  603.      */
  604.     public function createNote($user$subject$message)
  605.     {
  606.         // Set POST request parameters.
  607.         $data array();
  608.         $data['subject'$subject;
  609.         $data['message'$message;
  610.  
  611.         return $this->createConnection($user'notes'$data);
  612.     }
  613.  
  614.     /**
  615.      * Method to get the user's photos. Requires authentication and user_groups or friends_groups permission.
  616.      *
  617.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  618.      * @param   integer  $limit   The number of objects per page.
  619.      * @param   integer  $offset  The object's number on the page.
  620.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  621.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  622.      *
  623.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  624.      *
  625.      * @since   13.1
  626.      */
  627.     public function getPhotos($user$limit 0$offset 0$until null$since null)
  628.     {
  629.         return $this->getConnection($user'photos'''$limit$offset$until$since);
  630.     }
  631.  
  632.     /**
  633.      * Method to post a photo on user's wall. Requires authentication and publish_stream permission, user_groups or friends_groups permission.
  634.      *
  635.      * @param   mixed    $user      Either an integer containing the user ID or a string containing the username.
  636.      * @param   string   $source    Path to photo.
  637.      * @param   string   $message   Photo description.
  638.      * @param   string   $place     Facebook ID of the place associated with the photo.
  639.      * @param   boolean  $no_story  If set to 1, optionally suppresses the feed story that is automatically
  640.      *                                  generated on a user’s profile when they upload a photo using your application.
  641.      *
  642.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  643.      *
  644.      * @since   13.1
  645.      */
  646.     public function createPhoto($user$source$message null$place null$no_story null)
  647.     {
  648.         // Set POST request parameters.
  649.         $data array();
  650.         $data[basename($source)'@' realpath($source);
  651.         $data['message'$message;
  652.         $data['place'$place;
  653.         $data['no_story'$no_story;
  654.  
  655.         return $this->createConnection($user'photos'$dataarray('Content-Type' => 'multipart/form-data'));
  656.     }
  657.  
  658.     /**
  659.      * Method to get the user's posts. Requires authentication and read_stream permission for non-public posts.
  660.      *
  661.      * @param   mixed    $user      Either an integer containing the user ID or a string containing the username.
  662.      * @param   boolean  $location  Retreive only posts with a location attached.
  663.      * @param   integer  $limit     The number of objects per page.
  664.      * @param   integer  $offset    The object's number on the page.
  665.      * @param   string   $until     A unix timestamp or any date accepted by strtotime.
  666.      * @param   string   $since     A unix timestamp or any date accepted by strtotime.
  667.      *
  668.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  669.      *
  670.      * @since   13.1
  671.      */
  672.     public function getPosts($user$location false$limit 0$offset 0$until null$since null)
  673.     {
  674.         if ($location == true)
  675.         {
  676.             $location '?with=location';
  677.         }
  678.  
  679.         // Send the request.
  680.         return $this->getConnection($user'posts'$location$limit$offset$until$since);
  681.     }
  682.  
  683.     /**
  684.      * Method to post on a user's wall. Message or link parameter is required. Requires authentication and publish_stream permission.
  685.      *
  686.      * @param   mixed   $user               Either an integer containing the user ID or a string containing the username.
  687.      * @param   string  $message            Post message.
  688.      * @param   string  $link               Post URL.
  689.      * @param   string  $picture            Post thumbnail image (can only be used if link is specified)
  690.      * @param   string  $name               Post name (can only be used if link is specified).
  691.      * @param   string  $caption            Post caption (can only be used if link is specified).
  692.      * @param   string  $description        Post description (can only be used if link is specified).
  693.      * @param   array   $actions            Post actions array of objects containing name and link.
  694.      * @param   string  $place              Facebook Page ID of the location associated with this Post.
  695.      * @param   string  $tags               Comma-separated list of Facebook IDs of people tagged in this Post.
  696.      *                                          For example: 1207059,701732. You cannot specify this field without also specifying a place.
  697.      * @param   string  $privacy            Post privacy settings (can only be specified if the Timeline being posted
  698.      *                                          on belongs to the User creating the Post).
  699.      * @param   string  $object_attachment  Facebook ID for an existing picture in the User's photo albums to use as the thumbnail image.
  700.      *                                       The User must be the owner of the photo, and the photo cannot be part of a message attachment.
  701.      *
  702.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  703.      *
  704.      * @since   13.1
  705.      */
  706.     public function createPost($user$message null$link null$picture null$name null$caption null,
  707.         $description null$actions null$place null$tags null$privacy null$object_attachment null)
  708.     {
  709.         // Set POST request parameters.
  710.         $data array();
  711.         $data['message'$message;
  712.         $data['link'$link;
  713.         $data['name'$name;
  714.         $data['caption'$caption;
  715.         $data['description'$description;
  716.         $data['actions'$actions;
  717.         $data['place'$place;
  718.         $data['tags'$tags;
  719.         $data['privacy'$privacy;
  720.         $data['object_attachment'$object_attachment;
  721.         $data['picture'$picture;
  722.  
  723.         return $this->createConnection($user'feed'$data);
  724.     }
  725.  
  726.     /**
  727.      * Method to delete a post. Note: you can only delete the post if it was created by the current user. Requires authentication
  728.      *
  729.      * @param   string  $post  The Post ID.
  730.      *
  731.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  732.      *
  733.      * @since   13.1
  734.      */
  735.     public function deletePost($post)
  736.     {
  737.         return $this->deleteConnection($post);
  738.     }
  739.  
  740.     /**
  741.      * Method to get the user's statuses. Requires authentication read_stream permission.
  742.      *
  743.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  744.      * @param   integer  $limit   The number of objects per page.
  745.      * @param   integer  $offset  The object's number on the page.
  746.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  747.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  748.      *
  749.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  750.      *
  751.      * @since   13.1
  752.      */
  753.     public function getStatuses($user$limit 0$offset 0$until null$since null)
  754.     {
  755.         return $this->getConnection($user'statuses'''$limit$offset$until$since);
  756.     }
  757.  
  758.     /**
  759.      * Method to post a status message on behalf of the user. Requires authentication publish_stream permission.
  760.      *
  761.      * @param   mixed   $user     Either an integer containing the user ID or a string containing the username.
  762.      * @param   string  $message  Status message content.
  763.      *
  764.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  765.      *
  766.      * @since   13.1
  767.      */
  768.     public function createStatus($user$message)
  769.     {
  770.         // Set POST request parameters.
  771.         $data array();
  772.         $data['message'$message;
  773.  
  774.         return $this->createConnection($user'feed'$data);
  775.     }
  776.  
  777.     /**
  778.      * Method to delete a status. Note: you can only delete the post if it was created by the current user.
  779.      * Requires authentication publish_stream permission.
  780.      *
  781.      * @param   string  $status  The Status ID.
  782.      *
  783.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  784.      *
  785.      * @since   13.1
  786.      */
  787.     public function deleteStatus($status)
  788.     {
  789.         return $this->deleteConnection($status);
  790.     }
  791.  
  792.     /**
  793.      * Method to get the videos the user has been tagged in. Requires authentication and user_videos or friends_videos permission.
  794.      *
  795.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  796.      * @param   integer  $limit   The number of objects per page.
  797.      * @param   integer  $offset  The object's number on the page.
  798.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  799.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  800.      *
  801.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  802.      *
  803.      * @since   13.1
  804.      */
  805.     public function getVideos($user$limit 0$offset 0$until null$since null)
  806.     {
  807.         return $this->getConnection($user'videos'''$limit$offset$until$since);
  808.     }
  809.  
  810.     /**
  811.      * Method to post a video on behalf of the user. Requires authentication and publish_stream permission.
  812.      *
  813.      * @param   mixed   $user         Either an integer containing the user ID or a string containing the username.
  814.      * @param   string  $source       Path to video.
  815.      * @param   string  $title        Video title.
  816.      * @param   string  $description  Video description.
  817.      *
  818.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  819.      *
  820.      * @since   13.1
  821.      */
  822.     public function createVideo($user$source$title null$description null)
  823.     {
  824.         // Set POST request parameters.
  825.         $data array();
  826.         $data[basename($source)'@' realpath($source);
  827.         $data['title'$title;
  828.         $data['description'$description;
  829.  
  830.         return $this->createConnection($user'videos'$dataarray('Content-Type' => 'multipart/form-data'));
  831.     }
  832.  
  833.     /**
  834.      * Method to get the posts the user has been tagged in. Requires authentication and user_videos or friends_videos permission.
  835.      *
  836.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  837.      * @param   integer  $limit   The number of objects per page.
  838.      * @param   integer  $offset  The object's number on the page.
  839.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  840.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  841.      *
  842.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  843.      *
  844.      * @since   13.1
  845.      */
  846.     public function getTagged($user$limit 0$offset 0$until null$since null)
  847.     {
  848.         return $this->getConnection($user'tagged'''$limit$offset$until$since);
  849.     }
  850.  
  851.     /**
  852.      * Method to get the activities listed on the user's profile. Requires authentication and user_activities or friends_activities permission.
  853.      *
  854.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  855.      * @param   integer  $limit   The number of objects per page.
  856.      * @param   integer  $offset  The object's number on the page.
  857.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  858.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  859.      *
  860.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  861.      *
  862.      * @since   13.1
  863.      */
  864.     public function getActivities($user$limit 0$offset 0$until null$since null)
  865.     {
  866.         return $this->getConnection($user'activities'''$limit$offset$until$since);
  867.     }
  868.  
  869.     /**
  870.      * Method to get the books listed on the user's profile. Requires authentication and user_likes or friends_likes permission.
  871.      *
  872.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  873.      * @param   integer  $limit   The number of objects per page.
  874.      * @param   integer  $offset  The object's number on the page.
  875.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  876.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  877.      *
  878.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  879.      *
  880.      * @since   13.1
  881.      */
  882.     public function getBooks($user$limit 0$offset 0$until null$since null)
  883.     {
  884.         return $this->getConnection($user'books'''$limit$offset$until$since);
  885.     }
  886.  
  887.     /**
  888.      * Method to get the interests listed on the user's profile. Requires authentication.
  889.      *
  890.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  891.      * @param   integer  $limit   The number of objects per page.
  892.      * @param   integer  $offset  The object's number on the page.
  893.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  894.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  895.      *
  896.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  897.      *
  898.      * @since   13.1
  899.      */
  900.     public function getInterests($user$limit 0$offset 0$until null$since null)
  901.     {
  902.         return $this->getConnection($user'interests'''$limit$offset$until$since);
  903.     }
  904.  
  905.     /**
  906.      * Method to get the movies listed on the user's profile. Requires authentication and user_likes or friends_likes permission.
  907.      *
  908.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  909.      * @param   integer  $limit   The number of objects per page.
  910.      * @param   integer  $offset  The object's number on the page.
  911.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  912.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  913.      *
  914.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  915.      *
  916.      * @since   13.1
  917.      */
  918.     public function getMovies($user$limit 0$offset 0$until null$since null)
  919.     {
  920.         return $this->getConnection($user'movies'''$limit$offset$until$since);
  921.     }
  922.  
  923.     /**
  924.      * Method to get the television listed on the user's profile. Requires authentication and user_likes or friends_likes permission.
  925.      *
  926.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  927.      * @param   integer  $limit   The number of objects per page.
  928.      * @param   integer  $offset  The object's number on the page.
  929.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  930.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  931.      *
  932.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  933.      *
  934.      * @since   13.1
  935.      */
  936.     public function getTelevision($user$limit 0$offset 0$until null$since null)
  937.     {
  938.         return $this->getConnection($user'television'''$limit$offset$until$since);
  939.     }
  940.  
  941.     /**
  942.      * Method to get the music listed on the user's profile. Requires authentication user_likes or friends_likes permission.
  943.      *
  944.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  945.      * @param   integer  $limit   The number of objects per page.
  946.      * @param   integer  $offset  The object's number on the page.
  947.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  948.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  949.      *
  950.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  951.      *
  952.      * @since   13.1
  953.      */
  954.     public function getMusic($user$limit 0$offset 0$until null$since null)
  955.     {
  956.         return $this->getConnection($user'music'''$limit$offset$until$since);
  957.     }
  958.  
  959.     /**
  960.      * Method to get the user's subscribers. Requires authentication and user_subscriptions or friends_subscriptions permission.
  961.      *
  962.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  963.      * @param   integer  $limit   The number of objects per page.
  964.      * @param   integer  $offset  The object's number on the page.
  965.      *
  966.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  967.      *
  968.      * @since   13.1
  969.      */
  970.     public function getSubscribers($user$limit 0$offset 0)
  971.     {
  972.         return $this->getConnection($user'subscribers'''$limit$offset);
  973.     }
  974.  
  975.     /**
  976.      * Method to get the people the user is subscribed to. Requires authentication and user_subscriptions or friends_subscriptions permission.
  977.      *
  978.      * @param   mixed    $user    Either an integer containing the user ID or a string containing the username.
  979.      * @param   integer  $limit   The number of objects per page.
  980.      * @param   integer  $offset  The object's number on the page.
  981.      *
  982.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  983.      *
  984.      * @since   13.1
  985.      */
  986.     public function getSubscribedTo($user$limit 0$offset 0)
  987.     {
  988.         return $this->getConnection($user'subscribedto'''$limit$offset);
  989.     }
  990. }

Documentation generated on Tue, 19 Nov 2013 15:16:32 +0100 by phpDocumentor 1.4.3