-
Notifications
You must be signed in to change notification settings - Fork 448
/
Copy pathGatewayPlugin.inc.php
75 lines (65 loc) · 1.53 KB
/
GatewayPlugin.inc.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
<?php
/**
* @file classes/plugins/GatewayPlugin.inc.php
*
* Copyright (c) 2014-2017 Simon Fraser University
* Copyright (c) 2003-2017 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class GatewayPlugin
* @ingroup plugins
*
* @brief Abstract class for gateway plugins
*/
import('lib.pkp.classes.plugins.Plugin');
abstract class GatewayPlugin extends Plugin {
/**
* Constructor
*/
function __construct() {
parent::__construct();
}
/**
* Handle fetch requests for this plugin.
* @param $args array
* @param $request object
*/
abstract function fetch($args, $request);
/**
* Determine whether the plugin can be enabled.
* @return boolean
*/
function getCanEnable() {
return true;
}
/**
* Determine whether the plugin can be disabled.
* @return boolean
*/
function getCanDisable() {
return true;
}
/**
* Determine whether or not this plugin is currently enabled.
* @return boolean
*/
function getEnabled() {
return $this->getSetting($this->getCurrentContextId(), 'enabled');
}
/**
* Set whether or not this plugin is currently enabled.
* @param $enabled boolean
*/
function setEnabled($enabled) {
$this->updateSetting($this->getCurrentContextId(), 'enabled', $enabled, 'bool');
}
/**
* Get the current context ID or the site-wide context ID (0) if no context
* can be found.
*/
function getCurrentContextId() {
$context = PKPApplication::getRequest()->getContext();
return is_null($context) ? 0 : $context->getId();
}
}
?>