ExternalModules
class ExternalModules (View source)
Class ExternalModules
Properties
| int | $no_page | ||
| int | $per_page | ||
| int | $categorie | ||
| string | $search | ||
| string | $file_source_url | ||
| string | $cache_file | ||
| string | $url | // the url of this page |
|
| string | $shop_url | ||
| string | $lang | ||
| bool | $debug_api | ||
| string | $dolistore_api_url | ||
| string | $dolistore_api_key | ||
| int | $dolistoreApiStatus | ||
| string | $dolistoreApiError | ||
| int | $githubFileStatus | ||
| string | $githubFileError | ||
| string | $error | ||
| int | $numberOfProviders | ||
| array<int, mixed>|null | $products | ||
| int | $numberTotalOfProducts | ||
| int | $numberTotalOfPages | ||
| int | $numberOfProducts |
Methods
Constructor
loadRemoteSources
Test if we can access to remote Dolistore market place.
Fetch modules from a cache YAML file
Generate HTML for categories and their children.
Generate HTML for products.
Sort an array by a key
version compare
get previous link
get next link
get previous url
get next url
Generate pagination for navigating through pages of products.
Check the status code of the request
Get YAML file from remote source and put it into the cache file
Read a YAML string and convert it to an array
Adapter data fetched from github remote source to the expected format
Apply filters to the data
Check if an Dolistore API is up
Retrieve the status icon
Details
__construct(bool $debug = false)
Constructor
void
loadRemoteSources(bool $debug = false)
loadRemoteSources
array{status_code: int, response: null|string|array<string, mixed>}
callApi(string $resource, array<string, mixed>|false $options = false)
Test if we can access to remote Dolistore market place.
list<array<string, array<string, string|null>|string|null>>
fetchModulesFromFile(array<string, mixed> $options = array())
Fetch modules from a cache YAML file
string
getCategories(int $active = 0)
Generate HTML for categories and their children.
string|null
getProducts(array<string, mixed> $options)
Generate HTML for products.
Closure
buildSorter(string $key)
Sort an array by a key
int
versionCompare(string $v1, string $v2)
version compare
string
get_previous_link(string $text = '<<')
get previous link
string
get_next_link(string $text = '>>')
get next link
string
get_previous_url()
get previous url
string
get_next_url()
get next url
string
getPagination()
Generate pagination for navigating through pages of products.
protected string|null
checkStatusCode(array{status_code: int, response: null|string|array{curl_error_msg: string, errors: array<array{code: int, message: string}>}} $request)
Check the status code of the request
bool|string
getRemoteYamlFile(string $file_source_url, int $cache_time)
Get YAML file from remote source and put it into the cache file
list<array<string, array<string, string|null>|string|null>>
readYaml(string $yaml)
Read a YAML string and convert it to an array
list<array<string, array<string, string|null>|string|null>>
adaptData(array<string, mixed>|list<array<string, array<string, string|null>|string|null>> $data, string $source)
Adapter data fetched from github remote source to the expected format
array{total: int, data: list<array<string, mixed>>}
applyFilters(list<array<string, mixed>> $list, array<string, mixed> $options)
Apply filters to the data
int
checkApiStatus()
Check if an Dolistore API is up
string
libStatus(mixed $status, mixed $mode = 3, string $moretext = '')
Retrieve the status icon