Geeklog
[ class tree: Geeklog ] [ index: Geeklog ] [ all elements ]

Procedural File: lib-plugins.php

Source Location: /system/lib-plugins.php



Page Details:

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.




Tags:



Includes:

require_once($_CONF['path_system'].'classes/plugin.class.php') [line 49]
Include plugin class






PLG_RET_AUTH_FAILED [line 58]

PLG_RET_AUTH_FAILED = -3

[ Top ]



PLG_RET_ERROR [line 56]

PLG_RET_ERROR = -1

[ Top ]



PLG_RET_OK [line 55]

PLG_RET_OK = 0
Response codes for the service invocation PLG_invokeService(). Note that these are intentionally vague so as not to give away too much information.


[ Top ]



PLG_RET_PERMISSION_DENIED [line 57]

PLG_RET_PERMISSION_DENIED = -2

[ Top ]



PLG_RET_PRECONDITION_FAILED [line 59]

PLG_RET_PRECONDITION_FAILED = -4

[ Top ]



PLG_SPAM_ACTION_DELETE [line 69]

PLG_SPAM_ACTION_DELETE = 128

[ Top ]



PLG_SPAM_ACTION_NONE [line 67]

PLG_SPAM_ACTION_NONE = 0

[ Top ]



PLG_SPAM_ACTION_NOTIFY [line 68]

PLG_SPAM_ACTION_NOTIFY = 8

[ Top ]



PLG_SPAM_FOUND [line 63]

PLG_SPAM_FOUND = 1

[ Top ]



PLG_SPAM_NOT_FOUND [line 62]

PLG_SPAM_NOT_FOUND = 0

[ Top ]



PLG_SPAM_UNSURE [line 64]

PLG_SPAM_UNSURE = 2

[ Top ]




PLG_afterSaveSwitch [line 2829]

string PLG_afterSaveSwitch( string $target, string $item_url, string $plugin, [string $message = ''])

Forward the user depending on config setting after saving something



Tags:

return:  the url where the user will be forwarded to


Parameters

string   $target   where to redirect to
string   $item_url   the url of the item saved
string   $plugin   the name of the plugin that saved the item
string   $message   (optional) message number to attach to url
[ Top ]



PLG_approveSubmission [line 1043]

boolean PLG_approveSubmission( string $type, string $id)

This function is responsible for calling plugin_moderationapproves_<pluginname> which approves an item from the submission queue for a plugin.



Tags:

return:  Returns true on success otherwise false


Parameters

string   $type   Plugin name to do submission approval for
string   $id   used to identify the record to approve
[ Top ]



PLG_checkAvailable [line 3260]

mixed PLG_checkAvailable( $pi_name $pi_name, $version $version, [$operator $operator = '&gt;='])

Returns the status of a plugin or false if unavailable



Tags:

return:  false is returned if the plugin is unavailable other possible values are: 'ok', 'disabled', 'uninstalled', 'wrong_version'
since:  Geeklog 1.8.0


Parameters

$pi_name   $pi_name   string The short name of the plugin to look for
$version   $version   string A version to ask for, the default operator is '>='
$operator   $operator   string Optional operator to override the default See COM_versionCompare() for all valid operators
[ Top ]



PLG_checkAvailableDb [line 3313]

bool PLG_checkAvailableDb( $db $db, $pi_name $pi_name, $version $version, [$operator $operator = '&gt;='])

Returns true if the database server version matches the criteria and the required file is available in the plugin, false otherwise.



Tags:

since:  Geeklog 1.8.0


Parameters

$db   $db   string The name of the dbms to check for
$pi_name   $pi_name   string The short name of the plugin for which to check support
$version   $version   string A version to ask for, the default operator is '>='
$operator   $operator   string Optional operator to override the default See COM_versionCompare() for all valid operators
[ Top ]



PLG_checkDependencies [line 3194]

bool PLG_checkDependencies( $pi_name $pi_name)

Given a plugin name see if ALL of it's dependencies are satisfied



Tags:

return:  True or False, depending on whether all of the dependencies are satisfied for plugin $pi_name
since:  Geeklog 1.8.0


Parameters

$pi_name   $pi_name   string The short name of the plugin
[ Top ]



PLG_checkforSpam [line 2235]

int PLG_checkforSpam( string $content, [int $action = -1])

Allows plugins and Core Geeklog 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.

