Source for file photo.php

Documentation is available at photo.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 Photo class for the Joomla Platform.
  16.  *
  17.  * @package     Joomla.Platform
  18.  * @subpackage  Facebook
  19.  *
  20.  * @see         http://developers.facebook.com/docs/reference/api/photo/
  21.  * @since       13.1
  22.  */
  23. {
  24.     /**
  25.      * Method to get a photo. Requires authentication and user_photos or friends_photos permission for private photos.
  26.      *
  27.      * @param   string  $photo  The photo 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 getPhoto($photo)
  34.     {
  35.         return $this->get($photo);
  36.     }
  37.  
  38.     /**
  39.      * Method to get a photo's comments. Requires authentication and user_photos or friends_photos permission for private photos.
  40.      *
  41.      * @param   string   $photo   The photo 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 getComments($photo$limit 0$offset 0$until null$since null)
  52.     {
  53.         return $this->getConnection($photo'comments'''$limit$offset$until$since);
  54.     }
  55.  
  56.     /**
  57.      * Method to comment on a photo. Requires authentication and publish_stream permission, user_photos or friends_photos permission for private photos.
  58.      *
  59.      * @param   string  $photo    The photo id.
  60.      * @param   string  $message  The comment's text.
  61.      *
  62.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  63.      *
  64.      * @since   13.1
  65.      */
  66.     public function createComment($photo$message)
  67.     {
  68.         // Set POST request parameters.
  69.         $data['message'$message;
  70.  
  71.         return $this->createConnection($photo'comments'$data);
  72.     }
  73.  
  74.     /**
  75.      * Method to delete a comment. Requires authentication and publish_stream permission, user_photos or friends_photos permission for private photos.
  76.      *
  77.      * @param   string  $comment  The comment's id.
  78.      *
  79.      * @return  boolean Returns true if successful, and false otherwise.
  80.      *
  81.      * @since   13.1
  82.      */
  83.     public function deleteComment($comment)
  84.     {
  85.         return $this->deleteConnection($comment);
  86.     }
  87.  
  88.     /**
  89.      * Method to get photo's likes. Requires authentication and user_photos or friends_photos permission for private photos.
  90.      *
  91.      * @param   string   $photo   The photo id.
  92.      * @param   integer  $limit   The number of objects per page.
  93.      * @param   integer  $offset  The object's number on the page.
  94.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  95.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  96.      *
  97.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  98.      *
  99.      * @since   13.1
  100.      */
  101.     public function getLikes($photo$limit 0$offset 0$until null$since null)
  102.     {
  103.         return $this->getConnection($photo'likes'''$limit$offset$until$since);
  104.     }
  105.  
  106.     /**
  107.      * Method to like a photo. Requires authentication and publish_stream permission, user_photos or friends_photos permission for private photos.
  108.      *
  109.      * @param   string  $photo  The photo id.
  110.      *
  111.      * @return  boolean Returns true if successful, and false otherwise.
  112.      *
  113.      * @since   13.1
  114.      */
  115.     public function createLike($photo)
  116.     {
  117.         return $this->createConnection($photo'likes');
  118.     }
  119.  
  120.     /**
  121.      * Method to unlike a photo. Requires authentication and publish_stream permission, user_photos or friends_photos permission for private photos.
  122.      *
  123.      * @param   string  $photo  The photo id.
  124.      *
  125.      * @return  boolean Returns true if successful, and false otherwise.
  126.      *
  127.      * @since   13.1
  128.      */
  129.     public function deleteLike($photo)
  130.     {
  131.         return $this->deleteConnection($photo'likes');
  132.     }
  133.  
  134.     /**
  135.      * Method to get the Users tagged in the photo. Requires authentication and user_photos or friends_photos permission for private photos.
  136.      *
  137.      * @param   string   $photo   The photo id.
  138.      * @param   integer  $limit   The number of objects per page.
  139.      * @param   integer  $offset  The object's number on the page.
  140.      * @param   string   $until   A unix timestamp or any date accepted by strtotime.
  141.      * @param   string   $since   A unix timestamp or any date accepted by strtotime.
  142.      *
  143.      * @return  mixed   The decoded JSON response or false if the client is not authenticated.
  144.      *
  145.      * @since   13.1
  146.      */
  147.     public function getTags($photo$limit 0$offset 0$until null$since null)
  148.     {
  149.         return $this->getConnection($photo'tags'''$limit$offset$until$since);
  150.     }
  151.  
  152.     /**
  153.      * Method to tag one or more Users in a photo. $to or $tag_text required.
  154.      * Requires authentication and publish_stream permission, user_photos permission for private photos.
  155.      *
  156.      * @param   string   $photo     The photo id.
  157.      * @param   mixed    $to        ID of the User or an array of Users to tag in the photo: [{"id":"1234"}, {"id":"12345"}].
  158.      * @param   string   $tag_text  A text string to tag.
  159.      * @param   integer  $x         x coordinate of tag, as a percentage offset from the left edge of the picture.
  160.      * @param   integer  $y         y coordinate of tag, as a percentage offset from the top edge of the picture.
  161.      *
  162.      * @return  boolean Returns true if successful, and false otherwise.
  163.      *
  164.      * @since   13.1
  165.      */
  166.     public function createTag($photo$to null$tag_text null$x null$y null)
  167.     {
  168.         // Set POST request parameters.
  169.         if (is_array($to))
  170.         {
  171.             $data['tags'$to;
  172.         }
  173.         else
  174.         {
  175.             $data['to'$to;
  176.         }
  177.  
  178.         if ($tag_text)
  179.         {
  180.             $data['tag_text'$tag_text;
  181.         }
  182.  
  183.         if ($x)
  184.         {
  185.             $data['x'$x;
  186.         }
  187.  
  188.         if ($y)
  189.         {
  190.             $data['y'$y;
  191.         }
  192.  
  193.         return $this->createConnection($photo'tags'$data);
  194.     }
  195.  
  196.     /**
  197.      * Method to update the position of the tag for a particular Users in a photo.
  198.      * Requires authentication and publish_stream permission, user_photos permission for private photos.
  199.      *
  200.      * @param   string   $photo  The photo id.
  201.      * @param   string   $to     ID of the User to update tag in the photo.
  202.      * @param   integer  $x      x coordinate of tag, as a percentage offset from the left edge of the picture.
  203.      * @param   integer  $y      y coordinate of tag, as a percentage offset from the top edge of the picture.
  204.      *
  205.      * @return  boolean Returns true if successful, and false otherwise.
  206.      *
  207.      * @since   13.1
  208.      */
  209.     public function updateTag($photo$to$x null$y null)
  210.     {
  211.         // Set POST request parameters.
  212.         $data['to'$to;
  213.  
  214.         if ($x)
  215.         {
  216.             $data['x'$x;
  217.         }
  218.  
  219.         if ($y)
  220.         {
  221.             $data['y'$y;
  222.         }
  223.  
  224.         return $this->createConnection($photo'tags'$data);
  225.     }
  226.  
  227.     /**
  228.      * Method to get the album-sized view of the photo. Requires authentication and user_photos or friends_photos permission for private photos.
  229.      *
  230.      * @param   string   $photo     The photo id.
  231.      * @param   boolean  $redirect  If false this will return the URL of the picture without a 302 redirect.
  232.      *
  233.      * @return  string  URL of the picture.
  234.      *
  235.      * @since   13.1
  236.      */
  237.     public function getPicture($photo$redirect true)
  238.     {
  239.         $extra_fields '';
  240.  
  241.         if ($redirect == false)
  242.         {
  243.             $extra_fields '?redirect=false';
  244.         }
  245.  
  246.         return $this->getConnection($photo'picture'$extra_fields);
  247.     }
  248. }

Documentation generated on Tue, 19 Nov 2013 15:10:30 +0100 by phpDocumentor 1.4.3