unset( $query['returnto'] );
unset( $query['returntoquery'] );
}
- $this->thisquery = wfArrayToCGI( $query );
+ $this->thisquery = wfArrayToCgi( $query );
$this->loggedin = $user->isLoggedIn();
$this->username = $user->getName();
$language_urls = array();
if ( !$wgHideInterlanguageLinks ) {
- foreach( $out->getLanguageLinks() as $l ) {
- $tmp = explode( ':', $l, 2 );
- $class = 'interwiki-' . $tmp[0];
- unset( $tmp );
- $nt = Title::newFromText( $l );
- if ( $nt ) {
- $ilLangName = Language::fetchLanguageName( $nt->getInterwiki() );
+ foreach( $out->getLanguageLinks() as $languageLinkText ) {
+ $languageLinkParts = explode( ':', $languageLinkText, 2 );
+ $class = 'interwiki-' . $languageLinkParts[0];
+ unset( $languageLinkParts );
+ $languageLinkTitle = Title::newFromText( $languageLinkText );
+ if ( $languageLinkTitle ) {
+ $ilInterwikiCode = $languageLinkTitle->getInterwiki();
+ $ilLangName = Language::fetchLanguageName( $ilInterwikiCode );
+
if ( strval( $ilLangName ) === '' ) {
- $ilLangName = $l;
+ $ilLangName = $languageLinkText;
} else {
$ilLangName = $this->formatLanguageName( $ilLangName );
}
+
$language_urls[] = array(
- 'href' => $nt->getFullURL(),
+ 'href' => $languageLinkTitle->getFullURL(),
'text' => $ilLangName,
- 'title' => $nt->getText(),
+ 'title' => $languageLinkTitle->getText(),
'class' => $class,
- 'lang' => $nt->getInterwiki(),
- 'hreflang' => $nt->getInterwiki(),
+ 'lang' => $ilInterwikiCode,
+ 'hreflang' => $ilInterwikiCode
);
}
}
$a['wpStickHTTPS'] = true;
}
- $returnto = wfArrayToCGI( $a );
+ $returnto = wfArrayToCgi( $a );
if( $this->loggedin ) {
$personal_urls['userpage'] = array(
'text' => $this->username,
$is_signup = $request->getText( 'type' ) == 'signup';
# anonlogin & login are the same
- global $wgSecureLogin;
$proto = $wgSecureLogin ? PROTO_HTTPS : null;
$login_id = $this->showIPinHeader() ? 'anonlogin' : 'login';
}
/**
- * TODO document
- * @param $title Title
- * @param $message String message key
- * @param $selected Bool
- * @param $query String
- * @param $checkEdit Bool
+ * Builds an array with tab definition
+ *
+ * @param Title $title page where the tab links to
+ * @param string|array $message message key or an array of message keys (will fall back)
+ * @param boolean $selected display the tab as selected
+ * @param string $query query string attached to tab URL
+ * @param boolean $checkEdit check if $title exists and mark with .new if one doesn't
+ *
* @return array
*/
function tabAction( $title, $message, $selected, $query = '', $checkEdit = false ) {
}
if( $checkEdit && !$title->isKnown() ) {
$classes[] = 'new';
- $query = 'action=edit&redlink=1';
+ if ( $query !== '' ) {
+ $query = 'action=edit&redlink=1&' . $query;
+ } else {
+ $query = 'action=edit&redlink=1';
+ }
}
// wfMessageFallback will nicely accept $message as an array of fallbacks
}
}
- if ( $title->getNamespace() !== NS_MEDIAWIKI && $title->quickUserCan( 'protect', $user ) ) {
+ if ( $title->getNamespace() !== NS_MEDIAWIKI && $title->quickUserCan( 'protect', $user ) && $title->getRestrictionTypes() ) {
$mode = $title->isProtected() ? 'unprotect' : 'protect';
$content_navigation['actions'][$mode] = array(
'class' => ( $onPage && $action == $mode ) ? 'selected' : false,
// Gets preferred variant (note that user preference is
// only possible for wiki content language variant)
$preferred = $pageLang->getPreferredVariant();
+ if ( Action::getActionName( $this ) === 'view' ) {
+ $params = $request->getQueryValues();
+ unset( $params['title'] );
+ } else {
+ $params = array();
+ }
// Loops over each variant
foreach( $variants as $code ) {
// Gets variant name from language code
$content_navigation['variants'][] = array(
'class' => ( $code == $preferred ) ? 'selected' : false,
'text' => $varname,
- 'href' => $title->getLocalURL( array( 'variant' => $code ) ),
+ 'href' => $title->getLocalURL( array( 'variant' => $code ) + $params ),
'lang' => $code,
'hreflang' => $code
);
$rootUser = $user->getName();
$nav_urls['contributions'] = array(
+ 'text' => $this->msg( 'contributions', $rootUser )->text(),
'href' => self::makeSpecialUrlSubpage( 'Contributions', $rootUser )
);
$attrs['class'] .= ' active';
$attrs['class'] = trim( $attrs['class'] );
}
-
- // A special case for the talk link in personal tools.
- // See bug 41672 and 42337.
- if ( $key === 'mytalk' ) {
- $html = $this->getMsg( 'parentheses' )->rawParams( $html )->escaped();
- }
-
return Html::rawElement( isset( $options['tag'] ) ? $options['tag'] : 'li', $attrs, $html );
}