cvs: pear /Text_Wiki/Text/Wiki/Parse/Mediawiki Wikilink.php
| From: | bertrand Gugger | Date: | Sat, 25 Feb 2006 07:47:57 +0000 |
| Subject: | cvs: pear /Text_Wiki/Text/Wiki/Parse/Mediawiki Wikilink.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-38585@lists.php.net to get a copy of this message | ||
toggg Sat Feb 25 07:47:57 2006 UTC
Modified files:
/pear/Text_Wiki/Text/Wiki/Parse/Mediawiki Wikilink.php
Log:
Process interlangage only as an Interwiki
http://cvs.php.net/viewcvs.cgi/pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Wikilink.php?r1=1.4&r2=1.5&diff_format=u
Index: pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Wikilink.php
diff -u pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Wikilink.php:1.4
pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Wikilink.php:1.5
--- pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Wikilink.php:1.4 Sat Feb 25 04:19:55 2006
+++ pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Wikilink.php Sat Feb 25 07:47:57 2006
@@ -18,7 +18,7 @@
* @author Paul M. Jones <pmjones@php.net>
* @copyright 2005 bertrand Gugger
* @license http://www.gnu.org/copyleft/lesser.html LGPL
License 2.1
- * @version CVS: $Id: Wikilink.php,v 1.4 2006/02/25 04:19:55 toggg Exp $
+ * @version CVS: $Id: Wikilink.php,v 1.5 2006/02/25 07:47:57 toggg Exp $
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -49,6 +49,7 @@
var $conf = array(
'spaceUnderscore' => true,
'project' => array('demo', 'd'),
+ 'url' => 'http://example.com/en/page=%s'
'lang' => 'en'
);
@@ -158,7 +159,8 @@
$count = count($prefix);
$i = -1;
// Autolink
- if (in_array(trim($prefix[0]), $this->conf['project'])) {
+ if (isset($this->conf['project']) &&
+ in_array(trim($prefix[0]), $this->conf['project'])) {
$auto = trim($prefix[0]);
unset($prefix[0]);
$i = 0;
@@ -200,11 +202,22 @@
return $this->image($matches[3] . (empty($matches[4]) ? '' : '#'
. $matches[4]),
$text, $interlang, $colon);
}
+ if (!$interwiki && $interlang && isset($this->conf['url'])) {
+ if ($interlang == $this->conf['langage']) {
+ $interlang = '';
+ } else {
+ $interwiki = $this->conf['url'];
+ }
+ }
if ($interwiki) {
return $this->interwiki($interwiki,
$matches[3] . (empty($matches[4]) ? '' : '#' . $matches[4]),
$text, $interlang, $colon);
}
+ if ($interlang) {
+ $matches[3] = $interlang . ':' . $matches[3];
+ $text = (empty($matches[5]) ? $interlang . ':' : '') . $text;
+ }
// set the options
$options = array(
'page' => $matches[3],