]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/pluginlist.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / lib / pluginlist.php
index 038b08a18fdc8e9a1fb625366fb92953b40cd20c..5085f161d58376095e7523378ef73dfccc3d0bfd 100644 (file)
@@ -45,12 +45,12 @@ require INSTALLDIR . '/lib/plugindisableform.php';
  */
 class PluginList extends Widget
 {
-    var $plugins = array();
+    var $pluginNames = array();
 
-    function __construct(array $plugins, Action $out=null)
+    function __construct(array $pluginNames, Action $out=null)
     {
         parent::__construct($out);
-        $this->plugins = $plugins;
+        $this->pluginNames = $pluginNames;
     }
 
     function show()
@@ -72,40 +72,37 @@ class PluginList extends Widget
 
     function showPlugins()
     {
-        foreach ($this->plugins as $plugin) {
-            // Some check on instance
-            assert($plugin instanceof Plugin);
-
-            $pli = $this->newListItem($plugin);
+        foreach ($this->pluginNames as $pluginName) {
+            $pli = $this->newListItem($pluginName);
             $pli->show();
         }
     }
 
-    function newListItem(Plugin $plugin)
+    function newListItem($pluginName)
     {
-        return new PluginListItem($plugin, $this->out);
+        return new PluginListItem($pluginName, $this->out);
     }
 }
 
 class PluginListItem extends Widget
 {
     /** Current plugin. */
-    var $plugin = null;
+    private $pluginName = null;
 
     /** Local cache for plugin version info */
     protected static $versions = false;
 
-    function __construct($plugin, Action $out=null)
+    function __construct($pluginName, Action $out=null)
     {
         parent::__construct($out);
-        $this->plugin = $plugin;
+        $this->pluginName = $pluginName;
     }
 
     function show()
     {
         $meta = $this->metaInfo();
 
-        $this->out->elementStart('tr', array('id' => 'plugin-' . $this->plugin));
+        $this->out->elementStart('tr', array('id' => 'plugin-' . $this->pluginName));
 
         // Name and controls
         $this->out->elementStart('td');
@@ -113,7 +110,7 @@ class PluginListItem extends Widget
         if (!empty($meta['homepage'])) {
             $this->out->elementStart('a', array('href' => $meta['homepage']));
         }
-        $this->out->text($this->plugin);
+        $this->out->text($this->pluginName);
         if (!empty($meta['homepage'])) {
             $this->out->elementEnd('a');
         }
@@ -156,11 +153,11 @@ class PluginListItem extends Widget
      */
     protected function getControlForm()
     {
-        $key = 'disable-' . $this->plugin;
+        $key = 'disable-' . $this->pluginName;
         if (common_config('plugins', $key)) {
-            return new PluginEnableForm($this->out, $this->plugin);
+            return new PluginEnableForm($this->out, $this->pluginName);
         } else {
-            return new PluginDisableForm($this->out, $this->plugin);
+            return new PluginDisableForm($this->out, $this->pluginName);
         }
     }
 
@@ -180,7 +177,7 @@ class PluginListItem extends Widget
             // hack for URL shorteners... "LilUrl (ur1.ca)" etc
             list($name, ) = explode(' ', $info['name']);
 
-            if ($name == $this->plugin) {
+            if ($name == $this->pluginName) {
                 if ($found) {
                     // hack for URL shorteners...
                     $found['rawdescription'] .= "<br />\n" . $info['rawdescription'];
@@ -193,7 +190,7 @@ class PluginListItem extends Widget
         if ($found) {
             return $found;
         } else {
-            return array('name' => $this->plugin,
+            return array('name' => $this->pluginName,
                          // TRANS: Plugin description for a disabled plugin.
                          'rawdescription' => _m('plugin-description','(The plugin description is unavailable when a plugin has been disabled.)'));
         }