MediaWiki REL1_40
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 ForeignTitleFactory.

Collaboration diagram for 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 25 of file NaiveForeignTitleFactory.php.

Constructor & Destructor Documentation

◆ __construct()

NaiveForeignTitleFactory::__construct ( Language $contentLanguage)
Parameters
Language$contentLanguage

Definition at line 33 of file NaiveForeignTitleFactory.php.

Member Function Documentation

◆ createForeignTitle()

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 ForeignTitleFactory.

Definition at line 55 of file NaiveForeignTitleFactory.php.

References $title.


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