SF.net SVN: phpwiki:[10768] trunk/lib/plugin/WikiAdminUtils.php

vargenau--- via phpwiki-checkins <[email protected]>
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 10768
          http://sourceforge.net/p/phpwiki/code/10768
Author:   vargenau
Date:     2021-12-09 18:26:58 +0000 (Thu, 09 Dec 2021)
Log Message:
-----------
WikiAdminUtils plugin: avoid warning

Modified Paths:
--------------
    trunk/lib/plugin/WikiAdminUtils.php

Modified: trunk/lib/plugin/WikiAdminUtils.php
===================================================================
--- trunk/lib/plugin/WikiAdminUtils.php	2021-12-09 17:49:44 UTC (rev 10767)
+++ trunk/lib/plugin/WikiAdminUtils.php	2021-12-09 18:26:58 UTC (rev 10768)
@@ -58,13 +58,14 @@
     function run($dbi, $argstr, &$request, $basepage)
     {
         $args = $this->getArgs($argstr, $request);
-        $args['action'] = strtolower($args['action']);
         extract($args);
 
-        if (!$action) {
+        if (empty($action)) {
             $this->error("No action specified");
         }
-        if (!($default_label = $this->_getLabel($action))) {
+        $action = strtolower($action);
+
+        if (!($default_label = $this->getLabel($action))) {
             return HTML::div(array('class' => "error"), fmt("Bad action requested: %s", $action));
         }
         if ($request->getArg('action') != 'browse') {
@@ -115,16 +116,24 @@
         return '';
     }
 
-    private function _getLabel($action)
+    private function getLabel($action)
     {
-        $labels = array('purge-cache' => _("Purge HTML Cache"),
-            'purge-bad-pagenames' => _("Purge all Pages With Invalid Names"),
-            'purge-empty-pages' => _("Purge all empty, unreferenced Pages"),
-            'email-verification' => _("E-mail Verification"),
-            'db-check' => _("Check Wiki Database"),
-            'db-rebuild' => _("Rebuild Wiki Database")
-        );
-        return @$labels[$action];
+        switch ($action) {
+            case 'purge-cache':
+                return _("Purge HTML Cache");
+            case 'purge-bad-pagenames':
+                return _("Purge all Pages With Invalid Names");
+            case 'purge-empty-pages':
+                return _("Purge all empty, unreferenced Pages");
+            case 'email-verification':
+                return _("E-mail Verification");
+            case 'db-check':
+                return _("Check Wiki Database");
+            case 'db-rebuild':
+                return _("Rebuild Wiki Database");
+            default:
+                return '';
+        }
     }
 
     private function _do_purge_cache($request)

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.