// default
$gender = User::getDefaultOption( 'gender' );
- // allow prefix.
- $title = Title::newFromText( $username );
+ // allow prefix and normalize (e.g. "*foo" -> "*foo" ).
+ $title = Title::newFromText( $username, NS_USER );
if ( $title && $title->inNamespace( NS_USER ) ) {
$username = $title->getText();
}
public static function talkspace( $parser, $title = null ) {
$t = Title::newFromText( $title );
- if ( is_null( $t ) || !$t->canTalk() ) {
+ if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
return '';
}
return str_replace( '_', ' ', $t->getTalkNsText() );
}
public static function talkspacee( $parser, $title = null ) {
$t = Title::newFromText( $title );
- if ( is_null( $t ) || !$t->canTalk() ) {
+ if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
return '';
}
return wfUrlencode( $t->getTalkNsText() );
}
public static function fullpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
- if ( is_null( $t ) || !$t->canTalk() ) {
+ if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
return '';
}
return wfEscapeWikiText( $t->getPrefixedText() );
}
public static function fullpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
- if ( is_null( $t ) || !$t->canTalk() ) {
+ if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
return '';
}
return wfEscapeWikiText( $t->getPrefixedURL() );
}
public static function talkpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
- if ( is_null( $t ) || !$t->canTalk() ) {
+ if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
return '';
}
return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
}
public static function talkpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
- if ( is_null( $t ) || !$t->canTalk() ) {
+ if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
return '';
}
return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() );
$code = strtolower( $code );
$inLanguage = strtolower( $inLanguage );
$lang = Language::fetchLanguageName( $code, $inLanguage );
- return $lang !== '' ? $lang : wfBCP47( $code );
+ return $lang !== '' ? $lang : LanguageCode::bcp47( $code );
}
/**
*/
public static function anchorencode( $parser, $text ) {
$text = $parser->killMarkers( $text );
- return (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
+ $section = (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
+ return Sanitizer::safeEncodeAttribute( $section );
}
public static function special( $parser, $text ) {
if ( $argA == 'nowiki' ) {
// {{filepath: | option [| size] }}
$isNowiki = true;
- $parsedWidthParam = $parser->parseWidthParam( $argB );
+ $parsedWidthParam = Parser::parseWidthParam( $argB );
} else {
// {{filepath: [| size [|option]] }}
- $parsedWidthParam = $parser->parseWidthParam( $argA );
+ $parsedWidthParam = Parser::parseWidthParam( $argA );
$isNowiki = ( $argB == 'nowiki' );
}