PHP Class BP_Reply_By_Email_Admin, bp-reply-by-email

Show file Open project: r-a-y/bp-reply-by-email

Protected Properties

Property Type Description
$name string Internal name.
$settings array Settings from database.

Public Methods

Method Description
__construct ( ) Constructor.
add_plugin_action_links ( array $links, string $file ) Add extra links for RBE on the WP Admin plugins page
admin_init ( ) Setup our items when a user is in the WP backend.
footer ( ) JS hooked to footer of our settings page
get_plugin_basename ( ) : string Gets RBE's plugin basename.
head ( ) Inline CSS hooked to head of our settings page
load ( ) Output the admin page.
setup_admin ( ) Setup our admin settings page and hooks
validate ( array $input ) : array Validate and sanitize our options before saving to the DB.

Protected Methods

Method Description
display_errors ( ) Alternative approach to WP Settings API's add_settings_error().
field ( string $name, boolean $id = false, boolean $echo = true ) : mixed Returns or outputs a field name / ID in the admin area.
get_inbound_providers ( ) : array Get an array of available inbound providers.
get_option ( string $name, boolean $echo = true ) : mixed Returns or outputs an admin setting in the admin area.
github_updater ( ) Checks a JSON file to see if our Github repo should be updated.
render_field ( array $args = '' ) Renders the output of a form field in the admin area.
schedule ( ) Outputs next scheduled run of the (pseudo) cron.
webhost_warnings ( ) Adds webhost warnings to the admin page.

Method Details

__construct() public method

Constructor.
public __construct ( )

admin_init() public method

Setup our items when a user is in the WP backend.
public admin_init ( )

display_errors() protected method

Show any messages/errors saved to a setting during validation in {@link BP_Reply_By_Email::validate()}. Used as a template tag. Uses a ['messages'] array inside $this->settings. Format should be ['messages'][{$id}_error], $id is the setting id. Lightly modified from Jeremy Clark's observations - {@link http://old.nabble.com/Re%3A-Settings-API%3A-Showing-errors-if-validation-fails-p26834868.html}
protected display_errors ( )

field() protected method

Returns or outputs a field name / ID in the admin area.
protected field ( string $name, boolean $id = false, boolean $echo = true ) : mixed
$name string Input name for the field.
$id boolean Are we outputting the field's ID? If so, output unique ID.
$echo boolean Are we echoing or returning?
return mixed Either echo or returns a string

get_inbound_providers() protected method

Get an array of available inbound providers.
Since: 1.0-RC3
protected get_inbound_providers ( ) : array
return array Key/value pairs (provider internal name => provider display name)

get_option() protected method

Uses settings declared in $this->settings.
protected get_option ( string $name, boolean $echo = true ) : mixed
$name string Name of the setting.
$echo boolean Are we echoing or returning?
return mixed Either echo or returns a string

get_plugin_basename() public method

The reason for this extra method is because we're using {@link plugin_basename()} from a subdirectory. So we need to remove everything but the first directory.
Since: 1.0-RC2
public get_plugin_basename ( ) : string
return string

github_updater() protected method

Uses the Plugin Update Checker library by Janis Elsts. Licensed under the GPL. Slightly modified by me for better Github support.
protected github_updater ( )

head() public method

Inline CSS hooked to head of our settings page
public head ( )

load() public method

Output the admin page.
public load ( )

render_field() protected method

I like this better than {@link add_settings_field()} so sue me! Uses {@link BP_Reply_By_Email_Admin::field()} and {@link BP_Reply_By_Email_Admin::get_option()}.
protected render_field ( array $args = '' )
$args array Arguments for the field

schedule() protected method

Outputs next scheduled run of the (pseudo) cron.
protected schedule ( )

setup_admin() public method

Setup our admin settings page and hooks
public setup_admin ( )

validate() public method

Callback from {@link register_setting()}.
public validate ( array $input ) : array
$input array The submitted values from the form
return array $output The validated values to be inserted into the DB

webhost_warnings() protected method

If certain conditions for the webhost are not met, these warnings will be displayed on the admin page.
protected webhost_warnings ( )

Property Details

$name protected property

Internal name.
protected string $name
return string

$settings protected property

Settings from database.
protected array $settings
return array