glFusion Wiki

Site Tools


glfusion:development:api:plg:functions

lib-plugins.php

These APIs allow plugins to get very tight integration with glFusion.

PLG_afterSaveSwitch

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

Forward the user depending on config setting after saving something

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

Return

The URL where the user will be forwarded to

PLG_approveSubmission

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.

Parameters

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

Return

Returns TRUE on success, FALSE otherwise.

Calls

plugin_moderationapproves_{pluginname}

PLG_checkforSpam

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

Allows plugins and Core glFusion Components to filter out spam.

The Spam-X Plugin is now part of the glFusion 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

echo COM_refresh ($_CONF['site_url'] . '/index.php?msg=' . $result&plugin=spamx');

or by

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.

Parameters

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

Return

0 = no spam detected

Greater than 0 : spam detected

Calls

plugin_checkforSpam_{pluginname}

PLG_chkVersion

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.

Parameters

string $type Plugin name

Return

Returns true on success otherwise false

Calls

plugin_chkVersion_{pluginname}

PLG_commentDelete

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

Plugin should delete a comment

Parameters

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

Return

False for failure, HTML string (redirect?) for success

Calls

plugin_deletecomment_{pluginname}

PLG_commentEditSave

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

Called when a plugin's comment is edited (and saved).

Parameters

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

Return

False for failure, HTML string (redirect?) for success

Calls

plugin_editcomment_{pluginname}

PLG_commentPreSave

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

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

PLG_commentSave

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

Plugin should save a comment

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'

Return

False for failure, HTML string (redirect?) for success

PLG_createUser

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

PLG_deleteSubmission

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.

Parameters

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

Return

Returns true on success otherwise false

PLG_deleteUser

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

PLG_displayAdBlock

string PLG_displayAdBlock( $plugin, $counter)

This function is called after each item is displayed - allows a plugin to hook into the display and insert ad blocks.

EXPERIMENTAL

Parameters

PLG_displayComment

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]

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)

Return

results of calling the plugin_displaycomment_ function

PLG_doSearch

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

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)

Return

Returns search results

PLG_doSearchComment

array PLG_doSearchComment( 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 on their comments and return their results. Results come back in an array of HTML formatted table rows that can be quickly printed by search.php

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)

Return

Returns search results

PLG_enableStateChange

boolean PLG_enableStateChange( string $type, boolean $enable)

Inform plugin that it is either being enabled or disabled.

Parameters

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

Return

Returns true on success otherwise false

See Also

PLG_pluginStateChange()

PLG_feedUpdateCheck

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

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

Return

false = feed has to be updated, true = ok

Notes

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.

PLG_getAdminOptions

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

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

Returns options to put in admin menu

PLG_getBlocks

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

Gets glFusion blocks from plugins

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

Parameters

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

Return

array of block data

PLG_getCCOptions

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

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

Returns Command and Control options

PLG_getConfigElementHelp

(glFusion v1.1.6)

array PLG_getConfigElementHelp( string $type, string $option, [string $doclang = 'english'] )

Ask plugin to return the help URL for a configuration element.

Parameters

string $type Plugin name
string $option configuration option name
string $doclang Currently selected language name (optional)

Return

Array containing URL and window type (0=same window, 1=pop-up window)

PLG_getCommentUrlId

array PLG_getCommentUrlId( string $type)

Get view URL and name of unique identifier

Parameters

string $type Plugin to delete comment

Return

string of URL of view page, name of unique identifier

PLG_getFeedContent

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.

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.

Return

content of feed

PLG_getFeedElementExtensions

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.

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.

Return

list of extension tags

PLG_getFeedExtensionTags

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.

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.

Return

list of meta tag extensions

PLG_getFeedNames

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.

Parameters

string $plugin plugin name

Return

array of id/name pairs

PLG_getFeedNSExtensions

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.

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.

Return

list of extension namespaces

PLG_getHeaderCode

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

Return

returns a concatenated string of all plugins extra header code

PLG_getIcon

string PLG_getIcon( string $type)

Get the URL of a plugin's icon

Parameters

string $type plugin name

Return

URL of the icon

PLG_getItemInfo

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 (formatted)
  • 'raw-description' - full description - raw text no PLG_replaceTags() or other formatting
  • '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
  • 'label' - The plugin's text label (i.e.; StaticPages, Media Gallery, etc.)

'excerpt' and 'description' may return the same value. Properties that are not available should return an empty string. Return false for errors (e.g. access denied, item does not exist, etc.).

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)

Return

string or array of strings with the information

PLG_getMenuItems

array PLG_getMenuItems( )

Gives plugins a chance to print their menu items in header

Return

Returns menu options for plugin

Notes

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.

PLG_getModerationValues

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

PLG_getPluginStats

mixed PLG_getPluginStats( int $showsitestats)

The way this function works is very specific to how glFusion shows its statistics. On stats.php, there is the top box which gives overall statistics for glFusion and then there are blocks below it that give more specific statistics for various components of glFusion.

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

Parameters

int $showsitestats value indicating type of stats to return

Return

array (for mode 3) or string

PLG_getSearchTypes

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.

Return

String array of search types for plugin(s)

PLG_getSubmissionCount

int PLG_getSubmissionCount( )

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

Return

Number of submissions in queue for plugins

PLG_getUserOptions

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

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

Returns options to add to user menu

Notes

The plugin is responsible for its own security.

PLG_getWhatsNew

array PLG_getWhatsNew( )

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

Return

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

PLG_getWhatsNewComment

array PLG_getWhatsNewComment( )

Ask plugins if they want to add any comments to the What's New block comment section.

Return

array( commentrows )

PLG_groupChanged

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'

PLG_handlePingComment

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

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

glFusion 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

Parameters

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

Return

depends on $operation

PLG_install

boolean PLG_install( string $type)

DEPRECIATED

See Plugin Auto Installation

PLG_invokeService

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

Invoke a service

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

Return

The result of the invocation

PLG_isModerator

boolean PLG_isModerator( )

Checks to see if user is a plugin moderator

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

Return

True if current user is moderator of plugin otherwise false

PLG_isOnPageLoad

string PLG_isOnPageLoad( )

Allows a plugin to insert JavaScript to be executed by the Infinite Scroll library after new items have been loaded.

Return

The JavaScript to insert into the afterPageLoad() JS function.

PLG_itemDeleted

(glFusion v1.1.6)

void PLG_itemDeleted( string $id, string $type)

“Generic” plugin API: Delete item

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

Parameters

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

PLG_itemPreSave

string PLG_itemPreSave( string $type, string $content)

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

Parameters

string $type Type of item, i.e.; registration, contact …
string $content item specific content

Return

empty is no error, error message if error was encountered

See Also

PLG_commentPreSave()

PLG_itemSaved

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

“Generic” plugin API: Save item

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

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

Return

(actually: false, for backward compatibility)

PLG_loginUser

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

PLG_logoutUser

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

PLG_profileBlocksDisplay

string PLG_profileBlocksDisplay( int $uid)

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

Parameters

int $uid user id of the user profile to be edited

Return

HTML for additional block(s)

PLG_profileBlocksEdit

string PLG_profileBlocksEdit( int $uid)

DEPRECIATED - See PLG_profileEdit()

PLG_profileEdit

string PLG_profileEdit( int $uid, [string $panel = ''], [string $fieldset = ''])

glFusion 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 uid of the user being edited
string $panel name of the panel being displayed.
Panel names are:

- namepass
- userinfo
- layout
- content
- privacy

A panel corresponds to the profile tab. Each panel consists of one or more fieldsets. The fieldset parameter is used to allow a plugin to add new fields to the existing fieldset. The function is also called with an empty fieldset value, which allows the plugin to insert their own complete fieldset on that panel.
string $fieldset name of the fieldset being displayed.
Fieldset names are:

namepass panel
- name
- pwdemail
userinfo panel
- personalinfo
layout panel
- display
- comment
content panel
- exclude
- digest
- boxes
privacy pane
- privacy

Return

Returns the HTML to add to the profile panels.

Notes

The PLG_profileEdit() API will be called for each panel/fieldset combination, each panel, and one final time with no panel or fieldset. When called with no panel or fieldset, this gives the plugin the opportunity to add their own fieldset to the panel.

See Also

PLG_profileSave()

PLG_profileExtrasSave

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

DEPRECIATED - See PLG_profileSave()

PLG_profileSave

(glFusion v1.1.5)

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

This function will call the plugin's plugin_profilesave_{pluginname} function. The plugin can then process their variables from the $_POST array.

Parameters

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

Return

Void

Notes It will be up to the plugin's plugin_profilesave_{pluginname} function to retrieve the proper $_POST variables and process them.

PLG_profileVariablesDisplay

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

glFusion 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

PLG_profileVariablesEdit

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

DEPRECIATED - See PLG_profileEdit()

PLG_replaceSocialShare

string PLG_replaceSocialShare($type,$title,$url,$desc)

Allows a plugin to replace the Social Share buttons displayed in the footer of stories, media gallery items, etc.

PLG_replaceTags

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

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

Parameters

string $content Content that should be parsed for autolinks
string $plugin Optional if you only want to parse using a specific plugin

PLG_runScheduledTask

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

PLG_saveSubmission

boolean PLG_saveSubmission( string $type, array $A)

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

Parameters

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

Return

Returns true on success otherwise false

PLG_showCenterblock

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.

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

Return

Formatted center block content

PLG_showModerationList

string PLG_showModerationList( string $token)

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

Parameters

string $token security token

Return

returns list of items needing moderation for plugins

PLG_showSubmitForm

string PLG_showSubmitForm( string $type)

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

Parameters

string $type Plugin to show submission form for

Return

HTML for submit form for plugin

PLG_spamAction

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.

Parameters

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

Return

0: spam detected, == 0: no spam detected

See Also

PLG_checkforSpam()

PLG_supportingFeeds

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

Return

array of plugin names (can be empty)

PLG_templateSetVars

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

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 check for $templatename == 'header' and then set additional template variables

Parameters

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

See Also

CUSTOM_templateSetVars()

PLG_uninstall

boolean PLG_uninstall( string $type)

Tells a plugin to uninstall itself.

Parameters

string $type Plugin to uninstall

Return

Returns true on success otherwise false

PLG_upgrade

mixed PLG_upgrade( string $type)

Upgrades a plugin. Tells a plugin to upgrade itself.

Parameters

string $type Plugin name

Return

true on success, false or error number on failure

PLG_userInfoChanged

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

PLG_wsEnabled

boolean PLG_wsEnabled( string $type)

Returns true if the plugin supports webservices

Parameters

string $type The plugin type that is to be checked

Return

true: enabled, false: disabled

See Also

Webservices_API

glfusion/development/api/plg/functions.txt · Last modified: 2017/04/12 21:15 (external edit)

Page Tools