PHP 클래스 Ansel_Storage, horde

Copyright 2001-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
저자: Michael J Rubinsky ([email protected])
파일 보기 프로젝트 열기: horde/horde

보호된 프로퍼티들

프로퍼티 타입 설명
$_db Horde_Db_Adapter database handle
$_images array Local cache of retrieved images
$_shares Horde_Share The Horde_Shares object to use for this scope.

공개 메소드들

메소드 설명
__construct ( Horde_Core_Share_Driver $shareOb ) : Ansel_Storage Const'r
__get ( string $property ) Property accessor
buildGalleries ( array $shares ) : array Build an array of Ansel_Gallery objects from an array of Horde_Share_Object objects.
buildGallery ( Horde_Share_Object $share ) : Ansel_Gallery Build a single Ansel_Gallery object from a Horde_Share_Object
clearImageAttributes ( integer $image_id ) Clears an image's attributes from storage.
countGalleries ( $userid, array $params = [] ) : integer Return the count of galleries that the user has specified permissions to and that match any of the requested attributes.
createGallery ( array $attributes = [], Horde_Perms_Permission $perm = null, integer $parent = null ) : Ansel_Gallery Create and initialise a new gallery object.
emptyGallery ( Ansel_Gallery $gallery ) Empties a gallery of all images.
ensureHash ( string $hash ) Ensure the style hash is recorded in the database.
galleryExists ( integer $gallery_id = null, string $slug = null ) : boolean Check if a gallery exists. Need to do this here so we can also check by gallery slug.
getGalleries ( array $ids, integer $perms = Horde_Perms::SHOW ) : array Retrieve an array of Ansel_Gallery objects for the requested ids
getGalleriesBySlugs ( array $slugs, $perms = Horde_Perms::SHOW ) : array Retrieve an array of Ansel_Gallery objects for the given slugs.
getGallery ( integer $gallery_id, array $overrides = [] ) : Ansel_Gallery Retrieve an Ansel_Gallery given the share id
getGalleryBySlug ( string $slug, array $overrides = [] ) : Ansel_Gallery Retrieve an Ansel_Gallery given the gallery's slug
getHashes ( ) : array Get a list of all known styleHashes.
getImage ( integer $id ) : Ansel_Image Returns the image corresponding to the given id.
getImageAttributes ( integer $image_id ) : array Get image's attribtues from storage
getImageJson ( array $images, Ansel_Style $style = null, boolean $full = false, string $image_view = 'mini', boolean $view_links = false ) : string Retrieve json data for an arbitrary list of image ids, not necessarily from the same gallery.
getImages ( array $params = [] ) : array Return the images corresponding to the given ids.
getImagesGeodata ( array $image_ids = [], integer $gallery = null ) : array Return images' geolocation data.
getRandomGallery ( array $params = [] ) Returns a random Ansel_Gallery from a list fitting the search criteria.
getRecentImages ( array $galleries = [], integer $limit = 10, array $slugs = [] ) : array Returns a list of Ansel_Images of the most recently added images for the current user.
getRecentImagesGeodata ( string $user = null, integer $start, integer $count = 8 ) : array Like getRecentImages, but returns geotag data for the most recently added images from the current user. Useful for providing images to help locate images at the same place.
listAllGalleries ( ) : array Returns a list of ALL galleries, regardless of permissions.
listGalleries ( array $params = [] ) : array Retrieves the current user's gallery list from storage.
listImages ( array $params = [] ) : array Lists a slice of the image ids in the given gallery.
removeGallery ( Ansel_Gallery $gallery ) Removes an Ansel_Gallery.
removeImage ( integer $image_id ) Deletes an Ansel_Image from data storage.
saveImage ( Ansel_Image $image ) : integer Save image details to storage. Does NOT update the cached image files.
saveImageAttribute ( integer $image_id, $attribute, string $value ) Store an image attribute to storage
searchLocations ( string $search = '' ) : array Search for a textual location string from the passed in search token.
setImageSortOrder ( integer $imageId, integer $pos ) Set image sort order
setImagesGallery ( array $image_ids, integer $gallery_id ) Set the gallery id for a set of images. Useful for bulk updating images when moving from one gallery to another.
setStorage ( mixed $storage ) Backend setter

