MediaWiki  1.30.0
MediaWiki\Site\MediaWikiPageNameNormalizer Class Reference

Service for normalizing a page name using a MediaWiki api. More...

Collaboration diagram for MediaWiki\Site\MediaWikiPageNameNormalizer:

Public Member Functions

 __construct (Http $http=null)
 
 normalizePageName ( $pageName, $apiUrl)
 Returns the normalized form of the given page title, using the normalization rules of the given site. More...
 

Static Private Member Functions

static extractPageRecord ( $externalData, $pageTitle)
 Get normalization record for a given page title from an API response. More...
 

Private Attributes

Http $http
 

Detailed Description

Service for normalizing a page name using a MediaWiki api.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Since
1.27
Note
GNU GPL v2+
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 35 of file MediaWikiPageNameNormalizer.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Site\MediaWikiPageNameNormalizer::__construct ( Http  $http = null)
Parameters
Http | null$http

Definition at line 45 of file MediaWikiPageNameNormalizer.php.

References MediaWiki\Site\MediaWikiPageNameNormalizer\$http, and http.

Member Function Documentation

◆ extractPageRecord()

static MediaWiki\Site\MediaWikiPageNameNormalizer::extractPageRecord (   $externalData,
  $pageTitle 
)
staticprivate

Get normalization record for a given page title from an API response.

Parameters
array$externalDataA reply from the API on a external server.
string$pageTitleIdentifies the page at the external site, needing normalization.
Returns
array|bool A 'page' structure representing the page identified by $pageTitle.

Definition at line 147 of file MediaWikiPageNameNormalizer.php.

References as, captcha-old\count, and use.

◆ normalizePageName()

MediaWiki\Site\MediaWikiPageNameNormalizer::normalizePageName (   $pageName,
  $apiUrl 
)

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

If the given title is a redirect, the redirect weill be resolved and the redirect target is 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
Parameters
string$pageName
string$apiUrl
Returns
string
Exceptions

Definition at line 71 of file MediaWikiPageNameNormalizer.php.

References $args, $ret, FormatJson\decode(), http, wfAppendQuery(), and wfDebugLog().

Member Data Documentation

◆ $http

Http MediaWiki\Site\MediaWikiPageNameNormalizer::$http
private

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