[ Index ] |
|
Code source de GeekLog 1.4.1 |
[Code source] [Imprimer] [Statistiques]
This is the plugin library for Geeklog. This is the API that plugins can implement to get tight integration with Geeklog. See each function for more details.
Poids: | 1949 lignes (64 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
PLG_callFunctionForAllPlugins($function_name) X-Ref |
Calls a function for all enabled plugins param: string $function_name holds name of function to call |
PLG_callFunctionForOnePlugin($function, $args='') X-Ref |
Calls a function for a single plugin This is a generic function used by some of the other API functions to call a function for a specific plugin and, optionally pass parameters. This function can handle up to 5 arguments and if more exist it will try to pass the entire args array to the function. param: string $function holds name of function to call param: array $args arguments to send to function return: mixed returns result of function call, otherwise false |
PLG_install($type) X-Ref |
Tells a plugin to install itself. NOTE: not currently used anymore param: string $type Plugin name return: boolean Returns true on success otherwise false |
PLG_upgrade($type) X-Ref |
Upgrades a plugin. Tells a plugin to upgrade itself. param: string $type Plugin name return: boolean Returns true on success otherwise false |
PLG_chkVersion($type) X-Ref |
Calls the plugin function to return the current version of code. Used to indicate to admin if an update or upgrade is requied. param: string $type Plugin name return: boolean Returns true on success otherwise false |
PLG_uninstall($type) X-Ref |
Tells a plugin to uninstall itself. param: string $type Plugin to uninstall return: boolean Returns true on success otherwise false |
PLG_enableStateChange($type, $enable) X-Ref |
Inform plugin that it is either being enabled or disabled. param: string $type Plugin name param: boolean $enable true if enabling, false if disabling return: boolean Returns true on success otherwise false |
PLG_isModerator() X-Ref |
Checks to see if user is a plugin moderator Geeklog is asking if the user is a moderator for any installed plugins. return: boolean True if current user is moderator of plugin otherwise false |
PLG_getMenuItems() X-Ref |
Gives plugins a chance to print their menu items in header Note that this is fairly unflexible. This simply loops through the plugins in the database in the order they were installed and get their menu items. If you want more flexibility in your menu then you should hard code the menu items in header.thtml for the theme(s) you are using. return: array Returns menu options for plugin |
PLG_getCommentUrlId($type) X-Ref |
Get view URL and name of unique identifier author: Vincent Furia <vinny01 AT users DOT sourceforge DOT net> param: string $type Plugin to delete comment return: array string of URL of view page, name of unique identifier |
PLG_commentDelete($type, $cid, $id) X-Ref |
Plugin should delete a comment author: Vincent Furia <vinny01 AT users DOT sourceforge DOT net> param: string $type Plugin to delete comment param: int $cid Comment to be deleted param: string $id Item id to which $cid belongs return: mixed false for failure, HTML string (redirect?) for success |
PLG_commentSave($type, $title, $comment, $id, $pid, $postmode) X-Ref |
Plugin should save a comment author: Vincent Furia <vinny01 AT users DOT sourceforge DOT net> param: string $type Plugin to delete comment param: string $title comment title param: string $comment comment text param: string $id Item id to which $cid belongs param: int $pid comment parent param: string $postmode 'html' or 'text' return: mixed false for failure, HTML string (redirect?) for success |
PLG_displayComment($type, $id, $cid, $title, $order, $format, $page, $view) X-Ref |
Plugin should display [a] comment[s] author: Vincent Furia <vinny01 AT users DOT sourceforge DOT net> param: string $type Plugin to display comment param: string $id Unique idenifier for item comment belongs to param: int $cid Comment id to display (possibly including sub-comments) param: string $title Page/comment title param: string $order 'ASC' or 'DSC' or blank param: string $format 'threaded', 'nested', or 'flat' param: int $page Page number of comments to display param: boolean $view True to view comment (by cid), false to display (by $pid) return: mixed results of calling the plugin_displaycomment_ function |
PLG_commentPreSave($uid, &$title, &$comment, $sid, $pid, $type, &$postmode) X-Ref |
Allows plugins a chance to handle a comment before GL does. This is a first-come-first-serve affair so if a plugin returns an error, other plugins wishing to handle comment preprocessing won't get called author: Tony Bibbs <tony@geeklog.net> param: integer $uid User ID param: string $title Comment title param: string $sid Story ID (not always a story, remember!) param: integer $pid Parent comment ID param: string $type Type of comment param: string $postmode HTML or text return: an error otherwise false if no errors were encountered |
PLG_itemPreSave($type, $content) X-Ref |
Allows plugins a chance to handle an item before GL does. Modeled after the PLG_commentPreSave() function. This is a first-come-first-serve affair so if a plugin returns an error, other plugins wishing to handle comment preprocessing won't get called author: Mark Evans <mevans@ecsnet.com> param: string $type Type of item, i.e.; registration, contact ... param: string $content item specific content return: string empty is no error, error message if error was encountered |
PLG_getPluginStats($showsitestats) X-Ref |
The way this function works is very specific to how Geeklog shows its statistics. On stats.php, there is the top box which gives overall statistics for Geeklog and then there are blocks below it that give more specific statistics for various components of Geeklog. This plugin API function suffers from a variety of bugs and bad design decisions for which we have to provide backward compatibility, so please bear with us ... The only parameter to this function, $showsitestats, was documented as being 1 for the site stats and 0 for the plugin-specific stats. However, the latter was always called with a value of 2, so plugins only did a check for 1 and "else", which makes extensions somewhat tricky. Furthermore, due to the original templates for the site stats, it has become standard practice to hard-code a <table> in the plugins as the return value for $showsitestats == 1. This table, however, didn't align properly with the built-in site stats entries. Because of all this, the new mode, 3, works differently: - for $showsitestats == 3, we call a new plugin API function, plugin_statssummary_<plugin-name>, which is supposed to return the plugin's entry for the site stats in an array which stats.php will then properly format, alongside the entries for the built-in items. - for $showsitestats == 1, we only call those plugins that do NOT have a plugin_statssummary_<plugin-name> function, thus providing backward compatibility - for $showsitestats == 2, nothing has changed param: int $showsitestats value indicating type of stats to return return: mixed array (for mode 3) or string |
PLG_getSearchTypes() X-Ref |
This function gives each plugin the opportunity to put a value(s) in the 'Type' drop down box on the search.php page so that their plugin can be incorporated into searches. return: array String array of search types for plugin(s) |
PLG_supportsExpandedSearch($type) X-Ref |
Determines if a specific plugin supports Geeklog's expanded search results feature author: Tony Bibbs <tony AT geeklog DOT net> param: string $type Plugin name return: boolean True if it is supported, otherwise false |
PLG_doSearch($query, $datestart, $dateend, $topic, $type, $author, $keyType = 'all', $page = 1, $perpage = 10) X-Ref |
This function gives each plugin the opportunity to do their search and return their results. Results comeback in an array of HTML formatted table rows that can be quickly printed by search.php param: string $query What the user searched for param: date $datestart beginning of date range to search for param: date $dateend ending date range to search for param: string $topic the topic the user searched within param: string $type Type of items they are searching, or 'all' param: int $author UID...only return results for this person param: string $keyType search key type: 'all', 'phrase', 'any' param: int $page page number of current search param: int $perpage number of results per page return: array Returns search results |
PLG_getSubmissionCount() X-Ref |
Asks each plugin to report any submissions they may have in their submission queue return: int Number of submissions in queue for plugins |
PLGINT_getOptionsforMenus($var_names, $required_names, $function_name) X-Ref |
This function will get & check user or admin options from plugins and check required ones for availability. This function is called by several other functions and is not to be called from the plugin directly. The function which call this here follow below. NOTE for plugin developers: The plugin is responsible for its own security. This supports a plugin having either a single menuitem or multiple menuitems. The plugin has to provide an array for the menuitem of the format: array (menuitem_title, item_url, submission_count) or an array of arrays in case there are several entries: array ( array (menuitem1_title, item1_url, submission1_count), array (menuitem2_title, item2_url, submission2_count), array (menuitem3_title, item3_url, submission3_count)) Plugin function can return a single record array or multiple records param: array $var_names An array of the variables that are retrieved. param: array $required_names An array of true/false-values, describing param: string $function_name A string that gives the name of the function return: array Returns options to add to the given menu that is calling this |
PLG_getCCOptions() X-Ref |
This function shows the option for all plugins at the top of the command and control center. This supports that a plugin can have several lines in the CC menu. The plugin has to provide simply a set arrays with 3 variables in order to get n lines in the menu such as array( array("first line", "url1", "1"), array("second line", "url2", "44"), etc, etc) If there is only one item, a single array is enough: array("first line", "url1", "1") return: array Returns Command and Control options for moderation.php |
PLG_getAdminOptions() X-Ref |
This function will show any plugin adminstrative options in the admin functions block on every page (assuming the user is an admin and is logged in). NOTE: the plugin is responsible for its own security. This supports that a plugin can have several lines in the Admin menu. The plugin has to provide simply a set arrays with 3 variables in order to get n lines in the menu such as array( array("first line", "url1", "1"), array("second line", "url2", "44"),, etc, etc) If there is only one item, a single array is enough: array("first line", "url1", "1") return: array Returns options to put in admin menu |
PLG_getUserOptions() X-Ref |
This function will show any plugin user options in the user block on every page This supports that a plugin can have several lines in the User menu. The plugin has to provide simply a set of arrays with 3 variables in order to get n lines in the menu such as array( array("first line", "url1", "1"), array("second line", "url2", "44"), etc, etc) If there is only one item, a single array is enough: array("first line", "url1", "1") NOTE: the plugin is responsible for its own security. return: array Returns options to add to user menu |
PLG_approveSubmission($type, $id) X-Ref |
This function is responsible for calling plugin_moderationapproves_<pluginname> which approves an item from the submission queue for a plugin. param: string $type Plugin name to do submission approval for param: string $id used to identify the record to approve return: boolean Returns true on success otherwise false |
PLG_deleteSubmission($type, $id) X-Ref |
This function is responsible for calling plugin_moderationdelete_<pluginname> which deletes an item from the submission queue for a plugin. param: string $type Plugin to do submission deletion for param: string $id used to identify the record for which to delete return: boolean Returns true on success otherwise false |
PLG_saveSubmission($type, $A) X-Ref |
This function calls the plugin_savesubmission_<pluginname> to save a user submission param: string $type Plugin to save submission for param: array $A holds plugin specific data to save return: boolean Returns true on success otherwise false |
PLG_showModerationList() X-Ref |
This function starts the chain of calls needed to show any submissions needing moderation for the plugins. return: string returns list of items needing moderation for plugins |
PLG_getModerationValues($type) X-Ref |
This function is responsible for setting the plugin-specific values needed by moderation.php to approve stuff. param: string $type Plugin to call function for return: string |
PLG_showSubmitForm($type) X-Ref |
This function is resonsible for calling plugin_submit_<pluginname> so that the submission form for the plugin is displayed. param: string $type Plugin to show submission form for return: string HTML for submit form for plugin |
PLG_showCenterblock($where = 1, $page = 1, $topic = '') X-Ref |
This function will show the centerblock for any plugin It will be display before any news and after any defined staticpage content. The plugin is responsible to format the output correctly. param: where int 1 = top, 2 = after feat. story, 3 = bottom of page param: page int page number (1, ...) param: topic string topic ID or empty string == front page return: Formatted center block content |
PLG_createUser($uid) X-Ref |
This function will inform all plugins when a new user account is created. param: int $uid user id of the new user account |
PLG_deleteUser($uid) X-Ref |
This function will inform all plugins when a user account is deleted. param: int $uid user id of the deleted user account |
PLG_loginUser($uid) X-Ref |
This function will inform all plugins when a user logs in Note: This function is NOT called when users are re-authenticated by their long-term cookie. The global variable $_USER['auto_login'] will be set to 'true' in that case, however. param: int $uid user id |
PLG_logoutUser($uid) X-Ref |
This function will inform all plugins when a user logs out. Plugins should not rely on this ever being called, as the user may simply close the browser instead of logging out. param: int $uid user id |
PLG_userInfoChanged($uid) X-Ref |
This functions is called to inform plugins when a user's information (profile or preferences) has changed. param: int $uid User ID |
PLG_groupChanged($grp_id, $mode) X-Ref |
This functions is called to inform plugins when a group's information has changed or a new group has been created. param: int $grp_id Group ID param: string $mode type of change: 'new', 'edit', or 'delete' |
PLG_profileVariablesEdit($uid, &$template) X-Ref |
Geeklog is about to display the edit form for the user's profile. Plugins now get a chance to add their own variables and input fields to the form. param: int $uid user id of the user profile to be edited param: ref $template reference of the Template for the profile edit form |
PLG_profileBlocksEdit($uid) X-Ref |
Geeklog is about to display the edit form for the user's profile. Plugins now get a chance to add their own blocks below the standard form. param: int $uid user id of the user profile to be edited return: string HTML for additional block(s) |
PLG_profileVariablesDisplay($uid, &$template) X-Ref |
Geeklog is about to display the user's profile. Plugins now get a chance to add their own variables to the profile. param: int $uid user id of the user profile to be edited param: ref $template reference of the Template for the profile edit form |
PLG_profileBlocksDisplay($uid) X-Ref |
Geeklog is about to display the user's profile. Plugins now get a chance to add their own blocks below the standard profile form. param: int $uid user id of the user profile to be edited return: string HTML for additional block(s) |
PLG_profileExtrasSave($plugin = '') X-Ref |
The user wants to save changes to his/her profile. Any plugin that added its own variables or blocks to the profile input form will now have to extract its data and save it. Plugins will have to refer to the global $_POST array to get the actual data. param: string $plugin name of a specific plugin or empty (all plugins) |
PLG_templateSetVars($templatename, &$template) X-Ref |
This function can be called to check if an plugin wants to set a template variable Example in COM_siteHeader, the API call is now added A plugin can now check for templatename == 'header' and then set additional template variables param: string $templatename Name of calling template - used as test in plugin function param: ref $template reference for the Template |
PLG_getHeaderCode() X-Ref |
This function is called from COM_siteHeader and will return additional header information. This can be used for JavaScript functions required for the plugin or extra Metatags return: string returns a concatenated string of all plugins extra header code |
PLG_collectTags() X-Ref |
Get a list of all currently supported autolink tags. Returns an associative array where $A['tag-name'] = 'plugin-name' return: array All currently supported autolink tags |
PLG_replaceTags($content, $plugin = '') X-Ref |
This function will allow plugins to support the use of custom autolinks in other site content. Plugins can now use this API when saving content and have the content checked for any autolinks before saving. The autolink would be like: [story:20040101093000103 here] param: string $content Content that should be parsed for autolinks param: string $plugin Optional if you only want to parse using a specific plugin |
PLG_supportingFeeds() X-Ref |
Prepare a list of all plugins that support feeds. To do this, we re-use plugin_getfeednames_<plugin name> and only keep the names of those plugins which support that function return: array array of plugin names (can be empty) |
PLG_getFeedNames($plugin) X-Ref |
Ask the plugin for a list of feeds it supports. The plugin is expected to return an array of id/name pairs where 'id' is the plugin's internal id for the feed and 'name' is what will be presented to the user. param: string plugin plugin name return: array array of id/name pairs |
PLG_getFeedContent($plugin, $feed, &$link, &$update_data, $feedType, $feedVersion) X-Ref |
Get the content of a feed from the plugin. The plugin is expected to return an array holding the content of the feed and to fill in 'link' (some link that represents the same content on the site as that in the feed) and 'update_data' (to be stored for later up-to-date checks. param: string plugin plugin name param: int feed feed id param: string link link to content on the site param: string update_data information for later up-to-date checks param: string feedType The type of feed (RSS/Atom etc) param: string feedVersion The version info of the feed. return: array content of feed |
PLG_getFeedElementExtensions($contentType, $contentID, $feedType, $feedVersion, $topic, $fid) X-Ref |
Get extension tags for a feed. For example, some plugins may extened the available elements for an RSS 2.0 feed for articles. For some reason. This function allows that. param: string contentType Type of feed content, article or a plugin specific type param: string contentID Unique identifier of content item to extend param: string feedType Type of feed format (RSS/Atom/etc) param: string feedVersion Type of feed version (RSS 1.0 etc) param: string topic The topic for the feed. param: string fid The ID of the feed being fethed. |
PLG_getFeedNSExtensions($contentType, $feedType, $feedVersion, $topic, $fid) X-Ref |
Get namespaces extensions for a feed. If a plugin has added extended tags to a feed, then it may also need to insert some extensions to the name spaces. param: string contentType Type of feed content, article or a plugin specific type param: string feedType Type of feed format (RSS/Atom/etc) param: string feedVersion Type of feed version (RSS 1.0 etc) param: string topic The topic for the feed. param: string fid The ID of the feed being fethed. |
PLG_getFeedExtensionTags($contentType, $feedType, $feedVersion, $topic, $fid) X-Ref |
Get meta tag extensions for a feed. Add extended tags to the meta area of a feed. param: string contentType Type of feed content, article or a plugin specific type param: string feedType Type of feed format (RSS/Atom/etc) param: string feedVersion Type of feed version (RSS 1.0 etc) param: string topic The topic for the feed. param: string fid The ID of the feed being fethed. |
PLG_feedUpdateCheck($plugin, $feed, $topic, $update_data, $limit, $updated_type = '', $updated_topic = '', $updated_id = '') X-Ref |
The plugin is expected to check if the feed content needs to be updated. This is called from COM_rdfUpToDateCheck() every time Geeklog's index.php is displayed - it should try to be as efficient as possible ... param: string plugin plugin name param: int feed feed id param: string topic "topic" of the feed - plugin specific param: string limit number of entries or number of hours param: string updated_type (optional) type of feed to update param: string updated_topic (optional) topic to update param: string updated_id (optional) entry id to update return: bool false = feed has to be updated, true = ok |
PLG_getWhatsNew() X-Ref |
Ask plugins if they want to add something to Geeklog's What's New block. return: array array($headlines[], $bylines[], $content[$entries[]]) |
PLG_checkforSpam($content, $action = -1) X-Ref |
Allows plugins and Core GL Components to filter out spam. The Spam-X Plugin is now part of the Geeklog Distribution This plugin API will call the main function in the Spam-X plugin but can also be used to call other plugins or custom functions if available for filtering spam or content. param: string $content Text to be filtered or checked for spam param: integer $action what to do if spam found return: integer > 0: spam detected, == 0: no spam detected |
PLG_spamAction($content, $action = -1) X-Ref |
Act on spam This is normally called from PLG_checkforSpam (see above) automatically when spam has been detected. There may however be situations where spam has been detected by some other means, in which case you may want to trigger the spam action explicitly. param: string $content Text to be filtered or checked for spam param: integer $action what to do if spam found return: integer > 0: spam detected, == 0: no spam detected |
PLG_getItemInfo($type, $id, $what) X-Ref |
Ask plugin for information about one of its items param: string $type plugin type param: string $id ID of an item under the plugin's control param: string $what comma-separated list of item properties return: mixed string or array of strings with the information |
PLG_handlePingComment($type, $id, $operation) X-Ref |
Geeklog is about to perform an operation on a trackback or pingback comment to one of the items under the plugin's control and asks for the plugin's permission to continue. Geeklog handles receiving and deleting trackback comments and pingbacks for the plugin but since it doesn't know about the plugin's access control, it has to ask the plugin to approve / reject such an operation. param: string $type plugin type param: string $id an ID or URL, depending on the operation param: string $operation operation to perform |
PLG_runScheduledTask() X-Ref |
Check if plugins have a scheduled task they want to run The interval between runs is determined by $_CONF['cron_schedule_interval'] |
PLG_itemSaved($id, $type) X-Ref |
"Generic" plugin API: Save item To be called (eventually) whenever Geeklog saves an item into the database. Plugins can hook into this and modify the item (which is already in the database but not visible on the site yet). Plugins can signal an error by returning an error message (otherwise, they should return 'false' to signal "no errors"). In case of an error, all the plugins called up to that point will be invoked through an "abort" call to undo their changes. returns: mixed Boolean false for "no error", or an error msg text param: string $id unique ID of the item param: string $type type of the item, e.g. 'article' |
PLG_getBlocks( $side, $topic='') X-Ref |
Gets Geeklog blocks from plugins Returns data for blocks on a given side and, potentially, for a given topic. param: string $side Side to get blocks for (right or left for now) param: string $topic Only get blocks for this topic return: array of block data |
PLG_getIcon($type) X-Ref |
Get the URL of a plugin's icon param: string $type plugin name return: string URL of the icon |
Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |