Creating a plugin for The Secretary is a very simple and straightforward process. You are not required to write any special code to get your plugin working with the system, and as such, can write in your own programming style. Plugin development is very freeform, making it quick and easy.
File naming and Installation
All plugins in The Secretary must end with the extension plugin.php and be in the form of plugin_name.plugin.php. If the file does not have the correct extension it will be ignored.
Installing a plugin requires uploading the file to the 'plugins' folder in the Secretary installation. It will be automatically included by the system.
Hooks and Anchors
Plugins can provide extra functionality by introducing new functions that can be used by other plugins or in themes, they can add fields to the various forms and can modify data that is sent to and from the database.
In order to modify the system in some way, a plugin must hook into an 'event', or anchor as they are called in The Secretary. See the full list of anchors.
Hooking into anchors is easy:
<?php hook( "anchor", "myPluginFunction" ); ?>
In it's simplest usage, the hook() function takes two parameters: anchor name - the anchor you would like to hook into function name - the name of your function that will perform whatever tasks it needs to
Let's create a super simple plugin that will add a message to the top of every page in the backend:
<?php // Define hooks hook( "content_start", "sayHello" ); // Functions function sayHello() { echo '<h2>Hello you!</h2>'; } ?>
Save the file as “sayhello.plugin.php” and upload it to the “plugins” folder. Login to the backend and say “Hello!”.