diff options
| author | Irene Knapp <ireneista@internetsafetylabs.org> | 2025-10-08 02:10:24 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@internetsafetylabs.org> | 2025-10-08 02:10:24 -0700 |
| commit | 7dad24cb3d807d2aef23583aac2d48b70edb1903 (patch) | |
| tree | 9b5e2c0dbfc1a08279e98c613c8dcd454ce78827 /MantisSmalltech.php | |
initial version of the Mantis Smalltech plugin
this plugin will hold whatever style and navigation changes we wind up making to Mantis over time. the plan is to eventually publish it as part of Smalltech. as of this initial version, it makes the b/37 syntax work for links to Mantis bugs (per the feature request tracked in that same bug) Force-Push: initial development in a new repo Change-Id: Ie98e8abc9658fdf673b2feb23fb1323fa9b1b1c4
Diffstat (limited to 'MantisSmalltech.php')
| -rw-r--r-- | MantisSmalltech.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/MantisSmalltech.php b/MantisSmalltech.php new file mode 100644 index 0000000..fcdb162 --- /dev/null +++ b/MantisSmalltech.php @@ -0,0 +1,52 @@ +<?php + +/** + * Mantis plugin to make stylistic and navigation changes, as part of the + * Smalltech project. + */ +class MantisSmalltechPlugin extends MantisPlugin { + /** + * A method that populates the plugin information and minimum requirements. + * @return void + */ + function register() { + $this->name = plugin_lang_get( 'title' ); + $this->description = plugin_lang_get( 'description' ); + $this->page = ''; + + $this->version = '0.1'; + $this->requires = array( + 'MantisCore' => '2.3.0-dev', + ); + + $this->author = 'Irene Knapp'; + $this->contact = 'ireneista@internetsafetylabs.org'; + $this->url = 'https://irenes.space'; + + /* The MantisCoreFormatting plugin already does bug links. We could + * reimplement its logic, but it's simpler to just override its + * configuration. We set it in memory, not in the database, so that + * uninstalling MantisSmalltech will change it back. + * + * MantisCoreFormatting also has an "issue note" syntax, for links within + * a single issue thread. We leave that one at its default. + */ + config_set_global( 'bug_link_tag', 'b/', true ); + } + + /** + * plugin hooks + * @return array + */ + function hooks() { + $t_hooks = array( + 'EVENT_DISPLAY_BUG_ID' => 'display_bug_id', + ); + + return $t_hooks; + } + + function display_bug_id( $p_event_name, $p_string, $p_number ) { + return sprintf( 'b/%u', $p_number ); + } +} |