SF.net SVN: phpwiki:[11004] trunk

vargenau--- via phpwiki-checkins <[email protected]> Wed, 16 Feb 2022 18:24:27 +0000
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 11004
          http://sourceforge.net/p/phpwiki/code/11004
Author:   vargenau
Date:     2022-02-16 18:24:08 +0000 (Wed, 16 Feb 2022)
Log Message:
-----------
Back links now work when the link is inside a table

Modified Paths:
--------------
    trunk/lib/InlineParser.php
    trunk/lib/plugin/MediawikiTable.php
    trunk/lib/plugin/OldStyleTable.php
    trunk/lib/plugin/RichTable.php
    trunk/lib/plugin/WikicreoleTable.php
    trunk/locale/it/pgsrc/NoteDiRilascio
    trunk/pgsrc/Help%2FBackLinksPlugin
    trunk/pgsrc/ReleaseNotes

Modified: trunk/lib/InlineParser.php
===================================================================
--- trunk/lib/InlineParser.php	2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/lib/InlineParser.php	2022-02-16 18:24:08 UTC (rev 11004)
@@ -1387,3 +1387,20 @@
     }
     return $trfm->parse($text);
 }
+
+/**
+ * Return an array of links in given text
+ */
+function getTextLinks($text)
+{
+    $links = TransformLinks($text);
+    $links = $links->_content;
+    $wikilinks = array();
+    foreach ($links as $link) {
+        if (is_a($link, 'Cached_WikiLink')) {
+            $wikilinks[] = array('linkto' => $link->_page);
+        }
+    }
+    return $wikilinks;
+}
+

Modified: trunk/lib/plugin/MediawikiTable.php
===================================================================
--- trunk/lib/plugin/MediawikiTable.php	2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/lib/plugin/MediawikiTable.php	2022-02-16 18:24:08 UTC (rev 11004)
@@ -66,6 +66,22 @@
     }
 
     /**
+     * return links
+     *
+     * @param  string $argstr   The plugin argument string.
+     * @param  string $basepage The pagename the plugin is invoked from.
+     * @return array  List of pagenames linked to.
+     */
+    function getWikiPageLinks($argstr, $basepage)
+    {
+        return getTextLinks($argstr);
+    }
+
+    function handle_plugin_args_cruft($argstr, $args)
+    {
+    }
+
+    /**
      * @param WikiDB $dbi
      * @param string $argstr
      * @param WikiRequest $request

Modified: trunk/lib/plugin/OldStyleTable.php
===================================================================
--- trunk/lib/plugin/OldStyleTable.php	2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/lib/plugin/OldStyleTable.php	2022-02-16 18:24:08 UTC (rev 11004)
@@ -63,6 +63,18 @@
         );
     }
 
+    /**
+     * return links
+     *
+     * @param  string $argstr   The plugin argument string.
+     * @param  string $basepage The pagename the plugin is invoked from.
+     * @return array  List of pagenames linked to.
+     */
+    function getWikiPageLinks($argstr, $basepage)
+    {
+        return getTextLinks($argstr);
+    }
+
     function handle_plugin_args_cruft($argstr, $args)
     {
     }

Modified: trunk/lib/plugin/RichTable.php
===================================================================
--- trunk/lib/plugin/RichTable.php	2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/lib/plugin/RichTable.php	2022-02-16 18:24:08 UTC (rev 11004)
@@ -43,6 +43,22 @@
     }
 
     /**
+     * return links
+     *
+     * @param  string $argstr   The plugin argument string.
+     * @param  string $basepage The pagename the plugin is invoked from.
+     * @return array  List of pagenames linked to.
+     */
+    function getWikiPageLinks($argstr, $basepage)
+    {
+        return getTextLinks($argstr);
+    }
+
+    function handle_plugin_args_cruft($argstr, $args)
+    {
+    }
+
+    /**
      * @param WikiDB $dbi
      * @param string $argstr
      * @param WikiRequest $request

Modified: trunk/lib/plugin/WikicreoleTable.php
===================================================================
--- trunk/lib/plugin/WikicreoleTable.php	2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/lib/plugin/WikicreoleTable.php	2022-02-16 18:24:08 UTC (rev 11004)
@@ -63,6 +63,18 @@
         return array();
     }
 
+    /**
+     * return links
+     *
+     * @param  string $argstr   The plugin argument string.
+     * @param  string $basepage The pagename the plugin is invoked from.
+     * @return array  List of pagenames linked to.
+     */
+    function getWikiPageLinks($argstr, $basepage)
+    {
+        return getTextLinks($argstr);
+    }
+
     function handle_plugin_args_cruft($argstr, $args)
     {
     }

Modified: trunk/locale/it/pgsrc/NoteDiRilascio
===================================================================
--- trunk/locale/it/pgsrc/NoteDiRilascio	2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/locale/it/pgsrc/NoteDiRilascio	2022-02-16 18:24:08 UTC (rev 11004)
@@ -1,4 +1,4 @@
-Date: Mon,  7 Feb 2022 16:26:30 +0000
+Date: Wed, 16 Feb 2022 19:23:05 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.1)
 Content-Type: application/x-phpwiki;
   pagename=NoteDiRilascio;
@@ -13,6 +13,7 @@
 === Fixes ===
 * Make renaming of pages work for DATABASE_TYPE = PDO and file.
 * Make WantedPages work for DATABASE_TYPE = dba and file
+* Back links now work when the link is inside a table, in a template or in an included page.
 
 == 1.6.1 2022-01-24 Marc-Etienne Vargenau ==
 

Modified: trunk/pgsrc/Help%2FBackLinksPlugin
===================================================================
--- trunk/pgsrc/Help%2FBackLinksPlugin	2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/pgsrc/Help%2FBackLinksPlugin	2022-02-16 18:24:08 UTC (rev 11004)
@@ -1,4 +1,4 @@
-Date: Thu,  9 Dec 2021 18:48:34 +0000
+Date: Wed, 16 Feb 2022 19:23:05 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.1)
 Content-Type: application/x-phpwiki;
   pagename=Help%2FBackLinksPlugin;
@@ -59,8 +59,8 @@
 
 == Known Problems ==
 
-Back links will not be found if the link is inside a table, or in an included template,
-or in general if the link is in text generated by a plugin.
+Back links might not work if the link is in text generated by a plugin.
+Prior to ~PhpWiki 1.6.2, back links did not work if the link was inside a table, or in an included template,
 
 == Author ==
 * [[Help:Reini Urban|Reini Urban]]

Modified: trunk/pgsrc/ReleaseNotes
===================================================================
--- trunk/pgsrc/ReleaseNotes	2022-02-16 16:53:28 UTC (rev 11003)
+++ trunk/pgsrc/ReleaseNotes	2022-02-16 18:24:08 UTC (rev 11004)
@@ -1,4 +1,4 @@
-Date: Mon,  7 Feb 2022 16:26:30 +0000
+Date: Wed, 16 Feb 2022 19:23:05 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.1)
 Content-Type: application/x-phpwiki;
   pagename=ReleaseNotes;
@@ -13,6 +13,7 @@
 === Fixes ===
 * Make renaming of pages work for DATABASE_TYPE = PDO and file.
 * Make WantedPages work for DATABASE_TYPE = dba and file
+* Back links now work when the link is inside a table, in a template or in an included page.
 
 == 1.6.1 2022-01-24 Marc-Etienne Vargenau ==
 

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