Open Journal Systems
3.3.0
LazyLoadPlugin.inc.php
1
<?php
2
17
import
(
'lib.pkp.classes.plugins.Plugin'
);
18
19
abstract
class
LazyLoadPlugin
extends
Plugin
{
20
21
//
22
// Override public methods from Plugin
23
//
27
function
register
($category, $path, $mainContextId =
null
) {
28
if
(!parent::register($category, $path, $mainContextId))
return
false
;
29
$this->
addLocaleData
();
30
return
true
;
31
}
32
33
34
//
35
// Override protected methods from Plugin
36
//
40
function
getName
() {
41
// Lazy load enabled plug-ins always use the plugin's class name
42
// as plug-in name. Legacy plug-ins will override this method so
43
// this implementation is backwards compatible.
44
// NB: strtolower was required for PHP4 compatibility.
45
return
strtolower_codesafe
(get_class($this));
46
}
47
48
49
//
50
// Public methods required to support lazy load.
51
//
61
function
getEnabled
($contextId =
null
) {
62
if
($contextId ==
null
) {
63
$contextId = $this->
getCurrentContextId
();
64
if
($this->
isSitePlugin
()) {
65
$contextId = 0;
66
}
67
}
68
return
$this->
getSetting
($contextId,
'enabled'
);
69
}
70
75
function
setEnabled
($enabled) {
76
$contextId = $this->
getCurrentContextId
();
77
if
($this->
isSitePlugin
()) {
78
$contextId = 0;
79
}
80
$this->
updateSetting
($contextId,
'enabled'
, $enabled,
'bool'
);
81
}
82
86
function
getCanEnable
() {
87
return
true
;
88
}
89
93
function
getCanDisable
() {
94
return
true
;
95
}
96
101
function
getCurrentContextId
() {
102
$context =
Application::get
()->getRequest()->getContext();
103
return
is_null($context) ? 0 : $context->getId();
104
}
105
}
106
107
Plugin\updateSetting
updateSetting($contextId, $name, $value, $type=null)
Definition:
Plugin.inc.php:495
Plugin\isSitePlugin
isSitePlugin()
Definition:
Plugin.inc.php:182
LazyLoadPlugin\getCurrentContextId
getCurrentContextId()
Definition:
LazyLoadPlugin.inc.php:101
LazyLoadPlugin
Definition:
LazyLoadPlugin.inc.php:19
Plugin\getSetting
getSetting($contextId, $name)
Definition:
Plugin.inc.php:473
LazyLoadPlugin\getCanDisable
getCanDisable()
Definition:
LazyLoadPlugin.inc.php:93
LazyLoadPlugin\setEnabled
setEnabled($enabled)
Definition:
LazyLoadPlugin.inc.php:75
LazyLoadPlugin\getName
getName()
Definition:
LazyLoadPlugin.inc.php:40
LazyLoadPlugin\getEnabled
getEnabled($contextId=null)
Definition:
LazyLoadPlugin.inc.php:61
Plugin
Abstract class for plugins.
Definition:
Plugin.inc.php:51
strtolower_codesafe
strtolower_codesafe($str)
Definition:
functions.inc.php:280
LazyLoadPlugin\getCanEnable
getCanEnable()
Definition:
LazyLoadPlugin.inc.php:86
Plugin\addLocaleData
addLocaleData($locale=null)
Definition:
Plugin.inc.php:454
PKPApplication\get
static get()
Definition:
PKPApplication.inc.php:235
lib
pkp
classes
plugins
LazyLoadPlugin.inc.php
Generated on Fri Aug 28 2020 14:52:30 for Open Journal Systems by
1.8.17