MediaWiki  REL1_22
Site Class Reference
Inheritance diagram for Site:
Collaboration diagram for Site:

List of all members.

Public Member Functions

 __construct ($type=self::TYPE_UNKNOWN)
 Constructor.
 addInterwikiId ($identifier)
 Adds an interwiki id to the site.
 addLocalId ($type, $identifier)
 Adds a local identifier.
 addNavigationId ($identifier)
 Adds a navigation id to the site.
 getAllPaths ()
 Returns the paths as associative array.
 getDomain ()
 Returns the domain of the site, ie en.wikipedia.org Or false if it's not known.
 getExtraConfig ()
 Returns the type specific config.
 getExtraData ()
 Returns the type specific fields.
 getGlobalId ()
 Returns the global site identifier (ie enwiktionary).
 getGroup ()
 Gets the type of the site (ie wikipedia).
 getInternalId ()
 Returns the set internal identifier for the site.
 getInterwikiIds ()
 Returns the interwiki link identifiers that can be used for this site.
 getLanguageCode ()
 Returns language code of the sites primary language.
 getLinkPath ()
 Returns the path used to construct links with or false if there is no such path.
 getLinkPathType ()
 Returns the main path type, that is the type of the path that should generally be used to construct links to the target site.
 getLocalIds ()
 Returns all local ids.
 getNavigationIds ()
 Returns the equivalent link identifiers that can be used to make the site show up in interfaces such as the "language links" section.
 getPageUrl ($pageName=false)
 Returns the full URL for the given page on the site.
 getPath ($pathType)
 Returns the path of the provided type or false if there is no such path.
 getProtocol ()
 Returns the protocol of the site.
 getSource ()
 Returns the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
 getType ()
 Returns the type of the site (ie mediawiki).
 normalizePageName ($pageName)
 Returns $pageName without changes.
 removePath ($pathType)
 Removes the path of the provided type if it's set.
 serialize ()
 setExtraConfig (array $extraConfig)
 Sets the type specific config.
 setExtraData (array $extraData)
 Sets the type specific fields.
 setForward ($shouldForward)
 Sets if site.tld/path/key:pageTitle should forward users to the page on the actual site, where "key" is the local identifier.
 setGlobalId ($globalId)
 Sets the global site identifier (ie enwiktionary).
 setGroup ($group)
 Sets the type of the site (ie wikipedia).
 setInternalId ($internalId=null)
 Sets the internal identifier for the site.
 setLanguageCode ($languageCode)
 Sets language code of the sites primary language.
 setLinkPath ($fullUrl)
 Sets the path used to construct links with.
 setPath ($pathType, $fullUrl)
 Sets the path used to construct links with.
 setSource ($source)
 Sets the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
 shouldForward ()
 Gets if site.tld/path/key:pageTitle should forward users to the page on the actual site, where "key" is the local identifier.
 unserialize ($serialized)

Static Public Member Functions

static newForType ($siteType)

Public Attributes

const GROUP_NONE = 'none'
const ID_EQUIVALENT = 'equivalent'
const ID_INTERWIKI = 'interwiki'
const PATH_LINK = 'link'
const SERIAL_VERSION_ID = '2013-01-23'
const SOURCE_LOCAL = 'local'
const TYPE_MEDIAWIKI = 'mediawiki'
const TYPE_UNKNOWN = 'unknown'

Protected Attributes

array $extraConfig = array()
array $extraData = array()
bool $forward = false
string null $globalId = null
string $group = self::GROUP_NONE
int null $internalId = null
string null $languageCode = null
array[] $localIds = array()
 Holds the local ids for this site.
string $source = self::SOURCE_LOCAL
string $type = self::TYPE_UNKNOWN

Detailed Description

Definition at line 29 of file Site.php.


Constructor & Destructor Documentation

Site::__construct ( type = self::TYPE_UNKNOWN)

Constructor.

Since:
1.21
Parameters:
string$type

Reimplemented in MediaWikiSite.

Definition at line 122 of file Site.php.


Member Function Documentation

Site::addInterwikiId ( identifier)

Adds an interwiki id to the site.

Since:
1.21
Parameters:
string$identifier

Definition at line 511 of file Site.php.

Referenced by SiteTest\testAddInterwikiId().

Site::addLocalId ( type,
identifier 
)

Adds a local identifier.

Since:
1.21
Parameters:
string$type
string$identifier

Definition at line 490 of file Site.php.

Site::addNavigationId ( identifier)

Adds a navigation id to the site.

Since:
1.21
Parameters:
string$identifier

Definition at line 522 of file Site.php.

Referenced by SiteTest\testAddNavigationId().

Returns the paths as associative array.

The keys are path types, the values are the path urls.

Since:
1.21
Returns:
string[]

