MediaWiki
REL1_22
|
Class representing a MediaWiki site. More...
Public Member Functions | |
__construct ($type=self::TYPE_MEDIAWIKI) | |
Constructor. | |
getFileUrl ($path=false) | |
Returns the full file path (ie site url + relative file path). | |
getLinkPathType () | |
getPageUrl ($pageName=false) | |
getRelativeFilePath () | |
Returns the relative file path. | |
getRelativePagePath () | |
Returns the relative page path. | |
normalizePageName ($pageName) | |
Returns the normalized form of the given page title, using the normalization rules of the given site. | |
setFilePath ($path) | |
Sets the relative file path. | |
setPagePath ($path) | |
Sets the relative page path. | |
toDBKey ($title) | |
Returns the database form of the given title. | |
Static Public Member Functions | |
static | newFromGlobalId ($globalId) |
Public Attributes | |
const | PATH_FILE = 'file_path' |
const | PATH_PAGE = 'page_path' |
Static Private Member Functions | |
static | extractPageRecord ($externalData, $pageTitle) |
Get normalization record for a given page title from an API response. |
MediaWikiSite::__construct | ( | $ | type = self::TYPE_MEDIAWIKI | ) |
Constructor.
string | $type |
Reimplemented from Site.
Definition at line 61 of file MediaWikiSite.php.
References Site\$type.
static MediaWikiSite::extractPageRecord | ( | $ | externalData, |
$ | pageTitle | ||
) | [static, private] |
Get normalization record for a given page title from an API response.
array | $externalData | A reply from the API on a external server. |
string | $pageTitle | Identifies the page at the external site, needing normalization. |
Definition at line 182 of file MediaWikiSite.php.
Referenced by normalizePageName().
MediaWikiSite::getFileUrl | ( | $ | path = false | ) |
Returns the full file path (ie site url + relative file path).
The path should go at the $1 marker. If the $path argument is provided, the marker will be replaced by it's value.
string | boolean | $path |
Definition at line 342 of file MediaWikiSite.php.
References $path, and Site\getPath().
Referenced by normalizePageName().
Reimplemented from Site.
Definition at line 254 of file MediaWikiSite.php.
References PATH_PAGE.
MediaWikiSite::getPageUrl | ( | $ | pageName = false | ) |
This implementation returns a URL constructed using the path returned by getLinkPath(). In addition to the default behavior implemented by Site::getPageUrl(), this method converts the $pageName to DBKey-format by replacing spaces with underscores before using it in the URL.
string | boolean | $pageName | Page name or false (default: false) |
Reimplemented from Site.
Definition at line 316 of file MediaWikiSite.php.
References Site\getLinkPath(), toDBKey(), and wfUrlencode().
Returns the relative file path.
Definition at line 276 of file MediaWikiSite.php.
References Site\getPath().
Returns the relative page path.
Definition at line 265 of file MediaWikiSite.php.
References Site\getPath().
static MediaWikiSite::newFromGlobalId | ( | $ | globalId | ) | [static] |
integer | $globalId |
Definition at line 48 of file MediaWikiSite.php.
References Site\$globalId.
MediaWikiSite::normalizePageName | ( | $ | pageName | ) |
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.
string | $pageName |
MWException |
Reimplemented from Site.
Definition at line 97 of file MediaWikiSite.php.
References $ret, $t, array(), UtfNormal\cleanUp(), FormatJson\decode(), extractPageRecord(), Http\get(), getFileUrl(), Title\newFromText(), wfAppendQuery(), and wfDebugLog().
MediaWikiSite::setFilePath | ( | $ | path | ) |
Sets the relative file path.
string | $path |
Definition at line 298 of file MediaWikiSite.php.
References $path, and Site\setPath().
MediaWikiSite::setPagePath | ( | $ | path | ) |
Sets the relative page path.
string | $path |
Definition at line 287 of file MediaWikiSite.php.
References $path, and Site\setPath().
MediaWikiSite::toDBKey | ( | $ | title | ) |
Returns the database form of the given title.
string | $title | the target page's title, in normalized form. |
Definition at line 74 of file MediaWikiSite.php.
References $title.
Referenced by getPageUrl().
const MediaWikiSite::PATH_FILE = 'file_path' |
Definition at line 37 of file MediaWikiSite.php.
Referenced by TestSites\getSites().
const MediaWikiSite::PATH_PAGE = 'page_path' |
Definition at line 38 of file MediaWikiSite.php.
Referenced by getLinkPathType(), and TestSites\getSites().