MediaWiki REL1_35
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...

Inheritance diagram for NaiveForeignTitleFactory:
Collaboration diagram for NaiveForeignTitleFactory:

Public Member Functions

 createForeignTitle ( $title, $ns=null)
 Creates a ForeignTitle object based on the page title, and optionally the namespace ID, of a page on a foreign wiki.
 

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 27 of file NaiveForeignTitleFactory.php.

Member Function Documentation

◆ createForeignTitle()

NaiveForeignTitleFactory::createForeignTitle (   $title,
  $ns = null 
)

Creates 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 44 of file NaiveForeignTitleFactory.php.

References $title.


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