Skip to content

Buoy code structure

Meitar Moscovitz edited this page May 7, 2016 · 1 revision

WikiProjectsBuoyDeveloper DocumentationCode structure

The code for the Buoy plugin for WordPress follows some basic organization principles. This page provides an at-a-glance overview of these general principles. For more detailed information, consult the generated API documentation.

Classes

Each major component of Buoy is defined in its own class. Each class has its own file named with class- and the lowercased dash-separated class name.

There are at least four major components:

  • Buoy User
  • Buoy Team
  • Buoy Alert
  • Buoy Notification

Each of these inherit from a base "Buoy Plugin" (WP_Buoy_Plugin, for the WordPress plugin) class.

Class inheritance diagram for Buoy for WordPress plugin.

Methods

The methods within each class follow a general naming convention:

  • register*: these functions use the WordPress Plugin API to hook into the various parts of the underlying WordPress framework.
  • render*: these functions output HTML and are used to render various parts of the interface, and generally include a file from the plugin's pages/ subdirectory.
  • handle*: these functions respond to various wp_ajax_* or WP-API requests from a Buoy front-end client.