Skip to content

Commit 03d9e0d

Browse files
committed
New MantisSourceBase class
This new plugin base class is used to provide a common ancestor for all Source Integration Framework Plugin classes.
1 parent ac096b4 commit 03d9e0d

File tree

4 files changed

+33
-8
lines changed

4 files changed

+33
-8
lines changed

Source/MantisSourceBase.class.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
# Copyright (c) 2017 Damien Regad
4+
# Licensed under the MIT license
5+
6+
require_once( config_get_global( 'class_path' ) . 'MantisPlugin.class.php' );
7+
8+
/**
9+
* Class MantisSourceBase
10+
*
11+
* Base class for all Source Integration Plugin classes
12+
*/
13+
abstract class MantisSourceBase extends MantisPlugin
14+
{
15+
/**
16+
* Source Integration framework version.
17+
*
18+
* Numbering follows Semantic Versioning. Major version increments indicate
19+
* a change in the minimum required MantisBT version: 0=1.2; 1=1.3, 2=2.x.
20+
* The framework version is incremented when the plugin's core file change.
21+
*/
22+
const FRAMEWORK_VERSION = '1.3.1';
23+
}

Source/MantisSourcePlugin.class.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
# Copyright (c) 2012 John Reese
44
# Licensed under the MIT license
55

6+
require_once( 'MantisSourceBase.class.php' );
7+
68
/**
79
* Abstract class for simplifying creation of source control plugins.
810
* @author John Reese
911
*/
10-
abstract class MantisSourcePlugin extends MantisPlugin {
12+
abstract class MantisSourcePlugin extends MantisSourceBase {
1113
public function hooks() {
1214
return array(
1315
'EVENT_SOURCE_INTEGRATION' => 'integration',
@@ -172,7 +174,7 @@ final public function _precommit( $p_event ) {
172174
class SourceGenericPlugin extends MantisSourcePlugin {
173175
function register() {
174176
$this->name = plugin_lang_get( 'title', 'Source' );
175-
$this->version = SourcePlugin::$framework_version;
177+
$this->version = self::FRAMEWORK_VERSION;
176178
}
177179

178180
public $type = 'generic';

Source/Source.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# Copyright (c) 2012 John Reese
44
# Licensed under the MIT license
55

6-
require_once( config_get_global( 'class_path' ) . 'MantisPlugin.class.php' );
6+
require_once( 'MantisSourceBase.class.php' );
77

88
/**
99
* Creates an extensible API for integrating source control applications
1010
* with the Mantis bug tracker software.
1111
*/
12-
class SourcePlugin extends MantisPlugin {
13-
static $framework_version = '1.3.1';
12+
class SourcePlugin extends MantisSourceBase {
13+
1414
static $cache = array();
1515

1616
/**
@@ -28,7 +28,7 @@ function register() {
2828
$this->name = plugin_lang_get( 'title' );
2929
$this->description = plugin_lang_get( 'description' );
3030

31-
$this->version = self::$framework_version;
31+
$this->version = self::FRAMEWORK_VERSION;
3232
$this->requires = array(
3333
'MantisCore' => '1.3.0',
3434
);

Source/SourceIntegration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# Copyright (c) 2012 John Reese
44
# Licensed under the MIT license
55

6-
final class SourceIntegrationPlugin extends MantisPlugin {
6+
final class SourceIntegrationPlugin extends MantisSourceBase {
77
function register() {
88
$this->name = plugin_lang_get( 'title', 'Source' );
9-
$this->version = SourcePlugin::$framework_version;
9+
$this->version = self::FRAMEWORK_VERSION;
1010
}
1111

1212
function hooks() {

0 commit comments

Comments
 (0)