Update of /cvsroot/phpwiki/phpwiki/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25424 Modified Files: InlineParser.php CachedMarkup.php PageType.php Log Message: New special interwiki link markup [:LinkTo] without storing the backlink Index: InlineParser.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/InlineParser.php,v retrieving revision 1.78 retrieving revision 1.79 diff -u -2 -b -p -d -r1.78 -r1.79 --- InlineParser.php 3 Sep 2006 09:53:52 -0000 1.78 +++ InlineParser.php 8 Oct 2006 12:38:11 -0000 1.79 @@ -404,4 +404,7 @@ function LinkBracketLink($bracketlink) { elseif (preg_match("/:[:-]/", $link) and !isImageLink($link)) return new Cached_SemanticLink($link, $label); + /* Do not store the link */ + elseif (substr($link,0,1) == ':') + return new Cached_InterwikiLink($link, $label); /* * Inline images in Interwiki urls's: @@ -799,5 +802,5 @@ class InlineTransformer 'old_emphasis', 'nestled_emphasis', 'html_emphasis', 'html_abbr', 'plugin', - 'isonumchars', 'isohexchars', 'html_entities' + 'isonumchars', 'isohexchars', /*'html_entities'*/ ); else @@ -981,4 +984,7 @@ function TransformInlineNowiki($text, $m // $Log$ +// Revision 1.79 2006年10月08日 12:38:11 rurban +// New special interwiki link markup [:LinkTo] without storing the backlink +// // Revision 1.78 2006年09月03日 09:53:52 rurban // more colors, case-insensitive color names Index: CachedMarkup.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/CachedMarkup.php,v retrieving revision 1.43 retrieving revision 1.44 diff -u -2 -b -p -d -r1.43 -r1.44 --- CachedMarkup.php 18 Jun 2006 11:00:58 -0000 1.43 +++ CachedMarkup.php 8 Oct 2006 12:38:11 -0000 1.44 @@ -2,5 +2,5 @@ rcs_id('$Id$'); /* Copyright (C) 2002 Geoffrey T. Dairiki <da...@da...> - * Copyright (C) 2004, 2005 $ThePhpWikiProgrammingTeam + * Copyright (C) 2004,2005,2006 $ThePhpWikiProgrammingTeam * * This file is part of PhpWiki. @@ -78,6 +78,5 @@ class CacheableMarkup extends XmlContent /** Get names of wikipages linked to. * - * @return array - * A hash of linkto=>pagenames, relation=>pagenames (strings). + * @return array of hashes { linkto=>pagename, relation=>pagename } */ function getWikiPageLinks() { @@ -90,5 +89,6 @@ class CacheableMarkup extends XmlContent $links = array_merge($links, $item_links); } - // array_unique has a bug with hashes! set_links checks for duplicates, array_merge does not + // array_unique has a bug with hashes! + // set_links checks for duplicates, array_merge does not //return array_unique($links); return $links; @@ -525,7 +525,24 @@ class Cached_InterwikiLink extends Cache } + function getPagename($basepage) { + list ($moniker, $page) = split (":", $this->_link, 2); + $page = new WikiPageName($page, $basepage); + if ($page->isValid()) return $page->name; + else return false; + } + + function getWikiPageLinks($basepage) { + if ($basepage == '') return false; + /* ":DontStoreLink" */ + if (substr($this->_link,0,1) == ':') return false; + /* store only links to valid pagenames */ + if ($link = $this->getPagename($basepage)) + return array(array('linkto' => $link, 'relation' => 0)); + else return false; // dont store external links + } + function _getName($basepage) { $label = isset($this->_label) ? $this->_label : false; - return ($label and is_string($label)) ? $label : $link; + return ($label and is_string($label)) ? $label : $this->_link; } Index: PageType.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/PageType.php,v retrieving revision 1.47 retrieving revision 1.48 diff -u -2 -b -p -d -r1.47 -r1.48 --- PageType.php 7 Aug 2005 09:14:38 -0000 1.47 +++ PageType.php 8 Oct 2006 12:38:11 -0000 1.48 @@ -2,5 +2,5 @@ rcs_id('$Id$'); /* - Copyright 1999,2000,2001,2002,2003,2004,2005 $ThePhpWikiProgrammingTeam + Copyright 1999,2000,2001,2002,2003,2004,2005,2006 $ThePhpWikiProgrammingTeam This file is part of PhpWiki. @@ -188,5 +188,9 @@ class PageType_interwikimap extends Page $link = HTML::a(array('href' => $url)); - if (!$linktext) { + if ($moniker == '') { // ":LinkName" + $link->pushContent(HTML::span(array('class' => 'wikipage'), $page)); + $link->setAttr('class', $linktext ? 'named-wiki' : 'wiki'); + } + elseif (!$linktext) { $link->pushContent(PossiblyGlueIconToText('interwiki', "$moniker:"), HTML::span(array('class' => 'wikipage'), $page)); @@ -211,5 +215,5 @@ class PageType_interwikimap extends Page } - // Add virtual monikers Upload: Talk: User: + // Add virtual monikers: "Upload:" "Talk:" "User:", ":" // and expand special variables %u, %b, %d @@ -225,4 +229,5 @@ class PageType_interwikimap extends Page $map["User"] = "%s"; } + // Talk:UserName => UserName/Discussion // Talk:PageName => PageName/Discussion as default, which might be overridden if (empty($map["Talk"])) { @@ -234,4 +239,7 @@ class PageType_interwikimap extends Page $map["Talk"] = "%s".SUBPAGE_SEPARATOR._("Discussion"); } + if (empty($map[''])) { // Magic syntax: Don't store links ":PageName" as backlink + $map[''] = '%s'; + } foreach (array('Upload','User','Talk') as $special) { @@ -504,4 +512,7 @@ class PageFormatter_pdf extends PageForm } // $Log$ +// Revision 1.48 2006年10月08日 12:38:11 rurban +// New special interwiki link markup [:LinkTo] without storing the backlink +// // Revision 1.47 2005年08月07日 09:14:38 rurban // fix comments