Hotaru plugins can be as big as you like and do as much as you want them to do. You could build a simple plugin to show the date in the sidebar, or a complex plugin to run an online photo gallery. The documentation in this section shows you how to get started and explains some of the ways you can get the most out of Hotaru CMS.
Before you get started
You will need a basic understanding of PHP, and should understand the Hotaru Cycle and our implementation of the PEAR Coding Standards before beginning.
Preparing your files
In the /content/plugins folder, create a new folder and give it a name. In that folder, you need a .php file of the same name, i.e.
Additional files can be added with names of your choice, but those first files should all match the plugin folder name.
How plugins work
Hotaru themes, some core files and other plugins, contain plugin hooks that look like this:
When PHP encounters a plugin hook, it calls a special function imaginatively titled pluginHook. That function is in /libs/PluginFunctions.php. The purpose of the pluginHook function is to determine which plugin files and functions to include and trigger at that point.
Each plugin specifies the hooks it uses in a comment block at the top of the file. Hotaru takes those hooks and stores them along with the plugin name in the database. The pluginHook function checks the database (or database cache) to see which plugins match the plugin hook encountered.
Your plugin class
The pluginHook function described above will build an instance of your class and use it to run the function intended at that hook. A function's name must match the plugin hook's name and have $h as the first parameter, e.g.
Therefore, the skeleton for your plugin should look something like this:
// In a plugin or template:
// In the pluginHook function:
$my_plugin = new MyPlugin($h);
By passing $h to each function, we can use the dozens of functions built into Hotaru.
* name: My Plugin
* description: Does wonderful things
* version: 0.1
* folder: my_plugin
* class: MyPlugin
* hooks: plugin_hook_name
* You can type notes here
public function plugin_hook_name($h)
// do something
Now you're ready to make your first plugin!