User Tools

Site Tools


mantisbt:plugins_sample

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mantisbt:plugins_sample [2007/11/04 16:30]
vboctor Fixed a comment.
mantisbt:plugins_sample [2013/06/21 09:54] (current)
atrol
Line 1: Line 1:
 ====== Sample Plugins ====== ====== Sample Plugins ======
 +
  
 ===== Super Cow Powers ===== ===== Super Cow Powers =====
Line 9: Line 10:
 mantis/ mantis/
   plugins/   plugins/
-    supercow+    Supercow
-      register.php +      Supercow.php
-      events.php+
 </code> </code>
  
-**''plugins/supercow/register.php''**+**''plugins/Supercow/Supercow.php''**
 <code php> <code php>
 <?php <?php
  
-/** +class SupercowPlugin extends MantisPlugin {
- * Return plugin details to the API. +
- * @return array Plugin details +
- */ +
-function plugin_callback_supercow_info() { +
-  return array( +
-    'name' => 'Super Cow Powers', +
-    'description' => 'Gives your Mantis installation super cow powers.', +
-    'version' => '1.0', +
-    'author' => 'John Reese', +
-    'contact' => 'jreese@leetcode.net', +
-    'url' => 'http://leetcode.net', +
-    'page' => '', +
-    'requires' => array(), +
-  ); +
-}+
  
-/** +  function register() { 
- * Intitialize the plugin. +    $this->name        = 'Super Cow Powers'
- */ +    $this->description = 'Gives your Mantis installation super cow powers.';
-function plugin_callback_supercow_init() { +
-  plugin_event_hook( 'EVENT_PLUGIN_INIT''header); +
-+
-</code>+
  
-**''plugins/supercow/events.php''** +    $this->version     '1.0'
-<code php> +    $this->requires    = array( 
-<?php+      '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.' ); 
 +  }
  
-/** 
- * Handle the EVENT_PLUGIN_INIT callback. 
- */ 
-function plugin_event_supercow_header() { 
-  header( 'X-Mantis: This Mantis has super cow powers.' ); 
 } }
 </code> </code>
Line 111: Line 104:
 } }
 </code> </code>
 +
 +
mantisbt/plugins_sample.1194211818.txt.gz · Last modified: 2008/10/29 04:31 (external edit)