보호된 메소드들

메소드 설명
_getImageCommentCounts ( array $ids ) : array Get the total number of comments for an image.
_getImageFields ( $alias = '' ) : string Helper function to get a string of field names
_toImageDriverName ( string $field ) : string Convert an Ansel_Image property to it's backend storage field name.

메소드 상세

__construct() 공개 메소드

Const'r
public __construct ( Horde_Core_Share_Driver $shareOb ) : Ansel_Storage
$shareOb Horde_Core_Share_Driver
리턴 Ansel_Storage

__get() 공개 메소드

Property accessor
public __get ( string $property )
$property string The property to access.

_getImageCommentCounts() 보호된 메소드

Get the total number of comments for an image.
protected _getImageCommentCounts ( array $ids ) : array
$ids array Array of image ids
리턴 array of results. @see forums/numMessagesBatch api call

_getImageFields() 보호된 메소드

Helper function to get a string of field names
protected _getImageFields ( $alias = '' ) : string
리턴 string

_toImageDriverName() 보호된 메소드

Convert an Ansel_Image property to it's backend storage field name.
protected _toImageDriverName ( string $field ) : string
$field string The field name
리턴 string The converted field name suitable for use in backend.

buildGalleries() 공개 메소드

Build an array of Ansel_Gallery objects from an array of Horde_Share_Object objects.
public buildGalleries ( array $shares ) : array
$shares array An array of Horde_Share_Object objects.
리턴 array Ansel_Gallery objects.

buildGallery() 공개 메소드

Build a single Ansel_Gallery object from a Horde_Share_Object
public buildGallery ( Horde_Share_Object $share ) : Ansel_Gallery
$share Horde_Share_Object The share
리턴 Ansel_Gallery

clearImageAttributes() 공개 메소드

Clears an image's attributes from storage.
public clearImageAttributes ( integer $image_id )
$image_id integer The image to clear

countGalleries() 공개 메소드

Return the count of galleries that the user has specified permissions to and that match any of the requested attributes.
public countGalleries ( $userid, array $params = [] ) : integer
$params array Parameter array:
 (integer)perm          The level of permissions to require for a
                        gallery to return it [Horde_Perms::SHOW]
 (mixed)attributes      Restrict the galleries counted to those
                        matching $attributes. An array of
                        attribute/values pairs or a gallery owner
                        username.
(Ansel_Gallery)parent   The parent share to start counting at.
(boolean)all_levels      Return all levels, or just the direct children of
                        $parent? [true]
(array)tags             Filter results by galleries tagged with tags.
리턴 integer The count

createGallery() 공개 메소드

Create and initialise a new gallery object.
public createGallery ( array $attributes = [], Horde_Perms_Permission $perm = null, integer $parent = null ) : Ansel_Gallery
$attributes array The gallery attributes.
$perm Horde_Perms_Permission The permissions for the gallery if the defaults are not desirable.
$parent integer The id of the parent gallery (if any)
리턴 Ansel_Gallery A new gallery object.

emptyGallery() 공개 메소드

Empties a gallery of all images.
public emptyGallery ( Ansel_Gallery $gallery )
$gallery Ansel_Gallery The ansel gallery to empty.

ensureHash() 공개 메소드

Ensure the style hash is recorded in the database.
public ensureHash ( string $hash )
$hash string The hash to record.

galleryExists() 공개 메소드

Check if a gallery exists. Need to do this here so we can also check by gallery slug.
public galleryExists ( integer $gallery_id = null, string $slug = null ) : boolean
$gallery_id integer The gallery id
$slug string The gallery slug
리턴 boolean

