/
MantisCoreWikiPlugin.class.php
226 lines (190 loc) · 6.16 KB
/
MantisCoreWikiPlugin.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?php
# MantisBT - A PHP based bugtracking system
# Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.
# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
/**
* Mantis Core Wiki Plugins
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
* @package MantisBT
*/
/**
* requires MantisWikiPlugin.class
*/
require_once( 'MantisWikiPlugin.class.php' );
/**
* Base that uses the old style wiki definitions from config_inc.php
* @package MantisBT
* @subpackage classes
*/
abstract class MantisCoreWikiPlugin extends MantisWikiPlugin {
function config() {
return array(
'root_namespace' => config_get_global( 'wiki_root_namespace' ),
'engine_url' => config_get_global( 'wiki_engine_url' ),
);
}
}
/**
* Basic Dokuwiki support with old-style wiki integration.
* @package MantisBT
* @subpackage classes
*/
class MantisCoreDokuwikiPlugin extends MantisCoreWikiPlugin {
function register() {
$this->name = 'MantisBT Dokuwiki Integration';
$this->version = '0.1';
$this->requires = array(
'MantisCore' => '1.2.0',
);
}
function base_url( $p_project_id=null ) {
$t_base = plugin_config_get( 'engine_url' ) . 'doku.php?id=';
$t_namespace = plugin_config_get( 'root_namespace' );
if ( !is_blank( $t_namespace ) ) {
$t_base .= urlencode( $t_namespace ) . ':';
}
if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) {
$t_base .= urlencode( project_get_name( $p_project_id ) ) . ':';
}
return $t_base;
}
function link_bug( $p_event, $p_bug_id ) {
return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . 'issue:' . (int)$p_bug_id;
}
function link_project( $p_event, $p_project_id ) {
return $this->base_url( $p_project_id ) . 'start';
}
}
/**
* Basic MediaWiki support with old-style wiki integration.
* @package MantisBT
* @subpackage classes
*/
class MantisCoreMediaWikiPlugin extends MantisCoreWikiPlugin {
function register() {
$this->name = 'MantisBT MediaWiki Integration';
$this->version = '0.1';
$this->requires = array(
'MantisCore' => '1.2.0',
);
}
function base_url( $p_project_id=null ) {
$t_base = plugin_config_get( 'engine_url' ) . 'index.php/';
if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) {
$t_base .= urlencode( project_get_name( $p_project_id ) ) . ':';
} else {
$t_base .= urlencode( plugin_config_get( 'root_namespace' ) );
}
return $t_base;
}
function link_bug( $p_event, $p_bug_id ) {
return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . (int)$p_bug_id;
}
function link_project( $p_event, $p_project_id ) {
return $this->base_url( $p_project_id ) . 'Main_Page';
}
}
/**
* Basic Twiki support with old-style wiki integration.
* @package MantisBT
* @subpackage classes
*/
class MantisCoreTwikiPlugin extends MantisCoreWikiPlugin {
function register() {
$this->name = 'MantisBT Twiki Integration';
$this->version = '0.1';
$this->requires = array(
'MantisCore' => '1.2.0',
);
}
function base_url( $p_project_id=null ) {
$t_base = plugin_config_get( 'engine_url' );
$t_namespace = plugin_config_get( 'root_namespace' );
if ( !is_blank( $t_namespace ) ) {
$t_base .= urlencode( $t_namespace ) . '/';
}
if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) {
$t_base .= urlencode( project_get_name( $p_project_id ) ) . '/';
}
return $t_base;
}
function link_bug( $p_event, $p_bug_id ) {
return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . 'IssueNumber' . (int)$p_bug_id;
}
function link_project( $p_event, $p_project_id ) {
return $this->base_url( $p_project_id );
}
}
/**
* Basic WikkaWiki support with old-style wiki integration.
* @package MantisBT
* @subpackage classes
*/
class MantisCoreWikkaWikiPlugin extends MantisCoreWikiPlugin {
function register() {
$this->name = 'MantisBT WikkaWiki Integration';
$this->version = '0.1';
$this->requires = array(
'MantisCore' => '1.2.0',
);
}
function base_url( $p_project_id=null ) {
$t_base = plugin_config_get( 'engine_url' ) . 'wikka.php?wakka=';
$t_namespace = ucfirst( plugin_config_get( 'root_namespace' ) );
if ( !is_blank( $t_namespace ) ) {
$t_base .= urlencode( $t_namespace );
}
if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) {
$t_base .= urlencode( project_get_name( $p_project_id ) );
}
return $t_base;
}
function link_bug( $p_event, $p_bug_id ) {
return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . 'Issue' . (int)$p_bug_id;
}
function link_project( $p_event, $p_project_id ) {
return $this->base_url( $p_project_id ) . 'Start';
}
}
/**
* Basic Xwiki support with old-style wiki integration.
* @package MantisBT
* @subpackage classes
*/
class MantisCoreXwikiPlugin extends MantisCoreWikiPlugin {
function register() {
$this->name = 'MantisBT Xwiki Integration';
$this->version = '0.1';
$this->requires = array(
'MantisCore' => '1.2.0',
);
}
function base_url( $p_project_id=null ) {
$t_base = plugin_config_get( 'engine_url' );
if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) {
$t_base .= urlencode( project_get_name( $p_project_id ) ) . '/';
} else {
$t_base .= urlencode( plugin_config_get( 'root_namespace' ) );
}
return $t_base;
}
function link_bug( $p_event, $p_bug_id ) {
return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . (int)$p_bug_id;
}
function link_project( $p_event, $p_project_id ) {
return $this->base_url( $p_project_id ) . 'Main_Page';
}
}