functions.php
basic functions used by zenphoto
Table of Contents
Constants
- ZENPHOTO_LOCALE = \setMainDomain()
- ZP_NEWS_ENABLED = \false
- ZP_PAGES_ENABLED = \false
Functions
- parseAllowedTags() : array<string|int, mixed>
- parses the allowed HTML tags for use by htmLawed
- checkObjectsThumb() : string
- Search for a thumbnail for the image
- truncate_string() : string
- Returns a truncated string
- tidyHTML() : string
- Fixes unbalanced HTML tags. Uses the library htmlawed or if available the native PHP extension tidy
- shortenContent() : string
- Returns truncated html formatted content
- lookupSortKey() : string
- Returns a sort field part for querying Note: $sorttype may be a comma separated list of field names. If so, these are peckmarked and returned otherwise unchanged.
- zpFormattedDate() : string
- Returns a formatted date for output
- getDatetimeObject() : object
- Returns a datetime object
- getStandardDateFormats() : array<string|int, mixed>
- Returns an array with datetime (keys) and ICU dateformat (values) strings
- myts_date() : string
- Simple SQL timestamp formatting function.
- zp_mail() : string
- Send an mail to the mailing list. We also attempt to intercept any form injection attacks by slime ball spammers. Returns error message if send failure.
- sortByMultilingual() : array<string|int, mixed>
- Sorts the results of a DB search by the current locale string for $field
- checkAlbumPassword() : bool
- Checks to see access is allowed to an album Returns true if access is allowed.
- getPluginFiles() : array<string|int, mixed>
- Returns a consolidated list of plugins The array structure is key=plugin name, value=plugin path
- getPlugin() : string|false
- Returns the fully qualified file path of a plugin file.
- getEnabledPlugins() : array<string|int, mixed>
- Returns an array of the currently enabled plugins
- extensionEnabled() : bool
- Returns if a plugin is enabled
- enableExtension() : mixed
- Enables a plugin
- disableExtension() : mixed
- Disables an extension
- getManagedAlbumList() : array<string|int, mixed>
- Populates and returns the $_zp_admin_album_list array
- populateManagedObjectsList() : array<string|int, mixed>
- Returns a list of album names managed by $id
- getAllSubAlbumIDs() : array<string|int, mixed>
- Returns an array of album ids whose parent is the folder
- handleSearchParms() : mixed
- recovers search parameters from stored cookie, clears the cookie
- galleryAlbumsPerPage() : int
- Returns the number of album thumbs that go on a gallery page
- setupTheme() : string
- Returns the theme folder If there is an album theme, loads the theme options.
- getAllTagsUnique() : array<string|int, mixed>
- Returns an array of unique tag names
- getAllTagsCount() : array<string|int, mixed>
- Returns an array indexed by 'tag' with the element value the count of the tag
- getTagCountByAccess() : int
- Checks if a tag is assigned at all and if it can be viewed by the current visitor and returns the corrected count Helper function used optionally within getAllTagsCount() and getAllTagsUnique()
- storeTags() : mixed
- Stores tags for an object
- readTags() : unknown
- Retrieves the tags for an object Returns them in an array
- generateListFromArray() : mixed
- Creates the body of a select list
- generateListFromFiles() : mixed
- Generates a selection list from files found on disk
- generateAttributesFromArray() : string
- Helper to generate attributename="attributevalue" for HTML elements based on an array consisting of key => value pairs
- getLinkHTML() : mixed
- printLinkHTML() : mixed
- General link printing function
- shuffle_assoc() : bool
- shuffles an array maintaining the keys
- sortByKey() : mixed
- sorts the found albums (images) by the required key(s)
- sortMultiArray() : array<string|int, mixed>
- multidimensional array column sort
- sortArray() : bool
- General one dimensional array sorting function. Key/value associations are preserved.
- getNotViewableAlbums() : array<string|int, mixed>
- Returns a list of album IDs that the current viewer is not allowed to see
- getNotViewableImages() : array<string|int, mixed>
- Returns a list of image IDs that the current viewer is not allowed to see
- isValidURL() : bool
- Checks to see if a URL is valid
- safe_fnmatch() : bool
- pattern match function Works with characters with diacritical marks where the PHP one does not.
- isValidEmail() : bool
- Returns true if the mail address passed is valid.
- zp_image_types() : string
- returns a list of comment record 'types' for "images"
- dircopy() : the
- Copies a directory recursively
- byteConvert() : string
- Returns a byte size from a size value (eg: 100M).
- dateTimeConvert() : mixed
- Converts a datetime to connoical form
- removeDateTimeZone() : string
- Removes the time zone info from date formats like "2009-05-14T13:30:29+10:00" as stored for e.g. image meta data
- get_context() : mixed
- set_context() : mixed
- in_context() : mixed
- add_context() : mixed
- rem_context() : mixed
- save_context() : mixed
- restore_context() : mixed
- getContextObject() : bool|obj
- Returns the current item object (image, album and Zenpage page, article, category) of the current theme context or false if no context is set or matches
- zp_handle_password() : mixed
- checks password posting
- zp_handle_password_single() : bool
- Handles a passwort
- getOptionFromDB() : mixed
- Gets an option directly from the database.
- setThemeOption() : mixed
- Set options local to theme and/or album
- replaceThemeOption() : mixed
- Replaces/renames an option. If the old option exits, it creates the new option with the old option's value as the default unless the new option has already been set otherwise. Independently it always deletes the old option.
- purgeThemeOption() : mixed
- Deletes an theme option for a specific or the current theme from the database
- purgeThemeOptionTotal() : mixed
- Deletes a theme option for all themes present or not
- setThemeOptionDefault() : mixed
- Used to set default values for theme specific options
- getThemeOption() : mixed
- Returns the value of a theme option
- getUserIP() : string
- Returns the viewer's IP address Deals with transparent proxies
- getAnonymIP() : string
- Anonymizing of IP addresses
- seoFriendly() : string
- Strips out and/or replaces characters from the string that are not "soe" friendly
- seoFriendlyJS() : mixed
- emit the javascript seojs() function
- is_connected() : bool
- Returns true if there is an internet connection
- debug404() : mixed
- produce debugging information on 404 errors
- XSRFdefender() : mixed
- Checks for Cross Site Request Forgeries
- getXSRFToken() : mixed
- returns an XSRF token
- XSRFToken() : mixed
- Emits a "hidden" input for the XSRF token
- cron_starter() : mixed
- Starts a sechedule script run
- zp_loggedin() : bool
- Check if logged in (with specific rights) Returns a true value if there is a user logged on with the required rights
- read_exif_data_protected() : array<string|int, mixed>
- Provides an error protected read of image EXIF/IPTC data
- getLanguageFlag() : string
- fetches the path to the flag image
- getItemByID() : mixed
- Gets an item object by id
- reveal() : mixed
- uses down and up arrow links to show and hide sections of HTML
- applyMacros() : string
- Deals with the [macro parameters] substitutions
- getMacros() : mixed
- getNestedAlbumList() : array<string|int, mixed>
- generates a nested list of albums for the album tab sorting Returns an array of "albums" each element contains: 'name' which is the folder name 'sort_order' which is an array of the sort order set
- getImageMetaDataFieldFormatted() : mixed
- setexifvars() : mixed
- initializes the $_zp_exifvars array display state
- removeDir() : bool
- Recursively clears and removes a folder
- tagURLs() : mixed
- inserts location independent WEB path tags in place of site path tags
- unTagURLs() : string
- reverses tagURLs()
- updateImageProcessorLink() : string
- Searches out i.php image links and replaces them with cache links if image is cached
- pluginDebug() : mixed
- removeTrailingSlash() : string
- Removes a trailing slash from a string if one exists, otherwise just returns the string Used primarily within date and tag searches and news date archive results
- getDataUsageNotice() : array<string|int, mixed>
- Returns an array the data privacy policy page and the data usage confirmation text as defined on Options > Security array( 'notice' => '<The defined text>', 'url' => '<url to the define page either custom page url or Zenpage page>', 'linktext' => '<The defined text>' )
- printDataUsageNotice() : mixed
- Prints the data privacy policy page and the data usage confirmation text as defined on Options > Security If there is no page defined it only prints the default text.
- getCookieInfoData() : array<string|int, mixed>
- Returns an array with predefined info about general cookies set by the system and/or plugins
- getCookieInfoHTML() : string
- Returns a definition list with predefined info about general cookies set by the system and/or plugins as a string
- printCookieInfo() : mixed
- Prints a definition list with predefined info about general cookies set by the system and/or plugins
- getCookieInfoMacro() : array<string|int, mixed>
- Registers the content macro(s)
- getImageMetadataValue() : mixed
- Gets a formatted metadata field value for display
- printImageMetadataValue() : mixed
- Prints a formatted metadata field value
Constants
ZENPHOTO_LOCALE
public
mixed
ZENPHOTO_LOCALE
= \setMainDomain()
ZP_NEWS_ENABLED
public
mixed
ZP_NEWS_ENABLED
= \false
ZP_PAGES_ENABLED
public
mixed
ZP_PAGES_ENABLED
= \false
Functions
parseAllowedTags()
parses the allowed HTML tags for use by htmLawed
parseAllowedTags(string &$source) : array<string|int, mixed>
Parameters
- $source : string
-
by name, contains the string with the tag options
Tags
Return values
array<string|int, mixed> —the allowed_tags array.
checkObjectsThumb()
Search for a thumbnail for the image
checkObjectsThumb( $localpath) : string
Parameters
Return values
stringtruncate_string()
Returns a truncated string
truncate_string(string $string, int $length[, string $elipsis = '...' ]) : string
Parameters
- $string : string
-
souirce string
- $length : int
-
how long it should be
- $elipsis : string = '...'
-
the text to tack on indicating shortening
Return values
stringtidyHTML()
Fixes unbalanced HTML tags. Uses the library htmlawed or if available the native PHP extension tidy
tidyHTML(string $html) : string
Parameters
- $html : string
Return values
stringshortenContent()
Returns truncated html formatted content
shortenContent(string $articlecontent, int $shorten, string $shortenindicator[, bool $forceindicator = false ]) : string
Parameters
- $articlecontent : string
-
the source string
- $shorten : int
-
new size
- $shortenindicator : string
- $forceindicator : bool = false
-
set to true to include the indicator no matter what
Return values
stringlookupSortKey()
Returns a sort field part for querying Note: $sorttype may be a comma separated list of field names. If so, these are peckmarked and returned otherwise unchanged.
lookupSortKey(string $sorttype, string $default, string $table) : string
Parameters
- $sorttype : string
-
the 'Display" name of the sort
- $default : string
-
the default if $sorttype is empty
- $table : string
-
the database table being used.
Return values
stringzpFormattedDate()
Returns a formatted date for output
zpFormattedDate([string $format = '' ][, string|int $datetime = '' ][, bool $localized_date = null ]) : string
Parameters
- $format : string = ''
-
A datetime compatible format string. Leave empty to use the option value. NOTE: If $localize_date = true you need to provide an ICU dateformat string instead of a datetime format string unless you pass a date format constant like DATETIME_DISPLAYFORMAT using one of the standard formats.
- $datetime : string|int = ''
-
the date to be formatted. Can be a date string or a timestamp.
- $localized_date : bool = null
-
Default null to use the related option setting. Set to true to use localized dates. PHP intl extension required
Return values
stringgetDatetimeObject()
Returns a datetime object
getDatetimeObject([string|int $datetime = '' ]) : object
Parameters
- $datetime : string|int = ''
-
the date to be output. Can be a date string or a timestamp. If empty "now" is used
Tags
Return values
objectgetStandardDateFormats()
Returns an array with datetime (keys) and ICU dateformat (values) strings
getStandardDateFormats([string $type = "datetime" ]) : array<string|int, mixed>
Parameters
- $type : string = "datetime"
-
"date" for date formats without time, "time" for time formats, "datetime" for both combined
Tags
Return values
array<string|int, mixed>myts_date()
Simple SQL timestamp formatting function.
myts_date(string $format, int $mytimestamp) : string
Parameters
- $format : string
-
formatting template
- $mytimestamp : int
-
timestamp
Return values
stringzp_mail()
Send an mail to the mailing list. We also attempt to intercept any form injection attacks by slime ball spammers. Returns error message if send failure.
zp_mail(string $subject, string $message[, array<string|int, mixed> $email_list = NULL ][, array<string|int, mixed> $cc_addresses = NULL ][, array<string|int, mixed> $bcc_addresses = NULL ][, string $replyTo = NULL ]) : string
Parameters
- $subject : string
-
The subject of the email.
- $message : string
-
The message contents of the email.
- $email_list : array<string|int, mixed> = NULL
-
a list of email addresses to send to
- $cc_addresses : array<string|int, mixed> = NULL
-
a list of addresses to send copies to.
- $bcc_addresses : array<string|int, mixed> = NULL
-
a list of addresses to send blind copies to.
- $replyTo : string = NULL
-
reply-to address
Tags
Return values
stringsortByMultilingual()
Sorts the results of a DB search by the current locale string for $field
sortByMultilingual(array<string|int, mixed> $dbresult, string $field, bool $descending) : array<string|int, mixed>
Parameters
- $dbresult : array<string|int, mixed>
-
the result of the DB query
- $field : string
-
the field name to sort on
- $descending : bool
-
the direction of the sort
Return values
array<string|int, mixed> —the sorted result
checkAlbumPassword()
Checks to see access is allowed to an album Returns true if access is allowed.
checkAlbumPassword(string $album[, string &$hint = NULL ]) : bool
There is no password dialog--you must have already had authorization via a cookie.
Parameters
- $album : string
-
album object or name of the album
- $hint : string = NULL
-
becomes populated with the password hint.
Return values
boolgetPluginFiles()
Returns a consolidated list of plugins The array structure is key=plugin name, value=plugin path
getPluginFiles(string $pattern[, string $folder = '' ][, bool $stripsuffix = true ]) : array<string|int, mixed>
Parameters
- $pattern : string
-
File system wildcard matching pattern to limit the search
- $folder : string = ''
-
subfolder within the plugin folders to search
- $stripsuffix : bool = true
-
set to true to remove the suffix from the key name in the array
Return values
array<string|int, mixed>getPlugin()
Returns the fully qualified file path of a plugin file.
getPlugin(string $plugin[, bool $inTheme = false ][, bool $webpath = false ]) : string|false
Note: order of selection is if the file is named "something.php":
- 1-theme folder file (if $inTheme is set): /themes/currenthemefolder/something.php
- 2-user plugin folder file: /plugins/something.php
- 3-zp-extensions file /zp-core/zp-extensions/something.php
First file found is used. Returns false if no file is found.
Parameters
- $plugin : string
-
is the name of the plugin file, typically something.php
- $inTheme : bool = false
-
tells where to find the plugin. true means look in the current theme. This for example can be also used to load a additional custom css file for theme customizations so the theme itself does not need to be modified. false means look in the zp-core/plugins folder.
- $webpath : bool = false
-
return a WEBPATH rather than a SERVERPATH
Return values
string|falsegetEnabledPlugins()
Returns an array of the currently enabled plugins
getEnabledPlugins() : array<string|int, mixed>
Return values
array<string|int, mixed>extensionEnabled()
Returns if a plugin is enabled
extensionEnabled(string $extension) : bool
Parameters
- $extension : string
Return values
boolenableExtension()
Enables a plugin
enableExtension(string $extension, int $priority[, bool $persistent = true ]) : mixed
Parameters
- $extension : string
- $priority : int
- $persistent : bool = true
disableExtension()
Disables an extension
disableExtension(string $extension[, bool $persistent = true ]) : mixed
Parameters
- $extension : string
- $persistent : bool = true
Tags
getManagedAlbumList()
Populates and returns the $_zp_admin_album_list array
getManagedAlbumList() : array<string|int, mixed>
Return values
array<string|int, mixed>populateManagedObjectsList()
Returns a list of album names managed by $id
populateManagedObjectsList(string $type, int $id[, bool $rights = false ]) : array<string|int, mixed>
Parameters
- $type : string
-
which kind of object
- $id : int
-
admin ID
- $rights : bool = false
-
set true for album sub-rights
Return values
array<string|int, mixed>getAllSubAlbumIDs()
Returns an array of album ids whose parent is the folder
getAllSubAlbumIDs([string $albumfolder = '' ]) : array<string|int, mixed>
Parameters
- $albumfolder : string = ''
-
folder name if you want a album different >>from the current album
Return values
array<string|int, mixed>handleSearchParms()
recovers search parameters from stored cookie, clears the cookie
handleSearchParms(string $what[, string $album = NULL ][, string $image = NULL ]) : mixed
Parameters
- $what : string
-
the page type
- $album : string = NULL
-
Name of the album
- $image : string = NULL
-
Name of the image
galleryAlbumsPerPage()
Returns the number of album thumbs that go on a gallery page
galleryAlbumsPerPage() : int
Return values
intsetupTheme()
Returns the theme folder If there is an album theme, loads the theme options.
setupTheme([object $album = NULL ]) : string
Parameters
- $album : object = NULL
-
album object if override desired
Return values
stringgetAllTagsUnique()
Returns an array of unique tag names
getAllTagsUnique([bool $checkaccess = false ]) : array<string|int, mixed>
Parameters
- $checkaccess : bool = false
-
Set to true if you wish to exclude tags that are assigned to items (or are not assigned at all) the visitor is not allowed to see Beware that this may cause overhead on large sites. Usage of the static_html_cache plugin is strongely recommended.
Return values
array<string|int, mixed>getAllTagsCount()
Returns an array indexed by 'tag' with the element value the count of the tag
getAllTagsCount([bool $exclude_unassigned = false ][, bool $checkaccess = false ]) : array<string|int, mixed>
Parameters
- $exclude_unassigned : bool = false
-
Set to true if you wish to exclude tags that are not assigne to any item
- $checkaccess : bool = false
-
Set to true if you wish to exclude tags that are assigned to items (or are not assigned at all) the visitor is not allowed to see If set to true it overrides the $exclude_unassigned parameter. Beware that this may cause overhead on large sites. Usage of the static_html_cache plugin is strongely recommended.
Return values
array<string|int, mixed>getTagCountByAccess()
Checks if a tag is assigned at all and if it can be viewed by the current visitor and returns the corrected count Helper function used optionally within getAllTagsCount() and getAllTagsUnique()
getTagCountByAccess(array<string|int, mixed> $tag) : int
Parameters
- $tag : array<string|int, mixed>
-
Array representing a tag containing at least its name and id
Tags
Return values
intstoreTags()
Stores tags for an object
storeTags(array<string|int, mixed> $tags, int $id, string $tbl) : mixed
Parameters
- $tags : array<string|int, mixed>
-
the tag values
- $id : int
-
the record id of the album/image
- $tbl : string
-
database table of the object
readTags()
Retrieves the tags for an object Returns them in an array
readTags(int $id, string $tbl) : unknown
Parameters
- $id : int
-
the record id of the album/image
- $tbl : string
-
'albums' or 'images', etc.
Return values
unknowngenerateListFromArray()
Creates the body of a select list
generateListFromArray(array<string|int, mixed> $currentValue, array<string|int, mixed> $list, bool $descending, bool $localize) : mixed
Parameters
- $currentValue : array<string|int, mixed>
-
list of items to be flagged as checked
- $list : array<string|int, mixed>
-
the elements of the select list
- $descending : bool
-
set true for a ascending order sort. Set to null to keep the array as it is passed.
- $localize : bool
-
set true if the keys as description should be listed instead of the plain values
generateListFromFiles()
Generates a selection list from files found on disk
generateListFromFiles(strig $currentValue, string $root, string $suffix[, bool $descending = false ]) : mixed
Parameters
- $currentValue : strig
-
the current value of the selector
- $root : string
-
directory path to search
- $suffix : string
-
suffix to select for
- $descending : bool = false
-
set true to get a reverse order sort. Set to null to keep the array as it is passed.
generateAttributesFromArray()
Helper to generate attributename="attributevalue" for HTML elements based on an array consisting of key => value pairs
generateAttributesFromArray([array<string|int, mixed> $attributes = array() ][, array<string|int, mixed> $exclude = array() ]) : string
Returns a string with with prependend space to directly use with an HTML element.
Note: There is no check if these attributes are valid. Also values are not html_encoded as that could break for example JS event handlers. Do this in your attribute definition array as needed. Attributes with an empty value are skipped except the alt attribute or known boolean attributes (see in function definition)
Parameters
- $attributes : array<string|int, mixed> = array()
-
key => value pairs of element attribute name and value. e.g. array('class' => 'someclass', 'id' => 'someid');
- $exclude : array<string|int, mixed> = array()
-
Names of attributes to exclude (in case already set otherwise)
Tags
Return values
stringgetLinkHTML()
getLinkHTML(string $url, string $text[, string $title = NULL ][, string $class = NULL ][, string $id = NULL ][, array<string|int, mixed> $extra_attr = array() ]) : mixed
Parameters
- $url : string
-
The link URL
- $text : string
-
The text to go with the link
- $title : string = NULL
-
Text for the title tag
- $class : string = NULL
-
optional class
- $id : string = NULL
-
optional id
- $extra_attr : array<string|int, mixed> = array()
-
Additional attributes as array of key => value pairs
printLinkHTML()
General link printing function
printLinkHTML(string $url, string $text[, string $title = NULL ][, string $class = NULL ][, string $id = NULL ]) : mixed
Parameters
- $url : string
-
The link URL
- $text : string
-
The text to go with the link
- $title : string = NULL
-
Text for the title tag
- $class : string = NULL
-
optional class
- $id : string = NULL
-
optional id
shuffle_assoc()
shuffles an array maintaining the keys
shuffle_assoc(array<string|int, mixed> &$array) : bool
Parameters
- $array : array<string|int, mixed>
Return values
boolsortByKey()
sorts the found albums (images) by the required key(s)
sortByKey(array<string|int, mixed> $results, string $sortkey, string $order) : mixed
NB: this sort is sensitive to the key(s) chosen and makes the appropriate sorts based on same. Some multi-key sorts will not make any sense and will give unexpected results. Most notably any that contain the keys "title" or "desc" as these require multi-lingual sorts.
Parameters
- $results : array<string|int, mixed>
- $sortkey : string
- $order : string
sortMultiArray()
multidimensional array column sort
sortMultiArray(array<string|int, mixed> $array, mixed $index[, string $descending = false ][, bool $natsort = true ][, bool $case_sensitive = false ][, bool $preservekeys = false ][, array<string|int, mixed> $remove_criteria = array() ]) : array<string|int, mixed>
If the system's PHP has the native intl extension and its Collator class available the sorting is locale aware (true natural order) and always case sensitive if $natsort is set to true
Parameters
- $array : array<string|int, mixed>
-
The multidimensional array to be sorted
- $index : mixed
-
Which key(s) should be sorted by
- $descending : string = false
-
true for descending sortorder
- $natsort : bool = true
-
If natural order should be used. If available sorting will be locale aware.
- $case_sensitive : bool = false
-
If the sort should be case sensitive. Note if $natsort is true and locale aware sorting is available sorting is always case sensitive
- $preservekeys : bool = false
-
Default false,
- $remove_criteria : array<string|int, mixed> = array()
-
Array of indices to remove.
Tags
Return values
array<string|int, mixed>sortArray()
General one dimensional array sorting function. Key/value associations are preserved.
sortArray(array<string|int, mixed> &$array[, string $descending = false ][, bool $natsort = true ][, bool $case_sensitive = false ]) : bool
If the system's PHP has the native intl extension and its Collator class available and $natsort is set to true the sorting is locale sensitive (true natural order).
The function follows native PHP array sorting functions (natcasesort() etc.) and uses the array by reference and returns true or false on success or failure.
Parameters
- $array : array<string|int, mixed>
-
The array to sort. The array is passed by reference
- $descending : string = false
-
true for descending sorts (default false)
- $natsort : bool = true
-
If natural order should be used (default true). If available sorting will be locale sensitive.
- $case_sensitive : bool = false
-
If the sort should be case sensitive (default false). Note if $natsort is true and locale aware sorting is available sorting is always case sensitive
Tags
Return values
boolgetNotViewableAlbums()
Returns a list of album IDs that the current viewer is not allowed to see
getNotViewableAlbums() : array<string|int, mixed>
Return values
array<string|int, mixed>getNotViewableImages()
Returns a list of image IDs that the current viewer is not allowed to see
getNotViewableImages() : array<string|int, mixed>
Return values
array<string|int, mixed>isValidURL()
Checks to see if a URL is valid
isValidURL(string $url) : bool
Parameters
- $url : string
-
the URL being checked
Return values
boolsafe_fnmatch()
pattern match function Works with characters with diacritical marks where the PHP one does not.
safe_fnmatch(string $pattern, string $string) : bool
Parameters
- $pattern : string
-
pattern
- $string : string
-
haystack
Return values
boolisValidEmail()
Returns true if the mail address passed is valid.
isValidEmail(string $email) : bool
It uses PHP's internal filter_var
functions to validate the syntax but not the existence.
Parameters
- $email : string
-
An email address
Tags
Return values
boolzp_image_types()
returns a list of comment record 'types' for "images"
zp_image_types(string $quote) : string
Parameters
- $quote : string
-
quotation mark to use
Return values
stringdircopy()
Copies a directory recursively
dircopy(string $srcdir, string $dstdir) : the
Parameters
- $srcdir : string
-
the source directory.
- $dstdir : string
-
the destination directory.
Return values
the —total number of files copied.
byteConvert()
Returns a byte size from a size value (eg: 100M).
byteConvert(int $bytes) : string
Parameters
- $bytes : int
Return values
stringdateTimeConvert()
Converts a datetime to connoical form
dateTimeConvert(string $datetime[, bool $raw = false ]) : mixed
Parameters
- $datetime : string
-
input date/time string
- $raw : bool = false
-
set to true to return the timestamp otherwise you get a string
removeDateTimeZone()
Removes the time zone info from date formats like "2009-05-14T13:30:29+10:00" as stored for e.g. image meta data
removeDateTimeZone(string $date) : string
Parameters
- $date : string
Tags
Return values
stringget_context()
get_context() : mixed
set_context()
set_context(mixed $context) : mixed
Parameters
- $context : mixed
in_context()
in_context(mixed $context) : mixed
Parameters
- $context : mixed
add_context()
add_context(mixed $context) : mixed
Parameters
- $context : mixed
rem_context()
rem_context(mixed $context) : mixed
Parameters
- $context : mixed
save_context()
save_context() : mixed
restore_context()
restore_context() : mixed
getContextObject()
Returns the current item object (image, album and Zenpage page, article, category) of the current theme context or false if no context is set or matches
getContextObject() : bool|obj
Tags
Return values
bool|objzp_handle_password()
checks password posting
zp_handle_password([string $authType = NULL ][, mixed $check_auth = NULL ][, mixed $check_user = NULL ]) : mixed
Parameters
- $authType : string = NULL
-
override of athorization type
- $check_auth : mixed = NULL
- $check_user : mixed = NULL
zp_handle_password_single()
Handles a passwort
zp_handle_password_single([string $authType = NULL ][, string $check_auth = NULL ][, string $check_user = NULL ]) : bool
Parameters
- $authType : string = NULL
-
override of authorization type
- $check_auth : string = NULL
-
Password
- $check_user : string = NULL
-
User
Return values
boolgetOptionFromDB()
Gets an option directly from the database.
getOptionFromDB(string $key) : mixed
Parameters
- $key : string
setThemeOption()
Set options local to theme and/or album
setThemeOption(string $key, string $value, object $album, string $theme[, bool $default = false ]) : mixed
Parameters
- $key : string
- $value : string
- $album : object
- $theme : string
-
default theme
- $default : bool = false
-
set to true for setting default theme options (does not set the option if it already exists)
replaceThemeOption()
Replaces/renames an option. If the old option exits, it creates the new option with the old option's value as the default unless the new option has already been set otherwise. Independently it always deletes the old option.
replaceThemeOption(string $oldkey, string $newkey) : mixed
Parameters
- $oldkey : string
-
Old option name
- $newkey : string
-
New option name
Tags
purgeThemeOption()
Deletes an theme option for a specific or the current theme from the database
purgeThemeOption(string $key[, mixed $album = NULL ][, mixed $theme = NULL ][, mixed $allthemes = false ]) : mixed
Parameters
- $key : string
- $album : mixed = NULL
- $theme : mixed = NULL
- $allthemes : mixed = false
Tags
purgeThemeOptionTotal()
Deletes a theme option for all themes present or not
purgeThemeOptionTotal(string $key) : mixed
Parameters
- $key : string
Tags
setThemeOptionDefault()
Used to set default values for theme specific options
setThemeOptionDefault(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
getThemeOption()
Returns the value of a theme option
getThemeOption(string $option[, object $album = NULL ][, string $theme = NULL ]) : mixed
Parameters
- $option : string
-
option key
- $album : object = NULL
- $theme : string = NULL
-
default theme name
getUserIP()
Returns the viewer's IP address Deals with transparent proxies
getUserIP([bool $anonymize = null ]) : string
Parameters
- $anonymize : bool = null
-
If null (default) the backend option setting is used. Override with anonymize levels
- 0 (No anonymizing)
- 1 (Last fourth anonymized)
- 2 (Last half anonymized)
- 3 (Last three fourths anonymized)
- 4 (Full anonymization, no IP stored)
Return values
stringgetAnonymIP()
Anonymizing of IP addresses
getAnonymIP(mixed $ip[, bool $anonymize = null ]) : string
Parameters
- $ip : mixed
- $anonymize : bool = null
-
If null (default) the backend option setting is used. Override with anonymize levels
- 0 (No anonymizing)
- 1 (Last fourth anonymized)
- 2 (Last half anonymized)
- 3 (Last three fourths anonymized)
- 4 (Full anonymization, no IP stored)
Return values
stringseoFriendly()
Strips out and/or replaces characters from the string that are not "soe" friendly
seoFriendly(string $string) : string
Parameters
- $string : string
Return values
stringseoFriendlyJS()
emit the javascript seojs() function
seoFriendlyJS() : mixed
is_connected()
Returns true if there is an internet connection
is_connected([string $host = 'www.zenphoto.org' ]) : bool
Parameters
- $host : string = 'www.zenphoto.org'
-
optional host name to test
Return values
booldebug404()
produce debugging information on 404 errors
debug404(string $album, string $image, string $theme) : mixed
Parameters
- $album : string
- $image : string
- $theme : string
XSRFdefender()
Checks for Cross Site Request Forgeries
XSRFdefender(string $action) : mixed
Parameters
- $action : string
getXSRFToken()
returns an XSRF token
getXSRFToken(string $action) : mixed
Parameters
- $action : string
XSRFToken()
Emits a "hidden" input for the XSRF token
XSRFToken(string $action) : mixed
Parameters
- $action : string
cron_starter()
Starts a sechedule script run
cron_starter(string $script, array<string|int, mixed> $params, mixed $offsetPath[, bool $inline = false ]) : mixed
Parameters
- $script : string
-
The script file to load
- $params : array<string|int, mixed>
-
"POST" parameters
- $offsetPath : mixed
- $inline : bool = false
-
set to true to run the task "in-line". Set false run asynchronously
zp_loggedin()
Check if logged in (with specific rights) Returns a true value if there is a user logged on with the required rights
zp_loggedin([bit $rights = ALL_RIGHTS ]) : bool
Parameters
- $rights : bit = ALL_RIGHTS
-
rights required by the caller
Return values
boolread_exif_data_protected()
Provides an error protected read of image EXIF/IPTC data
read_exif_data_protected(string $path) : array<string|int, mixed>
Parameters
- $path : string
-
image path
Return values
array<string|int, mixed>getLanguageFlag()
fetches the path to the flag image
getLanguageFlag(string $lang) : string
Parameters
- $lang : string
-
whose flag
Return values
stringgetItemByID()
Gets an item object by id
getItemByID(string $table, int $id) : mixed
Parameters
- $table : string
-
database table to search
- $id : int
-
id of the item to get
reveal()
uses down and up arrow links to show and hide sections of HTML
reveal(string $content[, bool $visible = false ]) : mixed
Parameters
- $content : string
-
the id of the html section to be revealed
- $visible : bool = false
-
true if the content is initially visible
applyMacros()
Deals with the [macro parameters] substitutions
applyMacros(string $text) : string
See the macroList plugin for details
Parameters
- $text : string
Return values
stringgetMacros()
getMacros() : mixed
getNestedAlbumList()
generates a nested list of albums for the album tab sorting Returns an array of "albums" each element contains: 'name' which is the folder name 'sort_order' which is an array of the sort order set
getNestedAlbumList( $subalbum, $levels[, $checkalbumrights = true ][, $level = array() ]) : array<string|int, mixed>
Parameters
- $subalbum :
-
root level album (NULL is the gallery)
- $levels :
-
how far to nest
- $checkalbumrights : = true
-
TRUE (Default) for album rights for backend usage, FALSE to skip for frontend usage
- $level : = array()
-
internal for keeping the sort order elements
Return values
array<string|int, mixed>getImageMetaDataFieldFormatted()
getImageMetaDataFieldFormatted() : mixed
setexifvars()
initializes the $_zp_exifvars array display state
setexifvars() : mixed
removeDir()
Recursively clears and removes a folder
removeDir(string $path[, mixed $within = false ]) : bool
Parameters
- $path : string
- $within : mixed = false
Return values
booltagURLs()
inserts location independent WEB path tags in place of site path tags
tagURLs(string $text) : mixed
Parameters
- $text : string
unTagURLs()
reverses tagURLs()
unTagURLs(string|array<string|int, mixed> $text) : string
Parameters
- $text : string|array<string|int, mixed>
Return values
stringupdateImageProcessorLink()
Searches out i.php image links and replaces them with cache links if image is cached
updateImageProcessorLink(string $text) : string
Parameters
- $text : string
Return values
stringpluginDebug()
pluginDebug(mixed $extension, mixed $priority, mixed $start) : mixed
Parameters
- $extension : mixed
- $priority : mixed
- $start : mixed
removeTrailingSlash()
Removes a trailing slash from a string if one exists, otherwise just returns the string Used primarily within date and tag searches and news date archive results
removeTrailingSlash(string $string) : string
Parameters
- $string : string
Tags
Return values
stringgetDataUsageNotice()
Returns an array the data privacy policy page and the data usage confirmation text as defined on Options > Security array( 'notice' => '<The defined text>', 'url' => '<url to the define page either custom page url or Zenpage page>', 'linktext' => '<The defined text>' )
getDataUsageNotice() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>printDataUsageNotice()
Prints the data privacy policy page and the data usage confirmation text as defined on Options > Security If there is no page defined it only prints the default text.
printDataUsageNotice() : mixed
Tags
getCookieInfoData()
Returns an array with predefined info about general cookies set by the system and/or plugins
getCookieInfoData([string $section = null ]) : array<string|int, mixed>
Parameters
- $section : string = null
-
Name of the section to get: 'authentication', 'search', 'admin', 'cookie', 'various' or null (default) for the full array
Tags
Return values
array<string|int, mixed>getCookieInfoHTML()
Returns a definition list with predefined info about general cookies set by the system and/or plugins as a string
getCookieInfoHTML([string $section = null ][, string $sectionheadline = 'h2' ]) : string
Parameters
- $section : string = null
-
Name of the section to get: 'authentication', 'search', 'admin', 'cookie', 'various' or null (default) for the full array
- $sectionheadline : string = 'h2'
-
Add h2 to h6 to print as the section headline, h2 default.
Tags
Return values
stringprintCookieInfo()
Prints a definition list with predefined info about general cookies set by the system and/or plugins
printCookieInfo([string $section = null ][, string $sectionheadline = 'h2' ]) : mixed
Parameters
- $section : string = null
-
Name of the section to get: 'authentication', 'search', 'admin', 'cookie', 'various' or null (default) for the full array
- $sectionheadline : string = 'h2'
-
Add h2 to h6 to print as the section headline, h2 default.
Tags
getCookieInfoMacro()
Registers the content macro(s)
getCookieInfoMacro(array<string|int, mixed> $macros) : array<string|int, mixed>
Parameters
- $macros : array<string|int, mixed>
-
Passes through the array of already registered
Return values
array<string|int, mixed>getImageMetadataValue()
Gets a formatted metadata field value for display
getImageMetadataValue([string $type = '' ][, mixed $value = '' ][, string $name = '' ]) : mixed
Parameters
- $type : string = ''
-
The field type
- $value : mixed = ''
-
The field value
- $name : string = ''
-
The field name (Metadata Key)
Tags
printImageMetadataValue()
Prints a formatted metadata field value
printImageMetadataValue(string $type[, mixed $value = '' ][, string $name = '' ]) : mixed
Parameters
- $type : string
-
The field type
- $value : mixed = ''
-
The field value
- $name : string = ''
-
The field name (Metadata Key)