Plugin API

What we need for Campsite 2.3.1 to interface with phorums & polls:

Display Plugin Points

  • user modify rights
  • section add
  • section modify
  • article add
  • article edit
  • menu display

Event Plugin Points

  • on_login
  • on_logout
  • on_user_add
  • on_user_delete
  • on_user_modify
  • on_section_add
  • on_section_delete
  • on_section_modify
  • on_article_add
  • on_article_delete
  • on_article_modify

Display API

If we choose to implement a display API, we would need the plugins to be able to create the following components:

  • Prompt
  • checkbox
  • select

Requirements

  • Ability to upload module as one .zip file.
  • Ability to turn modules on and off

Implementation Methods

A good technique to use when trying to develop a solution to something is to simply list all possible solutions you can think of:

  1. Sebastian plugins. This is solution that was implemented for the phorum/poll plugins. Add a single "plugin point" function to all the scripts where you need it. The corresponding plugin files are mapped into a mirror image of the directory structure of the main application. For example, a plugin for the users screens would be mapped to a "users" subdirectory inside the plugin folder. The "plugin point" function figures out which script has been called, and loads the equivalent file in its mirror image.
    1. Con #1: Imposes a directory structure & file name structure for the plugins (they must match the existing campsite directories & files), and we want to change these file name and directories in the near future.
    2. Con #2: The plugin rely on global variables to get their "parameters".
  2. Phorum modules. There is a set of callback functions that are defined. The module provides a file that explains which callbacks it uses. The callback functions call the module functions when the events occur.
  3. Global "Event Broker". A singleton class, to which objects call at well-defined points. For example, the Article class might call the Event Broker when an article is modified. The Event Broker makes the callback to the listener when the event occurs. The broker can call every module on every event, or modules could register which events they want to listen to.