64 $pos = strpos( $userName,
'>' );
65 $services = MediaWikiServices::getInstance();
66 if ( $pos !==
false ) {
67 $iw = explode(
':', substr( $userName, 0, $pos ) );
68 $firstIw = array_shift( $iw );
69 $interwikiLookup = $services->getInterwikiLookup();
70 if ( $interwikiLookup->isValidInterwiki( $firstIw ) ) {
71 $title = $services->getNamespaceInfo()->getCanonicalName(
NS_USER ) .
72 ':' . substr( $userName, $pos + 1 );
82 $services->getUserNameUtils()->isIP( $userName )
83 || $services->getUserNameUtils()->isValidIPRange( $userName )
84 || $services->getUserNameUtils()->isValid( $userName )
109 $userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils();
110 if ( $userNameUtils->getCanonical( $name, UserRigorOptions::RIGOR_USABLE ) ===
false ) {
114 if ( $this->assignKnownUsers ) {
120 if ( !isset( $this->triedCreations[$name] ) ) {
121 $this->triedCreations[$name] =
true;
140 return substr( $this->usernamePrefix .
'>' . $name, 0, 255 );
150 return strpos( $username,
'>' ) !==
false;
160 if ( !self::isExternal( $username ) ) {
164 return substr( $username, strpos( $username,
'>' ) + 1 );
Class to parse and build external user names.
static getUserLinkTitle( $userName)
Get a target Title to link a username.
addPrefix( $name)
Add an interwiki prefix to the username regardless of circumstances.
__construct( $usernamePrefix, $assignKnownUsers)
static isExternal( $username)
Tells whether the username is external or not.
static getLocal( $username)
Get local part of the user name.
applyPrefix( $name)
Add an interwiki prefix to the username, if appropriate.
static runner()
Get a HookRunner instance for calling hooks using the new interfaces.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static idFromName( $name, $flags=self::READ_NORMAL)
Get database id given a user name.