File/lib/api.php

Description

Ansel external API interface.

$Horde: ansel/lib/api.php,v 1.122.2.13 2010-09-06 14:22:13 mrubinsk Exp $

Copyright 2004-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.fsf.org/copyleft/gpl.html.

Functions
_ansel_browse (line 223)

Browse through Ansel's gallery tree.

  • return: The contents of $path
array _ansel_browse ([string $path = ''], [array $properties = array()])
  • string $path: The level of the tree to browse.
  • array $properties: The item properties to return. Defaults to 'name', 'icon', and 'browseable'.
_ansel_commentCallback (line 415)

Callback for Agora comments.

  • return: Image filename on success | false on failure
mixed _ansel_commentCallback (integer $image_id)
  • integer $image_id: Image id to check
_ansel_count (line 723)

Returns the number of images in a gallery.

  • return: The number of images in the gallery.
integer _ansel_count ([integer $app = null], [integer $gallery_id = null], [string $slug = ''])
  • integer $app: Application used; if null then use default.
  • integer $gallery_id: The gallery id.
  • string $slug: The gallery slug.
_ansel_countGalleries (line 1129)

Counts the number of galleries.

  • return: Returns the number of matching galleries.
integer _ansel_countGalleries ([string $app = null], [integer $perm = PERMS_SHOW], [mixed $attributes = null], [integer $parent = null], [boolean $allLevels = true])
  • string $app: Application scope to use, if not the default.
  • integer $perm: The level of permissions to require for a gallery to return it.
  • mixed $attributes: Restrict the galleries counted to those matching $attributes. An array of attribute/value pairs or a gallery owner username.
  • integer $parent: The parent gallery id to start searching at.
  • boolean $allLevels: Return all levels, or just the direct children of $parent?
_ansel_createGallery (line 636)

Add a new gallery to any arbitrary application's Ansel_Shares.

  • return: The gallery id of the new gallery | PEAR_Error
mixed _ansel_createGallery ([string $app = null], [array $attributes = array()], [array $perm = null], [integer $parent = null])
  • string $app: Application scope to use, if not the default.
  • array $attributes: The gallery attributes (@see Ansel_Storage::createGallery).
  • array $perm: An array of permission data if Ansel's defaults are not desired. Takes an array like: array('guest' => PERMS_SHOW | PERMS_READ, 'default' => PERMS_SHOW | PERMS_READ);
  • integer $parent: The gallery id of the parent gallery, if any.
_ansel_galleryExists (line 1251)

Checks if the gallery exists

boolean _ansel_galleryExists (string $app, [integer $gallery_id = null], [string $slug = ''])
  • string $app: Application scope to use, if not the default.
  • integer $gallery_id: The gallery id
  • string $slug: The gallery slug
_ansel_getDefaultImage (line 756)

Returns the default image id of a gallery.

  • return: The default image id.
integer _ansel_getDefaultImage ([string $app = null], [integer $gallery_id = null], [string $style = 'ansel_default'], [string $slug = ''])
  • string $app: Application scope to use, if not the default.
  • integer $gallery_id: The gallery id.
  • string $style: The named style.
  • string $slug: The gallery slug.
_ansel_getGalleries (line 928)

Returns an array of gallery information.

  • return: An array of gallery data arrays | PEAR_Error
mixed _ansel_getGalleries ([array $ids = array()], [string $app = null], [array $slugs = array()])
  • array $ids: An array of gallery ids.
  • string $app: Application scope to use, if not the default.
  • array $slugs: An array of gallery slugs.
_ansel_getGalleryStyles (line 1267)

Get a list of all configured styles.

  • return: of style definitions.
hash _ansel_getGalleryStyles ()
_ansel_getImageContent (line 819)

Returns image file content.

  • return: The image path.
string _ansel_getImageContent (integer $image_id, [string $view = 'screen'], [string $style = null], [integer $app = null], [string $encoding = null], [string $compression = 'none'])
  • integer $image_id: The id of the image.
  • string $view: The view ('screen', 'thumb', 'full', etc) to show.
  • string $style: Force use of this gallery style.
  • integer $app: Application used.
  • string $encoding: The encoding type for the image data. (none, base64, or binhex)
  • string $compression: The compression type for the image data. (none, gzip, or lzf)
