diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-07-15 16:03:17 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-07-15 16:03:17 -0400 |
commit | 488befd6282bdcc706920fcc0332943ae808af00 (patch) | |
tree | 05bf55c5dae79a1dc2507d9a2ae67ad44c247c49 /README | |
parent | 9e7e440be9ef172cb9e0bda40e34726c2131d792 (diff) |
add some info about plugins
Diffstat (limited to 'README')
-rw-r--r-- | README | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -1429,6 +1429,51 @@ notify third-party servers of updates. notify: an array of URLs for ping endpoints. Default is the empty array (no notification). +Plugins +======= + +Beginning with the 0.7.x branch, Laconica has supported a simple but +powerful plugin architecture. Important events in the code are named, +like 'StartNoticeSave', and other software can register interest +in those events. When the events happen, the other software is called +and has a choice of accepting or rejecting the events. + +In the simplest case, you can add a function to config.php and use the +Event::addHandler() function to hook an event: + + function AddGoogleLink($action) + { + $action->menuItem('http://www.google.com/', _('Google'), _('Search engine')); + return true; + } + + Event::addHandler('EndPrimaryNav', 'AddGoogleLink'); + +This adds a menu item to the end of the main navigation menu. You can +see the list of existing events, and parameters that handlers must +implement, in EVENTS.txt. + +The Plugin class in lib/plugin.php makes it easier to write more +complex plugins. Sub-classes can just create methods named +'onEventName', where 'EventName' is the name of the event (case +matters!). These methods will be automatically registered as event +handlers by the Plugin constructor (which you must call from your own +class's constructor). + +Several example plugins are included in the plugins/ directory. You +can enable a plugin with the following line in config.php: + + addPlugin('Example', array('param1' => 'value1', + 'param2' => 'value2')); + +This will look for and load files named 'ExamplePlugin.php' or +'Example/ExamplePlugin.php' either in the plugins/ directory (for +plugins that ship with Laconica) or in the local/ directory (for +plugins you write yourself or that you get from somewhere else) or +local/plugins/. + +Plugins are documented in their own directories. + Troubleshooting =============== |