Properties

$meta_key

$meta_key : string

Database meta key name.

Type

string

$options

$options : array

Current settings.

Type

array

$defaults

$defaults : array

List of default values for settings.

Type

array

Methods

get_defaults()

get_defaults(string  $key = null) : mixed

Gets a default setting value.

Parameters

string $key

Returns

mixed

get_meta_key()

get_meta_key() : string

Gets the name of the meta key in which options are stored.

Returns

string

activate()

activate(boolean  $network_wide) : void

Saves default plugin options to the database when the plugin is activated by a user without overwriting existing values.

Parameters

boolean $network_wide

deactivate()

deactivate() : void

Turns Buoy functionality off for this site.

deleteOldAlerts()

deleteOldAlerts(string  $threshold) : void

Deletes alerts older than a certain threshold.

Also deletes their child posts (media attachments) if that option is enabled.

Parameters

string $threshold

A strtotime()-compatible string indicating some time in the past.

register()

register() : void

Registers WordPress hooks.

updatedSettings()

updatedSettings(array  $old_value,   $value) : void

Updates WordPress settings based on changed plugin settings.

Parameters

array $old_value
$value

get_instance()

get_instance() : \WP_Buoy_Settings

Gets the instance of this object.

Returns

\WP_Buoy_Settings

get()

get(string  $key, mixed  $default = null) : mixed

Gets an option.

Parameters

string $key
mixed $default

Returns

mixed

set()

set(  $key,   $value) : \WP_Buoy_Settings

Sets an option name and value pair.

Parameters

$key
$value

Returns

\WP_Buoy_Settings

has()

has(string  $key) : boolean

Checks whether or not an option is set.

Parameters

string $key

Returns

boolean

save()

save() : \WP_Buoy_Settings

Saves current options to the database.

Returns

\WP_Buoy_Settings

delete()

delete(  $key) : \WP_Buoy_Settings

Deletes an option.

Parameters

$key

Returns

\WP_Buoy_Settings

registerSettings()

registerSettings() : void

Registers the plugin setting with WordPress. All the plugin's options are stored in a serialized array. This means there is only one record in the WordPress options table in the database to record all the plugin's settings.

configureCron()

configureCron() : void

Writes or removes the plugin's cron jobs in the OS-level cron.

validateSettings()

validateSettings(array  $input) : array

WordPress validation callback for the Settings API hook.

Parameters

array $input

Returns

array

registerAdminMenu()

registerAdminMenu() : void

Adds items to the Dashboard Admin menu.

reorderSubmenu()

reorderSubmenu(array  $menu_order) : array

Ensure "Safety information" is last in "My Teams" submenu list.

Parameters

array $menu_order

The top-level admin menu order. Returned unchanged.

Returns

array

renderOptionsPage()

renderOptionsPage() : void

Displays the admin options page.

renderSafetyInfoPage()

renderSafetyInfoPage() : void

Displays the "Safety Info" page.

__construct()

__construct() : \WP_Buoy_Settings

Constructor.

Returns

\WP_Buoy_Settings

get_options()

get_options() : mixed

Gets the plugin options from the WordPress database.

Returns

mixed

activateSite()

activateSite() : void

Sets up Buoy settings for a site.

get_alert_ttl_string()

get_alert_ttl_string(integer  $num, integer  $multiplier, boolean  $past = true) : string

Gets an alert time-to-live string.

This is used to create a strtotime()-compatible string from the plugin's settings.

Parameters

integer $num
integer $multiplier
boolean $past

Returns

string

time_multiplier_to_unit()

time_multiplier_to_unit(integer  $num) : string

Converts a number of seconds to that value's English time unit.

Parameters

integer $num

Returns

string

updateSchedules()

updateSchedules(string  $old_str, string  $new_str) : void

Resets WP-Cron scheduled tasks.

Parameters

string $old_str
string $new_str