Cp_Plgn_Drctry_Cp_Plugins_Dir Uses Cp_Plgn_Drctry_Fx

The class to gather and list all Plugins from all apis.

Description

Lists all plugins in a grid Provides a Search form Provides "More info" data for each plugin Provides Pagination trhough the list of plugins

Tags
author

Beda Schmid beda@tukutoi.com

Table of Contents

$plugin_fx  : object
The Instance of the Plugin Functionality.
$plugin_name  : string
The ID of this plugin.
$plugin_prefix  : string
The unique prefix of this plugin.
$version  : string
The version of this plugin.
__construct()  : mixed
Initialize the class and set its properties.
list_plugins()  : mixed
List all plugins in a paginated, searchable grid.
encode_to_json()  : mixed
Encode data to JSON or return empty string.
get_content_between()  : string
Get string value between delimiters.
get_file_contents()  : mixed
CP Way of getting File Contents.
get_plugins()  : array<string|int, mixed>
Merge all Plugins from all APIs.
get_posted_data()  : mixed
Validates any POSTed nonce by key and nonce.
get_remote_decoded_body()  : mixed
Get Remote body json decoded.
get_remote_header()  : mixed
Get Remote header.
get_remote_raw_body()  : mixed
Get Remote body json decoded.
list_pagination()  : mixed
Create a paginated list out of an array of items
maybe_populate_cache()  : mixed
Maybe populate cache file.
maybe_send_json_failure()  : mixed
Validates any POSTed nonce by key and nonce.
more_info()  : string
Returns the more info content.
put_file_contents()  : mixed
CP Way of putting File Contentes.
search_form()  : mixed
Create a safe HTML search form input
search_plugins()  : array<string|int, mixed>
Search through the cached plugins.
validate_get_nonce()  : mixed
Validates any GET nonce by key and nonce.
validate_post_nonce()  : mixed
Validates any POSTed nonce by key and nonce.
vetted_orgs()  : array<string|int, mixed>
Get a list of vetted orgs

Properties

$plugin_fx

The Instance of the Plugin Functionality.

private object $plugin_fx
Description

The instance of the Cp_Plgn_Drctry_Plugin_Fx() Class handling plugins.

Tags
since
1.3.0
access

private

$plugin_prefix

The unique prefix of this plugin.

private string $plugin_prefix
Description

The string used to uniquely prefix technical functions of this plugin.

Tags
since
1.0.0
access

private

Methods

__construct()

Initialize the class and set its properties.

public __construct(string $plugin_name, string $plugin_prefix, string $version) : mixed
Parameters
$plugin_name
(string) The name of this plugin.
$plugin_prefix
(string) The unique prefix of this plugin.
$version
(string) The version of this plugin.
Tags
since
1.0.0
Return
(mixed)

encode_to_json()

Encode data to JSON or return empty string.

private encode_to_json(mixed $data) : mixed
Parameters
$data
(mixed) The Data to encode.
Return
(mixed)

get_content_between()

Get string value between delimiters.

private get_content_between(string $str, string $start_delimiter, string $end_delimiter) : string
Parameters
$str
(string) The string to scan.
$start_delimiter
(string) The start delimiter to look for.
$end_delimiter
(string) The end delimiter to look for.
Return
(string) The string between.

get_file_contents()

CP Way of getting File Contents.

private get_file_contents(string $file) : mixed
Parameters
$file
(string) The file path to get contents from.
Return
(mixed)

get_plugins()

Merge all Plugins from all APIs.

private get_plugins() : array<string|int, mixed>
Return
(array<string|int, mixed>) The array of all plugins objects.

get_posted_data()

Validates any POSTed nonce by key and nonce.

private get_posted_data(string $key, string $sanitization) : mixed
Parameters
$key
(string) The POST key where nonce is passed.
$sanitization
(string) The Sanitization function to use.
Return
(mixed)

get_remote_decoded_body()

Get Remote body json decoded.

private get_remote_decoded_body(string $url[, array<string|int, mixed> $header = array() ]) : mixed
Parameters
$url
(string) Remote URL.
$header
(array<string|int, mixed>) Array of headers to send to remote. Empty by default. Defaults to: array()
Return
(mixed)

get_remote_header()

Get Remote header.

private get_remote_header(string $url[, array<string|int, mixed> $header = array() ], string $return) : mixed
Parameters
$url
(string) Remote URL.
$header
(array<string|int, mixed>) Array of headers to send to remote. Empty by default. Defaults to: array()
$return
(string) The header to return.
Return
(mixed)

get_remote_raw_body()

Get Remote body json decoded.

private get_remote_raw_body(string $url[, array<string|int, mixed> $header = array() ]) : mixed
Parameters
$url
(string) Remote URL.
$header
(array<string|int, mixed>) Array of headers to send to remote. Empty by default. Defaults to: array()
Return
(mixed)

list_pagination()

Create a paginated list out of an array of items

private list_pagination(array<string|int, mixed> $data, string $return) : mixed
Parameters
$data
(array<string|int, mixed>) The data to paginate.
$return
(string) What part of the pagination assets to return.
Return
(mixed)

maybe_populate_cache()

Maybe populate cache file.

private maybe_populate_cache(string $file) : mixed
Parameters
$file
(string) The Cache file path.
Return
(mixed)

maybe_send_json_failure()

Validates any POSTed nonce by key and nonce.

private maybe_send_json_failure(string $key[, string $message = 'Something went wrong' ]) : mixed
Parameters
$key
(string) The POST key where nonce is passed.
$message
(string) The message to return on failure. Defaults to: 'Something went wrong'
Return
(mixed)

more_info()

Returns the more info content.

private more_info(object $plugin) : string
Parameters
$plugin
(object) The Current Plugin Object.
Return
(string) $html The HTML to produce the more info content.

put_file_contents()

CP Way of putting File Contentes.

private put_file_contents(mixed $contents, string $file) : mixed
Parameters
$contents
(mixed) The content to put.
$file
(string) The file path to get contents from.
Return
(mixed)

search_plugins()

Search through the cached plugins.

private search_plugins(array<string|int, mixed> $plugins) : array<string|int, mixed>
Parameters
$plugins
(array<string|int, mixed>) The Array of Plugin objects.
Return
(array<string|int, mixed>) $plugins The Found Plugins (or nothing, if nothing found).

validate_get_nonce()

Validates any GET nonce by key and nonce.

private validate_get_nonce(string $key, string $nonce) : mixed
Parameters
$key
(string) The GET key where nonce is passed.
$nonce
(string) The Nonce to validate (name).
Return
(mixed)

validate_post_nonce()

Validates any POSTed nonce by key and nonce.

private validate_post_nonce(string $key, string $nonce[, string $message = 'Invalid or missing Nonce!' ]) : mixed
Parameters
$key
(string) The POST key where nonce is passed.
$nonce
(string) The Nonce to validate (name).
$message
(string) The message to return on failure. Defaults to: 'Invalid or missing Nonce!'
Return
(mixed)

vetted_orgs()

Get a list of vetted orgs

private vetted_orgs() : array<string|int, mixed>
Return
(array<string|int, mixed>) $_orgs An array of vetted orgs.

Search results