SF.net SVN: phpwiki:[10976] trunk

vargenau--- via phpwiki-checkins <[email protected]> Thu, 03 Feb 2022 17:37:36 +0000
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 10976
          http://sourceforge.net/p/phpwiki/code/10976
Author:   vargenau
Date:     2022-02-03 17:37:36 +0000 (Thu, 03 Feb 2022)
Log Message:
-----------
WantedPages plugin: withlinks argument is a boolean, page argument default value is empty

Modified Paths:
--------------
    trunk/lib/plugin/WantedPages.php
    trunk/pgsrc/Help%2FWantedPagesPlugin

Modified: trunk/lib/plugin/WantedPages.php
===================================================================
--- trunk/lib/plugin/WantedPages.php	2022-02-03 16:05:35 UTC (rev 10975)
+++ trunk/lib/plugin/WantedPages.php	2022-02-03 17:37:36 UTC (rev 10976)
@@ -23,9 +23,6 @@
  */
 
 /**
- * Rewrite of WantedPages, which uses PageList and prints the references, not just the count.
- * It disables r1.6 but is more explicit, and of comparable convenience.
- *
  * A plugin which returns a list of referenced pages which do not exist yet.
  * All empty pages which are linked from any page - with an ending question mark,
  * or for just a single page, when the page argument is present.
@@ -50,17 +47,13 @@
         return array_merge
         (
             PageList::supportedArgs(),
-            array('page' => '[pagename]', // just for a single page.
-                'withlinks' => 0,
-                'noheader' => false,
-                'exclude_from' => __("InterWikiMap"),
-                'limit' => '100',
-                'paging' => 'auto'));
+            array('page' => '', // just for a single page.
+                  'withlinks' => false,
+                  'noheader' => false,
+                  'exclude_from' => __("InterWikiMap"),
+                  'limit' => '100'));
     }
 
-    // info arg allows multiple columns
-    // info=mtime,hits,summary,version,author,locked,minor,markup or all
-    // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
     /**
      * @param WikiDB $dbi
      * @param string $argstr
@@ -84,6 +77,16 @@
 
         extract($args);
 
+        if (!is_bool($withlinks)) {
+            if (($withlinks == '0') || ($withlinks == 'false')) {
+                $withlinks = false;
+            } elseif (($withlinks == '1') || ($withlinks == 'true')) {
+                $withlinks = true;
+            } else {
+                return $this->error(sprintf(_("Argument '%s' must be a boolean"), "withlinks"));
+            }
+        }
+
         if (!is_bool($noheader)) {
             if (($noheader == '0') || ($noheader == 'false')) {
                 $noheader = false;
@@ -94,8 +97,6 @@
             }
         }
 
-        if ($page == _("WantedPages")) $page = "";
-
         // There's probably a more memory-efficient way to do this (eg
         // a tailored SQL query via the backend, but this gets the job
         // done.

Modified: trunk/pgsrc/Help%2FWantedPagesPlugin
===================================================================
--- trunk/pgsrc/Help%2FWantedPagesPlugin	2022-02-03 16:05:35 UTC (rev 10975)
+++ trunk/pgsrc/Help%2FWantedPagesPlugin	2022-02-03 17:37:36 UTC (rev 10976)
@@ -1,4 +1,4 @@
-Date: Thu,  3 Feb 2022 16:54:43 +0000
+Date: Thu,  3 Feb 2022 18:34:11 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.1)
 Content-Type: application/x-phpwiki;
   pagename=Help%2FWantedPagesPlugin;
@@ -27,12 +27,12 @@
 ! Default value
 |-
 | **page**
-| just for a single page
-| pagename
+| Just for a single page.
+| //empty/
 |-
 | **withlinks**
-| display links
-| 0
+| Boolean. If true, display links.
+| false
 |-
 | **noheader**
 | Boolean. If true, header should be omitted.
@@ -39,16 +39,12 @@
 | false
 |-
 | **exclude_from**
-| Comma-separated list of pages to exclude
+| Comma-separated list of pages to exclude.
 | InterWikiMap
 |-
 | **limit**
-| maximum number of wanted pages to display
+| Maximum number of wanted pages to display.
 | 100
-|-
-| **paging**
-|
-| auto
 |}
 
 == Example ==

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.