Source for file album.php

Documentation is available at album.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 Album class for the Joomla Platform.
  16.  *
  17.  * @package     Joomla.Platform
  18.  * @subpackage  Facebook
  19.  *
  20.  * @see         http://developers.facebook.com/docs/reference/api/album/
  21.  * @since       13.1
  22.  */
  23. {
  24.     /**
  25.      * Method to get an album. Requires authentication and user_photos or friends_photos permission for private photos.
  26.      *
  27.      * @param   string  $album  The album id.
  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 getAlbum($album)
  34.     {
  35.         return $this->get($album);
  36.     }
  37.  
  38.     /**
  39.      * Method to get the photos contained in this album. Requires authentication and user_photos or friends_photos permission for private photos.
  40.      *
  41.      * @param   string   $album   The album id.
  42.      * @param   integer  $limit   The number of objects per page.
  43.      * @param   integer  $offset  The object's number on the page.
  44.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  45.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  46.      *
  47.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  48.      *
  49.      * @since   13.1
  50.      */
  51.     public function getPhotos($album$limit 0$offset 0$until null$since null)
  52.     {
  53.         return $this->getConnection($album'photos'''$limit$offset$until$since);
  54.     }
  55.  
  56.     /**
  57.      * Method to add photos to an album. Note: check can_upload flag first. Requires authentication and publish_stream  permission.
  58.      *
  59.      * @param   string  $album    The album id.
  60.      * @param   string  $source   Path to photo.
  61.      * @param   string  $message  Photo description.
  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 createPhoto($album$source$message null)
  68.     {
  69.         // Set POST request parameters.
  70.         $data array();
  71.         $data[basename($source)'@' realpath($source);
  72.  
  73.         if ($message)
  74.         {
  75.             $data['message'$message;
  76.         }
  77.  
  78.         return $this->createConnection($album'photos'$dataarray('Content-Type' => 'multipart/form-data'));
  79.     }
  80.  
  81.     /**
  82.      * Method to get an album's comments. Requires authentication and user_photos or friends_photos permission for private photos.
  83.      *
  84.      * @param   string   $album   The album id.
  85.      * @param   integer  $limit   The number of objects per page.
  86.      * @param   integer  $offset  The object's number on the page.
  87.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  88.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  89.      *
  90.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  91.      *
  92.      * @since   13.1
  93.      */
  94.     public function getComments($album$limit 0$offset 0$until null$since null)
  95.     {
  96.         return $this->getConnection($album'comments'''$limit$offset$until$since);
  97.     }
  98.  
  99.     /**
  100.      * Method to comment on an album. Requires authentication and publish_stream  permission.
  101.      *
  102.      * @param   string  $album    The album id.
  103.      * @param   string  $message  The comment's text.
  104.      *
  105.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  106.      *
  107.      * @since   13.1
  108.      */
  109.     public function createComment($album$message)
  110.     {
  111.         // Set POST request parameters.
  112.         $data array();
  113.         $data['message'$message;
  114.  
  115.         return $this->createConnection($album'comments'$data);
  116.     }
  117.  
  118.     /**
  119.      * Method to delete a comment. Requires authentication and publish_stream  permission.
  120.      *
  121.      * @param   string  $comment  The comment's id.
  122.      *
  123.      * @return  boolean Returns true if successful, and false otherwise.
  124.      *
  125.      * @since   13.1
  126.      */
  127.     public function deleteComment($comment)
  128.     {
  129.         return $this->deleteConnection($comment);
  130.     }
  131.  
  132.     /**
  133.      * Method to get album's likes. Requires authentication and user_photos or friends_photos permission for private photos.
  134.      *
  135.      * @param   string   $album   The album id.
  136.      * @param   integer  $limit   The number of objects per page.
  137.      * @param   integer  $offset  The object's number on the page.
  138.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  139.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  140.      *
  141.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  142.      *
  143.      * @since   13.1
  144.      */
  145.     public function getLikes($album$limit 0$offset 0$until null$since null)
  146.     {
  147.         return $this->getConnection($album'likes'''$limit$offset$until$since);
  148.     }
  149.  
  150.     /**
  151.      * Method to like an album. Requires authentication and publish_stream  permission.
  152.      *
  153.      * @param   string  $album  The album id.
  154.      *
  155.      * @return  boolean Returns true if successful, and false otherwise.
  156.      *
  157.      * @since   13.1
  158.      */
  159.     public function createLike($album)
  160.     {
  161.         return $this->createConnection($album'likes');
  162.     }
  163.  
  164.     /**
  165.      * Method to unlike an album. Requires authentication and publish_stream  permission.
  166.      *
  167.      * @param   string  $album  The album id.
  168.      *
  169.      * @return  boolean Returns true if successful, and false otherwise.
  170.      *
  171.      * @since   13.1
  172.      */
  173.     public function deleteLike($album)
  174.     {
  175.         return $this->deleteConnection($album'likes');
  176.     }
  177.  
  178.     /**
  179.      * Method to get the album's cover photo, the first picture uploaded to an album becomes the cover photo for the album.
  180.      * Requires authentication and user_photos or friends_photos permission for private photos.
  181.      *
  182.      * @param   string   $album     The album id.
  183.      * @param   boolean  $redirect  If false this will return the URL of the picture without a 302 redirect.
  184.      *
  185.      * @return  string  URL of the picture.
  186.      *
  187.      * @since   13.1
  188.      */
  189.     public function getPicture($album$redirect true)
  190.     {
  191.         $extra_fields '';
  192.  
  193.         if ($redirect == false)
  194.         {
  195.             $extra_fields '?redirect=false';
  196.         }
  197.  
  198.         return $this->getConnection($album'picture'$extra_fields);
  199.     }
  200. }

Documentation generated on Tue, 19 Nov 2013 14:53:41 +0100 by phpDocumentor 1.4.3