| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisBT - A PHP based bugtracking system 3 4 # Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge. 5 6 # MantisBT is free software: you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation, either version 2 of the License, or 9 # (at your option) any later version. 10 # 11 # MantisBT is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License for more details. 15 # 16 # You should have received a copy of the GNU General Public License 17 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>. 18 19 /** 20 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 21 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 22 * @link http://www.mantisbt.org 23 * @package MantisBT 24 */ 25 26 /** 27 * Base class that implements basic plugin functionality 28 * and integration with MantisBT. See the Mantis wiki for 29 * more information. 30 * @package MantisBT 31 * @subpackage classes 32 */ 33 abstract class MantisPlugin { 34 35 /** 36 * name - Your plugin's full name. Required value. 37 */ 38 public $name = null; 39 /** 40 * description - A full description of your plugin. 41 */ 42 public $description = null; 43 /** 44 * page - The name of a plugin page for further information and administration. 45 */ 46 public $page = null; 47 /** 48 * version - Your plugin's version string. Required value. 49 */ 50 public $version = null; 51 /** 52 * requires - An array of key/value pairs of basename/version plugin dependencies. 53 * Prefixing a version with '<' will allow your plugin to specify a maximum version (non-inclusive) for a dependency. 54 */ 55 public $requires = null; 56 /** 57 * An array of key/value pairs of basename/version plugin dependencies (soft dependency) 58 */ 59 public $uses = null; 60 /** 61 * author - Your name, or an array of names. 62 */ 63 public $author = null; 64 /** 65 * contact - An email address where you can be contacted. 66 */ 67 public $contact = null; 68 /** 69 * url - A web address for your plugin. 70 */ 71 public $url = null; 72 73 /** 74 * this function registers your plugin - must set at least name and version 75 */ 76 abstract public function register(); 77 78 /** 79 * this function allows your plugin to set itself up, include any 80 * necessary API's, declare or hook events, etc. 81 * Alternatively, your plugin can hook the EVENT_PLUGIN_INIT event 82 * that will be called after all plugins have been initialized. 83 */ 84 public function init() {} 85 86 /** 87 * This function allows plugins to add new error messages for Mantis usage 88 * 89 * @returns array The error_name=>error_message list to add 90 */ 91 public function errors() { 92 return array(); 93 } 94 95 /** 96 * return an array of default configuration name/value pairs 97 */ 98 public function config() { 99 return array(); 100 } 101 102 public function events() { 103 return array(); 104 } 105 106 public function hooks() { 107 return array(); 108 } 109 110 public function schema() { 111 return array(); 112 } 113 114 /** 115 * Perform pre-installation operations 116 * 117 * This method is called before installing the given plugin. 118 * It can be used to add pre-install checks on external requirements 119 * 120 * @returns bool true if install can proceed 121 */ 122 public function install() { 123 return true; 124 } 125 126 /** 127 * This callback is executed after the normal schema upgrade process has executed. 128 * This gives your plugin the chance to convert or normalize data after an upgrade 129 */ 130 public function upgrade( $p_schema ) { 131 return true; 132 } 133 134 /** 135 * This callback is executed after the normal uninstallation process, and should 136 * handle such operations as reverting database schemas, removing unnecessary data, 137 * etc. This callback should be used only if Mantis would break when this plugin 138 * is uninstalled without any other actions taken, as users may not want to lose 139 * data, or be able to re-install the plugin later. 140 */ 141 public function uninstall() { 142 } 143 144 ### Core plugin functionality ### 145 146 public $basename = null; 147 final public function __construct( $p_basename ) { 148 $this->basename = $p_basename; 149 $this->register(); 150 } 151 152 final public function __init() { 153 plugin_config_defaults( $this->config() ); 154 event_declare_many( $this->events() ); 155 plugin_event_hook_many( $this->hooks() ); 156 157 $this->init(); 158 } 159 } 160 161 162 /* vim: set noexpandtab tabstop=4 shiftwidth=4: */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |