MediaWiki REL1_34
|
A parser that translates page titles on a foreign wiki into ForeignTitle objects, using information about the namespace setup on the foreign site. More...
Public Member Functions | |
__construct ( $foreignNamespaces) | |
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. | |
Protected Member Functions | |
parseTitleNoNs ( $title) | |
Helper function to parse the title when the namespace ID is not specified. | |
parseTitleWithNs ( $title, $ns) | |
Helper function to parse the title when the namespace value is known. | |
Protected Attributes | |
array | $foreignNamespaces |
Private Member Functions | |
normalizeNamespaceName ( $name) | |
Normalizes an array name for $foreignNamespacesFlipped. | |
Private Attributes | |
array | $foreignNamespacesFlipped |
A parser that translates page titles on a foreign wiki into ForeignTitle objects, using information about the namespace setup on the foreign site.
Definition at line 25 of file NamespaceAwareForeignTitleFactory.php.
NamespaceAwareForeignTitleFactory::__construct | ( | $foreignNamespaces | ) |
array | null | $foreignNamespaces | An array 'id' => 'name' which contains the complete namespace setup of the foreign wiki. Such data could be obtained from siteinfo/namespaces in an XML dump file, or by an action API query such as api.php?action=query&meta=siteinfo&siprop=namespaces. If this data is unavailable, use NaiveForeignTitleFactory instead. |
Definition at line 51 of file NamespaceAwareForeignTitleFactory.php.
References $foreignNamespaces, and normalizeNamespaceName().
NamespaceAwareForeignTitleFactory::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.
string | $title | The page title |
int | null | $ns | The namespace ID, or null if this data is not available |
Implements ForeignTitleFactory.
Definition at line 71 of file NamespaceAwareForeignTitleFactory.php.
References $title, parseTitleNoNs(), and parseTitleWithNs().
|
private |
Normalizes an array name for $foreignNamespacesFlipped.
string | $name |
Definition at line 40 of file NamespaceAwareForeignTitleFactory.php.
Referenced by __construct(), and parseTitleNoNs().
|
protected |
Helper function to parse the title when the namespace ID is not specified.
string | $title |
Definition at line 87 of file NamespaceAwareForeignTitleFactory.php.
References $title, and normalizeNamespaceName().
Referenced by createForeignTitle().
|
protected |
Helper function to parse the title when the namespace value is known.
string | $title | |
int | $ns |
Definition at line 114 of file NamespaceAwareForeignTitleFactory.php.
References $title.
Referenced by createForeignTitle().
|
protected |
Definition at line 29 of file NamespaceAwareForeignTitleFactory.php.
Referenced by __construct().
|
private |
Definition at line 33 of file NamespaceAwareForeignTitleFactory.php.