Copyright (C) 2005, Peter A. Geer <pageer@skepticats.com>
LnBlog homepage: http://www.skepticats.com/lnblog/
LnBlog is a free (as in speech) weblog and "miniature" content management system implemented in object-oriented PHP 4.
This document provides an overview of the design and inner workings of LnBlog. It is intended to be a guide for programmers who wish to modify LnBlog or develop plugins for it.
LnBlog uses an event-driven
plugin system. When a plugin is loaded by the plugin manager,
it is responsible for registering with the event listener.
This simply means notifying the listener of which events the plugin is
interested in and telling it which method or function to call when the
event is fired. Note that plugins are loaded using a call to
include(), so any code which is not inside a function or class definition will run when the
plugin is loaded, i.e. at the beginning of the page.
Plugins are located in a directory named "plugins" located in either
the root of the LnBlog installation or the root of a particular
weblog. If the same file name exists in both locations, the one
in the weblog root will take precedence. This is the recommended
method for disabling system-wide plugins for one particular blog.
When plugins are first loaded, both these location are scanned for
files ending in ".php" (subdirectories are ignored) and the results are
merged into a single list. This list is sorted in alphabetical
order by file name and each file is then loaded with a call to PHP's
include() construct.
The recommended way to create plugins is to create a class for the plugin which inherits from the abstract Plugin class. This will allow you to access the default plugin management functionality in that class (note: this has yet to be implemented). To do this, you simply need to define a couple of standard member variables and define your callback functions (i.e. event handler functions) as methods of the class. Then, outside of the class definition, but in the same file, you would register your event handlers. Look at some of the standard plugins for examples and at the auto-generated documentation for available events and interfaces.