Properties

$prefix

$prefix : string

Type

string — String to prefix option names, settings, etc.

Methods

register()

register() : void

Entry point for the WordPress framework into plugin code.

This is the method called when WordPress loads the plugin file. It is responsible for "registering" the plugin's main functions with the WordPress Plugin API.

registerL10n()

registerL10n() : void

Loads localization files from plugin's languages directory.

initialize()

initialize() : void

Loads plugin componentry and calls that component's register() method. Called at the WordPress `init` hook.

activate()

activate(boolean  $network_wide) : void

Method to run when the plugin is activated by a user in the WordPress Dashboard admin screen.

Parameters

boolean $network_wide

checkPrereqs()

checkPrereqs() : void

Checks system requirements and exits if they are not met.

This first checks to ensure minimum WordPress and PHP versions have been satisfied. If not, the plugin deactivates and exits.

install_plugin_dependency()

install_plugin_dependency(string  $slug, string  $version = '') 

Automates installation of other plugins that we need.

We only use this for the WP REST API at the moment. It's the 1 and only dependency we have on other plugins. When that plugin gets added to WP Core, we can remove this code.

As a result, note that this code is SPECIFIC to the rest-api plugin. It will not work as-is for other plugins.

Parameters

string $slug
string $version

rest_api_install_failure_notice()

rest_api_install_failure_notice() 

get_minimum_wordpress_version()

get_minimum_wordpress_version() : string

Returns the "Requires at least" value from plugin's readme.txt.

Returns

string

deactivate()

deactivate() : void

Method to run when the plugin is deactivated by a user in the WordPress Dashboard admin screen.

enqueueFrontEndScripts()

enqueueFrontEndScripts() : void

Enqueues globally relevant scripts and stylesheets.

addHelpTab()

addHelpTab() : void

Attaches on-screen help tabs to the WordPress built-in help.

Loads the appropriate document from the localized help folder and inserts it as a help tab on the current screen.

addHelpSidebar()

addHelpSidebar() : void

Appends appropriate sidebar content based on current screen.

renderWebAppManifest()

renderWebAppManifest() : void

Prints the Web App manifest file.

renderWebAppHTML()

renderWebAppHTML() : void

Prints meta tag indicators for native-like functionality.

The "activate alert" screen is intended to be the web app "install" screen for Buoy. We insert special mobile browser specific tags in order to create a native-like "installer" for the user. We only want to do this on this specific screen.

registerDashboardWidget()

registerDashboardWidget() : void

Register the Dashboard widget.

renderDashboardWidget()

renderDashboardWidget() : void

Renders the Buoy Dashboard widget.

addedToTeam()

addedToTeam(integer|string  $who, \WP_Buoy_Team  $team, boolean  $notify = true) : void

Schedules a notification to be sent to the user.

Parameters

integer|string $who
\WP_Buoy_Team $team
boolean $notify

Whether or not to schedule a notification.

removedFromTeam()

removedFromTeam(integer  $user_id, \WP_Buoy_Team  $team) : void

Removes any scheduled notices to be sent to the user.

Parameters

integer $user_id
\WP_Buoy_Team $team

inviteUsers()

inviteUsers(integer  $post_id, \WP_Post  $post) 

Invites users added to a team when it is published.

Parameters

integer $post_id
\WP_Post $post

inviteNewUser()

inviteNewUser(\WP_Buoy_Team  $team, string  $email) : void

Sends an email inviting a new user to join this Buoy.

Parameters

\WP_Buoy_Team $team
string $email

publishAlert()

publishAlert(integer  $post_id, \WP_Post  $post) : void

Runs whenever an alert is published. Sends notifications to an alerter's response team informing them of the alert.

Parameters

integer $post_id
\WP_Post $post

getEmailToSmsGatewayDomain()

getEmailToSmsGatewayDomain(string  $provider) : string

Utility function to return the domain name portion of a given telco's email-to-SMS gateway address.

The returned string includes the prefixed @ sign.

Parameters

string $provider

A recognized sms_provider key.

Returns

string

debug_log()

debug_log(string  $message) : void

Prints a message to the WordPress debug log if the plugin's "detailed debugging" setting is enabled.

By default, the WordPress debug log is wp-content/debug.log relative to the WordPress installation root (ABSPATH).

Parameters

string $message

error_msg()

error_msg(string  $message) : string

Prepares an error message for logging.

Parameters

string $message

Returns

string