From: <var...@us...> - 2022-02-15 16:58:08
|
Revision: 11001 http://sourceforge.net/p/phpwiki/code/11001 Author: vargenau Date: 2022-02-15 16:58:07 +0000 (Tue, 15 Feb 2022) Log Message: ----------- lib/plugin/Template.php: simplify getWikiPageLinks Modified Paths: -------------- trunk/lib/plugin/Template.php Modified: trunk/lib/plugin/Template.php =================================================================== --- trunk/lib/plugin/Template.php 2022-02-15 16:55:31 UTC (rev 11000) +++ trunk/lib/plugin/Template.php 2022-02-15 16:58:07 UTC (rev 11001) @@ -84,23 +84,25 @@ return $name != 'action'; } - // TODO: check if page can really be pulled from the args, or if it is just the basepage. function getWikiPageLinks($argstr, $basepage) { $args = $this->getArgs($argstr); $page = isset($args['page']) ? $args['page'] : ''; - if ($page) { - 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) { + return array(); } + + 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(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |