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

From: Date: Sat, 25 Feb 2006 05:10:10 +0000
Subject: cvs: pear /Text_Wiki/Text/Wiki/Render/Latex Interwiki.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-38579@lists.php.net to get a copy of this message
toggg Sat Feb 25 05:10:10 2006 UTC Modified files: /pear/Text_Wiki/Text/Wiki/Render/Latex Interwiki.php Log: Allow parsers to give the full url in token options instead of the site + wiki page Urlencode the page name Removed unused configuration option 'target' http://cvs.php.net/viewcvs.cgi/pear/Text_Wiki/Text/Wiki/Render/Latex/Interwiki.php?r1=1.2&r2=1.3&diff_format=u Index: pear/Text_Wiki/Text/Wiki/Render/Latex/Interwiki.php diff -u pear/Text_Wiki/Text/Wiki/Render/Latex/Interwiki.php:1.2 pear/Text_Wiki/Text/Wiki/Render/Latex/Interwiki.php:1.3 --- pear/Text_Wiki/Text/Wiki/Render/Latex/Interwiki.php:1.2 Sat Sep 25 19:05:13 2004 +++ pear/Text_Wiki/Text/Wiki/Render/Latex/Interwiki.php Sat Feb 25 05:10:10 2006 @@ -7,8 +7,7 @@ 'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s', 'Advogato' => 'http://advogato.org/%s', 'Wiki' => 'http://c2.com/cgi/wiki?%s' - ), - 'target' => '_blank' + ) ); @@ -27,34 +26,33 @@ function token($options) { - $site = $options['site']; - $page = $options['page']; $text = $options['text']; - - 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); - } - - // allow for alternative targets - $target = $this->getConf('target', ''); - - if ($target && trim($target) != '') { - $target = " target=\"$target\""; + $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); + } } return "$text\\footnote\{$href}"; } } -?> \ No newline at end of file +?>

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