Source for file Flickr.php

Documentation is available at Flickr.php

  1. <?php
  2.     /**
  3.      * 
  4.      * SWX Flickr API by Aral Balkan. Uses the phpFlickr library. You can call this API using SWX, Amfphp, JSON and XML-RPC.
  5.      * 
  6.      * @author    Aral Balkan
  7.      * @copyright    2007 Aral Balkan. All Rights Reserved.
  8.      * @link     http://aralbalkan.com
  9.      * @link     http://swxformat.org
  10.      * @link    mailto://aral@aralbalkan.com
  11.      * 
  12.     ***/
  13.     
  14.     require_once("../lib/phpFlickr/phpFlickr.php");
  15.  
  16.     class Flickr
  17.     {
  18.         var $API_KEY = "e7efb59164979981686e62d8bcc473be";
  19.         var $SHARED_SECRET = "2be064bed40b0b78";
  20.         var $api;    // phpFlickr class instance
  21.     
  22.             
  23.         function Flickr()
  24.         {
  25.             global $flickr;
  26.             
  27.             // I'm putting my (Aral's) Flickr API key here so you guys
  28.             // can get up and running with this quickly. Please don't
  29.             // abuse this. If you're going to build your own apps 
  30.             // using the SWX Flickr API, please add your API here instead. 
  31.             // Thanks! :)
  32.             $this->api = new phpFlickr($this->API_KEY$this->SHARED_SECRET);
  33.         }
  34.     
  35.         /**
  36.          * Returns the requested number of photos for the specified user.
  37.          * 
  38.          * @param    Flickr user name
  39.          * @param     Style of photo as string (square, thumbnail, small, medium, large, original)
  40.          * @param    Number of photos to receive
  41.          *
  42.          * @return void 
  43.          * @author Aral Balkan
  44.          ***/
  45.         function getUserPhotos($userName$photoStyle "medium"$numPhotos = 10$page = 1)
  46.         {
  47.             $i = 0;
  48.             if (!empty($userName)) 
  49.             {
  50.                 // Find the NSID of the username inputted via the form.
  51.                 $person $this->api->people_findByUsername($userName);
  52.             
  53.                 // Flickr Error?
  54.                 if ($person === false
  55.                 {
  56.                     return $this->_getResult($person);
  57.                 }
  58.             
  59.                 // Get the friendly URL of the user's photos.
  60.                 $photos_url $this->api->urls_getUserPhotos($person['id']);
  61.             
  62.                 // Flickr Error?
  63.                 if ($photos_url === false)
  64.                 {
  65.                     return $this->_getResult($photos_url);
  66.                 }
  67.  
  68.                 // Get $numPhotos of the user's public photos, starting at page $page.
  69.                 $photos $this->api->people_getPublicPhotos($person['id']NULL$numPhotos$page);
  70.  
  71.                 // Flickr Error?
  72.                 if ($photos === false)
  73.                 {
  74.                     return $this->_getResult($photos);
  75.                 }
  76.  
  77.                 // Build the results
  78.                 $photoList = array();
  79.                 
  80.                 // Loop through the photos and output the html
  81.                 foreach ((array)$photos['photo'as $photo
  82.                 {
  83.                     $newPhoto = array
  84.                     (    
  85.                         'link' =>  $photos_url.$photo['id'],
  86.                         'alt' => $photo['title'],
  87.                         'src' => $this->api->buildPhotoURL($photo$photoStyle)
  88.                     );
  89.                     
  90.                     array_push($photoList$newPhoto);
  91.                 }
  92.             }
  93.             
  94.             return $photoList;
  95.         }
  96.         
  97.         
  98.         //
  99.         // Activity methods.
  100.         //
  101.         
  102.                 
  103.         /**
  104.          * Returns a list of recent activity on photos commented on by the calling user.
  105.          * Do not poll this method more than once an hour.
  106.          *
  107.          * Official Flickr API documentation:
  108.          * http://www.flickr.com/services/api/flickr.activity.userComments.html
  109.          * 
  110.          * Requires read authentication.
  111.          * 
  112.          * @param (str)    The auth token that was returned by authGetToken().
  113.          * @param (int, optional) Number of items to return per page. If this argument is omitted, it defaults to 10. The maximum allowed value is 50.
  114.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  115.          * 
  116.          * @return List of recent activity on photos commented on by the calling user.
  117.          * @author Aral Balkan
  118.          ***/
  119.         function activityUserComments($token$perPage = NULL$page = NULL)
  120.         {
  121.             $this->api->setToken($token);
  122.             $activityComments $this->api->activity_userComments($perPage$page = NULL);
  123.             
  124.             return $this->_getResult($activityComments);
  125.         }
  126.         
  127.         
  128.         /**
  129.          * Returns a list of recent activity on photos belonging to the calling user.
  130.          * Do not poll this method more than once an hour.
  131.          *
  132.          * Official Flickr API documentation:
  133.          * http://www.flickr.com/services/api/flickr.activity.userPhotos.html
  134.          * 
  135.          * Requires read authentication.
  136.          * 
  137.          * @param (str)    The auth token that was returned by authGetToken().
  138.          * @param (str, optional) The timeframe in which to return updates for. This can be specified in days ('2d') or hours ('4h'). The default behavoir is to return changes since the beginning of the previous user session.
  139.          * @param (int, optional) Number of items to return per page. If this argument is omitted, it defaults to 10. The maximum allowed value is 50.
  140.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  141.          * 
  142.          * @return List of recent activity on photos belonging to the calling user.
  143.          * @author Aral Balkan
  144.          ***/
  145.         function activityUserPhotos ($token$timeframe = NULL$perPage = NULL$page = NULL)
  146.         {
  147.             $this->api->setToken($token);
  148.             $activityPhotos $this->api->activity_userPhotos ($timeframe$perPage$page);
  149.             
  150.             return $this->_getResult($activityPhotos);
  151.         }
  152.         
  153.         //
  154.         // Authentication methods. 
  155.         // (Uses the authentication process for desktop applications.)
  156.         //
  157.     
  158.     
  159.             
  160.     
  161.         /**
  162.          * Returns a frob to be used during authentication.
  163.          * 
  164.          * To authenticate a user using the SWX Flickr API:
  165.          * 
  166.          * 1. First call this method and get the magic frob value.
  167.          * 2. Call the authGetUrl() method and pass the frob as well as the type of authentication you want ("read", "write", "delete"). This will return a URL.
  168.          * 3. Send the user to the URL returned in Step 2. Flickr will ask them to authorize your application. Once they've done that, they'll return to your application.
  169.          * 4. Call the authGetToken() method and pass the frob. If the user granted your application the correct permissions, you should get a token back. Send this token for all authenticated calls.
  170.          * 
  171.          * Official Flickr API documentation:
  172.          * http://www.flickr.com/services/api/flickr.auth.getFrob.html
  173.          * 
  174.          * Original Flickr authorization spec:
  175.          * http://www.flickr.com/services/api/auth.spec.html
  176.          * 
  177.          * Flickr Desktop Applications How-To:
  178.          * http://www.flickr.com/services/api/auth.howto.desktop.html
  179.          *
  180.          * @return (str) Frob.
  181.          * @author Aral Balkan
  182.          ***/
  183.         function authGetFrob()
  184.         {
  185.             $frob $this->api->auth_getFrob();
  186.             return $this->_getResult($frob);
  187.         }
  188.  
  189.  
  190.         /**
  191.          * Returns the authentication url to redirect the user to so
  192.          * they can log in and authorize the Flash application. (This
  193.          * uses the authentication mechanism for desktop applications, which
  194.          * is the one that works best for Flash applications).
  195.          * 
  196.          * For a full explanation of the authorization system in the
  197.          * SWX Flickr API, see the notes on the authGetFrob() method.
  198.          * 
  199.          * @param (str) The frob that was returned by the authGetFrob() method.
  200.          * @param (str, optional) The permissions being requested ("read"|"write"|"delete"). Write includes read, and delete includes both read and write permissions. Defaults to read.
  201.          *
  202.          * @return (str) URL to send user to so they can authorize the application.
  203.          * @author Aral Balkan
  204.          ***/
  205.         function authGetUrl ($frob$perms="read")
  206.         {
  207.             // Calculate the desktop auth url.
  208.             $api_sig md5($this->SHARED_SECRET . 'api_key' $this->API_KEY . 'frob' $frob 'perms' $perms);
  209.             $desktopAuthUrl 'http://www.flickr.com/services/auth/?api_key=' $this->API_KEY . '&perms=' $perms '&frob=' $frob '&api_sig='$api_sig;
  210.  
  211.             // And return it.
  212.             return $this->_getResult($desktopAuthUrl);        
  213.         }
  214.         
  215.  
  216.         /**
  217.          * Returns the token you need to make authenticated calls if the user has authenticated
  218.          * your application.
  219.          * 
  220.          * For a full explanation of the authorization system in the
  221.          * SWX Flickr API, see the notes on the authGetFrob() method.
  222.          * 
  223.          * Official Flickr API documentation:
  224.          * http://www.flickr.com/services/api/flickr.auth.getToken.html
  225.          * 
  226.          * @param (str)    The frob that was returned by the authGetFrob() method.
  227.          *
  228.          * @return (str) Flickr auth token.
  229.           * @author Aral Balkan
  230.          ***/
  231.         function authGetToken($frob)
  232.         {
  233.             $token $this->api->auth_getToken($frob);
  234.             return $this->_getResult($token);
  235.         }
  236.         
  237.         
  238.         //        
  239.         // Blog methods
  240.         //
  241.         
  242.         
  243.                 
  244.         
  245.         /**
  246.          * Get a list of configured blogs for the calling user.
  247.          * 
  248.          * Official Flickr API documentation:
  249.          * http://www.flickr.com/services/api/flickr.blogs.getList.html
  250.          * 
  251.          * Requires read authentication.
  252.          * 
  253.          * @param (str)    The auth token that was returned by authGetToken().
  254.          *
  255.          * @return List of blogs for the calling user.
  256.          * @author Aral Balkan
  257.          ***/
  258.         function blogsGetList($token)
  259.         {
  260.             $this->api->setToken($token);
  261.             $blogList $this->api->blogs_getList();
  262.             
  263.             return $this->_getResult($blogList);
  264.         }
  265.  
  266.         
  267.         /**
  268.          * Posts a photo to the blog with the passed id.
  269.          * 
  270.          * Official Flickr API documentation:
  271.          * http://www.flickr.com/services/api/flickr.blogs.postPhoto.html
  272.          * 
  273.          * Requires write authentication
  274.          * 
  275.          * @param (str)    The auth token that was returned by authGetToken().
  276.          * @param (str)    The id of the blog to post to.
  277.          * @param (str)    The id of the photo to blog.
  278.          * @param (str)    The blog post title.
  279.          * @param (str)    The blog post body.
  280.          * @param (str)    The password for the blog (used when the blog does not have a stored password).
  281.          *
  282.          * @return (bool) True/False depending on whether the call succeeded or failed.
  283.          * @author Aral Balkan
  284.          ***/
  285.         function blogsPostPhoto($token$blogId$photoId$title$description$blogPassword = NULL)
  286.         {
  287.             $this->api->setToken($token);
  288.             $success $this->api->blogs_postPhoto($blogId$photoId$title$description$blogPassword);
  289.             
  290.             return $this->_getResult($success);
  291.         }
  292.  
  293.  
  294.         //
  295.         // Contacts methods
  296.         //
  297.  
  298.         
  299.         
  300.         
  301.         /**
  302.          * Get a list of contacts for the calling user.
  303.          * 
  304.          * Valid values for the filter parameter, below, are:
  305.          * 
  306.          * friends: Only contacts who are friends (and not family).
  307.          * family: Only contacts who are family (and not friends).
  308.          * both: Only contacts who are both friends and family.
  309.          * neither: Only contacts who are neither friends nor family.
  310.          * 
  311.          * Official Flickr API documentation:
  312.          * http://www.flickr.com/services/api/flickr.contacts.getList.html
  313.          *
  314.          * Requires read authentication.
  315.          * 
  316.          * @param (str) The auth token that was returned by authGetToken().
  317.          * @param (str, optional) An optional filter of the results.
  318.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  319.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 1000. The maximum allowed value is 1000.
  320.          * 
  321.          * @return List of contacts or false on error.
  322.          * @author Aral Balkan
  323.          ***/
  324.         function contactsGetList($token$filter = NULL$page = NULL$per_page = NULL)
  325.         {
  326.             $this->api->setToken($token);
  327.             
  328.             error_log("page = $page, perpage = $per_page");
  329.             
  330.             $contacts $this->api->contacts_getList($filter$page$per_page);
  331.             
  332.             return $this->_getResult($contacts);
  333.         }
  334.         
  335.         
  336.         /**
  337.          * Get the contact list for a user.
  338.          * 
  339.          * Official Flickr API documentation:
  340.          * http://www.flickr.com/services/api/flickr.contacts.getPublicList.html
  341.          *
  342.          * Does not require authentication.
  343.          * 
  344.          * @param (str) The NSID of the user to fetch the contact list for.
  345.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  346.          * @param (int, optional) Number of contacts to return per page. If this argument is omitted, it defaults to 1000. The maximum allowed value is 1000.
  347.          * 
  348.          * @return List of contacts for the user.
  349.          * @author Aral Balkan
  350.          ***/
  351.         function contactsGetPublicList($userId$page = NULL$perPage = NULL)
  352.         {
  353.             $publicList $this->api->contacts_getPublicList($userId$page$perPage);
  354.             
  355.             return $this->_getResult($publicList);
  356.         }
  357.         
  358.         
  359.         //
  360.         // Favorites methods
  361.         //
  362.         
  363.         
  364.                 
  365.         
  366.         /**
  367.          * Returns a list of the user's favorite photos.
  368.          * Only photos which the calling user has permission to see are returned.
  369.          * 
  370.          * Official Flickr API documentation:
  371.           * http://www.flickr.com/services/api/flickr.favorites.getList.html
  372.          * 
  373.          * Requires read authentication.
  374.          * 
  375.          * @param (str) The auth token that was returned by authGetToken().
  376.          * @param (str, optional) The NSID of the user to fetch the favorites list for. If this argument is omitted, the favorites list for the calling user is returned.
  377.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  378.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  379.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  380.          * 
  381.          * @return List of user's favorite photos.
  382.          * @author Aral Balkan
  383.          ***/
  384.         function favoritesGetList($token$userId = NULL$extras = NULL$perPage = NULL$page = NULL)
  385.         {
  386.             $this->api->setToken($token);
  387.             $favorites $this->api->favorites_getList($userId$extras$perPage$page);
  388.             
  389.             return $this->_getResult($favorites);
  390.         }
  391.         
  392.         
  393.         /**
  394.          * Returns a list of favorite public photos for the given user.
  395.          * 
  396.          * Official Flickr API documentation:
  397.          * http://www.flickr.com/services/api/flickr.favorites.getPublicList.html
  398.          * 
  399.          * Does not require authentication.
  400.          * 
  401.          * @param (str) The user to fetch the favorites list for.
  402.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  403.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  404.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  405.          *
  406.          * @return List of favorite public photos for the given user.
  407.          * @author Aral Balkan
  408.          ***/
  409.         function favoritesGetPublicList($userId$extras = NULL$perPage = NULL$page = NULL)
  410.         {
  411.             $publicList $this->api->favorites_getPublicList($userId$extras$perPage$page);
  412.             
  413.             return $this->_getResult($publicList);
  414.         }
  415.         
  416.         
  417.         /**
  418.          * Adds a photo to a user's favorites list.
  419.          * 
  420.          * Official Flickr API documentation:
  421.          * http://www.flickr.com/services/api/flickr.favorites.add.html
  422.          * 
  423.          * Requires write authentication and a POST request.
  424.          * 
  425.          * @param (str) The auth token that was returned by authGetToken().
  426.          * @param (str) The id of the photo to add to the user's favorites.
  427.          *
  428.          * @return True/False depending on whether call was successful.
  429.          * @author Aral Balkan
  430.          ***/
  431.         function favoritesAdd ($token$photoId)
  432.         {
  433.             $this->api->setToken($token);
  434.             $success $this->api->favorites_add ($photoId);
  435.             
  436.             return $this->_getResult($success);
  437.         }
  438.         
  439.         
  440.         /**
  441.          * Removes a photo from a user's favorites list.
  442.          * 
  443.          * Official Flickr API documentation:
  444.          * http://www.flickr.com/services/api/flickr.favorites.remove.html
  445.          *
  446.          * Requires write authentication and a POST request.
  447.          * 
  448.          * @param (str) The auth token that was returned by authGetToken().
  449.          * @param (str) The id of the photo to remove from the user's favorites.
  450.          *
  451.          * @return True/False depending on whether call was successful.
  452.          * @author Aral Balkan
  453.          ***/
  454.         function favoritesRemove($token$photoId)
  455.         {
  456.             $this->api->setToken($token);
  457.             $success $this->api->favorites_remove($photoId);
  458.             
  459.             return $this->_getResult($success);
  460.         }
  461.         
  462.         
  463.         //
  464.         // Groups methods
  465.         //
  466.         
  467.         
  468.                 
  469.         
  470.         /**
  471.          * Browse the group category tree, finding groups and sub-categories.
  472.          * 
  473.          * Official Flickr API documentation:
  474.          * http://www.flickr.com/services/api/flickr.groups.browse.html
  475.          * 
  476.          * Requires read authentication.
  477.          * 
  478.          * @param (str) The auth token that was returned by authGetToken().
  479.          * @param (str, optional) The category id to fetch a list of groups and sub-categories for. If not specified, it defaults to zero, the root of the category tree.
  480.          *
  481.          * @return Category information.
  482.          * @author Aral Balkan
  483.          ***/
  484.         function groupsBrowse($token$catId = NULL)
  485.         {
  486.             $this->api->setToken($token);
  487.             $groups $this->api->groups_browse($catId);
  488.             
  489.             return $this->_getResult($groups);
  490.         }
  491.         
  492.         
  493.         /**
  494.          * Search for groups.
  495.          * 18+ groups will only be returned for authenticated calls where the authenticated user is over 18.
  496.          * 
  497.          * Official Flickr API documentation:
  498.          * http://www.flickr.com/services/api/flickr.groups.search.html
  499.          * 
  500.          * Does not require authentication unless you also want to receive 18+ groups.
  501.          * 
  502.          * @param (str)    Text to search for.
  503.          * @param (int)    Number of groups to return per page. If this argument is ommited, it defaults to 100. The maximum allowed value is 500.
  504.          * @param (int)    The page of results to return. If this argument is ommited, it defaults to 1.
  505.          * @param (str; optional) The auth token that was returned by authGetToken(). Only required to receive 18+ groups.
  506.          *
  507.          * @return List of groups matching the search.
  508.          * @author Aral Balkan
  509.          ***/
  510.         function groupsSearch($text$perPage = NULL$page = NULL$token = NULL)
  511.         {
  512.             if ($token != NULL)
  513.             {
  514.                 $this->api->setToken($token);
  515.             }
  516.             $groups $this->api->groups_search($text$perPage$page);
  517.             
  518.             return $this->_getResult($groups);
  519.         }
  520.         
  521.         
  522.         /**
  523.          * Get information about a group.
  524.          * 
  525.          * Official Flickr API documentation:
  526.          * http://www.flickr.com/services/api/flickr.groups.getInfo.html
  527.          * 
  528.          * Does not require authentication.
  529.          * 
  530.          * @param (str)    The NSID of the group to fetch information for.
  531.          *
  532.          * @return Information on requested group.
  533.          * @author Aral Balkan
  534.          ***/
  535.         function groupsGetInfo($groupId)
  536.         {
  537.             $groupInfo $this->api->groups_getInfo($groupId);
  538.             
  539.             return $this->_getResult($groupInfo);
  540.         }
  541.         
  542.         
  543.         //
  544.         // Groups pools methods
  545.         //
  546.         
  547.         
  548.                 
  549.         
  550.         /**
  551.          * Add a photo to a group's pool.
  552.          * 
  553.          * Official Flickr API documentation:
  554.          * http://www.flickr.com/services/api/flickr.groups.pools.add.html
  555.          * 
  556.          * Requires write authentication.
  557.          *
  558.          * @param (str) The auth token that was returned by authGetToken().
  559.          * @param (str)    The id of the photo to add to the group pool. The photo must belong to the calling user.
  560.          * @param (str)    The NSID of the group who's pool the photo is to be added to.
  561.          * 
  562.          * @return True/False depending on whether call was successful.
  563.          * @author Aral Balkan
  564.          ***/
  565.         function groupsPoolAdd ($token$photoId$groupId)
  566.         {
  567.             $this->api->setToken($token);
  568.             $success $this->api->groups_pools_add ($photoId$groupId);
  569.             
  570.             return $this->_getResult($success);
  571.         }
  572.         
  573.         
  574.         /**
  575.          * Returns next and previous photos for a photo in a group pool.
  576.          * 
  577.          * Official Flickr API documentation:
  578.          * http://www.flickr.com/services/api/flickr.groups.pools.getContext.html
  579.          * 
  580.          * Does not require authentication.
  581.          * 
  582.          * @param (str) The id of the photo to fetch the context for.
  583.          * @param (str) The nsid of the group who's pool to fetch the photo's context for.
  584.          *
  585.          * @return The next and previous photos for requested photo, in the requested group.
  586.          * @author Aral Balkan
  587.          ***/
  588.         function groupsPoolsGetContext($photoId$groupId)
  589.         {
  590.             $context $this->api->groups_pools_getContext ($photoId$groupId);
  591.             
  592.             return $this->_getResult($context);
  593.         }
  594.         
  595.  
  596.         /**
  597.          * Returns a list of groups to which you can add photos.
  598.          * 
  599.          * Official Flickr API documentation:
  600.          * http://www.flickr.com/services/api/flickr.groups.pools.getGroups.html
  601.          * 
  602.          * Requires read authentication.
  603.          *
  604.          * @param (str) The auth token that was returned by authGetToken().
  605.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  606.          * @param (int, optional) Number of groups to return per page. If this argument is omitted, it defaults to 400. The maximum allowed value is 400.
  607.          * 
  608.          * @return List of groups to which you can add photos.
  609.          * @author Aral Balkan
  610.          ***/
  611.         function groupsPoolsGetGroups ($token$page = NULL$perPage = NULL)
  612.         {
  613.             $this->api->setToken($token);
  614.             $groups $this->api->groups_pools_getGroups ($page$perPage);
  615.             
  616.             return $this->_getResult($groups);
  617.         }
  618.         
  619.         
  620.         /**
  621.          * Returns a list of pool photos for a given group,
  622.          * based on the permissions of the group and the user logged in (if any).
  623.          * 
  624.          * Official Flickr API documentation:
  625.          * http://www.flickr.com/services/api/flickr.groups.pools.getPhotos.html
  626.          * 
  627.          * Does not require authentication.
  628.          * 
  629.          * @param (str) The id of the group who's pool you which to get the photo list for.
  630.          * @param (str, optional) A tag to filter the pool with. At the moment only one tag at a time is supported.
  631.          * @param (str, optional) The nsid of a user. Specifiying this parameter will retrieve for you only those photos that the user has contributed to the group pool.
  632.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  633.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  634.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  635.          *
  636.          * @return List of pool photos for a given group.
  637.          * @author Aral Balkan
  638.          ***/
  639.         function groupsPoolsGetPhotos($groupId$tags = NULL$userId = NULL$extras = NULL$perPage = NULL$page = NULL)
  640.         {
  641.             $photos $this->api->groups_pools_getPhotos ($groupId$tags$userId$extras$perPage$page);
  642.             
  643.             return $this->_getResult($photos);
  644.         }
  645.         
  646.         
  647.         /**
  648.          * Remove a photo from a group pool.
  649.          * 
  650.          * Official Flickr API documentation:
  651.          * http://www.flickr.com/services/api/flickr.groups.pools.remove.html
  652.          * 
  653.          * Requires write authentication.
  654.          * 
  655.          * @param (str) The auth token that was returned by authGetToken().
  656.          * @param (str) The id of the photo to remove from the group pool. The photo must either be owned by the calling user of the calling user must be an administrator of the group.
  657.          * @param (str) The NSID of the group who's pool the photo is to removed from.
  658.          *
  659.          * @return True/Error obj depending on whether call was successful.
  660.          * @author Aral Balkan
  661.          ***/
  662.         function groupsPoolsRemove($token$photoId$groupId)
  663.         {
  664.             $this->api->setToken($token);
  665.             $success $this->api->groups_pools_remove ($photoId$groupId);
  666.             
  667.             return $this->_getResult($success);
  668.         }
  669.         
  670.         
  671.         //
  672.         // Interestingness methods
  673.         //
  674.         
  675.                 
  676.         /**
  677.          * Returns the list of interesting photos for the most recent day or a user-specified date.
  678.          * 
  679.          * Official Flickr API documentation:
  680.          * http://www.flickr.com/services/api/flickr.interestingness.getList.html
  681.          * 
  682.          * Does not require authentication.
  683.          * 
  684.          * @param (str, optional) A specific date, formatted as YYYY-MM-DD, to return interesting photos for.
  685.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  686.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  687.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  688.          *
  689.          * @return List of interesting photos for the most recent day or a user-specified date.
  690.          * @author Aral Balkan
  691.          ***/
  692.         function interestingnessGetList($date = NULL$extras = NULL$perPage = NULL$page = NULL)
  693.         {
  694.             $photos $this->api->interestingness_getList($date$extras$perPage$page);
  695.             
  696.             return $this->_getResult($photos);
  697.         }
  698.         
  699.         //
  700.         // People methods
  701.         //
  702.         
  703.                 
  704.         /**
  705.          * Return a user's NSID, given their email address
  706.          * 
  707.          * Official Flickr API documentation:
  708.          * http://www.flickr.com/services/api/flickr.people.findByEmail.html
  709.          * 
  710.          * Does not require authentication.
  711.          * 
  712.          * @param (str) The email address of the user to find (may be primary or secondary).
  713.          * 
  714.          * @return User's NSID.
  715.          * @author Aral Balkan
  716.          ***/
  717.         function peopleFindByEmail($findEmail)
  718.         {
  719.             $nsid $this->api->people_findByEmail($findEmail);
  720.             
  721.             return $this->_getResult($nsid);
  722.         }
  723.         
  724.         
  725.         /**
  726.          * Return a user's NSID, given their username.
  727.          * 
  728.          * Official Flickr API documentation:
  729.          * http://www.flickr.com/services/api/flickr.people.findByUsername.html
  730.          * 
  731.          * Does not require authentication.
  732.          * 
  733.          * @param (str) The username of the user to lookup.
  734.          *
  735.          * @return User's NSID.
  736.          * @author Aral Balkan
  737.          ***/
  738.         function peopleFindByUsername($userName)
  739.         {
  740.             $nsid $this->api->people_findByUsername($userName);
  741.             
  742.             return $this->_getResult($nsid);
  743.         }
  744.         
  745.         
  746.         /**
  747.          * Get information about a user.
  748.          * 
  749.          * Official Flickr API documentation:
  750.          * http://www.flickr.com/services/api/flickr.people.getInfo.html
  751.          *
  752.          * Does not require authentication but will return additional information
  753.          * if authenticated.
  754.          * 
  755.          * @param (str) The NSID of the user to fetch information about.
  756.          * @param (str, optional) The auth token that was returned by authGetToken().
  757.          * 
  758.          * @return User info.
  759.          * @author Aral Balkan
  760.          ***/
  761.         function peopleGetInfo($userId$token = NULL)
  762.         {
  763.             if ($token != NULL)
  764.             {
  765.                 $this->api->setToken($token);
  766.             }
  767.             
  768.             $userInfo $this->api->people_getInfo($userId);
  769.             
  770.             return $this->_getResult($userInfo);
  771.         }
  772.         
  773.         
  774.         /**
  775.          * Returns the list of public groups a user is a member of.
  776.          * 
  777.          * Official Flickr API documentation:
  778.          * http://www.flickr.com/services/api/flickr.people.getPublicGroups.html
  779.          * 
  780.          * Does not require authentication.
  781.          * 
  782.          * @param (str) The NSID of the user to fetch groups for.
  783.          *
  784.          * @return List of public groups a user is a member of.
  785.          * @author Aral Balkan
  786.          ***/
  787.         function peopleGetPublicGroups($userId)
  788.         {    
  789.             $publicGroups $this->api->people_getPublicGroups($userId);
  790.             
  791.             return $this->_getResult($publicGroups);
  792.         }
  793.  
  794.         
  795.         /**
  796.          * Get a list of public photos for the given user.
  797.          * 
  798.          * Official Flickr API documentation:
  799.          * http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html
  800.          * 
  801.          * Does not require authentication.
  802.          *
  803.          * @param (str) The NSID of the user who's photos to return.
  804.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  805.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  806.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  807.          * 
  808.          * @return List of public photos for the given user.
  809.          * @author Aral Balkan
  810.          ***/
  811.         function peopleGetPublicPhotos($userId$extra = NULL$perPage = NULL$page = NULL)
  812.         {
  813.             $publicPhotos $this->api->people_getPublicPhotos($userId$extras$perPage$page);
  814.             
  815.             return $this->_getResult($publicPhotos);
  816.         }
  817.         
  818.         
  819.         /**
  820.          * Returns information for the calling user related to photo uploads.
  821.          * 
  822.          * Official Flickr API documentation:
  823.          * http://www.flickr.com/services/api/flickr.people.getUploadStatus.html
  824.          * 
  825.          * Requires read authentication.
  826.          *
  827.          * @param (str) The auth token that was returned by authGetToken().
  828.          * 
  829.          * @return Information for the calling user related to photo uploads.
  830.          * @author Aral Balkan
  831.          ***/
  832.         function peopleGetUploadStatus($token)
  833.         {
  834.             $this->api->setToken($token);
  835.             $uploadStatus $this->api->people_getUploadStatus();
  836.         
  837.             return $this->_getResult($uploadStatus);
  838.         }
  839.         
  840.         
  841.         //
  842.         // Photos methods
  843.         //
  844.         
  845.         
  846.                 
  847.         
  848.         /**
  849.          * Add tags to a photo.
  850.          * 
  851.          * Official Flickr API documentation:
  852.          * http://www.flickr.com/services/api/flickr.photos.addTags.html
  853.          * 
  854.          * Requires write authentication.
  855.          * 
  856.          * @param (str) The auth token that was returned by authGetToken().
  857.          * @param (str) The id of the photo to add tags to.
  858.          * @param (str) The tags to add to the photo.
  859.          *
  860.          * @return True/False depending on result of the call.
  861.          * @author Aral Balkan
  862.          ***/
  863.         function photosAddTags($token$photoId$tags)
  864.         {
  865.             $this->api->setToken($token);
  866.             
  867.             $success $this->api->photos_addTags ($photoId$tags);
  868.             
  869.             return $this->_getResult($success);
  870.         }
  871.         
  872.         
  873.         /**
  874.          * Delete a photo from flickr.
  875.          * 
  876.          * Official Flickr API documentation:
  877.          * http://www.flickr.com/services/api/flickr.photos.delete.html
  878.          * 
  879.          * This method requires delete authentication.
  880.          * 
  881.          * @param (str) The auth token that was returned by authGetToken().
  882.          * @param (str) The id of the photo to delete.
  883.          *
  884.          * @return True/False depending on result of the call.
  885.          * @author Aral Balkan
  886.          ***/
  887.         function photosDelete($token$photoId)
  888.         {
  889.             $this->api->setToken($token);
  890.             
  891.             $success $this->api->photos_delete($photoId);
  892.             
  893.             return $this->_getResult($success);
  894.         }
  895.  
  896.  
  897.         /**
  898.          * Returns all visible sets and pools the photo belongs to.
  899.          * 
  900.          * Official Flickr API documentation:
  901.          * http://www.flickr.com/services/api/flickr.photos.getAllContexts.html
  902.          * 
  903.          * Does not require authentication.
  904.          * 
  905.          * @param (str) The photo to return information for.
  906.          *
  907.          * @return All visible sets and pools the photo belongs to.
  908.          * @author Aral Balkan
  909.          ***/
  910.         function photosGetAllContexts($photoId)
  911.         {
  912.             $contexts $this->api->photos_getAllContexts($photoId);
  913.             
  914.             return $this->_getResult($contexts);
  915.         }
  916.         
  917.         
  918.         /**
  919.          * Fetch a list of recent photos from the calling users' contacts.
  920.          * 
  921.          * Official Flickr API documentation:
  922.          * http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html
  923.          *
  924.          * Requires read authentication.
  925.          * 
  926.          * @param (str) The auth token that was returned by authGetToken().
  927.          * @param (int, optional) Number of photos to return. Defaults to 10, maximum 50. This is only used if single_photo is not passed.
  928.          * @param (int, optional) Set as 1 to only show photos from friends and family (excluding regular contacts).
  929.          * @param (?, optional) Only fetch one photo (the latest) per contact, instead of all photos in chronological order.
  930.          * @param (int, optional) Set to 1 to include photos from the calling user.
  931.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update.
  932.          * 
  933.          * @return List of recent photos from the calling users' contacts.
  934.          * @author Aral Balkan
  935.          ***/
  936.         function photosGetContactsPhotos($token$count = NULL$justFriends = NULL$singlePhoto = NULL$includeSelf = NULL$extras = NULL)
  937.         {
  938.             $this->api->setToken($token);
  939.             
  940.             $contactsPhotos $this->api->photos_getContactsPhotos($count$justFriends$singlePhoto$includeSelf$extras);
  941.             
  942.             return $this->_getResult($contactsPhotos);
  943.         }
  944.         
  945.         
  946.         /**
  947.          * Fetch a list of recent public photos from a users' contacts.
  948.          * 
  949.          * Official Flickr API documentation:
  950.          * http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html
  951.          * 
  952.          * @param (str) The NSID of the user to fetch photos for.
  953.          * @param (int, optional) Number of photos to return. Defaults to 10, maximum 50. This is only used if single_photo is not passed.
  954.          * @param (int, optional) Set as 1 to only show photos from friends and family (excluding regular contacts).
  955.          * @param (?, optional) Only fetch one photo (the latest) per contact, instead of all photos in chronological order.
  956.          * @param (int, optional) Set to 1 to include photos from the calling user.
  957.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update.
  958.          *
  959.          * @return List of recent public photos from a users' contacts.
  960.          * @author Aral Balkan
  961.          ***/
  962.         function photosGetContactsPublicPhotos($userId$count = NULL$justFriends = NULL$singlePhoto = NULL$includeSelf = NULL$extras = NULL)
  963.         {
  964.             $contactsPublicPhotos $this->api->photos_getContactsPublicPhotos($userId$count$justFriends$singlePhoto$includeSelf$extras);
  965.             
  966.             return $this->_getResult($contactsPublicPhotos);
  967.         }
  968.         
  969.         
  970.         /**
  971.          * Returns next and previous photos for a photo in a photostream.
  972.          * 
  973.          * Official Flickr API documentation:
  974.          * http://www.flickr.com/services/api/flickr.photos.getContext.html
  975.          *
  976.          * Does not require authentication.
  977.          * 
  978.          * @param (str) The id of the photo to fetch the context for.
  979.          * 
  980.          * @return Next and previous photos for a photo in a photostream.
  981.          * @author Aral Balkan
  982.          ***/
  983.         function photosGetContext($photoId)
  984.         {
  985.             $context $this->api->photos_getContext ($photoId);
  986.             
  987.             return $this->_getResult($context);
  988.         }
  989.         
  990.         
  991.         /**
  992.          * Gets a list of photo counts for the given date ranges for the calling user.
  993.          * 
  994.          * Official Flickr API documentation:
  995.          * http://www.flickr.com/services/api/flickr.photos.getCounts.html
  996.          * 
  997.          * Requires read authentication.
  998.          * 
  999.          * @param (str) The auth token that was returned by authGetToken().
  1000.          * @param (str, optional) A comma delimited list of unix timestamps, denoting the periods to return counts for. They should be specified smallest first. You must specify either this or takenDates.
  1001.          * @param (str, optional) A comma delimited list of mysql datetimes, denoting the periods to return counts for. They should be specified smallest first. You must specify either this or dates.
  1002.          * 
  1003.          * @return List of photo counts for the given date ranges for the calling user.
  1004.          * @author Aral Balkan
  1005.          ***/
  1006.         function photosGetCounts($token$dates = NULL$takenDates = NULL)
  1007.         {
  1008.             $this->api->setToken($token);
  1009.             $counts $this->api->photos_getCounts($dates$takenDates);
  1010.             
  1011.             return $this->_getResult($counts);
  1012.         }
  1013.         
  1014.         
  1015.         /**
  1016.          * Retrieves a list of EXIF/TIFF/GPS tags for a given photo.
  1017.          * The calling user must have permission to view the photo.
  1018.          * 
  1019.          * Official Flickr API documentation:
  1020.          * http://www.flickr.com/services/api/flickr.photos.getExif.html
  1021.          *
  1022.          * Does not require authentication.
  1023.          * 
  1024.          * @param (str) The id of the photo to fetch information for.
  1025.          * @param (str, optional) The secret for the photo. If the correct secret is passed then permissions checking is skipped. This enables the 'sharing' of individual photos by passing around the id and secret.
  1026.          * 
  1027.          * @return List of EXIF/TIFF/GPS tags for a given photo.
  1028.          * @author Aral Balkan
  1029.          ***/
  1030.         function photosGetExif($photoId$secret = NULL)
  1031.         {
  1032.             $exif $this->api->photos_getExif ($photoId$secret);
  1033.             
  1034.             return $this->_getResult($exif);
  1035.         }
  1036.         
  1037.         
  1038.         /**
  1039.          * Returns the list of people who have favorited a given photo.
  1040.          * 
  1041.          * Official Flickr API documentation:
  1042.          * http://www.flickr.com/services/api/flickr.photos.getFavorites.html
  1043.          * 
  1044.          * Does not require authentication.
  1045.          * 
  1046.          * @param (str) The ID of the photo to fetch the favoriters list for.
  1047.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  1048.          * @param (int, optional) Number of usres to return per page. If this argument is omitted, it defaults to 10. The maximum allowed value is 50.
  1049.          *
  1050.          * @return List of people who have favorited a given photo.
  1051.          * @author Aral Balkan
  1052.          ***/
  1053.         function photosGetFavorites($photoId$page = NULL$perPage = NULL)
  1054.         {
  1055.             $favorites $this->api->photos_getFavorites($photoId$page$perPage);
  1056.             
  1057.             return $this->_getResult($favorites);
  1058.         }
  1059.         
  1060.         
  1061.         /**
  1062.          * Get information about a photo.
  1063.          * The calling user must have permission to view the photo.
  1064.          * 
  1065.          * Official Flickr API documentation:
  1066.          * http://www.flickr.com/services/api/flickr.photos.getInfo.html
  1067.          * 
  1068.          * @param (str) The id of the photo to get information for.
  1069.          * @param (str, optional) The secret for the photo. If the correct secret is passed then permissions checking is skipped. This enables the 'sharing' of individual photos by passing around the id and secret.
  1070.          *
  1071.          * @return Information about a photo.
  1072.          * @author Aral Balkan
  1073.          ***/
  1074.         function photosGetInfo($photoId$secret = NULL)
  1075.         {
  1076.             $info $this->api->photos_getInfo($photoId$secret = NULL);
  1077.             
  1078.             return $this->_getResult($info);
  1079.         }
  1080.         
  1081.         
  1082.         /**
  1083.          * Returns a list of your photos that are not part of any sets.
  1084.          * 
  1085.          * Official Flickr API documentation:
  1086.          * http://www.flickr.com/services/api/flickr.photos.getNotInSet.html
  1087.          * 
  1088.          * Requires read authentication.
  1089.          * 
  1090.          * @param (str) The auth token that was returned by authGetToken().
  1091.          * @param (str, optional) Minimum upload date. Photos with an upload date greater than or equal to this value will be returned. The date should be in the form of a unix timestamp.
  1092.          * @param (str, optional) Maximum upload date. Photos with an upload date less than or equal to this value will be returned. The date should be in the form of a unix timestamp.
  1093.          * @param (str, optional) Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. The date should be in the form of a mysql datetime.
  1094.          * @param (str, optional) Maximum taken date. Photos with an taken date less than or equal to this value will be returned. The date should be in the form of a mysql datetime.
  1095.          * @param (int, optional) Return photos only matching a certain privacy level. Valid values are: 1 public photos,    2 private photos visible to friends, 3 private photos visible to family, 4 private photos visible to friends & family, 5 completely private photos
  1096.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  1097.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  1098.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  1099.          *
  1100.          * @return List of your photos that are not part of any sets.
  1101.          * @author Aral Balkan
  1102.          ***/
  1103.         function photosGetNotInSet($token$minUploadDate = NULL$maxUploadDate = NULL$minTakenDate = NULL$maxTakenDate = NULL$privacyFilter = NULL$extras = NULL$perPage = NULL$page = NULL)
  1104.         {
  1105.             $this->api->setToken($token);
  1106.             $photosNotInSet $this->api->photos_getNotInSet($minUploadDate$maxUploadDate$minTakenDate$maxTakenDate$privacyFilter$extras$perPage$page);
  1107.             
  1108.             return $this->_getResult($photosNotInSet);
  1109.         }
  1110.         
  1111.         
  1112.         /**
  1113.          * Get permissions for a photo.
  1114.          * 
  1115.          * Official Flickr API documentation:
  1116.          * http://www.flickr.com/services/api/flickr.photos.getPerms.html
  1117.          *
  1118.          * Requires read authentication.
  1119.          * 
  1120.          * @param (str) The auth token that was returned by authGetToken().
  1121.          * @param (str) The id of the photo to get permissions for.
  1122.          * 
  1123.          * @return Permissions for a photo.
  1124.          * @author Aral Balkan
  1125.          ***/
  1126.         function photosGetPerms($token$photoId)
  1127.         {
  1128.             $this->api->setToken($token);
  1129.             
  1130.             $perms $this->api->photos_getPerms($photoId);
  1131.             
  1132.             return $this->_getResult($perms);
  1133.         }
  1134.         
  1135.         
  1136.         /**
  1137.          * Returns a list of the latest public photos uploaded to flickr.
  1138.          * 
  1139.          * Official Flickr API documentation:
  1140.          * http://www.flickr.com/services/api/flickr.photos.getRecent.html
  1141.          * 
  1142.          * Does not require authentication.
  1143.          * 
  1144.          * @param (str, optional) comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  1145.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  1146.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  1147.          *
  1148.          * @return List of the latest public photos uploaded to flickr.
  1149.          * @author Aral Balkan
  1150.          ***/
  1151.         function photosGetRecent($extras = NULL$perPage = NULL$page = NULL)
  1152.         {
  1153.             $recentPhotos $this->api->photos_getRecent($extras$perPage$page);
  1154.             
  1155.             return $this->_getResult($recentPhotos);
  1156.         }
  1157.         
  1158.         
  1159.         /**
  1160.          * Returns the available sizes for a photo.
  1161.          * The calling user must have permission to view the photo.
  1162.          * 
  1163.          * Official Flickr API documentation:
  1164.          * http://www.flickr.com/services/api/flickr.photos.getSizes.html
  1165.          * 
  1166.          * Does not require authentication.
  1167.          * 
  1168.          * @param (str) The id of the photo to fetch size information for.
  1169.          *
  1170.          * @return The available sizes for a photo.
  1171.          * @author Aral Balkan
  1172.          ***/
  1173.         function photosGetSizes($photoId)
  1174.         {
  1175.             $sizes $this->api->photos_getSizes($photoId);
  1176.         
  1177.             return $this->_getResult($sizes);        
  1178.         }
  1179.         
  1180.         
  1181.         /**
  1182.          * Returns a list of your photos with no tags.
  1183.          * 
  1184.          * Official Flickr API documentation:
  1185.          * http://www.flickr.com/services/api/flickr.photos.getUntagged.html
  1186.          * 
  1187.          * Requires read authentication.
  1188.          * 
  1189.          * @param (str) The auth token that was returned by authGetToken().
  1190.          * @param (str, optional) Minimum upload date. Photos with an upload date greater than or equal to this value will be returned. The date should be in the form of a unix timestamp.
  1191.          * @param (str, optional) Maximum upload date. Photos with an upload date less than or equal to this value will be returned. The date should be in the form of a unix timestamp.
  1192.          * @param (str, optional) Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. The date should be in the form of a mysql datetime.
  1193.          * @param (str, optional) Maximum taken date. Photos with an taken date less than or equal to this value will be returned. The date should be in the form of a mysql datetime.
  1194.          * @param (int, optional) Return photos only matching a certain privacy level. Valid values are: 1 public photos, 2 private photos visible to friends,    3 private photos visible to family, 4 private photos visible to friends & family,    5 completely private photos
  1195.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  1196.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  1197.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  1198.          *
  1199.          * @return List of your photos with no tags.
  1200.          * @author Aral Balkan
  1201.          ***/
  1202.         function photosGetUntagged($token$minUploadDate = NULL$maxUploadDate = NULL$minTakenDate = NULL$maxTakenDate = NULL$privacyFilter = NULL$extras = NULL$perPage = NULL$page = NULL)
  1203.         {
  1204.             $this->api->setToken($token);
  1205.             $untagged $this->api->photos_getUntagged($minUploadDate$maxUploadDate$minTakenDate$maxTakenDate$privacyFilter$extras$perPage$page);
  1206.             
  1207.             return $this->_getResult($untagged);
  1208.         }
  1209.         
  1210.         
  1211.         /**
  1212.          * Returns a list of your geo-tagged photos.
  1213.          * 
  1214.          * Official Flickr API documentation:
  1215.          * http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html
  1216.          * 
  1217.          * Requires read authentication.
  1218.          *
  1219.          * @param (str) The auth token that was returned by authGetToken().
  1220.          * @param (str, optional) Minimum upload date. Photos with an upload date greater than or equal to this value will be returned. The date should be in the form of a unix timestamp.
  1221.          * @param (str, optional) Maximum upload date. Photos with an upload date less than or equal to this value will be returned. The date should be in the form of a unix timestamp.
  1222.          * @param (str, optional) Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. The date should be in the form of a mysql datetime.
  1223.          * @param (str, optional) Maximum taken date. Photos with an taken date less than or equal to this value will be returned. The date should be in the form of a mysql datetime.
  1224.          * @param (int, optional) Return photos only matching a certain privacy level. Valid values are: 1 public photos, 2 private photos visible to friends,    3 private photos visible to family, 4 private photos visible to friends & family,    5 completely private photos
  1225.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  1226.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  1227.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  1228.          * 
  1229.          * @return List of your geo-tagged photos.
  1230.          * @author Aral Balkan
  1231.          ***/
  1232.         function photosGetWithGeoData($token$minUploadDate = NULL$maxUploadDate = NULL$minTakenDate = NULL$maxTakenDate = NULL$privacyFilter = NULL$sort = NULL$extras = NULL$perPage = NULL$page = NULL)
  1233.         {                
  1234.             $this->api->setToken($token);
  1235.  
  1236.             // Create the args array. (The way PHPFlickr implemented this method
  1237.             // differs from the norm.
  1238.             $args = array('min_upload_date' => $minUploadDate'max_upload_date' => $maxUploadDate'min_taken_date' => $minTakenDate'max_taken_date' => $maxTakenDate'private_filter' => $privacyFilter'sort' => $sort'extras' => $extras'per_page' => $perPage'page' => $page);
  1239.             
  1240.             $photosWithGeoData $this->api->photos_getWithGeoData($args);
  1241.     
  1242.             return $this->_getResult($photosWithGeoData);        
  1243.         }        
  1244.         
  1245.         
  1246.         /**
  1247.          * Returns a list of your photos which haven't been geo-tagged.
  1248.          * 
  1249.          * Official Flickr API documentation:
  1250.          * http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html
  1251.          * 
  1252.          * Requires read authentication.
  1253.          * 
  1254.          * @param (str) The auth token that was returned by authGetToken().
  1255.          * @param (str, optional) Minimum upload date. Photos with an upload date greater than or equal to this value will be returned. The date should be in the form of a unix timestamp.
  1256.          * @param (str, optional) Maximum upload date. Photos with an upload date less than or equal to this value will be returned. The date should be in the form of a unix timestamp.
  1257.          * @param (str, optional) Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. The date should be in the form of a mysql datetime.
  1258.          * @param (str, optional) Maximum taken date. Photos with an taken date less than or equal to this value will be returned. The date should be in the form of a mysql datetime.
  1259.          * @param (int, optional) Return photos only matching a certain privacy level. Valid values are: 1 public photos, 2 private photos visible to friends,    3 private photos visible to family, 4 private photos visible to friends & family,    5 completely private photos
  1260.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  1261.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  1262.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  1263.          *
  1264.          * @return List of your photos which haven't been geo-tagged.
  1265.          * @author Aral Balkan
  1266.          ***/
  1267.         function photosGetWithoutGeoData($token$minUploadDate = NULL$maxUploadDate = NULL$minTakenDate = NULL$maxTakenDate = NULL$privacyFilter = NULL$sort = NULL$extras = NULL$perPage = NULL$page = NULL)
  1268.         {
  1269.             $this->api->setToken($token);
  1270.             
  1271.             // Create the args array. (The way PHPFlickr implemented this method
  1272.             // differs from the norm.
  1273.             $args = array('min_upload_date' => $minUploadDate'max_upload_date' => $maxUploadDate'min_taken_date' => $minTakenDate'max_taken_date' => $maxTakenDate'private_filter' => $privacyFilter'sort' => $sort'extras' => $extras'per_page' => $perPage'page' => $page);
  1274.             
  1275.             $photosWithoutGeoData $this->api->photos_getWithoutGeoData($args);
  1276.             
  1277.             return $this->_getResult($photosWithoutGeoData);
  1278.         }
  1279.         
  1280.         
  1281.         /**
  1282.          * Return a list of your photos that have been recently created
  1283.          * or which have been recently modified. Recently modified may mean
  1284.          * that the photo's metadata (title, description, tags) may have
  1285.          * been changed or a comment has been added (or just modified somehow :-)
  1286.          * 
  1287.          * Official Flickr API documentation:
  1288.          * http://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html
  1289.          *
  1290.          * Requires read authentication.
  1291.          * 
  1292.          * @param (str) The auth token that was returned by authGetToken().
  1293.          * @param (str) A Unix timestamp indicating the date from which modifications should be compared.
  1294.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  1295.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  1296.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  1297.          * 
  1298.          * @return List of your photos that have been recently created
  1299.          *  or which have been recently modified.
  1300.          * @author Aral Balkan
  1301.          ***/
  1302.         function photosRecentlyUpdated($token$minDate = NULL$extras = NULL$perPage = NULL$page = NULL)
  1303.         {
  1304.             $this->api->setToken($token);
  1305.             
  1306.             $photos $this->api->photos_recentlyUpdated($minDate$extras$perPage$page);
  1307.             
  1308.             return $this->_getResult($photos);
  1309.         }
  1310.         
  1311.         
  1312.         /**
  1313.          * Remove a tag from a photo.
  1314.          * 
  1315.          * Official Flickr API documentation:
  1316.          * http://www.flickr.com/services/api/flickr.photos.removeTag.html
  1317.          * 
  1318.          * Requires write authentication.
  1319.          * 
  1320.          * @param (str) The auth token that was returned by authGetToken().
  1321.          * @param (str) The tag to remove from the photo. This parameter should contain a tag id, as returned by photosGetInfo().
  1322.          *
  1323.          * @return True on success, or error object.
  1324.          * @author Aral Balkan
  1325.          ***/
  1326.         function photosRemoveTag($token$tagId)
  1327.         {
  1328.             $this->api->setToken($token);
  1329.             
  1330.             $result $this->api->photos_removeTag($tagId);
  1331.  
  1332.             return $this->_getResult($result);
  1333.         }
  1334.         
  1335.         
  1336.         /**
  1337.          * Return a list of photos matching some criteria. Only photos visible
  1338.          * to the calling user will be returned. To return private or semi-private
  1339.          *  photos, the caller must be authenticated with 'read' permissions, and
  1340.          * have permission to view the photos.
  1341.          * 
  1342.          * Autentication is optional. Unauthenticated calls will only return
  1343.          * public photos.
  1344.          *
  1345.          * Official Flickr API documentation:
  1346.          * http://www.flickr.com/services/api/flickr.photos.search.html
  1347.          * 
  1348.          * @param (str, optional) The auth token that was returned by authGetToken().
  1349.          * @param (str, optional) The NSID of the user who's photo to search. If this parameter isn't passed then everybody's public photos will be searched. A value of "me" will search against the calling user's photos for authenticated calls.
  1350.          * @param (str, optional) A comma-delimited list of tags. Photos with one or more of the tags listed will be returned.
  1351.          * @param (str, optional) Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.
  1352.          * @param (str, optional) A free text search. Photos who's title, description or tags contain the text will be returned.
  1353.          * @param (str, optional) Minimum upload date. Photos with an upload date greater than or equal to this value will be returned. The date should be in the form of a unix timestamp.
  1354.          * @param (str, optional) Maximum upload date. Photos with an upload date less than or equal to this value will be returned. The date should be in the form of a unix timestamp.
  1355.          * @param (str, optional) Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. The date should be in the form of a mysql datetime.
  1356.          * @param (str, optional) Maximum taken date. Photos with an taken date less than or equal to this value will be returned. The date should be in the form of a mysql datetime.
  1357.          * @param (str, optional) The license id for photos (for possible values see the flickr.photos.licenses.getInfo method). Multiple licenses may be comma-separated.
  1358.          * @param (str, optional) The order in which to sort returned photos. Deafults to date-posted-desc. The possible values are: date-posted-asc, date-posted-desc, date-taken-asc, date-taken-desc, interestingness-desc, interestingness-asc, and relevance.
  1359.          * @param (int, optional) Return photos only matching a certain privacy level. This only applies when making an authenticated call to view photos you own. Valid values are: 1 public photos, 2 private photos visible to friends, 3 private photos visible to family, 4 private photos visible to friends & family, 5 completely private photos
  1360.          * @param (str, optional) A comma-delimited list of 4 values defining the Bounding Box of the area that will be searched. The 4 values represent the bottom-left corner of the box and the top-right corner, minimum_longitude, minimum_latitude, maximum_longitude, maximum_latitude. Longitude has a range of -180 to 180 , latitude of -90 to 90. Defaults to -180, -90, 180, 90 if not specified. Unlike standard photo queries, geo (or bounding box) queries will only return 250 results per page. Geo queries require some sort of limiting agent in order to prevent the database from crying. This is basically like the check against "parameterless searches" for queries without a geo component. A tag, for instance, is considered a limiting agent as are user defined min_date_taken and min_date_upload parameters — If no limiting factor is passed we return only photos added in the last 12 hours (though we may extend the limit in the future).
  1361.          * @param (int, optional) Recorded accuracy level of the location information. Current range is 1-16:    World level is 1, Country is ~3, Region is ~6, City is ~11, Street is ~16, Defaults to maximum value if not specified.
  1362.          * @param (int, optional) Safe search setting: 1 for safe. 2 for moderate. 3 for restricted.    (Please note: Un-authed calls can only see Safe content.)
  1363.          * @param (int, optional) Content Type setting:    1 for photos only. 2 for screenshots only. 3 for 'other' only. 4 for photos and screenshots. 5 for screenshots and 'other'. 6 for photos and 'other'. 7 for photos, screenshots, and 'other' (all).
  1364.          * @param (str, optional) Aside from passing in a fully formed machine tag, there is a special syntax for searching on specific properties: Find photos using the 'dc' namespace : "machine_tags" => "dc:". Find photos with a title in the 'dc' namespace : "machine_tags" => "dc:title=".    Find photos titled "mr. camera" in the 'dc' namespace : "machine_tags" => "dc:title=\"mr. camera\". Find photos whose value is "mr. camera" : "machine_tags" => "*:*=\"mr. camera\"".    Find photos that have a title, in any namespace : "machine_tags" => "*:title=". Find photos that have a title, in any namespace, whose value is "mr. camera" : "machine_tags" => "*:title=\"mr. camera\"". Find photos, in the 'dc' namespace whose value is "mr. camera" : "machine_tags" => "dc:*=\"mr. camera\"". Multiple machine tags may be queried by passing a comma-separated list. The number of machine tags you can pass in a single query depends on the tag mode (AND or OR) that you are querying with. "AND" queries are limited to (16) machine tags. "OR" queries are limited to (8).
  1365.          * @param (str, required if searching for machine tags)    Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.
  1366.          * @param (str, optional) The id of a group who's pool to search. If specified, only matching photos posted to the group's pool will be returned.
  1367.          * @param (str, optional) A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags.
  1368.          * @param (int, optional) Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
  1369.          * @param (int, optional) The page of results to return. If this argument is omitted, it defaults to 1.
  1370.          * 
  1371.          * @return List of photos matching the criteria.
  1372.          * @author Aral Balkan
  1373.          ***/
  1374.         function photosSearch($token = NULL$userId = NULL$tags = NULL$tagMode = NULL$text = NULL$minUploadDate = NULL$maxUploadDate = NULL$minTakenDate = NULL$maxTakenDate = NULL$license = NULL$sort = NULL$privacyFilter = NULL$bbox = NULL$accuracy = NULL$safeSearch = NULL$contentType = NULL$machineTags = NULL$machineTagMode = NULL$groupId = NULL$extras = NULL$perPage = NULL$page = NULL)
  1375.         {
  1376.             if ($token !== NULL)
  1377.             {
  1378.                 $this->api->setToken($token);
  1379.             }
  1380.             
  1381.             $args = array('user_id' => $userId'tags' => $tags'tag_mode' => $tagMode'text' => $text'min_upload_date' => $minUploadDate'max_upload_date' => $maxUploadDate'min_taken_date' => $minTakenDate'max_taken_date' => $maxTakenDate'license' => $license'sort' => $sort'privacy_filter' => $privacyFilter'bbox' => $bbox'accuracy' => $accuracy'safe_search' => $safeSearch'content_type' => $contentType'machine_tags' => $machineTags'machine_tag_mode' => $machineTagMode'group_id' => $groupId'extras' => $extras'per_page' => $perPage'page' => $page);
  1382.             
  1383.             $result $this->api->photos_search($args);
  1384.         
  1385.             return $this->_getResult($result);
  1386.         }
  1387.         
  1388.         
  1389.         
  1390.         
  1391.         //
  1392.         // Private methods
  1393.         //
  1394.         
  1395.                 
  1396.         function _getResult($result)
  1397.         {
  1398.             if ($result === false)
  1399.             {
  1400.                 // Send the meaningful error message returned by Flickr, instead of false.
  1401.                 $result = array('error'=>true'code'=>$this->api->error_code'message'=>$this->api->error_msg);
  1402.             }
  1403.             
  1404.             return $result;
  1405.         }
  1406.         
  1407.     }
  1408.     
  1409. ?>

Documentation generated on Fri, 06 Jul 2007 19:54:50 +0100 by phpDocumentor 1.3.1