Overview

Creating a plugin

In order to function, a plugin must do the following:

  • Reside in "application/plugins" folder.
  • Plugin folder name must contain only lower case letters, numbers and underscores, no other characters are allowed.
  • Contain "manifest.php" and "install.php" files.

manifest.php file contains information about the plugin such as its name, description, version, etc. For example:

$params = array(
	'name' => 'Articles', // Your desired name of the plugin
	'description' => 'Users can write and post articles.', // Description
	'author' => 'VLD Interactive Inc.', // Developer name
	'website' => 'http://www.vldinteractive.com', // Developer website
	'version' => '1.0.0', // Plugin version
	'requirements' => array( 
		'system' => '1.1.4' // Optional, minimum software version required to install and run this plugin
	)
	'config' => true, // Optional, display a 'settings' link on the 'plugins' page to quickly access/change plugin settings once installed
);

install.php file contains code system may run for you when user installs, updates and uninstalls the plugin. For example:

class Plugins_Articles_Install extends Plugins
{
	public function __construct($manifest = array())
	{
		parent::__construct($manifest);
	}

	public function update()
	{
		if ( version_compare('1.0.1', $this->manifest['version_current']) == 1 )
		{
			// optional php code
		}

		return true;
	}

	public function install()
	{
		return true;
	}

	public function uninstall()
	{
		return true;
	}
}

Note that installation class name must extend "Plugins" class, and must contain the name of your plugin in its name "Plugins_Articles_Install" (does not have to be lower case though).