Gallery
in package
Gallery Class
Table of Contents
Properties
- $albumdir : mixed
- $table : mixed
- $albums : mixed
- $data : mixed
- $lastalbumsort : mixed
- $theme : mixed
- $themes : mixed
- $unprotected_pages : mixed
Methods
- __construct() : Gallery
- Creates an instance of a gallery
- __toString() : string
- "Magic" function to return a string identifying the object when it is treated as a string
- addAlbumHandler() : mixed
- registers object handlers for album varients
- addImageHandler() : mixed
- registers object handlers for image varients
- checkforGuest() : mixed
- Checks if guest is loggedin for the album
- clearCache() : mixed
- Cleans out the cache folder
- commentClean() : mixed
- countHit() : mixed
- counts visits to the object
- garbageCollect() : bool
- For every album in the gallery, look for its file. Delete from the database if the file does not exist. Do the same for images. Clean up comments that have been left orphaned.
- get() : mixed
- getAlbum() : Album
- Returns the a specific album in the array indicated by index.
- getAlbumDir() : string
- Returns the main albums directory
- getAlbumPublish() : mixed
- getAlbums() : array<string|int, mixed>
- Get Albums will create our $albums array with a fully populated set of Album names in the correct order.
- getAlbumSortKey() : string
- Returns the DB field corresponding to the album sort type desired
- getAlbumsPerPage() : int
- Gets the albums per page setting
- getAlbumUseImagedate() : mixed
- Option to update album date from date of new images
- getAllAlbums() : array<string|int, mixed>
- Gets all albums with the right order as set on the backend.
- getAllAlbumsFromDB() : array<string|int, mixed>
- Gets all albums from the database direclty. This is less accurate than getAllAlbums() but much faster on large sites with thousends of albums especially if $keeplevel_sortorder is kept false.
- getBareTitle() : string
- Returns a tag stripped title
- getCodeblock() : array<string|int, mixed>
- Returns the codeblocks as an serialized array
- getCopyrightNotice() : type
- Gets the copyright notice
- getCopyrightRightsholder() : mixed
- Gets the copyright site holder
- getCopyrightURL() : type
- Gets the copyright site url
- getCurrentTheme() : string
- Returns the foldername of the current theme.
- getDesc() : string
- Returns the gallery description
- getFirstPageImages() : int
- Gets the number of images if the thumb transintion page for sharing thumbs on the last album and the first image page
- getGallerySession() : mixed
- Option of for gallery sessions
- getHitcounter() : int
- Returns the hitcount
- getImagePublish() : mixed
- getNumAlbums() : int
- Returns the total number of TOPLEVEL albums in the gallery (does not include sub-albums)
- getNumComments() : array<string|int, mixed>
- Returns the count of comments
- getNumImages() : int
- Returns the number of images in the gallery
- getParentSiteTitle() : string
- Title to be used for a parent website if Zenphoto is used as a part of it
- getParentSiteURL() : string
- URL to be used for a parent website if Zenphoto is used as a part of it
- getPassword() : mixed
- Returns the hashed password for guest gallery access
- getPasswordHint() : string
- Returns the hind associated with the gallery password
- getSecondLevelThumbs() : mixed
- Option to show subalbum images in the thumbnail selector
- getSecurity() : mixed
- Option to allow only registered users view the site
- getSortDirection() : mixed
- getSortType() : mixed
- getThemes() : array<string|int, mixed>
- Populates the theme array and returns it. The theme array contains information about all the currently available themes.
- getThumbSelectImages() : mixed
- Option to show images in the thumbnail selector
- getTitle() : string
- Returns the gallery title
- getTotalPages() : int
- Gets the total album pages
- getUser() : mixed
- getUserLogonField() : mixed
- Option to expose the user field on logon forms
- getWebsiteTitle() : string
- Title to be used for a parent website if Zenphoto is used as a part of it
- getWebsiteURL() : string
- The URL of the home (not Zenphoto gallery) WEBsite
- isProtected() : mixed
- returns true if there is any protection on the gallery
- isProtectedGalleryIndex() : bool
- Checks if the site is protected and if the gallery index is one of the unprotected pages
- isUnprotectedPage() : bool
- Tests if a custom page is excluded from password protection
- save() : mixed
- set() : mixed
- setAlbumPublish() : mixed
- setAlbumUseImagedate() : mixed
- setCodeblock() : mixed
- set the codeblocks as an serialized array
- setCopyrightNotice() : mixed
- Sets the copyright notice
- setCopyrightURL() : mixed
- Sets the copyright site url
- setCurrentTheme() : mixed
- Sets the current theme
- setDesc() : mixed
- Sets the gallery description
- setGallerySession() : mixed
- setImagePublish() : mixed
- setParentSiteTitle() : mixed
- Set the title to be used for a parent website if Zenphoto is used as a part of it
- setParentSiteURL() : string
- The URL of the home (not Zenphoto gallery) WEBsite
- setPassword() : mixed
- setPasswordHint() : mixed
- setSecondLevelThumbs() : mixed
- setSecurity() : mixed
- setSortDirection() : mixed
- setSortType() : mixed
- setThumbSelectImages() : mixed
- setTitle() : mixed
- setUnprotectedPage() : mixed
- setUser() : mixed
- setUserLogonField() : mixed
- setWebsiteTitle() : mixed
- Set the title to be used for a parent website if Zenphoto is used as a part of it
- setWebsiteURL() : string
- Set URL of the home (not Zenphoto gallery) WEBsite
- sortAlbumArray() : array<string|int, mixed>
- Sort the album array based on either according to the sort key.
- validImage() : bool
- Returns true if the file is an image
- validImageAlt() : bool
- Returns true if the file is handled by an image handler plugin object
- getImageCount() : mixed
- loadAlbumNames() : array<string|int, mixed>
- Load all of the albums names that are found in the Albums directory on disk.
Properties
$albumdir
public
mixed
$albumdir
= \NULL
$table
public
mixed
$table
= 'gallery'
$albums
protected
mixed
$albums
= \NULL
$data
protected
mixed
$data
= array()
$lastalbumsort
protected
mixed
$lastalbumsort
= \NULL
$theme
protected
mixed
$theme
$themes
protected
mixed
$themes
$unprotected_pages
protected
mixed
$unprotected_pages
= array()
Methods
__construct()
Creates an instance of a gallery
public
__construct() : Gallery
Return values
Gallery__toString()
"Magic" function to return a string identifying the object when it is treated as a string
public
__toString() : string
Return values
stringaddAlbumHandler()
registers object handlers for album varients
public
static addAlbumHandler(type $suffix, type $objectName) : mixed
Parameters
- $suffix : type
- $objectName : type
Tags
addImageHandler()
registers object handlers for image varients
public
static addImageHandler(type $suffix, type $objectName) : mixed
Parameters
- $suffix : type
- $objectName : type
Tags
checkforGuest()
Checks if guest is loggedin for the album
public
checkforGuest([unknown_type &$hint = NULL ][, unknown_type &$show = NULL ]) : mixed
Parameters
- $hint : unknown_type = NULL
- $show : unknown_type = NULL
clearCache()
Cleans out the cache folder
public
static clearCache([string $cachefolder = NULL ]) : mixed
Parameters
- $cachefolder : string = NULL
-
the sub-folder to clean
commentClean()
public
commentClean(mixed $table) : mixed
Parameters
- $table : mixed
countHit()
counts visits to the object
public
countHit() : mixed
garbageCollect()
For every album in the gallery, look for its file. Delete from the database if the file does not exist. Do the same for images. Clean up comments that have been left orphaned.
public
garbageCollect([bool $cascade = true ][, bool $complete = false ][, int $restart = '' ]) : bool
Returns true if the operation was interrupted because it was taking too long
Parameters
- $cascade : bool = true
-
garbage collect every image and album in the gallery.
- $complete : bool = false
-
garbage collect every image and album in the database - completely cleans the database.
- $restart : int = ''
-
Image ID to restart scan from
Return values
boolget()
public
get(mixed $field) : mixed
Parameters
- $field : mixed
getAlbum()
Returns the a specific album in the array indicated by index.
public
getAlbum(int $index) : Album
Takes care of bounds checking, no need to check input.
Parameters
- $index : int
-
the index of the album sought
Return values
AlbumgetAlbumDir()
Returns the main albums directory
public
getAlbumDir() : string
Return values
stringgetAlbumPublish()
public
getAlbumPublish() : mixed
getAlbums()
Get Albums will create our $albums array with a fully populated set of Album names in the correct order.
public
getAlbums([int $page = 0 ][, string $sorttype = null ][, string $sortdirection = null ][, bool $care = true ][, bool $mine = NULL ]) : array<string|int, mixed>
Returns an array of albums (a pages worth if $page is not zero)
Parameters
- $page : int = 0
-
An option parameter that can be used to return a slice of the array.
- $sorttype : string = null
-
the kind of sort desired
- $sortdirection : string = null
-
set to a direction to override the default option
- $care : bool = true
-
set to false if the order of the albums does not matter
- $mine : bool = NULL
-
set true/false to override ownership
Return values
array<string|int, mixed>getAlbumSortKey()
Returns the DB field corresponding to the album sort type desired
public
getAlbumSortKey([string $sorttype = null ]) : string
Parameters
- $sorttype : string = null
-
the desired sort
Return values
stringgetAlbumsPerPage()
Gets the albums per page setting
public
getAlbumsPerPage() : int
Tags
Return values
intgetAlbumUseImagedate()
Option to update album date from date of new images
public
getAlbumUseImagedate() : mixed
getAllAlbums()
Gets all albums with the right order as set on the backend.
public
getAllAlbums([obj $albumobj = NULL ][, int $rights = UPLOAD_RIGHTS ][, bool $includetitles = true ]) : array<string|int, mixed>
Note while this is an very accurate result since this is using the filesystem to check and keeps the individuel sort order settings of each subalbum level it is therefore very slow on large galleries with thousands of albums.
Use the much faster but less accurate getAllAlbumsFromDB() instead if speed is needed. This is best used for any albums selector.
Note unless the §rights parameter is set to ALL_ALBUMS_RIGHTS or higher or the user is full admin dynamic albums are excluded.
Parameters
- $albumobj : obj = NULL
-
Default null for all albums, optional albumobject to get all sublevels of
- $rights : int = UPLOAD_RIGHTS
-
Rights constant to check the album access by, default UPLOAD_RIGHTS. Set to null to disable rights check
- $includetitles : bool = true
-
If set to true (default) returns an array with the album names as keys and the titles as values, otherwise just an array with the names
Tags
Return values
array<string|int, mixed>getAllAlbumsFromDB()
Gets all albums from the database direclty. This is less accurate than getAllAlbums() but much faster on large sites with thousends of albums especially if $keeplevel_sortorder is kept false.
public
getAllAlbumsFromDB([bool $keeplevel_sortorder = false ][, obj $albumobj = NULL ][, int $rights = UPLOAD_RIGHTS ][, bool $includetitles = true ]) : array<string|int, mixed>
Note that the filesystem and databse may be out of sync in the moment of fetching the data. If you need to be sure to cover this use getAllAlbums();
$keeplevel_sortorder is false so the order follows their nesting but the sortorder of individual sublevels is not kept to archieve greater speed. Order is simply by folder name instead. Set to true each subalbum level follows its individual sort order setting. While this is also faster than getAllAlbums() this is significantly slower than the default.
Note unless the §rights parameter is set to ALL_ALBUMS_RIGHTS or higher or the user is full admin dynamic albums are excluded.
Parameters
- $keeplevel_sortorder : bool = false
-
Default false, set to true if the sublevels should sorted by their individual settings (slower)
- $albumobj : obj = NULL
-
Default null for all albums, optional albumobject to get all sublevels of
- $rights : int = UPLOAD_RIGHTS
-
Rights constant to check the album access by, default UPLOAD_RIGHTS
- $includetitles : bool = true
-
If set to true (default) returns an array with the album names as keys and the titles as values, otherwise just an array with the names
Tags
Return values
array<string|int, mixed>getBareTitle()
Returns a tag stripped title
public
getBareTitle([string $locale = NULL ]) : string
Parameters
- $locale : string = NULL
Return values
stringgetCodeblock()
Returns the codeblocks as an serialized array
public
getCodeblock() : array<string|int, mixed>
Return values
array<string|int, mixed>getCopyrightNotice()
Gets the copyright notice
public
getCopyrightNotice([type $locale = null ]) : type
Parameters
- $locale : type = null
Tags
Return values
typegetCopyrightRightsholder()
Gets the copyright site holder
public
getCopyrightRightsholder() : mixed
Note: This does not fetch an actual field value but with some fallbacks
- 'copyright_site_rightsholder' field
- 'copyright_site_rightsholder_custom' field
- The site master user
Tags
getCopyrightURL()
Gets the copyright site url
public
getCopyrightURL() : type
Tags
Return values
typegetCurrentTheme()
Returns the foldername of the current theme.
public
getCurrentTheme() : string
if no theme is set, picks the "first" theme.
Return values
stringgetDesc()
Returns the gallery description
public
getDesc([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetFirstPageImages()
Gets the number of images if the thumb transintion page for sharing thumbs on the last album and the first image page
public
static getFirstPageImages([obj $obj = null ][, bool $one_image_page = false ]) : int
Parameters
- $obj : obj = null
-
Album object (or child class object) or searchengine object
- $one_image_page : bool = false
Tags
Return values
intgetGallerySession()
Option of for gallery sessions
public
getGallerySession() : mixed
getHitcounter()
Returns the hitcount
public
getHitcounter() : int
Return values
intgetImagePublish()
public
getImagePublish() : mixed
getNumAlbums()
Returns the total number of TOPLEVEL albums in the gallery (does not include sub-albums)
public
getNumAlbums([bool $db = false ][, bool $publishedOnly = false ]) : int
Parameters
- $db : bool = false
-
whether or not to use the database (includes ALL detected albums) or the directories
- $publishedOnly : bool = false
-
set to true to exclude un-published albums
Return values
intgetNumComments()
Returns the count of comments
public
getNumComments([bool $moderated = false ]) : array<string|int, mixed>
Parameters
- $moderated : bool = false
-
set true if you want to see moderated comments
Return values
array<string|int, mixed>getNumImages()
Returns the number of images in the gallery
public
getNumImages([int $what = 0 ]) : int
Parameters
- $what : int = 0
-
0: all images from the database 1: published images from the database 2: "viewable" images via the object model
Return values
intgetParentSiteTitle()
Title to be used for a parent website if Zenphoto is used as a part of it
public
getParentSiteTitle([string $locale = NULL ]) : string
œsince ZenphotoCMS 1.6
Parameters
- $locale : string = NULL
Return values
stringgetParentSiteURL()
URL to be used for a parent website if Zenphoto is used as a part of it
public
getParentSiteURL() : string
œsince ZenphotoCMS 1.6
Return values
stringgetPassword()
Returns the hashed password for guest gallery access
public
getPassword() : mixed
getPasswordHint()
Returns the hind associated with the gallery password
public
getPasswordHint([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetSecondLevelThumbs()
Option to show subalbum images in the thumbnail selector
public
getSecondLevelThumbs() : mixed
getSecurity()
Option to allow only registered users view the site
public
getSecurity() : mixed
getSortDirection()
public
getSortDirection() : mixed
getSortType()
public
getSortType() : mixed
getThemes()
Populates the theme array and returns it. The theme array contains information about all the currently available themes.
public
getThemes() : array<string|int, mixed>
Return values
array<string|int, mixed>getThumbSelectImages()
Option to show images in the thumbnail selector
public
getThumbSelectImages() : mixed
getTitle()
Returns the gallery title
public
getTitle([mixed $locale = NULL ]) : string
Parameters
- $locale : mixed = NULL
Return values
stringgetTotalPages()
Gets the total album pages
public
getTotalPages() : int
Tags
Return values
intgetUser()
public
getUser() : mixed
getUserLogonField()
Option to expose the user field on logon forms
public
getUserLogonField() : mixed
getWebsiteTitle()
Title to be used for a parent website if Zenphoto is used as a part of it
public
getWebsiteTitle([string $locale = NULL ]) : string
Parameters
- $locale : string = NULL
Tags
Return values
stringgetWebsiteURL()
The URL of the home (not Zenphoto gallery) WEBsite
public
getWebsiteURL() : string
Tags
Return values
stringisProtected()
returns true if there is any protection on the gallery
public
isProtected() : mixed
isProtectedGalleryIndex()
Checks if the site is protected and if the gallery index is one of the unprotected pages
public
isProtectedGalleryIndex() : bool
Tags
Return values
boolisUnprotectedPage()
Tests if a custom page is excluded from password protection
public
isUnprotectedPage( $page) : bool
Parameters
Return values
boolsave()
public
save() : mixed
set()
public
set(mixed $field, mixed $value) : mixed
Parameters
- $field : mixed
- $value : mixed
setAlbumPublish()
public
setAlbumPublish(mixed $v) : mixed
Parameters
- $v : mixed
setAlbumUseImagedate()
public
setAlbumUseImagedate(mixed $value) : mixed
Parameters
- $value : mixed
setCodeblock()
set the codeblocks as an serialized array
public
setCodeblock(mixed $cb) : mixed
Parameters
- $cb : mixed
setCopyrightNotice()
Sets the copyright notice
public
setCopyrightNotice(type $notice) : mixed
Parameters
- $notice : type
Tags
setCopyrightURL()
Sets the copyright site url
public
setCopyrightURL(type $url) : mixed
Parameters
- $url : type
Tags
setCurrentTheme()
Sets the current theme
public
setCurrentTheme(mixed $theme) : mixed
Parameters
- $theme : mixed
setDesc()
Sets the gallery description
public
setDesc(string $desc) : mixed
Parameters
- $desc : string
Tags
setGallerySession()
public
setGallerySession(mixed $value) : mixed
Parameters
- $value : mixed
setImagePublish()
public
setImagePublish(mixed $v) : mixed
Parameters
- $v : mixed
setParentSiteTitle()
Set the title to be used for a parent website if Zenphoto is used as a part of it
public
setParentSiteTitle(mixed $value) : mixed
œsince ZenphotoCMS 1.6
Parameters
- $value : mixed
setParentSiteURL()
The URL of the home (not Zenphoto gallery) WEBsite
public
setParentSiteURL(mixed $value) : string
œsince ZenphotoCMS 1.6
Parameters
- $value : mixed
Return values
stringsetPassword()
public
setPassword(mixed $value) : mixed
Parameters
- $value : mixed
setPasswordHint()
public
setPasswordHint(mixed $value) : mixed
Parameters
- $value : mixed
setSecondLevelThumbs()
public
setSecondLevelThumbs(mixed $value) : mixed
Parameters
- $value : mixed
setSecurity()
public
setSecurity(mixed $value) : mixed
Parameters
- $value : mixed
setSortDirection()
public
setSortDirection(mixed $value) : mixed
Parameters
- $value : mixed
setSortType()
public
setSortType(mixed $value) : mixed
Parameters
- $value : mixed
setThumbSelectImages()
public
setThumbSelectImages(mixed $value) : mixed
Parameters
- $value : mixed
setTitle()
public
setTitle(mixed $title) : mixed
Parameters
- $title : mixed
setUnprotectedPage()
public
setUnprotectedPage(mixed $page, mixed $on) : mixed
Parameters
- $page : mixed
- $on : mixed
setUser()
public
setUser(mixed $value) : mixed
Parameters
- $value : mixed
setUserLogonField()
public
setUserLogonField(mixed $value) : mixed
Parameters
- $value : mixed
setWebsiteTitle()
Set the title to be used for a parent website if Zenphoto is used as a part of it
public
setWebsiteTitle(type $value) : mixed
Parameters
- $value : type
Tags
setWebsiteURL()
Set URL of the home (not Zenphoto gallery) WEBsite
public
setWebsiteURL(mixed $value) : string
Parameters
- $value : mixed
Tags
Return values
stringsortAlbumArray()
Sort the album array based on either according to the sort key.
public
sortAlbumArray(mixed $parentalbum, array<string|int, mixed> $albums[, string $sortkey = '`sort_order`' ][, string $sortdirection = NULL ][, bool $mine = NULL ]) : array<string|int, mixed>
Default is to sort on the sort_order
field.
Returns an array with the albums in the desired sort order
Parameters
- $parentalbum : mixed
- $albums : array<string|int, mixed>
-
array of album names
- $sortkey : string = '`sort_order`'
-
the sorting scheme
- $sortdirection : string = NULL
- $mine : bool = NULL
-
set true/false to override ownership
Tags
Return values
array<string|int, mixed>validImage()
Returns true if the file is an image
public
static validImage(string $filename) : bool
Parameters
- $filename : string
-
the name of the target
Return values
boolvalidImageAlt()
Returns true if the file is handled by an image handler plugin object
public
static validImageAlt(string $filename) : bool
Parameters
- $filename : string
Return values
boolgetImageCount()
private
getImageCount(mixed $album) : mixed
Parameters
- $album : mixed
loadAlbumNames()
Load all of the albums names that are found in the Albums directory on disk.
private
loadAlbumNames() : array<string|int, mixed>
Returns an array containing this list.