]> 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 07a17ba397ba30a72e885cfc985eda08f706f33b..5085f161d58376095e7523378ef73dfccc3d0bfd 100644 (file)
@@ -31,8 +31,8 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-require INSTALLDIR . "/lib/pluginenableform.php";
-require INSTALLDIR . "/lib/plugindisableform.php";
+require INSTALLDIR . '/lib/pluginenableform.php';
+require INSTALLDIR . '/lib/plugindisableform.php';
 
 /**
  * Plugin list
@@ -43,15 +43,14 @@ require INSTALLDIR . "/lib/plugindisableform.php";
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-
 class PluginList extends Widget
 {
-    var $plugins = array();
+    var $pluginNames = array();
 
-    function __construct($plugins, $out)
+    function __construct(array $pluginNames, Action $out=null)
     {
         parent::__construct($out);
-        $this->plugins = $plugins;
+        $this->pluginNames = $pluginNames;
     }
 
     function show()
@@ -73,37 +72,37 @@ class PluginList extends Widget
 
     function showPlugins()
     {
-        foreach ($this->plugins as $plugin) {
-            $pli = $this->newListItem($plugin);
+        foreach ($this->pluginNames as $pluginName) {
+            $pli = $this->newListItem($pluginName);
             $pli->show();
         }
     }
 
-    function newListItem($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, $out)
+    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');
@@ -111,12 +110,12 @@ 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');
         }
         $this->out->elementEnd('div');
-        
+
         $form = $this->getControlForm();
         $form->show();
 
@@ -154,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);
         }
     }
 
@@ -178,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'];
@@ -191,9 +190,9 @@ class PluginListItem extends Widget
         if ($found) {
             return $found;
         } else {
-            return array('name' => $this->plugin,
-                         'rawdescription' => _m('plugin-description',
-                                                '(Plugin descriptions unavailable when disabled.)'));
+            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.)'));
         }
     }