cvs: pear /Text_Wiki/Text/Wiki/Render/Xhtml Interwiki.php

From: Date: Sat, 25 Feb 2006 05:03:13 +0000
Subject: cvs: pear /Text_Wiki/Text/Wiki/Render/Xhtml Interwiki.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-38578@lists.php.net to get a copy of this message
toggg Sat Feb 25 05:03:13 2006 UTC Modified files: /pear/Text_Wiki/Text/Wiki/Render/Xhtml Interwiki.php Log: Allow parsers to give the full url in token options instead of the site + wiki page http://cvs.php.net/viewcvs.cgi/pear/Text_Wiki/Text/Wiki/Render/Xhtml/Interwiki.php?r1=1.13&r2=1.14&diff_format=u Index: pear/Text_Wiki/Text/Wiki/Render/Xhtml/Interwiki.php diff -u pear/Text_Wiki/Text/Wiki/Render/Xhtml/Interwiki.php:1.13 pear/Text_Wiki/Text/Wiki/Render/Xhtml/Interwiki.php:1.14 --- pear/Text_Wiki/Text/Wiki/Render/Xhtml/Interwiki.php:1.13 Fri Feb 10 23:07:03 2006 +++ pear/Text_Wiki/Text/Wiki/Render/Xhtml/Interwiki.php Sat Feb 25 05:03:13 2006 @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones <pmjones@php.net> * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Interwiki.php,v 1.13 2006/02/10 23:07:03 toggg Exp $ + * @version CVS: $Id: Interwiki.php,v 1.14 2006/02/25 05:03:13 toggg Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -51,32 +51,37 @@ function token($options) { - $site = $options['site']; - // toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces) - $page = $this->urlEncode($options['page']); $text = $options['text']; - $css = $this->formatConf(' class="%s"', 'css'); - - if (isset($this->conf['sites'][$site])) { - $href = $this->conf['sites'][$site]; - } else { - return $text; - } - - // old form where page is at end, - // or new form with %s placeholder for sprintf()? - if (strpos($href, '%s') === false) { - // use the old form - $href = $href . $page; + if (isset($options['url'])) { + // calculated by the parser (e.g. Mediawiki) + $href = $options['url']; } else { - // use the new form - $href = sprintf($href, $page); + $site = $options['site']; + // toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces) + $page = $this->urlEncode($options['page']); + + if (isset($this->conf['sites'][$site])) { + $href = $this->conf['sites'][$site]; + } else { + return $text; + } + + // old form where page is at end, + // or new form with %s placeholder for sprintf()? + if (strpos($href, '%s') === false) { + // use the old form + $href = $href . $page; + } else { + // use the new form + $href = sprintf($href, $page); + } } // allow for alternative targets $target = $this->getConf('target'); // build base link + $css = $this->formatConf(' class="%s"', 'css'); $text = $this->textEncode($text); $output = "<a$css href=\"$href\"";

« previous php.pear.cvs (#38578) next »