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

Procedural File: plugin_api.php

Source Location: /core/plugin_api.php



Page Details:

Plugin API Handles the initialisation, management, and execution of plugins.



Tags:

copyright:  Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
copyright:  Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
link:  http://www.mantisbt.org


Includes:

require_once(MantisPlugin.class.php) [line 33]
requires MantisPlugin.class







plugin_child [line 318]

void plugin_child( string $p_child)

Allows a plugin to declare a 'child plugin' that can be loaded from the same parent directory.



Parameters

string   $p_child   Child plugin basename.
[ Top ]



plugin_config_defaults [line 208]

void plugin_config_defaults( array $p_options)

Set plugin default values to global values without overriding anything.



Parameters

array   $p_options   Array of configuration option name/value pairs.
[ Top ]



plugin_config_delete [line 197]

void plugin_config_delete( string $p_option, [int $p_user = ALL_USERS], [int $p_project = ALL_PROJECTS])

Delete a plugin configuration option from the database.



Parameters

string   $p_option   Configuration option name
int   $p_user   User ID
int   $p_project   Project ID
[ Top ]



plugin_config_get [line 161]

void plugin_config_get( string $p_option, [multi $p_default = null], [ $p_global = false])

Get a plugin configuration option.



Parameters

string   $p_option   Configuration option name
multi   $p_default   Default option value
   $p_global  
[ Top ]



plugin_config_set [line 180]

void plugin_config_set( string $p_option, multi $p_value, [int $p_user = NO_USER], [int $p_project = ALL_PROJECTS], [int $p_access = DEFAULT_ACCESS_LEVEL])

Set a plugin configuration option in the database.



Parameters

string   $p_option   Configuration option name
multi   $p_value   Option value
int   $p_user   User ID
int   $p_project   Project ID
int   $p_access   Access threshold
[ Top ]



plugin_dependency [line 441]

integer plugin_dependency( string $p_basename, string $p_required, [ $p_initialized = false])

Check a plugin dependency given a basename and required version.

Versions are checked using PHP's library version_compare routine and allows both minimum and maximum version requirements. Returns 1 if plugin dependency is met, 0 if dependency not met, or -1 if dependency is the wrong version.




Tags:

return:  Plugin dependency status


Parameters

string   $p_basename   Plugin basename
string   $p_required   Required version
   $p_initialized  
[ Top ]



plugin_error [line 260]

void plugin_error( string $p_error_name, [int $p_error_type = ERROR], [string $p_basename = null])

Trigger a plugin-specific error with the given name and type.



Parameters

string   $p_error_name   Error name
int   $p_error_type   Error type
string   $p_basename   Plugin basename
[ Top ]



plugin_event_hook [line 285]

void plugin_event_hook( string $p_name, string $p_callback)

Hook a plugin's callback function to an event.



Parameters

string   $p_name   Event name
string   $p_callback   Callback function
[ Top ]



plugin_event_hook_many [line 294]

void plugin_event_hook_many( array $p_hooks)

Hook multiple plugin callbacks at once.



Parameters

array   $p_hooks   Array of event name/callback key/value pairs
[ Top ]



plugin_file [line 107]

void plugin_file( string $p_file, [string $p_redirect = false], [ $p_basename = null])

Get the URL to the plugin wrapper page.



Parameters

string   $p_file   Page name
string   $p_redirect   Plugin basename (defaults to current plugin)
   $p_basename  
[ Top ]



plugin_file_include [line 125]

void plugin_file_include( string $p_filename, [string $p_basename = null])

Include the contents of a file as output.



Parameters

string   $p_filename   File name
string   $p_basename   Plugin basename
[ Top ]



plugin_file_path [line 94]

mixed plugin_file_path( string $p_filename, string $p_basename)

Return a path to a plugin file.



Tags:

return:  File path or false if FNF


Parameters

string   $p_filename   File name
string   $p_basename   Plugin basename
[ Top ]



plugin_find_all [line 671]

array plugin_find_all( )

Search the plugins directory for plugins.



Tags:

return:  Plugin basename/info key/value pairs.


[ Top ]



plugin_get_current [line 47]

string plugin_get_current( )

Get the currently executing plugin's basename.



Tags:

return:  Plugin basename, or null if no current plugin


[ Top ]



plugin_history_log [line 242]

void plugin_history_log( $p_bug_id, $p_field_name, $p_old_value, [ $p_new_value = ''], [ $p_user_id = null], [ $p_basename = null])



Parameters

   $p_bug_id  
   $p_field_name  
   $p_old_value  
   $p_new_value  
   $p_user_id  
   $p_basename  
[ Top ]



plugin_include [line 699]

void plugin_include( string $p_basename, [ $p_child = null])

Load a plugin's core class file.



Parameters

string   $p_basename   Plugin basename
   $p_child  
[ Top ]



