Source for file Wikilink.php
Documentation is available at Wikilink.php
class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
'view_url' => 'http://example.com/index.php?page=%s',
'new_url' => 'http://example.com/new.php?page=%s',
* Renders a token into XHTML.
* @param array $options The "options" portion of the token (second
* @return string The text rendered from the token options.
// make nice variable names (page, anchor, text)
if (in_array($page, $this->getConf ('pages', array ()))) {
// yes, link to the page view, but we have to build
// the HREF. we support both the old form where
// the page always comes at the end, and the new
// form that uses %s for sprintf()
$href = $this->getConf ('view_url');
if (strpos($href, '%s') === false ) {
$href = $href . $page . $anchor;
$href = sprintf($href, $page . $anchor);
return " <a href=\"$href\">$text</a>";
// no, link to a create-page url, but only if new_url is set
$href = $this->getConf ('new_url', null );
if (! $href || trim($href) == '') {
// no useful href, return the text as it is
// yes, link to the page view, but we have to build
// the HREF. we support both the old form where
// the page always comes at the end, and the new
// form that uses sprintf()
if (strpos($href, '%s') === false ) {
return $text . " <a href=\"$href\">" . $this->getConf ('new_text') . "</a>";
Documentation generated on Mon, 11 Mar 2019 13:51:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|