Example.
Example/ Example.php
mantis_plugin_Example_foo_table.
Warning
example will not work.
Example.php in our case) must contain a concrete class deriving from the MantisPlugin base class; its name must be the plugin's basename with the Plugin suffix appended to it. For our purposes, the class' name will therefore be ExamplePlugin.
MantisPlugin declares the register() method as abstract, our plugin must implement that method before PHP will find it semantically valid. This method is meant for one simple purpose, and should never be used for any other task: setting the plugin's information properties including the plugin's name, description, version, and more. Please refer to Section 4.2.2, “Properties” below for details about available properties.
register() method, and sets at least the name and version properties, it is then considered a "complete" plugin, and can be loaded and installed within MantisBT's plugin manager. At this stage, our Example plugin, with all the possible plugin properties set at registration, looks like this:
Example/Example.php
<?php
class ExamplePlugin extends MantisPlugin {
function register() {
$this->name = 'Example Plugin'; # Proper name of plugin
$this->description = 'Example Plugin from MantisBT Developers Guide';
# Short description of the plugin
$this->page = ''; # Default plugin page
$this->version = '2.0'; # Plugin version string
$this->requires = array( # Plugin dependencies
'MantisCore' => '2.0', # Should always depend on an appropriate
# version of MantisBT
);
$this->author = 'MantisBT Team'; # Author/team name
$this->contact = 'mantisbt-dev@lists.sourceforge.net';
# Author/team e-mail address
$this->url = 'https://mantisbt.org'; # Support webpage
}
}