Your IP : 216.73.216.162


Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/
Upload File :
Current File : /home/x/b/o/xbodynamge/namtation/wp-content/mystock-import.tar

.htaccess000066600000000424151143361000006340 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>init.php000066600000017344151143361000006227 0ustar00<?php
/**
 * The module for mystock import.
 *
 * @link       https://themeisle.com
 * @since      1.0.0
 *
 * @package    Mystock_Import_OBFX_Module
 */

/**
 * The class for mystock import.
 *
 * @package    Mystock_Import_OBFX_Module
 * @author     Themeisle <friends@themeisle.com>
 * @codeCoverageIgnore
 */
class Mystock_Import_OBFX_Module extends Orbit_Fox_Module_Abstract {

	/**
	 * The api key.
	 */
	const API_KEY = '97d007cf8f44203a2e578841a2c0f9ac';

	/**
	 * The number of images to fetch. Only the first page will be fetched.
	 */
	const MAX_IMAGES = 40;

	/**
	 * The username of the flickr account.
	 */
	const USER_NAME = 'themeisle';

	/**
	 * The cache time.
	 */
	const CACHE_DAYS = 7;


	/**
	 * Mystock_Import_OBFX_Module constructor.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function __construct() {
		parent::__construct();
		$this->name           = __( 'Mystock Import', 'themeisle-companion' );
		$this->description    = __( 'Module to import images directly from', 'themeisle-companion' ) . sprintf( ' <a href="%s" target="_blank">mystock.photos</a>', 'https://mystock.photos' );
		$this->active_default = true;
	}


	/**
	 * Determine if module should be loaded.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return bool
	 */
	public function enable_module() {
		return true;
	}

	/**
	 * The loading logic for the module.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load() {
	}

	/**
	 * Method to define hooks needed.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function hooks() {

		/*Get tab content*/
		$this->loader->add_action( 'wp_ajax_get-tab-' . $this->slug, $this, 'get_tab_content' );
		$this->loader->add_action( 'wp_ajax_infinite-' . $this->slug, $this, 'infinite_scroll' );
		$this->loader->add_action( 'wp_ajax_handle-request-' . $this->slug, $this, 'handle_request' );
		$this->loader->add_filter( 'media_view_strings', $this, 'media_view_strings' );
	}

	/**
	 * Display tab content.
	 */
	public function get_tab_content() {
		$urls = $this->get_images();
		require $this->get_dir() . "/inc/photos.php";
		wp_die();
	}

	/**
	 * Request images from flickr.
	 *
	 * @param int $page Page to load.
	 *
	 * @return array
	 */
	private function get_images( $page = 1 ) {
		$photos = get_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_' . $page );
		if ( ! $photos ) {
			require_once $this->get_dir() . '/vendor/phpflickr/phpflickr.php';
			$api    = new phpFlickr( self::API_KEY );
			$user   = $api->people_findByUsername( self::USER_NAME );
			$photos = array();
			if ( $user && isset( $user['nsid'] ) ) {
				$photos = $api->people_getPublicPhotos( $user['nsid'], null, 'url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o', self::MAX_IMAGES, $page );
				if ( ! empty( $photos ) ) {
					$pages = get_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_pages' );
					if ( false === $pages ) {
						set_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_pages', $photos['photos']['pages'], self::CACHE_DAYS * DAY_IN_SECONDS );
					}
					$photos = $photos['photos']['photo'];
				}
			}
			set_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_' . $page, $photos, self::CACHE_DAYS * DAY_IN_SECONDS );
		}

		return $photos;
	}

	/**
	 * Upload image.
	 */
	function handle_request() {
		check_ajax_referer( $this->slug . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ), 'security' );

		if ( ! isset( $_POST['url'] ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}

		$url      = $_POST['url'];
		$name     = basename( $url );
		$tmp_file = download_url( $url );
		if ( is_wp_error( $tmp_file ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}
		$file             = array();
		$file['name']     = $name;
		$file['tmp_name'] = $tmp_file;
		$image_id         = media_handle_sideload( $file, 0 );
		if ( is_wp_error( $image_id ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}
		$attach_data = wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) );
		if ( is_wp_error( $attach_data ) ) {
			echo esc_html__( 'Image failed to upload', 'themeisle-companion' );
			wp_die();
		}
		wp_update_attachment_metadata( $image_id, $attach_data );

		wp_send_json_success( array( 'id' => $image_id ) );
	}

	/**
	 * Ajax function to load new images.
	 */
	function infinite_scroll() {
		check_ajax_referer( $this->slug . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ), 'security' );

		if ( ! isset( $_POST['page'] ) ) {
			wp_die();
		}

		//Update last page that was loaded
		$req_page = (int) $_POST['page'] + 1;

		//Request new page
		$response    = '';
		$new_request = $this->get_images( $req_page );
		if ( ! empty( $new_request ) ) {
			foreach ( $new_request as $photo ) {
				$response .= '<li class="obfx-image" data-page="' . esc_attr( $req_page ) . '" data-pid="' . esc_attr( $photo['id'] ) . '">';
				$response .= '<div class="obfx-preview"><div class="thumbnail"><div class="centered">';
				$response .= '<img src="' . esc_url( $photo['url_m'] ) . '">';
				$response .= '</div></div></div>';
				$response .= '<button type="button" class="check obfx-image-check" tabindex="0"><span class="media-modal-icon"></span><span class="screen-reader-text">' . esc_html__( 'Deselect', 'themeisle-companion' ) . '</span></button>';
				$response .= '</li>';
			}
		}

		echo $response;
		wp_die();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the front end part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function public_enqueue() {
		return array();
	}

	/**
	 * Method that returns an array of scripts and styles to be loaded
	 * for the admin part.
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function admin_enqueue() {
		$current_screen = get_current_screen();

		if ( ! isset( $current_screen->id ) ) {
			return array();
		}
		if ( ! in_array( $current_screen->id, array( 'post', 'page', 'post-new', 'upload' ) ) ) {
			return array();
		}

		$this->localized = array(
			'admin' => array(
				'ajaxurl' => admin_url( 'admin-ajax.php' ),
				'nonce'   => wp_create_nonce( $this->slug . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ) ),
				'l10n'    => array(
					'fetch_image_sizes'     => esc_html__( 'Fetching data', 'themeisle-companion' ),
					'upload_image'          => esc_html__( 'Downloading image. Please wait...', 'themeisle-companion' ),
					'upload_image_complete' => esc_html__( 'Your image was imported. Go to Media Library tab to use it.', 'themeisle-companion' ),
					'load_more'             => esc_html__( 'Loading more photos...', 'themeisle-companion' ),
					'tab_name'              => esc_html__( 'MyStock Library', 'themeisle-companion' ),
					'featured_image_new'    => esc_html__( 'Import & set featured image', 'themeisle-companion' ),
					'insert_image_new'      => esc_html__( 'Import & insert image', 'themeisle-companion' ),
					'featured_image'        => isset( $this->strings['setFeaturedImage'] ) ? $this->strings['setFeaturedImage'] : '',
					'insert_image'          => isset( $this->strings['insertIntoPost'] ) ? $this->strings['insertIntoPost'] : '',
				),
				'slug'    => $this->slug,
				'pages'   => get_transient( $this->slug . 'photos_' . self::MAX_IMAGES . '_pages' ),
			),
		);

		return array(
			'js'  => array(
				'admin' => array( 'media-views' ),
			),
			'css' => array(
				'media' => array(),
			),
		);
	}

	/**
	 * Method to define the options fields for the module
	 *
	 * @since   1.0.0
	 * @access  public
	 * @return array
	 */
	public function options() {
		return array();
	}

	public function media_view_strings( $strings ) {
		$this->strings = $strings;

		return $strings;
	}
}css/media.css000066600000006506151143361000007132 0ustar00.obfx-image-list {
	overflow: auto;
	position: absolute;
	top: 50px;
	right: 300px;
	bottom: 0;
	left: 0;
	width: 95%;
	margin: 0;
	padding: 2px 8px 8px;
	outline: 0;
	opacity: 1;

	-webkit-overflow-scrolling: touch;
}

.obfx-preview {
	position: relative;
	background: #eee;
	box-shadow: inset 0 0 15px rgba(0,0,0,0.1), inset 0 0 0 1px rgba(0,0,0,0.05);
	cursor: pointer;
}

.obfx-preview:before {
	display: block;
	padding-top: 100%;
	content: "";
}

.obfx-preview .thumbnail {
	overflow: hidden;
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	opacity: 1;
	-webkit-transition: opacity 0.1s;
	transition: opacity 0.1s;
}

.obfx-preview .thumbnail:after {
	display: block;
	overflow: hidden;
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
	content: "";
}

.obfx-preview .thumbnail .centered {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	-webkit-transform: translate(50%,50%);
	-ms-transform: translate(50%,50%);
	transform: translate(50%,50%);
}

.obfx-preview .thumbnail .centered img {
	-webkit-transform: translate(-50%,-50%);
	-ms-transform: translate(-50%,-50%);
	transform: translate(-50%,-50%);
}

.obfx-image {
	float: left;
	position: relative;
	box-sizing: border-box;
	width: 20%;
	margin: 0;
	padding: 8px;
	color: #444;
	text-align: center;
	list-style: none;
	cursor: pointer;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

.obfx-image-list .obfx-image.details {
	box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 7px #0073aa;
}

.obfx-image-list .obfx-image.details .check,
.obfx-image-list .obfx-image.selected .check:focus {
	display: block;
	background-color: #0073aa;
	box-shadow: 0 0 0 1px #fff, 0 0 0 2px #0073aa;
}

.obfx-image-list .obfx-image .check {
	display: none;
	position: absolute;
	z-index: 10;
	top: 0;
	right: 0;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	outline: 0;
	background: #eee;
	box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(0, 0, 0, 0.15);
	cursor: pointer;
}

.obfx-image-list .obfx-image.details .check:hover .media-modal-icon,
.obfx-image-list .obfx-image.selected .check:focus .media-modal-icon {
	background-position: -60px 0;
}

.obfx-image-list .obfx-image.details .check .media-modal-icon {
	background-position: -21px 0;
}

.obfx-image-list .obfx-image .check:hover .media-modal-icon {
	background-position: -40px 0;
}

.obfx-image-list .obfx-image .check .media-modal-icon {
	display: block;
	width: 15px;
	height: 15px;
	margin: 5px;
	background-position: -1px 0;
}

.obfx-image-list .media-modal-icon {
	background-image: url(../../../../../../wp-includes/images/uploader-icons.png);
	background-repeat: no-repeat;
}

.wp-core-ui .button.obfx-import-media {
	float: right;
	margin-top: 10px;
}

.attachement-settings {
	float: right;
	width: 100%;
}

.attachement-settings .name {
	padding-right: 10px;
}

.attachement-loading {
	float: left;
	width: 100%;
	text-align: center;
}

.attachement-loading .spinner {
	float: none;
	width: auto;
	height: auto;
	padding: 10px;
}

.obfx_spinner {
	display: none;
	width: 32px;
	height: 32px;
	margin: 25% auto 0;
	opacity: 0.9;
	background: url("/wp-admin/images/wpspin_light-2x.gif") no-repeat;
	background-size: 32px 32px;

	filter: alpha(opacity=70);
}

.obfx-image-list.obfx_loading {
	opacity: 0.5;

	filter: alpha(opacity=50);
}
css/.htaccess000066600000000424151143361000007130 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>inc/.htaccess000066600000000424151143361000007111 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>inc/photos.php000066600000001745151143361000007347 0ustar00<?php
/**
 * Template used for photo rendering.
 *
 * @package OBFX
 */

?>
<div id='obfx-mystock' data-pagenb="1">
		<ul class='obfx-image-list'>
			<?php
			if ( ! empty( $urls ) ) {
				foreach ( $urls as $photo ) {
					$pid = $photo['id'];
					if ( ! empty( $pid ) ) {
						$thumb = $photo['url_m'];
						?>
						<li class='obfx-image' data-page="1" data-pid="<?php echo esc_attr( $pid ); ?>" data-url="<?php echo esc_attr( $photo['url_l'] ); ?>">
							<div class="obfx-preview">
								<div class="thumbnail">
									<div class="centered">
										<img src='<?php echo esc_url( $thumb ); ?>'>
									</div>
								</div>
							</div>
							<button type="button" class="check obfx-image-check" tabindex="0">
								<span class="media-modal-icon"></span>
								<span class="screen-reader-text"><?php esc_html_e( 'Deselect', 'themeisle-companion' ); ?></span>
							</button>
						</li>
						<?php
					}
				}
			}
			?>
		</ul>
		<div class="obfx_spinner"></div>
</div>
js/.htaccess000066600000000424151143361000006754 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>js/admin.js000066600000020641151143361000006607 0ustar00/* global _wpMediaViewsL10n, mystock_import, jQuery */
(function ($) {
	var media = wp.media,
		l10n = media.view.l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n;

	media.view.MediaFrame.Select.prototype.browseRouter = function (view) {
		view.set(
			{
				upload: {
					text: l10n.uploadFilesTitle,
					priority: 20
				},
				browse: {
					text: l10n.mediaLibraryTitle,
					priority: 30
				},
				mystock: {
					text: mystock_import.l10n.tab_name,
					priority: 40
				}
			}
		);
	};

	var bindHandlers = media.view.MediaFrame.Select.prototype.bindHandlers;

	media.view.MediaFrame.Select.prototype.bindHandlers = function () {
		bindHandlers.apply( this, arguments );
		this.on( 'content:create:mystock', this.mystockContent, this );
		this.on(
			'content:render:mystock', function(){
				wp.media.frame.state().get( 'selection' ).reset();
				$( document ).find( '.media-button-select' ).addClass( 'obfx-mystock-featured' ).html( mystock_import.l10n.featured_image_new );
				$( document ).find( '.media-button-insert' ).addClass( 'obfx-mystock-insert' ).html( mystock_import.l10n.insert_image_new );
			}, this
		);
		this.on(
			'content:render:browse content:render:upload', function(){
				$( document ).find( '.media-button-select' ).removeClass( 'obfx-mystock-featured' ).html( mystock_import.l10n.featured_image );
				$( document ).find( '.media-button-insert' ).removeClass( 'obfx-mystock-insert' ).html( mystock_import.l10n.insert_image );
			}, this
		);
	};

	media.view.MediaFrame.Select.prototype.mystockContent = function ( contentRegion ) {
		var state = this.state();

		this.$el.removeClass( 'hide-toolbar' );

		contentRegion.view = new wp.media.view.RemotePhotos(
			{
				controller: this,
				collection: state.get( 'library' ),
				selection:  state.get( 'selection' ),
				model:      state,
				sortable:   state.get( 'sortable' ),
				search:     state.get( 'searchable' ),
				filters:    state.get( 'filterable' ),
				date:       state.get( 'date' ),
				display:    state.has( 'display' ) ? state.get( 'display' ) : state.get( 'displaySettings' ),
				dragInfo:   state.get( 'dragInfo' ),

				idealColumnWidth: state.get( 'idealColumnWidth' ),
				suggestedWidth:   state.get( 'suggestedWidth' ),
				suggestedHeight:  state.get( 'suggestedHeight' ),

				AttachmentView: state.get( 'AttachmentView' )
			}
		);
	};

	// ensure only one scroll request is sent at one time.
	var scroll_called = false;

	media.view.RemotePhotos = media.View.extend(
		{
			tagName: 'div',
			className: 'obfx-attachments-browser',

			initialize: function () {
				// _.defaults(this.options, {});
				var container = this.$el;
				$( container ).html( '<div class="obfx_spinner"></div>' );
				this.loadContent( container,this );
				this.selectItem();
				this.deselectItem();
				this.handleRequest();
			},

			showSpinner: function(container) {
				$( container ).find( '.obfx-image-list' ).addClass( 'obfx_loading' );
				$( container ).find( '.obfx_spinner' ).show();
				$( document ).find( '.media-button-select' ).attr( 'disabled', 'disabled' ).addClass( 'obfx-mystock-featured' ).html( mystock_import.l10n.featured_image_new );
				$( document ).find( '.media-button-insert' ).attr( 'disabled', 'disabled' ).addClass( 'obfx-mystock-insert' ).html( mystock_import.l10n.insert_image_new );
			},
			hideSpinner: function(container) {
				$( container ).find( '.obfx-image-list' ).removeClass( 'obfx_loading' );
				$( container ).find( '.obfx_spinner' ).hide();
			},
			loadContent: function(container, frame){
				this.showSpinner( container );
				$.ajax(
					{
						type : 'POST',
						data : {
							action: 'get-tab-' + mystock_import.slug,
							security : mystock_import.nonce
						},
						url : mystock_import.ajaxurl,
						success : function(response) {
							container.html( response );
							frame.infiniteScroll( container, frame );
						}
					}
				);
			},

			selectItem : function(){
				$( document ).on(
					'click', '.obfx-image', function () {
						$( '.obfx-image' ).removeClass( 'selected details' );
						$( this ).addClass( 'selected details' );
						$( document ).find( '.media-button-insert' ).removeAttr( 'disabled', 'disabled' ).addClass( 'obfx-mystock-insert' ).html( mystock_import.l10n.insert_image_new );
						$( document ).find( '.media-button-select' ).removeAttr( 'disabled', 'disabled' ).addClass( 'obfx-mystock-featured' ).html( mystock_import.l10n.featured_image_new );
					}
				);
			},

			deselectItem :function () {
				$( document ).on(
					'click', '.obfx-image-check', function (e) {
						e.stopPropagation();
						$( this ).parent().removeClass( 'selected details' );
						$( document ).find( '.media-button-insert' ).attr( 'disabled', 'disabled' );
						$( document ).find( '.media-button-select' ).attr( 'disabled', 'disabled' );
					}
				);
			},

			infiniteScroll : function (container, frame) {
				$( '#obfx-mystock .obfx-image-list' ).on(
					'scroll',function() {
						if ($( this ).scrollTop() + $( this ).innerHeight() + 10 >= $( this )[0].scrollHeight) {
							var current_page = parseInt( $( '#obfx-mystock' ).data( 'pagenb' ) );
							if (parseInt( mystock_import.pages ) === current_page) {
								return;
							}
							if (scroll_called) {
								return;
							}
							scroll_called = true;
							frame.showSpinner( container );
							$.ajax(
								{
									type : 'POST',
									data : {
										'action': 'infinite-' + mystock_import.slug,
										'page' : $( '#obfx-mystock' ).data( 'pagenb' ),
										'security' : mystock_import.nonce
									},
									url : mystock_import.ajaxurl,
									success : function(response) {
										scroll_called = false;
										if ( response ) {
											var imageList = $( '.obfx-image-list' );
											var listWrapper = $( '#obfx-mystock' );
											var nextPage = parseInt( current_page ) + 1;
											listWrapper.data( 'pagenb', nextPage );
											imageList.append( response );
										}
										frame.hideSpinner( container );
										frame.deselectItem();
									}

								}
							);
						}
					}
				);
			},

			handleRequest : function () {
				$( document ).on(
					'click','.obfx-mystock-insert', function () {
						$( document ).find( '.media-button-insert' ).attr( 'disabled', 'disabled' ).html( mystock_import.l10n.upload_image );
						$.ajax(
							{
								method : 'POST',
								data : {
									'action': 'handle-request-' + mystock_import.slug,
									'url' : $( '.obfx-image.selected' ).attr( 'data-url' ),
									'security' : mystock_import.nonce
								},
								url : mystock_import.ajaxurl,
								success : function(data) {
									$( document ).find( '.media-button-insert' ).attr( 'disabled', 'disabled' ).html( mystock_import.l10n.insert_image_new );
									if ( 'mystock' === wp.media.frame.content.mode() ) {
										wp.media.frame.content.get( 'library' ).collection.props.set( { '__ignore_force_update': (+ new Date()) } );
										wp.media.frame.content.mode( 'browse' );
										$( document ).find( '.media-button-insert' ).attr( 'disabled', 'disabled' );
										wp.media.frame.state().get( 'selection' ).reset( wp.media.attachment( data.data.id ) );
										$( document ).find( '.media-button-insert' ).trigger( 'click' );
									}
								}
							}
						);
					}
				);

				$( document ).on(
					'click','.obfx-mystock-featured', function () {
						$( document ).find( '.media-button-select' ).attr( 'disabled', 'disabled' ).html( mystock_import.l10n.upload_image );
						$.ajax(
							{
								method : 'POST',
								data : {
									'action': 'handle-request-' + mystock_import.slug,
									'url' : $( '.obfx-image.selected' ).attr( 'data-url' ),
									'security' : mystock_import.nonce
								},
								url : mystock_import.ajaxurl,
								success : function(data) {
									$( document ).find( '.media-button-select' ).attr( 'disabled', 'disabled' ).html( mystock_import.l10n.featured_image_new );
									if ( 'mystock' === wp.media.frame.content.mode() ) {
										wp.media.frame.content.get( 'library' ).collection.props.set( { '__ignore_force_update': (+ new Date()) } );
										wp.media.frame.content.mode( 'browse' );
										$( document ).find( '.media-button-select' ).attr( 'disabled', 'disabled' );
										wp.media.frame.state().get( 'selection' ).reset( wp.media.attachment( data.data.id ) );
										$( document ).find( '.media-button-select' ).trigger( 'click' );
									}
								}
							}
						);
					}
				);
			}
		}
	);
})( jQuery );
vendor/.htaccess000066600000000424151143361000007635 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>vendor/phpflickr/.htaccess000066600000000424151143361000011617 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>vendor/phpflickr/LICENSE000066600000043151151143361000011032 0ustar00GNU GENERAL PUBLIC LICENSE
                       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

                    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

                            NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    {description}
    Copyright (C) {year}  {fullname}

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) year name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  {signature of Ty Coon}, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.vendor/phpflickr/phpflickr.php000066600000246546151143361000012535 0ustar00<?php
/* phpFlickr
 * Written by Dan Coulter (dan@dancoulter.com)
 * Project Home Page: http://github.com/dancoulter/phpflickr
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
if ( !class_exists('phpFlickr') ) {
	if (session_id() == "") {
		@session_start();
	}

	class phpFlickr {
		var $api_key;
		var $secret;

		var $rest_endpoint = 'https://api.flickr.com/services/rest/';
		var $upload_endpoint = 'https://up.flickr.com/services/upload/';
		var $replace_endpoint = 'https://up.flickr.com/services/replace/';
		var $req;
		var $response;
		var $parsed_response;
		var $cache = false;
		var $cache_db = null;
		var $cache_table = null;
		var $cache_dir = null;
		var $cache_expire = null;
		var $cache_key = null;
		var $last_request = null;
		var $die_on_error;
		var $error_code;
		Var $error_msg;
		var $token;
		var $php_version;
		var $custom_post = null, $custom_cache_get = null, $custom_cache_set = null;
		var $sizes = array(
				"square" => "_s",
				"square_75" => "_s",
				"square_150" => "_q",
				"thumbnail" => "_t",
				"small" => "_m",
				"small_240" => "_m",
				"small_320" => "_n",
				"medium" => "",
				"medium_500" => "",
				"medium_640" => "_z",
				"medium_800" => "_c",
				"large" => "_b",
				"large_1024" => "_b",
				"large_1600" => "_h",
				"large_2048" => "_k",
				"original" => "_o",
			);

		public function get_sizes() {
			return $this->sizes;
		}

		/*
		 * When your database cache table hits this many rows, a cleanup
		 * will occur to get rid of all of the old rows and cleanup the
		 * garbage in the table.  For most personal apps, 1000 rows should
		 * be more than enough.  If your site gets hit by a lot of traffic
		 * or you have a lot of disk space to spare, bump this number up.
		 * You should try to set it high enough that the cleanup only
		 * happens every once in a while, so this will depend on the growth
		 * of your table.
		 */
		var $max_cache_rows = 1000;

		function __construct ($api_key, $secret = NULL, $die_on_error = false) {
			//The API Key must be set before any calls can be made.  You can
			//get your own at https://www.flickr.com/services/api/misc.api_keys.html
			$this->api_key = $api_key;
			$this->secret = $secret;
			$this->die_on_error = $die_on_error;
			$this->service = "flickr";

			//Find the PHP version and store it for future reference
			$this->php_version = explode("-", phpversion());
			$this->php_version = explode(".", $this->php_version[0]);
		}

		function enableCache ($type, $connection, $cache_expire = 600, $table = 'flickr_cache') {
			// Turns on caching.  $type must be either "db" (for database caching) or "fs" (for filesystem).
			// When using db, $connection must be a PEAR::DB connection string. Example:
			//	  "mysql://user:password@server/database"
			// If the $table, doesn't exist, it will attempt to create it.
			// When using file system, caching, the $connection is the folder that the web server has write
			// access to. Use absolute paths for best results.  Relative paths may have unexpected behavior
			// when you include this.  They'll usually work, you'll just want to test them.
			if ($type == 'db') {
				if ( preg_match('|mysql://([^:]*):([^@]*)@([^/]*)/(.*)|', $connection, $matches) ) {
					//Array ( [0] => mysql://user:password@server/database [1] => user [2] => password [3] => server [4] => database )
					$db = mysqli_connect($matches[3],  $matches[1],  $matches[2]);
					mysqli_query($db, "USE $matches[4]");

					/*
					 * If high performance is crucial, you can easily comment
					 * out this query once you've created your database table.
					 */
					mysqli_query($db, "
						CREATE TABLE IF NOT EXISTS `$table` (
							`request` varchar(128) NOT NULL,
							`response` mediumtext NOT NULL,
							`expiration` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
							UNIQUE KEY `request` (`request`)
						)
					");

					$result = mysqli_query($db, "SELECT COUNT(*) 'count' FROM $table");
					if( $result ) {
						$result = mysqli_fetch_assoc($result);						
					}
					
					if ( $result && $result['count'] > $this->max_cache_rows ) {
						mysqli_query($db, "DELETE FROM $table WHERE CURRENT_TIMESTAMP > expiration");
						mysqli_query($db, 'OPTIMIZE TABLE ' . $this->cache_table);
					}
					$this->cache = 'db';
					$this->cache_db = $db;
					$this->cache_table = $table;
				}
			} elseif ($type == 'fs') {
				$this->cache = 'fs';
				$connection = realpath($connection);
				$this->cache_dir = $connection;
				if ($dir = opendir($this->cache_dir)) {
					while ($file = readdir($dir)) {
						if (substr($file, -6) == '.cache' && ((filemtime($this->cache_dir . '/' . $file) + $cache_expire) < time()) ) {
							unlink($this->cache_dir . '/' . $file);
						}
					}
				}
			} elseif ( $type == 'custom' ) {
				$this->cache = "custom";
				$this->custom_cache_get = $connection[0];
				$this->custom_cache_set = $connection[1];
			}
			$this->cache_expire = $cache_expire;
		}

		function getCached ($request)
		{
			//Checks the database or filesystem for a cached result to the request.
			//If there is no cache result, it returns a value of false. If it finds one,
			//it returns the unparsed XML.
			unset($request['api_sig']);
			foreach ( $request as $key => $value ) {
				if ( empty($value) ) unset($request[$key]);
				else $request[$key] = (string) $request[$key];
			}
			//if ( is_user_logged_in() ) print_r($request);
			$reqhash = md5(serialize($request));
			$this->cache_key = $reqhash;
			$this->cache_request = $request;
			if ($this->cache == 'db') {
				$result = mysqli_query($this->cache_db, "SELECT response FROM " . $this->cache_table . " WHERE request = '" . $reqhash . "' AND CURRENT_TIMESTAMP < expiration");
				if ( $result && mysqli_num_rows($result) ) {
					$result = mysqli_fetch_assoc($result);
					return urldecode($result['response']);
				} else {
					return false;
				}
			} elseif ($this->cache == 'fs') {
				$file = $this->cache_dir . '/' . $reqhash . '.cache';
				if (file_exists($file)) {
					if ($this->php_version[0] > 4 || ($this->php_version[0] == 4 && $this->php_version[1] >= 3)) {
						return file_get_contents($file);
					} else {
						return implode('', file($file));
					}
				}
			} elseif ( $this->cache == 'custom' ) {
				return call_user_func_array($this->custom_cache_get, array($reqhash));
			}
			return false;
		}

		function cache ($request, $response)
		{
			//Caches the unparsed response of a request.
			unset($request['api_sig']);
			foreach ( $request as $key => $value ) {
				if ( empty($value) ) unset($request[$key]);
				else $request[$key] = (string) $request[$key];
			}
			$reqhash = md5(serialize($request));
			if ($this->cache == 'db') {
				//$this->cache_db->query("DELETE FROM $this->cache_table WHERE request = '$reqhash'");
				$response = urlencode($response);
				$sql = 'INSERT INTO '.$this->cache_table.' (request, response, expiration) 
						VALUES (\''.$reqhash.'\', \''.$response.'\', TIMESTAMPADD(SECOND,'.$this->cache_expire.',CURRENT_TIMESTAMP))
						ON DUPLICATE KEY UPDATE response=\''.$response.'\', 
						expiration=TIMESTAMPADD(SECOND,'.$this->cache_expire.',CURRENT_TIMESTAMP) ';

				$result = mysqli_query($this->cache_db, $sql);
				if(!$result) {
					echo mysqli_error($this->cache_db);
				}
					
				return $result;
			} elseif ($this->cache == "fs") {
				$file = $this->cache_dir . "/" . $reqhash . ".cache";
				$fstream = fopen($file, "w");
				$result = fwrite($fstream,$response);
				fclose($fstream);
				return $result;
			} elseif ( $this->cache == "custom" ) {
				return call_user_func_array($this->custom_cache_set, array($reqhash, $response, $this->cache_expire));
			}
			return false;
		}

		function setCustomPost ( $function ) {
			$this->custom_post = $function;
		}

		function post ($data, $type = null) {
			if ( is_null($type) ) {
				$url = $this->rest_endpoint;
			}

			if ( !is_null($this->custom_post) ) {
				return call_user_func($this->custom_post, $url, $data);
			}

			if ( !preg_match("|https://(.*?)(/.*)|", $url, $matches) ) {
				die('There was some problem figuring out your endpoint');
			}

			if ( function_exists('curl_init') ) {
				// Has curl. Use it!
				$curl = curl_init($this->rest_endpoint);
				curl_setopt($curl, CURLOPT_POST, true);
				curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
				curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
				curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
				$response = curl_exec($curl);
				curl_close($curl);
			} else {
				// Use sockets.
				foreach ( $data as $key => $value ) {
					$data[$key] = $key . '=' . urlencode($value);
				}
				$data = implode('&', $data);

				$fp = @pfsockopen('ssl://'.$matches[1], 443);
				if (!$fp) {
					die('Could not connect to the web service');
				}
				fputs ($fp,'POST ' . $matches[2] . " HTTP/1.1\n");
				fputs ($fp,'Host: ' . $matches[1] . "\n");
				fputs ($fp,"Content-type: application/x-www-form-urlencoded\n");
				fputs ($fp,"Content-length: ".strlen($data)."\n");
				fputs ($fp,"Connection: close\r\n\r\n");
				fputs ($fp,$data . "\n\n");
				$response = "";
				while(!feof($fp)) {
					$response .= fgets($fp, 1024);
				}
				fclose ($fp);
				$chunked = false;
				$http_status = trim(substr($response, 0, strpos($response, "\n")));
				if ( $http_status != 'HTTP/1.1 200 OK' ) {
					die('The web service endpoint returned a "' . $http_status . '" response');
				}
				if ( strpos($response, 'Transfer-Encoding: chunked') !== false ) {
					$temp = trim(strstr($response, "\r\n\r\n"));
					$response = '';
					$length = trim(substr($temp, 0, strpos($temp, "\r")));
					while ( trim($temp) != "0" && ($length = trim(substr($temp, 0, strpos($temp, "\r")))) != "0" ) {
						$response .= trim(substr($temp, strlen($length)+2, hexdec($length)));
						$temp = trim(substr($temp, strlen($length) + 2 + hexdec($length)));
					}
				} elseif ( strpos($response, 'HTTP/1.1 200 OK') !== false ) {
					$response = trim(strstr($response, "\r\n\r\n"));
				}
			}
			return $response;
		}

		function request ($command, $args = array(), $nocache = false)
		{
			//Sends a request to Flickr's REST endpoint via POST.
			if (substr($command,0,7) != "flickr.") {
				$command = "flickr." . $command;
			}

			//Process arguments, including method and login data.
			$args = array_merge(array("method" => $command, "format" => "json", "nojsoncallback" => "1", "api_key" => $this->api_key), $args);
			if (!empty($this->token)) {
				$args = array_merge($args, array("auth_token" => $this->token));
			} elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
				$args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
			}
			ksort($args);
			$auth_sig = "";
			$this->last_request = $args;
			$this->response = $this->getCached($args);
			if (!($this->response) || $nocache) {
				foreach ($args as $key => $data) {
					if ( is_null($data) ) {
						unset($args[$key]);
						continue;
					}
					$auth_sig .= $key . $data;
				}
				if (!empty($this->secret)) {
					$api_sig = md5($this->secret . $auth_sig);
					$args['api_sig'] = $api_sig;
				}
				$this->response = $this->post($args);
				$this->cache($args, $this->response);
			}


			/*
			 * Uncomment this line (and comment out the next one) if you're doing large queries
			 * and you're concerned about time.  This will, however, change the structure of
			 * the result, so be sure that you look at the results.
			 */
			$this->parsed_response = json_decode($this->response, TRUE);
/* 			$this->parsed_response = $this->clean_text_nodes(json_decode($this->response, TRUE)); */
			if ($this->parsed_response['stat'] == 'fail') {
				if ($this->die_on_error) die("The Flickr API returned the following error: #{$this->parsed_response['code']} - {$this->parsed_response['message']}");
				else {
					$this->error_code = $this->parsed_response['code'];
					$this->error_msg = $this->parsed_response['message'];
					$this->parsed_response = false;
				}
			} else {
				$this->error_code = false;
				$this->error_msg = false;
			}
			return $this->response;
		}

		function clean_text_nodes ($arr) {
			if (!is_array($arr)) {
				return $arr;
			} elseif (count($arr) == 0) {
				return $arr;
			} elseif (count($arr) == 1 && array_key_exists('_content', $arr)) {
				return $arr['_content'];
			} else {
				foreach ($arr as $key => $element) {
					$arr[$key] = $this->clean_text_nodes($element);
				}
				return($arr);
			}
		}

		function setToken ($token) {
			// Sets an authentication token to use instead of the session variable
			$this->token = $token;
		}

		function setProxy ($server, $port) {
			// Sets the proxy for all phpFlickr calls.
			$this->req->setProxy($server, $port);
		}

		function getErrorCode () {
			// Returns the error code of the last call.  If the last call did not
			// return an error. This will return a false boolean.
			return $this->error_code;
		}

		function getErrorMsg () {
			// Returns the error message of the last call.  If the last call did not
			// return an error. This will return a false boolean.
			return $this->error_msg;
		}

		/* These functions are front ends for the flickr calls */

		function buildPhotoURL ($photo, $size = "Medium") {
			//receives an array (can use the individual photo data returned
			//from an API call) and returns a URL (doesn't mean that the
			//file size exists)
			$sizes = $this->sizes;

			$size = strtolower($size);
			if (!array_key_exists($size, $sizes)) {
				$size = "medium";
			}

			if ($size == "original") {
				$url = "https://farm" . $photo['farm'] . ".static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['originalsecret'] . "_o" . "." . $photo['originalformat'];
			} else {
				$url = "https://farm" . $photo['farm'] . ".static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['secret'] . $sizes[$size] . ".jpg";
			}
			return $url;
		}

		function sync_upload ($photo, $title = null, $description = null, $tags = null, $is_public = null, $is_friend = null, $is_family = null) {
			if ( function_exists('curl_init') ) {
				// Has curl. Use it!

				//Process arguments, including method and login data.
				$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);
				if (!empty($this->token)) {
					$args = array_merge($args, array("auth_token" => $this->token));
				} elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
					$args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
				}

				ksort($args);
				$auth_sig = "";
				foreach ($args as $key => $data) {
					if ( is_null($data) ) {
						unset($args[$key]);
					} else {
						$auth_sig .= $key . $data;
					}
				}
				if (!empty($this->secret)) {
					$api_sig = md5($this->secret . $auth_sig);
					$args["api_sig"] = $api_sig;
				}

				$photo = realpath($photo);
				$args['photo'] = '@' . $photo;


				$curl = curl_init($this->upload_endpoint);
				curl_setopt($curl, CURLOPT_POST, true);
				curl_setopt($curl, CURLOPT_POSTFIELDS, $args);
				curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
				$response = curl_exec($curl);
				$this->response = $response;
				curl_close($curl);

				$rsp = explode("\n", $response);
				foreach ($rsp as $line) {
					if (preg_match('|<err code="([0-9]+)" msg="(.*)"|', $line, $match)) {
						if ($this->die_on_error)
							die("The Flickr API returned the following error: #{$match[1]} - {$match[2]}");
						else {
							$this->error_code = $match[1];
							$this->error_msg = $match[2];
							$this->parsed_response = false;
							return false;
						}
					} elseif (preg_match("|<photoid>(.*)</photoid>|", $line, $match)) {
						$this->error_code = false;
						$this->error_msg = false;
						return $match[1];
					}
				}

			} else {
				die("Sorry, your server must support CURL in order to upload files");
			}

		}

		function async_upload ($photo, $title = null, $description = null, $tags = null, $is_public = null, $is_friend = null, $is_family = null) {
			if ( function_exists('curl_init') ) {
				// Has curl. Use it!

				//Process arguments, including method and login data.
				$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);
				if (!empty($this->token)) {
					$args = array_merge($args, array("auth_token" => $this->token));
				} elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
					$args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
				}

				ksort($args);
				$auth_sig = "";
				foreach ($args as $key => $data) {
					if ( is_null($data) ) {
						unset($args[$key]);
					} else {
						$auth_sig .= $key . $data;
					}
				}
				if (!empty($this->secret)) {
					$api_sig = md5($this->secret . $auth_sig);
					$args["api_sig"] = $api_sig;
				}

				$photo = realpath($photo);
				$args['photo'] = '@' . $photo;


				$curl = curl_init($this->upload_endpoint);
				curl_setopt($curl, CURLOPT_POST, true);
				curl_setopt($curl, CURLOPT_POSTFIELDS, $args);
				curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
				$response = curl_exec($curl);
				$this->response = $response;
				curl_close($curl);

				$rsp = explode("\n", $response);
				foreach ($rsp as $line) {
					if (preg_match('/<err code="([0-9]+)" msg="(.*)"/', $line, $match)) {
						if ($this->die_on_error)
							die("The Flickr API returned the following error: #{$match[1]} - {$match[2]}");
						else {
							$this->error_code = $match[1];
							$this->error_msg = $match[2];
							$this->parsed_response = false;
							return false;
						}
					} elseif (preg_match("/<ticketid>(.*)</", $line, $match)) {
						$this->error_code = false;
						$this->error_msg = false;
						return $match[1];
					}
				}
			} else {
				die("Sorry, your server must support CURL in order to upload files");
			}
		}

		// Interface for new replace API method.
		function replace ($photo, $photo_id, $async = null) {
			if ( function_exists('curl_init') ) {
				// Has curl. Use it!

				//Process arguments, including method and login data.
				$args = array("api_key" => $this->api_key, "photo_id" => $photo_id, "async" => $async);
				if (!empty($this->token)) {
					$args = array_merge($args, array("auth_token" => $this->token));
				} elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
					$args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
				}

				ksort($args);
				$auth_sig = "";
				foreach ($args as $key => $data) {
					if ( is_null($data) ) {
						unset($args[$key]);
					} else {
						$auth_sig .= $key . $data;
					}
				}
				if (!empty($this->secret)) {
					$api_sig = md5($this->secret . $auth_sig);
					$args["api_sig"] = $api_sig;
				}

				$photo = realpath($photo);
				$args['photo'] = '@' . $photo;


				$curl = curl_init($this->replace_endpoint);
				curl_setopt($curl, CURLOPT_POST, true);
				curl_setopt($curl, CURLOPT_POSTFIELDS, $args);
				curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
				$response = curl_exec($curl);
				$this->response = $response;
				curl_close($curl);

				if ($async == 1)
					$find = 'ticketid';
				 else
					$find = 'photoid';

				$rsp = explode("\n", $response);
				foreach ($rsp as $line) {
					if (preg_match('|<err code="([0-9]+)" msg="(.*)"|', $line, $match)) {
						if ($this->die_on_error)
							die("The Flickr API returned the following error: #{$match[1]} - {$match[2]}");
						else {
							$this->error_code = $match[1];
							$this->error_msg = $match[2];
							$this->parsed_response = false;
							return false;
						}
					} elseif (preg_match("|<" . $find . ">(.*)</|", $line, $match)) {
						$this->error_code = false;
						$this->error_msg = false;
						return $match[1];
					}
				}
			} else {
				die("Sorry, your server must support CURL in order to upload files");
			}
		}

		function auth ($perms = "read", $remember_uri = true) {
			// Redirects to Flickr's authentication piece if there is no valid token.
			// If remember_uri is set to false, the callback script (included) will
			// redirect to its default page.

			if (empty($_SESSION['phpFlickr_auth_token']) && empty($this->token)) {
				if ( $remember_uri === true ) {
					$_SESSION['phpFlickr_auth_redirect'] = $_SERVER['REQUEST_URI'];
				} elseif ( $remember_uri !== false ) {
					$_SESSION['phpFlickr_auth_redirect'] = $remember_uri;
				}
				$api_sig = md5($this->secret . "api_key" . $this->api_key . "perms" . $perms);

				if ($this->service == "23") {
					header("Location: http://www.23hq.com/services/auth/?api_key=" . $this->api_key . "&perms=" . $perms . "&api_sig=". $api_sig);
				} else {
					header("Location: https://www.flickr.com/services/auth/?api_key=" . $this->api_key . "&perms=" . $perms . "&api_sig=". $api_sig);
				}
				exit;
			} else {
				$tmp = $this->die_on_error;
				$this->die_on_error = false;
				$rsp = $this->auth_checkToken();
				if ($this->error_code !== false) {
					unset($_SESSION['phpFlickr_auth_token']);
					$this->auth($perms, $remember_uri);
				}
				$this->die_on_error = $tmp;
				return $rsp['perms'];
			}
		}

		function auth_url($frob, $perms = 'read') {
			$sig = md5(sprintf('%sapi_key%sfrob%sperms%s', $this->secret, $this->api_key, $frob, $perms));
			return sprintf('https://flickr.com/services/auth/?api_key=%s&perms=%s&frob=%s&api_sig=%s', $this->api_key, $perms, $frob, $sig);
		}

		/*******************************

		To use the phpFlickr::call method, pass a string containing the API method you want
		to use and an associative array of arguments.  For example:
			$result = $f->call("flickr.photos.comments.getList", array("photo_id"=>'34952612'));
		This method will allow you to make calls to arbitrary methods that haven't been
		implemented in phpFlickr yet.

		*******************************/

		function call ($method, $arguments) {
			foreach ( $arguments as $key => $value ) {
				if ( is_null($value) ) unset($arguments[$key]);
			}
			$this->request($method, $arguments);
			return $this->parsed_response ? $this->parsed_response : false;
		}

		/*
			These functions are the direct implementations of flickr calls.
			For method documentation, including arguments, visit the address
			included in a comment in the function.
		*/

		/* Activity methods */
		function activity_userComments ($per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.activity.userComments.html */
			$this->request('flickr.activity.userComments', array("per_page" => $per_page, "page" => $page));
			return $this->parsed_response ? $this->parsed_response['items']['item'] : false;
		}

		function activity_userPhotos ($timeframe = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.activity.userPhotos.html */
			$this->request('flickr.activity.userPhotos', array("timeframe" => $timeframe, "per_page" => $per_page, "page" => $page));
			return $this->parsed_response ? $this->parsed_response['items']['item'] : false;
		}

		/* Authentication methods */
		function auth_checkToken () {
			/* https://www.flickr.com/services/api/flickr.auth.checkToken.html */
			$this->request('flickr.auth.checkToken');
			return $this->parsed_response ? $this->parsed_response['auth'] : false;
		}

		function auth_getFrob () {
			/* https://www.flickr.com/services/api/flickr.auth.getFrob.html */
			$this->request('flickr.auth.getFrob');
			return $this->parsed_response ? $this->parsed_response['frob'] : false;
		}

		function auth_getFullToken ($mini_token) {
			/* https://www.flickr.com/services/api/flickr.auth.getFullToken.html */
			$this->request('flickr.auth.getFullToken', array('mini_token'=>$mini_token));
			return $this->parsed_response ? $this->parsed_response['auth'] : false;
		}

		function auth_getToken ($frob) {
			/* https://www.flickr.com/services/api/flickr.auth.getToken.html */
			$this->request('flickr.auth.getToken', array('frob'=>$frob));
			$_SESSION['phpFlickr_auth_token'] = $this->parsed_response['auth']['token'];
			return $this->parsed_response ? $this->parsed_response['auth'] : false;
		}

		/* Blogs methods */
		function blogs_getList ($service = NULL) {
			/* https://www.flickr.com/services/api/flickr.blogs.getList.html */
			$rsp = $this->call('flickr.blogs.getList', array('service' => $service));
			return $rsp['blogs']['blog'];
		}

		function blogs_getServices () {
			/* https://www.flickr.com/services/api/flickr.blogs.getServices.html */
			return $this->call('flickr.blogs.getServices', array());
		}

		function blogs_postPhoto ($blog_id = NULL, $photo_id, $title, $description, $blog_password = NULL, $service = NULL) {
			/* https://www.flickr.com/services/api/flickr.blogs.postPhoto.html */
			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));
		}

		/* Collections Methods */
		function collections_getInfo ($collection_id) {
			/* https://www.flickr.com/services/api/flickr.collections.getInfo.html */
			return $this->call('flickr.collections.getInfo', array('collection_id' => $collection_id));
		}

		function collections_getTree ($collection_id = NULL, $user_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.collections.getTree.html */
			return $this->call('flickr.collections.getTree', array('collection_id' => $collection_id, 'user_id' => $user_id));
		}

		/* Commons Methods */
		function commons_getInstitutions () {
			/* https://www.flickr.com/services/api/flickr.commons.getInstitutions.html */
			return $this->call('flickr.commons.getInstitutions', array());
		}

		/* Contacts Methods */
		function contacts_getList ($filter = NULL, $page = NULL, $per_page = NULL) {
			/* https://www.flickr.com/services/api/flickr.contacts.getList.html */
			$this->request('flickr.contacts.getList', array('filter'=>$filter, 'page'=>$page, 'per_page'=>$per_page));
			return $this->parsed_response ? $this->parsed_response['contacts'] : false;
		}

		function contacts_getPublicList ($user_id, $page = NULL, $per_page = NULL) {
			/* https://www.flickr.com/services/api/flickr.contacts.getPublicList.html */
			$this->request('flickr.contacts.getPublicList', array('user_id'=>$user_id, 'page'=>$page, 'per_page'=>$per_page));
			return $this->parsed_response ? $this->parsed_response['contacts'] : false;
		}

		function contacts_getListRecentlyUploaded ($date_lastupload = NULL, $filter = NULL) {
			/* https://www.flickr.com/services/api/flickr.contacts.getListRecentlyUploaded.html */
			return $this->call('flickr.contacts.getListRecentlyUploaded', array('date_lastupload' => $date_lastupload, 'filter' => $filter));
		}

		/* Favorites Methods */
		function favorites_add ($photo_id) {
			/* https://www.flickr.com/services/api/flickr.favorites.add.html */
			$this->request('flickr.favorites.add', array('photo_id'=>$photo_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function favorites_getList ($user_id = NULL, $jump_to = NULL, $min_fave_date = NULL, $max_fave_date = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.favorites.getList.html */
			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));
		}

		function favorites_getPublicList ($user_id, $jump_to = NULL, $min_fave_date = NULL, $max_fave_date = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.favorites.getPublicList.html */
			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));
		}

		function favorites_remove ($photo_id, $user_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.favorites.remove.html */
			$this->request("flickr.favorites.remove", array('photo_id' => $photo_id, 'user_id' => $user_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		/* Galleries Methods */
		function galleries_addPhoto ($gallery_id, $photo_id, $comment = NULL) {
			/* https://www.flickr.com/services/api/flickr.galleries.addPhoto.html */
			return $this->call('flickr.galleries.addPhoto', array('gallery_id' => $gallery_id, 'photo_id' => $photo_id, 'comment' => $comment));
		}

		function galleries_create ($title, $description, $primary_photo_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.galleries.create.html */
			return $this->call('flickr.galleries.create', array('title' => $title, 'description' => $description, 'primary_photo_id' => $primary_photo_id));
		}

		function galleries_editMeta ($gallery_id, $title, $description = NULL) {
			/* https://www.flickr.com/services/api/flickr.galleries.editMeta.html */
			return $this->call('flickr.galleries.editMeta', array('gallery_id' => $gallery_id, 'title' => $title, 'description' => $description));
		}

		function galleries_editPhoto ($gallery_id, $photo_id, $comment) {
			/* https://www.flickr.com/services/api/flickr.galleries.editPhoto.html */
			return $this->call('flickr.galleries.editPhoto', array('gallery_id' => $gallery_id, 'photo_id' => $photo_id, 'comment' => $comment));
		}

		function galleries_editPhotos ($gallery_id, $primary_photo_id, $photo_ids) {
			/* https://www.flickr.com/services/api/flickr.galleries.editPhotos.html */
			return $this->call('flickr.galleries.editPhotos', array('gallery_id' => $gallery_id, 'primary_photo_id' => $primary_photo_id, 'photo_ids' => $photo_ids));
		}

		function galleries_getInfo ($gallery_id) {
			/* https://www.flickr.com/services/api/flickr.galleries.getInfo.html */
			return $this->call('flickr.galleries.getInfo', array('gallery_id' => $gallery_id));
		}

		function galleries_getList ($user_id, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.galleries.getList.html */
			return $this->call('flickr.galleries.getList', array('user_id' => $user_id, 'per_page' => $per_page, 'page' => $page));
		}

		function galleries_getListForPhoto ($photo_id, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.galleries.getListForPhoto.html */
			return $this->call('flickr.galleries.getListForPhoto', array('photo_id' => $photo_id, 'per_page' => $per_page, 'page' => $page));
		}

		function galleries_getPhotos ($gallery_id, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.galleries.getPhotos.html */
			return $this->call('flickr.galleries.getPhotos', array('gallery_id' => $gallery_id, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
		}

		/* Groups Methods */
		function groups_browse ($cat_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.groups.browse.html */
			$this->request("flickr.groups.browse", array("cat_id"=>$cat_id));
			return $this->parsed_response ? $this->parsed_response['category'] : false;
		}

		function groups_getInfo ($group_id, $lang = NULL) {
			/* https://www.flickr.com/services/api/flickr.groups.getInfo.html */
			return $this->call('flickr.groups.getInfo', array('group_id' => $group_id, 'lang' => $lang));
		}

		function groups_search ($text, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.groups.search.html */
			$this->request("flickr.groups.search", array("text"=>$text,"per_page"=>$per_page,"page"=>$page));
			return $this->parsed_response ? $this->parsed_response['groups'] : false;
		}

		/* Groups Members Methods */
		function groups_members_getList ($group_id, $membertypes = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.groups.members.getList.html */
			return $this->call('flickr.groups.members.getList', array('group_id' => $group_id, 'membertypes' => $membertypes, 'per_page' => $per_page, 'page' => $page));
		}

		/* Groups Pools Methods */
		function groups_pools_add ($photo_id, $group_id) {
			/* https://www.flickr.com/services/api/flickr.groups.pools.add.html */
			$this->request("flickr.groups.pools.add", array("photo_id"=>$photo_id, "group_id"=>$group_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function groups_pools_getContext ($photo_id, $group_id, $num_prev = NULL, $num_next = NULL) {
			/* https://www.flickr.com/services/api/flickr.groups.pools.getContext.html */
			return $this->call('flickr.groups.pools.getContext', array('photo_id' => $photo_id, 'group_id' => $group_id, 'num_prev' => $num_prev, 'num_next' => $num_next));
		}

		function groups_pools_getGroups ($page = NULL, $per_page = NULL) {
			/* https://www.flickr.com/services/api/flickr.groups.pools.getGroups.html */
			$this->request("flickr.groups.pools.getGroups", array('page'=>$page, 'per_page'=>$per_page));
			return $this->parsed_response ? $this->parsed_response['groups'] : false;
		}

		function groups_pools_getPhotos ($group_id, $tags = NULL, $user_id = NULL, $jump_to = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.groups.pools.getPhotos.html */
			if (is_array($extras)) {
				$extras = implode(",", $extras);
			}
			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));
		}

		function groups_pools_remove ($photo_id, $group_id) {
			/* https://www.flickr.com/services/api/flickr.groups.pools.remove.html */
			$this->request("flickr.groups.pools.remove", array("photo_id"=>$photo_id, "group_id"=>$group_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		/* Interestingness methods */
		function interestingness_getList ($date = NULL, $use_panda = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.interestingness.getList.html */
			if (is_array($extras)) {
				$extras = implode(",", $extras);
			}

			return $this->call('flickr.interestingness.getList', array('date' => $date, 'use_panda' => $use_panda, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
		}

		/* Machine Tag methods */
		function machinetags_getNamespaces ($predicate = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.machinetags.getNamespaces.html */
			return $this->call('flickr.machinetags.getNamespaces', array('predicate' => $predicate, 'per_page' => $per_page, 'page' => $page));
		}

		function machinetags_getPairs ($namespace = NULL, $predicate = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.machinetags.getPairs.html */
			return $this->call('flickr.machinetags.getPairs', array('namespace' => $namespace, 'predicate' => $predicate, 'per_page' => $per_page, 'page' => $page));
		}

		function machinetags_getPredicates ($namespace = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.machinetags.getPredicates.html */
			return $this->call('flickr.machinetags.getPredicates', array('namespace' => $namespace, 'per_page' => $per_page, 'page' => $page));
		}

		function machinetags_getRecentValues ($namespace = NULL, $predicate = NULL, $added_since = NULL) {
			/* https://www.flickr.com/services/api/flickr.machinetags.getRecentValues.html */
			return $this->call('flickr.machinetags.getRecentValues', array('namespace' => $namespace, 'predicate' => $predicate, 'added_since' => $added_since));
		}

		function machinetags_getValues ($namespace, $predicate, $per_page = NULL, $page = NULL, $usage = NULL) {
			/* https://www.flickr.com/services/api/flickr.machinetags.getValues.html */
			return $this->call('flickr.machinetags.getValues', array('namespace' => $namespace, 'predicate' => $predicate, 'per_page' => $per_page, 'page' => $page, 'usage' => $usage));
		}

		/* Panda methods */
		function panda_getList () {
			/* https://www.flickr.com/services/api/flickr.panda.getList.html */
			return $this->call('flickr.panda.getList', array());
		}

		function panda_getPhotos ($panda_name, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.panda.getPhotos.html */
			return $this->call('flickr.panda.getPhotos', array('panda_name' => $panda_name, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
		}

		/* People methods */
		function people_findByEmail ($find_email) {
			/* https://www.flickr.com/services/api/flickr.people.findByEmail.html */
			$this->request("flickr.people.findByEmail", array("find_email"=>$find_email));
			return $this->parsed_response ? $this->parsed_response['user'] : false;
		}

		function people_findByUsername ($username) {
			/* https://www.flickr.com/services/api/flickr.people.findByUsername.html */
			$this->request("flickr.people.findByUsername", array("username"=>$username));
			return $this->parsed_response ? $this->parsed_response['user'] : false;
		}

		function people_getInfo ($user_id) {
			/* https://www.flickr.com/services/api/flickr.people.getInfo.html */
			$this->request("flickr.people.getInfo", array("user_id"=>$user_id));
			return $this->parsed_response ? $this->parsed_response['person'] : false;
		}

		function people_getPhotos ($user_id, $args = array()) {
			/* This function strays from the method of arguments that I've
			 * used in the other functions for the fact that there are just
			 * so many arguments to this API method. What you'll need to do
			 * is pass an associative array to the function containing the
			 * arguments you want to pass to the API.  For example:
			 *   $photos = $f->photos_search(array("tags"=>"brown,cow", "tag_mode"=>"any"));
			 * This will return photos tagged with either "brown" or "cow"
			 * or both. See the API documentation (link below) for a full
			 * list of arguments.
			 */

			 /* https://www.flickr.com/services/api/flickr.people.getPhotos.html */
			return $this->call('flickr.people.getPhotos', array_merge(array('user_id' => $user_id), $args));
		}

		function people_getPhotosOf ($user_id, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.people.getPhotosOf.html */
			return $this->call('flickr.people.getPhotosOf', array('user_id' => $user_id, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
		}

		function people_getPublicGroups ($user_id) {
			/* https://www.flickr.com/services/api/flickr.people.getPublicGroups.html */
			$this->request("flickr.people.getPublicGroups", array("user_id"=>$user_id));
			return $this->parsed_response ? $this->parsed_response['groups']['group'] : false;
		}

		function people_getPublicPhotos ($user_id, $safe_search = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.people.getPublicPhotos.html */
			return $this->call('flickr.people.getPublicPhotos', array('user_id' => $user_id, 'safe_search' => $safe_search, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
		}

		function people_getUploadStatus () {
			/* https://www.flickr.com/services/api/flickr.people.getUploadStatus.html */
			/* Requires Authentication */
			$this->request("flickr.people.getUploadStatus");
			return $this->parsed_response ? $this->parsed_response['user'] : false;
		}


		/* Photos Methods */
		function photos_addTags ($photo_id, $tags) {
			/* https://www.flickr.com/services/api/flickr.photos.addTags.html */
			$this->request("flickr.photos.addTags", array("photo_id"=>$photo_id, "tags"=>$tags), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photos_delete ($photo_id) {
			/* https://www.flickr.com/services/api/flickr.photos.delete.html */
			$this->request("flickr.photos.delete", array("photo_id"=>$photo_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photos_getAllContexts ($photo_id) {
			/* https://www.flickr.com/services/api/flickr.photos.getAllContexts.html */
			$this->request("flickr.photos.getAllContexts", array("photo_id"=>$photo_id));
			return $this->parsed_response ? $this->parsed_response : false;
		}

		function photos_getContactsPhotos ($count = NULL, $just_friends = NULL, $single_photo = NULL, $include_self = NULL, $extras = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html */
			$this->request("flickr.photos.getContactsPhotos", array("count"=>$count, "just_friends"=>$just_friends, "single_photo"=>$single_photo, "include_self"=>$include_self, "extras"=>$extras));
			return $this->parsed_response ? $this->parsed_response['photos']['photo'] : false;
		}

		function photos_getContactsPublicPhotos ($user_id, $count = NULL, $just_friends = NULL, $single_photo = NULL, $include_self = NULL, $extras = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html */
			$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));
			return $this->parsed_response ? $this->parsed_response['photos']['photo'] : false;
		}

		function photos_getContext ($photo_id, $num_prev = NULL, $num_next = NULL, $extras = NULL, $order_by = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.getContext.html */
			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));
		}

		function photos_getCounts ($dates = NULL, $taken_dates = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.getCounts.html */
			$this->request("flickr.photos.getCounts", array("dates"=>$dates, "taken_dates"=>$taken_dates));
			return $this->parsed_response ? $this->parsed_response['photocounts']['photocount'] : false;
		}

		function photos_getExif ($photo_id, $secret = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.getExif.html */
			$this->request("flickr.photos.getExif", array("photo_id"=>$photo_id, "secret"=>$secret));
			return $this->parsed_response ? $this->parsed_response['photo'] : false;
		}

		function photos_getFavorites ($photo_id, $page = NULL, $per_page = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.getFavorites.html */
			$this->request("flickr.photos.getFavorites", array("photo_id"=>$photo_id, "page"=>$page, "per_page"=>$per_page));
			return $this->parsed_response ? $this->parsed_response['photo'] : false;
		}

		function photos_getInfo ($photo_id, $secret = NULL, $humandates = NULL, $privacy_filter = NULL, $get_contexts = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.getInfo.html */
			return $this->call('flickr.photos.getInfo', array('photo_id' => $photo_id, 'secret' => $secret, 'humandates' => $humandates, 'privacy_filter' => $privacy_filter, 'get_contexts' => $get_contexts));
		}

		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) {
			/* https://www.flickr.com/services/api/flickr.photos.getNotInSet.html */
			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));
		}

		function photos_getPerms ($photo_id) {
			/* https://www.flickr.com/services/api/flickr.photos.getPerms.html */
			$this->request("flickr.photos.getPerms", array("photo_id"=>$photo_id));
			return $this->parsed_response ? $this->parsed_response['perms'] : false;
		}

		function photos_getRecent ($jump_to = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.getRecent.html */
			if (is_array($extras)) {
				$extras = implode(",", $extras);
			}
			return $this->call('flickr.photos.getRecent', array('jump_to' => $jump_to, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
		}

		function photos_getSizes ($photo_id) {
			/* https://www.flickr.com/services/api/flickr.photos.getSizes.html */
			$this->request("flickr.photos.getSizes", array("photo_id"=>$photo_id));
			return $this->parsed_response ? $this->parsed_response['sizes']['size'] : false;
		}

		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) {
			/* https://www.flickr.com/services/api/flickr.photos.getUntagged.html */
			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));
		}

		function photos_getWithGeoData ($args = array()) {
			/* See the documentation included with the photos_search() function.
			 * I'm using the same style of arguments for this function. The only
			 * difference here is that this doesn't require any arguments. The
			 * flickr.photos.search method requires at least one search parameter.
			 */
			/* https://www.flickr.com/services/api/flickr.photos.getWithGeoData.html */
			$this->request("flickr.photos.getWithGeoData", $args);
			return $this->parsed_response ? $this->parsed_response['photos'] : false;
		}

		function photos_getWithoutGeoData ($args = array()) {
			/* See the documentation included with the photos_search() function.
			 * I'm using the same style of arguments for this function. The only
			 * difference here is that this doesn't require any arguments. The
			 * flickr.photos.search method requires at least one search parameter.
			 */
			/* https://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html */
			$this->request("flickr.photos.getWithoutGeoData", $args);
			return $this->parsed_response ? $this->parsed_response['photos'] : false;
		}

		function photos_recentlyUpdated ($min_date, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.recentlyUpdated.html */
			return $this->call('flickr.photos.recentlyUpdated', array('min_date' => $min_date, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
		}

		function photos_removeTag ($tag_id) {
			/* https://www.flickr.com/services/api/flickr.photos.removeTag.html */
			$this->request("flickr.photos.removeTag", array("tag_id"=>$tag_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photos_search ($args = array()) {
			/* This function strays from the method of arguments that I've
			 * used in the other functions for the fact that there are just
			 * so many arguments to this API method. What you'll need to do
			 * is pass an associative array to the function containing the
			 * arguments you want to pass to the API.  For example:
			 *   $photos = $f->photos_search(array("tags"=>"brown,cow", "tag_mode"=>"any"));
			 * This will return photos tagged with either "brown" or "cow"
			 * or both. See the API documentation (link below) for a full
			 * list of arguments.
			 */

			/* https://www.flickr.com/services/api/flickr.photos.search.html */
			$result = $this->request("flickr.photos.search", $args);
			return ($this->parsed_response) ? $this->parsed_response['photos'] : false;
		}

		function photos_setContentType ($photo_id, $content_type) {
			/* https://www.flickr.com/services/api/flickr.photos.setContentType.html */
			return $this->call('flickr.photos.setContentType', array('photo_id' => $photo_id, 'content_type' => $content_type));
		}

		function photos_setDates ($photo_id, $date_posted = NULL, $date_taken = NULL, $date_taken_granularity = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.setDates.html */
			$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);
			return $this->parsed_response ? true : false;
		}

		function photos_setMeta ($photo_id, $title, $description) {
			/* https://www.flickr.com/services/api/flickr.photos.setMeta.html */
			$this->request("flickr.photos.setMeta", array("photo_id"=>$photo_id, "title"=>$title, "description"=>$description), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photos_setPerms ($photo_id, $is_public, $is_friend, $is_family, $perm_comment, $perm_addmeta) {
			/* https://www.flickr.com/services/api/flickr.photos.setPerms.html */
			$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);
			return $this->parsed_response ? true : false;
		}

		function photos_setSafetyLevel ($photo_id, $safety_level = NULL, $hidden = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.setSafetyLevel.html */
			return $this->call('flickr.photos.setSafetyLevel', array('photo_id' => $photo_id, 'safety_level' => $safety_level, 'hidden' => $hidden));
		}

		function photos_setTags ($photo_id, $tags) {
			/* https://www.flickr.com/services/api/flickr.photos.setTags.html */
			$this->request("flickr.photos.setTags", array("photo_id"=>$photo_id, "tags"=>$tags), TRUE);
			return $this->parsed_response ? true : false;
		}

		/* Photos - Comments Methods */
		function photos_comments_addComment ($photo_id, $comment_text) {
			/* https://www.flickr.com/services/api/flickr.photos.comments.addComment.html */
			$this->request("flickr.photos.comments.addComment", array("photo_id" => $photo_id, "comment_text"=>$comment_text), TRUE);
			return $this->parsed_response ? $this->parsed_response['comment'] : false;
		}

		function photos_comments_deleteComment ($comment_id) {
			/* https://www.flickr.com/services/api/flickr.photos.comments.deleteComment.html */
			$this->request("flickr.photos.comments.deleteComment", array("comment_id" => $comment_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photos_comments_editComment ($comment_id, $comment_text) {
			/* https://www.flickr.com/services/api/flickr.photos.comments.editComment.html */
			$this->request("flickr.photos.comments.editComment", array("comment_id" => $comment_id, "comment_text"=>$comment_text), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photos_comments_getList ($photo_id, $min_comment_date = NULL, $max_comment_date = NULL, $page = NULL, $per_page = NULL, $include_faves = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.comments.getList.html */
			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));
		}

		function photos_comments_getRecentForContacts ($date_lastcomment = NULL, $contacts_filter = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.comments.getRecentForContacts.html */
			return $this->call('flickr.photos.comments.getRecentForContacts', array('date_lastcomment' => $date_lastcomment, 'contacts_filter' => $contacts_filter, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
		}

		/* Photos - Geo Methods */
		function photos_geo_batchCorrectLocation ($lat, $lon, $accuracy, $place_id = NULL, $woe_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.geo.batchCorrectLocation.html */
			return $this->call('flickr.photos.geo.batchCorrectLocation', array('lat' => $lat, 'lon' => $lon, 'accuracy' => $accuracy, 'place_id' => $place_id, 'woe_id' => $woe_id));
		}

		function photos_geo_correctLocation ($photo_id, $place_id = NULL, $woe_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.geo.correctLocation.html */
			return $this->call('flickr.photos.geo.correctLocation', array('photo_id' => $photo_id, 'place_id' => $place_id, 'woe_id' => $woe_id));
		}

		function photos_geo_getLocation ($photo_id) {
			/* https://www.flickr.com/services/api/flickr.photos.geo.getLocation.html */
			$this->request("flickr.photos.geo.getLocation", array("photo_id"=>$photo_id));
			return $this->parsed_response ? $this->parsed_response['photo'] : false;
		}

		function photos_geo_getPerms ($photo_id) {
			/* https://www.flickr.com/services/api/flickr.photos.geo.getPerms.html */
			$this->request("flickr.photos.geo.getPerms", array("photo_id"=>$photo_id));
			return $this->parsed_response ? $this->parsed_response['perms'] : false;
		}

		function photos_geo_photosForLocation ($lat, $lon, $accuracy = NULL, $extras = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.geo.photosForLocation.html */
			return $this->call('flickr.photos.geo.photosForLocation', array('lat' => $lat, 'lon' => $lon, 'accuracy' => $accuracy, 'extras' => $extras, 'per_page' => $per_page, 'page' => $page));
		}

		function photos_geo_removeLocation ($photo_id) {
			/* https://www.flickr.com/services/api/flickr.photos.geo.removeLocation.html */
			$this->request("flickr.photos.geo.removeLocation", array("photo_id"=>$photo_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photos_geo_setContext ($photo_id, $context) {
			/* https://www.flickr.com/services/api/flickr.photos.geo.setContext.html */
			return $this->call('flickr.photos.geo.setContext', array('photo_id' => $photo_id, 'context' => $context));
		}

		function photos_geo_setLocation ($photo_id, $lat, $lon, $accuracy = NULL, $context = NULL, $bookmark_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.geo.setLocation.html */
			return $this->call('flickr.photos.geo.setLocation', array('photo_id' => $photo_id, 'lat' => $lat, 'lon' => $lon, 'accuracy' => $accuracy, 'context' => $context, 'bookmark_id' => $bookmark_id));
		}

		function photos_geo_setPerms ($is_public, $is_contact, $is_friend, $is_family, $photo_id) {
			/* https://www.flickr.com/services/api/flickr.photos.geo.setPerms.html */
			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));
		}

		/* Photos - Licenses Methods */
		function photos_licenses_getInfo () {
			/* https://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html */
			$this->request("flickr.photos.licenses.getInfo");
			return $this->parsed_response ? $this->parsed_response['licenses']['license'] : false;
		}

		function photos_licenses_setLicense ($photo_id, $license_id) {
			/* https://www.flickr.com/services/api/flickr.photos.licenses.setLicense.html */
			/* Requires Authentication */
			$this->request("flickr.photos.licenses.setLicense", array("photo_id"=>$photo_id, "license_id"=>$license_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		/* Photos - Notes Methods */
		function photos_notes_add ($photo_id, $note_x, $note_y, $note_w, $note_h, $note_text) {
			/* https://www.flickr.com/services/api/flickr.photos.notes.add.html */
			$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);
			return $this->parsed_response ? $this->parsed_response['note'] : false;
		}

		function photos_notes_delete ($note_id) {
			/* https://www.flickr.com/services/api/flickr.photos.notes.delete.html */
			$this->request("flickr.photos.notes.delete", array("note_id" => $note_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photos_notes_edit ($note_id, $note_x, $note_y, $note_w, $note_h, $note_text) {
			/* https://www.flickr.com/services/api/flickr.photos.notes.edit.html */
			$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);
			return $this->parsed_response ? true : false;
		}

		/* Photos - Transform Methods */
		function photos_transform_rotate ($photo_id, $degrees) {
			/* https://www.flickr.com/services/api/flickr.photos.transform.rotate.html */
			$this->request("flickr.photos.transform.rotate", array("photo_id" => $photo_id, "degrees" => $degrees), TRUE);
			return $this->parsed_response ? true : false;
		}

		/* Photos - People Methods */
		function photos_people_add ($photo_id, $user_id, $person_x = NULL, $person_y = NULL, $person_w = NULL, $person_h = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.people.add.html */
			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));
		}

		function photos_people_delete ($photo_id, $user_id, $email = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.people.delete.html */
			return $this->call('flickr.photos.people.delete', array('photo_id' => $photo_id, 'user_id' => $user_id, 'email' => $email));
		}

		function photos_people_deleteCoords ($photo_id, $user_id) {
			/* https://www.flickr.com/services/api/flickr.photos.people.deleteCoords.html */
			return $this->call('flickr.photos.people.deleteCoords', array('photo_id' => $photo_id, 'user_id' => $user_id));
		}

		function photos_people_editCoords ($photo_id, $user_id, $person_x, $person_y, $person_w, $person_h, $email = NULL) {
			/* https://www.flickr.com/services/api/flickr.photos.people.editCoords.html */
			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));
		}

		function photos_people_getList ($photo_id) {
			/* https://www.flickr.com/services/api/flickr.photos.people.getList.html */
			return $this->call('flickr.photos.people.getList', array('photo_id' => $photo_id));
		}

		/* Photos - Upload Methods */
		function photos_upload_checkTickets ($tickets) {
			/* https://www.flickr.com/services/api/flickr.photos.upload.checkTickets.html */
			if (is_array($tickets)) {
				$tickets = implode(",", $tickets);
			}
			$this->request("flickr.photos.upload.checkTickets", array("tickets" => $tickets), TRUE);
			return $this->parsed_response ? $this->parsed_response['uploader']['ticket'] : false;
		}

		/* Photosets Methods */
		function photosets_addPhoto ($photoset_id, $photo_id) {
			/* https://www.flickr.com/services/api/flickr.photosets.addPhoto.html */
			$this->request("flickr.photosets.addPhoto", array("photoset_id" => $photoset_id, "photo_id" => $photo_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photosets_create ($title, $description, $primary_photo_id) {
			/* https://www.flickr.com/services/api/flickr.photosets.create.html */
			$this->request("flickr.photosets.create", array("title" => $title, "primary_photo_id" => $primary_photo_id, "description" => $description), TRUE);
			return $this->parsed_response ? $this->parsed_response['photoset'] : false;
		}

		function photosets_delete ($photoset_id) {
			/* https://www.flickr.com/services/api/flickr.photosets.delete.html */
			$this->request("flickr.photosets.delete", array("photoset_id" => $photoset_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photosets_editMeta ($photoset_id, $title, $description = NULL) {
			/* https://www.flickr.com/services/api/flickr.photosets.editMeta.html */
			$this->request("flickr.photosets.editMeta", array("photoset_id" => $photoset_id, "title" => $title, "description" => $description), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photosets_editPhotos ($photoset_id, $primary_photo_id, $photo_ids) {
			/* https://www.flickr.com/services/api/flickr.photosets.editPhotos.html */
			$this->request("flickr.photosets.editPhotos", array("photoset_id" => $photoset_id, "primary_photo_id" => $primary_photo_id, "photo_ids" => $photo_ids), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photosets_getContext ($photo_id, $photoset_id, $num_prev = NULL, $num_next = NULL) {
			/* https://www.flickr.com/services/api/flickr.photosets.getContext.html */
			return $this->call('flickr.photosets.getContext', array('photo_id' => $photo_id, 'photoset_id' => $photoset_id, 'num_prev' => $num_prev, 'num_next' => $num_next));
		}

		function photosets_getInfo ($photoset_id) {
			/* https://www.flickr.com/services/api/flickr.photosets.getInfo.html */
			$this->request("flickr.photosets.getInfo", array("photoset_id" => $photoset_id));
			return $this->parsed_response ? $this->parsed_response['photoset'] : false;
		}

		function photosets_getList ($user_id = NULL, $page = NULL, $per_page = NULL, $primary_photo_extras = NULL) {
			/* https://www.flickr.com/services/api/flickr.photosets.getList.html */
			$this->request("flickr.photosets.getList", array("user_id" => $user_id, 'page' => $page, 'per_page' => $per_page, 'primary_photo_extras' => $primary_photo_extras));
			return $this->parsed_response ? $this->parsed_response['photosets'] : false;
		}

		function photosets_getPhotos ($photoset_id, $extras = NULL, $privacy_filter = NULL, $per_page = NULL, $page = NULL, $media = NULL) {
			/* https://www.flickr.com/services/api/flickr.photosets.getPhotos.html */
			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));
		}

		function photosets_orderSets ($photoset_ids) {
			/* https://www.flickr.com/services/api/flickr.photosets.orderSets.html */
			if (is_array($photoset_ids)) {
				$photoset_ids = implode(",", $photoset_ids);
			}
			$this->request("flickr.photosets.orderSets", array("photoset_ids" => $photoset_ids), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photosets_removePhoto ($photoset_id, $photo_id) {
			/* https://www.flickr.com/services/api/flickr.photosets.removePhoto.html */
			$this->request("flickr.photosets.removePhoto", array("photoset_id" => $photoset_id, "photo_id" => $photo_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photosets_removePhotos ($photoset_id, $photo_ids) {
			/* https://www.flickr.com/services/api/flickr.photosets.removePhotos.html */
			return $this->call('flickr.photosets.removePhotos', array('photoset_id' => $photoset_id, 'photo_ids' => $photo_ids));
		}

		function photosets_reorderPhotos ($photoset_id, $photo_ids) {
			/* https://www.flickr.com/services/api/flickr.photosets.reorderPhotos.html */
			return $this->call('flickr.photosets.reorderPhotos', array('photoset_id' => $photoset_id, 'photo_ids' => $photo_ids));
		}

		function photosets_setPrimaryPhoto ($photoset_id, $photo_id) {
			/* https://www.flickr.com/services/api/flickr.photosets.setPrimaryPhoto.html */
			return $this->call('flickr.photosets.setPrimaryPhoto', array('photoset_id' => $photoset_id, 'photo_id' => $photo_id));
		}

		/* Photosets Comments Methods */
		function photosets_comments_addComment ($photoset_id, $comment_text) {
			/* https://www.flickr.com/services/api/flickr.photosets.comments.addComment.html */
			$this->request("flickr.photosets.comments.addComment", array("photoset_id" => $photoset_id, "comment_text"=>$comment_text), TRUE);
			return $this->parsed_response ? $this->parsed_response['comment'] : false;
		}

		function photosets_comments_deleteComment ($comment_id) {
			/* https://www.flickr.com/services/api/flickr.photosets.comments.deleteComment.html */
			$this->request("flickr.photosets.comments.deleteComment", array("comment_id" => $comment_id), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photosets_comments_editComment ($comment_id, $comment_text) {
			/* https://www.flickr.com/services/api/flickr.photosets.comments.editComment.html */
			$this->request("flickr.photosets.comments.editComment", array("comment_id" => $comment_id, "comment_text"=>$comment_text), TRUE);
			return $this->parsed_response ? true : false;
		}

		function photosets_comments_getList ($photoset_id) {
			/* https://www.flickr.com/services/api/flickr.photosets.comments.getList.html */
			$this->request("flickr.photosets.comments.getList", array("photoset_id"=>$photoset_id));
			return $this->parsed_response ? $this->parsed_response['comments'] : false;
		}

		/* Places Methods */
		function places_find ($query) {
			/* https://www.flickr.com/services/api/flickr.places.find.html */
			return $this->call('flickr.places.find', array('query' => $query));
		}

		function places_findByLatLon ($lat, $lon, $accuracy = NULL) {
			/* https://www.flickr.com/services/api/flickr.places.findByLatLon.html */
			return $this->call('flickr.places.findByLatLon', array('lat' => $lat, 'lon' => $lon, 'accuracy' => $accuracy));
		}

		function places_getChildrenWithPhotosPublic ($place_id = NULL, $woe_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.places.getChildrenWithPhotosPublic.html */
			return $this->call('flickr.places.getChildrenWithPhotosPublic', array('place_id' => $place_id, 'woe_id' => $woe_id));
		}

		function places_getInfo ($place_id = NULL, $woe_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.places.getInfo.html */
			return $this->call('flickr.places.getInfo', array('place_id' => $place_id, 'woe_id' => $woe_id));
		}

		function places_getInfoByUrl ($url) {
			/* https://www.flickr.com/services/api/flickr.places.getInfoByUrl.html */
			return $this->call('flickr.places.getInfoByUrl', array('url' => $url));
		}

		function places_getPlaceTypes () {
			/* https://www.flickr.com/services/api/flickr.places.getPlaceTypes.html */
			return $this->call('flickr.places.getPlaceTypes', array());
		}

		function places_getShapeHistory ($place_id = NULL, $woe_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.places.getShapeHistory.html */
			return $this->call('flickr.places.getShapeHistory', array('place_id' => $place_id, 'woe_id' => $woe_id));
		}

		function places_getTopPlacesList ($place_type_id, $date = NULL, $woe_id = NULL, $place_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.places.getTopPlacesList.html */
			return $this->call('flickr.places.getTopPlacesList', array('place_type_id' => $place_type_id, 'date' => $date, 'woe_id' => $woe_id, 'place_id' => $place_id));
		}

		function places_placesForBoundingBox ($bbox, $place_type = NULL, $place_type_id = NULL, $recursive = NULL) {
			/* https://www.flickr.com/services/api/flickr.places.placesForBoundingBox.html */
			return $this->call('flickr.places.placesForBoundingBox', array('bbox' => $bbox, 'place_type' => $place_type, 'place_type_id' => $place_type_id, 'recursive' => $recursive));
		}

		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) {
			/* https://www.flickr.com/services/api/flickr.places.placesForContacts.html */
			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));
		}

		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) {
			/* https://www.flickr.com/services/api/flickr.places.placesForTags.html */
			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));
		}

		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) {
			/* https://www.flickr.com/services/api/flickr.places.placesForUser.html */
			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));
		}

		function places_resolvePlaceId ($place_id) {
			/* https://www.flickr.com/services/api/flickr.places.resolvePlaceId.html */
			$rsp = $this->call('flickr.places.resolvePlaceId', array('place_id' => $place_id));
			return $rsp ? $rsp['location'] : $rsp;
		}

		function places_resolvePlaceURL ($url) {
			/* https://www.flickr.com/services/api/flickr.places.resolvePlaceURL.html */
			$rsp = $this->call('flickr.places.resolvePlaceURL', array('url' => $url));
			return $rsp ? $rsp['location'] : $rsp;
		}

		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) {
			/* https://www.flickr.com/services/api/flickr.places.tagsForPlace.html */
			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));
		}

		/* Prefs Methods */
		function prefs_getContentType () {
			/* https://www.flickr.com/services/api/flickr.prefs.getContentType.html */
			$rsp = $this->call('flickr.prefs.getContentType', array());
			return $rsp ? $rsp['person'] : $rsp;
		}

		function prefs_getGeoPerms () {
			/* https://www.flickr.com/services/api/flickr.prefs.getGeoPerms.html */
			return $this->call('flickr.prefs.getGeoPerms', array());
		}

		function prefs_getHidden () {
			/* https://www.flickr.com/services/api/flickr.prefs.getHidden.html */
			$rsp = $this->call('flickr.prefs.getHidden', array());
			return $rsp ? $rsp['person'] : $rsp;
		}

		function prefs_getPrivacy () {
			/* https://www.flickr.com/services/api/flickr.prefs.getPrivacy.html */
			$rsp = $this->call('flickr.prefs.getPrivacy', array());
			return $rsp ? $rsp['person'] : $rsp;
		}

		function prefs_getSafetyLevel () {
			/* https://www.flickr.com/services/api/flickr.prefs.getSafetyLevel.html */
			$rsp = $this->call('flickr.prefs.getSafetyLevel', array());
			return $rsp ? $rsp['person'] : $rsp;
		}

		/* Reflection Methods */
		function reflection_getMethodInfo ($method_name) {
			/* https://www.flickr.com/services/api/flickr.reflection.getMethodInfo.html */
			$this->request("flickr.reflection.getMethodInfo", array("method_name" => $method_name));
			return $this->parsed_response ? $this->parsed_response : false;
		}

		function reflection_getMethods () {
			/* https://www.flickr.com/services/api/flickr.reflection.getMethods.html */
			$this->request("flickr.reflection.getMethods");
			return $this->parsed_response ? $this->parsed_response['methods']['method'] : false;
		}

		/* Stats Methods */
		function stats_getCollectionDomains ($date, $collection_id = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.stats.getCollectionDomains.html */
			return $this->call('flickr.stats.getCollectionDomains', array('date' => $date, 'collection_id' => $collection_id, 'per_page' => $per_page, 'page' => $page));
		}

		function stats_getCollectionReferrers ($date, $domain, $collection_id = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.stats.getCollectionReferrers.html */
			return $this->call('flickr.stats.getCollectionReferrers', array('date' => $date, 'domain' => $domain, 'collection_id' => $collection_id, 'per_page' => $per_page, 'page' => $page));
		}

		function stats_getCollectionStats ($date, $collection_id) {
			/* https://www.flickr.com/services/api/flickr.stats.getCollectionStats.html */
			return $this->call('flickr.stats.getCollectionStats', array('date' => $date, 'collection_id' => $collection_id));
		}

		function stats_getCSVFiles () {
			/* https://www.flickr.com/services/api/flickr.stats.getCSVFiles.html */
			return $this->call('flickr.stats.getCSVFiles', array());
		}

		function stats_getPhotoDomains ($date, $photo_id = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.stats.getPhotoDomains.html */
			return $this->call('flickr.stats.getPhotoDomains', array('date' => $date, 'photo_id' => $photo_id, 'per_page' => $per_page, 'page' => $page));
		}

		function stats_getPhotoReferrers ($date, $domain, $photo_id = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.stats.getPhotoReferrers.html */
			return $this->call('flickr.stats.getPhotoReferrers', array('date' => $date, 'domain' => $domain, 'photo_id' => $photo_id, 'per_page' => $per_page, 'page' => $page));
		}

		function stats_getPhotosetDomains ($date, $photoset_id = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.stats.getPhotosetDomains.html */
			return $this->call('flickr.stats.getPhotosetDomains', array('date' => $date, 'photoset_id' => $photoset_id, 'per_page' => $per_page, 'page' => $page));
		}

		function stats_getPhotosetReferrers ($date, $domain, $photoset_id = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.stats.getPhotosetReferrers.html */
			return $this->call('flickr.stats.getPhotosetReferrers', array('date' => $date, 'domain' => $domain, 'photoset_id' => $photoset_id, 'per_page' => $per_page, 'page' => $page));
		}

		function stats_getPhotosetStats ($date, $photoset_id) {
			/* https://www.flickr.com/services/api/flickr.stats.getPhotosetStats.html */
			return $this->call('flickr.stats.getPhotosetStats', array('date' => $date, 'photoset_id' => $photoset_id));
		}

		function stats_getPhotoStats ($date, $photo_id) {
			/* https://www.flickr.com/services/api/flickr.stats.getPhotoStats.html */
			return $this->call('flickr.stats.getPhotoStats', array('date' => $date, 'photo_id' => $photo_id));
		}

		function stats_getPhotostreamDomains ($date, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.stats.getPhotostreamDomains.html */
			return $this->call('flickr.stats.getPhotostreamDomains', array('date' => $date, 'per_page' => $per_page, 'page' => $page));
		}

		function stats_getPhotostreamReferrers ($date, $domain, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.stats.getPhotostreamReferrers.html */
			return $this->call('flickr.stats.getPhotostreamReferrers', array('date' => $date, 'domain' => $domain, 'per_page' => $per_page, 'page' => $page));
		}

		function stats_getPhotostreamStats ($date) {
			/* https://www.flickr.com/services/api/flickr.stats.getPhotostreamStats.html */
			return $this->call('flickr.stats.getPhotostreamStats', array('date' => $date));
		}

		function stats_getPopularPhotos ($date = NULL, $sort = NULL, $per_page = NULL, $page = NULL) {
			/* https://www.flickr.com/services/api/flickr.stats.getPopularPhotos.html */
			return $this->call('flickr.stats.getPopularPhotos', array('date' => $date, 'sort' => $sort, 'per_page' => $per_page, 'page' => $page));
		}

		function stats_getTotalViews ($date = NULL) {
			/* https://www.flickr.com/services/api/flickr.stats.getTotalViews.html */
			return $this->call('flickr.stats.getTotalViews', array('date' => $date));
		}

		/* Tags Methods */
		function tags_getClusterPhotos ($tag, $cluster_id) {
			/* https://www.flickr.com/services/api/flickr.tags.getClusterPhotos.html */
			return $this->call('flickr.tags.getClusterPhotos', array('tag' => $tag, 'cluster_id' => $cluster_id));
		}

		function tags_getClusters ($tag) {
			/* https://www.flickr.com/services/api/flickr.tags.getClusters.html */
			return $this->call('flickr.tags.getClusters', array('tag' => $tag));
		}

		function tags_getHotList ($period = NULL, $count = NULL) {
			/* https://www.flickr.com/services/api/flickr.tags.getHotList.html */
			$this->request("flickr.tags.getHotList", array("period" => $period, "count" => $count));
			return $this->parsed_response ? $this->parsed_response['hottags'] : false;
		}

		function tags_getListPhoto ($photo_id) {
			/* https://www.flickr.com/services/api/flickr.tags.getListPhoto.html */
			$this->request("flickr.tags.getListPhoto", array("photo_id" => $photo_id));
			return $this->parsed_response ? $this->parsed_response['photo']['tags']['tag'] : false;
		}

		function tags_getListUser ($user_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.tags.getListUser.html */
			$this->request("flickr.tags.getListUser", array("user_id" => $user_id));
			return $this->parsed_response ? $this->parsed_response['who']['tags']['tag'] : false;
		}

		function tags_getListUserPopular ($user_id = NULL, $count = NULL) {
			/* https://www.flickr.com/services/api/flickr.tags.getListUserPopular.html */
			$this->request("flickr.tags.getListUserPopular", array("user_id" => $user_id, "count" => $count));
			return $this->parsed_response ? $this->parsed_response['who']['tags']['tag'] : false;
		}

		function tags_getListUserRaw ($tag = NULL) {
			/* https://www.flickr.com/services/api/flickr.tags.getListUserRaw.html */
			return $this->call('flickr.tags.getListUserRaw', array('tag' => $tag));
		}

		function tags_getRelated ($tag) {
			/* https://www.flickr.com/services/api/flickr.tags.getRelated.html */
			$this->request("flickr.tags.getRelated", array("tag" => $tag));
			return $this->parsed_response ? $this->parsed_response['tags'] : false;
		}

		function test_echo ($args = array()) {
			/* https://www.flickr.com/services/api/flickr.test.echo.html */
			$this->request("flickr.test.echo", $args);
			return $this->parsed_response ? $this->parsed_response : false;
		}

		function test_login () {
			/* https://www.flickr.com/services/api/flickr.test.login.html */
			$this->request("flickr.test.login");
			return $this->parsed_response ? $this->parsed_response['user'] : false;
		}

		function urls_getGroup ($group_id) {
			/* https://www.flickr.com/services/api/flickr.urls.getGroup.html */
			$this->request("flickr.urls.getGroup", array("group_id"=>$group_id));
			return $this->parsed_response ? $this->parsed_response['group']['url'] : false;
		}

		function urls_getUserPhotos ($user_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.urls.getUserPhotos.html */
			$this->request("flickr.urls.getUserPhotos", array("user_id"=>$user_id));
			return $this->parsed_response ? $this->parsed_response['user']['url'] : false;
		}

		function urls_getUserProfile ($user_id = NULL) {
			/* https://www.flickr.com/services/api/flickr.urls.getUserProfile.html */
			$this->request("flickr.urls.getUserProfile", array("user_id"=>$user_id));
			return $this->parsed_response ? $this->parsed_response['user']['url'] : false;
		}

		function urls_lookupGallery ($url) {
			/* https://www.flickr.com/services/api/flickr.urls.lookupGallery.html */
			return $this->call('flickr.urls.lookupGallery', array('url' => $url));
		}

		function urls_lookupGroup ($url) {
			/* https://www.flickr.com/services/api/flickr.urls.lookupGroup.html */
			$this->request("flickr.urls.lookupGroup", array("url"=>$url));
			return $this->parsed_response ? $this->parsed_response['group'] : false;
		}

		function urls_lookupUser ($url) {
			/* https://www.flickr.com/services/api/flickr.photos.notes.edit.html */
			$this->request("flickr.urls.lookupUser", array("url"=>$url));
			return $this->parsed_response ? $this->parsed_response['user'] : false;
		}
	}
}

if ( !class_exists('phpFlickr_pager') ) {
	class phpFlickr_pager {
		var $phpFlickr, $per_page, $method, $args, $results, $global_phpFlickr;
		var $total = null, $page = 0, $pages = null, $photos, $_extra = null;


		function __construct($phpFlickr, $method = null, $args = null, $per_page = 30) {
			$this->per_page = $per_page;
			$this->method = $method;
			$this->args = $args;
			$this->set_phpFlickr($phpFlickr);
		}

		function set_phpFlickr($phpFlickr) {
			if ( is_a($phpFlickr, 'phpFlickr') ) {
				$this->phpFlickr = $phpFlickr;
				if ( $this->phpFlickr->cache ) {
					$this->args['per_page'] = 500;
				} else {
					$this->args['per_page'] = (int) $this->per_page;
				}
			}
		}

		function __sleep() {
			return array(
				'method',
				'args',
				'per_page',
				'page',
				'_extra',
			);
		}

		function load($page) {
			$allowed_methods = array(
				'flickr.photos.search' => 'photos',
				'flickr.photosets.getPhotos' => 'photoset',
			);
			if ( !in_array($this->method, array_keys($allowed_methods)) ) return false;

			if ( $this->phpFlickr->cache ) {
				$min = ($page - 1) * $this->per_page;
				$max = $page * $this->per_page - 1;
				if ( floor($min/500) == floor($max/500) ) {
					$this->args['page'] = floor($min/500) + 1;
					$this->results = $this->phpFlickr->call($this->method, $this->args);
					if ( $this->results ) {
						$this->results = $this->results[$allowed_methods[$this->method]];
						$this->photos = array_slice($this->results['photo'], $min % 500, $this->per_page);
						$this->total = $this->results['total'];
						$this->pages = ceil($this->results['total'] / $this->per_page);
						return true;
					} else {
						return false;
					}
				} else {
					$this->args['page'] = floor($min/500) + 1;
					$this->results = $this->phpFlickr->call($this->method, $this->args);
					if ( $this->results ) {
						$this->results = $this->results[$allowed_methods[$this->method]];

						$this->photos = array_slice($this->results['photo'], $min % 500);
						$this->total = $this->results['total'];
						$this->pages = ceil($this->results['total'] / $this->per_page);

						$this->args['page'] = floor($min/500) + 2;
						$this->results = $this->phpFlickr->call($this->method, $this->args);
						if ( $this->results ) {
							$this->results = $this->results[$allowed_methods[$this->method]];
							$this->photos = array_merge($this->photos, array_slice($this->results['photo'], 0, $max % 500 + 1));
						}
						return true;
					} else {
						return false;
					}

				}
			} else {
				$this->args['page'] = $page;
				$this->results = $this->phpFlickr->call($this->method, $this->args);
				if ( $this->results ) {
					$this->results = $this->results[$allowed_methods[$this->method]];

					$this->photos = $this->results['photo'];
					$this->total = $this->results['total'];
					$this->pages = $this->results['pages'];
					return true;
				} else {
					return false;
				}
			}
		}

		function get($page = null) {
			if ( is_null($page) ) {
				$page = $this->page;
			} else {
				$this->page = $page;
			}
			if ( $this->load($page) ) {
				return $this->photos;
			}
			$this->total = 0;
			$this->pages = 0;
			return array();
		}

		function next() {
			$this->page++;
			if ( $this->load($this->page) ) {
				return $this->photos;
			}
			$this->total = 0;
			$this->pages = 0;
			return array();
		}

	}
}

?>