The caller should check for return values > 0 in which case spam has been detected and the poster should be told, either via

  1.    echo COM_refresh($_CONF['site_url''/index.php?msg=' $result
  2.                     . '&amp;plugin=spamx');
or by
  1.    COM_displayMessageAndAbort($result'spamx'403'Forbidden');
Where the former will only display a "spam detected" message while the latter will also send an HTTP status code 403 with the message.




Tags:

return:  > 0: spam detected, == 0: no spam detected
link:  http://wiki.geeklog.net/index.php/Filtering_Spam_with_Spam-X


Parameters

string   $content   Text to be filtered or checked for spam
int   $action   what to do if spam found
[ Top ]



PLG_chkVersion [line 225]

boolean PLG_chkVersion( string $type)

Calls the plugin function to return the current version of code.

Used to indicate to admin if an update or upgrade is required.




Tags:

return:  Returns true on success otherwise false


Parameters

string   $type   Plugin name
[ Top ]



PLG_collectSitemapItems [line 3480]

array PLG_collectSitemapItems( string $type, [int $uid = 1], [int $limit = 0])

Ask plugins for items they want to include in an XML site map



Tags:

return:  array of array( 'url' => the URL of an item (mandatory), 'date-modified' => the UNIX timestamp when an item was last modified (optional) 'change-freq' => one of 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' (optional) 'priority' => a float value showing the priority of an item, must be between 0.0 (lowest) and 1.0 (highest) (optional) )
link:  http://wiki.geeklog.net/index.php/PLG_getSitemapItems
since:  Geeklog-2.1.1


Parameters

string   $type   plugin type (incl. 'article' for stories)
int   $uid   user ID or 0 = current user; should be 1 (= anonymous user) in most cases
int   $limit   the max number of items to be returned (0 = no limit)
[ Top ]



PLG_commentDelete [line 485]

mixed PLG_commentDelete( string $type, int $cid, string $id)

Plugin should delete a comment



Tags:

return:  false for failure, HTML string (redirect?) for success
author:  Vincent Furia, vinny01 AT users DOT sourceforge DOT net


Parameters

string   $type   Plugin to delete comment
int   $cid   Comment to be deleted
string   $id   Item id to which $cid belongs
[ Top ]



PLG_commentPreSave [line 580]

mixed PLG_commentPreSave( int $uid, string &$title, string &$comment, string $sid, int $pid, string $type, string &$postmode)

Allows plugins a chance to handle a comment before Geeklog 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




Tags:

return:  an error otherwise false if no errors were encountered
author:  Tony Bibbs, tony AT tonybibbs DOT com
see:  PLG_itemPreSave()
access:  public


Parameters

int   $uid   User ID
string   &$title   Comment title
string   &$comment   Comment text
string   $sid   Story ID (not always a story, remember!)
int   $pid   Parent comment ID
string   $type   Type of comment
string   &$postmode   HTML or text
[ Top ]



PLG_commentSave [line 511]

mixed PLG_commentSave( string $type, string $title, string $comment, string $id, int $pid, string $postmode)

Plugin should save a comment



Tags:

return:  false for failure, HTML string (redirect?) for success
author:  Vincent Furia, vinny01 AT users DOT sourceforge DOT net


Parameters

string   $type   Plugin to delete comment
string   $title   comment title
string   $comment   comment text
string   $id   Item id to which $cid belongs
int   $pid   comment parent
string   $postmode   'html' or 'text'
[ Top ]



PLG_configChange [line 2910]

void PLG_configChange( string $group, array $changes)

Inform plugins of configuration changes

NOTE: Plugins will only be notified of details of changes in 'Core' and in their own configuration. For other plugins, they will only be notified of the fact that something in the other plugin's config changed.




Tags:

link:  http://wiki.geeklog.net/index.php/PLG_configChange
since:  Geeklog 1.6.0


Parameters

string   $group   plugin name or 'Core' for $_CONF changes
array   $changes   names of config values that changed
[ Top ]



PLG_createUser [line 1185]

void PLG_createUser( int $uid)

This function will inform all plugins when a new user account is created.



Parameters

int   $uid   user id of the new user account
[ Top ]



PLG_deleteSubmission [line 1060]

boolean PLG_deleteSubmission( string $type, string $id)

This function is responsible for calling plugin_moderationdelete_<pluginname> which deletes an item from the submission queue for a plugin.



Tags:

return:  Returns true on success otherwise false


Parameters

string   $type   Plugin to do submission deletion for
string   $id   used to identify the record for which to delete
[ Top ]



PLG_deleteUser [line 1211]

void PLG_deleteUser( int $uid)

This function will inform all plugins when a user account is deleted.



Parameters

int   $uid   user id of the deleted user account
[ Top ]



PLG_displayComment [line 542]

mixed PLG_displayComment( string $type, string $id, int $cid, string $title, string $order, string $format, int $page, boolean $view)

Plugin should display [a] comment[s]



Tags:

return:  results of calling the plugin_displaycomment_ function
author:  Vincent Furia, vinny01 AT users DOT sourceforge DOT net


Parameters

string   $type   Plugin to display comment
string   $id   Unique idenifier for item comment belongs to
int   $cid   Comment id to display (possibly including sub-comments)
string   $title   Page/comment title
string   $order   'ASC' or 'DSC' or blank
string   $format   'threaded', 'nested', or 'flat'
int   $page   Page number of comments to display
boolean   $view   True to view comment (by cid), false to display (by $pid)
[ Top ]



PLG_doSearch [line 798]

array PLG_doSearch( string $query, date $datestart, date $dateend, string $topic, string $type, int $author, [string $keyType = 'all'], [int $page = 1], [int $perpage = 10])

This function gives each plugin the opportunity to do their search and return their results. Results come back in an array of HTML formatted table rows that can be quickly printed by search.php



Tags:

return:  Returns search results


Parameters

string   $query   What the user searched for
date   $datestart   beginning of date range to search for
date   $dateend   ending date range to search for
string   $topic   the topic the user searched within
string   $type   Type of items they are searching, or 'all'
int   $author   UID...only return results for this person
string   $keyType   search key type: 'all', 'phrase', 'any'
int   $page   page number of current search (deprecated)
int   $perpage   number of results per page (deprecated)
[ Top ]



PLG_enableStateChange [line 396]

boolean PLG_enableStateChange( string $type, boolean $enable)

Inform plugin that it is either being enabled or disabled.



Tags:

return:  Returns true on success otherwise false
see:  PLG_pluginStateChange()


Parameters

string   $type   Plugin name
boolean   $enable   true if enabling, false if disabling
[ Top ]



PLG_feedUpdateCheck [line 2006]

boolean PLG_feedUpdateCheck( string $plugin, int $feed, string $topic, string $update_data, string $limit, [string $updated_type = ''], [string $updated_topic = ''], [string $updated_id = ''])

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 ...

NOTE: The presence of non-empty $updated_XXX parameters indicates that an existing entry has been changed. The plugin may therefore apply a different method to check if its feed has to be updated.




Tags:

return:  false = feed has to be updated, true = ok


Parameters

string   $plugin   plugin name
int   $feed   feed id
string   $topic   "topic" of the feed - plugin specific
string   $update_data   comma-sep. list of updated ids
string   $limit   number of entries or number of hours
string   $updated_type   (optional) type of feed to update
string   $updated_topic   (optional) topic to update
string   $updated_id   (optional) entry id to update
[ Top ]



PLG_getAdminOptions [line 989]

array PLG_getAdminOptions( )

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

  1.  array(
  2.    array("first line""url1""1"),
  3.    array("second line""url2""44"),,
  4.             etcetc)
If there is only one item, a single array is enough:
  1.  array("first line""url1""1")




Tags:

return:  Returns options to put in admin menu


[ Top ]



PLG_getBlocks [line 2637]

array PLG_getBlocks( string $side, [string $topic = ''])

Gets Geeklog blocks from plugins

Returns data for blocks on a given side and, potentially, for a given topic.




Tags:

return:  array of block data
link:  http://wiki.geeklog.net/index.php/Dynamic_Blocks


Parameters

string   $side   Side to get blocks for (right or left for now)
string   $topic   Only get blocks for this topic
[ Top ]



PLG_getBlocksConfig [line 2674]

array PLG_getBlocksConfig( string $side, [string $topic = ''])

Gets Geeklog blocks from plugins

Returns config data for blocks on a given side and, potentially, for a given topic.




Tags:

return:  array of block data
link:  http://wiki.geeklog.net/index.php/Dynamic_Blocks


Parameters

string   $side   Side to get blocks for (right or left for now)
string   $topic   Only get blocks for this topic
[ Top ]



PLG_getCCOptions [line 956]

array PLG_getCCOptions( )

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

  1.  array(
  2.    array("first line""url1""1"),
  3.    array("second line""url2""44"),
  4.             etcetc)
If there is only one item, a single array is enough:
  1.  array("first line""url1""1")




Tags:

return:  Returns Command and Control options for moderation.php


[ Top ]



PLG_getCommentUrlId [line 461]

array PLG_getCommentUrlId( string $type)

Get view URL and name of unique identifier



Tags:

return:  string of URL of view page, name of unique identifier
author:  Vincent Furia, vinny01 AT users DOT sourceforge DOT net


Parameters

string   $type   Plugin to delete comment
[ Top ]



PLG_getConfigTooltip [line 2973]

mixed PLG_getConfigTooltip( string $group, string $id)

Ask plugin for text for a Configuration tooltip



Tags:

return:  Text to use regular tooltip, NULL to use config tooltip hack, or empty string when not available
link:  http://wiki.geeklog.net/index.php/PLG_getConfigTooltip
since:  Geeklog 1.8.0


Parameters

string   $group   plugin name or 'Core'
string   $id   Id of config value
[ Top ]



PLG_getDocumentationUrl [line 2954]

mixed PLG_getDocumentationUrl( string $type, string $file)

Ask plugin for the URL to its documentation



Tags:

return:  URL or false / empty string when not available
link:  http://wiki.geeklog.net/index.php/PLG_getDocumentationUrl
since:  Geeklog 1.6.0


Parameters

string   $type   plugin name
string   $file   documentation file being requested, e.g. 'config'
[ Top ]



PLG_getFeedContent [line 1848]

array PLG_getFeedContent( string $plugin, int $feed, string &$link, string &$update_data, string $feedType, string $feedVersion)

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.




Tags:

return:  content of feed


Parameters

string   $plugin   plugin name
int   $feed   feed id
string   &$link   link to content on the site
string   &$update_data   information for later up-to-date checks
string   $feedType   The type of feed (RSS/Atom etc)
string   $feedVersion   The version info of the feed.
[ Top ]



PLG_getFeedElementExtensions [line 1891]

array PLG_getFeedElementExtensions( string $contentType, string $contentID, string $feedType, string $feedVersion, string $topic, string $fid)

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.



Tags:

return:  list of extension tags


Parameters

string   $contentType   Type of feed content, article or a plugin specific type
string   $contentID   Unique identifier of content item to extend
string   $feedType   Type of feed format (RSS/Atom/etc)
string   $feedVersion   Type of feed version (RSS 1.0 etc)
string   $topic   The topic for the feed.
string   $fid   The ID of the feed being fetched.
[ Top ]



PLG_getFeedExtensionTags [line 1962]

array PLG_getFeedExtensionTags( string $contentType, string $feedType, string $feedVersion, string $topic, string $fid)

Get meta tag extensions for a feed. Add extended tags to the meta area of a feed.



Tags:

return:  list of meta tag extensions


Parameters

string   $contentType   Type of feed content, article or a plugin specific type
string   $feedType   Type of feed format (RSS/Atom/etc)
string   $feedVersion   Type of feed version (RSS 1.0 etc)
string   $topic   The topic for the feed.
string   $fid   The ID of the feed being fetched.
[ Top ]



PLG_getFeedNames [line 1802]

array PLG_getFeedNames( string $plugin)

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.



Tags:

return:  array of id/name pairs


Parameters

string   $plugin   plugin name
[ Top ]



PLG_getFeedNSExtensions [line 1927]

array PLG_getFeedNSExtensions( string $contentType, string $feedType, string $feedVersion, string $topic, string $fid)

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.



Tags:

return:  list of extension namespaces


Parameters

string   $contentType   Type of feed content, article or a plugin specific type
string   $feedType   Type of feed format (RSS/Atom/etc)
string   $feedVersion   Type of feed version (RSS 1.0 etc)
string   $topic   The topic for the feed.
string   $fid   The ID of the feed being fetched.
[ Top ]



PLG_getFooterCode [line 1547]

string PLG_getFooterCode( )

This function is called from COM_siteFooter and will return additional footer information. This can be used for JavaScript functions required for the plugin



Tags:

return:  returns a concatenated string of all plugins extra footer code
since:  Geeklog 1.8.0


[ Top ]



PLG_getHeaderCode [line 1518]

string PLG_getHeaderCode( )

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



Tags:

return:  returns a concatenated string of all plugins extra header code
since:  Geeklog 1.3.8


[ Top ]



PLG_getIcon [line 2706]

string PLG_getIcon( string $type)

Get the URL of a plugin's icon



Tags:

return:  URL of the icon


Parameters

string   $type   plugin name
[ Top ]



PLG_getItemInfo [line 2330]

mixed PLG_getItemInfo( string $type, string $id, string $what, [int $uid = 0], [array $options = array()])

Ask plugin for information about one of its items

Item properties that can be requested:

  • 'date-created' - creation date, if available
  • 'date-modified' - date of last modification, if available
  • 'description' - full description of the item
  • 'excerpt' - short description of the item
  • 'id' - ID of the item, e.g. sid for articles
  • 'title' - title of the item
  • 'url' - URL of the item
'excerpt' and 'description' may return the same value. Properties should be returned in the order they are listed in $what. Properties that are not available should return an empty string. Return false for errors (e.g. access denied, item does not exist, etc.).




Tags:

return:  string or array of strings with the information
link:  http://wiki.geeklog.net/index.php/PLG_getItemInfo


Parameters

string   $type   plugin type (incl. 'article' for stories)
string   $id   ID of an item under the plugin's control or '*'
string   $what   comma-separated list of item properties
int   $uid   user ID or 0 = current user
array   $options   (reserved for future extensions)
[ Top ]



PLG_getMenuItems [line 436]

array PLG_getMenuItems( )

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.




Tags:

return:  Returns menu options for plugin


[ Top ]



PLG_getMetaTags [line 3408]

string PLG_getMetaTags( string $type, string $id, [ $myTags = array()])

This function is called from COM_siteHeader and other places where meta tags are being built and will return additional meta tags.



Tags:

return:  all meta tags
since:  Geeklog 2.1.0


Parameters

string   $type   item type of the caller, e.g. 'article', 'staticpages'
string   $id   id of the current item of the caller
string   $myTags   meta tags the caller wants to add (optional)
[ Top ]



PLG_getModerationValues [line 1112]

string PLG_getModerationValues( string $type)

This function is responsible for setting the plugin-specific values needed by moderation.php to approve stuff.



Parameters

string   $type   Plugin to call function for
[ Top ]



PLG_getParams [line 3338]

array PLG_getParams( $pi_name $pi_name)

Get list of install parameters for a plugin (including dependencies) For plugins with new install this works like a charm. For the older plugins, not so much.



Tags:

return:  An array containing the installation parameters of a plugin
since:  Geeklog 1.8.0


Parameters

$pi_name   $pi_name   string The short name of the plugin
[ Top ]



PLG_getPluginStats [line 682]

mixed PLG_getPluginStats( int $showsitestats)

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 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




Tags:

return:  array (for mode 3) or string


Parameters

int   $showsitestats   value indicating type of stats to return
[ Top ]



PLG_getRelatedItems [line 2045]

array PLG_getRelatedItems( $types, $tids, $max, $trim)

Ask plugins if they want to add something to Geeklog's Related Items list.



Tags:

return:  A list of clickable links with the key being the timestamp


Parameters

   $types  
   $tids  
   $max  
   $trim  
[ Top ]



PLG_getSearchTypes [line 751]

array PLG_getSearchTypes( )

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.



Tags:

return:  String array of search types for plugin(s)


[ Top ]



PLG_getSubmissionCount [line 837]

int PLG_getSubmissionCount( )

Asks each plugin to report any submissions they may have in their submission queue



Tags:

return:  Number of submissions in queue for plugins


[ Top ]



PLG_getUserOptions [line 1022]

array PLG_getUserOptions( )

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

  1.  array(
  2.    array("first line""url1""1"),
  3.    array("second line""url2""44"),
  4.             etcetc)
If there is only one item, a single array is enough:
  1.  array("first line""url1""1")

NOTE: the plugin is responsible for its own security.




Tags:

return:  Returns options to add to user menu


[ Top ]



PLG_getWhatsNew [line 2085]

array PLG_getWhatsNew( )

Ask plugins if they want to add something to Geeklog's What's New block.



Tags:

return:  array($headlines[], $bylines[], $content[$entries[]])


[ Top ]



PLG_getWhatsNewComment [line 2143]

array PLG_getWhatsNewComment( [string $type = ''], [int $numreturn = 0], [int $uid = 0])

Ask plugins if they want to add new comments to Geeklog's What's New block or User Profile Page.



Tags:

return:  list of new comments (dups, type, title, sid, lastdate) or (sid, title, cid, unixdate)
since:  Geeklog 1.7.0


Parameters

string   $type   Plugin name. '' for all plugins.
int   $numreturn   If 0 will return results for What's New Block. If > 0 will return last X new comments for User Profile.
int   $uid   ID of the user to return results for. 0 = all users.
[ Top ]



PLG_groupChanged [line 1318]

void PLG_groupChanged( int $grp_id, string $mode)

This function is called to inform plugins when a group's information has changed or a new group has been created.



Parameters

int   $grp_id   Group ID
string   $mode   type of change: 'new', 'edit', or 'delete'
[ Top ]



PLG_handlePingComment [line 2375]

mixed PLG_handlePingComment( string $type, string $id, string $operation)

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.

$operation can be one of the following:

  • 'acceptByID': accept a trackback comment on item with ID $id returns: true for accept, false for reject
  • 'acceptByURI': accept a pingback comment on item at URL $id returns: the item's ID for accept, false for reject
  • 'delete': is the current user allowed to delete item with ID $id? returns: true for accept, false for reject




Tags:

return:  depends on $operation


Parameters

string   $type   plugin type
string   $id   an ID or URL, depending on the operation
string   $operation   operation to perform
[ Top ]



PLG_install [line 178]

boolean PLG_install( string $type)

Tells a plugin to install itself. NOTE: not currently used any more



Tags:

return:  Returns true on success otherwise false
link:  http://wiki.geeklog.net/index.php/Plugin_Autoinstall
deprecated:  deprecated since Geeklog 1.6.0


Parameters

string   $type   Plugin name
[ Top ]



PLG_invokeService [line 2767]

int PLG_invokeService( string $type, string $action, array $args, array &$output, array &$svc_msg)

Invoke a service



Tags:

return:  The result of the invocation
link:  http://wiki.geeklog.net/index.php/Webservices_API


Parameters

string   $type   The plugin type whose service is to be called
string   $action   The service action to be performed
array   $args   The arguments to be passed to the service invoked
array   &$output   The output variable that will contain the output after invocation
array   &$svc_msg   The output variable that will contain the service messages
[ Top ]



PLG_isModerator [line 420]

boolean PLG_isModerator( )

Checks to see if user is a plugin moderator

Geeklog is asking if the user is a moderator for any installed plugins.




Tags:

return:  True if current user is moderator of plugin otherwise false


[ Top ]



PLG_itemDeleted [line 2543]

void PLG_itemDeleted( string $id, string $type)

"Generic" plugin API: Delete item

To be called (eventually) whenever Geeklog removes an item from the database. Plugins can define their own 'itemdeleted' function to be notified whenever an item is deleted.




Tags:

since:  Geeklog 1.6.0


Parameters

string   $id   ID of the item
string   $type   type of the item, e.g. 'article'
[ Top ]



PLG_itemDisplay [line 2589]

array PLG_itemDisplay( string $id, string $type)

"Generic" plugin API: Display item

To be called (eventually) whenever Geeklog displays an item. Plugins can hook into this and add content to the displayed item, in the form of an array (true, string1, string2...).

The object that called can then display one or several items with a object-defined layout.

Plugins can signal an error by returning an array (false, 'Error Message') In case of an error, the error message will be written to the error.log and nothing will be displayed on the output.




Tags:

return:  array with a status and one or several strings


Parameters

string   $id   unique ID of the item
string   $type   type of the item, e.g. 'article'
[ Top ]



PLG_itemPreSave [line 622]

string PLG_itemPreSave( string $type, string $content)

Allows plugins a chance to handle an item before Geeklog 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




Tags:

return:  empty is no error, error message if error was encountered
author:  Mark Evans, mevans AT ecsnet DOT com
see:  PLG_commentPreSave()
access:  public


Parameters

string   $type   Type of item, i.e.; registration, contact ...
string   $content   item specific content
[ Top ]



PLG_itemSaved [line 2501]

void PLG_itemSaved( string $id, string $type, [string $old_id = ''])

"Generic" plugin API: Save item

To be called (eventually) whenever Geeklog saves an item into the database. Plugins can define their own 'itemsaved' function to be notified whenever an item is saved or modified.

NOTE: The behaviour of this API function changed in Geeklog 1.6.0




Tags:

return:  (actually: false, for backward compatibility)
link:  http://wiki.geeklog.net/index.php/PLG_itemSaved


Parameters

string   $id   unique ID of the item
string   $type   type of the item, e.g. 'article'
string   $old_id   (optional) old ID when the ID was changed
[ Top ]



PLG_loginUser [line 1239]

void PLG_loginUser( int $uid)

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.




Parameters

int   $uid   user id
[ Top ]



PLG_logoutUser [line 1265]

void PLG_logoutUser( int $uid)

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.




Parameters

int   $uid   user id
[ Top ]



PLG_migrate [line 205]

boolean PLG_migrate( string $type, array $old_conf)

Called during site migration - let plugin handle changed URLs or paths



Tags:

return:  true on success, otherwise false
link:  http://wiki.geeklog.net/index.php/PLG_migrate
since:  Geeklog 1.6.0


Parameters

string   $type   Plugin name
array   $old_conf   contents of $_CONF before the migration
[ Top ]



PLG_pluginStateChange [line 3004]

void PLG_pluginStateChange( string $type, string $status)

Inform plugins when another plugin's state changed

Unlike PLG_enableStateChange, this function is called after the state change.

NOTE: You can not rely on being informed of state changes for 'installed', 'uninstalled', and 'upgraded', as these may happen in the plugin's install script, outside of Geeklog's control.




Tags:

see:  PLG_enableStateChange()
since:  Geeklog 1.6.0


Parameters

string   $type   plugin name
string   $status   new status: 'enabled', 'disabled', 'installed', 'uninstalled', 'upgraded'
[ Top ]



PLG_printDependencies [line 3107]

string PLG_printDependencies( $pi_name $pi_name, [$pi_gl_version $pi_gl_version = ''])

Returns a string with HTML that contains the dependency information of a plugin.



Tags:

return:  An string that contains HTML code.
since:  Geeklog 1.8.0


Parameters

$pi_name   $pi_name   string The short name of the plugin
$pi_gl_version   $pi_gl_version   string Specify a minimum version of Geeklog to require. (Optional and only for use with plugins that have the old-style install.)
[ Top ]



PLG_profileBlocksDisplay [line 1426]

string PLG_profileBlocksDisplay( int $uid)

Geeklog is about to display the user's profile. Plugins now get a chance to add their own blocks below the standard profile form.



Tags:

return:  HTML for additional block(s)


Parameters

int   $uid   user id of the user profile to be edited
[ Top ]



PLG_profileBlocksEdit [line 1371]

string PLG_profileBlocksEdit( int $uid)

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.



Tags:

return:  HTML for additional block(s)


Parameters

int   $uid   user id of the user profile to be edited
[ Top ]



PLG_profileExtrasSave [line 1458]

void PLG_profileExtrasSave( [string $plugin = ''])

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.




Parameters

string   $plugin   name of a specific plugin or empty(all plugins)
[ Top ]



PLG_profileVariablesDisplay [line 1401]

void PLG_profileVariablesDisplay( int $uid, ref &$template)

Geeklog is about to display the user's profile. Plugins now get a chance to add their own variables to the profile.



Parameters

int   $uid   user id of the user profile to be edited
ref   &$template   reference of the Template for the profile edit form
[ Top ]



PLG_profileVariablesEdit [line 1346]

void PLG_profileVariablesEdit( int $uid, ref &$template)

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.



Parameters

int   $uid   user id of the user profile to be edited
ref   &$template   reference of the Template for the profile edit form
[ Top ]



PLG_replaceTags [line 1650]

void PLG_replaceTags( string $content, [string $plugin = ''], [string $remove = false])

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]




Parameters

string   $content   Content that should be parsed for autolinks
string   $plugin   Optional if you only want to parse using a specific plugin
string   $remove   Optional if you want to remove the autotag from the content
[ Top ]



PLG_resolveDependencies [line 3031]

bool PLG_resolveDependencies( )

Disables all plugins with unresolved dependencies and resolves the load order for all enabled plugins.



Tags:

return:  True or False, depending on whether it was necessary to alter the load order of a plugin
since:  Geeklog 1.8.0


[ Top ]



PLG_runScheduledTask [line 2393]

void PLG_runScheduledTask( )

Check if plugins have a scheduled task they want to run The interval between runs is determined by $_CONF['cron_schedule_interval']



[ Top ]



PLG_saveSubmission [line 1076]

boolean PLG_saveSubmission( string $type, array $A)

This function calls the plugin_savesubmission_<pluginname> to save a user submission



Tags:

return:  Returns true on success otherwise false


Parameters

string   $type   Plugin to save submission for
array   $A   holds plugin specific data to save
[ Top ]



PLG_showCenterblock [line 1145]

string PLG_showCenterblock( [int $where = 1], [int $page = 1], [string $topic = ''])

This function will show the centerblock for any plugin.

Plugin can display some of their own content in a block on the index or any topic index page. The block can be at the top or bottom of the page, after the featured story or the plugin can take over the entire page. The plugin is responsible to format the output correctly.




Tags:

return:  Formatted center block content
since:  Geeklog 1.3.8


Parameters

int   $where   where 1 = top, 2 = after feat. story, 3 = bottom of page, 0 = entire page
int   $page   page number (1, ...)
string   $topic   topic ID or empty string == front page
[ Top ]



PLG_showModerationList [line 1091]

string PLG_showModerationList( string $token)

This function starts the chain of calls needed to show any submissions needing moderation for the plugins.



Tags:

return:  returns list of items needing moderation for plugins


Parameters

string   $token   security token
[ Top ]



PLG_showSubmitForm [line 1125]

string PLG_showSubmitForm( string $type)

This function is resonsible for calling plugin_submit_<pluginname> so that the submission form for the plugin is displayed.



Tags:

return:  HTML for submit form for plugin


Parameters

string   $type   Plugin to show submission form for
[ Top ]



PLG_spamAction [line 2279]

int PLG_spamAction( string $content, [int $action = -1])

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.




Tags:

return:  > 0: spam detected, == 0: no spam detected
see:  PLG_checkforSpam()
since:  Geeklog 1.4.1


Parameters

string   $content   Text to be filtered or checked for spam
int   $action   what to do if spam found
[ Top ]



PLG_submissionDeleted [line 2458]

void PLG_submissionDeleted( string $type)

"Generic" plugin API: Delete submission

Called whenever Geeklog removes a submission from the database. Plugins can define their own 'submissiondeleted' function to be notified whenever an submission is deleted.




Parameters

string   $type   type of the item, e.g. 'article'
[ Top ]



PLG_submissionSaved [line 2419]

void PLG_submissionSaved( string $type)

"Generic" plugin API: Save submission

Called whenever Geeklog saves a submission into the database. Plugins can define their own 'submissionsaved' function to be notified whenever an submission is saved.




Parameters

string   $type   type of the item, e.g. 'article'
[ Top ]



PLG_supportingFeeds [line 1759]

array PLG_supportingFeeds( )

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



Tags:

return:  array of plugin names (can be empty)


[ Top ]



PLG_templateSetVars [line 1493]

void PLG_templateSetVars( string $templatename, ref &$template)

This function can be called to check if a plugin wants to set a template variable

A plugin can check for $templatename == 'header' and then set additional template variables

Called from within Geeklog for:

  • 'header' (site header)
  • 'footer' (site footer)
  • 'storytext', 'featuredstorytext', 'archivestorytext' (story templates)
  • 'story' (story submission)
  • 'comment' (comment submission form)
  • 'registration' (user registration form)
  • 'contact' (email user form)
  • 'emailstory' (email story to a friend)
  • 'loginblock' (login form in the side bar)
  • 'loginform' (login form in the content area)
  • 'search' (advanced search form; simple search is usually part of 'header')




Tags:



Parameters

string   $templatename   Name of calling template
ref   &$template   reference for the Template
[ Top ]



PLG_uninstall [line 238]

boolean PLG_uninstall( string $type)

Tells a plugin to uninstall itself.



Tags:

return:  Returns true on success otherwise false
link:  http://wiki.geeklog.net/index.php/Plugin_Auto-Uninstall


Parameters

string   $type   Plugin to uninstall
[ Top ]



PLG_upgrade [line 190]

mixed PLG_upgrade( string $type)

Upgrades a plugin. Tells a plugin to upgrade itself.



Tags:

return:  true on success, false or error number on failure


Parameters

string   $type   Plugin name
[ Top ]



PLG_userInfoChanged [line 1290]

void PLG_userInfoChanged( int $uid)

This function is called to inform plugins when a user's information (profile or preferences) has changed.



Parameters

int   $uid   user id
[ Top ]



PLG_wsEnabled [line 2802]

boolean PLG_wsEnabled( string $type)

Returns true if the plugin supports webservices



Tags:

return:  true: enabled, false: disabled
link:  http://wiki.geeklog.net/index.php/Webservices_API


Parameters

string   $type   The plugin type that is to be checked
[ Top ]



Documentation generated on Sun, 02 Oct 2016 07:51:29 +0000 by phpDocumentor 1.4.3