Class: GalleryCoreApi
Source Location: /modules/core/classes/GalleryCoreApi.class
Class GalleryCoreApi
Method Summary
array |
acquireReadLockParents() |
Acquire read locks on all the ancestors of this id. This is useful when we're going to do a filesystem related operation and we want to make sure that the tree does not change out from underneath us. |
array |
addItemToAlbum() |
Add a new data item to an album from a data file. |
GalleryStatus |
addMimeType() |
Add the given extension to the database and map it to the specified mime type and mark it viewable as requested. Return ERROR_COLLISION if there's already a mapping for the given extension. |
array |
buildItemQuery() |
Build query to select items in a given sort order |
GalleryStatus |
compactAccessLists() |
Compact the access map. Remove any duplicate access maps and remap any subscribers from the duplicates to the one remaining version. |
string |
convertFromUtf8() |
Convert the string from the internal encoding (UTF-8) to target encoding. |
string |
convertToUtf8() |
Convert the string from the source encoding to UTF8 |
GalleryStatus |
deleteSortOrder() |
Remove the given sort order from any thing in the framework that uses it (albums and the default sort order). |
array |
deleteUserItems() |
Delete all non-album items of a user. Then delete all remaining albums that are empty. |
array |
describeEntity() |
Describe the members, modules and parent of an entity |
array |
fetchAccessListIds() |
Fetch all the access list ids that grant the given permission to the given user (either directly or via a group). |
array |
fetchAlbumTree() |
Fetch album tree visible to current user, optionally starting from a given album and to a given depth. |
array |
fetchAllItemIds() |
Return the ids of all items that match the given type and have the given permission. |
array |
fetchChildCounts() |
Return the number of children for the items specified, that are visible to the given user. |
array |
fetchChildItemIds() |
Return the ids of the children of this entity, in the order specified by the orderBy field and the direction specified by the orderDirection field, that are visible to the given user. |
array |
fetchDescendentItemIds() |
Return the ids of the descendents of this entity that are visible to the given user. |
array |
fetchGroupCount() |
Return a count of groups, optionally matching a search string |
array |
fetchItemIdByPath() |
Given a complete logical path, return the item id that it refers to. |
array |
fetchItemIdCount() |
Return the number of of items that match the given type and have the given permission. |
array |
fetchItemizedDescendentCounts() |
Fetch the breakdown of descendents for a given item. Note: this call is more expensive than GalleryCoreApi::fetchDescendentCounts(), so use that version where possible. |
array |
fetchLinkableChildItemIdsWithPermission() |
Return the ids of all the child items of the given item that have the matching permission and are linkable entities. Useful for, example, for finding all the children where we (the active user) has the 'core.changePermissions' permission bit set. This allows us to cascade permission updates. |
int |
fetchNextItemWeight() |
Fetch the weight of the next peer in line (higher or lower, as specified) |
array |
fetchPluginList() |
Return a plugin list by plugin type of all installed plugins. |
array |
fetchPreferredSource() |
Return the preferred source for this item by returning the first occurrence of the following: |
array |
fetchThemeId() |
Return the correct theme for this item. If the appropriate theme cannot be loaded, we fall back on the default. And if that can't be loaded, then we return null. |
array(boolean |
fetchWebFile() |
Fetch the web page at the given url. Follow redirects to get the data and upon completion return the http response, headers and the actual URL that we used to get the data. |
array(boolean |
fetchWebPage() |
Fetch the web page at the given url. Follow redirects to get the data and upon completion return the body, http response, headers and the actual URL that we used to get the data. |
array |
getAllPluginIds() |
Get the list of all available plugins of a given type |
array |
getApiVersion() |
Return the major and minor version of the Core API. |
string |
getCodeBasePath() |
Get the local path to the Gallery code base path (not URL or web root). Optionally append a relative path. |
array |
getLegalPathComponent() |
Get a legal path component in the given parent id. Legal by the platform standards, and legal in that it doesn't cause a conflict with other path components. |
array |
getMapEntry() |
Get entries in a map that match a criteria and return selected fields |
array |
getMimeType() |
Determine the proper mime type given the file and optionally with the mime type from the request |
array |
getPermissionIds() |
Get all the permission ids that match the specified flags. |
array |
getPermissions() |
Return all the permissions that the given user has for the given item. |
array |
getRedundantToolkitPriorities() |
Get list of toolkits/priorities in managed priority range (20-40) for which another toolkit supports a same operation and mime type. |
array |
getSubPermissions() |
Expand a single permission into all the possible permissions that it can possibly be. |
array |
hasItemPermission() |
Return true if the current user has the specific permission for the target item |
array |
hasPermission() |
Are any or the given user/group ids directly granted all given permissions for the target item? Ignores session-based permissions. |
array |
isDisabledUsername() |
Return true if this username is not allowed to log in (generally due to automated abuse). |
boolean |
isReadLocked() |
Return true if the given id is read locked or write locked by us. |
GalleryStatus |
isSupportedOperationSequence() |
Verify that a given mime-type/operation-sequence combination is supported by our existing toolkits by walking the sequence and making sure that we have a toolkit that can handle each operation. |
boolean |
isWriteLocked() |
Return true if the given id is write locked by us. |
array |
loadPlugin() |
Load and initialize the given plugin |
array |
newItemByMimeType() |
Return the appropriate GalleryItem instance for the mime type provided. |
array |
postEvent() |
Deliver an event to anybody listening. |
array(body, |
postToWebPage() |
Post form data to a remote url and return the http response, headers and body of the reply |
GalleryStatus |
rebalanceChildOrderWeights() |
Rebalance the order weights associated with this item's children. When this method is complete, the child item ids should still have the same order as they have now, but their order weights should be spaced out to exactly the spacing value specified in the arguments. |
array($responseStatus, |
requestWebPage() |
Make an HTTP request to a remote URL and return the HTTP response status, headers and body. |
void |
requireOnce() |
Require a file, but only once. All specified paths must be relative to the gallery2 directory. Think of it as a virtual PHP include_path. |
boolean |
shouldDoCompileCheck() |
Check whether modification checks should be done to see if the compiled templates are still up to date. The result is cached in memory. |
GalleryStatus |
unregisterToolkit() |
Unregister a toolkit's operations and properties. If we have any remaining that are no longer implemented by any toolkit then remove them from the system also. |
string |
utf8Strcut() |
mb_strcut for UTF-8, with PHP fallback. Truncates incomplete HTML entity at end of result. |
string |
utf8Substring() |
mb_substr for UTF-8, with PHP fallback. Truncates incomplete HTML entity at end of result. |
Methods
array acquireReadLock(
mixed
$ids, [int
$timeout = 10]
)
|
|
Read Lock one or more objects
Parameters:
mixed |
$ids: |
array of ids to lock, or single int id |
int |
$timeout: |
(optional) how long to wait for the lock before giving up |
API Tags:
Return: | GalleryStatus a status code int the lock id |
array acquireReadLockParents(
int
$id, [int
$timeout = 10]
)
|
|
Acquire read locks on all the ancestors of this id. This is useful when we're going to do a filesystem related operation and we want to make sure that the tree does not change out from underneath us.
Parameters:
int |
$id: |
|
int |
$timeout: |
(optional) how long to wait for the lock before giving up |
API Tags:
Return: | GalleryStatus a status code int the lock id |
array acquireWriteLock(
mixed
$ids, [int
$timeout = 10]
)
|
|
Write lock one or more objects
Parameters:
mixed |
$ids: |
array of ids to lock, or single int id |
int |
$timeout: |
(optional) how long to wait for the lock before giving up |
API Tags:
Return: | GalleryStatus a status code int the lock id |
array activatePlugin(
string
$pluginType, string
$pluginId
)
|
|
Activate the given plugin
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
API Tags:
Return: | GalleryStatus a status code array redirect info for error page (empty for success) |
GalleryStatus addDerivativePreference(
int
$order, int
$itemId, int
$derivativeType, string
$derivativeOperations
)
|
|
Add a derivative preference to a given item
Parameters:
int |
$order: |
the position of this preference |
int |
$itemId: |
|
int |
$derivativeType: |
(eg. DERIVATIVE_TYPE_IMAGE_THUMBNAIL) |
string |
$derivativeOperations: |
(eg. 'thumbnail|200') |
API Tags:
GalleryStatus addEntityPermission(
int
$itemId, int
$entityId, string
$permission, [boolean
$applyToChildren = false]
)
|
|
Add the given itemid, entityid, permission mapping.
(Session based permissions; permission is granted when this entityId is added to GALLERY_PERMISSION_SESSION_KEY array in the session)
Parameters:
int |
$itemId: |
the id of the GalleryItem |
int |
$entityId: |
the id of the GalleryEntity |
string |
$permission: |
the permission id |
boolean |
$applyToChildren: |
(optional) whether or not this call applies to child items |
API Tags:
GalleryStatus addEventLogEntry(
string
$type, string
$summary,
$details, string
$detail
)
|
|
Store a value in the event log.
Parameters:
string |
$type: |
a short string with the type of event (e.g.: 'Gallery Error', 'PHP Error', 'comment module') |
string |
$summary: |
a brief summary of the event |
string |
$detail: |
the event details |
|
$details: |
|
API Tags:
Add an existing data item to an album
Parameters:
GalleryItem |
$item: |
the source item |
int |
$albumId: |
the id of the target album |
boolean |
$isNew: |
(optional) if true, skip check for existing derivatives |
API Tags:
GalleryStatus addGroupPermission(
int
$itemId, int
$groupId, string
$permission, [boolean
$applyToChildren = false]
)
|
|
Add the given itemid, groupid, permission mapping
Parameters:
int |
$itemId: |
the id of the GalleryItem |
int |
$groupId: |
the id of the GalleryGroup |
string |
$permission: |
the permission id |
boolean |
$applyToChildren: |
(optional) whether or not this call applies to child items |
API Tags:
array addItemToAlbum(
string
$fileName, string
$itemName, string
$title, string
$summary, string
$description, string
$mimeType, int
$albumId, [boolean
$symlink = false]
)
|
|
Add a new data item to an album from a data file.
Parameters:
string |
$fileName: |
the path to the file on the local disk |
string |
$itemName: |
the name of the new item |
string |
$title: |
the title of the new item |
string |
$summary: |
the summary of the new item |
string |
$description: |
the description of the new item |
string |
$mimeType: |
the mime type of the new item |
int |
$albumId: |
the id of the target album |
boolean |
$symlink: |
(optional) a boolean true if we should symlink instead of copy (default is false). |
API Tags:
Return: | GalleryStatus a status code GalleryDataItem a new item |
GalleryStatus addMapEntry(
string
$mapName, array
$data, [boolean
$useNonTransactionalConnection = false]
)
|
|
Add a new entry to a map
Parameters:
string |
$mapName: |
the map we're working on |
array |
$data: |
an associative array of the entry data |
boolean |
$useNonTransactionalConnection: |
(optional) set to true if we should use a new non transactional database connection for this operation. Default is false. |
API Tags:
GalleryStatus addMimeType(
string
$extension, string
$mimeType, bool
$viewable
)
|
|
Add the given extension to the database and map it to the specified mime type and mark it viewable as requested. Return ERROR_COLLISION if there's already a mapping for the given extension.
Parameters:
string |
$extension: |
|
string |
$mimeType: |
|
bool |
$viewable: |
whether or not it's browser viewable |
API Tags:
void addPermissionToSession(
int
$entityId
)
|
|
Grant permissions identified by an entity id to the current user's session.
Parameters:
int |
$entityId: |
The permission identifier (e.g. a user, group, or entity id) which grants one or more permissions to one or more items |
GalleryStatus addUserPermission(
int
$itemId, int
$userId, string
$permission, [boolean
$applyToChildren = false]
)
|
|
Add the given itemid, userid, permission mapping
Parameters:
int |
$itemId: |
the id of the GalleryItem |
int |
$userId: |
the id of the GalleryUser |
string |
$permission: |
the permission id |
boolean |
$applyToChildren: |
(optional) whether or not this call applies to child items |
API Tags:
Add the specified user to the specified group.
Parameters:
int |
$userId: |
|
int |
$groupId: |
|
API Tags:
GalleryStatus adjustDependentDerivatives(
array
$id, string
$operation, [boolean
$reverse = false]
)
|
|
Use the given operation as a transform for each derivative that depends on the target
derivative. This gives the dependent derivatives a chance to perform any necessary transformations required to adapt to an upstream derivative operation change. For example, if you have a preferred which has a dependent thumbnail which has a crop operation in it, then you "rotate|90" the preferred you'd call adjustDependentDerivatives on the thumbnail with the "rotate|90" operation so that we can rotate the crop coordinates appropriately.
Parameters:
array |
$id: |
id the target derivative |
string |
$operation: |
the operation that was performed on the target derivative |
boolean |
$reverse: |
(optional) true if we should apply the transform in reverse |
API Tags:
(Re)create derivatives for a data item according to preferences for given album
Parameters:
GalleryItem |
$item: |
the source item |
int |
$albumId: |
the id of the target album |
boolean |
$isNew: |
(optional) if true, skip check for existing derivatives |
API Tags:
GalleryStatus applyToolkitOperation(
string
$operation, GalleryItem
$args, boolean
$preserveOriginal, mixed
&$item, [
$preferred = null], [int
$serialNumber = null]
)
|
|
Use the given operation as a transform for each derivative that depends on the target
Parameters:
string |
$operation: |
the operation to be executed |
GalleryItem |
$args: |
item to perform the operation on |
boolean |
$preserveOriginal: |
whether to preserve original |
int |
$serialNumber: |
(optional) avoid concurrent edits |
|
$preferred: |
|
API Tags:
GalleryStatus assertHasItemPermission(
int
$itemId, string
$permission
)
|
|
Assert that the current user has the specific permission for the target item
Parameters:
int |
$itemId: |
|
string |
$permission: |
|
API Tags:
Return: | success if the user has permission, ERROR_PERMISSION_DENIED if not. |
Assert that the active user is a site administrator
API Tags:
Return: | success if the user is an administrator ERROR_PERMISSION_DENIED if not. |
array buildItemQuery(
string
$baseTable, string
$baseIdColumn, string
$baseQuery, string
$orderBy, string
$orderDirection, string
$class, string|array
$requiredPermission, boolean
$linkableOnly, int
$userId
)
|
|
Build query to select items in a given sort order
Parameters:
string |
$baseTable: |
base table to query |
string |
$baseIdColumn: |
name of id column in this table |
string |
$baseQuery: |
where clause for query |
string |
$orderBy: |
order for results |
string |
$orderDirection: |
order direction for results |
string |
$class: |
a class to restrict children to (eg. 'GalleryAlbumItem'; can be null) |
string|array |
$requiredPermission: |
a single required permission (can be null) or an array of required permission-ids |
boolean |
$linkableOnly: |
whether to restrict to linkable items only |
int |
$userId: |
the user we're doing this for |
API Tags:
Return: | GalleryStatus a status code string query array data items for query (not including any ? marks in baseQuery) |
array checkPathCollision(
string
$pathComponent, int
$parentId, [int
$selfId = null]
)
|
|
Check for a collision of FileSystemEntiry paths.
Parameters:
string |
$pathComponent: |
|
int |
$parentId: |
the id of the target parent |
int |
$selfId: |
(optional) ignore path collision with this id |
API Tags:
Return: | GalleryStatus a status code boolean true if there's a collision |
Compact the access map. Remove any duplicate access maps and remap any subscribers from the duplicates to the one remaining version.
API Tags:
array convertExtensionToMime(
string
$extension
)
|
|
Convert a file extension to a mime type
Parameters:
string |
$extension: |
a file extension |
API Tags:
Return: | GalleryStatus a status code string a mime type (application/unknown if no known mapping) |
string convertFromUtf8(
string
$inputString, [string
$targetEncoding = null]
)
|
|
Convert the string from the internal encoding (UTF-8) to target encoding.
Parameters:
string |
$inputString: |
|
string |
$targetEncoding: |
target encoding (eg. 'ISO-8859-1'), defaults to system charset |
API Tags:
array convertMimeToExtensions(
string
$mimeType
)
|
|
Convert a mime type to a file extension
Parameters:
API Tags:
Return: | GalleryStatus a status code array of file extensions (empty array if no known mapping) |
array convertPermissionBitsToIds(
int
$permissionBits, [boolean
$compress = false]
)
|
|
Return all the permission ids for a permission bit set
Parameters:
int |
$permissionBits: |
the bit mask |
boolean |
$compress: |
should we compress the permission list? |
API Tags:
Return: | GalleryStatus a status code array (bits, bits, bits) |
array convertPermissionIdsToBits(
mixed
$permissionIds
)
|
|
Return the permission bits for a set of permission ids
Parameters:
mixed |
$permissionIds: |
array of string permission ids or single permission id |
API Tags:
Return: | GalleryStatus a status code integer bits |
string convertToUtf8(
string
$inputString, [string
$sourceEncoding = null]
)
|
|
Convert the string from the source encoding to UTF8
Parameters:
string |
$inputString: |
|
string |
$sourceEncoding: |
source encoding (eg. 'ISO-8859-1'), defaults to system charset |
API Tags:
GalleryStatus copyDerivativePreferences(
int
$sourceId, int
$targetId
)
|
|
Copy the derivative preferences from one id to another.
Note that this doesn't modify pre-existing preferences already assigned to the target.
Parameters:
int |
$sourceId: |
the source id |
int |
$targetId: |
the target id |
API Tags:
Copy a set of permissions from one id to another
Parameters:
int |
$itemId: |
the id of the target item |
int |
$fromId: |
the id of the source item |
API Tags:
array createAlbum(
int
$parentAlbumId, string
$name, string
$title, string
$summary, string
$description, string
$keywords
)
|
|
Create a new album.
Parameters:
int |
$parentAlbumId: |
the id of the parent album |
string |
$name: |
the name of the new album |
string |
$title: |
the title of the new album |
string |
$summary: |
the summary of the new album |
string |
$description: |
the description of the new album |
string |
$keywords: |
the keywords of the new album |
API Tags:
Return: | GalleryStatus a status code GalleryAlbumItem a new album |
GalleryStatus createFastDownloadFile(
object
$entity, [bool
$runEvenInUnitTest = false]
)
|
|
Create a small PHP file containing all the information we need to send a data item or derivative to the browser.
Note that fast-downloads are only created for items with public permissions
Parameters:
object |
$entity: |
GalleryDataItem or GalleryDerivative object |
bool |
$runEvenInUnitTest: |
(optional) force this to run, even in the unit test framework |
API Tags:
GalleryStatus createItemAttributes(
int
$itemId, array
$parentSequence
)
|
|
Create a new set of attributes for an item
Parameters:
int |
$itemId: |
|
array |
$parentSequence: |
the sequence of parent ids |
API Tags:
array deactivatePlugin(
string
$pluginType, string
$pluginId
)
|
|
Deactivate the given plugin
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
API Tags:
Return: | GalleryStatus a status code array redirect info for error page (empty for success) |
GalleryStatus deleteEntityById(
int
$id, [mixed
$requiredEntityType = null]
)
|
|
Delete the entity with the given id
Parameters:
int |
$id: |
the id of a GalleryEntity to delete |
mixed |
$requiredEntityType: |
(optional) Throw an ERROR_MISSING_OBJECT if the loaded entity doesn't extend the given entity-type (or types). Specify 'GalleryEntity' if any entity type is allowed. |
API Tags:
Return: | a status code |
Deprecated: | $requiredEntityType will no longer be optional after the next major API change |
void deleteFastDownloadFileById(
int
$entityId
)
|
|
Delete the fast download file for a specific entity
Parameters:
Remove the given renderer from all items that are using it.
Parameters:
string |
$rendererClassName: |
|
API Tags:
Remove the given sort order from any thing in the framework that uses it (albums and the default sort order).
Parameters:
API Tags:
array deleteUserItems(
int
$userId
)
|
|
Delete all non-album items of a user. Then delete all remaining albums that are empty.
This function can only be called with activeUser = Site Admin
Parameters:
API Tags:
Return: | GalleryStatus a status code |
array describeEntity(
string
$entityName, [boolean
$tryAllModules = false]
)
|
|
Describe the members, modules and parent of an entity
Parameters:
string |
$entityName: |
a class name |
boolean |
$tryAllModules: |
true if we should scan all modules, not just the active ones |
API Tags:
Return: | GalleryStatus a status code entity associative array |
array describeMap(
string
$mapName, [boolean
$tryAllModules = false]
)
|
|
Describe all the members of a map
Parameters:
string |
$mapName: |
|
boolean |
$tryAllModules: |
true if we should scan all modules, not just the active ones |
API Tags:
Return: | GalleryStatus a status code, array member name => member type |
GalleryStatus error(
int
$errorCode, [string
$fileName = 'ignored'], [string
$lineNumber = 'ignored'], [string
$errorMessage = null]
)
|
|
Return an error status.
Starting in GalleryCoreApi 7.4 we ignore the filename and line number. You still need to provide them if you want to provide an error message. Next major API bump we'll remove the fileName and lineNumber arguments.
Parameters:
int |
$errorCode: |
|
string |
$fileName: |
deprecated |
string |
$lineNumber: |
deprecated |
string |
$errorMessage: |
|
API Tags:
Estimate the dimensions of a GalleryDerivativeImage from its operations and its source.
Parameters:
GalleryDerivativeImage |
$derivative: |
|
GalleryDerivativeEntity |
$source
: |
(probably a GalleryPhotoItem or GalleryMovieItem) |
|
&$derivative: |
|
|
$source: |
|
API Tags:
Information Tags:
Todo: | This method knows too much about a small set of operations. We should move it into the toolkits themselves. |
Expire all derivatives that depend on the source ids specified
Parameters:
API Tags:
array fetchAccessListId(
int
$itemId
)
|
|
Look up an item's access list.
Parameters:
int |
$itemId: |
the id of the source item |
API Tags:
Return: | GalleryStatus a status code, int accessListId the associated item's list |
array fetchAccessListIds(
string|array
$permission, int
$userId, [boolean
$sessionPermissions = true]
)
|
|
Fetch all the access list ids that grant the given permission to the given user (either directly or via a group).
Parameters:
string|array |
$permission: |
a single permission id (eg. 'core.view') or an array of permission ids |
int |
$userId: |
|
boolean |
$sessionPermissions: |
(optional) false to ignore session based permissions |
API Tags:
Return: | GalleryStatus a status code array int access list ids |
array fetchAlbumTree(
[int
$itemId = null], [int
$depth = null], [int
$userId = null]
)
|
|
Fetch album tree visible to current user, optionally starting from a given album and to a given depth.
Parameters:
int |
$itemId: |
(optional) id of album for root of tree |
int |
$depth: |
(optional) max depth of tree |
int |
$userId: |
(optional) items visible to this user id, instead of current user |
API Tags:
Return: | GalleryStatus a status code array (albumId => array(albumId => array, ..), ..) |
array fetchAllItemIds(
string
$itemType, [array|string
$permission = 'core.view']
)
|
|
Return the ids of all items that match the given type and have the given permission.
Parameters:
string |
$itemType: |
an item type (eg. GalleryAlbumItem) |
array|string |
$permission: |
(default is core.view). Either a single permission-id or an array of permission-ids. |
API Tags:
Return: | GalleryStatus a status code array(id, id, id, ...) |
array fetchAllItemIdsByOwnerId(
int
$ownerId
)
|
|
Return the ids of all items which are owned by the given userid.
This function does NOT obey permissions!
Parameters:
int |
$ownerId: |
the id of the owner of the items |
API Tags:
Return: | GalleryStatus a status code array(id, id, id, ...) |
array fetchAllPermissionsForItem(
int
$itemId, [boolean
$compress = false]
)
|
|
Return a list of permissions for the given item id
Parameters:
int |
$itemId: |
|
boolean |
$compress: |
should we compress the permission list? |
API Tags:
Return: | GalleryStatus a status code array array('userId' or 'groupId' or 'entityId' => ..., 'permission' => ...) |
array fetchAllPluginParameters(
string
$pluginType, string
$pluginId, [int
$itemId = 0]
)
|
|
Get all the parameters for this plugin
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
int |
$itemId: |
the id of item (or null for global settings) |
API Tags:
Return: | GalleryStatus a status code array (parameterName => parameterValue) |
array fetchChildAlbumItemIds(
GalleryItem
$item, [int
$offset = null], [int
$count = null], [int
$userId = null]
)
|
|
Same as fetchChildItemIds except we only want sub-albums
Parameters:
GalleryItem |
$item: |
|
int |
$offset: |
where to start |
int |
$count: |
how many to return |
int |
$userId: |
optional user id. Defaults to current user id |
API Tags:
Return: | GalleryStatus a status code array integer ids |
array fetchChildCounts(
array
$itemIds, [int
$userId = null]
)
|
|
Return the number of children for the items specified, that are visible to the given user.
Parameters:
array |
$itemIds: |
|
int |
$userId: |
an optional user id (default is the current user) |
API Tags:
Return: | GalleryStatus a status code array (itemId => count, itemId => count, ...) |
array fetchChildDataItemIds(
GalleryItem
$item, [int
$offset = null], [int
$count = null], [int
$userId = null]
)
|
|
Same as fetchChildItemIds except we only want data items
Parameters:
GalleryItem |
$item: |
|
int |
$offset: |
where to start |
int |
$count: |
how many to return |
int |
$userId: |
optional user id. Defaults to current user id |
API Tags:
Return: | GalleryStatus a status code array integer ids |
array fetchChildIdByPathComponent(
int
$parentId, string
$pathComponent
)
|
|
Returns the id of the child filesystem entity that matches the given path component.
Note: this call ignores permissions so it must be used very carefully!
Parameters:
int |
$parentId: |
|
string |
$pathComponent: |
of the target item |
API Tags:
Return: | GalleryStatus a status code int an id |
array fetchChildItemIds(
GalleryItem
$item, [int
$offset = null], [int
$count = null], [int
$userId = null]
)
|
|
Return the ids of the children of this entity, in the order specified by the orderBy field and the direction specified by the orderDirection field, that are visible to the given user.
Parameters:
GalleryItem |
$item: |
|
int |
$offset: |
where to start |
int |
$count: |
how many to return |
int |
$userId: |
optional user id. Defaults to current user id |
API Tags:
Return: | GalleryStatus a status code array integer ids |
array fetchChildItemIdsIgnorePermissions(
GalleryItem
$item, [int
$offset = null], [int
$count = null]
)
|
|
Same as fetchChildItemIds, except that we ignore permissions
Parameters:
GalleryItem |
$item: |
|
int |
$offset: |
where to start |
int |
$count: |
how many to return |
API Tags:
Return: | GalleryStatus a status code array integer ids |
array fetchChildItemIdsWithPermission(
int
$itemId, array|string
$permissionId
)
|
|
Return the ids of all the child items of the given item that have the matching permission.
Useful for, example, for finding all the children where we (the active user) has the 'core.changePermissions' permission bit set. This allows us to cascade permission updates.
Parameters:
int |
$itemId: |
|
array|string |
$permissionId: |
Either a single permission-id or an array of permission-ids |
API Tags:
Return: | GalleryStatus a status code array a list of ids |
array fetchDerivativePreferencesForItem(
int
$targetId
)
|
|
Get the derivative preferences for the given item
Parameters:
int |
$targetId: |
the target id |
API Tags:
Return: | GalleryStatus a status code array (derivativeType => ..., derivativeOperations => ...) |
array fetchDerivativesByItemIds(
array
$ids
)
|
|
Convenience function to fetch all derivatives for a given item id
Parameters:
array |
$ids: |
GalleryItem ids |
API Tags:
Return: | GalleryStatus a status code array(GalleryItem id => GalleryDerivativeImage, ...) |
array fetchDerivativesBySourceIds(
array
$ids, [array
$types = array()]
)
|
|
Load the derivative images that have the specified source id(s) with the type(s) specified
Parameters:
array |
$ids: |
Derivative source (GalleryFileSystemEntity or GalleryDerivative) ids |
array |
$types: |
derivative types (eg. DERIVATIVE_TYPE_IMAGE_THUMBNAIL) |
API Tags:
Return: | GalleryStatus a status code array(GalleryItem id => GalleryDerivativeImage, ...) |
array fetchDescendentAlbumItemIds(
GalleryItem
$item, [int
$offset = null], [int
$count = null], [string
$permission = 'core.view']
)
|
|
Same as fetchDescendentItemIds except we only want sub-albums
Parameters:
GalleryItem |
$item: |
|
int |
$offset: |
where to start |
int |
$count: |
how many to return |
string |
$permission: |
(optional) what permission is required for the item |
API Tags:
Return: | GalleryStatus a status code array integer ids |
array fetchDescendentCounts(
array
$itemIds, [int
$userId = null]
)
|
|
Fetch the breakdown of descendents for a given item
Parameters:
array |
$itemIds: |
|
int |
$userId: |
an optional user id (default is the current user) |
API Tags:
Return: | GalleryStatus a status code array(id => ##, id => ##) |
array fetchDescendentItemIds(
GalleryItem
$item, [int
$offset = null], [int
$count = null], [string
$permission = 'core.view']
)
|
|
Return the ids of the descendents of this entity that are visible to the given user.
Parameters:
GalleryItem |
$item: |
|
int |
$offset: |
where to start |
int |
$count: |
how many to return |
string |
$permission: |
(optional) what permission is required for the item |
API Tags:
Return: | GalleryStatus a status code array integer ids |
array fetchEntitiesLinkedTo(
int
$targetId
)
|
|
Fetch the ids of the entities linked to the target entity
Parameters:
int |
$targetId: |
the target entity id |
API Tags:
Return: | GalleryStatus a status code array entity ids |
int fetchExtremeChildWeight(
int
$itemId, int
$direction
)
|
|
Fetch the highest or lowest weight of all children
Parameters:
int |
$itemId: |
the parent item id |
int |
$direction: |
the direction (HIGHER_WEIGHT, LOWER_WEIGHT) |
API Tags:
array fetchGroupByGroupName(
[string
$groupName = null]
)
|
|
Lookup a group by name
Parameters:
API Tags:
Return: | GalleryStatus a status code GalleryGroup a group |
array fetchGroupCount(
[string
$substring = null]
)
|
|
Return a count of groups, optionally matching a search string
Parameters:
string |
$substring: |
the substring to match |
API Tags:
Return: | GalleryStatus a status code int group count |
array fetchGroupNames(
[int
$count = null], [int
$offset = null], [string
$substring = null]
)
|
|
Return a map of groupIds => groupNames.
You can specify how many groups to list, and where the windows is in the list of all groups.
Parameters:
int |
$count: |
(optional) the number of groupnames desired |
int |
$offset: |
(optional) the start of the range |
string |
$substring: |
(optional) a substring to match |
API Tags:
Return: | GalleryStatus a status code array (groupname, groupname, ...) |
array fetchGroupsForUser(
int
$userId, [int
$count = null], [int
$offset = null]
)
|
|
Return a list of groups that a user belongs to.
You can specify how many userids to list, and where the windows is in the list of all users.
Parameters:
int |
$userId: |
|
int |
$count: |
the number of group ids desired |
int |
$offset: |
the start of the range |
API Tags:
Return: | GalleryStatus a status code array group id => group name |
array fetchItemIdByPath(
string
$path
)
|
|
Given a complete logical path, return the item id that it refers to.
Parameters:
API Tags:
Return: | GalleryStatus a status code int the item id |
array fetchItemIdCount(
string
$itemType, [string
$permission = 'core.view'], [int
$userId = null]
)
|
|
Return the number of of items that match the given type and have the given permission.
Parameters:
string |
$itemType: |
an item type (eg. GalleryAlbumItem) |
string |
$permission: |
(default is core.view) |
int |
$userId: |
an optional user id (default is the current user) |
API Tags:
Return: | GalleryStatus a status code int a count |
array fetchItemizedDescendentCounts(
array
$itemIds
)
|
|
Fetch the breakdown of descendents for a given item. Note: this call is more expensive than GalleryCoreApi::fetchDescendentCounts(), so use that version where possible.
Parameters:
API Tags:
Return: | GalleryStatus a status code array(id => array('GalleryAlbumItem' => ##, 'GalleryDataItem' => ##), id => array('GalleryAlbumItem' => ##, 'GalleryDataItem' => ##)) |
array fetchItemOrderWeight(
int
$itemId
)
|
|
Get the order weight for a given item id
Parameters:
API Tags:
Return: | GalleryStatus a status code int the order weight |
array fetchItemOrderWeights(
array
$itemIds
)
|
|
Get the order weight for many item ids
Parameters:
API Tags:
Return: | GalleryStatus a status code array(itemId1 => orderWeight1, itemId2 => orderWeight2, ...) |
array fetchItemViewCount(
int
$itemId
)
|
|
Get the view counts for many item ids
Parameters:
API Tags:
Return: | GalleryStatus a status code int view count |
array fetchItemViewCounts(
array
$itemIds
)
|
|
Get the view counts for many item ids
Parameters:
API Tags:
Return: | GalleryStatus a status code array (itemId => viewCount, ..) |
array fetchLanguageCodeForUser(
int
$userId
)
|
|
Fetch the preferred language of a specific user.
Parameters:
API Tags:
Return: | GalleryStatus a status code string code of preferred locale |
array fetchLinkableChildItemIdsWithPermission(
array
$itemId,
$permissionId, array|string
$permission
)
|
|
Return the ids of all the child items of the given item that have the matching permission and are linkable entities. Useful for, example, for finding all the children where we (the active user) has the 'core.changePermissions' permission bit set. This allows us to cascade permission updates.
Parameters:
array |
$itemId: |
|
array|string |
$permission: |
(default is core.view). Either a single permission-id or an array of permission-ids. |
|
$permissionId: |
|
API Tags:
Return: | GalleryStatus a status code array a list of ids |
int fetchNextItemWeight(
int
$itemId, int
$direction
)
|
|
Fetch the weight of the next peer in line (higher or lower, as specified)
Parameters:
int |
$itemId: |
|
int |
$direction: |
the direction (HIGHER_WEIGHT, LOWER_WEIGHT) |
API Tags:
Fetch the originationTimestamp through our known toolkits
Parameters:
API Tags:
Return: | GalleryStatus a status code int a timestamp or null if nothing was found |
array fetchParents(
GalleryItem
$item, [string|array
$permission = null], [bool
$filterBreadcrumb = false]
)
|
|
Load all the ancestors of this item
Parameters:
GalleryItem |
$item: |
|
string|array |
$permission: |
(optional) only return ancestors with a specific permission or an array of required permissions |
bool |
$filterBreadcrumb: |
(optional) whether to filter results with breadcrumbRootId |
API Tags:
Return: | GalleryStatus a status code array of GalleryItem, from top level to parent item |
array fetchParentSequence(
int
$itemId, [bool
$filterBreadcrumb = false]
)
|
|
Get the parent sequence for this item id
Parameters:
int |
$itemId: |
|
bool |
$filterBreadcrumb: |
(optional) whether to filter results with breadcrumbRootId |
API Tags:
Return: | GalleryStatus a status code array the parent id sequence from root album down; given itemId not included |
array fetchPermissionsForItems(
array
$itemIds, [int
$userId = null], [boolean
$sessionPermissions = true]
)
|
|
Return a list of permissions for the given items
Parameters:
array |
$itemIds: |
int GalleryItem ids |
int |
$userId: |
(optional) id of the user whose permissions we search for |
boolean |
$sessionPermissions: |
(optional) false to ignore session based permissions |
API Tags:
Return: | GalleryStatus a status code array (id => array(array(permission.id => 1, ...), ...) |
array fetchPluginList(
string
$pluginType
)
|
|
Return a plugin list by plugin type of all installed plugins.
Parameters:
API Tags:
Return: | GalleryStatus a status code array of (pluginId => ('active' => boolean)) |
array fetchPluginStatus(
string
$pluginType, [bool
$ignoreCache = false]
)
|
|
Get the status of all plugins of a given type
Notes: - Some array elements are empty for uninstalled plugins
('version', 'required*Api', 'callbacks').
- Installed but unavailable plugins are not listed.
Parameters:
string |
$pluginType: |
|
bool |
$ignoreCache: |
(optional) true if we want to ignore the cache |
API Tags:
Return: | GalleryStatus as status code array (moduleId => array('active' => true/false, 'available' => true/false, 'callbacks' => string, 'requiredCoreApi' => array 'requiredModuleApi' => array, 'version' => string) |
array fetchPreferredsByItemIds(
array
$ids
)
|
|
Convenience function to fetch the preferred for an item id
Parameters:
array |
$ids: |
GalleryItem ids |
API Tags:
Return: | GalleryStatus a status code array(GalleryItem id => GalleryDerivativeImage, ...) |
Return the preferred source for this item by returning the first occurrence of the following:
- This item's preferred derivative
- This item's linked item's preferred derivative (if applicable)
- This item's linked item (if applicable)
- This item itself
Parameters:
API Tags:
Return: | GalleryObject a status code GalleryEntity (either a GalleryDataItem or a GalleryDerivative) the preferred source |
array fetchResizesByItemIds(
array
$ids
)
|
|
Convenience function to fetch the resizes for an item id
Parameters:
array |
$ids: |
GalleryItem ids |
API Tags:
Return: | GalleryStatus a status code array(GalleryItem id => array(GalleryDerivativeImage, ...) ...) |
Return the correct theme for this item. If the appropriate theme cannot be loaded, we fall back on the default. And if that can't be loaded, then we return null.
Parameters:
API Tags:
Return: | GalleryStatus a status code string a theme plugi |
array fetchThumbnailsByItemIds(
array
$ids
)
|
|
Convenience function to fetch the thumbnail for an item id
Parameters:
array |
$ids: |
GalleryItem ids |
API Tags:
Return: | GalleryStatus a status code array(GalleryItem id => GalleryDerivativeImage, ...) |
array fetchUserByUserName(
[string
$userName = null]
)
|
|
Lookup a user by username
Parameters:
API Tags:
Return: | GalleryStatus a status code GalleryUser a user |
array fetchUserCount(
[string
$substring = null], [
$groupId = null]
)
|
|
Return the total number of users
Parameters:
string |
$substring: |
an optional substring to match against the username |
|
$groupId: |
|
API Tags:
Return: | GalleryStatus a status code int number of users |
array fetchUsernames(
[int
$count = null], [int
$offset = null], [string
$substring = null]
)
|
|
Return a map of userNames => userids
You can specify how many users to list, and where the windows is in the list of all users.
Parameters:
int |
$count: |
(optional) the number of usernames desired |
int |
$offset: |
(optional) the start of the range |
string |
$substring: |
(optional) a substring to match |
API Tags:
Return: | GalleryStatus a status code array (username, username, ...) |
array fetchUsersForGroup(
int
$groupId, [int
$count = null], [int
$offset = null], [string
$substring = null]
)
|
|
Return a list of user ids belonging to a group
You can specify how many userids to list, and where the windows is in the list of all users.
Parameters:
int |
$groupId: |
|
int |
$count: |
the number of user ids desired |
int |
$offset: |
the start of the range |
string |
$substring: |
substring to match against the username |
API Tags:
Return: | GalleryStatus a status code array user id => user name |
array(boolean fetchWebFile(
string
$url, string
$outputFile, [array
$extraHeaders = array()], [array
$postDataArray = array()]
)
|
|
Fetch the web page at the given url. Follow redirects to get the data and upon completion return the http response, headers and the actual URL that we used to get the data.
Parameters:
string |
$url: |
|
string |
$outputFile: |
|
array |
$extraHeaders: |
(optional) extra headers to pass to the server |
array |
$postDataArray: |
the key/value post data |
API Tags:
Return: | success, http response, headers, url) the url is the final url retrieved after redirects |
array(boolean fetchWebPage(
string
$url, [array
$extraHeaders = array()]
)
|
|
Fetch the web page at the given url. Follow redirects to get the data and upon completion return the body, http response, headers and the actual URL that we used to get the data.
Parameters:
string |
$url: |
|
array |
$extraHeaders: |
(optional) extra headers to pass to the server |
API Tags:
Return: | success, string body, http response, headers, url) the url is the final url retrieved after redirects |
array getAllFactoryImplementationIds(
string
$classType
)
|
|
Return the ids and class names of all the available implementations for a class
Parameters:
string |
$classType: |
the class type (eg. 'GalleryToolkit') |
API Tags:
Return: | GalleryStatus a status code array (id => className, ...) |
array getAllFactoryImplementationIdsWithHint(
$classType,
$hint
)
|
|
Return the ids of all the available implementations for a class for a given hint.
Parameters:
API Tags:
Return: | GalleryStatus a status code array (id => className, ...) |
array getAllPluginIds(
string
$pluginType
)
|
|
Get the list of all available plugins of a given type
Parameters:
API Tags:
Return: | GalleryStatus a status code string plugin ids |
array getAnonymousUserId(
)
|
|
Get id of the guest user.
API Tags:
Return: | GalleryStatus a status code int user id |
Return the major and minor version of the Core API.
When we add to the API, we'll bump the minor version. When we change or remove something from the API we'll change the major version. When writing a module, you should verify: - The major version of the API exactly matches the version you expect
- The minor number is the same, or higher than the version you expect
Notes: - If the major number is lower, or it's the same and the minor number is
lower then it means that the API is older than you require.
- If the major number is higher, then it means that the API is newer, but
has made a change that may be incompatible with your module
- If the major number is the same and the minor number is higher, then
the API has more features than you need but should still work for you.
API Tags:
Return: | major number, minor number |
Information Tags:
Todo: | for next major version bump: - remove GallerySession::getSessionId
- remove GalleryPlatform::recursiveFixDirPermissions
- remove GalleryUtilities::htmlEntityDecode
- remove GalleryUrlGenerator::getGalleryId
- remove GalleryStatus::wrap
- change GalleryCoreApi::error to only take error code and error message
- remove GalleryCapabilities (major bump of embed api too?)
- remove 'link' entry in Gallery.class constructor
- remove GalleryCoreApi::getPluginBaseDirs();
- remove GalleryCoreApi::getPluginBaseDir();
- remove GalleryCoreApi::isPluginInDefaultLocation();
- remove $skipBaseDirectoryDetection from GalleryCoreApi::requireOnce();
- remove support for check[Sidebar|Album|Photo]Blocks deprecated params
for ShouldShowEmergencyEditItemLink in Callbacks.inc
and comment in blocks/EmergencyEditItemLink.tpl
- remove GalleryView::_getItem() (the private version of getItem());
- remove support for : separator in GalleryView::loadView
- delete GallerySqlFragment.class
- remove studyPermissions, fetchPermissionsForItems does the same and more.
- remove GalleryUtilities::utf8Substring (moved to GalleryCoreApi)
- remove lib/wz_dragdrop/ (currently used by G2.1's watermark module)
- refactor renderer code (methods: getRenderer and render, GalleryEntity vs GalleryItem)
- remove support for {modules,themes}/.../locale dirs from lib/tools/po scripts
from GalleryTranslatorHelper_medium::installTranslationsForPlugin,
and from getPackageNames() in lib/tools/repository/classes/RepositoryDescriptor.class
- remove resourceGetTemplateBaseDir from GalleryTemplate class
- delete GalleryTestCase::failWithStatus
- loadEntitiesById and deleteEntityById: make optional $requiredEntityType mandatory
- remove GalleryCoreApi::registerEventListener, GalleryModule::registerEventListeners
and other code marked for removal in helpers/GalleryEventHelper_simple.class
- consider renaming everything using "languageCode" to "locale" for correct terminology
(GalleryTranslator.class and Gallery.class)
- delete modules/core/templates/blocks/NavigationLinks.tpl
- remove GalleryRepository::getLanguageDescription
- convert the contents of GALLERY_PERMISSION_SESSION_KEY to array indices instead of array
of values.
|
string getCodeBasePath(
[string
$relativePath = null]
)
|
|
Get the local path to the Gallery code base path (not URL or web root). Optionally append a relative path.
Parameters:
string |
$relativePath: |
(optional) Relative path to append to the code base path. |
API Tags:
Return: | local path to the Gallery code base. If the optional parameter has not been supplied the return value will have the trailing slash appended. |
array getDefaultAlbumId(
)
|
|
Get id of the album to display by default.
API Tags:
Return: | GalleryStatus a status code int album id |
array getExternalAccessMemberList(
string
$entityName
)
|
|
Get a list of entity members which are allowed to be shown / set by external systems (e.g.
via remote protocols like WebDAV, XML-RPC, etc). This does not include any permission checking.
Parameters:
string |
$entityName: |
name of the entity |
API Tags:
Return: | GalleryStatus a status code array(string memberName => array('read' => boolean true if it's ok to show, 'write' => boolean true if it's ok to set)) |
array getFactoryDefinitionHints(
string
$classType,
$implId
)
|
|
Return the Hints for the specified class type and implId.
Parameters:
string |
$classType: |
Class type of the factory |
|
$implId: |
|
API Tags:
Return: | GalleryStatus array Hints for the specified implementation id and class type |
array getLanguageDescription(
string
$languageCode
)
|
|
Returns the language description of the specified language-country code.
eg. en_US => English (US)
Parameters:
API Tags:
Return: | GalleryStatus a status code string language description |
array getLegalPathComponent(
string
$pathComponent, int
$parentId, [int
$selfId = null], [boolean
$forDirectory = false]
)
|
|
Get a legal path component in the given parent id. Legal by the platform standards, and legal in that it doesn't cause a conflict with other path components.
Parameters:
string |
$pathComponent: |
the starting path component (eg. "IMG_10293.JPG") |
int |
$parentId: |
the target parent id |
int |
$selfId: |
(optional) ignore path collision with this id |
boolean |
$forDirectory: |
(optional) Whether the path component is for a directory. Defaults to false. Periods are allowed anywhere in directories. |
API Tags:
Return: | GalleryStatus a status code string the legal path component |
object array getLockIds(
)
|
|
Get the set of lock ids
API Tags:
array getMapEntry(
string
$mapName, array
$select, [array
$match = array()], [array
$optional = array()]
)
|
|
Get entries in a map that match a criteria and return selected fields
Parameters:
string |
$mapName: |
the map we're working on |
array |
$select: |
the columns to return |
array |
$match: |
the entries to match |
array |
$optional: |
optional arguments (eg. limit, orderBy) array('limit' => array('count' => #, 'offset' => #), 'orderBy' => array(columnName => ORDER_ASCENDING|ORDER_DESCENDING, ...)) |
API Tags:
Return: | GalleryStatus a status code array the results |
array getMaximumManagedToolkitPriority(
)
|
|
Get maximum priority value (lowest priority) in managed priority range (20-40)
API Tags:
Return: | GalleryStatus a status code int priority |
array getMimeType(
string
$filename, [string
$requestMimeType = null]
)
|
|
Determine the proper mime type given the file and optionally with the mime type from the request
Parameters:
string |
$filename: |
the file name to determine the mime type for |
string |
$requestMimeType: |
(optional) |
API Tags:
Return: | GalleryStatus a status code string a mime type (application/unknown if no known extension) |
array getPermissionIds(
[int
$flags = 0]
)
|
|
Get all the permission ids that match the specified flags.
This will return any permissions that contain *all* the bits from flags.
Parameters:
API Tags:
Return: | GalleryStatus a status code array (id => description, id => description, ...) |
array getPermissions(
int
$itemId, [int
$userId = null], [boolean
$sessionPermissions = true]
)
|
|
Return all the permissions that the given user has for the given item.
Parameters:
int |
$itemId: |
|
int |
$userId: |
an optional user id (default is current user) |
boolean |
$sessionPermissions: |
(optional) false to ignore session based permissions |
API Tags:
Return: | GalleryStatus a status code array (perm1, perm2) |
string getPluginBaseDir(
string
$pluginType, string
$pluginId, [bool
$clearCache = false]
)
|
|
Returns the base directory of the specified plugin.
OBSOLETE. Remove on next major API bump. Modules should never assume the filesystem location of any module, not even the core module. Use this function to get the base directory of a module. Possible base directories are usually gallery2/ and gallery2/plugins. The complete list can be read with GalleryCoreApi::getPluginBaseDirs().
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
bool |
$clearCache: |
(optional) force index to be reread from the filesystem |
API Tags:
Return: | plugin base directory |
void getPluginBaseDirs(
)
|
|
Returns an array of directories that can contain plugins.
OBSOLETE. Remove on next major API bump. This function should only be used in special circumstances, for example when a list of all plugins needs to be made. Currently it returns gallery2/ and gallery2/plugins/.
array getPluginParameter(
string
$pluginType, string
$pluginId, string
$parameterName, [string
$itemId = 0]
)
|
|
Convenience method to retrieve a plugin parameter
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
string |
$parameterName: |
|
string |
$itemId: |
(optional) |
API Tags:
Return: | GalleryStatus a status code string a value |
array getRedundantToolkitPriorities(
)
|
|
Get list of toolkits/priorities in managed priority range (20-40) for which another toolkit supports a same operation and mime type.
API Tags:
Return: | GalleryStatus a status code array (toolkitId=>priority, ..) |
array getSubPermissions(
$permissionId
)
|
|
Expand a single permission into all the possible permissions that it can possibly be.
For example, convert 'core.viewAll' into: ('core.viewAll', 'core.view', 'core.viewOriginal', 'core.viewResizes')
Parameters:
API Tags:
Return: | GalleryStatus a status code array(array('id' => ..., 'description' => ...), ...) |
array['language getSupportedLanguages(
)
|
|
Return the list of languages that we support.
API Tags:
Return: | code']['country code'] = array('description', 'right-to-left'?) |
array getToolkitByOperation(
string
$mimeType, string
$operationName
)
|
|
Get a toolkit that can perform the given operation
Parameters:
string |
$mimeType: |
|
string |
$operationName: |
|
API Tags:
Return: | GalleryStatus a status code GalleryToolkit a toolkit string a result mime type |
array getToolkitByProperty(
string
$mimeType, string
$propertyName
)
|
|
Get a toolkit that can retrieve the given property
Parameters:
string |
$mimeType: |
|
string |
$propertyName: |
|
API Tags:
Return: | GalleryStatus a status code GalleryToolkit a toolkit |
array getToolkitOperationMimeTypes(
string
$operationName
)
|
|
Get all valid input mime types for a certain operation
Parameters:
API Tags:
Return: | GalleryStatus a status code array(mime type => array(toolkit ids, sorted by priority)) |
array getToolkitOperations(
string
$mimeType
)
|
|
Get all valid operations on a certain mime type
Parameters:
API Tags:
Return: | GalleryStatus a status code array('name' => ..., 'outputMimeType' => ..., 'description' => ..., arguments => array('type' => ..., 'description' => ...), ...) |
array getToolkitPriorityById(
string
$toolkitId
)
|
|
Get maximum priority value (lowest priority) in managed priority range (20-40)
Parameters:
API Tags:
Return: | GalleryStatus a status code int priority |
array getToolkitProperties(
string
$mimeType
)
|
|
Get all valid properties of a certain mime type
Parameters:
API Tags:
Return: | GalleryStatus a status code array ( array('name' => property, 'type' => type, 'description' => description), .. ) |
array getToolkitsByProperty(
string
$mimeType, string
$propertyName
)
|
|
Get the toolkits that can retrieve the given property
Parameters:
string |
$mimeType: |
|
string |
$propertyName: |
|
API Tags:
Return: | GalleryStatus a status code array of toolkitIds |
Make sure that the album has a thumbnail. If it doesn't, then grab the first handy child and make it the album's thumbnail. We're not picky.
Parameters:
int |
$itemId: |
the album id |
API Tags:
Return: | a status code boolean true if successful |
array handleThemeSettingsRequest(
string
$themeId, int
$itemId, array
$form
)
|
|
Handle theme settings form submission
Parameters:
string |
$themeId: |
if empty, site default theme is used |
int |
$itemId: |
|
array |
$form: |
form values |
API Tags:
Return: | GalleryStatus a status code array error messages string localized status message |
array hasItemPermission(
int
$itemId, string
$permission, [int
$userId = null], [boolean
$sessionPermissions = true]
)
|
|
Return true if the current user has the specific permission for the target item
Parameters:
int |
$itemId: |
|
string |
$permission: |
|
int |
$userId: |
an optional user id (default is the current user) |
boolean |
$sessionPermissions: |
(optional) false to ignore session based permissions |
API Tags:
Return: | GalleryStatus a status code boolean true if yes |
array hasPermission(
int
$itemId, mixed
$entityIds, mixed
$permissions
)
|
|
Are any or the given user/group ids directly granted all given permissions for the target item? Ignores session-based permissions.
Parameters:
int |
$itemId: |
|
mixed |
$entityIds: |
array of int entity ids (usually user or group ids) or a single id |
mixed |
$permissions: |
array of string permission ids or single permission id |
API Tags:
Return: | GalleryStatus a status code boolean true if yes |
GalleryStatus incrementItemViewCount(
int
$itemId, [int
$step = 1]
)
|
|
Update the view count for this item id
Parameters:
int |
$itemId: |
|
int |
$step: |
the amount to increment |
API Tags:
GalleryStatus installTranslationsForLocale(
[string
$locale = null]
)
|
|
Copy the translations for a given locale into our locale hierarchy.
Copies for all available (even uninstalled) plugins.
Parameters:
string |
$locale: |
(optional) Defaults to translator's current locale |
API Tags:
GalleryStatus installTranslationsForPlugin(
string
$pluginType, string
$pluginId
)
|
|
Copy the translations for a given plugin into our locale hierarchy.
Parameters:
string |
$pluginType: |
'module' or 'theme' |
string |
$pluginId: |
the id of the plugin |
API Tags:
GalleryStatus invalidateDerivativeDimensionsBySourceIds(
array
$ids
)
|
|
Zero out the dimensions for all derivatives that depend on the given source id so that they will be recalculated before the next view.
Parameters:
API Tags:
array isAnonymousUser(
[int
$userId = null]
)
|
|
Is the user a guest?
Parameters:
int |
$userId: |
id of user (default is current user) |
API Tags:
Return: | GalleryStatus a status code boolean true if anonymous |
array isDisabledUsername(
string
$userName
)
|
|
Return true if this username is not allowed to log in (generally due to automated abuse).
The username doesn't have to correspond to a real user in the system.
Parameters:
string |
$userName: |
a username |
API Tags:
Return: | GalleryStatus a status code bool true if the account is disabled |
Return true if the plugin is compatible with the current API versions. False otherwise.
Parameters:
API Tags:
Return: | true if the plugin is compatible |
boolean isPluginInDefaultLocation(
string
$pluginType, string
$pluginId, [bool
$clearCache = false]
)
|
|
Indicates whether the specified plugin is in the default plugin directory.
OBSOLETE. Remove on next major API bump. Sometimes it's useful to know just whether a plugin is in its default directory or not, without actually getting any information about its path. It is used for rewriting URL in the UrlGenerator. We don't use GalleryPlatform in this function, because it is too low-level and there are significant problems with making it work here. One of the problems is that it breaks dozens of tests that rely on UnitTestPlatform.
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
bool |
$clearCache: |
(optional) force index to be reread from the filesystem |
boolean isReadLocked(
int
$id
)
|
|
Return true if the given id is read locked or write locked by us.
Parameters:
API Tags:
Return: | true if the entity is read locked |
GalleryStatus isSupportedOperationSequence(
string
$mimeType, string
$operations
)
|
|
Verify that a given mime-type/operation-sequence combination is supported by our existing toolkits by walking the sequence and making sure that we have a toolkit that can handle each operation.
Parameters:
string |
$mimeType: |
the original mime type |
string |
$operations: |
a sequence of operations |
API Tags:
Return: | a status code boolean true if supported, false if not string the output mime type |
array isUserInGroup(
int
$userId, int
$groupId
)
|
|
Is the given user id in the given group?
Parameters:
int |
$userId: |
|
int |
$groupId: |
|
API Tags:
Return: | GalleryStatus a status code boolean true if yes |
array isUserInSiteAdminGroup(
[int
$userId = null]
)
|
|
Is the active user in the admin group?
Parameters:
int |
$userId: |
an optional user id (default is the current user) |
API Tags:
Return: | GalleryStatus a status code boolean true if yes |
array isViewableMimeType(
string
$mimeType
)
|
|
Return true if the given mime type is viewble in a web browser
Parameters:
API Tags:
Return: | GalleryStatus a status code boolean |
boolean isWriteLocked(
int
$id
)
|
|
Return true if the given id is write locked by us.
Parameters:
API Tags:
Return: | true if the entity is write locked |
array loadAvailableBlocks(
[bool
$getInactive = false]
)
|
|
Load the block configuration files from every module
Parameters:
bool |
$getInactive: |
(optional) by default, only active modules' blocks are returned |
API Tags:
Return: | GalleryStatus a status code array block configurations |
array loadEntitiesById(
mixed
$ids, [mixed
$requiredEntityType = null]
)
|
|
Load the GalleryEntities with the ids specified
Parameters:
mixed |
$ids: |
the ids (or id) of the GalleryEntities to load |
mixed |
$requiredEntityType: |
(optional) Throw an ERROR_MISSING_OBJECT if the loaded entity doesn't extend the given entity-type (or types), e.g. 'GalleryItem'. Specify 'GalleryEntity' if any entity type is allowed. |
API Tags:
Return: | GalleryStatus a status code, mixed one GalleryEntity or an array of GalleryEntities |
Deprecated: | $requiredEntityType will no longer be optional after the next major API change |
array loadEntityByExternalId(
string
$externalId, string
$entityType
)
|
|
Map external id to G2 id and then load the entity
Parameters:
string |
$externalId: |
|
string |
$entityType: |
|
API Tags:
Return: | GalleryStatus a status code GalleryEntity |
array loadPlugin(
string
$pluginType, string
$pluginId, [bool
$ignoreVersionMismatch = false], [bool
$errorOnVersionMismatch = false]
)
|
|
Load and initialize the given plugin
Parameters:
string |
$pluginType: |
the plugin type (eg. module, theme) |
string |
$pluginId: |
the plugin id |
bool |
$ignoreVersionMismatch: |
should we ignore version mismatches (default: no) |
bool |
$errorOnVersionMismatch: |
should we return an error on version mismatches instead of redirecting to the upgrader? (default: false) |
API Tags:
Return: | GalleryStatus a status code object the plugin |
Load template data for a theme settings form
Parameters:
string |
$themeId: |
if empty, site default theme is used |
int |
$itemId: |
|
GalleryTemplate |
$template: |
|
array |
$form: |
|
|
&$template: |
|
|
&$form: |
|
API Tags:
array makeSupportedViewableOperationSequence(
string
$mimeType, string
$operations, [boolean
$prependConversion = true]
)
|
|
Make sure operation sequence is supported and produces a browser-viewable output mime type.
Add convert-to-image/jpeg operation if needed.
Parameters:
string |
$mimeType: |
the original mime type |
string |
$operations: |
a sequence of operations |
boolean |
$prependConversion: |
(optional) true to also try prepending convert-to-image/xxx |
API Tags:
Return: | GalleryStatus a status code string a sequence of operations, null if not supported string the output mime type, null if not supported |
Compact the access list map, if we deem that it's a good time to do so.
API Tags:
array mergeDerivativeOperations(
string
$operationSet1, string
$operationSet2, [boolean
$highPriority = false]
)
|
|
Merge together two sets of operations into one in the most sensible way.
For example: OPERATION SET 1 OPERATION SET 2 RESULT crop|1,2,3,4;rotate|90 crop|2,3,4,5 crop|2,3,4,5;rotate|90 scale|250;rotate|90 rotate|-90 scale|250 scale|250;rotate|90 rotate|90 scale|250;rotate|180 scale|250;rotate|90 thumbnail|125 thumbnail|125;rotate|180
Parameters:
string |
$operationSet1: |
the first set of operations |
string |
$operationSet2: |
the second set of operations |
boolean |
$highPriority: |
true if the second set should be added at the beginning of the first set, if it can't be merged. |
API Tags:
Return: | GalleryStatus a status code the merged operation set |
Create a new event with the given name.
Parameters:
string |
$eventName: |
the name of the event, e.g. GalleryEntity::save |
API Tags:
Return: | an event with the given name |
GalleryStatus newFactoryInstance(
string
$classType, [string
$className = null]
)
|
|
Create a new instance of the given type
Parameters:
string |
$classType: |
the class type (eg. 'GalleryToolkit') |
string |
$className: |
the class name (eg. 'NetPbmToolkit') |
API Tags:
Return: | a status code object the instance |
array newFactoryInstanceByHint(
string
$classType, mixed
$hints
)
|
|
Create a new instance of the given type based on the hint(s) provided
Parameters:
string |
$classType: |
the class type (eg. 'GalleryToolkit') |
mixed |
$hints: |
array of hints to try (in order) or single string hint (eg. 'image/jpeg') |
API Tags:
Return: | GalleryStatus a status code, object an instance |
array newFactoryInstanceById(
string
$classType, string
$id
)
|
|
Create a new instance of the given type based on the id provided
Parameters:
string |
$classType: |
the class type (eg. 'GalleryToolkit') |
string |
$id: |
the class name (eg. 'NetPBM') |
API Tags:
Return: | GalleryStatus a status code, object an instance |
array newItemByMimeType(
string
$mimeType
)
|
|
Return the appropriate GalleryItem instance for the mime type provided.
Use the GalleryFactory to try to find an exact match to the mime type. Failing that, fall back to the major type, then fall back to '*'.
Parameters:
API Tags:
Return: | GalleryStatus a status code GalleryItem an item |
Deliver an event to anybody listening.
Parameters:
API Tags:
Return: | GalleryStatus a status code array data returned from listeners, if any |
array(body, postToWebPage(
string
$url, array
$postDataArray, [array
$extraHeaders = array()]
)
|
|
Post form data to a remote url and return the http response, headers and body of the reply
Parameters:
string |
$url: |
|
array |
$postDataArray: |
the key/value post data |
array |
$extraHeaders: |
(optional) extra headers to pass to the server |
API Tags:
Return: | http response, headers) |
GalleryStatus rebalanceChildOrderWeights(
int
$parentItemId, [int
$spacing = 1000]
)
|
|
Rebalance the order weights associated with this item's children. When this method is complete, the child item ids should still have the same order as they have now, but their order weights should be spaced out to exactly the spacing value specified in the arguments.
Parameters:
int |
$parentItemId: |
|
int |
$spacing: |
the order spacing |
API Tags:
array rebuildDerivativeCache(
int
$derivativeId
)
|
|
Rebuild the cache for the given derivative
Parameters:
API Tags:
Return: | GalleryStatus a status code GalleryDerivative the rebuilt derivative |
array rebuildDerivativeCacheIfNotCurrent(
int
$derivativeId, [boolean
$fixBroken = false]
)
|
|
Rebuild the cached derivative file if it is not current.
If the cache is expired, it will be automatically rebuilt
Parameters:
int |
$derivativeId: |
|
boolean |
$fixBroken: |
(optional) whether to try to fix the derivative if is broken |
API Tags:
Return: | GalleryStatus a status code, GalleryDerivative the up-to-date derivative boolean true if it had to be rebuilt, false if not |
Refresh all the locks that we hold so that they aren't accidentally considered expired
Parameters:
int |
$freshUntil: |
the new "fresh until" timestamp |
API Tags:
void registerEventListener(
string
$eventName,
&$eventListener, [boolean
$disableForUnitTests = false], GalleryEventListener
$eventListener
)
|
|
Register an event listener.
Parameters:
string |
$eventName: |
the name of the event, e.g. GalleryEntity::save |
GalleryEventListener |
$eventListener: |
|
boolean |
$disableForUnitTests: |
(optional) if true, disable event listener during tests |
|
&$eventListener: |
|
API Tags:
Deprecated: | Use GalleryCoreApi::registerFactoryImplementation('GalleryEventListener', ... |
void registerFactoryImplementation(
string
$classType, string
$className, string
$implId, string
$implPath, string
$implModuleId, array
$hints, [int
$orderWeight = 5]
)
|
|
Register a new implementation with the factory
Parameters:
string |
$classType: |
the class type (eg. 'GalleryToolkit') |
string |
$className: |
the class name (eg. 'NetPbmToolkit') |
string |
$implId: |
an implementation id (eg. 'NetPBM') |
string |
$implPath: |
the relative path to the implementation file (eg. 'modules/netpbm/classes/NetPbmToolkit.class') |
string |
$implModuleId: |
the id of the module containing the implementation (eg. 'netpbm') |
array |
$hints: |
optional hints that can be used to locate this implementation (eg. array('image/jpeg', 'image/gif')) |
int |
$orderWeight: |
the priority of this implementation (lower number == higher priority) |
GalleryStatus registerFactoryImplementationForRequest(
string
$classType, string
$className, string
$implId, string
$implPath, string
$implModuleId, array
$hints
)
|
|
Register a new implementation with the factory for this request only
Parameters:
string |
$classType: |
the class type (eg. 'GalleryToolkit') |
string |
$className: |
the class name (eg. 'NetPbmToolkit') |
string |
$implId: |
an implementation id (eg. 'NetPBM') |
string |
$implPath: |
the relative path to the implementation file (eg. 'modules/netpbm/classes/NetPbmToolkit.class') |
string |
$implModuleId: |
the id of the module containing the implementation (eg. 'netpbm') |
array |
$hints: |
optional hints that can be used to locate this implementation (eg. array('image/jpeg', 'image/gif')) |
GalleryStatus registerPermission(
string
$module, string
$permissionId, string
$description, [int
$flags = 0], [array
$composites = array()]
)
|
|
Register a new permission
Parameters:
string |
$module: |
the id of the module |
string |
$permissionId: |
the id of the permission |
string |
$description: |
the non-localized description of the permission |
int |
$flags: |
(optional) flags (of the GALLERY_PERMISSION_XYZ variety) |
array |
$composites: |
(optional) ids of other permissions that compose this one |
API Tags:
GalleryStatus registerToolkitOperation(
string
$toolkitId, array
$mimeTypes, string
$operationName, array
$parameterTypesArray, string
$description, [string
$outputMimeType = ''], [int
$priority = 5]
)
|
|
Register the operations that a toolkit is able to perform on a certain mime type.
This should be called by a module that provides a toolkit to access certain mime types. The module should also call GalleryCoreApi::registerFactoryImplementation with the same "id" that it registers here, so the correct class can be found later.
Parameters:
string |
$toolkitId: |
the id of the toolkit |
array |
$mimeTypes: |
the applicable mime types for this operation |
string |
$operationName: |
the id of the operation |
array |
$parameterTypesArray: |
a list of parameters that this operation requires |
string |
$description: |
a translatable description of this operation |
string |
$outputMimeType: |
the output mime type after performing this operation |
int |
$priority: |
priority of this implementation vs other toolkits |
API Tags:
GalleryStatus registerToolkitProperty(
string
$toolkitId, array
$mimeTypes, string
$propertyName, string
$type, string
$description
)
|
|
Register a parameter that a toolkit can extract from a certain mime type.
This should be called by a module that provides a toolkit to access certain mime types. The module should also call GalleryCoreApi::registerFactoryImplementation with the same "id" that it registers here, so the correct class can be found later.
Parameters:
string |
$toolkitId: |
the id of the toolkit |
array |
$mimeTypes: |
the applicable mime types for this property |
string |
$propertyName: |
the name of the property |
string |
$type: |
the type of the property |
string |
$description: |
a translatable description of this property |
API Tags:
Let go of all of our locks.
API Tags:
Release the given lock(s)
Parameters:
mixed |
$lockIds: |
array of lock ids, or a single lock id |
API Tags:
Transfer the ownership of all items by oldUser to newUser
Parameters:
int |
$oldUserId: |
the user id of the old owner |
int |
$newUserId: |
the user id of the new owner |
API Tags:
GalleryStatus remapSourceIds(
string
$originalSourceId, string
$newSourceId
)
|
|
Find all derivatives attached to one source and switch them to another one
Parameters:
string |
$originalSourceId: |
the original source id |
string |
$newSourceId: |
the new source id |
API Tags:
GalleryStatus removeAllMapEntries(
string
$mapName, [bool
$useNonTransactionalConnection = false]
)
|
|
Remove ALL entries from this map.. use with caution!
Parameters:
string |
$mapName: |
|
bool |
$useNonTransactionalConnection: |
(optional) set to true if we should do this operation outside of a transaction (which will let some databases use the TRUNCATE statement). |
API Tags:
GalleryStatus removeAllPluginParameters(
string
$pluginType, string
$pluginId
)
|
|
Remove all parameters for this plugin
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
API Tags:
Remove any users in the group
Parameters:
API Tags:
string removeDerivativeOperation(
$operation,
$operationSet
)
|
|
Remove the given operation from the operation set.
Parameters:
|
$operation: |
|
|
$operationSet: |
|
API Tags:
Return: | the new operation set |
GalleryStatus removeDerivativePreferenceForItemType(
int
$itemId, int
$derivativeType
)
|
|
Remove derivative preference for a given item/type combination
Parameters:
int |
$itemId: |
|
int |
$derivativeType: |
|
API Tags:
Remove all derivative preferences for a given item
Parameters:
API Tags:
GalleryStatus removeEntityPermission(
int
$itemId, int
$entityId, string
$permission, [boolean
$applyToChildren = false]
)
|
|
Remove the given itemid, entityid, permission mapping
Parameters:
int |
$itemId: |
the id of the GalleryItem |
int |
$entityId: |
the id of the GalleryEntity |
string |
$permission: |
the permission id |
boolean |
$applyToChildren: |
(optional) whether or not this call applies to child items |
API Tags:
GalleryStatus removeGroupPermission(
int
$itemId, int
$groupId, string
$permission, [boolean
$applyToChildren = false]
)
|
|
Remove the given itemid, groupid, permission mapping
Parameters:
int |
$itemId: |
the id of the GalleryItem |
int |
$groupId: |
the id of the GalleryGroup |
string |
$permission: |
the permission id |
boolean |
$applyToChildren: |
(optional) whether or not this call applies to child items |
API Tags:
Remove the attributes for the given item
Parameters:
API Tags:
Remove all permissions for the given itemid
Parameters:
API Tags:
Remove entries from a map
Parameters:
string |
$mapName: |
the map we're working on |
array |
$data: |
an associative array of data about the entries to match |
API Tags:
Remove specified mime data from the list.
examples: array('mimeType' => 'test/image') or array('extension' => array('img', 'im2'))
Parameters:
array |
$mimeMatch: |
(keys/values to delete) |
API Tags:
Remove onLoadHandlers from all entities
Parameters:
array |
$handlerIds: |
of factory impl ids |
API Tags:
GalleryStatus removePlugin(
string
$pluginType, string
$pluginId
)
|
|
Remove the given plugin from the map
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
API Tags:
GalleryStatus removePluginParameter(
string
$pluginType, string
$pluginId, string
$parameterName, [int
$itemId = 0]
)
|
|
Remove a parameter for this plugin
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
string |
$parameterName: |
|
int |
$itemId: |
the id of item (or null for a global setting) |
API Tags:
GalleryStatus removePluginParameterByValue(
string
$pluginType, string
$pluginId, string
$parameterName, mixed
$parameterValue
)
|
|
Remove all plugin entries for a given parameter and value pair
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
string |
$parameterName: |
|
mixed |
$parameterValue: |
the value to be matched |
API Tags:
Remove all plugin parameters for a given item id
Parameters:
int |
$itemId: |
the id of the GalleryItem |
API Tags:
GalleryStatus removeTranslationsForPlugin(
string
$pluginType, string
$pluginId
)
|
|
Remove the translations for a given plugin from our locale hierarchy.
Parameters:
string |
$pluginType: |
'module' or 'theme' |
string |
$pluginId: |
the id of the plugin |
API Tags:
Remove the user from all groups
Parameters:
API Tags:
Remove the specified user to the specified group.
Parameters:
int |
$userId: |
|
int |
$groupId: |
|
API Tags:
GalleryStatus removeUserPermission(
int
$itemId, int
$userId, string
$permission, [boolean
$applyToChildren = false]
)
|
|
Remove the given itemid, userid, permission mapping
Parameters:
int |
$itemId: |
the id of the GalleryItem |
int |
$userId: |
the id of the GalleryUser |
string |
$permission: |
the permission id |
boolean |
$applyToChildren: |
(optional) whether or not this call applies to child items |
API Tags:
array($responseStatus, requestWebPage(
string
$url, [string
$requestMethod = 'GET'], [array
$requestHeaders = array()], [string
$requestBody = '']
)
|
|
Make an HTTP request to a remote URL and return the HTTP response status, headers and body.
Parameters:
string |
$url: |
|
string |
$requestMethod: |
(optional) the HTTP request method, defaults to 'GET' |
array |
$requestHeaders: |
(optional) extra headers to pass to the server |
string |
$requestBody: |
(optional) the request body to pass to the server |
API Tags:
void requireOnce(
string
$file, [boolean
$skipBaseDirectoryDetection = false]
)
|
|
Require a file, but only once. All specified paths must be relative to the gallery2 directory. Think of it as a virtual PHP include_path.
Surprisingly, tracking what's been already loaded in a static variable is actually 10x+ faster than just calling require_once directly, even when using this extra API method to wrap it.
Parameters:
string |
$file: |
|
boolean |
$skipBaseDirectoryDetection: |
deprecated |
GalleryStatus sendTemplatedEmail(
string
$file, array
$data, string
$from, string
$to, string
$subject, [string
$headers = '']
)
|
|
Send an email using a smarty template for the message body
Parameters:
string |
$file: |
template file |
array |
$data: |
data to pass to smarty template |
string |
$from: |
from address (null allowed) |
string |
$to: |
to address(es) (comma separated) |
string |
$subject: |
email subject |
string |
$headers: |
(optional) additional headers (\r\n separated) |
API Tags:
GalleryStatus setItemOrderWeight(
int
$itemId, int
$orderWeight
)
|
|
Set the order weight for an item id
Parameters:
int |
$itemId: |
|
int |
$orderWeight: |
the new order weight |
API Tags:
Update the view count for this item id
Parameters:
int |
$itemId: |
|
int |
$count: |
the new count |
API Tags:
Allows the application to programmatically set Gallery into or out of maintenance mode.
Parameters:
mixed |
$mode: |
This can either be a boolean flag or a string representing the url of the custom maintenance mode page. |
API Tags:
GalleryStatus setParentSequence(
int
$itemId, array
$parentSequence
)
|
|
Set the parent id sequence for an item id
Parameters:
int |
$itemId: |
|
array |
$parentSequence: |
the parent sequence (ids) |
API Tags:
GalleryStatus setPluginParameter(
string
$pluginType, string
$pluginId, string
$parameterName, string
$parameterValue, [string
$itemId = 0]
)
|
|
Set a plugin parameter
Parameters:
string |
$pluginType: |
|
string |
$pluginId: |
|
string |
$parameterName: |
|
string |
$parameterValue: |
|
string |
$itemId: |
(optional) |
API Tags:
GalleryStatus setThumbnailFromItem(
int
$itemId, int
$fromItemId
)
|
|
Set the thumbnail for an album from an item, according to the thumbnail preferences for the album.
Parameters:
int |
$itemId: |
the album id |
int |
$fromItemId: |
the item id |
API Tags:
Return: | a status code boolean true if successful |
boolean shouldDoCompileCheck(
)
|
|
Check whether modification checks should be done to see if the compiled templates are still up to date. The result is cached in memory.
API Tags:
Return: | false if the compiled templates should be used without any checking |
GalleryStatus studyPermissions(
array
$itemIds, [int
$userId = null], [boolean
$sessionPermissions = true]
)
|
|
Study the permissions for all items (for the given user).
Caches the results in memory for the duration of the HTTP request handling such that subsequent permission checks go to memory rather than to the DB.
Parameters:
array |
$itemIds: |
GalleryItem ids |
int |
$userId: |
an optional user id (default is current user) |
boolean |
$sessionPermissions: |
(optional) false to ignore session based permissions |
API Tags:
Return: | a status code |
Deprecated: | Use fetchPermissionsForItems instead. |
GalleryStatus unregisterFactoryImplementation(
string
$classType, string
$implId
)
|
|
Unregister a factory implementation by id
Parameters:
string |
$classType: |
a class type (eg. 'GalleryToolkit') |
string |
$implId: |
an implementation id (eg. 'NetPBM') |
API Tags:
GalleryStatus unregisterFactoryImplementationsByModuleId(
string
$moduleId
)
|
|
Unregister all factory implementations for a module
Parameters:
string |
$moduleId: |
an id (eg. 'netpbm') |
API Tags:
Unregister all permission associated with a given module.
Parameters:
API Tags:
Unregister a toolkit's operations and properties. If we have any remaining that are no longer implemented by any toolkit then remove them from the system also.
Parameters:
API Tags:
GalleryStatus unregisterToolkitOperation(
string
$toolkitId, string
$operationName, [array
$mimeTypes = array()]
)
|
|
Unregister an operation that a toolkit is able to perform on certain mime types
Parameters:
string |
$toolkitId: |
the id of the toolkit |
string |
$operationName: |
the id of the operation |
array |
$mimeTypes: |
the applicable mime types to remove; empty for all mime types |
API Tags:
Unregister all operations and properties for toolkits implemented by the given module.
Parameters:
API Tags:
GalleryStatus updateFactoryDefinitionHints(
string
$classType,
$implId, mixed
$hints
)
|
|
Return the Hints for the specified class type and implId.
Parameters:
string |
$classType: |
Class type of the factory |
mixed |
$hints: |
array of hints to try (in order) or single string hint (eg. 'image/jpeg') |
|
$implId: |
|
GalleryStatus updateMapEntry(
string
$mapName, array
$match, array
$change, [boolean
$useNonTransactionalConnection = false]
)
|
|
Update entries in a map
Parameters:
string |
$mapName: |
the map we're working on |
array |
$match: |
the entries to match |
array |
$change: |
the values to change |
boolean |
$useNonTransactionalConnection: |
(optional) set to true if we should use a new non transactional database connection for this operation. Default is false. |
API Tags:
Set modification timestamp for the given entity id to the current time.
Parameters:
API Tags:
GalleryStatus updateParentSequence(
array
$oldParentSequence, array
$newParentSequence
)
|
|
Update all items containing the source parent sequence to the new parent sequence
Parameters:
array |
$oldParentSequence: |
|
array |
$newParentSequence: |
the parent sequence (ids) |
API Tags:
string utf8Strcut(
string
$string, int
$start, int
$length
)
|
|
mb_strcut for UTF-8, with PHP fallback. Truncates incomplete HTML entity at end of result.
Parameters:
string |
$string: |
the input string containing raw UTF-8 |
int |
$start: |
the byte-offset of the start position |
int |
$length: |
the length in bytes (not in characters), not optional |
API Tags:
Return: | a multibyte safe substring of input value |
string utf8Substring(
string
$string, int
$start, int
$length
)
|
|
mb_substr for UTF-8, with PHP fallback. Truncates incomplete HTML entity at end of result.
Parameters:
string |
$string: |
the input string containing raw UTF-8 |
int |
$start: |
the start position |
int |
$length: |
the length of the substring, not optional |
API Tags:
Return: | a multibyte safe substring of input value |
|
|