diff options
author | Andreas Gohr <andi@splitbrain.org> | 2009-07-25 17:21:05 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2009-07-25 17:21:05 +0200 |
commit | 0ef95f3d2c295b225c3d3e09786d7e28abcdfe95 (patch) | |
tree | a630a9963d5eb82b1684849580ad932732919968 /lib/plugins/plugin/classes/ap_enable.class.php | |
parent | 76c65fd3be96c545da85d9b67e7674e765e92e04 (diff) | |
download | rpg-0ef95f3d2c295b225c3d3e09786d7e28abcdfe95.tar.gz rpg-0ef95f3d2c295b225c3d3e09786d7e28abcdfe95.tar.bz2 |
restructured plugin manager
Ignore-this: 4007248aa01f09990612c844c8a83900
This patch moves the different classes of the plugin manager into their own
files and moves formerly global utility functions into the appropriate
class scopes.
darcs-hash:20090725152105-7ad00-89801e811b7eb0d0db25a825d6065aed8ef95c33.gz
Diffstat (limited to 'lib/plugins/plugin/classes/ap_enable.class.php')
-rw-r--r-- | lib/plugins/plugin/classes/ap_enable.class.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/plugins/plugin/classes/ap_enable.class.php b/lib/plugins/plugin/classes/ap_enable.class.php new file mode 100644 index 000000000..35450a907 --- /dev/null +++ b/lib/plugins/plugin/classes/ap_enable.class.php @@ -0,0 +1,49 @@ +<?php + +class ap_enable extends ap_manage { + + var $enabled = array(); + + function process() { + global $plugin_protected; + $count_enabled = $count_disabled = 0; + + $this->enabled = isset($_REQUEST['enabled']) ? $_REQUEST['enabled'] : array(); + + foreach ($this->manager->plugin_list as $plugin) { + if (in_array($plugin, $plugin_protected)) continue; + + $new = in_array($plugin, $this->enabled); + $old = !plugin_isdisabled($plugin); + + if ($new != $old) { + switch ($new) { + // enable plugin + case true : + if(plugin_enable($plugin)){ + msg(sprintf($this->lang['enabled'],$plugin),1); + $count_enabled++; + }else{ + msg(sprintf($this->lang['notenabled'],$plugin),-1); + } + break; + case false: + if(plugin_disable($plugin)){ + msg(sprintf($this->lang['disabled'],$plugin),1); + $count_disabled++; + }else{ + msg(sprintf($this->lang['notdisabled'],$plugin),-1); + } + break; + } + } + } + + // refresh plugins, including expiring any dokuwiki cache(s) + if ($count_enabled || $count_disabled) { + $this->refresh(); + } + } + +} + |