glFusion Wiki

Site Tools


glfusion:development:pluginapi:misc

Misc. Functions

The following is a list of (optional) functions for miscellaneous purposes.

plugin_uninstall_<plugin name>

If you want to give your plugin the ability to uninstall itself then you must implement this function.

Arguments

This function does not take any parameters. The plugin should try and uninstall itself, especially removing all its tables and data structures from the database. The function should return true if the uninstall succeeded and false if it failed.

test

plugin_centerblock_<plugin name>

Plugins can display a block in the site's center area (i.e. among the stories). This function is called several times during rendering of the site's index page. The parameters will tell the plugin where on the index page the block would appear. Parameters are where (1 = top of page, 2 = after the featured story, 3 = bottom of page), page number, and topic id. where can also be 0 which means that the plugin can take over the entire page if it wants to (in this case, it will have to return the HTML for the entire page. The function should return the complete HTML for the block (including header and footer), or an empty string.

Arguments

test

plugin_getheadercode_<plugin name>

Plugins may add additional lines to the site's <head> tag by implementing this function (i.e. Javascript functions or additional Meta tags). The function should return a concatenated string of all its extra header code.

Arguments

test

plugin_templatesetvars_<plugin name>

Plugins may set additional template variables. Currently this function is only called in COM_siteHeader and COM_siteFooter, but could in the future be called in other locations. The parameters passed are the template name and the reference to the template object. The plugin API can check the template name (in this case it will currently be 'header' or 'footer') and then, using the passed template object reference, set any required new template variables.

Arguments

test

plugin_chkVersion_<plugin name>

Plugins should implement this function and return the code version. Plugins should use a variable in the plugin's functions.inc for the code version, which allows the developer to easily update it before releasing a new version. This API function is called in the plugin Editor to show the version of the current installed version and plugin code version. The plugin installed version is pulled from the plugins table and should be updated as part of the plugin install or future updates. This API function allows the site admin to know if the current plugin code is newer then the installed version. Plugin developers can read the installed version from the plugins table and determine automatically if any SQL updates are required or at least update the plugin record to be the same as the code version.

Arguments

test

plugin_runScheduledTask_<plugin name>

This function allows plugin developers to schedule a task to be run. This API will only be called when someone accesses the site but should be sufficient for most plugins that want to schedule some maintenance process or clean-up routine. The interval this API is called is set in the site's configuration and all plugins that have this function will then be called.

Arguments

test
glfusion/development/pluginapi/misc.txt · Last modified: 2017/04/12 21:13 (external edit)

Page Tools