====== Sample Plugins ======
===== Super Cow Powers =====
This is a very minimal plugin that does nothing but increase your site's Geek Factor.
**Directory Structure**
mantis/
plugins/
Supercow/
Supercow.php
**''plugins/Supercow/Supercow.php''**
name = 'Super Cow Powers';
$this->description = 'Gives your Mantis installation super cow powers.';
$this->version = '1.0';
$this->requires = array(
'MantisCore' => '1.2.0',
);
$this->author = 'Fred Smith';
$this->contact = 'fredsmith@fredsmith.fsn';
$this->url = 'http://fredsmith.fsn';
}
function init() {
plugin_event_hook( 'EVENT_PLUGIN_INIT', 'header' );
}
/**
* Handle the EVENT_PLUGIN_INIT callback.
*/
function header() {
header( 'X-Mantis: This Mantis has super cow powers.' );
}
}
===== SVN Links =====
This is a plugin that detects svn:123 and hyperlinks it to the ViewVC web page that contains all the details of the changeset.
**''plugins/svnlinks/register.php''**
'SVN Links',
'description' => 'Detects references to SVN changesets and hyperlinks them.',
'version' => '1.0',
'author' => 'Victor Boctor',
'contact' => 'vboctor -at- users.sourceforge.net',
'url' => 'http://www.mantisbt.org',
);
}
/**
* Intitialize the plugin.
*/
function plugin_callback_svnlinks_init() {
plugin_event_hook( 'EVENT_TEXT_LINKS', 'string_display_links' );
}
**''plugins/svnlinks/events.php''**
svn:\\1';
return preg_replace( '/svn\:([[:digit:]]+)/i',
$t_replace_with,
$p_string );
}