getGalleries() 공개 메소드

Retrieve an array of Ansel_Gallery objects for the requested ids
public getGalleries ( array $ids, integer $perms = Horde_Perms::SHOW ) : array
$ids array Gallery ids to fetch
$perms integer Horde_Perms constant for the perms required.
리턴 array An array of Ansel_Gallery objects

getGalleriesBySlugs() 공개 메소드

Retrieve an array of Ansel_Gallery objects for the given slugs.
public getGalleriesBySlugs ( array $slugs, $perms = Horde_Perms::SHOW ) : array
$slugs array The gallery slugs.
리턴 array An array of Ansel_Gallery objects.

getGallery() 공개 메소드

Retrieve an Ansel_Gallery given the share id
public getGallery ( integer $gallery_id, array $overrides = [] ) : Ansel_Gallery
$gallery_id integer The gallery_id to fetch
$overrides array An array of attributes that should be overridden when the gallery is returned.
리턴 Ansel_Gallery

getGalleryBySlug() 공개 메소드

Retrieve an Ansel_Gallery given the gallery's slug
public getGalleryBySlug ( string $slug, array $overrides = [] ) : Ansel_Gallery
$slug string The gallery slug
$overrides array An array of attributes that should be overridden when the gallery is returned.
리턴 Ansel_Gallery The gallery object

getHashes() 공개 메소드

Get a list of all known styleHashes.
public getHashes ( ) : array
리턴 array An array of style hashes.

getImage() 공개 메소드

Returns the image corresponding to the given id.
public getImage ( integer $id ) : Ansel_Image
$id integer The image_id of the image to retrieve.
리턴 Ansel_Image The image object requested..

getImageAttributes() 공개 메소드

Get image's attribtues from storage
public getImageAttributes ( integer $image_id ) : array
$image_id integer The image id
리턴 array A image attribute hash

getImageJson() 공개 메소드

Retrieve json data for an arbitrary list of image ids, not necessarily from the same gallery.
public getImageJson ( array $images, Ansel_Style $style = null, boolean $full = false, string $image_view = 'mini', boolean $view_links = false ) : string
$images array An array of image ids
$style Ansel_Style A gallery style to force if requesting pretty thumbs.
$full boolean Generate full urls
$image_view string Which image view to use? screen, thumb etc..
$view_links boolean Include links to the image view
리턴 string The json data

getImages() 공개 메소드

Return the images corresponding to the given ids.
public getImages ( array $params = [] ) : array
$params array function parameters:
  'ids'        - An array of image ids to fetch.
  'preserve'   - Preserve the order of the image ids when returned.
  'gallery_id' - Return all images from requested gallery (ignores 'ids').
  'from'       - If passing a gallery, start at this image.
  'count'      - If passing a gallery, return this many images.
리턴 array An array of Ansel_Image objects.

getImagesGeodata() 공개 메소드

Return images' geolocation data.
public getImagesGeodata ( array $image_ids = [], integer $gallery = null ) : array
$image_ids array An array of image_ids to look up.
$gallery integer A gallery id. If this is provided, will return all images in the gallery that have geolocation data ($image_ids would be ignored).
리턴 array of geodata

getRandomGallery() 공개 메소드

Returns a random Ansel_Gallery from a list fitting the search criteria.
또한 보기: Ansel_Storage::listGalleries()
public getRandomGallery ( array $params = [] )
$params array

getRecentImages() 공개 메소드

Returns a list of Ansel_Images of the most recently added images for the current user.
public getRecentImages ( array $galleries = [], integer $limit = 10, array $slugs = [] ) : array
$galleries array An array of gallery ids to search in. If left empty, will search all galleries with Horde_Perms::SHOW.
$limit integer The maximum number of images to return
$slugs array An array of gallery slugs.
리턴 array An array of Ansel_Image objects

getRecentImagesGeodata() 공개 메소드

Like getRecentImages, but returns geotag data for the most recently added images from the current user. Useful for providing images to help locate images at the same place.
public getRecentImagesGeodata ( string $user = null, integer $start, integer $count = 8 ) : array
$user string Limit images to this user
$start integer Start a slice at this image number
$count integer Include this many images
리턴 array An array of image ids

listAllGalleries() 공개 메소드

Returns a list of ALL galleries, regardless of permissions.
public listAllGalleries ( ) : array
리턴 array

listGalleries() 공개 메소드

Retrieves the current user's gallery list from storage.
public listGalleries ( array $params = [] ) : array
$params array Optional parameters:
  (integer)perm      The permissions filter to use [Horde_Perms::SHOW]
  (mixed)attributes  Restrict the galleries returned to those matching
                     the filters. Can be an array of attribute/values
                     pairs or a gallery owner username.
  (integer)parent    The parent share to start listing at.
  (boolean)all_levels If set, return all levels below parent, not just
                     direct children [TRUE]
  (integer)from      The gallery to start listing at.
  (integer)count     The number of galleries to return.
  (string)sort_by    Attribute to sort by.
  (integer)direction The direction to sort by [Ansel::SORT_ASCENDING]
  (array)tags        An array of tags to limit results by.
리턴 array An array of Ansel_Gallery objects

listImages() 공개 메소드

Lists a slice of the image ids in the given gallery.
public listImages ( array $params = [] ) : array
$params array Filter parameters.
 integer|array 'gallery_id'  - A gallery id to list images from
 integer 'offset'            - The image to start listing from
 integer 'limit'             - How many images to return
 array|string 'fields'       - The fields to return
 string 'sort'               - The field to sort by.
 array  'filter'             - Additional filters. Each element is an
                               array containing 'property', 'op', and
                               'value' keys. Passing 'IN' as the 'op'
                               and an array as 'value' will produce a
                               SQL IN conditional.
리턴 array An array of images. Either an array of ids, or an array of field values, keyed by id.

removeGallery() 공개 메소드

Removes an Ansel_Gallery.
public removeGallery ( Ansel_Gallery $gallery )
$gallery Ansel_Gallery The gallery to delete

removeImage() 공개 메소드

Deletes an Ansel_Image from data storage.
public removeImage ( integer $image_id )
$image_id integer The image id(s) to remove.

saveImage() 공개 메소드

Save image details to storage. Does NOT update the cached image files.
public saveImage ( Ansel_Image $image ) : integer
$image Ansel_Image The image to save.
리턴 integer The image id

saveImageAttribute() 공개 메소드

Store an image attribute to storage
public saveImageAttribute ( integer $image_id, $attribute, string $value )
$image_id integer The image id
$value string The attrbute value

searchLocations() 공개 메소드

Used for location autocompletion.
public searchLocations ( string $search = '' ) : array
$search string Search fragment for autocompleting location strings
리턴 array The results

setImageSortOrder() 공개 메소드

Set image sort order
public setImageSortOrder ( integer $imageId, integer $pos )
$imageId integer The image id
$pos integer The new sort order position

setImagesGallery() 공개 메소드

Set the gallery id for a set of images. Useful for bulk updating images when moving from one gallery to another.
public setImagesGallery ( array $image_ids, integer $gallery_id )
$image_ids array An array of image ids
$gallery_id integer The gallery id to move the images to.

setStorage() 공개 메소드

Backend setter
public setStorage ( mixed $storage )
$storage mixed The backend storage driver.

프로퍼티 상세

$_db 보호되어 있는 프로퍼티

database handle
protected Horde_Db_Adapter $_db
리턴 Horde_Db_Adapter

$_images 보호되어 있는 프로퍼티

Local cache of retrieved images
protected array $_images
리턴 array

$_shares 보호되어 있는 프로퍼티

The Horde_Shares object to use for this scope.
protected Horde_Share $_shares
리턴 Horde_Share