From: <var...@us...> - 2022-02-15 16:55:34
|
Revision: 11000 http://sourceforge.net/p/phpwiki/code/11000 Author: vargenau Date: 2022-02-15 16:55:31 +0000 (Tue, 15 Feb 2022) Log Message: ----------- lib/plugin/IncludePage.php: getWikiPageLinks returns links in the included page (as well as the included page) Modified Paths: -------------- trunk/lib/plugin/IncludePage.php Modified: trunk/lib/plugin/IncludePage.php =================================================================== --- trunk/lib/plugin/IncludePage.php 2022-02-15 15:32:18 UTC (rev 10999) +++ trunk/lib/plugin/IncludePage.php 2022-02-15 16:55:31 UTC (rev 11000) @@ -54,18 +54,28 @@ function getWikiPageLinks($argstr, $basepage) { - extract($this->getArgs($argstr)); + $args = $this->getArgs($argstr); + $page = isset($args['page']) ? $args['page'] : ''; - if (!isset($page)) - return false; - if ($page) { - // Expand relative page names. - $page = new WikiPageName($page, $basepage); + if (!$page) { + return array(); } - if (!$page or !$page->name) - return false; - return array(array('linkto' => $page->name)); + global $request; + $dbi = $request->_dbi; + $page_handle = $dbi->getPage($page); + $links = $page_handle->getPageLinks(); + $alllinks = array(); + while ($link_handle = $links->next()) { + $linkname = $link_handle->getName(); + $alllinks[] = array('linkto' => $linkname); + } + $page = new WikiPageName($page, $basepage); + if (!$page or !$page->name) { + return array(); + } + $alllinks[] = array('linkto' => $page->name); + return $alllinks; } // Avoid warning in: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |