MediaWiki
REL1_24
|
The main skin class which provides methods and properties for all other skins. More...
Public Member Functions | |
__call ($fname, $args) | |
Use PHP's magic __call handler to intercept legacy calls to the linker for backwards compatibility. | |
aboutLink () | |
Gets the link to the wiki's about page. | |
addToBodyAttributes ($out, &$bodyAttrs) | |
This will be called by OutputPage::headElement when it is creating the "<body>" tag, skins can override it if they have a need to add in any body attributes or classes of their own. | |
addToSidebar (&$bar, $message) | |
Add content from a sidebar system message Currently only used for MediaWiki:Sidebar (but may be used by Extensions) | |
addToSidebarPlain (&$bar, $text) | |
Add content from plain text. | |
bottomScripts () | |
This gets called shortly before the "</body>" tag. | |
buildSidebar () | |
Build an array that represents the sidebar(s), the navigation bar among them. | |
commonPrintStylesheet () | |
This function previously controlled whether the 'mediawiki.legacy.wikiprintable' module should be loaded by OutputPage. | |
disclaimerLink () | |
Gets the link to the wiki's general disclaimers page. | |
doEditSectionLink (Title $nt, $section, $tooltip=null, $lang=false) | |
Create a section edit link. | |
drawCategoryBrowser ($tree) | |
Render the array as a series of links. | |
editUrlOptions () | |
Return URL options for the 'edit page' link. | |
escapeSearchLink () | |
footerLink ($desc, $page) | |
Returns an HTML link for use in the footer. | |
getCategories () | |
getCategoryLinks () | |
getCommonStylePath ($name) | |
This function previously returned a fully resolved style path URL to images or styles stored in the legacy skins/common/ directory. | |
getCopyright ($type= 'detect') | |
getCopyrightIcon () | |
getDefaultModules () | |
Defines the ResourceLoader modules that should be added to the skin It is recommended that skins wishing to override call parent::getDefaultModules() and substitute out any modules they wish to change by using a key to look them up. | |
getHtmlElementAttributes () | |
Return values for <html> element. | |
getLogo () | |
URL to the logo. | |
getNamespaceNotice () | |
Get a notice based on page's namespace. | |
getNewtalks () | |
Gets new talk page messages for the current user and returns an appropriate alert message (or an empty string if there are no messages) | |
getPageClasses ($title) | |
TODO: document. | |
getPoweredBy () | |
Gets the powered by MediaWiki icon. | |
getRelevantTitle () | |
Return the "relevant" title. | |
getRelevantUser () | |
Return the "relevant" user. | |
getRevisionId () | |
Get the current revision ID. | |
getSearchLink () | |
getSiteNotice () | |
Get the site notice. | |
getSkinName () | |
getSkinStylePath ($name) | |
Return a fully resolved style path url to images or styles stored in the current skins's folder. | |
getUndeleteLink () | |
initPage (OutputPage $out) | |
isRevisionCurrent () | |
Whether the revision displayed is the latest revision of the page. | |
logoText ($align= '') | |
mainPageLink () | |
Gets the link to the wiki's main page. | |
makeFooterIcon ($icon, $withImage= 'withImage') | |
Renders a $wgFooterIcons icon according to the method's arguments. | |
outputPage (OutputPage $out=null) | |
Outputs the HTML generated by other functions. | |
preloadExistence () | |
Preload the existence of three commonly-requested pages in a single query. | |
printSource () | |
Text with the permalink to the source page, usually shown on the footer of a printed page. | |
privacyLink () | |
Gets the link to the wiki's privacy policy page. | |
setRelevantTitle ($t) | |
Set the "relevant" title. | |
setRelevantUser ($u) | |
Set the "relevant" user. | |
setupSkinUserCss (OutputPage $out) | |
Add skin specific stylesheets Calling this method with an $out of anything but the same OutputPage inside ->getOutput() is deprecated. | |
showEmailUser ($id) | |
showIPinHeader () | |
Returns true if the IP should be shown in the header. | |
subPageSubtitle () | |
Static Public Member Functions | |
static | checkTitle (&$title, $name) |
make sure we have some title to operate on | |
static | getAllowedSkins () |
Fetch the list of user-selectable skins in regards to $wgSkipSkins. | |
static | getDynamicStylesheetQuery () |
Get the query to generate a dynamic stylesheet. | |
static | getSkinNameMessages () |
Fetch the skinname messages for available skins. | |
static | getSkinNames () |
Fetch the set of available skins. | |
static | getUsableSkins () |
static | makeI18nUrl ($name, $urlaction= '') |
static | makeInternalOrExternalUrl ($name) |
If url string starts with http, consider as external URL, else internal. | |
static | makeKnownUrlDetails ($name, $urlaction= '') |
Make URL details where the article exists (or at least it's convenient to think so) | |
static | makeMainPageUrl ($urlaction= '') |
static | makeNSUrl ($name, $urlaction= '', $namespace=NS_MAIN) |
this can be passed the NS number as defined in Language.php | |
static | makeSpecialUrl ($name, $urlaction= '', $proto=null) |
Make a URL for a Special Page using the given query and protocol. | |
static | makeSpecialUrlSubpage ($name, $subpage, $urlaction= '') |
static | makeUrl ($name, $urlaction= '') |
static | makeUrlDetails ($name, $urlaction= '') |
these return an array with the 'href' and boolean 'exists' | |
static | makeVariablesScript ($data) |
static & | newFromKey ($key) |
Factory method for loading a skin of a given type. | |
static | normalizeKey ($key) |
Normalize a skin preference value to a form that can be loaded. | |
Public Attributes | |
$stylename = null | |
Protected Member Functions | |
afterContentHook () | |
This runs a hook to allow extensions placing their stuff after content and article metadata (e.g. | |
generateDebugHTML () | |
Generate debug data HTML for displaying at the bottom of the main content area. | |
lastModified () | |
Get the timestamp of the latest revision, formatted in user language. | |
Protected Attributes | |
$mRelevantTitle = null | |
$mRelevantUser = null | |
$skinname = null | |
Private Member Functions | |
getCachedNotice ($name) | |
Get a cached notice. |
The main skin class which provides methods and properties for all other skins.
See docs/skin.txt for more information.
Skin::__call | ( | $ | fname, |
$ | args | ||
) |
Use PHP's magic __call handler to intercept legacy calls to the linker for backwards compatibility.
string | $fname | Name of called method |
array | $args | Arguments to the method |
MWException |
Definition at line 1609 of file Skin.php.
References $fname, array(), and wfDeprecated().
Skin::aboutLink | ( | ) |
Gets the link to the wiki's about page.
Definition at line 964 of file Skin.php.
References footerLink().
Skin::addToBodyAttributes | ( | $ | out, |
&$ | bodyAttrs | ||
) |
This will be called by OutputPage::headElement when it is creating the "<body>" tag, skins can override it if they have a need to add in any body attributes or classes of their own.
OutputPage | $out | |
array | $bodyAttrs |
Skin::addToSidebar | ( | &$ | bar, |
$ | message | ||
) |
Add content from a sidebar system message Currently only used for MediaWiki:Sidebar (but may be used by Extensions)
This is just a wrapper around addToSidebarPlain() for backwards compatibility
array | $bar | |
string | $message |
Definition at line 1248 of file Skin.php.
References addToSidebarPlain(), and wfMessage().
Referenced by buildSidebar().
Skin::addToSidebarPlain | ( | &$ | bar, |
$ | text | ||
) |
Add content from plain text.
array | $bar | |
string | $text |
Definition at line 1259 of file Skin.php.
References $lines, $link, $title, array(), as, Sanitizer\escapeId(), ContextSource\getTitle(), global, ContextSource\msg(), Title\newFromText(), MessageCache\singleton(), wfMatchesDomainList(), and wfUrlProtocols().
Referenced by addToSidebar().
Skin::afterContentHook | ( | ) | [protected] |
This runs a hook to allow extensions placing their stuff after content and article metadata (e.g.
categories). Note: This function has nothing to do with afterContent().
This hook is placed here in order to allow using the same hook for all skins, both the SkinTemplate based ones and the older ones, which directly use this class to get their data.
The output of this function gets processed in SkinTemplate::outputPage() for the SkinTemplate based skins, all other skins should directly echo it.
Definition at line 579 of file Skin.php.
References array(), wfDebug(), and wfRunHooks().
This gets called shortly before the "</body>" tag.
Definition at line 614 of file Skin.php.
References array(), ContextSource\getOutput(), and wfRunHooks().
Build an array that represents the sidebar(s), the navigation bar among them.
BaseTemplate::getSidebar can be used to simplify the format and id generation in new skins.
The format of the returned array is array( heading => content, ... ), where:
Note that extensions can control the sidebar contents using the SkinBuildSidebar hook and can technically insert anything in here; skin creators are expected to handle values described above.
Definition at line 1209 of file Skin.php.
References $key, $wgMemc, addToSidebar(), array(), ContextSource\getLanguage(), global, wfMemcKey(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
static Skin::checkTitle | ( | &$ | title, |
$ | name | ||
) | [static] |
make sure we have some title to operate on
Title | $title | |
string | $name |
Definition at line 1179 of file Skin.php.
References $name, $title, and Title\newFromText().
Referenced by makeI18nUrl(), makeKnownUrlDetails(), makeMainPageUrl(), makeNSUrl(), makeUrl(), and makeUrlDetails().
This function previously controlled whether the 'mediawiki.legacy.wikiprintable' module should be loaded by OutputPage.
That module no longer exists and the return value of this method is ignored.
If your skin doesn't provide its own print styles, the 'mediawiki.legacy.commonPrint' module can be used instead (SkinTemplate-based skins do it automatically).
Definition at line 1355 of file Skin.php.
References wfDeprecated().
Gets the link to the wiki's general disclaimers page.
Definition at line 972 of file Skin.php.
References footerLink().
Skin::doEditSectionLink | ( | Title $ | nt, |
$ | section, | ||
$ | tooltip = null , |
||
$ | lang = false |
||
) |
Create a section edit link.
This supersedes editSectionLink() and editSectionLinkForOther().
Title | $nt | The title being linked to (may not be the same as the current page, if the section is included from a template) |
string | $section | The designation of the section being pointed to, to be included in the link, like "§ion=$section" |
string | $tooltip | The tooltip to use for the link: will be escaped and wrapped in the 'editsectionhint' message |
string | $lang | Language code |
Definition at line 1570 of file Skin.php.
References $attribs, $link, $result, $section, array(), Sanitizer\decodeCharReferences(), Linker\link(), text, wfGetLangObj(), wfMessage(), and wfRunHooks().
Skin::drawCategoryBrowser | ( | $ | tree | ) |
Render the array as a series of links.
array | $tree | Categories tree returned by Title::getParentCategoryTree |
Definition at line 523 of file Skin.php.
References as, empty, Linker\link(), and Title\newFromText().
Referenced by getCategoryLinks().
Return URL options for the 'edit page' link.
This may include an 'oldid' specifier, if the current page view is such.
Definition at line 983 of file Skin.php.
References $options, array(), getRevisionId(), and isRevisionCurrent().
Skin::footerLink | ( | $ | desc, |
$ | page | ||
) |
Returns an HTML link for use in the footer.
string | $desc | The i18n message key for the link text |
string | $page | The i18n message key for the page to link to |
Definition at line 934 of file Skin.php.
References $title, Linker\linkKnown(), ContextSource\msg(), Title\newFromText(), and text.
Referenced by aboutLink(), disclaimerLink(), and privacyLink().
Skin::generateDebugHTML | ( | ) | [protected] |
Generate debug data HTML for displaying at the bottom of the main content area.
Definition at line 605 of file Skin.php.
References MWDebug\getHTMLDebugLog().
static Skin::getAllowedSkins | ( | ) | [static] |
Fetch the list of user-selectable skins in regards to $wgSkipSkins.
Useful for Special:Preferences and other places where you only want to show skins users _can_ use.
Definition at line 72 of file Skin.php.
References $wgSkipSkins, as, getSkinNames(), and global.
Referenced by ApiQuerySiteinfo\appendSkins(), Preferences\generateSkinOptions(), and getUsableSkins().
Skin::getCachedNotice | ( | $ | name | ) | [private] |
Get a cached notice.
string | $name | Message name, or 'default' for $wgSiteNotice |
Definition at line 1458 of file Skin.php.
References $key, $name, $parserMemc, $wgContLang, array(), empty, ContextSource\getOutput(), global, ContextSource\msg(), Html\rawElement(), wfMemcKey(), wfProfileIn(), and wfProfileOut().
Referenced by getNamespaceNotice(), and getSiteNotice().
Definition at line 546 of file Skin.php.
References $out, empty, getCategoryLinks(), ContextSource\getOutput(), ContextSource\getTitle(), and ContextSource\getUser().
Definition at line 456 of file Skin.php.
References $out, $s, $t, drawCategoryBrowser(), empty, ContextSource\getOutput(), ContextSource\getTitle(), ContextSource\getUser(), global, Linker\link(), ContextSource\msg(), Title\newFromText(), and wfMessage().
Referenced by getCategories().
Skin::getCommonStylePath | ( | $ | name | ) |
This function previously returned a fully resolved style path URL to images or styles stored in the legacy skins/common/ directory.
That directory has been removed in 1.24 and the function always returns an empty string.
string | $name | The name or path of a skin resource file |
Definition at line 1020 of file Skin.php.
References wfDeprecated().
Skin::getCopyright | ( | $ | type = 'detect' | ) |
string | $type |
Definition at line 753 of file Skin.php.
References $link, $title, $type, array(), ContextSource\getTitle(), global, isRevisionCurrent(), Linker\linkKnown(), Linker\makeExternalLink(), ContextSource\msg(), Title\newFromText(), and wfRunHooks().
Defines the ResourceLoader modules that should be added to the skin It is recommended that skins wishing to override call parent::getDefaultModules() and substitute out any modules they wish to change by using a key to look them up.
Definition at line 184 of file Skin.php.
References $out, $user, array(), ContextSource\getOutput(), and global.
static Skin::getDynamicStylesheetQuery | ( | ) | [static] |
Return values for <html> element.
Definition at line 424 of file Skin.php.
References array(), and ContextSource\getLanguage().
Skin::getLogo | ( | ) |
URL to the logo.
Definition at line 448 of file Skin.php.
References global.
Referenced by logoText().
Get a notice based on page's namespace.
Definition at line 1512 of file Skin.php.
References $key, getCachedNotice(), ContextSource\getTitle(), wfProfileIn(), and wfProfileOut().
Gets new talk page messages for the current user and returns an appropriate alert message (or an empty string if there are no messages)
Definition at line 1365 of file Skin.php.
References $newtalks, $out, $user, array(), as, Xml\element(), ContextSource\getOutput(), ContextSource\getUser(), Linker\linkKnown(), ContextSource\msg(), Revision\newFromTitle(), IDBAccessObject\READ_NORMAL, wfRunHooks(), and wfWikiID().
Skin::getPageClasses | ( | $ | title | ) |
TODO: document.
Title | $title |
Definition at line 397 of file Skin.php.
References $name, $title, $type, Sanitizer\escapeClass(), list, and SpecialPageFactory\resolveAlias().
Return the "relevant" title.
A "relevant" title is not necessarily the actual title of the page. Special pages like Special:MovePage use set the page they are acting on as their "relevant" title, this allows the skin system to display things such as content tabs which belong to to that page instead of displaying a basic special page tab which has almost no meaning.
Definition at line 301 of file Skin.php.
References ContextSource\getTitle().
Referenced by getRelevantUser().
Return the "relevant" user.
A "relevant" user is similar to a relevant title. Special pages like Special:Contributions mark the user which they are relevant to so that things like the toolbox can display the information they usually are only able to display on a user's userpage and talkpage.
Definition at line 325 of file Skin.php.
References $title, $user, getRelevantTitle(), User\isIP(), and User\newFromName().
Get the current revision ID.
Definition at line 268 of file Skin.php.
References ContextSource\getOutput().
Referenced by editUrlOptions(), isRevisionCurrent(), lastModified(), and printSource().
Definition at line 737 of file Skin.php.
References $searchPage, and SpecialPage\getTitleFor().
Referenced by escapeSearchLink().
Get the site notice.
Definition at line 1532 of file Skin.php.
References $siteNotice, array(), getCachedNotice(), ContextSource\getUser(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
static Skin::getSkinNameMessages | ( | ) | [static] |
static Skin::getSkinNames | ( | ) | [static] |
Fetch the set of available skins.
Definition at line 49 of file Skin.php.
References SkinFactory\getDefaultInstance().
Referenced by ResourceLoaderContext\__construct(), ApiQuerySiteinfo\appendSkins(), getAllowedSkins(), ResourceLoaderStartUpModule\getConfigSettings(), and normalizeKey().
Skin::getSkinStylePath | ( | $ | name | ) |
Return a fully resolved style path url to images or styles stored in the current skins's folder.
This method returns a url resolved using the configured skin style path and includes the style version inside of the url.
Requires $stylename to be set, otherwise throws MWException.
string | $name | The name or path of a skin resource file |
Definition at line 1035 of file Skin.php.
References global.
Definition at line 647 of file Skin.php.
References $n, ContextSource\getRequest(), ContextSource\getTitle(), SpecialPage\getTitleFor(), ContextSource\getUser(), Linker\linkKnown(), and ContextSource\msg().
static Skin::getUsableSkins | ( | ) | [static] |
Definition at line 88 of file Skin.php.
References getAllowedSkins(), and wfDeprecated().
Skin::initPage | ( | OutputPage $ | out | ) |
OutputPage | $out |
Reimplemented in SkinFallback.
Definition at line 170 of file Skin.php.
References preloadExistence(), wfProfileIn(), and wfProfileOut().
Whether the revision displayed is the latest revision of the page.
Definition at line 277 of file Skin.php.
References getRevisionId(), and ContextSource\getTitle().
Referenced by editUrlOptions(), and getCopyright().
Skin::lastModified | ( | ) | [protected] |
Get the timestamp of the latest revision, formatted in user language.
Definition at line 844 of file Skin.php.
References $s, $t, $timestamp, ContextSource\getLanguage(), ContextSource\getOutput(), getRevisionId(), Revision\getTimestampFromId(), ContextSource\getTitle(), ContextSource\getUser(), ContextSource\msg(), and wfGetLB().
Skin::logoText | ( | $ | align = '' | ) |
string | $align |
Definition at line 871 of file Skin.php.
References $s, getLogo(), ContextSource\msg(), and Title\newMainPage().
Gets the link to the wiki's main page.
Definition at line 919 of file Skin.php.
References $s, Linker\linkKnown(), ContextSource\msg(), and Title\newMainPage().
Skin::makeFooterIcon | ( | $ | icon, |
$ | withImage = 'withImage' |
||
) |
Renders a $wgFooterIcons icon according to the method's arguments.
array | $icon | The icon to build the html for, see $wgFooterIcons for the format of this array. |
bool | string | $withImage | Whether to use the icon's image or output a text-only footericon. |
Definition at line 896 of file Skin.php.
References $html, array(), Html\element(), and Html\rawElement().
static Skin::makeI18nUrl | ( | $ | name, |
$ | urlaction = '' |
||
) | [static] |
string | $name | |
string | $urlaction |
Definition at line 1095 of file Skin.php.
References $name, $title, checkTitle(), Title\newFromText(), text, and wfMessage().
static Skin::makeInternalOrExternalUrl | ( | $ | name | ) | [static] |
If url string starts with http, consider as external URL, else internal.
string | $name |
Definition at line 1119 of file Skin.php.
References $name, makeUrl(), and wfUrlProtocols().
Referenced by UserloginTemplate\execute().
static Skin::makeKnownUrlDetails | ( | $ | name, |
$ | urlaction = '' |
||
) | [static] |
Make URL details where the article exists (or at least it's convenient to think so)
string | $name | Article name |
string | $urlaction |
Definition at line 1163 of file Skin.php.
References $name, $title, array(), checkTitle(), Title\newFromText(), and true.
static Skin::makeMainPageUrl | ( | $ | urlaction = '' | ) | [static] |
string | $urlaction |
Definition at line 1052 of file Skin.php.
References $title, checkTitle(), and Title\newMainPage().
static Skin::makeNSUrl | ( | $ | name, |
$ | urlaction = '' , |
||
$ | namespace = NS_MAIN |
||
) | [static] |
this can be passed the NS number as defined in Language.php
string | $name | |
string | $urlaction | |
int | $namespace |
Definition at line 1134 of file Skin.php.
References $name, $title, checkTitle(), and Title\makeTitleSafe().
static Skin::makeSpecialUrl | ( | $ | name, |
$ | urlaction = '' , |
||
$ | proto = null |
||
) | [static] |
Make a URL for a Special Page using the given query and protocol.
If $proto is set to null, make a local URL. Otherwise, make a full URL with the protocol specified.
string | $name | Name of the Special page |
string | $urlaction | Query to append |
string | null | $proto | Protocol to use or null for a local URL |
Definition at line 1070 of file Skin.php.
References $name, $title, and SpecialPage\getSafeTitleFor().
static Skin::makeSpecialUrlSubpage | ( | $ | name, |
$ | subpage, | ||
$ | urlaction = '' |
||
) | [static] |
string | $name | |
string | $subpage | |
string | $urlaction |
Definition at line 1085 of file Skin.php.
References $name, $title, and SpecialPage\getSafeTitleFor().
static Skin::makeUrl | ( | $ | name, |
$ | urlaction = '' |
||
) | [static] |
string | $name | |
string | $urlaction |
Definition at line 1106 of file Skin.php.
References $name, $title, checkTitle(), and Title\newFromText().
Referenced by makeInternalOrExternalUrl().
static Skin::makeUrlDetails | ( | $ | name, |
$ | urlaction = '' |
||
) | [static] |
these return an array with the 'href' and boolean 'exists'
string | $name | |
string | $urlaction |
Definition at line 1147 of file Skin.php.
References $name, $title, array(), checkTitle(), and Title\newFromText().
static Skin::makeVariablesScript | ( | $ | data | ) | [static] |
array | $data |
Definition at line 355 of file Skin.php.
References Html\inlineScript(), ResourceLoader\makeConfigSetScript(), and ResourceLoader\makeLoaderConditionalScript().
Referenced by wfReportTime().
static& Skin::newFromKey | ( | $ | key | ) | [static] |
Factory method for loading a skin of a given type.
string | $key | 'monobook', 'vector', etc. |
Definition at line 149 of file Skin.php.
References $factory, $key, $skin, SkinFactory\getDefaultInstance(), normalizeKey(), and wfDeprecated().
static Skin::normalizeKey | ( | $ | key | ) | [static] |
Normalize a skin preference value to a form that can be loaded.
If a skin can't be found, it will fall back to the configured default ($wgDefaultSkin), or the hardcoded default ($wgFallbackSkin) if the default skin is unavailable too.
string | $key | 'monobook', 'vector', etc. |
Definition at line 102 of file Skin.php.
References $fallback, $key, array(), getSkinNames(), and global.
Referenced by ApiQuerySiteinfo\appendSkins(), and newFromKey().
Skin::outputPage | ( | OutputPage $ | out = null | ) | [abstract] |
Outputs the HTML generated by other functions.
OutputPage | $out |
Reimplemented in SkinTemplate.
Preload the existence of three commonly-requested pages in a single query.
Definition at line 241 of file Skin.php.
References $lb, $titles, $user, array(), ContextSource\getTitle(), ContextSource\getUser(), and wfRunHooks().
Referenced by initPage().
Text with the permalink to the source page, usually shown on the footer of a printed page.
Definition at line 630 of file Skin.php.
References getRevisionId(), ContextSource\getTitle(), ContextSource\msg(), and wfExpandIRI().
Gets the link to the wiki's privacy policy page.
Definition at line 956 of file Skin.php.
References footerLink().
Skin::setRelevantTitle | ( | $ | t | ) |
Skin::setRelevantUser | ( | $ | u | ) |
Skin::setupSkinUserCss | ( | OutputPage $ | out | ) | [abstract] |
Add skin specific stylesheets Calling this method with an $out of anything but the same OutputPage inside ->getOutput() is deprecated.
The $out arg is kept for compatibility purposes with skins.
OutputPage | $out |
Reimplemented in SkinTemplate, and SkinFallback.
Skin::showEmailUser | ( | $ | id | ) |
User | int | $id |
Definition at line 997 of file Skin.php.
References ContextSource\getUser(), and User\newFromId().
Definition at line 675 of file Skin.php.
References $link, $out, array(), as, ContextSource\getLanguage(), ContextSource\getOutput(), ContextSource\getTitle(), MWNamespace\hasSubpages(), Linker\linkKnown(), ContextSource\msg(), Title\newFromText(), and wfRunHooks().
Skin::$skinname = null [protected] |
Reimplemented in SkinTemplate, and SkinFallback.