mantisbt:plugins_sample
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
mantisbt:plugins_sample [2007/11/04 00:26] – created jreese | mantisbt:plugins_sample [2013/06/21 09:54] (current) – atrol | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Sample Plugins ====== | ====== 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 | ||
+ | </ | ||
+ | |||
+ | **'' | ||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | class SupercowPlugin extends MantisPlugin { | ||
+ | |||
+ | function register() { | ||
+ | $this-> | ||
+ | $this-> | ||
+ | |||
+ | $this-> | ||
+ | $this-> | ||
+ | ' | ||
+ | ); | ||
+ | |||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | function init() { | ||
+ | plugin_event_hook( ' | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Handle the EVENT_PLUGIN_INIT callback. | ||
+ | */ | ||
+ | function header() { | ||
+ | header( ' | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== 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. | ||
+ | |||
+ | **'' | ||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | /** | ||
+ | * Return plugin details to the API. | ||
+ | * @return array Plugin details | ||
+ | */ | ||
+ | function plugin_callback_svnlinks_info() { | ||
+ | return array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Intitialize the plugin. | ||
+ | */ | ||
+ | function plugin_callback_svnlinks_init() { | ||
+ | plugin_event_hook( ' | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **'' | ||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | # Configuration: | ||
+ | # $g_plugin_svnlinks_svn_changeset_link = ' | ||
+ | |||
+ | /** | ||
+ | * Handle the EVENT_TEXT_LINKS callback. | ||
+ | */ | ||
+ | function plugin_event_svnlinks_string_display_links( $p_event, $p_string ) { | ||
+ | $t_svn_changeset_link_format = config_get( ' | ||
+ | if ( is_blank( $t_svn_changeset_link_format ) ) { | ||
+ | return $p_string; | ||
+ | } | ||
+ | |||
+ | $t_svn_changeset_link = sprintf( $t_svn_changeset_link_format, | ||
+ | |||
+ | $t_replace_with = '<a href="' | ||
+ | |||
+ | return preg_replace( '/ | ||
+ | $t_replace_with, | ||
+ | $p_string ); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ |
mantisbt/plugins_sample.txt · Last modified: 2013/06/21 09:54 by atrol