ResourceSpace
extends Provider
in package
implements
MultipleInstanceProviderInterface
Table of Contents
Interfaces
Properties
- $configs : array<string|int, mixed>
- $download_endpoint : string
- $id : int
- $lang : array<string|int, mixed>
- $name : string
- $temp_dir_path : string
- $warning : string
- $instances : array<int, ResourceSpaceProviderInstance>
- Only valid instances
- $selected_instance_id : int
Methods
- __construct() : mixed
- allowViewPage() : bool
- Determine if the Provider should show the view page when clicking on the search result preview image
- buildConfigPageDefinition() : array<string|int, mixed>
- Add configuration needs to the image_banks' setup page
- callApi() : array<string|int, mixed>|int|string
- Helper method to use ResourceSpace API
- checkDependencies() : array<string|int, mixed>
- Allow each provider to register its own dependency checks.
- findById() : ProviderResult
- Find Image Bank record by ID.
- getAllInstances() : array<string|int, ProviderInstanceInterface>
- getAllowedDownloadEndpoint() : mixed
- getDownloadFileInfo() : SplFileInfo
- Get file information for download or when creating a new resource based on a Providers' source file.
- getId() : mixed
- getImageMetadata() : array<string, string>
- Retrieve image metadata from Image Bank Provider.
- getImageNonMetadataProperties() : array<string, string>
- Retrieve non-metadata properties from Image Bank Provider for image ID.
- getName() : mixed
- getResourceDownloadOptionsTable() : array<string|int, mixed>
- Get table view information for rendering on the plugins' view page
- getSelectedSystemInstance() : ResourceSpaceProviderInstance
- Get a Provider instance (while working with a particular Provider)
- getSortOptions() : array<string|int, mixed>
- Get the Providers' sort options which should be displayed on the search page
- getTempDirPath() : string
- Get Image Bank providers' temporary directory path
- parseInstancesConfiguration() : array<string|int, mixed>
- registerConfigurationNeeds() : void
- Register configuration options required by the Provider in the GLOBAL scope
- runSearch() : ProviderSearchResults
- Search providers' database based on specified keywords
- search() : ProviderSearchResults
- Search providers' database based on specified keywords
- selectSystemInstance() : Provider
- Activate a selected Providers' system instance so the search performed by the Provider is ran over the correct system.
- getCache() : bool|string
- Get Cache from the providers' temporary directory
- setCache() : void
- Set cache in the providers' temporary directory
Properties
$configs
protected
array<string|int, mixed>
$configs
$download_endpoint
protected
string
$download_endpoint
$id
protected
int
$id
$lang
protected
array<string|int, mixed>
$lang
$name
protected
string
$name
$temp_dir_path
protected
string
$temp_dir_path
= ""
$warning
protected
string
$warning
$instances
Only valid instances
private
array<int, ResourceSpaceProviderInstance>
$instances
= []
$selected_instance_id
private
int
$selected_instance_id
Methods
__construct()
public
__construct(array<string|int, mixed> $lang, string $temp_dir_path) : mixed
Parameters
- $lang : array<string|int, mixed>
- $temp_dir_path : string
allowViewPage()
Determine if the Provider should show the view page when clicking on the search result preview image
public
allowViewPage() : bool
Tags
Return values
boolbuildConfigPageDefinition()
Add configuration needs to the image_banks' setup page
public
buildConfigPageDefinition(array<string|int, mixed> $page_def) : array<string|int, mixed>
Parameters
- $page_def : array<string|int, mixed>
-
Setup page definitions config_functions.php
Tags
Return values
array<string|int, mixed>callApi()
Helper method to use ResourceSpace API
public
callApi(string $function, array<string|int, mixed> $data) : array<string|int, mixed>|int|string
Parameters
- $function : string
-
API binding function name
- $data : array<string|int, mixed>
-
Request payload
Return values
array<string|int, mixed>|int|string —JSON decoded data, as received from the API binding
checkDependencies()
Allow each provider to register its own dependency checks.
public
checkDependencies() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —List of failed (system) dependencies.
findById()
Find Image Bank record by ID.
public
findById(int $id) : ProviderResult
Parameters
- $id : int
-
Resource ref
Tags
Return values
ProviderResultgetAllInstances()
public
getAllInstances() : array<string|int, ProviderInstanceInterface>
Tags
Return values
array<string|int, ProviderInstanceInterface>getAllowedDownloadEndpoint()
public
final getAllowedDownloadEndpoint() : mixed
getDownloadFileInfo()
Get file information for download or when creating a new resource based on a Providers' source file.
public
getDownloadFileInfo(string $file) : SplFileInfo
Parameters
- $file : string
-
The source file URL
Tags
Return values
SplFileInfogetId()
public
getId() : mixed
getImageMetadata()
Retrieve image metadata from Image Bank Provider.
public
getImageMetadata(int $id) : array<string, string>
Parameters
- $id : int
-
Resource ref
Tags
Return values
array<string, string> —The returned key must be the user friendly name (label), the value is just that.
getImageNonMetadataProperties()
Retrieve non-metadata properties from Image Bank Provider for image ID.
public
getImageNonMetadataProperties(int $id) : array<string, string>
Parameters
- $id : int
-
Resource ref
Tags
Return values
array<string, string> —The returned key must be the user friendly name (label), the value is just that.
getName()
public
final getName() : mixed
getResourceDownloadOptionsTable()
Get table view information for rendering on the plugins' view page
public
getResourceDownloadOptionsTable(int $id) : array<string|int, mixed>
Parameters
- $id : int
-
Resource ref
Tags
Return values
array<string|int, mixed>getSelectedSystemInstance()
Get a Provider instance (while working with a particular Provider)
public
getSelectedSystemInstance() : ResourceSpaceProviderInstance
Tags
Return values
ResourceSpaceProviderInstancegetSortOptions()
Get the Providers' sort options which should be displayed on the search page
public
getSortOptions() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getTempDirPath()
Get Image Bank providers' temporary directory path
public
final getTempDirPath() : string
Return values
stringparseInstancesConfiguration()
public
parseInstancesConfiguration() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>registerConfigurationNeeds()
Register configuration options required by the Provider in the GLOBAL scope
public
final registerConfigurationNeeds(array<string|int, mixed> $globals) : void
Parameters
- $globals : array<string|int, mixed>
-
The globals variable - $GLOBALS
runSearch()
Search providers' database based on specified keywords
public
runSearch(string $keywords[, int $per_page = 24 ][, int $page = 1 ][, array<string|int, mixed> $ctx = [] ]) : ProviderSearchResults
Parameters
- $keywords : string
-
Search keyword(s)
- $per_page : int = 24
-
Number of results per page
- $page : int = 1
-
Select the page number
- $ctx : array<string|int, mixed> = []
-
Any other search related contextual information specific provider instances might need
Tags
Return values
ProviderSearchResultssearch()
Search providers' database based on specified keywords
public
final search(string $keywords[, int $per_page = 24 ][, int $page = 1 ][, array<string|int, mixed> $ctx = [] ]) : ProviderSearchResults
Parameters
- $keywords : string
-
Search keyword(s)
- $per_page : int = 24
-
Number of results per page
- $page : int = 1
-
Select the page number
- $ctx : array<string|int, mixed> = []
-
Any other search related contextual information specific provider instances might need
Return values
ProviderSearchResultsselectSystemInstance()
Activate a selected Providers' system instance so the search performed by the Provider is ran over the correct system.
public
selectSystemInstance(int $id) : Provider
Parameters
- $id : int
-
Instance ID
Tags
Return values
ProvidergetCache()
Get Cache from the providers' temporary directory
protected
final getCache(string $id, int $ttl) : bool|string
Parameters
- $id : string
-
The cache ID. This is also the filename when saved on disk
- $ttl : int
-
The time to live (in hours) of the cache value. This is measured based on the last modified timestamp of the cache file
Return values
bool|string —Returns FALSE if no cache found or the content of the file
setCache()
Set cache in the providers' temporary directory
protected
final setCache(string $id, mixed $value) : void
Parameters
- $id : string
-
The cache ID
- $value : mixed
-
The value to store in the file