MediaWiki master
MediaWiki\Title\NaiveForeignTitleFactory Class Reference

A parser that translates page titles on a foreign wiki into ForeignTitle objects, with no knowledge of the namespace setup on the foreign site. More...

Inherits MediaWiki\Title\ForeignTitleFactory.

Collaboration diagram for MediaWiki\Title\NaiveForeignTitleFactory:

Public Member Functions

 __construct (Language $contentLanguage)
 
 createForeignTitle ( $title, $ns=null)
 Create a ForeignTitle object.
 

Detailed Description

A parser that translates page titles on a foreign wiki into ForeignTitle objects, with no knowledge of the namespace setup on the foreign site.

Definition at line 29 of file NaiveForeignTitleFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Title\NaiveForeignTitleFactory::__construct ( Language $contentLanguage)

Definition at line 33 of file NaiveForeignTitleFactory.php.

Member Function Documentation

◆ createForeignTitle()

MediaWiki\Title\NaiveForeignTitleFactory::createForeignTitle ( $title,
$ns = null )

Create a ForeignTitle object.

Based on the page title and optionally the namespace ID, of a page on a foreign wiki. These values could be, for example, the <title> and <ns> attributes found in an XML dump.

Although exported XML dumps have contained a map of namespace IDs to names since MW 1.5, the importer used to completely ignore the <siteinfo> tag before MW 1.25. It is therefore possible that custom XML dumps (i.e. not generated by Special:Export) have been created without this metadata. As a result, this code falls back to using namespace data for the local wiki (similar to buggy pre-1.25 behaviour) if $ns is not supplied.

Parameters
string$titleThe page title
int | null$nsThe namespace ID, or null if this data is not available
Returns
ForeignTitle

Implements MediaWiki\Title\ForeignTitleFactory.

Definition at line 55 of file NaiveForeignTitleFactory.php.


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