LnBlog Technical Overview

Copyright (C) 2005, Peter A. Geer <pageer@skepticats.com>
LnBlog homepage: http://www.skepticats.com/lnblog/

Introduction

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 both a guide for programmers who wish to modify LnBlog and as a case study for "up and comming" programmers who want to learn more about PHP or object oriented programming.

Plugin System

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 will run when the plugin is loaded, i.e. at the beginning of the page. 

There are two ways to go about creating a plugin.  The recommended way 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.  An example might look like this: