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 out | |
|