Definition at line 605 of file Site.php.

Referenced by getPath(), SiteTest\testGetAllPaths(), and SiteTest\testSetAndRemovePath().

Returns the domain of the site, ie en.wikipedia.org Or false if it's not known.

Since:
1.21
Returns:
string|null

Definition at line 259 of file Site.php.

Returns the type specific config.

Since:
1.21
Returns:
array

Definition at line 421 of file Site.php.

Returns the type specific fields.

Since:
1.21
Returns:
array

Definition at line 399 of file Site.php.

Returns the global site identifier (ie enwiktionary).

Since:
1.21
Returns:
string|null

Definition at line 133 of file Site.php.

Referenced by SiteTest\testGetGlobalId(), and SiteTest\testSetGlobalId().

Gets the type of the site (ie wikipedia).

Since:
1.21
Returns:
string

Definition at line 172 of file Site.php.

Returns the set internal identifier for the site.

Since:
1.21
Returns:
string|null

Definition at line 466 of file Site.php.

Returns the interwiki link identifiers that can be used for this site.

Since:
1.21
Returns:
string[]

Definition at line 533 of file Site.php.

Referenced by SiteTest\testAddInterwikiId(), and SiteTest\testGetInterwikiIds().

Returns language code of the sites primary language.

Or null if it's not known.

Since:
1.21
Returns:
string|null

Definition at line 444 of file Site.php.

Referenced by SiteTest\testGetLanguageCode(), and SiteTest\testSetLanguageCode().

Returns the path used to construct links with or false if there is no such path.

Shall be equivalent to getPath( getLinkPathType() ).

Returns:
string|null

Definition at line 327 of file Site.php.

Referenced by MediaWikiSite\getPageUrl().

Returns the main path type, that is the type of the path that should generally be used to construct links to the target site.

This default implementation returns Site::PATH_LINK as the default path type. Subclasses can override this to define a different default path type, or return false to disable site links.

Since:
1.21
Returns:
string|null

Reimplemented in MediaWikiSite.

Definition at line 343 of file Site.php.

Returns all local ids.

Since:
1.21
Returns:
array[]

Definition at line 556 of file Site.php.

Returns the equivalent link identifiers that can be used to make the site show up in interfaces such as the "language links" section.

Since:
1.21
Returns:
string[]

Definition at line 545 of file Site.php.

Referenced by SiteTest\testAddNavigationId(), and SiteTest\testGetNavigationIds().

Site::getPageUrl ( pageName = false)

Returns the full URL for the given page on the site.

Or false if the needed information is not known.

This generated URL is usually based upon the path returned by getLinkPath(), but this is not a requirement.

This implementation returns a URL constructed using the path returned by getLinkPath().

Since:
1.21
Parameters:
bool | String$pageName
Returns:
string|boolean false

Reimplemented in MediaWikiSite.

Definition at line 362 of file Site.php.

Site::getPath ( pathType)

Returns the path of the provided type or false if there is no such path.

Since:
1.21
Parameters:
string$pathType
Returns:
string|null

Definition at line 592 of file Site.php.

References getAllPaths().

Referenced by MediaWikiSite\getFileUrl(), MediaWikiSite\getRelativeFilePath(), MediaWikiSite\getRelativePagePath(), SiteTest\testGetPath(), and SiteTest\testSetAndRemovePath().

Returns the protocol of the site.

Since:
1.21
Exceptions:
MWException
Returns:
string

Definition at line 277 of file Site.php.

Returns the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').

Since:
1.21
Returns:
string

Definition at line 200 of file Site.php.

Returns the type of the site (ie mediawiki).

Since:
1.21
Returns:
string

Definition at line 161 of file Site.php.

Referenced by SiteTest\testGetType().

static Site::newForType ( siteType) [static]
Since:
1.21
Parameters:
string$siteType
Returns:
Site

Definition at line 629 of file Site.php.

Site::normalizePageName ( pageName)

Returns $pageName without changes.

Subclasses may override this to apply some kind of normalization.

See also:
Site::normalizePageName
Since:
1.21
Parameters:
string$pageName
Returns:
string

Reimplemented in MediaWikiSite.

Definition at line 388 of file Site.php.

Referenced by SiteTest\testNormalizePageName().

Site::removePath ( pathType)

Removes the path of the provided type if it's set.

Since:
1.21
Parameters:
string$pathType

Definition at line 616 of file Site.php.

Referenced by SiteTest\testSetAndRemovePath().

See also:
Serializable::serialize
Since:
1.21
Returns:
string

Definition at line 646 of file Site.php.

Site::setExtraConfig ( array extraConfig)

Sets the type specific config.

Since:
1.21
Parameters:
array$extraConfig

Definition at line 432 of file Site.php.

Site::setExtraData ( array extraData)

Sets the type specific fields.

Since:
1.21
Parameters:
array$extraData

Definition at line 410 of file Site.php.

Site::setForward ( shouldForward)

Sets if site.tld/path/key:pageTitle should forward users to the page on the actual site, where "key" is the local identifier.

Since:
1.21
Parameters:
boolean$shouldForward
Exceptions:
MWException

Definition at line 243 of file Site.php.

Site::setGlobalId ( globalId)

Sets the global site identifier (ie enwiktionary).

Since:
1.21
Parameters:
string | null$globalId
Exceptions:
MWException

Definition at line 146 of file Site.php.

References $globalId.

Referenced by SiteTest\testSetGlobalId().

Site::setGroup ( group)

Sets the type of the site (ie wikipedia).

Since:
1.21
Parameters:
string$group
Exceptions:
MWException

Definition at line 185 of file Site.php.

References $group.

Site::setInternalId ( internalId = null)

Sets the internal identifier for the site.

This typically is a primary key in a db table.

Since:
1.21
Parameters:
int | null$internalId

Definition at line 478 of file Site.php.

Site::setLanguageCode ( languageCode)

Sets language code of the sites primary language.

Since:
1.21
Parameters:
string$languageCode

Definition at line 455 of file Site.php.

Referenced by SiteTest\testSetLanguageCode().

Site::setLinkPath ( fullUrl)

Sets the path used to construct links with.

Shall be equivalent to setPath( getLinkPathType(), $fullUrl ).

Parameters:
string$fullUrl
Since:
1.21
Exceptions:
MWException

Definition at line 310 of file Site.php.

Site::setPath ( pathType,
fullUrl 
)

Sets the path used to construct links with.

Shall be equivalent to setPath( getLinkPathType(), $fullUrl ).

Since:
1.21
Parameters:
string$pathType
string$fullUrl
Exceptions:
MWException

Definition at line 571 of file Site.php.

Referenced by MediaWikiSite\setFilePath(), MediaWikiSite\setPagePath(), and SiteTest\testSetAndRemovePath().

Site::setSource ( source)

Sets the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').

Since:
1.21
Parameters:
string$source
Exceptions:
MWException

Definition at line 213 of file Site.php.

References $source, and source.

Gets if site.tld/path/key:pageTitle should forward users to the page on the actual site, where "key" is the local identifier.

Since:
1.21
Returns:
boolean

Definition at line 229 of file Site.php.

Site::unserialize ( serialized)
See also:
Serializable::unserialize
Since:
1.21
Parameters:
string$serialized

Definition at line 671 of file Site.php.


Member Data Documentation

array Site::$extraConfig = array() [protected]
Since:
1.21

Definition at line 101 of file Site.php.

array Site::$extraData = array() [protected]
Since:
1.21

Definition at line 95 of file Site.php.

bool Site::$forward = false [protected]
Since:
1.21

Definition at line 107 of file Site.php.

string null Site::$globalId = null [protected]
Since:
1.21

Definition at line 56 of file Site.php.

Referenced by MediaWikiSite\newFromGlobalId(), and setGlobalId().

string Site::$group = self::GROUP_NONE [protected]
Since:
1.21

Definition at line 68 of file Site.php.

Referenced by setGroup().

int null Site::$internalId = null [protected]
Since:
1.21

Definition at line 113 of file Site.php.

string null Site::$languageCode = null [protected]
Since:
1.21

Definition at line 80 of file Site.php.

array [] Site::$localIds = array() [protected]

Holds the local ids for this site.

local id type => [ ids for this type (strings) ]

Since:
1.21

Definition at line 89 of file Site.php.

string Site::$source = self::SOURCE_LOCAL [protected]
Since:
1.21

Definition at line 74 of file Site.php.

Referenced by setSource().

string Site::$type = self::TYPE_UNKNOWN [protected]
Since:
1.21

Definition at line 62 of file Site.php.

Referenced by MediaWikiSite\__construct().

const Site::GROUP_NONE = 'none'

Definition at line 34 of file Site.php.

const Site::ID_EQUIVALENT = 'equivalent'

Definition at line 37 of file Site.php.

const Site::ID_INTERWIKI = 'interwiki'

Definition at line 36 of file Site.php.

const Site::PATH_LINK = 'link'

Definition at line 41 of file Site.php.

const Site::SERIAL_VERSION_ID = '2013-01-23'

Definition at line 50 of file Site.php.

const Site::SOURCE_LOCAL = 'local'

Definition at line 39 of file Site.php.

const Site::TYPE_MEDIAWIKI = 'mediawiki'

Definition at line 32 of file Site.php.

const Site::TYPE_UNKNOWN = 'unknown'

Definition at line 31 of file Site.php.


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