Assembles all parts defined in $link returns HTML for the link
public _formatLink ( array $link ) : string | ||
$link | array | attributes of a link |
Résultat | string |
/** * reformat links if needed */ function _formatLink($link) { // for internal links contains the title the pageid if (in_array($link['title'], $this->actioninstance->getExportedPages())) { list(, $hash) = explode('#', $link['url'], 2); $check = false; $pid = sectionID($link['title'], $check); $link['url'] = "#" . $pid . '__' . $hash; } // prefix interwiki links with interwiki icon if ($link['name'][0] != '<' && preg_match('/\\binterwiki iw_(.\\w+)\\b/', $link['class'], $m)) { if (file_exists(DOKU_INC . 'lib/images/interwiki/' . $m[1] . '.png')) { $img = DOKU_BASE . 'lib/images/interwiki/' . $m[1] . '.png'; } elseif (file_exists(DOKU_INC . 'lib/images/interwiki/' . $m[1] . '.gif')) { $img = DOKU_BASE . 'lib/images/interwiki/' . $m[1] . '.gif'; } else { $img = DOKU_BASE . 'lib/images/interwiki.png'; } $link['name'] = '<img src="' . $img . '" width="16" height="16" style="vertical-align: center" class="' . $link['class'] . '" />' . $link['name']; } return parent::_formatLink($link); }
function set_footnote($link, $note_url = "") { $out = $link['name']; $fn_id = epub_fn(); $link['name'] = "[{$fn_id}]"; if (preg_match("/media\\s*=\\s*(http.*)/", $link['url'], $matches)) { //format external urls $note_url = urldecode($matches[1]); } $link['url'] = 'footnotes.html#' . $this->current_page; $link['class'] = 'wikilink1'; $id = 'backto_' . $fn_id; $hash_link = "<a id='{$id}' name='{$id}'>"; $out .= $hash_link . parent::_formatLink($link) . '</a>'; epub_write_footnote($fn_id, $this->current_page, $note_url); return $out; }
/** * reformat links if needed */ function _formatLink($link) { // prefix interwiki links with interwiki icon if ($link['name'][0] != '<' && preg_match('/\\binterwiki iw_(.\\w+)\\b/', $link['class'], $m)) { if (file_exists(DOKU_INC . 'lib/images/interwiki/' . $m[1] . '.png')) { $img = DOKU_BASE . 'lib/images/interwiki/' . $m[1] . '.png'; } elseif (file_exists(DOKU_INC . 'lib/images/interwiki/' . $m[1] . '.gif')) { $img = DOKU_BASE . 'lib/images/interwiki/' . $m[1] . '.gif'; } else { $img = DOKU_BASE . 'lib/images/interwiki.png'; } $link['name'] = '<img src="' . $img . '" width="16" height="16" style="vertical-align: center" class="' . $link['class'] . '" />' . $link['name']; } return parent::_formatLink($link); }