plugin_init [line 829]

boolean plugin_init( string $p_basename)

Initialize a single plugin.



Tags:

return:  True if plugin initialized, false otherwise.


Parameters

string   $p_basename   Plugin basename
[ Top ]



plugin_init_installed [line 786]

void plugin_init_installed( )

Initialize all installed plugins.

Post-signals EVENT_PLUGIN_INIT.




[ Top ]



plugin_install [line 537]

void plugin_install( string $p_plugin)

Install a plugin to the database.



Parameters

string   $p_plugin   Plugin basename
[ Top ]



plugin_is_installed [line 525]

boolean plugin_is_installed( string $p_basename)

Determine if a given plugin is installed.



Tags:

return:  True if plugin is installed


Parameters

string   $p_basename   Plugin basename
[ Top ]



plugin_is_loaded [line 338]

boolean plugin_is_loaded( string $p_basename)

Checks if a given plugin has been registered and initialized, and returns a boolean value representing the "loaded" state.



Tags:

return:  Plugin loaded


Parameters

string   $p_basename   Plugin basename
[ Top ]



plugin_lang_get [line 230]

string plugin_lang_get( string $p_name, [string $p_basename = null])

Get a language string for the plugin.

Automatically prepends plugin_<basename> to the string requested.




Tags:

return:  Language string


Parameters

string   $p_name   Language string name
string   $p_basename   Plugin basename
[ Top ]



plugin_needs_upgrade [line 572]

boolean plugin_needs_upgrade( string $p_plugin)

Determine if an installed plugin needs to upgrade its schema.



Tags:

return:  True if plugin needs schema ugrades.


Parameters

string   $p_plugin   Plugin basename
[ Top ]



plugin_page [line 75]

void plugin_page( string $p_page, [string $p_redirect = false], [ $p_basename = null])

Get the URL to the plugin wrapper page.



Parameters

string   $p_page   Page name
string   $p_redirect   Plugin basename (defaults to current plugin)
   $p_basename  
[ Top ]



plugin_pop_current [line 65]

string plugin_pop_current( )

Remove the current plugin from the stack



Tags:

return:  Plugin basename, or null if no current plugin


[ Top ]



plugin_priority [line 508]

int plugin_priority( string $p_basename)

Gets a plugin's priority.



Tags:

return:  Plugin priority


Parameters

string   $p_basename   Plugin basename
[ Top ]



plugin_protected [line 492]

boolean plugin_protected( string $p_basename)

Checks to see if a plugin is 'protected' from uninstall.



Tags:

return:  True if plugin is protected


Parameters

string   $p_basename   Plugin basename
[ Top ]



plugin_push_current [line 56]

void plugin_push_current( string $p_basename)

Add the current plugin to the stack



Parameters

string   $p_basename   Plugin basename
[ Top ]



plugin_register [line 721]

void plugin_register( string $p_basename, [ $p_return = false], [ $p_child = null])

Register a plugin with MantisBT.

The plugin class must already be loaded before calling.




Parameters

string   $p_basename   Plugin classname without 'Plugin' postfix
   $p_return  
   $p_child  
[ Top ]



plugin_register_installed [line 766]

void plugin_register_installed( )

Find and register all installed plugins.



[ Top ]



plugin_table [line 147]

string plugin_table( string $p_name, [string $p_basename = null])

Given a base table name for a plugin, add appropriate prefix and suffix.

Convenience for plugin schema definitions.




Tags:

return:  Full table name


Parameters

string   $p_name   Table name
string   $p_basename   Plugin basename (defaults to current plugin)
[ Top ]



plugin_uninstall [line 647]

void plugin_uninstall( string $p_plugin)

Uninstall a plugin from the database.



Parameters

string   $p_plugin   Plugin basename
[ Top ]



plugin_upgrade [line 589]

multi plugin_upgrade( string $p_plugin)

Upgrade an installed plugin's schema.



Tags:

return:  True if upgrade completed, null if problem


Parameters

string   $p_plugin   Plugin basename
[ Top ]



plugin_version_array [line 350]

array plugin_version_array( string $p_version)

Converts a version string to an array, using some punctuation and number/lettor boundaries as splitting points.



Tags:

return:  Version array


Parameters

string   $p_version   Version string
[ Top ]



plugin_version_check [line 378]

int plugin_version_check( array $p_version1, array $p_version2, [boolean $p_maximum = false])

Checks two version arrays sequentially for minimum or maximum version dependencies.



Tags:

return:  1 if the version dependency succeeds, -1 if it fails


Parameters

array   $p_version1   Version array to check
array   $p_version2   Version array required
boolean   $p_maximum   Minimum (false) or maximum (true) version check
[ Top ]



Documentation generated on Sun, 12 Dec 2010 23:50:44 +0900 by phpDocumentor 1.4.3
inserted by FC2 system