_ansel_getImageUrl (line 791)

Returns image URL.

  • return: The image path.
string _ansel_getImageUrl ([integer $app = null], integer $image_id, [string $view = 'screen'], [boolean $full = false], [string $style = null])
  • integer $app: Application used.
  • integer $image_id: The id of the image.
  • string $view: The view ('screen', 'thumb', 'full', etc) to show.
  • boolean $full: Return a path that includes the server name?
  • string $style: Use this gallery style
_ansel_getRecentImages (line 1083)

Return a list of recently added images

  • return: An array of image objects.
array _ansel_getRecentImages ([string $app = null], [array $galleries = array()], [integer $perms = PERMS_SHOW], [string $view = 'screen'], [boolean $full = false], [integer $limit = 10], [string $style = null], [string $slugs = array()])
  • string $app: Application used if null then use default.
  • array $galleries: An array of gallery ids to check. If left empty, will search all galleries with the given permissions for the current user.
  • integer $perms: PERMS_* constant
  • string $view: The type of image view to return.
  • boolean $full: Return a full URL if this is true.
  • integer $limit: The maximum number of images to return.
  • string $style: Force the use of this gallery style
  • string $slugs: An array of gallery slugs
_ansel_hasComments (line 436)

Checks if applications allows comments

boolean _ansel_hasComments ()
_ansel_listGalleries (line 890)

Returns a list of all galleries.

  • return: An array of gallery information.
array _ansel_listGalleries ([string $app = null], [integer $perm = PERMS_SHOW], [integer $parent = null], [boolean $allLevels = true], [integer $from = 0], [integer $count = 0], [array $attributes = null], [ $sort_by = null], [ $direction = 0])
  • string $app: Application scope to use, if not the default.
  • integer $perm: The level of permissions to require for a gallery to be returned.
  • integer $parent: The parent gallery id to start searching from. This should be either a gallery id or null.
  • boolean $allLevels: Return all levels, or just the direct children of $parent?
  • integer $from: The gallery to start listing at.
  • integer $count: The number of galleries to return.
  • array $attributes: Restrict the returned galleries to those matching $attributes. An array of attribute names => values
  • $sort_by
  • $direction
_ansel_listImages (line 1010)

Returns a list of all images in a gallery.

The return has the URL because in a lot of cases you'll want the url also. Using api call getImageURL results in a lot of overhead when e.g. generating a select list.

  • return: Two dimensional array with image names ids (key) and urls.
array _ansel_listImages ([string $app = null], [integer $gallery_id = null], [integer $perm = PERMS_SHOW], [string $view = 'screen'], [boolean $full = false], [integer $from = 0], [integer $count = 0], [string $style = null], [string $slug = ''])
  • string $app: Application scope to use, if not the default.
  • integer $gallery_id: Gallery id to get images from.
  • integer $perm: The level of permissions to require for a gallery to return it.
  • string $view: Viewsize to generate URLs for.
  • boolean $full: Return a full URL
  • integer $from: Start image.
  • integer $count: End image.
  • string $style: Use this gallery style.
  • string $slug: Gallery slug
_ansel_listTagInfo (line 1154)

Retrieve the list of used tag_names, tag_ids and the total number of resources that are linked to that tag.

  • return: An array containing tag_name, and total | PEAR_Error
mixed _ansel_listTagInfo ([array $tags = null])
  • array $tags: An optional array of tag_ids. If omitted, all tags will be included.
_ansel_perms (line 205)

Returns a list of available permissions.

  • return: An array describing all available permissions.
array _ansel_perms ()
_ansel_put (line 379)

Saves an image into the gallery tree.

  • return: The event UIDs, or a PEAR_Error on failure.
array _ansel_put (string $path, string $content, string $content_type)
  • string $path: The path where to PUT the file.
  • string $content: The file content.
  • string $content_type: The file's content type.
_ansel_removeGallery (line 674)

Removes a gallery and its images.

  • return: boolean true | PEAR_Error
mixed _ansel_removeGallery ([string $app = null], integer $gallery_id)
  • string $app: Application scope to use, if not the default.
  • integer $gallery_id: The id of gallery.
_ansel_removeImage (line 594)

Removes an image from a gallery.

void _ansel_removeImage ([string $app = null], integer $gallery_id, string $image_id)
  • string $app: Application scope to use, if not the default.
  • integer $gallery_id: The id of gallery.
  • string $image_id: The id of image to remove.
_ansel_renderView (line 1286)

Renders a gallery view

  • return: An array containing 'html' and 'crumbs' keys.
  • see: Ansel_View_* classes for descriptions of available parameters to use here.
array _ansel_renderView ([array $params = array()], [string $app = null], [string $view = 'Gallery'])
  • array $params: Any parameters that the view might need.
  • string $app: Application scope to use, if not the default.
  • string $view: The generic type of view we want. (Gallery, Image, List, Embedded)
_ansel_saveImage (line 508)

Stores an image in a gallery and returns gallery and image data.

  • return: An array of image/gallery data || PEAR_Error
mixed _ansel_saveImage ([integer $app = null], integer $gallery_id, array $image, [integer $default = false], [array $gallery_data = null], [string $encoding = null], [string $slug = null], [string $compression = 'none'])
  • integer $app: Application used if null then use default.
  • integer $gallery_id: The gallery id to add the image to.
  • array $image: Image data array. This can either be the return from Horde_Form_Type_image:: or an array with the following four fields: 'filename', 'description', 'data', 'type'
  • integer $default: Set this image as default in the gallery?
  • array $gallery_data: Any gallery parameters to change at this time.
  • string $encoding: The encoding type for the image data. (none, base64, or binhex)
  • string $slug: Use gallery slug instead of id. (Pass '0' or null to gallery_id parameter).
  • string $compression: The compression type for the image data. (none, gzip, or lzf)
_ansel_searchTags (line 1185)

Searches images/galleries tagged with all requested tags.

Returns an application-agnostic array (useful for when doing a tag search across multiple applications) containing the following keys:

  'title'    - The title for this resource.
  'desc'     - A terse description of this resource.
  'view_url' - The URL to view this resource.
  'app'      - The Horde application this resource belongs to.

The 'raw' results array can be returned instead by setting $raw = true.

  • return: An array of results | PEAR_Error
mixed _ansel_searchTags (array $names, [integer $max = 10], [integer $from = 0], [string $resource_type = 'all'], [string $user = null], [boolean $raw = false], [string $app = null])
  • array $names: An array of tag_names to search for.
  • integer $max: The maximum number of stories to return.
  • integer $from: The number of the story to start with.
  • string $resource_type: An array of channel_ids to limit the search to.
  • string $user: Restrict results to resources owned by $user.
  • boolean $raw: Return the raw story data?
  • string $app: Application scope to use, if not the default.
_ansel_selectGalleries (line 973)

Returns a 'select' menu from the list of galleries created by _ansel_listGalleries().

void _ansel_selectGalleries ([integer $app = null], [integer $perm = PERMS_SHOW], [string $parent = null], [boolean $allLevels = true], [integer $from = 0], [integer $count = 0], [boolean $default = null])
  • integer $app: Application used if null then use default.
  • integer $perm: The permissions filter to use.
  • string $parent: The parent share to start listing at.
  • boolean $allLevels: Return all levels, or just the direct
  • integer $from: The gallery to start listing at.
  • integer $count: The number of galleries to return.
  • boolean $default: The gallery_id of the gallery that is selected by default in the returned option list.
_getImageData (line 459)

Returns decoded image data

  • return: The image path.
string _getImageData (string $data, [string $encoding = 'none'], [string $compression = 'none'], [boolean $upload = true])
  • string $data: The id of the image.
  • string $encoding: The encoding type for the image data. (none, base64, or binhex)
  • string $compression: The compression type for the image data. (none, gzip, or lzf)
  • boolean $upload: Process direction (true of encode/compress or false if decode/decompress)

Documentation generated on Sun, 30 Jan 2011 05:08:44 +0000 by phpDocumentor 1.4.3