From 1576102b47d220c37a193a021df931546fdfe4fd Mon Sep 17 00:00:00 2001 From: Rotem Liss Date: Sun, 6 Aug 2006 18:08:21 +0000 Subject: [PATCH] Using a new function, Language::getArrow, to check the direction, instead of hard-coding the arrows and the checks; adding direction marks in Special:DoubleRedirects; adding the real arrows (instead of =>) in Special:Disambiguations. --- includes/SpecialBrokenRedirects.php | 2 +- includes/SpecialDisambiguations.php | 5 +++-- includes/SpecialDoubleRedirects.php | 2 +- includes/SpecialListredirects.php | 5 +---- languages/Language.php | 17 ++++++++++++++--- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/includes/SpecialBrokenRedirects.php b/includes/SpecialBrokenRedirects.php index e5c2dd8e04..653e13e244 100644 --- a/includes/SpecialBrokenRedirects.php +++ b/includes/SpecialBrokenRedirects.php @@ -68,7 +68,7 @@ class BrokenRedirectsPage extends PageQueryPage { $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' ); $edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no'); $to = $skin->makeBrokenLinkObj( $toObj ); - $arr = $wgContLang->isRTL() ? '←' : '→'; + $arr = $wgContLang->getArrow(); return "$from $edit $arr $to"; } diff --git a/includes/SpecialDisambiguations.php b/includes/SpecialDisambiguations.php index 1a0297af72..f57b732073 100644 --- a/includes/SpecialDisambiguations.php +++ b/includes/SpecialDisambiguations.php @@ -23,7 +23,6 @@ class DisambiguationsPage extends PageQueryPage { global $wgUser; $sk = $wgUser->getSkin(); - #FIXME : probably need to add a backlink to the maintenance page. return '

'.wfMsg('disambiguationstext', $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."


\n"; } @@ -57,14 +56,16 @@ class DisambiguationsPage extends PageQueryPage { } function formatResult( $skin, $result ) { + global $wgContLang; $title = Title::newFromId( $result->value ); $dp = Title::makeTitle( $result->namespace, $result->title ); $from = $skin->makeKnownLinkObj( $title,''); $edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no'); + $arr = $wgContLang->getArrow(); $to = $skin->makeKnownLinkObj( $dp,''); - return "$from $edit => $to"; + return "$from $edit $arr $to"; } } diff --git a/includes/SpecialDoubleRedirects.php b/includes/SpecialDoubleRedirects.php index fe480f60a1..fe42b00a1b 100644 --- a/includes/SpecialDoubleRedirects.php +++ b/includes/SpecialDoubleRedirects.php @@ -87,7 +87,7 @@ class DoubleRedirectsPage extends PageQueryPage { $edit = $skin->makeBrokenLinkObj( $titleA, "(".wfMsg("qbedit").")" , 'redirect=no'); $linkB = $skin->makeKnownLinkObj( $titleB, '', 'redirect=no' ); $linkC = $skin->makeKnownLinkObj( $titleC ); - $arr = $wgContLang->isRTL() ? '←' : '→'; + $arr = $wgContLang->getArrow() . $wgContLang->getDirMark(); return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" ); } diff --git a/includes/SpecialListredirects.php b/includes/SpecialListredirects.php index a7ae44f574..0dca85ab73 100644 --- a/includes/SpecialListredirects.php +++ b/includes/SpecialListredirects.php @@ -32,6 +32,7 @@ class ListredirectsPage extends QueryPage { # Make a link to the redirect itself $rd_title = Title::makeTitle( $result->namespace, $result->title ); + $arr = $wgContLang->getArrow() . $wgContLang->getDirMark(); $rd_link = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' ); # Find out where the redirect leads @@ -50,10 +51,6 @@ class ListredirectsPage extends QueryPage { $targetLink = '*'; } - # Check the language; RTL wikis need a ← - $arr = $wgContLang->isRTL() ? ' ← ' : ' → '; - $arr .= $wgContLang->getDirMark(); - # Format the whole thing and return it return( $rd_link . $arr . $targetLink ); diff --git a/languages/Language.php b/languages/Language.php index 33e5f467e4..2a8fb99b4e 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -884,16 +884,27 @@ class Language { * * @return string */ - function getDirMark() { return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E"; } + function getDirMark() { + return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E"; + } + + /** + * An arrow, depending on the language direction + * + * @return string + */ + function getArrow() { + return $this->isRTL() ? '←' : '→'; + } /** * To allow "foo[[bar]]" to extend the link over the whole word "foobar" * * @return bool */ - function linkPrefixExtension() { + function linkPrefixExtension() { $this->load(); - return $this->linkPrefixExtension; + return $this->linkPrefixExtension; } function &getMagicWords() { -- 2.20.1