Grouper - Documentation
Getting Started: Free Download |
Purchase |
Install
Reference: Functions | Plugins | Themes
Etc.: Configure | Affiliates
Reference: Functions | Plugins | Themes
Etc.: Configure | Affiliates
Grouper Evolution API
Grouper Evolution allows plugins to register callback functions for various stages of the processing of creating an RSS newsfeed. The API for registering callbacks, and the arguments that will be sent to your callback functions are described below.
You may use the plugins bundled with Grouper Evolution as a starting point for developing your own plugins.
Registering Callbacks, etc.
When your plugin is loaded or reset, it must set three Grouper configuration values:
- extractionfunction:
This is the name of the function that is called after a web page has been loaded to extract and format the RSS data.
If this may be accomplished using Grouper's built-in data extraction function, set it to '.' by calling GrouperSouceConf('extractionfunction','.');
If the page that is loaded will already be in RSS format, and you do not wish to change it, set this value to '' by calling GrouperSouceConf('extractionfunction','');
- buildqueryfunction:
This is the name of a function that is called to generate the query string which is sent to the site you are searching or otherwise accessing.
The query string must contain everything in the URL to be loaded beginning from (and including) the first slash after the domain name.
When loading a directory index, this value must include a trailing slash or the complete name of the index file.
To simply set the query string to '/' (to load the root page on the server), set this to '.' and don't provide a function.
- sourcesettings:
This is an array of configuration settings unique to your plugin.
It must contain a searchdomain, channeltitle, channeldescription and encoding.
Beyond that, you may add whatever configuration settings you require.
The following describes the arguments passed to your callback functions and how they should return their results.
- GrouperBuildQueryCallback($searchterms)
Based on the search terms and any relevant values from $grouperconf and $grouperconf['sourcesettings'] (which you set above), generate and return a query string. If your plugin does not have to do with searches, you may ignore $searchterms, or you may use it for some other purpose. The query string must contain everything in the URL to be loaded beginning from (and including) the first slash after the domain name. When loading a directory index, this value must include a trailing slash or the complete name of the index file.
- GrouperExtractionCallback()
This function should take the value of the global variable $grouperrawdata (the raw contents of the web page from which the RSS feed is to be generated) and return a string containing the code for the RSS items. The return value must not contain any of the RSS code appearing outside of the <item> and </item> tags. To set the channel title and description for the RSS feed, use GrouperSourceConf to set the 'channeltitle' and 'channeldescription' variables.