/** * Lists all links contained in a wiki page * * @author Michael Klier <*****@*****.**> */ function listLinks($id) { $id = $this->resolvePageId($id); if (auth_quickaclcheck($id) < AUTH_READ) { throw new RemoteAccessDeniedException('You are not allowed to read this page', 111); } $links = array(); // resolve page instructions $ins = p_cached_instructions(wikiFN($id)); // instantiate new Renderer - needed for interwiki links include DOKU_INC . 'inc/parser/xhtml.php'; $Renderer = new Doku_Renderer_xhtml(); $Renderer->interwiki = getInterwiki(); // parse parse instructions foreach ($ins as $in) { $link = array(); switch ($in[0]) { case 'internallink': $link['type'] = 'local'; $link['page'] = $in[1][0]; $link['href'] = wl($in[1][0]); array_push($links, $link); break; case 'externallink': $link['type'] = 'extern'; $link['page'] = $in[1][0]; $link['href'] = $in[1][0]; array_push($links, $link); break; case 'interwikilink': $url = $Renderer->_resolveInterWiki($in[1][2], $in[1][3]); $link['type'] = 'extern'; $link['page'] = $url; $link['href'] = $url; array_push($links, $link); break; } } return $links; }