MediaWiki REL1_40
MediaWiki\Site\MediaWikiPageNameNormalizer Class Reference

Service for normalizing a page name via a MediaWiki action API. More...

Public Member Functions

 __construct ( $httpRequestFactory=null)
 
 normalizePageName ( $pageName, $apiUrl, $followRedirect=self::FOLLOW_REDIRECT)
 Returns the normalized form of the given page title, using the normalization rules of the given site.
 

Public Attributes

const FOLLOW_REDIRECT = 1
 
const NOFOLLOW_REDIRECT = 2
 

Detailed Description

Service for normalizing a page name via a MediaWiki action API.

Since
1.27
Author
John Erling Blad < jebla.nosp@m.d@gm.nosp@m.ail.c.nosp@m.om >
Daniel Kinzler
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Marius Hoch

Definition at line 38 of file MediaWikiPageNameNormalizer.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Site\MediaWikiPageNameNormalizer::__construct ( $httpRequestFactory = null)
Parameters
HttpRequestFactory | null$httpRequestFactory

Definition at line 51 of file MediaWikiPageNameNormalizer.php.

References MediaWiki\MediaWikiServices\getInstance().

Member Function Documentation

◆ normalizePageName()

MediaWiki\Site\MediaWikiPageNameNormalizer::normalizePageName ( $pageName,
$apiUrl,
$followRedirect = self::FOLLOW_REDIRECT )

Returns the normalized form of the given page title, using the normalization rules of the given site.

If $followRedirect is set to self::FOLLOW_REDIRECT (default) and the given title is a redirect, the redirect will be resolved and the redirect target is returned. Only titles of existing pages will be returned.

Note
This actually makes an API request to the remote site, so beware that this function is slow and depends on an external service.
See also
Site::normalizePageName
Since
1.27
1.37 Added $followRedirect
Parameters
string$pageName
string$apiUrl
int$followRedirecteither self::FOLLOW_REDIRECT or self::NOFOLLOW_REDIRECT
Returns
string|false The normalized form of the title, or false to indicate an invalid title, a missing page, or some other kind of error.
Exceptions

\MWException

Exceptions
InvalidArgumentException

Definition at line 83 of file MediaWikiPageNameNormalizer.php.

References wfAppendQuery(), and wfDebugLog().

Member Data Documentation

◆ FOLLOW_REDIRECT

const MediaWiki\Site\MediaWikiPageNameNormalizer::FOLLOW_REDIRECT = 1

Definition at line 40 of file MediaWikiPageNameNormalizer.php.

◆ NOFOLLOW_REDIRECT

const MediaWiki\Site\MediaWikiPageNameNormalizer::NOFOLLOW_REDIRECT = 2

Definition at line 41 of file MediaWikiPageNameNormalizer.php.


The documentation for this class was generated from the following file: