Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
LazyLoadPlugin.inc.php
1 <?php
2 
17 import('lib.pkp.classes.plugins.Plugin');
18 
19 class LazyLoadPlugin extends Plugin {
23  function LazyLoadPlugin() {
24  parent::Plugin();
25  }
26 
27  /*
28  * Override public methods from Plugin
29  */
38  function register($category, $path) {
39  $success = parent::register($category, $path);
40  if ($success) {
41  $this->addLocaleData();
42  }
43  return $success;
44  }
45 
46  /*
47  * Override protected methods from Plugin
48  */
52  function getName() {
53  // Lazy load enabled plug-ins always use the plugin's class name
54  // as plug-in name. Legacy plug-ins will override this method so
55  // this implementation is backwards compatible.
56  // NB: strtolower was required for PHP4 compatibility.
57  return strtolower_codesafe(get_class($this));
58  }
59 
60  /*
61  * Protected methods required to support lazy load.
62  */
68  function getEnabled() {
69  return $this->getContextSpecificSetting($this->getSettingMainContext(), 'enabled');
70  }
71 
77  function setEnabled($enabled) {
78  return $this->updateContextSpecificSetting($this->getSettingMainContext(), 'enabled', $enabled, 'bool');
79  }
80 }
81 
82 ?>
Abstract class for plugins.
Definition: Plugin.inc.php:50
getSettingMainContext()
Definition: Plugin.inc.php:452
addLocaleData($locale=null)
Definition: Plugin.inc.php:347
getContextSpecificSetting($context, $name)
Definition: Plugin.inc.php:387
updateContextSpecificSetting($context, $name, $value, $type=null)
Definition: Plugin.inc.php:410