From ee50e4f1268fc5148dfab5c8352df65092b335d3 Mon Sep 17 00:00:00 2001 From: carstenklapp Date: Sat, 19 Jan 2002 19:29:49 +0000 Subject: [PATCH] Moved LinkUnknownWikiWord to Theme.php, removed get/setWikiMark functions. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@1359 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/Theme.php | 26 +++++++++++++---------- lib/stdlib.php | 40 ++++++----------------------------- themes/Hawaiian/themeinfo.php | 6 +----- themes/WikiTrek/themeinfo.php | 6 +----- themes/default/themeinfo.php | 5 +---- 5 files changed, 25 insertions(+), 58 deletions(-) diff --git a/lib/Theme.php b/lib/Theme.php index cc34779c1..da702bfa0 100644 --- a/lib/Theme.php +++ b/lib/Theme.php @@ -1,4 +1,4 @@ -_wikiMark = $wikimark ? $wikimark : "?%s"; - } - - function getWikiMark() { - if (! @$this->_wikiMark) - $this->setWikiMark(); - - return $this->_wikiMark; + function LinkUnknownWikiWord($wikiword, $linktext = '') { + if (empty($linktext)) { + $linktext = $wikiword; + if (defined("autosplit_wikiwords")) + $linktext=split_pagename($linktext); + $class = 'wikiunknown'; + } else + $class = 'named-wikiunknown'; + + return Element('span', array('class' => $class), + QElement('a', + array('href' => WikiURL($wikiword, + array('action' => 'edit'))), + '?') . Element('u', $linktext)); } diff --git a/lib/stdlib.php b/lib/stdlib.php index c9563f82c..23f854345 100644 --- a/lib/stdlib.php +++ b/lib/stdlib.php @@ -1,4 +1,4 @@ - LinkInterWikiLink($link, $linktext) (see /lib/interwiki.php) + function moved => LinkUnknownWikiWord($wikiword, $linktext) + (see /lib/Theme.php) function gone => UpdateRecentChanges($dbi, $pagename, $isnewpage) (see /lib/plugin/RecentChanges.php) @@ -150,7 +151,8 @@ function LinkWikiWord($wikiword, $linktext = '', $version = false) { if ($dbi->isWikiPage($wikiword)) return LinkExistingWikiWord($wikiword, $linktext); else - return LinkUnknownWikiWord($wikiword, $linktext); + global $Theme; + return $Theme->LinkUnknownWikiWord($wikiword, $linktext); } function LinkExistingWikiWord($wikiword, $linktext = '', $version = false) { @@ -172,35 +174,6 @@ function LinkExistingWikiWord($wikiword, $linktext = '', $version = false) { $linktext); } -function LinkUnknownWikiWord($wikiword, $linktext = '', $version = false) { - if (empty($linktext)) { - $linktext = $wikiword; - if (defined("autosplit_wikiwords")) - $linktext=split_pagename($linktext); - $class = 'wikiunknown'; - } else - $class = 'named-wikiunknown'; - - $attr = array('action' => 'edit'); - if ($version !== false) - $attr['version'] = $version; - - //FIXME: do this without global - global $Theme; - // Note: $qmark uses Element instead of QElement to allow html in the WikiMark. - $qmark = Element('a', array('href' => WikiURL($wikiword, $attr)), - $Theme->getWikiMark()); - - // FIXME: for some reason sprintf wants 4 arguments here!? - // lib/stdlib.php:196: Warning[2]: sprintf(): too few arguments - //$html = sprintf($qmark,$text,"",""); - - // FIXME: Sorry, this ugly hack is to prevent whole word from being inverted. - // For now this is necessary to use the new $Theme->setWikiMark("?%s") - $html = @ sprintf($qmark, "".Element('u', $linktext).""); - - return Element('span', array('class' => $class), $html); -} function LinkImage($url, $alt = '[External Image]') { // FIXME: Is this needed (or sufficient?) @@ -418,7 +391,8 @@ function ParseAndLink($bracketlink) { $link['link'] = LinkInterWikiLink($URL, $linkname); } else { $link['type'] = "wiki-unknown-$linktype"; - $link['link'] = LinkUnknownWikiWord($URL, $linkname); + global $Theme; + $link['link'] = $Theme->LinkUnknownWikiWord($URL, $linkname); } return $link; diff --git a/themes/Hawaiian/themeinfo.php b/themes/Hawaiian/themeinfo.php index ad60933cc..ed0f863b5 100644 --- a/themes/Hawaiian/themeinfo.php +++ b/themes/Hawaiian/themeinfo.php @@ -1,6 +1,6 @@ setLinkIcon('*', 'flower.png'); //define("RC_SEPARATOR_A", ' . . . '); //define("RC_SEPARATOR_B", ' --'); -// Controls whether the '?' appears before or after UnknownWikiWords. -// The PhpWiki default is for the '?' to appear before. -//$Theme->setWikiMark('?%s'); - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // (c-file-style: "gnu") diff --git a/themes/WikiTrek/themeinfo.php b/themes/WikiTrek/themeinfo.php index d0f9ba829..c6f9cf4ba 100644 --- a/themes/WikiTrek/themeinfo.php +++ b/themes/WikiTrek/themeinfo.php @@ -1,6 +1,6 @@ addImageAlias('signature', 'lights.gif'); $Theme->setDateTimeFormat("Stardate %Y%m%d.%H%M%S"); // may contain time of day $Theme->setDateFormat("Stardate %Y%m%d"); // must not contain time -// Controls whether the '?' appears before or after UnknownWikiWords. -// The PhpWiki default is for the '?' to appear before. -//$Theme->setWikiMark('?%s'); - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // (c-file-style: "gnu") diff --git a/themes/default/themeinfo.php b/themes/default/themeinfo.php index 78ebd9659..192b81375 100644 --- a/themes/default/themeinfo.php +++ b/themes/default/themeinfo.php @@ -1,5 +1,5 @@ setLinkIcon('*', 'url'); //$Theme->setButtonSeparator(' | '); -// Controls whether the '?' appears before or after UnknownWikiWords. -// The PhpWiki default is for the '?' to appear before. -//$Theme->setWikiMark('?%s'); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // (c-file-style: "gnu") -- 2.45.0