Provider
in package
Table of Contents
Properties
- $configs : array<string|int, mixed>
- $download_endpoint : string
- $id : int
- $lang : array<string|int, mixed>
- $name : string
- $temp_dir_path : string
- $warning : string
Methods
- 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
- checkDependencies() : array<string|int, mixed>
- Allow each provider to register its own dependency checks.
- findById() : ProviderResult
- Find Image Bank record by ID.
- 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
- 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
- registerConfigurationNeeds() : void
- Register configuration options required by the Provider in the GLOBAL scope
- search() : ProviderSearchResults
- Search providers' database based on specified keywords
- getCache() : bool|string
- Get Cache from the providers' temporary directory
- runSearch() : ProviderSearchResults
- Search providers' database based on specified keywords
- 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
Methods
allowViewPage()
Determine if the Provider should show the view page when clicking on the search result preview image
public
allowViewPage() : bool
Return values
boolbuildConfigPageDefinition()
Add configuration needs to the image_banks' setup page
public
abstract buildConfigPageDefinition(array<string|int, mixed> $page_def) : array<string|int, mixed>
Parameters
- $page_def : array<string|int, mixed>
-
Setup page definitions config_functions.php
Return values
array<string|int, mixed>checkDependencies()
Allow each provider to register its own dependency checks.
public
abstract checkDependencies() : array<string|int, mixed>
Note: Image Banks implements the extra_warn_checks hook which will use these errors to notify sysadmins.
Return values
array<string|int, mixed> —List of failed (system) dependencies.
findById()
Find Image Bank record by ID.
public
findById(int|string $id) : ProviderResult
Parameters
- $id : int|string
-
Record ID
Return values
ProviderResultgetAllowedDownloadEndpoint()
public
final getAllowedDownloadEndpoint() : mixed
getDownloadFileInfo()
Get file information for download or when creating a new resource based on a Providers' source file.
public
abstract getDownloadFileInfo(string $file) : SplFileInfo
Parameters
- $file : string
-
The source file URL
Return values
SplFileInfogetId()
public
getId() : mixed
getImageMetadata()
Retrieve image metadata from Image Bank Provider.
public
getImageMetadata(int|string $id) : array<string, string>
Parameters
- $id : int|string
-
Record ID
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|string $id) : array<string, string>
Parameters
- $id : int|string
-
Record ID
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|string $id) : array<string|int, mixed>
Parameters
- $id : int|string
-
Record ID
Return values
array<string|int, mixed>getSortOptions()
Get the Providers' sort options which should be displayed on the search page
public
getSortOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getTempDirPath()
Get Image Bank providers' temporary directory path
public
final getTempDirPath() : string
Return values
stringregisterConfigurationNeeds()
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
search()
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
ProviderSearchResultsgetCache()
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
runSearch()
Search providers' database based on specified keywords
protected
abstract 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
Return values
ProviderSearchResultssetCache()
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