[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/plugins/ -> _plugin.class.php (sommaire)

This file implements the abstract {@link Plugin} class. This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

Author: fplanque: Francois PLANQUE - {@link http://fplanque.net/}
Author: blueyed: Daniel HAHLER
Copyright: (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}
Version: $Id: _plugin.class.php,v 1.4 2007/09/22 22:11:18 fplanque Exp $
Poids: 3106 lignes (101 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

Plugin:: (127 méthodes):
  Plugin()
  PluginInit()
  GetDefaultSettings()
  GetDefaultUserSettings()
  get_widget_param_definitions()
  GetDependencies()
  GetDbLayout()
  GetExtraEvents()
  GetHtsrvMethods()
  GetCronJobs()
  ExecCronJob()
  AdminAfterMenuInit()
  AdminEndHtmlHead()
  AdminAfterPageFooter()
  AdminDisplayEditorButton()
  AdminDisplayToolbar()
  AdminToolAction()
  AdminToolPayload()
  AdminTabAction()
  AdminTabPayload()
  AdminBeginPayload()
  BeforeBlogDisplay()
  SkinBeginHtmlHead()
  SkinEndHtmlBody()
  GetProvidedSkins()
  DisplaySkin()
  BeforeInstall()
  AfterInstall()
  BeforeUninstall()
  BeforeUninstallPayload()
  BeforeEnable()
  BeforeDisable()
  PluginVersionChanged()
  RenderItemAsHtml()
  RenderItemAsXml()
  RenderItemAsText()
  DisplayItemAsHtml()
  DisplayItemAsXml()
  DisplayItemAsText()
  PrependItemUpdateTransact()
  AfterItemUpdate()
  PrependItemInsertTransact()
  AfterItemInsert()
  AfterItemDelete()
  AppendItemPreviewTransact()
  ItemViewsIncreased()
  AdminDisplayItemFormFieldset()
  AdminBeforeItemEditDelete()
  AdminBeforeItemEditCreate()
  AdminBeforeItemEditUpdate()
  ItemCanComment()
  ItemSendPing()
  DisplayTrackbackAddr()
  ItemApplyAsRenderer()
  DisplayCommentToolbar()
  AdminDisplayCommentFormFieldset()
  DisplayCommentFormFieldset()
  DisplayCommentFormButton()
  CommentFormSent()
  BeforeCommentFormInsert()
  AfterCommentFormInsert()
  GetSpamKarmaForComment()
  AfterCommentUpdate()
  AfterCommentInsert()
  AfterCommentDelete()
  BeforeTrackbackInsert()
  FilterCommentAuthor()
  FilterCommentAuthorUrl()
  FilterCommentContent()
  DisplayMessageFormFieldset()
  DisplayMessageFormButton()
  MessageFormSent()
  MessageFormSentCleanup()
  CacheObjects()
  CachePageContent()
  CacheIsCollectingContent()
  PluginSettingsValidateSet()
  PluginSettingsUpdateAction()
  PluginSettingsEditAction()
  PluginSettingsEditDisplayAfter()
  PluginUserSettingsValidateSet()
  PluginUserSettingsUpdateAction()
  PluginUserSettingsEditAction()
  PluginUserSettingsEditDisplayAfter()
  AfterLoginAnonymousUser()
  AfterLoginRegisteredUser()
  AppendUserRegistrTransact()
  AfterUserRegistration()
  DisplayRegisterFormFieldset()
  RegisterFormSent()
  DisplayLoginFormFieldset()
  LoginAttempt()
  LoginAttemptNeedsRawPassword()
  Logout()
  DisplayValidateAccountFormFieldset()
  ValidateAccountFormSent()
  AlternateAuthentication()
  AfterUserUpdate()
  AfterUserInsert()
  AfterUserDelete()
  CaptchaPayload()
  CaptchaValidated()
  CaptchaValidatedCleanup()
  FilterIpAddress()
  SessionLoaded()
  get_class_id()
  T_()
  get_plugin_url()
  debug_log()
  get_htsrv_url()
  msg()
  register_menu_entry()
  are_events_available()
  set_status()
  get_sql_table()
  stop_propagation()
  session_set()
  session_get()
  session_delete()
  forget_events()
  disable_event()
  enable_event()
  get_help_link()
  get_help_url()
  get_README_link()
  get_help_file()
  get_edit_settings_link()


Classe: Plugin  - X-Ref

Plugin Class

Real plugins should be derived from this class.

Plugin()   X-Ref
Constructor.

You should not use a constructor with your plugin, but the
{@link Plugin::PluginInit()} method instead!

PluginInit( & $params )   X-Ref
Init the Plugin after it has been registered/instantiated.

Should set name and description in a localizable fashion.

This gets called on every instantiated plugin, also if it's just for
discovering the list of available plugins in the backoffice.

Use this to validate Settings/requirements and/or cache them into class properties.

param: array Associative array of parameters.
return: boolean If this method returns false, the Plugin gets unregistered (for the current request only).

GetDefaultSettings( & $params )   X-Ref
Define default settings here.
Those can then be edited in the backoffice.

You can access them in the plugin through the member object
{@link Plugin::$Settings}, e.g.:
<code>$this->Settings->get( 'my_param' );</code>

fp> this is unclear: You probably don't need to set or change values (other than the
defaultvalues), but if you know what you're doing, see
{@link PluginSettings}, where {@link Plugin::$Settings} gets derived from.

NOTE: this method gets called by b2evo when instantiating the plugin
settings and when the settings get displayed for editing in the backoffice.
In the second case, $params['for_editing'] will be true.

param: array Associative array of parameters (since 1.9).
return: array

GetDefaultUserSettings( & $params )   X-Ref
Define here default user settings that are then available in the backoffice.

You can access them in the plugin through the member object
{@link $UserSettings}, e.g.:
<code>$this->UserSettings->get( 'my_param' );</code>

This method behaves exactly like {@link Plugin::GetDefaultSettings()},
except that it defines user specific settings instead of global settings.

param: array Associative array of parameters.
return: array See {@link Plugin::GetDefaultSettings()}.

get_widget_param_definitions( $params )   X-Ref
Get definitions for widget specific editable params

param: local params like 'for_editing' => true

GetDependencies()   X-Ref
Get the list of dependencies that the plugin has.

This gets checked on install or uninstall of a plugin.

There are two <b>classes</b> of dependencies:
- 'recommends': This is just a recommendation. If it cannot get fulfilled
there will just be a note added on install.
- 'requires': A plugin cannot be installed if the dependencies cannot get
fulfilled. Also, a plugin cannot get uninstalled, if another
plugin depends on it.

Each <b>class</b> of dependency can have the following types:
- 'events_by_one': A list of eventlists that have to be provided by a single plugin,
e.g., <code>array( array('CaptchaPayload', 'CaptchaValidated') )</code>
to look for a plugin that provides both events.
- 'plugins':
A list of plugins, either just the plugin's classname or an array with
classname and minimum version of the plugin (see {@link Plugin::$version}).
E.g.: <code>array( 'test_plugin', '1' )</code> to require at least version "1"
of the test plugin.
- 'app_min': Minimum application (b2evo) version, e.g. "1.9".
This way you can make sure that the hooks you need are implemented
in the core.
(Available since b2evo 1.8.3. To make it work before 1.8.2 use
"api_min" and check for array(1, 2) (API version of 1.9)).
- 'api_min': You can require a specific minimum version of the Plugins API here.
If it's just a number, only the major version is checked against.
To check also for the minor version, you have to give an array:
array( major, minor ).
Obsolete since 1.9! Used API versions: 1.1 (b2evo 1.8.1) and 1.2 (b2evo 1.9).

return: array

GetDbLayout()   X-Ref
This method should return your DB schema, consisting of a list of CREATE TABLE
queries.

The DB gets changed accordingly on installing or enabling your Plugin.

If you want to change your DB layout in a new version of your Plugin, simply
adjust the queries here and increase {@link Plugin::$version}, because this will
request to check the current DB layout against the one you require.

For restrictions see {@link db_delta()}.

GetExtraEvents()   X-Ref
This method gets asked when plugins get installed and allows you to return a list
of extra events, which your plugin triggers itself (e.g. through
{@link $Plugins->trigger_event()}).

NOTE: PLEASE use a distinct prefix for the event name, e.g. "$this->classname".

NOTE: The length of event names is limited to 40 chars.

NOTE: Please comment the params and the return value here with the list
that you return. Only informal as comment, but makes it easier for
others.

return: NULL|array "event_name" => "description"

GetHtsrvMethods()   X-Ref
Override this method to define methods/functions that you want to make accessible
through /htsrv/call_plugin.php, which allows you to call those methods by HTTP request.

This is useful for things like AJAX or displaying an <iframe> element, where the content
should get provided by the plugin itself.

E.g., the image captcha plugin uses this method to serve a generated image.

NOTE: the Plugin's method must be prefixed with "htsrv_", but in this list (and the URL) it
is not. E.g., to have a method "disp_image" that should be callable through this method
return <code>array('disp_image')</code> here and implement it as
<code>function htsrv_disp_image( $params )</code> in your plugin.
This is used to distinguish those methods from others, but keep URLs nice.

return: array

GetCronJobs( & $params )   X-Ref
This method gets asked for a list of cronjobs that the plugin
provides.
If a user installs a cron job out of this list, the
{@link Plugin::ExecCronJob()} of the plugin gets called.

return: array Array of arrays with keys "name", "ctrl" and "params".

ExecCronJob( & $params )   X-Ref
Execute/handle a cron job, which has been scheduled by the admin out
of the list that the Plugin provides (see {@link GetCronJobs()}).

param: array Associative array of parameters
return: array with keys "code" (integer, 1 is ok), "message" (gets logged)

AdminAfterMenuInit()   X-Ref
Event handler: Gets invoked in /admin.php for every backoffice page after
the menu structure is build. You could use the {@link $AdminUI} object
to modify it.

This is the hook to register menu entries. See {@link register_menu_entry()}.

AdminEndHtmlHead( & $params )   X-Ref
Event handler: Called when ending the admin html head section.

param: array Associative array of parameters
return: boolean did we do something?

AdminAfterPageFooter( & $params )   X-Ref
Event handler: Called right after displaying the admin page footer.

param: array Associative array of parameters
return: boolean did we do something?

AdminDisplayEditorButton( $params )   X-Ref
Event handler: Called when displaying editor buttons.

This method, if implemented, should output the buttons
(probably as html INPUT elements) and return true, if
button(s) have been displayed.

You should provide an unique html ID with your button.

param: array Associative array of parameters.
return: boolean did we display a button?

AdminDisplayToolbar( & $params )   X-Ref
Event handler: Called when displaying editor toolbars.

param: array Associative array of parameters
return: boolean did we display a toolbar?

AdminToolAction()   X-Ref
Event handler: Called when handling actions for the "Tools" menu.

Use {@link msg()} to add messages for the user.

AdminToolPayload()   X-Ref
Event handler: Called when displaying the block in the "Tools" menu.

return: boolean did we display something?

AdminTabAction()   X-Ref
Event handler: Method that gets invoked when our tab is selected.

You should catch (your own) params (using {@link param()}) here and do actions
(but no output!).

Use {@link msg()} to add messages for the user.

AdminTabPayload()   X-Ref
Event handler: Gets invoked when our tab is selected and should get displayed.

Do your output here.

return: boolean did we display something?

AdminBeginPayload()   X-Ref
Event handler: Gets invoked before the main payload in the backoffice.


BeforeBlogDisplay( & $params )   X-Ref
Event handler: Called before a blog gets displayed (in _blog_main.inc.php).


SkinBeginHtmlHead( & $params )   X-Ref
Event handler: Called at the beginning of the skin's HTML HEAD section.

Use this to add any HTML HEAD lines (like CSS styles or links to resource
files (CSS, JavaScript, ..)).

SkinEndHtmlBody( & $params )   X-Ref
Event handler: Called at the end of the skin's HTML BODY section.

Use this to add any HTML snippet at the end of the generated page.

GetProvidedSkins()   X-Ref
Event handler: Gets asked about a list of skin names that the plugin handles.

If one of the skins returned gets called through the "skin=X" URL param, the
{@link Plugin::DisplaySkin()} method of your plugin gets called.

return: array

DisplaySkin( & $params )   X-Ref
Event handler: Display a skin. Use {@link Plugin::GetProvidedSkins()} to return
a list of names that you register.

param: array Associative array of parameters

BeforeInstall()   X-Ref
Event handler: Called before the plugin is going to be installed.

This is the hook to create any DB tables or the like.

If you just want to add a note, use {@link Plugin::msg()} (and return true).

return: true|string True, if the plugin can be enabled/activated,

AfterInstall()   X-Ref
Event handler: Called after the plugin has been installed.


BeforeUninstall( & $params )   X-Ref
Event handler: Called before the plugin is going to be un-installed.

This is the hook to remove any files or the like - tables with canonical names
(see {@link Plugin::get_sql_table()}, are handled internally.

See {@link BeforeUninstallPayload()} for the corresponding payload handler, which you
can request to invoke by returning NULL here.

Note: this method gets called again, if the uninstallation has to be confirmed,
either because you've requested a call to {@link BeforeUninstallPayload()}
or there are tables to be dropped (what the admin user has to confirm).

param: array Associative array of parameters.
return: boolean|NULL

BeforeUninstallPayload( & $params )   X-Ref
Event handler: Gets invoked to display the payload before uninstalling the plugin.

You have to request a call to this during the plugin uninstall procedure by
returning NULL in {@link BeforeUninstall()}.

param: array Associative array of parameters.

BeforeEnable()   X-Ref
Event handler: Called when the admin tries to enable the plugin, changes
its configuration/settings and after installation.

Use this, if your plugin needs configuration before it can be used.

return: true|string True, if the plugin can be enabled/activated,

BeforeDisable()   X-Ref
Event handler: Your plugin gets notified here, just before it gets
disabled.

You cannot prevent this, but only clean up stuff, if you have to.


PluginVersionChanged( & $params )   X-Ref
Event handler: Called when we detect a version change (in {@link Plugins::register()}).

Use this for your upgrade needs.

param: array Associative array of parameters.
return: boolean If this method returns false, the Plugin's status gets changed to "needs_config" and

RenderItemAsHtml( & $params )   X-Ref
Event handler: Called when rendering item/post contents as HTML. (CACHED)

The rendered content will be *cached* and the cached content will be reused on subsequent displays.
Use {@link DisplayItemAsHtml()} instead if you want to do rendering at display time.

Note: You have to change $params['data'] (which gets passed by reference).

param: array Associative array of parameters
return: boolean Have we changed something?

RenderItemAsXml( & $params )   X-Ref
Event handler: Called when rendering item/post contents as XML.

Should this plugin apply to XML?
It should actually only apply when:
- it generates some content that is visible without HTML tags
- it removes some dirty markup when generating the tags (which will get stripped afterwards)
Note: htmlentityencoded is not considered as XML here.

Note: You have to change $params['data'] (which gets passed by reference).

param: array Associative array of parameters
return: boolean Have we changed something?

RenderItemAsText()   X-Ref
Event handler: Called when rendering item/post contents other than XML or HTML.

Note: return value is ignored. You have to change $params['data'].

param: array Associative array of parameters
return: boolean Have we changed something?

DisplayItemAsHtml( & $params )   X-Ref
Event handler: Called when displaying an item/post's content as HTML.

This is different from {@link RenderItemAsHtml()}, because it gets called
on every display (while rendering gets cached).

param: array Associative array of parameters
return: boolean Have we changed something?

DisplayItemAsXml( & $params )   X-Ref
Event handler: Called when displaying an item/post's content as XML.

This is different from {@link RenderItemAsXml()}, because it gets called
on every display (while rendering gets cached).

param: array Associative array of parameters
return: boolean Have we changed something?

DisplayItemAsText( & $params )   X-Ref
Event handler: Called when displaying an item/post's content as text.

This is different from {@link RenderItemAsText()}, because it gets called
on every display (while rendering gets cached).

param: array Associative array of parameters
return: boolean Have we changed something?

PrependItemUpdateTransact( & $params )   X-Ref
Event handler: called at the beginning of {@link Item::dbupdate() updating
an item/post in the database}.

Use this to manipulate the {@link Item}, e.g. adding a renderer code
through {@link Item::add_renderer()}.

param: array Associative array of parameters

AfterItemUpdate( & $params )   X-Ref
Event handler: called at the end of {@link Item::dbupdate() updating
an item/post in the database}, which means that it has been changed.

param: array Associative array of parameters

PrependItemInsertTransact( & $params )   X-Ref
Event handler: called at the beginning of {@link Item::dbinsert() inserting
an item/post in the database}.

Use this to manipulate the {@link Item}, e.g. adding a renderer code
through {@link Item::add_renderer()}.

param: array Associative array of parameters

AfterItemInsert( & $params )   X-Ref
Event handler: called at the end of {@link Item::dbinsert() inserting
a item/post into the database}, which means it has been created.

param: array Associative array of parameters

AfterItemDelete( & $params )   X-Ref
Event handler: called at the end of {@link Item::dbdelete() deleting
an item/post from the database}.

param: array Associative array of parameters

AppendItemPreviewTransact( & $params )   X-Ref
Event handler: called when instantiating an Item for preview.

param: array Associative array of parameters

ItemViewsIncreased( & $params )   X-Ref
Event handler: Called when the view counter of an item got increased.

param: array Associative array of parameters

AdminDisplayItemFormFieldset( & $params )   X-Ref
Event handler: Called at the end of the "Edit item" form.

param: array Associative array of parameters
return: boolean did we display something?

AdminBeforeItemEditDelete( & $params )   X-Ref
Event handler: Called before an item gets deleted (in the backoffice).

You could {@link Plugin::msg() add a message} of
category "error" here, to prevent the comment from being deleted.

param: array Associative array of parameters

AdminBeforeItemEditCreate( & $params )   X-Ref
Event handler: Called before a new item gets created (in the backoffice).

You could {@link Plugin::msg() add a message} of
category "error" here, to prevent the comment from being inserted.

param: array Associative array of parameters

AdminBeforeItemEditUpdate( & $params )   X-Ref
Event handler: Called before an existing item gets updated (in the backoffice).

You could {@link Plugin::msg() add a message} of
category "error" here, to prevent the comment from being inserted.

param: array Associative array of parameters

ItemCanComment( & $params )   X-Ref
Event handler: the plugin gets asked if an item can receive feedback/comments.

param: array Associative array of parameters
return: boolean|string

ItemSendPing( & $params )   X-Ref
Event handler: send a ping about a new item.

param: array Associative array of parameters
return: boolean Was the ping successful?

DisplayTrackbackAddr( & $params )   X-Ref
Event handler: called to display the URL that accepts trackbacks for
an item.

param: array Associative array of parameters

ItemApplyAsRenderer( & $params )   X-Ref
Event handler: Does your Plugin want to apply as a renderer for the item?

NOTE: this is especially useful for lazy Plugins, which would look
at the content and decide, if they apply.

return: boolean|NULL If true, the Plugin gets added as a renderer, false

DisplayCommentToolbar( & $params )   X-Ref
Event handler: Called when displaying editor toolbars.

param: array Associative array of parameters
return: boolean did we display a toolbar?

AdminDisplayCommentFormFieldset( & $params )   X-Ref
Event handler: Called at the end of the "Edit comment" form.

param: array Associative array of parameters
return: boolean did we display something?

DisplayCommentFormFieldset( & $params )   X-Ref
Event handler: Called at the end of the frontend comment form.

You might want to use this to inject antispam payload to use in
in {@link GetSpamKarmaForComment()} or modify the Comment according
to it in {@link BeforeCommentFormInsert()}.

param: array Associative array of parameters

DisplayCommentFormButton( & $params )   X-Ref
Event handler: Called in the submit button section of the
frontend comment form.

param: array Associative array of parameters

CommentFormSent( & $params )   X-Ref
Event handler: Called before at the beginning, if a comment form gets sent (and received).

Use this to filter input, e.g. the OpenID uses this to provide alternate authentication.

param: array Associative array of parameters

BeforeCommentFormInsert( & $params )   X-Ref
Event handler: Called before a comment gets inserted through the public comment
form.

Use this, to validate a comment: you could {@link Plugin::msg() add a message} of
category "error" here, to prevent the comment from being inserted.

param: array Associative array of parameters

AfterCommentFormInsert( & $params )   X-Ref
Event handler: Called when a comment form has been processed and the comment
got inserted into DB.

param: array Associative array of parameters

GetSpamKarmaForComment( & $params )   X-Ref
Event handler: Called to ask the plugin for the spam karma of a comment/trackback.

This gets called just before the comment gets stored.

param: array Associative array of parameters
return: integer|NULL Spam probability (-100 - 100).

AfterCommentUpdate( & $params )   X-Ref
Event handler: called at the end of {@link Comment::dbupdate() updating
a comment in the database}, which means that it has changed.

param: array Associative array of parameters

AfterCommentInsert( & $params )   X-Ref
Event handler: called at the end of {@link Comment::dbinsert() inserting
a comment into the database}, which means it has been created.

param: array Associative array of parameters

AfterCommentDelete( & $params )   X-Ref
Event handler: called at the end of {@link Comment::dbdelete() deleting
a comment from the database}.

param: array Associative array of parameters

BeforeTrackbackInsert( & $params )   X-Ref
Event handler: called before a trackback gets recorded.

Use this, to validate a trackback: you could {@link Plugin::msg() add a message} of
category "error" here, to prevent the trackback from being accepted.

param: array Associative array of parameters

FilterCommentAuthor( & $params )   X-Ref
Event handler: called to filter the comment's author name (blog name for trackbacks)

param: array Associative array of parameters

FilterCommentAuthorUrl( & $params )   X-Ref
Event handler: called to filter the comment's author URL.
This may be either the URL only or a full link (A tag).

param: array Associative array of parameters

FilterCommentContent( & $params )   X-Ref
Event handler: called to filter the comment's content

param: array Associative array of parameters

DisplayMessageFormFieldset( & $params )   X-Ref
Event handler: Called at the end of the frontend message form, which
allows to send an email to a user/commentator.

You might want to use this to inject antispam payload to use in
in {@link MessageFormSent()}.

param: array Associative array of parameters

DisplayMessageFormButton( & $params )   X-Ref
Event handler: Called in the submit button section of the
frontend message form.

param: array Associative array of parameters

MessageFormSent( & $params )   X-Ref
Event handler: Called when a message form has been submitted.

Add messages of category "error" to prevent the message from being sent.

You can also alter the "message" or "message_footer" that gets sent here.

param: array Associative array of parameters

MessageFormSentCleanup()   X-Ref
Event handler: Called after a message has been sent through the public email form.

This is meant to cleanup generated data.

CacheObjects( & $params )   X-Ref
Event handler: called to cache object data.

param: array Associative array of parameters
return: boolean True if action was successful, false otherwise.

CachePageContent( & $params )   X-Ref
Event handler: called to cache page content (get cached content or request caching).

This method must build a unique key for the requested page (including cookie/session info) and
start an output buffer, to get the content to cache.

Note, that there are special occassions when this event does not get called, because we want
really fresh content always:
- we're generating static pages
- there gets a "dynamic object", such as "Messages" or "core.preview_Comment" transported in the session

param: array Associative array of parameters
return: boolean True if we handled the request (either returned caching data or started buffering),

CacheIsCollectingContent()   X-Ref
Event handler: gets asked for if we are generating cached content.

This is useful to not generate a list of online users or the like.

return: boolean

PluginSettingsValidateSet( & $params )   X-Ref
Event handler: Called before displaying or setting a plugin's setting in the backoffice.

param: array Associative array of parameters
return: string|NULL Return a string with an error to prevent the setting from being set

PluginSettingsUpdateAction()   X-Ref
Event handler: Called as action just before updating the {@link Plugin::$Settings plugin's settings}.

The "regular" settings from {@link GetDefaultSettings()} have been set into
{@link Plugin::$Settings}, but get saved into DB after this method has been called.

Use this to catch custom input fields from {@link PluginSettingsEditDisplayAfter()} or
add notes/errors through {@link Plugin::msg()}.

If you want to modify plugin events (see {@link Plugin::enable_event()} and
{@link Plugin::disable_event()}), you should use {@link Plugin::BeforeEnable()}, because Plugin
events get saved (according to the edit settings screen) after this event.

return: false|NULL Return false to prevent the settings from being updated to DB.

PluginSettingsEditAction()   X-Ref
Event handler: Called as action before displaying the "Edit plugin" form,
which includes the display of the {@link Plugin::$Settings plugin's settings}.

You may want to use this to check existing settings or display notes about
something.

PluginSettingsEditDisplayAfter( & $params )   X-Ref
Event handler: Called after the form to edit the {@link Plugin::$Settings} has been
displayed.

Use this to add custom input fields (and catch them in {@link PluginSettingsUpdateAction()})
or display custom output (e.g. a test link).

param: array Associative array of parameters

PluginUserSettingsValidateSet( & $params )   X-Ref
Event handler: Called before displaying or setting a plugin's user setting in the backoffice.

param: array Associative array of parameters
return: string|NULL Return a string with an error to prevent the setting from being set

PluginUserSettingsUpdateAction( & $params )   X-Ref
Event handler: Called as action just before updating the {@link Plugin::$UserSettings plugin's user settings}.

The "regular" settings from {@link GetDefaultUserSettings()} have been set into
{@link Plugin::$UserSettings}, but get saved into DB after this method has been called.

Use this to catch custom input fields from {@link PluginUserSettingsEditDisplayAfter()} or
add notes/errors through {@link Plugin::msg()}.

param: array Associative array of parameters
return: false|NULL Return false to prevent the settings from being updated to DB.

PluginUserSettingsEditAction( & $params )   X-Ref
Event handler: Called as action before displaying the "Edit user" form,
which includes the display of the {@link Plugin::$UserSettings plugin's user settings}.

You may want to use this to check existing settings or display notes about
something.

param: array Associative array of parameters

PluginUserSettingsEditDisplayAfter( & $params )   X-Ref
Event handler: Called after the form to edit the {@link Plugin::$UserSettings} has been
displayed.

Use this to add custom input fields (and catch them in {@link PluginUserSettingsUpdateAction()})
or display custom output (e.g. a test link).

param: array Associative array of parameters

AfterLoginAnonymousUser( & $params )   X-Ref
Event handler: Called at the end of the login procedure, if the
user is anonymous ({@link $current_User current User} NOT set).

Use this for example to read some cookie and define further handling of
this visitor or force them to login, by {@link Plugin::msg() adding a message}
of class "login_error", which will trigger the login screen.

AfterLoginRegisteredUser( & $params )   X-Ref
Event handler: Called at the end of the login procedure, if the
{@link $current_User current User} is set and the
user is therefor registered.

Use this for example to re-act on specific {@link Plugin::$UserSettings user settings},
e.g., call {@link Plugin::forget_events()} to de-activate the plugin for
the current request.

You can also {@link Plugin::msg() add a message} of class "login_error"
to prevent the user from accessing the site and triggering
the login screen.

AppendUserRegistrTransact( & $params )   X-Ref
Event handler: Called when a new user has registered, at the end of the
DB transaction that created this user.

If you want to modify the about-to-be-created user (if the transaction gets
committed), you'll have to call {@link User::dbupdate()} on it, because he
got already inserted (but the transaction is not yet committed).

Note: if you want to re-act on a new user,
use {@link Plugin::AfterUserRegistration()} instead!

param: array Associative array of parameters
return: boolean false if the whole transaction should get rolled back (the user does not get created).

AfterUserRegistration( & $params )   X-Ref
Event handler: Called when a new user has registered and got created.

Note: if you want to modify a new user,
use {@link Plugin::AppendUserRegistrTransact()} instead!

param: array Associative array of parameters

DisplayRegisterFormFieldset( & $params )   X-Ref
Event handler: Called at the end of the "Register as new user" form.

You might want to use this to inject antispam payload to use
in {@link Plugin::RegisterFormSent()}.

param: array Associative array of parameters

RegisterFormSent( & $params )   X-Ref
Event handler: Called when a "Register as new user" form has been submitted.

You can cancel the registration process by {@link Plugin::msg() adding a message}
of type "error".

param: array Associative array of parameters

DisplayLoginFormFieldset( & $params )   X-Ref
Event handler: Called at the end of the "Login" form.

You might want to use this to inject payload to use
in {@link LoginAttempt()}.

param: array Associative array of parameters

LoginAttempt( & $params )   X-Ref
Event handler: called when a user attemps to login.

You can prevent the user from logging in by {@link Plugin::msg() adding a message}
of type "login_error".

Otherwise, this hook is meant to authenticate a user against some
external database (e.g. LDAP) and generate a new user.

To check, if a user already exists in b2evo with that login/password, you might
want to use <code>user_pass_ok( $login, $pass_md5, true )</code>.

NOTE: if 'pass_hashed' is not empty, you won't receive the password in clear-type. It
has been hashed using client-side Javascript.
SHA1( MD5($params['pass']).$params['pass_salt'] ) should result in $params['pass_hashed']!
If you need the raw password, see {@link LoginAttemptNeedsRawPassword()}.

param: array Associative array of parameters

LoginAttemptNeedsRawPassword()   X-Ref
Event handler: your Plugin should return true here, if it needs a raw (un-hashed)
password for the {@link Plugin::LoginAttempt()} event. If any Plugin returns true
for this event, client-side hashing of the password is not used.
NOTE: this causes passwords to travel un-encrypted, unless SSL/HTTPS get used.

return: boolean True, if you need the raw password.

Logout( $params )   X-Ref
Event handler: called when a user logs out.

This is meant to cleanup data, e.g. if you use the
{@link Plugin::AlternateAuthentication()} hook.

param: array Associative array of parameters

DisplayValidateAccountFormFieldset( & $params )   X-Ref
Event handler: Called at the end of the "Validate user account" form, which gets
invoked if newusers_mustvalidate is enabled and the user has not
been validated yet.

The corresponding action event is {@link Plugin::ValidateAccountFormSent()}.

param: array Associative array of parameters

ValidateAccountFormSent( & $params )   X-Ref
Event handler: Called when a "Validate user account" form has been submitted.

You can cancel the registration process by {@link Plugin::msg() adding a message}
of type "error".

AlternateAuthentication( & $params )   X-Ref
Event handler: called at the end of the login process, if the user did not try to
login (by sending "login" and "pwd"), the session has no user attached
or only "login" is given.

This hook is meant to automagically login/authenticate an user by his/her IP address,
special cookie, etc..

If you can authenticate the user, you'll have to attach him to the {@link $Session},
either through {@link Session::set_user_ID()} or {@link Session::set_User()}.

return: boolean True, if the user has been authentificated (set in $Session)

AfterUserUpdate( & $params )   X-Ref
Event handler: called at the end of {@link User::dbupdate() updating
an user account in the database}, which means that it has been changed.

param: array Associative array of parameters

AfterUserInsert( & $params )   X-Ref
Event handler: called at the end of {@link User::dbinsert() inserting
an user account into the database}, which means it has been created.

param: array Associative array of parameters

AfterUserDelete( & $params )   X-Ref
Event handler: called at the end of {@link User::dbdelete() deleting
an user from the database}.

param: array Associative array of parameters

CaptchaPayload( & $params )   X-Ref
Event handler: general event to inject payload for a captcha test.

This does not get called by b2evolution itself, but provides an interface
to other plugins. E.g., the {@link dnsbl_antispam_plugin DNS blacklist plugin}
uses this event optionally to whitelist a user.

param: array Associative array of parameters
return: boolean True, if you have provided payload for a captcha test

CaptchaValidated( & $params )   X-Ref
Event handler: general event to validate a captcha which payload was added
through {@link CaptchaPayload()}.

This does not get called by b2evolution itself, but provides an interface
to other plugins. E.g., the {@link dnsbl_antispam_plugin DNS blacklist plugin}
uses this event optionally to whitelist a user.

NOTE: if the action is verified/completed in total, you HAVE to call
{@link CaptchaValidatedCleanup()}, so that the plugin can cleanup its data
and is not vulnerable against multiple usage of the same captcha!

param: array Associative array of parameters
return: boolean true if the catcha could be validated

CaptchaValidatedCleanup( & $params )   X-Ref
Event handler: general event to be called after an action has been taken, which
involved {@link CaptchaPayload()} and {@link CaptchaValidated()}.

This is meant to cleanup generated data for the Captcha test.

This does not get called by b2evolution itself, but provides an interface
to other plugins. E.g., the {@link dnsbl_antispam_plugin DNS blacklist plugin}
uses this event optionally to whitelist a user.

FilterIpAddress( & $params )   X-Ref
Event handler: Called when an IP address gets displayed, typically in a protected
area or for a privileged user, e.g. in the backoffice statistics menu.

param: array Associative array of parameters
return: boolean Have we changed something?

SessionLoaded()   X-Ref
Event handler: Called after initializing plugins, DB, Settings, Hit, .. but
quite early.

This is meant to be a good point for Antispam plugins to cancel the request.


get_class_id( $append = '' )   X-Ref
Get a string, unqiue for the plugin, usable in HTML form elements.

param: string Optional text to append (gets prefixed with "_").
return: string

T_( $string, $req_locale = '' )   X-Ref
Translate a given string, in the Plugin's context.

This means, that the translation is obtained from the Plugin's "locales" folder.
param: string The string (english), that should be translated
param: string Requested locale ({@link $current_locale} gets used by default)
return: string

get_plugin_url( $abs = false )   X-Ref
Get the absolute URL to the plugin's directory (where the plugins classfile is).
Trailing slash included.

param: string Get absolute URL? (or make it relative to $ReqHost)
return: string

debug_log( $msg, $add_cats = array()   X-Ref
Log a debug message.

This gets added to {@link $Debuglog the global Debuglog} with
the category '[plugin_classname]_[plugin_ID]'.

NOTE: if debugging is not enabled (see {@link $debug}), {@link $Debuglog}
is of class {@link Log_noop}, which means it does not accept nor display
messages.

param: string Message to log.
param: array Optional list of additional categories.

get_htsrv_url( $method, $params = array()   X-Ref
Get the URL to call a plugin method through http. This links to the /htsrv/call_plugin.php
file.

It uses either {@link $htsrv_url} or {@link $htsrv_url_sensitive} (if {@link $ReqHost} is on https).

NOTE: AJAX callbacks are required to be on the same domain/protocol, so if you're using absolute
blog URLs on different domains you must set {@link $htsrv_url} dynamically, to use the same domain!

param: string Method to call. This must be listed in {@link GetHtsrvMethods()}.
param: array Array of optional parameters passed to the method.
param: string Glue for additional GET params used internally.
param: string Get absolute URL? (or cut off $ReqHost at the beginning)
return: string The URL

msg( $msg, $category = 'note' )   X-Ref
A simple wrapper around the {@link $Messages} object with a default
catgory of 'note'.

param: string Message
param: string|array category ('note', 'error', 'success'; default: 'note')

register_menu_entry( $text, $path = 'tools', $menu_entry_props = array()   X-Ref
Register a tab (sub-menu) for the backoffice Tools menus.

param: string Text for the tab.
param: string|array Path to add the menu entry into.
param: array Optional params. See {@link AdminUI::add_menu_entries()}.

are_events_available( $events, $by_one_plugin = false )   X-Ref
Check if the requested list of events is provided by any or one plugin.

param: array|string A single event or a list thereof
param: boolean Make sure there's at least one plugin that provides them all?
return: boolean

set_status( $status )   X-Ref
Set the status of the plugin.

param: string 'enabled', 'disabled' or 'needs_config'
return: boolean

get_sql_table( $name )   X-Ref
Get canonical name for database tables a plugin uses, by adding an unique
prefix for your plugin instance.

You should use this when refering to your SQL table names.

E.g., for the "test_plugin" with ID 7 and the default {@link $tableprefix} of "evo_" it
would generate: "evo_plugin_test_7_log" for a requested name "log".

param: string Your name, which gets returned with the unique prefix.
return: string

stop_propagation()   X-Ref
Stop propagation of the event to next plugins (with lower priority)
in events that get triggered for a batch of Plugins.


session_set( $name, $value, $timeout, $save_immediately = false )   X-Ref
Set a data value for the session.

NOTE: the session data is limited to about 64kb, so do not use it for huge data!
Please consider using an own database table (see {@link Plugin::GetDbLayout()}).

param: string Name of the data's key (gets prefixed with 'plugIDX_' internally).
param: mixed The value
param: integer Time in seconds for data to expire (0 to disable).
param: boolean Should the data get saved immediately? (otherwise it gets saved on script shutdown)

session_get( $name, $default = NULL )   X-Ref
Get a data value for the session, using a unique prefix to the Plugin.
This checks for the data to be expired and unsets it then.

param: string Name of the data's key (gets prefixed with 'plugIDX_' internally).
param: mixed Default value to use if key is not set or has expired. (since 1.10.0)
return: mixed The value, if set; otherwise $default

session_delete( $name )   X-Ref
Delete a value from the session data, using a unique prefix to the Plugin.

param: string Name of the data's key (gets prefixed with 'plugIDX_' internally).

forget_events()   X-Ref
Call this to unregister all your events for the current request.


disable_event( $event )   X-Ref
Disable an event.

This removes it from the events table.

return: boolean True, if status has changed; false if it was disabled already

enable_event( $event )   X-Ref
Enable an event.

This adds it to the events table.

return: boolean True, if status has changed; false if it was enabled already

get_help_link( $target = '' )   X-Ref
Get a link to a help page (with icon).

param: string Target; one of the following:
return: string The html A tag, linking to the help (or empty in case of $readme, if there is none).

get_help_url()   X-Ref
Get the plugin's external help/website URL.

If {@link Plugin::$help_url} is empty, it defaults to the manual wiki.

return: string

get_README_link()   X-Ref


get_help_file()   X-Ref
Get the help file for a Plugin ID. README.LOCALE.html will take
precedence above the general (english) README.html.

return: false|string

get_edit_settings_link()   X-Ref
Get a link to edit the Plugin's settings (if the user has permission).

return: false|string



Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics