Cp_Plgn_Drctry_Settings Uses Cp_Plgn_Drctry_Fx

The settings for this plugin.

Description

Defines the plugin name, version and the entire options/settings page to define repositories to read.

Tags
author

Beda Schmid beda@tukutoi.com

Table of Contents

$plugin_name  : string
The ID of this plugin.
$plugin_prefix  : string
The unique prefix of this plugin.
$verified_badge  : string
The Badge for verified Repos.
$version  : string
The version of this plugin.
__construct()  : mixed
Initialize the class and set its properties.
external_org_repos_select_cb()  : mixed
External Orgs Repos Select Field callback function.
external_repos_cb()  : mixed
External Repos section callback function.
external_repos_select_cb()  : mixed
External Single Repos Select Field callback function.
external_user_repos_select_cb()  : mixed
External Users Repos Select Field callback function.
github_token_cb()  : mixed
GitHub Token section
github_token_input_cb()  : mixed
GitHub Token text field callback function.
settings_init()  : mixed
Custom Setting sections and fields.
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_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.
put_file_contents()  : mixed
CP Way of putting File Contentes.
search_form()  : mixed
Create a safe HTML search form input
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_name

The ID of this plugin.

private string $plugin_name
Description

The ID of this plugin.

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.3.0
access

private

$verified_badge

The Badge for verified Repos.

private string $verified_badge
Description

Badge used for verified Orgs from GitHub.

Tags
since
1.3.0
access

private

$version

The version of this plugin.

private string $version
Description

The current version of this plugin.

Tags
since
1.3.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.3.0
Return
(mixed)

external_org_repos_select_cb()

External Orgs Repos Select Field callback function.

public external_org_repos_select_cb(array<string|int, mixed> $args) : mixed
Parameters
$args
(array<string|int, mixed>) The array of arguments.
Return
(mixed)

external_repos_cb()

External Repos section callback function.

public external_repos_cb(array<string|int, mixed> $args) : mixed
Parameters
$args
(array<string|int, mixed>) The settings array, defining title, id, callback.
Return
(mixed)

external_repos_select_cb()

External Single Repos Select Field callback function.

public external_repos_select_cb(array<string|int, mixed> $args) : mixed
Parameters
$args
(array<string|int, mixed>) The array of arguments.
Return
(mixed)

external_user_repos_select_cb()

External Users Repos Select Field callback function.

public external_user_repos_select_cb(array<string|int, mixed> $args) : mixed
Parameters
$args
(array<string|int, mixed>) The array of arguments.
Return
(mixed)

github_token_cb()

GitHub Token section

public github_token_cb(array<string|int, mixed> $args) : mixed
Parameters
$args
(array<string|int, mixed>) The settings array, defining title, id, callback.
Return
(mixed)

github_token_input_cb()

GitHub Token text field callback function.

public github_token_input_cb(array<string|int, mixed> $args) : mixed
Parameters
$args
(array<string|int, mixed>) The array of arguments.
Return
(mixed)

settings_init()

Custom Setting sections and fields.

public settings_init() : mixed
Description

Registers a new setting:

  • cp_dir_opts_options

Adds two sections:

  • cp_dir_opts_section_external_repos

  • cp_dir_opts_section_github_token Adds four setting fields:

  • cp_dir_opts_exteranal_org_repos

  • cp_dir_opts_exteranal_user_repos

  • cp_dir_opts_exteranal_repos

  • cp_dir_opts_section_github_token

Tags
since
1.3.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_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)

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)

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