diff options
Diffstat (limited to 'lib/pluginlist.php')
-rw-r--r-- | lib/pluginlist.php | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/lib/pluginlist.php b/lib/pluginlist.php index 07a17ba39..48ef1cb81 100644 --- a/lib/pluginlist.php +++ b/lib/pluginlist.php @@ -154,47 +154,23 @@ class PluginListItem extends Widget */ protected function getControlForm() { - $key = 'disable-' . $this->plugin; - if (common_config('plugins', $key)) { - return new PluginEnableForm($this->out, $this->plugin); - } else { + $enabled = array_key_exists($this->plugin, StatusNet::getPlugins()); + $disabled = common_config('plugins', 'disable-'.$this->plugin); + + if ( $enabled && (!$disabled) ) { return new PluginDisableForm($this->out, $this->plugin); + } else { + return new PluginEnableForm($this->out, $this->plugin); } } + /** * Grab metadata about this plugin... - * Warning: horribly inefficient and may explode! - * Doesn't work for disabled plugins either. - * - * @fixme pull structured data from plugin source */ function metaInfo() { - $versions = self::getPluginVersions(); - $found = false; - - foreach ($versions as $info) { - // hack for URL shorteners... "LilUrl (ur1.ca)" etc - list($name, ) = explode(' ', $info['name']); - - if ($name == $this->plugin) { - if ($found) { - // hack for URL shorteners... - $found['rawdescription'] .= "<br />\n" . $info['rawdescription']; - } else { - $found = $info; - } - } - } - - if ($found) { - return $found; - } else { - return array('name' => $this->plugin, - 'rawdescription' => _m('plugin-description', - '(Plugin descriptions unavailable when disabled.)')); - } + return $versions[$this->plugin]; } /** |