forked from opendocman/opendocman
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Plugin_class.php
288 lines (247 loc) · 6.42 KB
/
Plugin_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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<?php
/**
* Plugin_class should be used as an abstract class to create your own plugins.
* See the README file in the HelloWorld plugin folder for details
*
Copyright (C) 2010-2011 Stephen Lawrence Jr.
This program 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.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Stephen J. Lawrence Jr.
*/
class Plugin
{
public $name = '';
public $version = '';
public $author = '';
public $homepage = '';
public $description = '';
public $pluginslist = '';
public function Plugin()
{
$name = $this->name;
$version = $this->version;
$author = $this->author;
$homepage = $this->homepage;
$description = $this->description;
$pluginslist = $this->pluginslist;
$this->loadPlugins();
}
/*
* INCLUDE ALL PLUGINS
* @return array $pluginslist An array of plugin names currently in the plug-ins folder
*/
public function getPluginsList()
{
$pluginslist = array();
$curdir = dirname(__FILE__);
if ($handle = opendir($curdir . '/plug-ins')) {
while (false !== ($file = readdir($handle))) {
if ($file != 'index.html' && $file != '.htaccess' && $file != "." && $file != ".." && $file != '.svn' && is_file('plug-ins/' . $file . '/' . $file . '_class.php')) {
array_push($pluginslist, $file);
}
}
$this->setPluginsList($pluginslist);
return $pluginslist;
}
}
/*
* Set the value for the pluginslist variable
*/
public function setPluginsList($var)
{
$this->pluginslist = $var;
}
/*
* Include all the plugin class files
* @return true
*/
public function loadPlugins()
{
foreach ($this->getPluginsList() as $file) {
include_once('plug-ins/' . $file . '/' . $file . '_class.php');
}
return true;
}
/*
* This function allows for new admin menu items to display for your plugin
*/
public function onAdminMenu()
{
}
/*
* This function is run on the Add File page
*/
public function onBeforeAdd()
{
}
/*
* This function is run on while the file is being added to the database
*/
public function onDuringAdd($fileid)
{
}
/*
* This function is run after a new file is added
*/
public function onAfterAdd($fileid)
{
}
/*
* This function is run before the edit file form is finished being rendered
*/
public function onBeforeEditFile($fileid)
{
}
/*
* This function is run after the user saves and change to a file
*/
public function onAfterEditFile($fileid)
{
}
/*
* This function is run after the user deletes a file (aka archive)
*/
public function onAfterArchiveFile()
{
}
/*
* This function is run after the admin permanently deletes a file
*/
public function onAfterDeleteFile()
{
}
/*
* This function is run before a user is logged in
*/
public function onBeforeLogin()
{
}
/*
* This function is run after a user is logged in
*/
public function onAfterLogin()
{
}
/*
* This function is run after the user session is cleared
*/
public function onAfterLogout()
{
}
/*
* This function is called after a failed login
*/
public function onFailedLogin()
{
}
/*
* This function is called after the user views a file
*/
public function onViewFile()
{
}
/*
* This function is performed after a search has been initiated
*/
public function onSearch()
{
}
/*
* This function is run at the top of the add user form
*/
public function onBeforeAddUser()
{
}
/*
* This function is run after the add user form is saved
*/
public function onAfterAddUser()
{
}
/*
* This function allows for setting of class settings
*/
public function setProperties()
{
}
/*
* This function allows for getting of class settings
*/
public function getProperties()
{
}
/*
* This function is run during the details view
*/
public function onDuringDetails($fileid)
{
}
/*
* This function is run after the details view
*/
public function onAfterDetails($fileid)
{
}
/*
* This function is run before the file list view
*/
public function onBeforeListFiles($fileList)
{
}
/*
* This function is run after the file list view is drawn
*/
public function onAfterListFiles()
{
}
/*
* This function is run before the edited file object is saved to the db
*/
public function onBeforeEditFileSaved()
{
}
/*
* This function is run while the add department form is being drawn
*/
public function onDepartmentAddForm()
{
}
/*
* This function is run while the edit department form is being drawn
* @param int $deptId The ID for the department being edited
*/
public function onDepartmentEditForm($deptId)
{
}
/*
* This function is run while the edit department form is being drawn
* @param array $formData The _REQUEST passed in
*/
public function onDepartmentModifySave($formData)
{
}
/*
* This function is run while the add department form is being submitted
* @param int $deptId The new department ID
*/
public function onDepartmentAddSave($deptId)
{
}
/*
* This function is run after the file history page is displayed
* @param int $file_id The new file id
*/
public function onAfterHistory($file_id)
{
}
}