Render an external link
public externallink ( string $url, string | array $name = null, boolean $returnonly = false ) : void | string | ||
$url | string | full URL with scheme |
$name | string | array | name for the link, array for media file |
$returnonly | boolean | whether to return html or write to doc attribute |
return | void | string | writes to doc attribute or returns html depends on $returnonly |
protected function convertToLink($href, $label, $varspace = array()) { $href = trim($href); if ($href === '') { return $label; } if (is_array($varspace) && count($varspace)) { $href = $this->replaceMarkup($href, $varspace); } if (strpos($href, '://') !== false) { // embed external link in header // externallink() is adding to renderer->doc() ... // --> remove from doc afterwards, thus store its length now $length = strlen($this->renderer->doc); $this->renderer->externallink($href, $label); // --> now extract rendered link from doc $label = substr($this->renderer->doc, $length); $this->renderer->doc = substr_replace($this->renderer->doc, '', $length); } else { // embed internal link in header resolve_pageid(getNS(self::getPageID()), $href, $exists); $label = $this->renderer->internallink($href, $label, NULL, true); } return $label; }
/** * list all installed plugins * * uses some of the original renderer methods * * @param string $type * @param Doku_Renderer_xhtml $renderer */ function _plugins_xhtml($type, Doku_Renderer_xhtml $renderer) { global $lang; $renderer->doc .= '<ul>'; $plugins = plugin_list($type); $plginfo = array(); // remove subparts foreach ($plugins as $p) { if (!($po = plugin_load($type, $p))) { continue; } list($name, ) = explode('_', $p, 2); $plginfo[$name] = $po->getInfo(); } // list them foreach ($plginfo as $info) { $renderer->doc .= '<li><div class="li">'; $renderer->externallink($info['url'], $info['name']); $renderer->doc .= ' '; $renderer->doc .= '<em>' . $info['date'] . '</em>'; $renderer->doc .= ' '; $renderer->doc .= $lang['by']; $renderer->doc .= ' '; $renderer->emaillink($info['email'], $info['author']); $renderer->doc .= '<br />'; $renderer->doc .= strtr(hsc($info['desc']), array("\n" => "<br />")); $renderer->doc .= '</div></li>'; unset($po); } $renderer->doc .= '</ul>'; }