http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88646
Revision: 88646
Author: ialex
Date: 2011-05-23 16:32:52 +0000 (Mon, 23 May 2011)
Log Message:
-----------
* Simplify message existence checks by using wfMessage() instead of wfMsg()
with wfEmptyMsg()
* Fixed one check in Skin::addToSidebarPlain() that used user language for
existence and content language for message's content
* Changed SkinTemplate::buildContentNavigationUrls() to use
Title::getDefaultMessageText() instead of wfEmptyMsg()
Modified Paths:
--------------
trunk/phase3/includes/Skin.php
trunk/phase3/includes/SkinTemplate.php
trunk/phase3/skins/CologneBlue.php
trunk/phase3/skins/MonoBook.php
trunk/phase3/skins/Vector.php
Modified: trunk/phase3/includes/Skin.php
===================================================================
--- trunk/phase3/includes/Skin.php 2011-05-23 16:07:19 UTC (rev 88645)
+++ trunk/phase3/includes/Skin.php 2011-05-23 16:32:52 UTC (rev 88646)
@@ -1253,22 +1253,24 @@
if ( strpos( $line, '|' ) !== false ) { //
sanity check
$line =
MessageCache::singleton()->transform( $line, false, null, $this->getTitle() );
$line = array_map( 'trim', explode(
'|', $line, 2 ) );
- $link = wfMsgForContent( $line[0] );
- if ( $link == '-' ) {
- continue;
+ $msgLink = wfMessage( $line[0]
)->inContentLanguage();
+ if ( $msgLink->exists() ) {
+ $link = $msgLink->text();
+ if ( $link == '-' ) {
+ continue;
+ }
+ } else {
+ $link = $line[0];
}
- $text = wfMsgExt( $line[1], 'parsemag'
);
-
- if ( wfEmptyMsg( $line[1] ) ) {
+ $msgText = wfMessage( $line[1] );
+ if ( $msgText->exists() ) {
+ $text = $msgText->text();
+ } else {
$text = $line[1];
}
- if ( wfEmptyMsg( $line[0] ) ) {
- $link = $line[0];
- }
-
if ( preg_match( '/^(?:' .
wfUrlProtocols() . ')/', $link ) ) {
$href = $link;
} else {
Modified: trunk/phase3/includes/SkinTemplate.php
===================================================================
--- trunk/phase3/includes/SkinTemplate.php 2011-05-23 16:07:19 UTC (rev
88645)
+++ trunk/phase3/includes/SkinTemplate.php 2011-05-23 16:32:52 UTC (rev
88646)
@@ -905,7 +905,7 @@
( $action == 'edit' || $action ==
'submit' ) &&
( $section != 'new' )
);
- $msgKey = $title->exists() || (
$title->getNamespace() == NS_MEDIAWIKI && !wfEmptyMsg( $title->getText() ) ) ?
+ $msgKey = $title->exists() || (
$title->getNamespace() == NS_MEDIAWIKI && $title->getDefaultMessageText() !==
false ) ?
"edit" : "create";
$content_navigation['views']['edit'] = array(
'class' => ( $selected ? 'selected' :
'' ) . $isTalkClass,
Modified: trunk/phase3/skins/CologneBlue.php
===================================================================
--- trunk/phase3/skins/CologneBlue.php 2011-05-23 16:07:19 UTC (rev 88645)
+++ trunk/phase3/skins/CologneBlue.php 2011-05-23 16:32:52 UTC (rev 88646)
@@ -216,12 +216,12 @@
$barnumber = 1;
foreach ( $bar as $heading => $browseLinks ) {
- $heading_text = wfMsg ( $heading );
if ( $barnumber > 1 ) {
- if ( wfEmptyMsg( $heading, $heading_text ) ) {
+ $headingMsg = wfMessage( $heading );
+ if ( $headingMsg->exists() ) {
+ $h = $headingMsg->text();
+ } else {
$h = $heading;
- } else {
- $h = $heading_text;
}
$s .= "\n<h6>" . htmlspecialchars( $h ) .
"</h6>";
}
@@ -231,7 +231,7 @@
htmlspecialchars( $link['text']
) . '</a>' . $sep;
}
}
- $barnumber = $barnumber + 1;
+ $barnumber++;
}
if ( $wgOut->isArticle() ) {
Modified: trunk/phase3/skins/MonoBook.php
===================================================================
--- trunk/phase3/skins/MonoBook.php 2011-05-23 16:07:19 UTC (rev 88645)
+++ trunk/phase3/skins/MonoBook.php 2011-05-23 16:32:52 UTC (rev 88646)
@@ -288,7 +288,7 @@
echo ' ' . Html::openElement( 'div', $portletAttribs );
?>
- <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar)) echo
htmlspecialchars($bar); else echo htmlspecialchars($out); ?></h5>
+ <h5><?php $msg = wfMessage( $bar ); echo htmlspecialchars(
$msg->exists() ? $msg->text() : $bar ); ?></h5>
<div class='pBody'>
<?php if ( is_array( $cont ) ) { ?>
<ul>
Modified: trunk/phase3/skins/Vector.php
===================================================================
--- trunk/phase3/skins/Vector.php 2011-05-23 16:07:19 UTC (rev 88645)
+++ trunk/phase3/skins/Vector.php 2011-05-23 16:32:52 UTC (rev 88646)
@@ -298,7 +298,7 @@
}
?>
<div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php
echo Linker::tooltip( 'p-' . $name ) ?>>
- <h5<?php $this->html( 'userlangattributes' ) ?>><?php $out = wfMsg(
$msg ); if ( wfEmptyMsg( $msg ) ) echo htmlspecialchars( $msg ); else echo
htmlspecialchars( $out ); ?></h5>
+ <h5<?php $this->html( 'userlangattributes' ) ?>><?php $msgObj =
wfMessage( $msg ); echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() :
$msg ); ?></h5>
<div class="body">
<?php
if ( is_array( $content ) ): ?>
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs