phpFlickr PHP Cross Reference Image Galleries

Source: /phpFlickr.php - 1804 lines - 85001 bytes - Summary - Text - Print

   1  <?php
   2  /* phpFlickr
   3   * Written by Dan Coulter (dan@dancoulter.com)
   4   * Project Home Page: http://github.com/dancoulter/phpflickr
   5   * 
   6   * This program is free software: you can redistribute it and/or modify
   7   * it under the terms of the GNU General Public License as published by
   8   * the Free Software Foundation, either version 3 of the License, or
   9   * (at your option) any later version.
  10   * 
  11   * This program is distributed in the hope that it will be useful,
  12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14   * GNU General Public License for more details.
  15   * 
  16   * You should have received a copy of the GNU General Public License
  17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18   * 
  19   */ 
  20  if ( !class_exists('phpFlickr') ) {
  21      if (session_id() == "") {
  22          @session_start();
  23      }
  24  
  25      class phpFlickr {
  26          var $api_key;
  27          var $secret;
  28          
  29          var $rest_endpoint = 'https://api.flickr.com/services/rest/';
  30          var $upload_endpoint = 'https://up.flickr.com/services/upload/';
  31          var $replace_endpoint = 'https://up.flickr.com/services/replace/';
  32          var $req;
  33          var $response;
  34          var $parsed_response;
  35          var $cache = false;
  36          var $cache_db = null;
  37          var $cache_table = null;
  38          var $cache_dir = null;
  39          var $cache_expire = null;
  40          var $cache_key = null;
  41          var $last_request = null;
  42          var $die_on_error;
  43          var $error_code;
  44          Var $error_msg;
  45          var $token;
  46          var $php_version;
  47          var $custom_post = null, $custom_cache_get = null, $custom_cache_set = null;
  48  
  49          /*
  50           * When your database cache table hits this many rows, a cleanup
  51           * will occur to get rid of all of the old rows and cleanup the
  52           * garbage in the table.  For most personal apps, 1000 rows should
  53           * be more than enough.  If your site gets hit by a lot of traffic
  54           * or you have a lot of disk space to spare, bump this number up.
  55           * You should try to set it high enough that the cleanup only
  56           * happens every once in a while, so this will depend on the growth
  57           * of your table.
  58           */
  59          var $max_cache_rows = 1000;
  60  
  61  		function phpFlickr ($api_key, $secret = NULL, $die_on_error = false) {
  62              //The API Key must be set before any calls can be made.  You can
  63              //get your own at https://www.flickr.com/services/api/misc.api_keys.html
  64              $this->api_key = $api_key;
  65              $this->secret = $secret;
  66              $this->die_on_error = $die_on_error;
  67              $this->service = "flickr";
  68  
  69              //Find the PHP version and store it for future reference
  70              $this->php_version = explode("-", phpversion());
  71              $this->php_version = explode(".", $this->php_version[0]);
  72          }
  73  
  74  		function enableCache ($type, $connection, $cache_expire = 600, $table = 'flickr_cache') {
  75              // Turns on caching.  $type must be either "db" (for database caching) or "fs" (for filesystem).
  76              // When using db, $connection must be a PEAR::DB connection string. Example:
  77              //      "mysql://user:password@server/database"
  78              // If the $table, doesn't exist, it will attempt to create it.
  79              // When using file system, caching, the $connection is the folder that the web server has write
  80              // access to. Use absolute paths for best results.  Relative paths may have unexpected behavior
  81              // when you include this.  They'll usually work, you'll just want to test them.
  82              if ($type == 'db') {
  83                  if ( preg_match('|mysql://([^:]*):([^@]*)@([^/]*)/(.*)|', $connection, $matches) ) {
  84                      //Array ( [0] => mysql://user:password@server/database [1] => user [2] => password [3] => server [4] => database ) 
  85                      $db = mysql_connect($matches[3], $matches[1], $matches[2]);
  86                      mysql_select_db($matches[4], $db);
  87                      
  88                      /*
  89                       * If high performance is crucial, you can easily comment
  90                       * out this query once you've created your database table.
  91                       */
  92                      mysql_query("
  93                          CREATE TABLE IF NOT EXISTS `$table` (
  94                              `request` CHAR( 35 ) NOT NULL ,
  95                              `response` MEDIUMTEXT NOT NULL ,
  96                              `expiration` DATETIME NOT NULL ,
  97                              INDEX ( `request` )
  98                          ) TYPE = MYISAM
  99                      ", $db);
 100                      
 101                      $result = mysql_query("SELECT COUNT(*) FROM $table", $db);
 102                      $result = mysql_fetch_row($result);
 103                      if ( $result[0] > $this->max_cache_rows ) {
 104                          mysql_query("DELETE FROM $table WHERE expiration < DATE_SUB(NOW(), INTERVAL $cache_expire second)", $db);
 105                          mysql_query('OPTIMIZE TABLE ' . $this->cache_table, $db);
 106                      }
 107                      $this->cache = 'db';
 108                      $this->cache_db = $db;
 109                      $this->cache_table = $table;
 110                  }
 111              } elseif ($type == 'fs') {
 112                  $this->cache = 'fs';
 113                  $connection = realpath($connection);
 114                  $this->cache_dir = $connection;
 115                  if ($dir = opendir($this->cache_dir)) {
 116                      while ($file = readdir($dir)) {
 117                          if (substr($file, -6) == '.cache' && ((filemtime($this->cache_dir . '/' . $file) + $cache_expire) < time()) ) {
 118                              unlink($this->cache_dir . '/' . $file);
 119                          }
 120                      }
 121                  }
 122              } elseif ( $type == 'custom' ) {
 123                  $this->cache = "custom";
 124                  $this->custom_cache_get = $connection[0];
 125                  $this->custom_cache_set = $connection[1];
 126              }
 127              $this->cache_expire = $cache_expire;
 128          }
 129  
 130  		function getCached ($request)
 131          {
 132              //Checks the database or filesystem for a cached result to the request.
 133              //If there is no cache result, it returns a value of false. If it finds one,
 134              //it returns the unparsed XML.
 135              foreach ( $request as $key => $value ) {
 136                  if ( empty($value) ) unset($request[$key]);
 137                  else $request[$key] = (string) $request[$key];
 138              }
 139              //if ( is_user_logged_in() ) print_r($request);
 140              $reqhash = md5(serialize($request));
 141              $this->cache_key = $reqhash;
 142              $this->cache_request = $request;
 143              if ($this->cache == 'db') {
 144                  $result = mysql_query("SELECT response FROM " . $this->cache_table . " WHERE request = '" . $reqhash . "' AND DATE_SUB(NOW(), INTERVAL " . (int) $this->cache_expire . " SECOND) < expiration", $this->cache_db);
 145                  if ( mysql_num_rows($result) ) {
 146                      $result = mysql_fetch_assoc($result);
 147                      return $result['response'];
 148                  } else {
 149                      return false;
 150                  }
 151              } elseif ($this->cache == 'fs') {
 152                  $file = $this->cache_dir . '/' . $reqhash . '.cache';
 153                  if (file_exists($file)) {
 154                      if ($this->php_version[0] > 4 || ($this->php_version[0] == 4 && $this->php_version[1] >= 3)) {
 155                          return file_get_contents($file);
 156                      } else {
 157                          return implode('', file($file));
 158                      }
 159                  }
 160              } elseif ( $this->cache == 'custom' ) {
 161                  return call_user_func_array($this->custom_cache_get, array($reqhash));
 162              }
 163              return false;
 164          }
 165  
 166  		function cache ($request, $response)
 167          {
 168              //Caches the unparsed response of a request.
 169              unset($request['api_sig']);
 170              foreach ( $request as $key => $value ) {
 171                  if ( empty($value) ) unset($request[$key]);
 172                  else $request[$key] = (string) $request[$key];
 173              }
 174              $reqhash = md5(serialize($request));
 175              if ($this->cache == 'db') {
 176                  //$this->cache_db->query("DELETE FROM $this->cache_table WHERE request = '$reqhash'");
 177                  $result = mysql_query("SELECT COUNT(*) FROM " . $this->cache_table . " WHERE request = '" . $reqhash . "'", $this->cache_db);
 178                  $result = mysql_fetch_row($result);
 179                  if ( $result[0] ) {
 180                      $sql = "UPDATE " . $this->cache_table . " SET response = '" . str_replace("'", "''", $response) . "', expiration = '" . strftime("%Y-%m-%d %H:%M:%S") . "' WHERE request = '" . $reqhash . "'";
 181                      mysql_query($sql, $this->cache_db);
 182                  } else {
 183                      $sql = "INSERT INTO " . $this->cache_table . " (request, response, expiration) VALUES ('$reqhash', '" . str_replace("'", "''", $response) . "', '" . strftime("%Y-%m-%d %H:%M:%S") . "')";
 184                      mysql_query($sql, $this->cache_db);
 185                  }
 186              } elseif ($this->cache == "fs") {
 187                  $file = $this->cache_dir . "/" . $reqhash . ".cache";
 188                  $fstream = fopen($file, "w");
 189                  $result = fwrite($fstream,$response);
 190                  fclose($fstream);
 191                  return $result;
 192              } elseif ( $this->cache == "custom" ) {
 193                  return call_user_func_array($this->custom_cache_set, array($reqhash, $response, $this->cache_expire));
 194              }
 195              return false;
 196          }
 197          
 198  		function setCustomPost ( $function ) {
 199              $this->custom_post = $function;
 200          }
 201          
 202  		function post ($data, $type = null) {
 203              if ( is_null($type) ) {
 204                  $url = $this->rest_endpoint;
 205              }
 206              
 207              if ( !is_null($this->custom_post) ) {
 208                  return call_user_func($this->custom_post, $url, $data);
 209              }
 210              
 211              if ( !preg_match("|https://(.*?)(/.*)|", $url, $matches) ) {
 212                  die('There was some problem figuring out your endpoint');
 213              }
 214  
 215              if ( function_exists('curl_init') ) {
 216                  // Has curl. Use it!
 217                  $curl = curl_init($this->rest_endpoint);
 218                  curl_setopt($curl, CURLOPT_POST, true);
 219                  curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
 220                  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 221                  $response = curl_exec($curl);
 222                  curl_close($curl);
 223              } else {
 224                  // Use sockets.
 225                  foreach ( $data as $key => $value ) {
 226                      $data[$key] = $key . '=' . urlencode($value);
 227                  }
 228                  $data = implode('&', $data);
 229              
 230                  $fp = @pfsockopen($matches[1], 80);
 231                  if (!$fp) {
 232                      die('Could not connect to the web service');
 233                  }
 234                  fputs ($fp,'POST ' . $matches[2] . " HTTP/1.1\n");
 235                  fputs ($fp,'Host: ' . $matches[1] . "\n");
 236                  fputs ($fp,"Content-type: application/x-www-form-urlencoded\n");
 237                  fputs ($fp,"Content-length: ".strlen($data)."\n");
 238                  fputs ($fp,"Connection: close\r\n\r\n");
 239                  fputs ($fp,$data . "\n\n");
 240                  $response = "";
 241                  while(!feof($fp)) {
 242                      $response .= fgets($fp, 1024);
 243                  }
 244                  fclose ($fp);
 245                  $chunked = false;
 246                  $http_status = trim(substr($response, 0, strpos($response, "\n")));
 247                  if ( $http_status != 'HTTP/1.1 200 OK' ) {
 248                      die('The web service endpoint returned a "' . $http_status . '" response');
 249                  }
 250                  if ( strpos($response, 'Transfer-Encoding: chunked') !== false ) {
 251                      $temp = trim(strstr($response, "\r\n\r\n"));
 252                      $response = '';
 253                      $length = trim(substr($temp, 0, strpos($temp, "\r")));
 254                      while ( trim($temp) != "0" && ($length = trim(substr($temp, 0, strpos($temp, "\r")))) != "0" ) {
 255                          $response .= trim(substr($temp, strlen($length)+2, hexdec($length)));
 256                          $temp = trim(substr($temp, strlen($length) + 2 + hexdec($length)));
 257                      }
 258                  } elseif ( strpos($response, 'HTTP/1.1 200 OK') !== false ) {
 259                      $response = trim(strstr($response, "\r\n\r\n"));
 260                  }
 261              }
 262              return $response;
 263          }
 264          
 265  		function request ($command, $args = array(), $nocache = false)
 266          {
 267              //Sends a request to Flickr's REST endpoint via POST.
 268              if (substr($command,0,7) != "flickr.") {
 269                  $command = "flickr." . $command;
 270              }
 271  
 272              //Process arguments, including method and login data.
 273              $args = array_merge(array("method" => $command, "format" => "php_serial", "api_key" => $this->api_key), $args);
 274              if (!empty($this->token)) {
 275                  $args = array_merge($args, array("auth_token" => $this->token));
 276              } elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
 277                  $args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
 278              }
 279              ksort($args);
 280              $auth_sig = "";
 281              $this->last_request = $args;
 282              if (!($this->response = $this->getCached($args)) || $nocache) {
 283                  foreach ($args as $key => $data) {
 284                      if ( is_null($data) ) {
 285                          unset($args[$key]);
 286                          continue;
 287                      }
 288                      $auth_sig .= $key . $data;
 289                  }
 290                  if (!empty($this->secret)) {
 291                      $api_sig = md5($this->secret . $auth_sig);
 292                      $args['api_sig'] = $api_sig;
 293                  }
 294                  $this->response = $this->post($args);
 295                  $this->cache($args, $this->response);
 296              }
 297              
 298              /*
 299               * Uncomment this line (and comment out the next one) if you're doing large queries
 300               * and you're concerned about time.  This will, however, change the structure of
 301               * the result, so be sure that you look at the results.
 302               */
 303              //$this->parsed_response = unserialize($this->response);
 304              $this->parsed_response = $this->clean_text_nodes(unserialize($this->response));
 305              if ($this->parsed_response['stat'] == 'fail') {
 306                  if ($this->die_on_error) die("The Flickr API returned the following error: #{$this->parsed_response['code']} - {$this->parsed_response['message']}");
 307                  else {
 308                      $this->error_code = $this->parsed_response['code'];
 309                      $this->error_msg = $this->parsed_response['message'];
 310                      $this->parsed_response = false;
 311                  }
 312              } else {
 313                  $this->error_code = false;
 314                  $this->error_msg = false;
 315              }
 316              return $this->response;
 317          }
 318  
 319  		function clean_text_nodes ($arr) {
 320              if (!is_array($arr)) {
 321                  return $arr;
 322              } elseif (count($arr) == 0) {
 323                  return $arr;
 324              } elseif (count($arr) == 1 && array_key_exists('_content', $arr)) {
 325                  return $arr['_content'];
 326              } else {
 327                  foreach ($arr as $key => $element) {
 328                      $arr[$key] = $this->clean_text_nodes($element);
 329                  }
 330                  return($arr);
 331              }
 332          }
 333  
 334  		function setToken ($token) {
 335              // Sets an authentication token to use instead of the session variable
 336              $this->token = $token;
 337          }
 338  
 339  		function setProxy ($server, $port) {
 340              // Sets the proxy for all phpFlickr calls.
 341              $this->req->setProxy($server, $port);
 342          }
 343  
 344  		function getErrorCode () {
 345              // Returns the error code of the last call.  If the last call did not
 346              // return an error. This will return a false boolean.
 347              return $this->error_code;
 348          }
 349  
 350  		function getErrorMsg () {
 351              // Returns the error message of the last call.  If the last call did not
 352              // return an error. This will return a false boolean.
 353              return $this->error_msg;
 354          }
 355  
 356          /* These functions are front ends for the flickr calls */
 357  
 358  		function buildPhotoURL ($photo, $size = "Medium") {
 359              //receives an array (can use the individual photo data returned
 360              //from an API call) and returns a URL (doesn't mean that the
 361              //file size exists)
 362              $sizes = array(
 363                  "square" => "_s",
 364                  "thumbnail" => "_t",
 365                  "small" => "_m",
 366                  "medium" => "",
 367                  "medium_640" => "_z",
 368                  "large" => "_b",
 369                  "original" => "_o"
 370              );
 371              
 372              $size = strtolower($size);
 373              if (!array_key_exists($size, $sizes)) {
 374                  $size = "medium";
 375              }
 376              
 377              if ($size == "original") {
 378                  $url = "https://farm" . $photo['farm'] . ".static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['originalsecret'] . "_o" . "." . $photo['originalformat'];
 379              } else {
 380                  $url = "https://farm" . $photo['farm'] . ".static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['secret'] . $sizes[$size] . ".jpg";
 381              }
 382              return $url;
 383          }
 384  
 385  		function sync_upload ($photo, $title = null, $description = null, $tags = null, $is_public = null, $is_friend = null, $is_family = null) {
 386              if ( function_exists('curl_init') ) {
 387                  // Has curl. Use it!
 388  
 389                  //Process arguments, including method and login data.
 390                  $args = array("api_key" => $this->api_key, "title" => $title, "description" => $description, "tags" => $tags, "is_public" => $is_public, "is_friend" => $is_friend, "is_family" => $is_family);
 391                  if (!empty($this->token)) {
 392                      $args = array_merge($args, array("auth_token" => $this->token));
 393                  } elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
 394                      $args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
 395                  }
 396  
 397                  ksort($args);
 398                  $auth_sig = "";
 399                  foreach ($args as $key => $data) {
 400                      if ( is_null($data) ) {
 401                          unset($args[$key]);
 402                      } else {
 403                          $auth_sig .= $key . $data;
 404                      }
 405                  }
 406                  if (!empty($this->secret)) {
 407                      $api_sig = md5($this->secret . $auth_sig);
 408                      $args["api_sig"] = $api_sig;
 409                  }
 410  
 411                  $photo = realpath($photo);
 412                  $args['photo'] = '@' . $photo;
 413                  
 414  
 415                  $curl = curl_init($this->upload_endpoint);
 416                  curl_setopt($curl, CURLOPT_POST, true);
 417                  curl_setopt($curl, CURLOPT_POSTFIELDS, $args);
 418                  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 419                  $response = curl_exec($curl);
 420                  $this->response = $response;
 421                  curl_close($curl);
 422                  
 423                  $rsp = explode("\n", $response);
 424                  foreach ($rsp as $line) {
 425                      if (preg_match('|<err code="([0-9]+)" msg="(.*)"|', $line, $match)) {
 426                          if ($this->die_on_error)
 427                              die("The Flickr API returned the following error: #{$match[1]} - {$match[2]}");
 428                          else {
 429                              $this->error_code = $match[1];
 430                              $this->error_msg = $match[2];
 431                              $this->parsed_response = false;
 432                              return false;
 433                          }
 434                      } elseif (preg_match("|<photoid>(.*)</photoid>|", $line, $match)) {
 435                          $this->error_code = false;
 436                          $this->error_msg = false;
 437                          return $match[1];
 438                      }
 439                  }
 440  
 441              } else {
 442                  die("Sorry, your server must support CURL in order to upload files");
 443              }
 444  
 445          }
 446  
 447  		function async_upload ($photo, $title = null, $description = null, $tags = null, $is_public = null, $is_friend = null, $is_family = null) {
 448              if ( function_exists('curl_init') ) {
 449                  // Has curl. Use it!
 450  
 451                  //Process arguments, including method and login data.
 452                  $args = array("async" => 1, "api_key" => $this->api_key, "title" => $title, "description" => $description, "tags" => $tags, "is_public" => $is_public, "is_friend" => $is_friend, "is_family" => $is_family);
 453                  if (!empty($this->token)) {
 454                      $args = array_merge($args, array("auth_token" => $this->token));
 455                  } elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
 456                      $args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
 457                  }
 458  
 459                  ksort($args);
 460                  $auth_sig = "";
 461                  foreach ($args as $key => $data) {
 462                      if ( is_null($data) ) {
 463                          unset($args[$key]);
 464                      } else {
 465                          $auth_sig .= $key . $data;
 466                      }
 467                  }
 468                  if (!empty($this->secret)) {
 469                      $api_sig = md5($this->secret . $auth_sig);
 470                      $args["api_sig"] = $api_sig;
 471                  }
 472  
 473                  $photo = realpath($photo);
 474                  $args['photo'] = '@' . $photo;
 475                  
 476  
 477                  $curl = curl_init($this->upload_endpoint);
 478                  curl_setopt($curl, CURLOPT_POST, true);
 479                  curl_setopt($curl, CURLOPT_POSTFIELDS, $args);
 480                  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 481                  $response = curl_exec($curl);
 482                  $this->response = $response;
 483                  curl_close($curl);
 484                  
 485                  $rsp = explode("\n", $response);
 486                  foreach ($rsp as $line) {
 487                      if (ereg('<err code="([0-9]+)" msg="(.*)"', $line, $match)) {
 488                          if ($this->die_on_error)
 489                              die("The Flickr API returned the following error: #{$match[1]} - {$match[2]}");
 490                          else {
 491                              $this->error_code = $match[1];
 492                              $this->error_msg = $match[2];
 493                              $this->parsed_response = false;
 494                              return false;
 495                          }
 496                      } elseif (ereg("<ticketid>(.*)</", $line, $match)) {
 497                          $this->error_code = false;
 498                          $this->error_msg = false;
 499                          return $match[1];
 500                      }
 501                  }
 502              } else {
 503                  die("Sorry, your server must support CURL in order to upload files");
 504              }
 505          }
 506  
 507          // Interface for new replace API method.
 508  		function replace ($photo, $photo_id, $async = null) {
 509              if ( function_exists('curl_init') ) {
 510                  // Has curl. Use it!
 511  
 512                  //Process arguments, including method and login data.
 513                  $args = array("api_key" => $this->api_key, "photo_id" => $photo_id, "async" => $async);
 514                  if (!empty($this->token)) {
 515                      $args = array_merge($args, array("auth_token" => $this->token));
 516                  } elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
 517                      $args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
 518                  }
 519  
 520                  ksort($args);
 521                  $auth_sig = "";
 522                  foreach ($args as $key => $data) {
 523                      if ( is_null($data) ) {
 524                          unset($args[$key]);
 525                      } else {
 526                          $auth_sig .= $key . $data;
 527                      }
 528                  }
 529                  if (!empty($this->secret)) {
 530                      $api_sig = md5($this->secret . $auth_sig);
 531                      $args["api_sig"] = $api_sig;
 532                  }
 533  
 534                  $photo = realpath($photo);
 535                  $args['photo'] = '@' . $photo;
 536                  
 537  
 538                  $curl = curl_init($this->replace_endpoint);
 539                  curl_setopt($curl, CURLOPT_POST, true);
 540                  curl_setopt($curl, CURLOPT_POSTFIELDS, $args);
 541                  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 542                  $response = curl_exec($curl);
 543                  $this->response = $response;
 544                  curl_close($curl);
 545                  
 546                  if ($async == 1)
 547                      $find = 'ticketid';
 548                   else
 549                      $find = 'photoid';
 550  
 551                  $rsp = explode("\n", $response);
 552                  foreach ($rsp as $line) {
 553                      if (preg_match('|<err code="([0-9]+)" msg="(.*)"|', $line, $match)) {
 554                          if ($this->die_on_error)
 555                              die("The Flickr API returned the following error: #{$match[1]} - {$match[2]}");
 556                          else {
 557                              $this->error_code = $match[1];
 558                              $this->error_msg = $match[2];
 559                              $this->parsed_response = false;
 560                              return false;
 561                          }
 562                      } elseif (preg_match("|<" . $find . ">(.*)</|", $line, $match)) {
 563                          $this->error_code = false;
 564                          $this->error_msg = false;
 565                          return $match[1];
 566                      }
 567                  }
 568              } else {
 569                  die("Sorry, your server must support CURL in order to upload files");
 570              }
 571          }
 572  
 573  		function auth ($perms = "read", $remember_uri = true) {
 574              // Redirects to Flickr's authentication piece if there is no valid token.
 575              // If remember_uri is set to false, the callback script (included) will
 576              // redirect to its default page.
 577  
 578              if (empty($_SESSION['phpFlickr_auth_token']) && empty($this->token)) {
 579                  if ( $remember_uri === true ) {
 580                      $_SESSION['phpFlickr_auth_redirect'] = $_SERVER['REQUEST_URI'];
 581                  } elseif ( $remember_uri !== false ) {
 582                      $_SESSION['phpFlickr_auth_redirect'] = $remember_uri;
 583                  }
 584                  $api_sig = md5($this->secret . "api_key" . $this->api_key . "perms" . $perms);
 585                  
 586                  if ($this->service == "23") {
 587                      header("Location: http://www.23hq.com/services/auth/?api_key=" . $this->api_key . "&perms=" . $perms . "&api_sig=". $api_sig);
 588                  } else {
 589                      header("Location: https://www.flickr.com/services/auth/?api_key=" . $this->api_key . "&perms=" . $perms . "&api_sig=". $api_sig);
 590                  }
 591                  exit;
 592              } else {
 593                  $tmp = $this->die_on_error;
 594                  $this->die_on_error = false;
 595                  $rsp = $this->auth_checkToken();
 596                  if ($this->error_code !== false) {
 597                      unset($_SESSION['phpFlickr_auth_token']);
 598                      $this->auth($perms, $remember_uri);
 599                  }
 600                  $this->die_on_error = $tmp;
 601                  return $rsp['perms'];
 602              }
 603          }
 604  
 605  		function auth_url($frob, $perms = 'read') {
 606              $sig = md5(sprintf('%sapi_key%sfrob%sperms%s', $this->secret, $this->api_key, $frob, $perms));
 607              return sprintf('https://flickr.com/services/auth/?api_key=%s&perms=%s&frob=%s&api_sig=%s', $this->api_key, $perms, $frob, $sig);
 608          }
 609  
 610          /*******************************
 611  
 612          To use the phpFlickr::call method, pass a string containing the API method you want
 613          to use and an associative array of arguments.  For example:
 614              $result = $f->call("flickr.photos.comments.getList", array("photo_id"=>'34952612'));
 615          This method will allow you to make calls to arbitrary methods that haven't been
 616          implemented in phpFlickr yet.
 617  
 618          *******************************/
 619  
 620  		function call ($method, $arguments) {
 621              foreach ( $arguments as $key => $value ) {
 622                  if ( is_null($value) ) unset($arguments[$key]);
 623              }
 624              $this->request($method, $arguments);
 625              return $this->parsed_response ? $this->parsed_response : false;
 626          }
 627  
 628          /*
 629              These functions are the direct implementations of flickr calls.
 630              For method documentation, including arguments, visit the address
 631              included in a comment in the function.
 632          */
 633  
 634          /* Activity methods */
 635  		function activity_userComments ($per_page = NULL, $page = NULL) {
 636              /* https://www.flickr.com/services/api/flickr.activity.userComments.html */
 637              $this->request('flickr.activity.userComments', array("per_page" => $per_page, "page" => $page));
 638              return $this->parsed_response ? $this->parsed_response['items']['item'] : false;
 639          }
 640  
 641  		function activity_userPhotos ($timeframe = NULL, $per_page = NULL, $page = NULL) {
 642              /* https://www.flickr.com/services/api/flickr.activity.userPhotos.html */
 643              $this->request('flickr.activity.userPhotos', array("timeframe" => $timeframe, "per_page" => $per_page, "page" => $page));
 644              return $this->parsed_response ? $this->parsed_response['items']['item'] : false;
 645          }
 646  
 647          /* Authentication methods */
 648  		function auth_checkToken () {
 649              /* https://www.flickr.com/services/api/flickr.auth.checkToken.html */
 650              $this->request('flickr.auth.checkToken');
 651              return $this->parsed_response ? $this->parsed_response['auth'] : false;
 652          }
 653  
 654  		function auth_getFrob () {
 655              /* https://www.flickr.com/services/api/flickr.auth.getFrob.html */
 656              $this->request('flickr.auth.getFrob');
 657              return $this->parsed_response ? $this->parsed_response['frob'] : false;
 658          }
 659  
 660  		function auth_getFullToken ($mini_token) {
 661              /* https://www.flickr.com/services/api/flickr.auth.getFullToken.html */
 662              $this->request('flickr.auth.getFullToken', array('mini_token'=>$mini_token));
 663              return $this->parsed_response ? $this->parsed_response['auth'] : false;
 664          }
 665  
 666  		function auth_getToken ($frob) {
 667              /* https://www.flickr.com/services/api/flickr.auth.getToken.html */
 668              $this->request('flickr.auth.getToken', array('frob'=>$frob));
 669              $_SESSION['phpFlickr_auth_token'] = $this->parsed_response['auth']['token'];
 670              return $this->parsed_response ? $this->parsed_response['auth'] : false;
 671          }
 672  
 673          /* Blogs methods */
 674  		function blogs_getList ($service = NULL) {
 675              /* https://www.flickr.com/services/api/flickr.blogs.getList.html */
 676              $rsp = $this->call('flickr.blogs.getList', array('service' => $service));
 677              return $rsp['blogs']['blog'];
 678          }
 679          
 680  		function blogs_getServices () {
 681              /* https://www.flickr.com/services/api/flickr.blogs.getServices.html */
 682              return $this->call('flickr.blogs.getServices', array());
 683          }
 684  
 685  		function blogs_postPhoto ($blog_id = NULL, $photo_id, $title, $description, $blog_password = NULL, $service = NULL) {
 686              /* https://www.flickr.com/services/api/flickr.blogs.postPhoto.html */
 687              return $this->call('flickr.blogs.postPhoto', array('blog_id' => $blog_id, 'photo_id' => $photo_id, 'title' => $title, 'description' => $description, 'blog_password' => $blog_password, 'service' => $service));
 688          }
 689  
 690          /* Collections Methods */
 691  		function collections_getInfo ($collection_id) {
 692              /* https://www.flickr.com/services/api/flickr.collections.getInfo.html */
 693              return $this->call('flickr.collections.getInfo', array('collection_id' => $collection_id));
 694          }
 695  
 696  		function collections_getTree ($collection_id = NULL, $user_id = NULL) {
 697              /* https://www.flickr.com/services/api/flickr.collections.getTree.html */
 698              return $this->call('flickr.collections.getTree', array('collection_id' => $collection_id, 'user_id' => $user_id));
 699          }
 700          
 701          /* Commons Methods */
 702  		function commons_getInstitutions () {
 703              /* https://www.flickr.com/services/api/flickr.commons.getInstitutions.html */
 704              return $this->call('flickr.commons.getInstitutions', array());
 705          }
 706          
 707          /* Contacts Methods */
 708  		function contacts_getList ($filter = NULL, $page = NULL, $per_page = NULL) {
 709              /* https://www.flickr.com/services/api/flickr.contacts.getList.html */
 710              $this->request('flickr.contacts.getList', array('filter'=>$filter, 'page'=>$page, 'per_page'=>$per_page));
 711              return $this->parsed_response ? $this->parsed_response['contacts'] : false;
 712          }
 713  
 714  		function contacts_getPublicList ($user_id, $page = NULL, $per_page = NULL) {
 715              /* https://www.flickr.com/services/api/flickr.contacts.getPublicList.html */
 716              $this->request('flickr.contacts.getPublicList', array('user_id'=>$user_id, 'page'=>$page, 'per_page'=>$per_page));
 717              return $this->parsed_response ? $this->parsed_response['contacts'] : false;
 718          }
 719          
 720  		function contacts_getListRecentlyUploaded ($date_lastupload = NULL, $filter = NULL) {
 721              /* https://www.flickr.com/services/api/flickr.contacts.getListRecentlyUploaded.html */
 722              return $this->call('flickr.contacts.getListRecentlyUploaded', array('date_lastupload' => $date_lastupload, 'filter' => $filter));
 723          }
 724  
 725          /* Favorites Methods */
 726  		function favorites_add ($photo_id) {
 727              /* https://www.flickr.com/services/api/flickr.favorites.add.html */
 728              $this->request('flickr.favorites.add', array('photo_id'=>$photo_id), TRUE);
 729              return $this->parsed_response ? true : false;
 730          }
 731  
 732  		function favorites_getList ($user_id = NULL, $jump_to = NULL, $min_fave_date = NULL, $max_fave_date = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
 733              /* https://www.flickr.com/services/api/flickr.favorites.getList.html */
 734              return $this->call('flickr.favorites.getList', array('user_id' => $user_id, 'jump_to' => $jump_to, 'min_fave_date' => $min_fave_date, 'max_fave_date' => $max_fave_date, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
 735          }
 736          
 737  		function favorites_getPublicList ($user_id, $jump_to = NULL, $min_fave_date = NULL, $max_fave_date = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
 738              /* https://www.flickr.com/services/api/flickr.favorites.getPublicList.html */
 739              return $this->call('flickr.favorites.getPublicList', array('user_id' => $user_id, 'jump_to' => $jump_to, 'min_fave_date' => $min_fave_date, 'max_fave_date' => $max_fave_date, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
 740          }
 741          
 742  		function favorites_remove ($photo_id, $user_id = NULL) {
 743              /* https://www.flickr.com/services/api/flickr.favorites.remove.html */
 744              $this->request("flickr.favorites.remove", array('photo_id' => $photo_id, 'user_id' => $user_id), TRUE);
 745              return $this->parsed_response ? true : false;
 746          }
 747  
 748          /* Galleries Methods */
 749  		function galleries_addPhoto ($gallery_id, $photo_id, $comment = NULL) {
 750              /* https://www.flickr.com/services/api/flickr.galleries.addPhoto.html */
 751              return $this->call('flickr.galleries.addPhoto', array('gallery_id' => $gallery_id, 'photo_id' => $photo_id, 'comment' => $comment));
 752          }
 753          
 754  		function galleries_create ($title, $description, $primary_photo_id = NULL) {
 755              /* https://www.flickr.com/services/api/flickr.galleries.create.html */
 756              return $this->call('flickr.galleries.create', array('title' => $title, 'description' => $description, 'primary_photo_id' => $primary_photo_id));
 757          }
 758  
 759  		function galleries_editMeta ($gallery_id, $title, $description = NULL) {
 760              /* https://www.flickr.com/services/api/flickr.galleries.editMeta.html */
 761              return $this->call('flickr.galleries.editMeta', array('gallery_id' => $gallery_id, 'title' => $title, 'description' => $description));
 762          }
 763  
 764  		function galleries_editPhoto ($gallery_id, $photo_id, $comment) {
 765              /* https://www.flickr.com/services/api/flickr.galleries.editPhoto.html */
 766              return $this->call('flickr.galleries.editPhoto', array('gallery_id' => $gallery_id, 'photo_id' => $photo_id, 'comment' => $comment));
 767          }
 768  
 769  		function galleries_editPhotos ($gallery_id, $primary_photo_id, $photo_ids) {
 770              /* https://www.flickr.com/services/api/flickr.galleries.editPhotos.html */
 771              return $this->call('flickr.galleries.editPhotos', array('gallery_id' => $gallery_id, 'primary_photo_id' => $primary_photo_id, 'photo_ids' => $photo_ids));
 772          }
 773  
 774  		function galleries_getInfo ($gallery_id) {
 775              /* https://www.flickr.com/services/api/flickr.galleries.getInfo.html */
 776              return $this->call('flickr.galleries.getInfo', array('gallery_id' => $gallery_id));
 777          }
 778  
 779  		function galleries_getList ($user_id, $per_page = NULL, $page = NULL) {
 780              /* https://www.flickr.com/services/api/flickr.galleries.getList.html */
 781              return $this->call('flickr.galleries.getList', array('user_id' => $user_id, 'per_page' => $per_page, 'page' => $page));
 782          }
 783  
 784  		function galleries_getListForPhoto ($photo_id, $per_page = NULL, $page = NULL) {
 785              /* https://www.flickr.com/services/api/flickr.galleries.getListForPhoto.html */
 786              return $this->call('flickr.galleries.getListForPhoto', array('photo_id' => $photo_id, 'per_page' => $per_page, 'page' => $page));
 787          }
 788              
 789  		function galleries_getPhotos ($gallery_id, $extras = NULL, $per_page = NULL, $page = NULL) {
 790              /* https://www.flickr.com/services/api/flickr.galleries.getPhotos.html */
 791              return $this->call('flickr.galleries.getPhotos', array('gallery_id' => $gallery_id, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
 792          }
 793  
 794          /* Groups Methods */
 795  		function groups_browse ($cat_id = NULL) {
 796              /* https://www.flickr.com/services/api/flickr.groups.browse.html */
 797              $this->request("flickr.groups.browse", array("cat_id"=>$cat_id));
 798              return $this->parsed_response ? $this->parsed_response['category'] : false;
 799          }
 800  
 801  		function groups_getInfo ($group_id, $lang = NULL) {
 802              /* https://www.flickr.com/services/api/flickr.groups.getInfo.html */
 803              return $this->call('flickr.groups.getInfo', array('group_id' => $group_id, 'lang' => $lang));
 804          }
 805  
 806  		function groups_search ($text, $per_page = NULL, $page = NULL) {
 807              /* https://www.flickr.com/services/api/flickr.groups.search.html */
 808              $this->request("flickr.groups.search", array("text"=>$text,"per_page"=>$per_page,"page"=>$page));
 809              return $this->parsed_response ? $this->parsed_response['groups'] : false;
 810          }
 811  
 812          /* Groups Members Methods */
 813  		function groups_members_getList ($group_id, $membertypes = NULL, $per_page = NULL, $page = NULL) {
 814              /* https://www.flickr.com/services/api/flickr.groups.members.getList.html */
 815              return $this->call('flickr.groups.members.getList', array('group_id' => $group_id, 'membertypes' => $membertypes, 'per_page' => $per_page, 'page' => $page));
 816          }
 817          
 818          /* Groups Pools Methods */
 819  		function groups_pools_add ($photo_id, $group_id) {
 820              /* https://www.flickr.com/services/api/flickr.groups.pools.add.html */
 821              $this->request("flickr.groups.pools.add", array("photo_id"=>$photo_id, "group_id"=>$group_id), TRUE);
 822              return $this->parsed_response ? true : false;
 823          }
 824  
 825  		function groups_pools_getContext ($photo_id, $group_id, $num_prev = NULL, $num_next = NULL) {
 826              /* https://www.flickr.com/services/api/flickr.groups.pools.getContext.html */
 827              return $this->call('flickr.groups.pools.getContext', array('photo_id' => $photo_id, 'group_id' => $group_id, 'num_prev' => $num_prev, 'num_next' => $num_next));
 828          }
 829          
 830  		function groups_pools_getGroups ($page = NULL, $per_page = NULL) {
 831              /* https://www.flickr.com/services/api/flickr.groups.pools.getGroups.html */
 832              $this->request("flickr.groups.pools.getGroups", array('page'=>$page, 'per_page'=>$per_page));
 833              return $this->parsed_response ? $this->parsed_response['groups'] : false;
 834          }
 835  
 836  		function groups_pools_getPhotos ($group_id, $tags = NULL, $user_id = NULL, $jump_to = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
 837              /* https://www.flickr.com/services/api/flickr.groups.pools.getPhotos.html */
 838              if (is_array($extras)) {
 839                  $extras = implode(",", $extras);
 840              }
 841              return $this->call('flickr.groups.pools.getPhotos', array('group_id' => $group_id, 'tags' => $tags, 'user_id' => $user_id, 'jump_to' => $jump_to, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
 842          }
 843  
 844  		function groups_pools_remove ($photo_id, $group_id) {
 845              /* https://www.flickr.com/services/api/flickr.groups.pools.remove.html */
 846              $this->request("flickr.groups.pools.remove", array("photo_id"=>$photo_id, "group_id"=>$group_id), TRUE);
 847              return $this->parsed_response ? true : false;
 848          }
 849  
 850          /* Interestingness methods */
 851  		function interestingness_getList ($date = NULL, $use_panda = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
 852              /* https://www.flickr.com/services/api/flickr.interestingness.getList.html */
 853              if (is_array($extras)) {
 854                  $extras = implode(",", $extras);
 855              }
 856  
 857              return $this->call('flickr.interestingness.getList', array('date' => $date, 'use_panda' => $use_panda, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
 858          }
 859  
 860          /* Machine Tag methods */
 861  		function machinetags_getNamespaces ($predicate = NULL, $per_page = NULL, $page = NULL) {
 862              /* https://www.flickr.com/services/api/flickr.machinetags.getNamespaces.html */
 863              return $this->call('flickr.machinetags.getNamespaces', array('predicate' => $predicate, 'per_page' => $per_page, 'page' => $page));
 864          }
 865  
 866  		function machinetags_getPairs ($namespace = NULL, $predicate = NULL, $per_page = NULL, $page = NULL) {
 867              /* https://www.flickr.com/services/api/flickr.machinetags.getPairs.html */
 868              return $this->call('flickr.machinetags.getPairs', array('namespace' => $namespace, 'predicate' => $predicate, 'per_page' => $per_page, 'page' => $page));
 869          }
 870  
 871  		function machinetags_getPredicates ($namespace = NULL, $per_page = NULL, $page = NULL) {
 872              /* https://www.flickr.com/services/api/flickr.machinetags.getPredicates.html */
 873              return $this->call('flickr.machinetags.getPredicates', array('namespace' => $namespace, 'per_page' => $per_page, 'page' => $page));
 874          }
 875          
 876  		function machinetags_getRecentValues ($namespace = NULL, $predicate = NULL, $added_since = NULL) {
 877              /* https://www.flickr.com/services/api/flickr.machinetags.getRecentValues.html */
 878              return $this->call('flickr.machinetags.getRecentValues', array('namespace' => $namespace, 'predicate' => $predicate, 'added_since' => $added_since));
 879          }
 880  
 881  		function machinetags_getValues ($namespace, $predicate, $per_page = NULL, $page = NULL, $usage = NULL) {
 882              /* https://www.flickr.com/services/api/flickr.machinetags.getValues.html */
 883              return $this->call('flickr.machinetags.getValues', array('namespace' => $namespace, 'predicate' => $predicate, 'per_page' => $per_page, 'page' => $page, 'usage' => $usage));
 884          }
 885          
 886          /* Panda methods */
 887  		function panda_getList () {
 888              /* https://www.flickr.com/services/api/flickr.panda.getList.html */
 889              return $this->call('flickr.panda.getList', array());
 890          }
 891  
 892  		function panda_getPhotos ($panda_name, $extras = NULL, $per_page = NULL, $page = NULL) {
 893              /* https://www.flickr.com/services/api/flickr.panda.getPhotos.html */
 894              return $this->call('flickr.panda.getPhotos', array('panda_name' => $panda_name, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
 895          }
 896  
 897          /* People methods */
 898  		function people_findByEmail ($find_email) {
 899              /* https://www.flickr.com/services/api/flickr.people.findByEmail.html */
 900              $this->request("flickr.people.findByEmail", array("find_email"=>$find_email));
 901              return $this->parsed_response ? $this->parsed_response['user'] : false;
 902          }
 903  
 904  		function people_findByUsername ($username) {
 905              /* https://www.flickr.com/services/api/flickr.people.findByUsername.html */
 906              $this->request("flickr.people.findByUsername", array("username"=>$username));
 907              return $this->parsed_response ? $this->parsed_response['user'] : false;
 908          }
 909  
 910  		function people_getInfo ($user_id) {
 911              /* https://www.flickr.com/services/api/flickr.people.getInfo.html */
 912              $this->request("flickr.people.getInfo", array("user_id"=>$user_id));
 913              return $this->parsed_response ? $this->parsed_response['person'] : false;
 914          }
 915  
 916  		function people_getPhotos ($user_id, $args = array()) {
 917              /* This function strays from the method of arguments that I've
 918               * used in the other functions for the fact that there are just
 919               * so many arguments to this API method. What you'll need to do
 920               * is pass an associative array to the function containing the
 921               * arguments you want to pass to the API.  For example:
 922               *   $photos = $f->photos_search(array("tags"=>"brown,cow", "tag_mode"=>"any"));
 923               * This will return photos tagged with either "brown" or "cow"
 924               * or both. See the API documentation (link below) for a full
 925               * list of arguments.
 926               */
 927  
 928               /* https://www.flickr.com/services/api/flickr.people.getPhotos.html */
 929              return $this->call('flickr.people.getPhotos', array_merge(array('user_id' => $user_id), $args));
 930          }
 931  
 932  		function people_getPhotosOf ($user_id, $extras = NULL, $per_page = NULL, $page = NULL) {
 933              /* https://www.flickr.com/services/api/flickr.people.getPhotosOf.html */
 934              return $this->call('flickr.people.getPhotosOf', array('user_id' => $user_id, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
 935          }
 936          
 937  		function people_getPublicGroups ($user_id) {
 938              /* https://www.flickr.com/services/api/flickr.people.getPublicGroups.html */
 939              $this->request("flickr.people.getPublicGroups", array("user_id"=>$user_id));
 940              return $this->parsed_response ? $this->parsed_response['groups']['group'] : false;
 941          }
 942  
 943  		function people_getPublicPhotos ($user_id, $safe_search = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
 944              /* https://www.flickr.com/services/api/flickr.people.getPublicPhotos.html */
 945              return $this->call('flickr.people.getPublicPhotos', array('user_id' => $user_id, 'safe_search' => $safe_search, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
 946          }
 947  
 948  		function people_getUploadStatus () {
 949              /* https://www.flickr.com/services/api/flickr.people.getUploadStatus.html */
 950              /* Requires Authentication */
 951              $this->request("flickr.people.getUploadStatus");
 952              return $this->parsed_response ? $this->parsed_response['user'] : false;
 953          }
 954  
 955  
 956          /* Photos Methods */
 957  		function photos_addTags ($photo_id, $tags) {
 958              /* https://www.flickr.com/services/api/flickr.photos.addTags.html */
 959              $this->request("flickr.photos.addTags", array("photo_id"=>$photo_id, "tags"=>$tags), TRUE);
 960              return $this->parsed_response ? true : false;
 961          }
 962  
 963  		function photos_delete ($photo_id) {
 964              /* https://www.flickr.com/services/api/flickr.photos.delete.html */
 965              $this->request("flickr.photos.delete", array("photo_id"=>$photo_id), TRUE);
 966              return $this->parsed_response ? true : false;
 967          }
 968  
 969  		function photos_getAllContexts ($photo_id) {
 970              /* https://www.flickr.com/services/api/flickr.photos.getAllContexts.html */
 971              $this->request("flickr.photos.getAllContexts", array("photo_id"=>$photo_id));
 972              return $this->parsed_response ? $this->parsed_response : false;
 973          }
 974  
 975  		function photos_getContactsPhotos ($count = NULL, $just_friends = NULL, $single_photo = NULL, $include_self = NULL, $extras = NULL) {
 976              /* https://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html */
 977              $this->request("flickr.photos.getContactsPhotos", array("count"=>$count, "just_friends"=>$just_friends, "single_photo"=>$single_photo, "include_self"=>$include_self, "extras"=>$extras));
 978              return $this->parsed_response ? $this->parsed_response['photos']['photo'] : false;
 979          }
 980  
 981  		function photos_getContactsPublicPhotos ($user_id, $count = NULL, $just_friends = NULL, $single_photo = NULL, $include_self = NULL, $extras = NULL) {
 982              /* https://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html */
 983              $this->request("flickr.photos.getContactsPublicPhotos", array("user_id"=>$user_id, "count"=>$count, "just_friends"=>$just_friends, "single_photo"=>$single_photo, "include_self"=>$include_self, "extras"=>$extras));
 984              return $this->parsed_response ? $this->parsed_response['photos']['photo'] : false;
 985          }
 986  
 987  		function photos_getContext ($photo_id, $num_prev = NULL, $num_next = NULL, $extras = NULL, $order_by = NULL) {
 988              /* https://www.flickr.com/services/api/flickr.photos.getContext.html */
 989              return $this->call('flickr.photos.getContext', array('photo_id' => $photo_id, 'num_prev' => $num_prev, 'num_next' => $num_next, 'extras' => $extras, 'order_by' => $order_by));
 990          }
 991  
 992  		function photos_getCounts ($dates = NULL, $taken_dates = NULL) {
 993              /* https://www.flickr.com/services/api/flickr.photos.getCounts.html */
 994              $this->request("flickr.photos.getCounts", array("dates"=>$dates, "taken_dates"=>$taken_dates));
 995              return $this->parsed_response ? $this->parsed_response['photocounts']['photocount'] : false;
 996          }
 997  
 998  		function photos_getExif ($photo_id, $secret = NULL) {
 999              /* https://www.flickr.com/services/api/flickr.photos.getExif.html */
1000              $this->request("flickr.photos.getExif", array("photo_id"=>$photo_id, "secret"=>$secret));
1001              return $this->parsed_response ? $this->parsed_response['photo'] : false;
1002          }
1003          
1004  		function photos_getFavorites ($photo_id, $page = NULL, $per_page = NULL) {
1005              /* https://www.flickr.com/services/api/flickr.photos.getFavorites.html */
1006              $this->request("flickr.photos.getFavorites", array("photo_id"=>$photo_id, "page"=>$page, "per_page"=>$per_page));
1007              return $this->parsed_response ? $this->parsed_response['photo'] : false;
1008          }
1009  
1010  		function photos_getInfo ($photo_id, $secret = NULL, $humandates = NULL, $privacy_filter = NULL, $get_contexts = NULL) {
1011              /* https://www.flickr.com/services/api/flickr.photos.getInfo.html */
1012              return $this->call('flickr.photos.getInfo', array('photo_id' => $photo_id, 'secret' => $secret, 'humandates' => $humandates, 'privacy_filter' => $privacy_filter, 'get_contexts' => $get_contexts));
1013          }
1014          
1015  		function photos_getNotInSet ($max_upload_date = NULL, $min_taken_date = NULL, $max_taken_date = NULL, $privacy_filter = NULL, $media = NULL, $min_upload_date = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
1016              /* https://www.flickr.com/services/api/flickr.photos.getNotInSet.html */
1017              return $this->call('flickr.photos.getNotInSet', array('max_upload_date' => $max_upload_date, 'min_taken_date' => $min_taken_date, 'max_taken_date' => $max_taken_date, 'privacy_filter' => $privacy_filter, 'media' => $media, 'min_upload_date' => $min_upload_date, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
1018          }
1019          
1020  		function photos_getPerms ($photo_id) {
1021              /* https://www.flickr.com/services/api/flickr.photos.getPerms.html */
1022              $this->request("flickr.photos.getPerms", array("photo_id"=>$photo_id));
1023              return $this->parsed_response ? $this->parsed_response['perms'] : false;
1024          }
1025  
1026  		function photos_getRecent ($jump_to = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
1027              /* https://www.flickr.com/services/api/flickr.photos.getRecent.html */
1028              if (is_array($extras)) {
1029                  $extras = implode(",", $extras);
1030              }
1031              return $this->call('flickr.photos.getRecent', array('jump_to' => $jump_to, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
1032          }
1033  
1034  		function photos_getSizes ($photo_id) {
1035              /* https://www.flickr.com/services/api/flickr.photos.getSizes.html */
1036              $this->request("flickr.photos.getSizes", array("photo_id"=>$photo_id));
1037              return $this->parsed_response ? $this->parsed_response['sizes']['size'] : false;
1038          }
1039  
1040  		function photos_getUntagged ($min_upload_date = NULL, $max_upload_date = NULL, $min_taken_date = NULL, $max_taken_date = NULL, $privacy_filter = NULL, $media = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
1041              /* https://www.flickr.com/services/api/flickr.photos.getUntagged.html */
1042              return $this->call('flickr.photos.getUntagged', array('min_upload_date' => $min_upload_date, 'max_upload_date' => $max_upload_date, 'min_taken_date' => $min_taken_date, 'max_taken_date' => $max_taken_date, 'privacy_filter' => $privacy_filter, 'media' => $media, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
1043          }
1044  
1045  		function photos_getWithGeoData ($args = array()) {
1046              /* See the documentation included with the photos_search() function.
1047               * I'm using the same style of arguments for this function. The only
1048               * difference here is that this doesn't require any arguments. The
1049               * flickr.photos.search method requires at least one search parameter.
1050               */
1051              /* https://www.flickr.com/services/api/flickr.photos.getWithGeoData.html */
1052              $this->request("flickr.photos.getWithGeoData", $args);
1053              return $this->parsed_response ? $this->parsed_response['photos'] : false;
1054          }
1055  
1056  		function photos_getWithoutGeoData ($args = array()) {
1057              /* See the documentation included with the photos_search() function.
1058               * I'm using the same style of arguments for this function. The only
1059               * difference here is that this doesn't require any arguments. The
1060               * flickr.photos.search method requires at least one search parameter.
1061               */
1062              /* https://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html */
1063              $this->request("flickr.photos.getWithoutGeoData", $args);
1064              return $this->parsed_response ? $this->parsed_response['photos'] : false;
1065          }
1066  
1067  		function photos_recentlyUpdated ($min_date, $extras = NULL, $per_page = NULL, $page = NULL) {
1068              /* https://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html */
1069              return $this->call('flickr.photos.recentlyUpdated', array('min_date' => $min_date, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
1070          }
1071  
1072  		function photos_removeTag ($tag_id) {
1073              /* https://www.flickr.com/services/api/flickr.photos.removeTag.html */
1074              $this->request("flickr.photos.removeTag", array("tag_id"=>$tag_id), TRUE);
1075              return $this->parsed_response ? true : false;
1076          }
1077  
1078  		function photos_search ($args = array()) {
1079              /* This function strays from the method of arguments that I've
1080               * used in the other functions for the fact that there are just
1081               * so many arguments to this API method. What you'll need to do
1082               * is pass an associative array to the function containing the
1083               * arguments you want to pass to the API.  For example:
1084               *   $photos = $f->photos_search(array("tags"=>"brown,cow", "tag_mode"=>"any"));
1085               * This will return photos tagged with either "brown" or "cow"
1086               * or both. See the API documentation (link below) for a full
1087               * list of arguments.
1088               */
1089  
1090              /* https://www.flickr.com/services/api/flickr.photos.search.html */
1091              $this->request("flickr.photos.search", $args);
1092              return $this->parsed_response ? $this->parsed_response['photos'] : false;
1093          }
1094  
1095  		function photos_setContentType ($photo_id, $content_type) {
1096              /* https://www.flickr.com/services/api/flickr.photos.setContentType.html */
1097              return $this->call('flickr.photos.setContentType', array('photo_id' => $photo_id, 'content_type' => $content_type));
1098          }
1099          
1100  		function photos_setDates ($photo_id, $date_posted = NULL, $date_taken = NULL, $date_taken_granularity = NULL) {
1101              /* https://www.flickr.com/services/api/flickr.photos.setDates.html */
1102              $this->request("flickr.photos.setDates", array("photo_id"=>$photo_id, "date_posted"=>$date_posted, "date_taken"=>$date_taken, "date_taken_granularity"=>$date_taken_granularity), TRUE);
1103              return $this->parsed_response ? true : false;
1104          }
1105  
1106  		function photos_setMeta ($photo_id, $title, $description) {
1107              /* https://www.flickr.com/services/api/flickr.photos.setMeta.html */
1108              $this->request("flickr.photos.setMeta", array("photo_id"=>$photo_id, "title"=>$title, "description"=>$description), TRUE);
1109              return $this->parsed_response ? true : false;
1110          }
1111  
1112  		function photos_setPerms ($photo_id, $is_public, $is_friend, $is_family, $perm_comment, $perm_addmeta) {
1113              /* https://www.flickr.com/services/api/flickr.photos.setPerms.html */
1114              $this->request("flickr.photos.setPerms", array("photo_id"=>$photo_id, "is_public"=>$is_public, "is_friend"=>$is_friend, "is_family"=>$is_family, "perm_comment"=>$perm_comment, "perm_addmeta"=>$perm_addmeta), TRUE);
1115              return $this->parsed_response ? true : false;
1116          }
1117  
1118  		function photos_setSafetyLevel ($photo_id, $safety_level = NULL, $hidden = NULL) {
1119              /* https://www.flickr.com/services/api/flickr.photos.setSafetyLevel.html */
1120              return $this->call('flickr.photos.setSafetyLevel', array('photo_id' => $photo_id, 'safety_level' => $safety_level, 'hidden' => $hidden));
1121          }
1122          
1123  		function photos_setTags ($photo_id, $tags) {
1124              /* https://www.flickr.com/services/api/flickr.photos.setTags.html */
1125              $this->request("flickr.photos.setTags", array("photo_id"=>$photo_id, "tags"=>$tags), TRUE);
1126              return $this->parsed_response ? true : false;
1127          }
1128  
1129          /* Photos - Comments Methods */
1130  		function photos_comments_addComment ($photo_id, $comment_text) {
1131              /* https://www.flickr.com/services/api/flickr.photos.comments.addComment.html */
1132              $this->request("flickr.photos.comments.addComment", array("photo_id" => $photo_id, "comment_text"=>$comment_text), TRUE);
1133              return $this->parsed_response ? $this->parsed_response['comment'] : false;
1134          }
1135  
1136  		function photos_comments_deleteComment ($comment_id) {
1137              /* https://www.flickr.com/services/api/flickr.photos.comments.deleteComment.html */
1138              $this->request("flickr.photos.comments.deleteComment", array("comment_id" => $comment_id), TRUE);
1139              return $this->parsed_response ? true : false;
1140          }
1141  
1142  		function photos_comments_editComment ($comment_id, $comment_text) {
1143              /* https://www.flickr.com/services/api/flickr.photos.comments.editComment.html */
1144              $this->request("flickr.photos.comments.editComment", array("comment_id" => $comment_id, "comment_text"=>$comment_text), TRUE);
1145              return $this->parsed_response ? true : false;
1146          }
1147  
1148  		function photos_comments_getList ($photo_id, $min_comment_date = NULL, $max_comment_date = NULL, $page = NULL, $per_page = NULL, $include_faves = NULL) {
1149              /* https://www.flickr.com/services/api/flickr.photos.comments.getList.html */
1150              return $this->call('flickr.photos.comments.getList', array('photo_id' => $photo_id, 'min_comment_date' => $min_comment_date, 'max_comment_date' => $max_comment_date, 'page' => $page, 'per_page' => $per_page, 'include_faves' => $include_faves));
1151          }
1152          
1153  		function photos_comments_getRecentForContacts ($date_lastcomment = NULL, $contacts_filter = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
1154              /* https://www.flickr.com/services/api/flickr.photos.comments.getRecentForContacts.html */
1155              return $this->call('flickr.photos.comments.getRecentForContacts', array('date_lastcomment' => $date_lastcomment, 'contacts_filter' => $contacts_filter, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
1156          }
1157  
1158          /* Photos - Geo Methods */
1159  		function photos_geo_batchCorrectLocation ($lat, $lon, $accuracy, $place_id = NULL, $woe_id = NULL) {
1160              /* https://www.flickr.com/services/api/flickr.photos.geo.batchCorrectLocation.html */
1161              return $this->call('flickr.photos.geo.batchCorrectLocation', array('lat' => $lat, 'lon' => $lon, 'accuracy' => $accuracy, 'place_id' => $place_id, 'woe_id' => $woe_id));
1162          }
1163  
1164  		function photos_geo_correctLocation ($photo_id, $place_id = NULL, $woe_id = NULL) {
1165              /* https://www.flickr.com/services/api/flickr.photos.geo.correctLocation.html */
1166              return $this->call('flickr.photos.geo.correctLocation', array('photo_id' => $photo_id, 'place_id' => $place_id, 'woe_id' => $woe_id));
1167          }
1168  
1169  		function photos_geo_getLocation ($photo_id) {
1170              /* https://www.flickr.com/services/api/flickr.photos.geo.getLocation.html */
1171              $this->request("flickr.photos.geo.getLocation", array("photo_id"=>$photo_id));
1172              return $this->parsed_response ? $this->parsed_response['photo'] : false;
1173          }
1174  
1175  		function photos_geo_getPerms ($photo_id) {
1176              /* https://www.flickr.com/services/api/flickr.photos.geo.getPerms.html */
1177              $this->request("flickr.photos.geo.getPerms", array("photo_id"=>$photo_id));
1178              return $this->parsed_response ? $this->parsed_response['perms'] : false;
1179          }
1180          
1181  		function photos_geo_photosForLocation ($lat, $lon, $accuracy = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
1182              /* https://www.flickr.com/services/api/flickr.photos.geo.photosForLocation.html */
1183              return $this->call('flickr.photos.geo.photosForLocation', array('lat' => $lat, 'lon' => $lon, 'accuracy' => $accuracy, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
1184          }
1185  
1186  		function photos_geo_removeLocation ($photo_id) {
1187              /* https://www.flickr.com/services/api/flickr.photos.geo.removeLocation.html */
1188              $this->request("flickr.photos.geo.removeLocation", array("photo_id"=>$photo_id), TRUE);
1189              return $this->parsed_response ? true : false;
1190          }
1191  
1192  		function photos_geo_setContext ($photo_id, $context) {
1193              /* https://www.flickr.com/services/api/flickr.photos.geo.setContext.html */
1194              return $this->call('flickr.photos.geo.setContext', array('photo_id' => $photo_id, 'context' => $context));
1195          }
1196  
1197  		function photos_geo_setLocation ($photo_id, $lat, $lon, $accuracy = NULL, $context = NULL, $bookmark_id = NULL) {
1198              /* https://www.flickr.com/services/api/flickr.photos.geo.setLocation.html */
1199              return $this->call('flickr.photos.geo.setLocation', array('photo_id' => $photo_id, 'lat' => $lat, 'lon' => $lon, 'accuracy' => $accuracy, 'context' => $context, 'bookmark_id' => $bookmark_id));
1200          }
1201          
1202  		function photos_geo_setPerms ($is_public, $is_contact, $is_friend, $is_family, $photo_id) {
1203              /* https://www.flickr.com/services/api/flickr.photos.geo.setPerms.html */
1204              return $this->call('flickr.photos.geo.setPerms', array('is_public' => $is_public, 'is_contact' => $is_contact, 'is_friend' => $is_friend, 'is_family' => $is_family, 'photo_id' => $photo_id));
1205          }
1206  
1207          /* Photos - Licenses Methods */
1208  		function photos_licenses_getInfo () {
1209              /* https://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html */
1210              $this->request("flickr.photos.licenses.getInfo");
1211              return $this->parsed_response ? $this->parsed_response['licenses']['license'] : false;
1212          }
1213  
1214  		function photos_licenses_setLicense ($photo_id, $license_id) {
1215              /* https://www.flickr.com/services/api/flickr.photos.licenses.setLicense.html */
1216              /* Requires Authentication */
1217              $this->request("flickr.photos.licenses.setLicense", array("photo_id"=>$photo_id, "license_id"=>$license_id), TRUE);
1218              return $this->parsed_response ? true : false;
1219          }
1220  
1221          /* Photos - Notes Methods */
1222  		function photos_notes_add ($photo_id, $note_x, $note_y, $note_w, $note_h, $note_text) {
1223              /* https://www.flickr.com/services/api/flickr.photos.notes.add.html */
1224              $this->request("flickr.photos.notes.add", array("photo_id" => $photo_id, "note_x" => $note_x, "note_y" => $note_y, "note_w" => $note_w, "note_h" => $note_h, "note_text" => $note_text), TRUE);
1225              return $this->parsed_response ? $this->parsed_response['note'] : false;
1226          }
1227  
1228  		function photos_notes_delete ($note_id) {
1229              /* https://www.flickr.com/services/api/flickr.photos.notes.delete.html */
1230              $this->request("flickr.photos.notes.delete", array("note_id" => $note_id), TRUE);
1231              return $this->parsed_response ? true : false;
1232          }
1233  
1234  		function photos_notes_edit ($note_id, $note_x, $note_y, $note_w, $note_h, $note_text) {
1235              /* https://www.flickr.com/services/api/flickr.photos.notes.edit.html */
1236              $this->request("flickr.photos.notes.edit", array("note_id" => $note_id, "note_x" => $note_x, "note_y" => $note_y, "note_w" => $note_w, "note_h" => $note_h, "note_text" => $note_text), TRUE);
1237              return $this->parsed_response ? true : false;
1238          }
1239  
1240          /* Photos - Transform Methods */
1241  		function photos_transform_rotate ($photo_id, $degrees) {
1242              /* https://www.flickr.com/services/api/flickr.photos.transform.rotate.html */
1243              $this->request("flickr.photos.transform.rotate", array("photo_id" => $photo_id, "degrees" => $degrees), TRUE);
1244              return $this->parsed_response ? true : false;
1245          }
1246  
1247          /* Photos - People Methods */
1248  		function photos_people_add ($photo_id, $user_id, $person_x = NULL, $person_y = NULL, $person_w = NULL, $person_h = NULL) {
1249              /* https://www.flickr.com/services/api/flickr.photos.people.add.html */
1250              return $this->call('flickr.photos.people.add', array('photo_id' => $photo_id, 'user_id' => $user_id, 'person_x' => $person_x, 'person_y' => $person_y, 'person_w' => $person_w, 'person_h' => $person_h));
1251          }
1252  
1253  		function photos_people_delete ($photo_id, $user_id, $email = NULL) {
1254              /* https://www.flickr.com/services/api/flickr.photos.people.delete.html */
1255              return $this->call('flickr.photos.people.delete', array('photo_id' => $photo_id, 'user_id' => $user_id, 'email' => $email));
1256          }
1257          
1258  		function photos_people_deleteCoords ($photo_id, $user_id) {
1259              /* https://www.flickr.com/services/api/flickr.photos.people.deleteCoords.html */
1260              return $this->call('flickr.photos.people.deleteCoords', array('photo_id' => $photo_id, 'user_id' => $user_id));
1261          }
1262  
1263  		function photos_people_editCoords ($photo_id, $user_id, $person_x, $person_y, $person_w, $person_h, $email = NULL) {
1264              /* https://www.flickr.com/services/api/flickr.photos.people.editCoords.html */
1265              return $this->call('flickr.photos.people.editCoords', array('photo_id' => $photo_id, 'user_id' => $user_id, 'person_x' => $person_x, 'person_y' => $person_y, 'person_w' => $person_w, 'person_h' => $person_h, 'email' => $email));
1266          }
1267          
1268  		function photos_people_getList ($photo_id) {
1269              /* https://www.flickr.com/services/api/flickr.photos.people.getList.html */
1270              return $this->call('flickr.photos.people.getList', array('photo_id' => $photo_id));
1271          }
1272          
1273          /* Photos - Upload Methods */
1274  		function photos_upload_checkTickets ($tickets) {
1275              /* https://www.flickr.com/services/api/flickr.photos.upload.checkTickets.html */
1276              if (is_array($tickets)) {
1277                  $tickets = implode(",", $tickets);
1278              }
1279              $this->request("flickr.photos.upload.checkTickets", array("tickets" => $tickets), TRUE);
1280              return $this->parsed_response ? $this->parsed_response['uploader']['ticket'] : false;
1281          }
1282  
1283          /* Photosets Methods */
1284  		function photosets_addPhoto ($photoset_id, $photo_id) {
1285              /* https://www.flickr.com/services/api/flickr.photosets.addPhoto.html */
1286              $this->request("flickr.photosets.addPhoto", array("photoset_id" => $photoset_id, "photo_id" => $photo_id), TRUE);
1287              return $this->parsed_response ? true : false;
1288          }
1289  
1290  		function photosets_create ($title, $description, $primary_photo_id) {
1291              /* https://www.flickr.com/services/api/flickr.photosets.create.html */
1292              $this->request("flickr.photosets.create", array("title" => $title, "primary_photo_id" => $primary_photo_id, "description" => $description), TRUE);
1293              return $this->parsed_response ? $this->parsed_response['photoset'] : false;
1294          }
1295  
1296  		function photosets_delete ($photoset_id) {
1297              /* https://www.flickr.com/services/api/flickr.photosets.delete.html */
1298              $this->request("flickr.photosets.delete", array("photoset_id" => $photoset_id), TRUE);
1299              return $this->parsed_response ? true : false;
1300          }
1301  
1302  		function photosets_editMeta ($photoset_id, $title, $description = NULL) {
1303              /* https://www.flickr.com/services/api/flickr.photosets.editMeta.html */
1304              $this->request("flickr.photosets.editMeta", array("photoset_id" => $photoset_id, "title" => $title, "description" => $description), TRUE);
1305              return $this->parsed_response ? true : false;
1306          }
1307  
1308  		function photosets_editPhotos ($photoset_id, $primary_photo_id, $photo_ids) {
1309              /* https://www.flickr.com/services/api/flickr.photosets.editPhotos.html */
1310              $this->request("flickr.photosets.editPhotos", array("photoset_id" => $photoset_id, "primary_photo_id" => $primary_photo_id, "photo_ids" => $photo_ids), TRUE);
1311              return $this->parsed_response ? true : false;
1312          }
1313  
1314  		function photosets_getContext ($photo_id, $photoset_id, $num_prev = NULL, $num_next = NULL) {
1315              /* https://www.flickr.com/services/api/flickr.photosets.getContext.html */
1316              return $this->call('flickr.photosets.getContext', array('photo_id' => $photo_id, 'photoset_id' => $photoset_id, 'num_prev' => $num_prev, 'num_next' => $num_next));
1317          }
1318          
1319  		function photosets_getInfo ($photoset_id) {
1320              /* https://www.flickr.com/services/api/flickr.photosets.getInfo.html */
1321              $this->request("flickr.photosets.getInfo", array("photoset_id" => $photoset_id));
1322              return $this->parsed_response ? $this->parsed_response['photoset'] : false;
1323          }
1324  
1325  		function photosets_getList ($user_id = NULL) {
1326              /* https://www.flickr.com/services/api/flickr.photosets.getList.html */
1327              $this->request("flickr.photosets.getList", array("user_id" => $user_id));
1328              return $this->parsed_response ? $this->parsed_response['photosets'] : false;
1329          }
1330  
1331  		function photosets_getPhotos ($photoset_id, $extras = NULL, $privacy_filter = NULL, $per_page = NULL, $page = NULL, $media = NULL) {
1332              /* https://www.flickr.com/services/api/flickr.photosets.getPhotos.html */
1333              return $this->call('flickr.photosets.getPhotos', array('photoset_id' => $photoset_id, 'extras' => $extras, 'privacy_filter' => $privacy_filter, 'per_page' => $per_page, 'page' => $page, 'media' => $media));
1334          }
1335  
1336  		function photosets_orderSets ($photoset_ids) {
1337              /* https://www.flickr.com/services/api/flickr.photosets.orderSets.html */
1338              if (is_array($photoset_ids)) {
1339                  $photoset_ids = implode(",", $photoset_ids);
1340              }
1341              $this->request("flickr.photosets.orderSets", array("photoset_ids" => $photoset_ids), TRUE);
1342              return $this->parsed_response ? true : false;
1343          }
1344  
1345  		function photosets_removePhoto ($photoset_id, $photo_id) {
1346              /* https://www.flickr.com/services/api/flickr.photosets.removePhoto.html */
1347              $this->request("flickr.photosets.removePhoto", array("photoset_id" => $photoset_id, "photo_id" => $photo_id), TRUE);
1348              return $this->parsed_response ? true : false;
1349          }
1350          
1351  		function photosets_removePhotos ($photoset_id, $photo_ids) {
1352              /* https://www.flickr.com/services/api/flickr.photosets.removePhotos.html */
1353              return $this->call('flickr.photosets.removePhotos', array('photoset_id' => $photoset_id, 'photo_ids' => $photo_ids));
1354          }
1355          
1356  		function photosets_reorderPhotos ($photoset_id, $photo_ids) {
1357              /* https://www.flickr.com/services/api/flickr.photosets.reorderPhotos.html */
1358              return $this->call('flickr.photosets.reorderPhotos', array('photoset_id' => $photoset_id, 'photo_ids' => $photo_ids));
1359          }
1360          
1361  		function photosets_setPrimaryPhoto ($photoset_id, $photo_id) {
1362              /* https://www.flickr.com/services/api/flickr.photosets.setPrimaryPhoto.html */
1363              return $this->call('flickr.photosets.setPrimaryPhoto', array('photoset_id' => $photoset_id, 'photo_id' => $photo_id));
1364          }
1365  
1366          /* Photosets Comments Methods */
1367  		function photosets_comments_addComment ($photoset_id, $comment_text) {
1368              /* https://www.flickr.com/services/api/flickr.photosets.comments.addComment.html */
1369              $this->request("flickr.photosets.comments.addComment", array("photoset_id" => $photoset_id, "comment_text"=>$comment_text), TRUE);
1370              return $this->parsed_response ? $this->parsed_response['comment'] : false;
1371          }
1372  
1373  		function photosets_comments_deleteComment ($comment_id) {
1374              /* https://www.flickr.com/services/api/flickr.photosets.comments.deleteComment.html */
1375              $this->request("flickr.photosets.comments.deleteComment", array("comment_id" => $comment_id), TRUE);
1376              return $this->parsed_response ? true : false;
1377          }
1378  
1379  		function photosets_comments_editComment ($comment_id, $comment_text) {
1380              /* https://www.flickr.com/services/api/flickr.photosets.comments.editComment.html */
1381              $this->request("flickr.photosets.comments.editComment", array("comment_id" => $comment_id, "comment_text"=>$comment_text), TRUE);
1382              return $this->parsed_response ? true : false;
1383          }
1384  
1385  		function photosets_comments_getList ($photoset_id) {
1386              /* https://www.flickr.com/services/api/flickr.photosets.comments.getList.html */
1387              $this->request("flickr.photosets.comments.getList", array("photoset_id"=>$photoset_id));
1388              return $this->parsed_response ? $this->parsed_response['comments'] : false;
1389          }
1390          
1391          /* Places Methods */
1392  		function places_find ($query) {
1393              /* https://www.flickr.com/services/api/flickr.places.find.html */
1394              return $this->call('flickr.places.find', array('query' => $query));
1395          }
1396  
1397  		function places_findByLatLon ($lat, $lon, $accuracy = NULL) {
1398              /* https://www.flickr.com/services/api/flickr.places.findByLatLon.html */
1399              return $this->call('flickr.places.findByLatLon', array('lat' => $lat, 'lon' => $lon, 'accuracy' => $accuracy));
1400          }
1401  
1402  		function places_getChildrenWithPhotosPublic ($place_id = NULL, $woe_id = NULL) {
1403              /* https://www.flickr.com/services/api/flickr.places.getChildrenWithPhotosPublic.html */
1404              return $this->call('flickr.places.getChildrenWithPhotosPublic', array('place_id' => $place_id, 'woe_id' => $woe_id));
1405          }
1406  
1407  		function places_getInfo ($place_id = NULL, $woe_id = NULL) {
1408              /* https://www.flickr.com/services/api/flickr.places.getInfo.html */
1409              return $this->call('flickr.places.getInfo', array('place_id' => $place_id, 'woe_id' => $woe_id));
1410          }
1411  
1412  		function places_getInfoByUrl ($url) {
1413              /* https://www.flickr.com/services/api/flickr.places.getInfoByUrl.html */
1414              return $this->call('flickr.places.getInfoByUrl', array('url' => $url));
1415          }
1416          
1417  		function places_getPlaceTypes () {
1418              /* https://www.flickr.com/services/api/flickr.places.getPlaceTypes.html */
1419              return $this->call('flickr.places.getPlaceTypes', array());
1420          }
1421          
1422  		function places_getShapeHistory ($place_id = NULL, $woe_id = NULL) {
1423              /* https://www.flickr.com/services/api/flickr.places.getShapeHistory.html */
1424              return $this->call('flickr.places.getShapeHistory', array('place_id' => $place_id, 'woe_id' => $woe_id));
1425          }
1426  
1427  		function places_getTopPlacesList ($place_type_id, $date = NULL, $woe_id = NULL, $place_id = NULL) {
1428              /* https://www.flickr.com/services/api/flickr.places.getTopPlacesList.html */
1429              return $this->call('flickr.places.getTopPlacesList', array('place_type_id' => $place_type_id, 'date' => $date, 'woe_id' => $woe_id, 'place_id' => $place_id));
1430          }
1431          
1432  		function places_placesForBoundingBox ($bbox, $place_type = NULL, $place_type_id = NULL, $recursive = NULL) {
1433              /* https://www.flickr.com/services/api/flickr.places.placesForBoundingBox.html */
1434              return $this->call('flickr.places.placesForBoundingBox', array('bbox' => $bbox, 'place_type' => $place_type, 'place_type_id' => $place_type_id, 'recursive' => $recursive));
1435          }
1436  
1437  		function places_placesForContacts ($place_type = NULL, $place_type_id = NULL, $woe_id = NULL, $place_id = NULL, $threshold = NULL, $contacts = NULL, $min_upload_date = NULL, $max_upload_date = NULL, $min_taken_date = NULL, $max_taken_date = NULL) {
1438              /* https://www.flickr.com/services/api/flickr.places.placesForContacts.html */
1439              return $this->call('flickr.places.placesForContacts', array('place_type' => $place_type, 'place_type_id' => $place_type_id, 'woe_id' => $woe_id, 'place_id' => $place_id, 'threshold' => $threshold, 'contacts' => $contacts, 'min_upload_date' => $min_upload_date, 'max_upload_date' => $max_upload_date, 'min_taken_date' => $min_taken_date, 'max_taken_date' => $max_taken_date));
1440          }
1441  
1442  		function places_placesForTags ($place_type_id, $woe_id = NULL, $place_id = NULL, $threshold = NULL, $tags = NULL, $tag_mode = NULL, $machine_tags = NULL, $machine_tag_mode = NULL, $min_upload_date = NULL, $max_upload_date = NULL, $min_taken_date = NULL, $max_taken_date = NULL) {
1443              /* https://www.flickr.com/services/api/flickr.places.placesForTags.html */
1444              return $this->call('flickr.places.placesForTags', array('place_type_id' => $place_type_id, 'woe_id' => $woe_id, 'place_id' => $place_id, 'threshold' => $threshold, 'tags' => $tags, 'tag_mode' => $tag_mode, 'machine_tags' => $machine_tags, 'machine_tag_mode' => $machine_tag_mode, 'min_upload_date' => $min_upload_date, 'max_upload_date' => $max_upload_date, 'min_taken_date' => $min_taken_date, 'max_taken_date' => $max_taken_date));
1445          }
1446  
1447  		function places_placesForUser ($place_type_id = NULL, $place_type = NULL, $woe_id = NULL, $place_id = NULL, $threshold = NULL, $min_upload_date = NULL, $max_upload_date = NULL, $min_taken_date = NULL, $max_taken_date = NULL) {
1448              /* https://www.flickr.com/services/api/flickr.places.placesForUser.html */
1449              return $this->call('flickr.places.placesForUser', array('place_type_id' => $place_type_id, 'place_type' => $place_type, 'woe_id' => $woe_id, 'place_id' => $place_id, 'threshold' => $threshold, 'min_upload_date' => $min_upload_date, 'max_upload_date' => $max_upload_date, 'min_taken_date' => $min_taken_date, 'max_taken_date' => $max_taken_date));
1450          }
1451          
1452  		function places_resolvePlaceId ($place_id) {
1453              /* https://www.flickr.com/services/api/flickr.places.resolvePlaceId.html */
1454              $rsp = $this->call('flickr.places.resolvePlaceId', array('place_id' => $place_id));
1455              return $rsp ? $rsp['location'] : $rsp;
1456          }
1457          
1458  		function places_resolvePlaceURL ($url) {
1459              /* https://www.flickr.com/services/api/flickr.places.resolvePlaceURL.html */
1460              $rsp = $this->call('flickr.places.resolvePlaceURL', array('url' => $url));
1461              return $rsp ? $rsp['location'] : $rsp;
1462          }
1463          
1464  		function places_tagsForPlace ($woe_id = NULL, $place_id = NULL, $min_upload_date = NULL, $max_upload_date = NULL, $min_taken_date = NULL, $max_taken_date = NULL) {
1465              /* https://www.flickr.com/services/api/flickr.places.tagsForPlace.html */
1466              return $this->call('flickr.places.tagsForPlace', array('woe_id' => $woe_id, 'place_id' => $place_id, 'min_upload_date' => $min_upload_date, 'max_upload_date' => $max_upload_date, 'min_taken_date' => $min_taken_date, 'max_taken_date' => $max_taken_date));
1467          }
1468  
1469          /* Prefs Methods */
1470  		function prefs_getContentType () {
1471              /* https://www.flickr.com/services/api/flickr.prefs.getContentType.html */
1472              $rsp = $this->call('flickr.prefs.getContentType', array());
1473              return $rsp ? $rsp['person'] : $rsp;
1474          }
1475          
1476  		function prefs_getGeoPerms () {
1477              /* https://www.flickr.com/services/api/flickr.prefs.getGeoPerms.html */
1478              return $this->call('flickr.prefs.getGeoPerms', array());
1479          }
1480          
1481  		function prefs_getHidden () {
1482              /* https://www.flickr.com/services/api/flickr.prefs.getHidden.html */
1483              $rsp = $this->call('flickr.prefs.getHidden', array());
1484              return $rsp ? $rsp['person'] : $rsp;
1485          }
1486          
1487  		function prefs_getPrivacy () {
1488              /* https://www.flickr.com/services/api/flickr.prefs.getPrivacy.html */
1489              $rsp = $this->call('flickr.prefs.getPrivacy', array());
1490              return $rsp ? $rsp['person'] : $rsp;
1491          }
1492          
1493  		function prefs_getSafetyLevel () {
1494              /* https://www.flickr.com/services/api/flickr.prefs.getSafetyLevel.html */
1495              $rsp = $this->call('flickr.prefs.getSafetyLevel', array());
1496              return $rsp ? $rsp['person'] : $rsp;
1497          }
1498  
1499          /* Reflection Methods */
1500  		function reflection_getMethodInfo ($method_name) {
1501              /* https://www.flickr.com/services/api/flickr.reflection.getMethodInfo.html */
1502              $this->request("flickr.reflection.getMethodInfo", array("method_name" => $method_name));
1503              return $this->parsed_response ? $this->parsed_response : false;
1504          }
1505  
1506  		function reflection_getMethods () {
1507              /* https://www.flickr.com/services/api/flickr.reflection.getMethods.html */
1508              $this->request("flickr.reflection.getMethods");
1509              return $this->parsed_response ? $this->parsed_response['methods']['method'] : false;
1510          }
1511  
1512          /* Stats Methods */
1513  		function stats_getCollectionDomains ($date, $collection_id = NULL, $per_page = NULL, $page = NULL) {
1514              /* https://www.flickr.com/services/api/flickr.stats.getCollectionDomains.html */
1515              return $this->call('flickr.stats.getCollectionDomains', array('date' => $date, 'collection_id' => $collection_id, 'per_page' => $per_page, 'page' => $page));
1516          }
1517  
1518  		function stats_getCollectionReferrers ($date, $domain, $collection_id = NULL, $per_page = NULL, $page = NULL) {
1519              /* https://www.flickr.com/services/api/flickr.stats.getCollectionReferrers.html */
1520              return $this->call('flickr.stats.getCollectionReferrers', array('date' => $date, 'domain' => $domain, 'collection_id' => $collection_id, 'per_page' => $per_page, 'page' => $page));
1521          }
1522  
1523  		function stats_getCollectionStats ($date, $collection_id) {
1524              /* https://www.flickr.com/services/api/flickr.stats.getCollectionStats.html */
1525              return $this->call('flickr.stats.getCollectionStats', array('date' => $date, 'collection_id' => $collection_id));
1526          }
1527          
1528  		function stats_getCSVFiles () {
1529              /* https://www.flickr.com/services/api/flickr.stats.getCSVFiles.html */
1530              return $this->call('flickr.stats.getCSVFiles', array());
1531          }
1532  
1533  		function stats_getPhotoDomains ($date, $photo_id = NULL, $per_page = NULL, $page = NULL) {
1534              /* https://www.flickr.com/services/api/flickr.stats.getPhotoDomains.html */
1535              return $this->call('flickr.stats.getPhotoDomains', array('date' => $date, 'photo_id' => $photo_id, 'per_page' => $per_page, 'page' => $page));
1536          }
1537  
1538  		function stats_getPhotoReferrers ($date, $domain, $photo_id = NULL, $per_page = NULL, $page = NULL) {
1539              /* https://www.flickr.com/services/api/flickr.stats.getPhotoReferrers.html */
1540              return $this->call('flickr.stats.getPhotoReferrers', array('date' => $date, 'domain' => $domain, 'photo_id' => $photo_id, 'per_page' => $per_page, 'page' => $page));
1541          }
1542  
1543  		function stats_getPhotosetDomains ($date, $photoset_id = NULL, $per_page = NULL, $page = NULL) {
1544              /* https://www.flickr.com/services/api/flickr.stats.getPhotosetDomains.html */
1545              return $this->call('flickr.stats.getPhotosetDomains', array('date' => $date, 'photoset_id' => $photoset_id, 'per_page' => $per_page, 'page' => $page));
1546          }
1547  
1548  		function stats_getPhotosetReferrers ($date, $domain, $photoset_id = NULL, $per_page = NULL, $page = NULL) {
1549              /* https://www.flickr.com/services/api/flickr.stats.getPhotosetReferrers.html */
1550              return $this->call('flickr.stats.getPhotosetReferrers', array('date' => $date, 'domain' => $domain, 'photoset_id' => $photoset_id, 'per_page' => $per_page, 'page' => $page));
1551          }
1552  
1553  		function stats_getPhotosetStats ($date, $photoset_id) {
1554              /* https://www.flickr.com/services/api/flickr.stats.getPhotosetStats.html */
1555              return $this->call('flickr.stats.getPhotosetStats', array('date' => $date, 'photoset_id' => $photoset_id));
1556          }
1557  
1558  		function stats_getPhotoStats ($date, $photo_id) {
1559              /* https://www.flickr.com/services/api/flickr.stats.getPhotoStats.html */
1560              return $this->call('flickr.stats.getPhotoStats', array('date' => $date, 'photo_id' => $photo_id));
1561          }
1562  
1563  		function stats_getPhotostreamDomains ($date, $per_page = NULL, $page = NULL) {
1564              /* https://www.flickr.com/services/api/flickr.stats.getPhotostreamDomains.html */
1565              return $this->call('flickr.stats.getPhotostreamDomains', array('date' => $date, 'per_page' => $per_page, 'page' => $page));
1566          }
1567  
1568  		function stats_getPhotostreamReferrers ($date, $domain, $per_page = NULL, $page = NULL) {
1569              /* https://www.flickr.com/services/api/flickr.stats.getPhotostreamReferrers.html */
1570              return $this->call('flickr.stats.getPhotostreamReferrers', array('date' => $date, 'domain' => $domain, 'per_page' => $per_page, 'page' => $page));
1571          }
1572  
1573  		function stats_getPhotostreamStats ($date) {
1574              /* https://www.flickr.com/services/api/flickr.stats.getPhotostreamStats.html */
1575              return $this->call('flickr.stats.getPhotostreamStats', array('date' => $date));
1576          }
1577  
1578  		function stats_getPopularPhotos ($date = NULL, $sort = NULL, $per_page = NULL, $page = NULL) {
1579              /* https://www.flickr.com/services/api/flickr.stats.getPopularPhotos.html */
1580              return $this->call('flickr.stats.getPopularPhotos', array('date' => $date, 'sort' => $sort, 'per_page' => $per_page, 'page' => $page));
1581          }
1582  
1583  		function stats_getTotalViews ($date = NULL) {
1584              /* https://www.flickr.com/services/api/flickr.stats.getTotalViews.html */
1585              return $this->call('flickr.stats.getTotalViews', array('date' => $date));
1586          }
1587          
1588          /* Tags Methods */
1589  		function tags_getClusterPhotos ($tag, $cluster_id) {
1590              /* https://www.flickr.com/services/api/flickr.tags.getClusterPhotos.html */
1591              return $this->call('flickr.tags.getClusterPhotos', array('tag' => $tag, 'cluster_id' => $cluster_id));
1592          }
1593  
1594  		function tags_getClusters ($tag) {
1595              /* https://www.flickr.com/services/api/flickr.tags.getClusters.html */
1596              return $this->call('flickr.tags.getClusters', array('tag' => $tag));
1597          }
1598  
1599  		function tags_getHotList ($period = NULL, $count = NULL) {
1600              /* https://www.flickr.com/services/api/flickr.tags.getHotList.html */
1601              $this->request("flickr.tags.getHotList", array("period" => $period, "count" => $count));
1602              return $this->parsed_response ? $this->parsed_response['hottags'] : false;
1603          }
1604  
1605  		function tags_getListPhoto ($photo_id) {
1606              /* https://www.flickr.com/services/api/flickr.tags.getListPhoto.html */
1607              $this->request("flickr.tags.getListPhoto", array("photo_id" => $photo_id));
1608              return $this->parsed_response ? $this->parsed_response['photo']['tags']['tag'] : false;
1609          }
1610  
1611  		function tags_getListUser ($user_id = NULL) {
1612              /* https://www.flickr.com/services/api/flickr.tags.getListUser.html */
1613              $this->request("flickr.tags.getListUser", array("user_id" => $user_id));
1614              return $this->parsed_response ? $this->parsed_response['who']['tags']['tag'] : false;
1615          }
1616  
1617  		function tags_getListUserPopular ($user_id = NULL, $count = NULL) {
1618              /* https://www.flickr.com/services/api/flickr.tags.getListUserPopular.html */
1619              $this->request("flickr.tags.getListUserPopular", array("user_id" => $user_id, "count" => $count));
1620              return $this->parsed_response ? $this->parsed_response['who']['tags']['tag'] : false;
1621          }
1622  
1623  		function tags_getListUserRaw ($tag = NULL) {
1624              /* https://www.flickr.com/services/api/flickr.tags.getListUserRaw.html */
1625              return $this->call('flickr.tags.getListUserRaw', array('tag' => $tag));
1626          }
1627          
1628  		function tags_getRelated ($tag) {
1629              /* https://www.flickr.com/services/api/flickr.tags.getRelated.html */
1630              $this->request("flickr.tags.getRelated", array("tag" => $tag));
1631              return $this->parsed_response ? $this->parsed_response['tags'] : false;
1632          }
1633  
1634  		function test_echo ($args = array()) {
1635              /* https://www.flickr.com/services/api/flickr.test.echo.html */
1636              $this->request("flickr.test.echo", $args);
1637              return $this->parsed_response ? $this->parsed_response : false;
1638          }
1639  
1640  		function test_login () {
1641              /* https://www.flickr.com/services/api/flickr.test.login.html */
1642              $this->request("flickr.test.login");
1643              return $this->parsed_response ? $this->parsed_response['user'] : false;
1644          }
1645  
1646  		function urls_getGroup ($group_id) {
1647              /* https://www.flickr.com/services/api/flickr.urls.getGroup.html */
1648              $this->request("flickr.urls.getGroup", array("group_id"=>$group_id));
1649              return $this->parsed_response ? $this->parsed_response['group']['url'] : false;
1650          }
1651  
1652  		function urls_getUserPhotos ($user_id = NULL) {
1653              /* https://www.flickr.com/services/api/flickr.urls.getUserPhotos.html */
1654              $this->request("flickr.urls.getUserPhotos", array("user_id"=>$user_id));
1655              return $this->parsed_response ? $this->parsed_response['user']['url'] : false;
1656          }
1657  
1658  		function urls_getUserProfile ($user_id = NULL) {
1659              /* https://www.flickr.com/services/api/flickr.urls.getUserProfile.html */
1660              $this->request("flickr.urls.getUserProfile", array("user_id"=>$user_id));
1661              return $this->parsed_response ? $this->parsed_response['user']['url'] : false;
1662          }
1663          
1664  		function urls_lookupGallery ($url) {
1665              /* https://www.flickr.com/services/api/flickr.urls.lookupGallery.html */
1666              return $this->call('flickr.urls.lookupGallery', array('url' => $url));
1667          }
1668  
1669  		function urls_lookupGroup ($url) {
1670              /* https://www.flickr.com/services/api/flickr.urls.lookupGroup.html */
1671              $this->request("flickr.urls.lookupGroup", array("url"=>$url));
1672              return $this->parsed_response ? $this->parsed_response['group'] : false;
1673          }
1674  
1675  		function urls_lookupUser ($url) {
1676              /* https://www.flickr.com/services/api/flickr.photos.notes.edit.html */
1677              $this->request("flickr.urls.lookupUser", array("url"=>$url));
1678              return $this->parsed_response ? $this->parsed_response['user'] : false;
1679          }
1680      }
1681  }
1682  
1683  if ( !class_exists('phpFlickr_pager') ) {
1684      class phpFlickr_pager {
1685          var $phpFlickr, $per_page, $method, $args, $results, $global_phpFlickr;
1686          var $total = null, $page = 0, $pages = null, $photos, $_extra = null;
1687          
1688          
1689  		function phpFlickr_pager($phpFlickr, $method = null, $args = null, $per_page = 30) {
1690              $this->per_page = $per_page;
1691              $this->method = $method;
1692              $this->args = $args;
1693              $this->set_phpFlickr($phpFlickr);
1694          }
1695          
1696  		function set_phpFlickr($phpFlickr) {
1697              if ( is_a($phpFlickr, 'phpFlickr') ) {
1698                  $this->phpFlickr = $phpFlickr;
1699                  if ( $this->phpFlickr->cache ) {
1700                      $this->args['per_page'] = 500;
1701                  } else {
1702                      $this->args['per_page'] = (int) $this->per_page;
1703                  }
1704              }
1705          }
1706          
1707  		function __sleep() {
1708              return array(
1709                  'method',
1710                  'args',
1711                  'per_page',
1712                  'page',
1713                  '_extra',
1714              );
1715          }
1716          
1717  		function load($page) {
1718              $allowed_methods = array(
1719                  'flickr.photos.search' => 'photos',
1720                  'flickr.photosets.getPhotos' => 'photoset',
1721              );
1722              if ( !in_array($this->method, array_keys($allowed_methods)) ) return false;
1723              
1724              if ( $this->phpFlickr->cache ) {
1725                  $min = ($page - 1) * $this->per_page;
1726                  $max = $page * $this->per_page - 1;
1727                  if ( floor($min/500) == floor($max/500) ) {
1728                      $this->args['page'] = floor($min/500) + 1;
1729                      $this->results = $this->phpFlickr->call($this->method, $this->args);
1730                      if ( $this->results ) {
1731                          $this->results = $this->results[$allowed_methods[$this->method]];
1732                          $this->photos = array_slice($this->results['photo'], $min % 500, $this->per_page);
1733                          $this->total = $this->results['total'];
1734                          $this->pages = ceil($this->results['total'] / $this->per_page);
1735                          return true;
1736                      } else {
1737                          return false;
1738                      }
1739                  } else {
1740                      $this->args['page'] = floor($min/500) + 1;
1741                      $this->results = $this->phpFlickr->call($this->method, $this->args);
1742                      if ( $this->results ) {
1743                          $this->results = $this->results[$allowed_methods[$this->method]];
1744  
1745                          $this->photos = array_slice($this->results['photo'], $min % 500);
1746                          $this->total = $this->results['total'];
1747                          $this->pages = ceil($this->results['total'] / $this->per_page);
1748                          
1749                          $this->args['page'] = floor($min/500) + 2;
1750                          $this->results = $this->phpFlickr->call($this->method, $this->args);
1751                          if ( $this->results ) {
1752                              $this->results = $this->results[$allowed_methods[$this->method]];
1753                              $this->photos = array_merge($this->photos, array_slice($this->results['photo'], 0, $max % 500 + 1));
1754                          }
1755                          return true;
1756                      } else {
1757                          return false;
1758                      }
1759  
1760                  }
1761              } else {
1762                  $this->args['page'] = $page;
1763                  $this->results = $this->phpFlickr->call($this->method, $this->args);
1764                  if ( $this->results ) {
1765                      $this->results = $this->results[$allowed_methods[$this->method]];
1766                      
1767                      $this->photos = $this->results['photo'];
1768                      $this->total = $this->results['total'];
1769                      $this->pages = $this->results['pages'];
1770                      return true;
1771                  } else {
1772                      return false;
1773                  }
1774              }
1775          }
1776          
1777  		function get($page = null) {
1778              if ( is_null($page) ) {
1779                  $page = $this->page;
1780              } else {
1781                  $this->page = $page;
1782              }
1783              if ( $this->load($page) ) {
1784                  return $this->photos;
1785              }
1786              $this->total = 0;
1787              $this->pages = 0;
1788              return array();
1789          }
1790          
1791  		function next() {
1792              $this->page++;
1793              if ( $this->load($this->page) ) {
1794                  return $this->photos;
1795              }
1796              $this->total = 0;
1797              $this->pages = 0;
1798              return array();
1799          }
1800          
1801      }
1802  }
1803  
1804  ?>

title

Description

title

Description

title

Description

title

title

Body