MediaWiki  master
Skin Class Reference

The main skin class which provides methods and properties for all other skins. More...

Inheritance diagram for Skin:
Collaboration diagram for Skin:

Public Member Functions

 __construct ( $options=null)
 
 aboutLink ()
 Gets the link to the wiki's about page. More...
 
 addToSidebar (&$bar, $message)
 Add content from a sidebar system message Currently only used for MediaWiki:Sidebar (but may be used by Extensions) More...
 
 addToSidebarPlain (&$bar, $text)
 Add content from plain text. More...
 
 bottomScripts ()
 This gets called shortly before the "</body>" tag. More...
 
 buildSidebar ()
 Build an array that represents the sidebar(s), the navigation bar among them. More...
 
 disclaimerLink ()
 Gets the link to the wiki's general disclaimers page. More...
 
 doEditSectionLink (Title $nt, $section, $tooltip, Language $lang)
 Create a section edit link. More...
 
 editUrlOptions ()
 Return URL options for the 'edit page' link. More...
 
 footerLink ( $desc, $page)
 Returns an HTML link for use in the footer. More...
 
 getAfterPortlet (string $name)
 Allows extensions to hook into known portlets and add stuff to them. More...
 
 getCategories ()
 
 getCategoryLinks ()
 
 getCopyright ( $type='detect')
 
 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. More...
 
 getHtmlElementAttributes ()
 Return values for <html> element. More...
 
 getIndicatorsHTML ( $indicators)
 Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed in the top-right corner of the page, outside of the main content. More...
 
 getLanguages ()
 Generates array of language links for the current page. More...
 
 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) More...
 
 getPageClasses ( $title)
 TODO: document. More...
 
 getPersonalToolsForMakeListItem ( $urls)
 Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate. More...
 
 getRelevantTitle ()
 Return the "relevant" title. More...
 
 getRelevantUser ()
 Return the "relevant" user. More...
 
 getRevisionId ()
 Get the current revision ID. More...
 
 getSiteFooterLinks ()
 Gets the link to the wiki's privacy policy, about page, and disclaimer page. More...
 
 getSiteNotice ()
 Get the site notice. More...
 
 getSkinName ()
 
 getSkinStylePath ( $name)
 Return a fully resolved style path URL to images or styles stored in the current skin's folder. More...
 
 getUndeleteLink ()
 
 initPage (OutputPage $out)
 Stable to override. More...
 
 isResponsive ()
 Indicates if this skin is responsive. More...
 
 isRevisionCurrent ()
 Whether the revision displayed is the latest revision of the page. More...
 
 logoText ( $align='')
 
 mainPageLink ()
 Gets the link to the wiki's main page. More...
 
 makeFooterIcon ( $icon, $withImage='withImage')
 Renders a $wgFooterIcons icon according to the method's arguments. More...
 
 makeLink ( $key, $item, $options=[])
 Makes a link, usually used by makeListItem to generate a link for an item in a list used in navigation lists, portlets, portals, sidebars, etc... More...
 
 makeListItem ( $key, $item, $options=[])
 Generates a list item for a navigation, portlet, portal, sidebar... More...
 
 makeSearchButton ( $mode, $attrs=[])
 
 makeSearchInput ( $attrs=[])
 
 makeToolbox ( $navUrls, $feedUrls)
 Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate. More...
 
 mapInterwikiToLanguage ( $code)
 Allows correcting the language of interlanguage links which, mostly due to legacy reasons, do not always match the standards compliant language tag. More...
 
 outputPage ()
 Outputs the HTML generated by other functions. More...
 
 printSource ()
 Text with the permalink to the source page, usually shown on the footer of a printed page. More...
 
 privacyLink ()
 Gets the link to the wiki's privacy policy page. More...
 
 setRelevantTitle ( $t)
 Set the "relevant" title. More...
 
 setRelevantUser ( $u)
 Set the "relevant" user. More...
 
 setupSkinUserCss (OutputPage $out)
 Hook point for adding style modules to OutputPage. More...
 
 showEmailUser ( $id)
 
 subPageSubtitle ( $out=null)
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage(). More...
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID. More...
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object. More...
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 Stable to override. More...
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 setContext (IContextSource $context)
 

Static Public Member Functions

static checkTitle (&$title, $name)
 make sure we have some title to operate on More...
 
static getAllowedSkins ()
 Fetch the list of user-selectable skins in regards to $wgSkipSkins. More...
 
static getSkinNames ()
 Fetch the set of available skins. More...
 
static makeI18nUrl ( $name, $urlaction='')
 
static makeInternalOrExternalUrl ( $name)
 If url string starts with http, consider as external URL, else internal. More...
 
static makeMainPageUrl ( $urlaction='')
 
static makeNSUrl ( $name, $urlaction='', $namespace=NS_MAIN)
 this can be passed the NS number as defined in Language.php More...
 
static makeSpecialUrl ( $name, $urlaction='', $proto=null)
 Make a URL for a Special Page using the given query and protocol. More...
 
static makeSpecialUrlSubpage ( $name, $subpage, $urlaction='')
 
static makeUrl ( $name, $urlaction='')
 
static makeVariablesScript ( $data, $nonce=null)
 
static normalizeKey ( $key)
 Normalize a skin preference value to a form that can be loaded. More...
 

Public Attributes

string $stylename = null
 Stylesheets set to use. More...
 

Protected Member Functions

 afterContentHook ()
 This runs a hook to allow extensions placing their stuff after content and article metadata (e.g. More...
 
 buildFeedUrls ()
 Build data structure representing syndication links. More...
 
 buildNavUrls ()
 Build array of common navigation links. More...
 
 drawCategoryBrowser ( $tree)
 Render the array as a series of links. More...
 
 generateDebugHTML ()
 Generate debug data HTML for displaying at the bottom of the main content area. More...
 
 getCopyrightIcon ()
 
 getIndicatorsData ( $indicators)
 Return an array of indicator data. More...
 
 getLogo ()
 URL to the default square logo (1x key) Please use ResourceLoaderSkinModule::getAvailableLogos. More...
 
 getPoweredBy ()
 Gets the powered by MediaWiki icon. More...
 
 getSearchLink ()
 
 lastModified ()
 Get the timestamp of the latest revision, formatted in user language. More...
 
 preloadExistence ()
 Preload the existence of three commonly-requested pages in a single query. More...
 

Static Protected Member Functions

static makeKnownUrlDetails ( $name, $urlaction='')
 Make URL details where the article exists (or at least it's convenient to think so) More...
 
static makeUrlDetails ( $name, $urlaction='')
 these return an array with the 'href' and boolean 'exists' More...
 

Protected Attributes

 $mRelevantTitle = null
 
 $mRelevantUser = null
 
array $options = []
 Skin options passed into constructor. More...
 
string null $skinname = null
 

Private Member Functions

 footerLinkTitle ( $desc, $page)
 
 getCachedNotice ( $name)
 Get a cached notice. More...
 

Detailed Description

The main skin class which provides methods and properties for all other skins.

See docs/Skin.md for more information.

Stable to extend

Definition at line 41 of file Skin.php.

Constructor & Destructor Documentation

◆ __construct()

Skin::__construct (   $options = null)
Since
1.31
Parameters
string | null | array$optionsOptions for the skin can be an array since 1.35. When an array is passed name represents skinname, scripts represents an array of ResourceLoader script modules and styles represents an array of ResourceLoader style modules to load on all pages. responsive indicates if a viewport meta tag should be set.

Definition at line 153 of file Skin.php.

References $options.

Member Function Documentation

◆ aboutLink()

Skin::aboutLink ( )

Gets the link to the wiki's about page.

Returns
string HTML

Definition at line 1120 of file Skin.php.

References footerLink().

Referenced by getSiteFooterLinks().

◆ addToSidebar()

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

Parameters
array&$bar
string$message

Definition at line 1684 of file Skin.php.

References addToSidebarPlain(), and ContextSource\msg().

Referenced by buildSidebar().

◆ addToSidebarPlain()

Skin::addToSidebarPlain ( $bar,
  $text 
)

Add content from plain text.

Since
1.17
Parameters
array&$bar
string$text
Returns
array

Definition at line 1695 of file Skin.php.

References $line, $lines, $title, Sanitizer\escapeIdForAttribute(), ContextSource\getConfig(), ContextSource\getTitle(), ContextSource\msg(), Title\newFromText(), Title\newMainPage(), wfMatchesDomainList(), and wfUrlProtocols().

Referenced by addToSidebar().

◆ afterContentHook()

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.

Returns
string Empty by default, if not changed by any hook function.

Definition at line 652 of file Skin.php.

References wfDebug().

Referenced by SkinMustache\getTemplateData(), and SkinTemplate\prepareQuickTemplate().

◆ bottomScripts()

Skin::bottomScripts ( )

This gets called shortly before the "</body>" tag.

Returns
string|WrappedStringList HTML containing scripts to put before </body>

Definition at line 690 of file Skin.php.

References ContextSource\getOutput().

Referenced by SkinTemplate\prepareQuickTemplate(), and SkinMustache\tailElement().

◆ buildFeedUrls()

Skin::buildFeedUrls ( )
finalprotected

Build data structure representing syndication links.

Since
1.35
Returns
array

Definition at line 1589 of file Skin.php.

References ContextSource\getOutput(), and ContextSource\msg().

Referenced by buildSidebar(), and SkinTemplate\prepareQuickTemplate().

◆ buildNavUrls()

◆ buildSidebar()

Skin::buildSidebar ( )

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 [ heading => content, ... ], where:

  • heading is the heading of a navigation portlet. It is either:
    • magic string to be handled by the skins ('SEARCH' / 'LANGUAGES' / 'TOOLBOX' / ...)
      • Note that 'SEARCH' unlike others is not supported out-of-the-box by the skins.
      • For it to work, a skin must add custom support for it.
    • a message name (e.g. 'navigation'), the message should be HTML-escaped by the skin
    • plain text, which should be HTML-escaped by the skin
  • content is the contents of the portlet. It is either:

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.

Stable to override

Returns
array

Definition at line 1629 of file Skin.php.

References addToSidebar(), buildFeedUrls(), buildNavUrls(), ContextSource\getConfig(), ContextSource\getLanguage(), getLanguages(), and makeToolbox().

Referenced by SkinTemplate\prepareQuickTemplate().

◆ checkTitle()

static Skin::checkTitle ( $title,
  $name 
)
static

make sure we have some title to operate on

Parameters
Title&$title
string$name

Definition at line 1324 of file Skin.php.

References $title, and Title\newFromText().

Referenced by SkinTemplate\makeArticleUrlDetails(), makeI18nUrl(), makeKnownUrlDetails(), makeMainPageUrl(), makeNSUrl(), SkinTemplate\makeTalkUrlDetails(), makeUrl(), and makeUrlDetails().

◆ disclaimerLink()

Skin::disclaimerLink ( )

Gets the link to the wiki's general disclaimers page.

Returns
string HTML

Definition at line 1128 of file Skin.php.

References footerLink().

Referenced by getSiteFooterLinks().

◆ doEditSectionLink()

Skin::doEditSectionLink ( Title  $nt,
  $section,
  $tooltip,
Language  $lang 
)

Create a section edit link.

SecurityCheck-XSS $links has keys of different taint types

Parameters
Title$ntThe title being linked to (may not be the same as the current page, if the section is included from a template)
string$sectionThe designation of the section being pointed to, to be included in the link, like "&section=$section"
string | null$tooltipThe tooltip to use for the link: will be escaped and wrapped in the 'editsectionhint' message
Language$langLanguage object
Returns
string HTML to use for edit link

Definition at line 1981 of file Skin.php.

References $lang, and ContextSource\msg().

◆ drawCategoryBrowser()

Skin::drawCategoryBrowser (   $tree)
protected

Render the array as a series of links.

Parameters
array$treeCategories tree returned by Title::getParentCategoryTree
Returns
string Separated by >, terminate with "\\n"

Definition at line 595 of file Skin.php.

References Title\newFromText().

Referenced by getCategoryLinks().

◆ editUrlOptions()

Skin::editUrlOptions ( )

Return URL options for the 'edit page' link.

This may include an 'oldid' specifier, if the current page view is such.

Returns
array

Definition at line 1139 of file Skin.php.

References $options, and ContextSource\getOutput().

Referenced by SkinTemplate\buildContentNavigationUrls().

◆ footerLink()

Skin::footerLink (   $desc,
  $page 
)

Returns an HTML link for use in the footer.

Parameters
string$descThe i18n message key for the link text
string$pageThe i18n message key for the page to link to
Returns
string HTML anchor

Definition at line 1039 of file Skin.php.

References $title, footerLinkTitle(), and ContextSource\msg().

Referenced by aboutLink(), disclaimerLink(), and privacyLink().

◆ footerLinkTitle()

Skin::footerLinkTitle (   $desc,
  $page 
)
private
Parameters
string$desc
string$page
Returns
Title|null

Definition at line 1057 of file Skin.php.

References $title, ContextSource\msg(), and Title\newFromText().

Referenced by footerLink(), and preloadExistence().

◆ generateDebugHTML()

Skin::generateDebugHTML ( )
protected

Generate debug data HTML for displaying at the bottom of the main content area.

Returns
string HTML containing debug data, if enabled (otherwise empty).
Deprecated:
since 1.35. Call MWDebug::getHTMLDebugLog() directly.

Definition at line 680 of file Skin.php.

References MWDebug\getHTMLDebugLog(), and wfDeprecated().

◆ getAfterPortlet()

Skin::getAfterPortlet ( string  $name)

Allows extensions to hook into known portlets and add stuff to them.

Unlike its BaseTemplate counterpart, this method does not wrap the html provided by the hook in a div.

Parameters
string$name
Returns
string html
Since
1.35

Definition at line 2468 of file Skin.php.

◆ getAllowedSkins()

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.

Returns
string[]
Since
1.23

Definition at line 78 of file Skin.php.

References $wgSkipSkins, and getSkinNames().

◆ getCachedNotice()

Skin::getCachedNotice (   $name)
private

Get a cached notice.

Parameters
string$nameMessage name, or 'default' for $wgSiteNotice
Returns
string|bool HTML fragment, or false to indicate that the caller should fall back to the next notice in its sequence

Definition at line 1896 of file Skin.php.

References $cache, ContextSource\getConfig(), ContextSource\getOutput(), ContextSource\msg(), and Html\rawElement().

Referenced by getSiteNotice().

◆ getCategories()

◆ getCategoryLinks()

◆ getCopyright()

Skin::getCopyright (   $type = 'detect')

◆ getCopyrightIcon()

Skin::getCopyrightIcon ( )
protected
Returns
null|string

Definition at line 889 of file Skin.php.

References ContextSource\getConfig().

Referenced by SkinTemplate\prepareQuickTemplate().

◆ getDefaultModules()

Skin::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.

Any modules defined with the 'styles' key will be added as render blocking CSS via Output::addModuleStyles. Similarly, each key should refer to a list of modules

Stable to override

Returns
array Array of modules with helper keys for easy overriding

Definition at line 214 of file Skin.php.

References $modules, ContextSource\getOutput(), and ContextSource\getUser().

◆ getHtmlElementAttributes()

Skin::getHtmlElementAttributes ( )

Return values for <html> element.

Returns
array Array of associative name-to-value elements for <html> element

Definition at line 502 of file Skin.php.

References $lang, and ContextSource\getLanguage().

Referenced by OutputPage\headElement().

◆ getIndicatorsData()

Skin::getIndicatorsData (   $indicators)
protected

Return an array of indicator data.

Can be used by subclasses but should not be extended.

Parameters
array$indicatorsreturn value of OutputPage::getIndicators
Returns
array

Definition at line 2125 of file Skin.php.

References $content, and Sanitizer\escapeIdForAttribute().

Referenced by getIndicatorsHTML(), and SkinMustache\getTemplateData().

◆ getIndicatorsHTML()

Skin::getIndicatorsHTML (   $indicators)
final

Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed in the top-right corner of the page, outside of the main content.

Your skin may implement this differently, for example by handling some indicator names specially with a different UI. However, it is recommended to use a <div class="mw-indicator" id="mw-indicator-<id>" /> as a wrapper element for each indicator, for better compatibility with extensions and user scripts.

The raw data is available in ‘$this->data['indicators’]` as an associative array (keys: identifiers, values: contents) internally ordered by keys.

Since
1.35
Deprecated:
since 1.36.
Parameters
array$indicators
Returns
string HTML

Definition at line 2101 of file Skin.php.

References getIndicatorsData(), Html\rawElement(), and wfDeprecated().

◆ getLanguages()

Skin::getLanguages ( )

Generates array of language links for the current page.

This may includes items added to this section by the SidebarBeforeOutput hook (which may not necessarily be language links)

Since
1.35
Returns
array

Definition at line 1354 of file Skin.php.

References LanguageCode\bcp47(), ContextSource\getConfig(), ContextSource\getLanguage(), ContextSource\getOutput(), ContextSource\getTitle(), mapInterwikiToLanguage(), ContextSource\msg(), and Title\newFromText().

Referenced by buildSidebar(), and SkinTemplate\prepareQuickTemplate().

◆ getLogo()

Skin::getLogo ( )
protected

URL to the default square logo (1x key) Please use ResourceLoaderSkinModule::getAvailableLogos.

Returns
string

Definition at line 516 of file Skin.php.

References ResourceLoaderSkinModule\getAvailableLogos(), and ContextSource\getConfig().

Referenced by logoText().

◆ getNewtalks()

Skin::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)

Returns
string

Definition at line 1789 of file Skin.php.

References $revStore, WikiMap\getCurrentWikiId(), ContextSource\getOutput(), ContextSource\getUser(), and ContextSource\msg().

Referenced by SkinTemplate\prepareQuickTemplate().

◆ getPageClasses()

Skin::getPageClasses (   $title)

TODO: document.

Parameters
Title$title
Returns
string

Definition at line 464 of file Skin.php.

References $title, $type, Sanitizer\escapeClass(), getPermissionManager(), and ContextSource\getUser().

Referenced by OutputPage\headElement().

◆ getPersonalToolsForMakeListItem()

Skin::getPersonalToolsForMakeListItem (   $urls)
final

Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.

The resulting array is built according to a format intended to be passed through makeListItem to generate the html. This is in reality the same list as already stored in personal_urls however it is reformatted so that you can just pass the individual items to makeListItem instead of hardcoding the element creation boilerplate.

Since
1.35
Parameters
array$urls
Returns
array

Definition at line 2149 of file Skin.php.

Referenced by SkinTemplate\getStructuredPersonalTools(), and SkinTemplate\makePersonalToolsList().

◆ getPoweredBy()

Skin::getPoweredBy ( )
protected

Gets the powered by MediaWiki icon.

Returns
string

Definition at line 919 of file Skin.php.

References ContextSource\getConfig().

Referenced by SkinTemplate\prepareQuickTemplate().

◆ getRelevantTitle()

Skin::getRelevantTitle ( )

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.

Returns
Title

Definition at line 383 of file Skin.php.

References ContextSource\getTitle().

Referenced by SkinTemplate\buildContentNavigationUrls(), getRelevantUser(), and preloadExistence().

◆ getRelevantUser()

Skin::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.

Returns
User

Definition at line 404 of file Skin.php.

References $mRelevantUser, $title, getRelevantTitle(), User\isIP(), User\newFromName(), and NS_USER.

Referenced by buildNavUrls().

◆ getRevisionId()

Skin::getRevisionId ( )

Get the current revision ID.

Deprecated:
since 1.34, use OutputPage::getRevisionId instead
Returns
int

Definition at line 346 of file Skin.php.

References ContextSource\getOutput(), and wfDeprecated().

Referenced by lastModified().

◆ getSearchLink()

Skin::getSearchLink ( )
protected
Returns
string

Definition at line 837 of file Skin.php.

References SpecialPage\getTitleFor().

Referenced by SkinTemplate\prepareQuickTemplate().

◆ getSiteFooterLinks()

Skin::getSiteFooterLinks ( )

Gets the link to the wiki's privacy policy, about page, and disclaimer page.

Definition at line 1077 of file Skin.php.

References aboutLink(), disclaimerLink(), ContextSource\getConfig(), and privacyLink().

Referenced by SkinTemplate\getFooterLinks().

◆ getSiteNotice()

Skin::getSiteNotice ( )

Get the site notice.

Returns
string HTML fragment

Definition at line 1945 of file Skin.php.

References getCachedNotice(), and ContextSource\getUser().

Referenced by SkinMustache\getTemplateData(), and SkinTemplate\prepareQuickTemplate().

◆ getSkinName()

Skin::getSkinName ( )
Returns
string|null Skin name

Definition at line 169 of file Skin.php.

References $skinname.

Referenced by OutputPage\headElement().

◆ getSkinNames()

static Skin::getSkinNames ( )
static

Fetch the set of available skins.

Returns
array Associative array of strings

Definition at line 66 of file Skin.php.

Referenced by ResourceLoaderContext\__construct(), ApiQuerySiteinfo\appendSkins(), getAllowedSkins(), ResourceLoaderFileModule\getAllSkinStyleFiles(), EditPage\isWrongCaseUserConfigPage(), and normalizeKey().

◆ getSkinStylePath()

Skin::getSkinStylePath (   $name)

Return a fully resolved style path URL to images or styles stored in the current skin's folder.

This method returns a URL resolved using the configured skin style path.

Requires $stylename to be set, otherwise throws MWException.

Parameters
string$nameThe name or path of a skin resource file
Returns
string The fully resolved style path URL
Exceptions
MWException

Definition at line 1178 of file Skin.php.

References ContextSource\getConfig().

◆ getUndeleteLink()

◆ initPage()

Skin::initPage ( OutputPage  $out)

Stable to override.

Parameters
OutputPage$out

Reimplemented in SkinFallback.

Definition at line 190 of file Skin.php.

References OutputPage\addMeta(), isResponsive(), and preloadExistence().

Referenced by SkinTemplate\outputPage().

◆ isResponsive()

Skin::isResponsive ( )

Indicates if this skin is responsive.

Responsive skins have skin–responsive added to <body> by OutputPage, and a viewport <meta> tag set by Skin::initPage.

Since
1.36 Stable to override
Returns
bool

Definition at line 182 of file Skin.php.

Referenced by OutputPage\headElement(), and initPage().

◆ isRevisionCurrent()

Skin::isRevisionCurrent ( )

Whether the revision displayed is the latest revision of the page.

Deprecated:
since 1.34, use OutputPage::isRevisionCurrent instead
Returns
bool

Definition at line 358 of file Skin.php.

References ContextSource\getOutput(), and wfDeprecated().

Referenced by getCopyright().

◆ lastModified()

Skin::lastModified ( )
protected

Get the timestamp of the latest revision, formatted in user language.

Returns
string

Definition at line 942 of file Skin.php.

References $s, $t, ContextSource\getLanguage(), ContextSource\getOutput(), getRevisionId(), ContextSource\getUser(), and ContextSource\msg().

Referenced by SkinTemplate\getFooterLinks().

◆ logoText()

Skin::logoText (   $align = '')
Parameters
string$align
Returns
string

Definition at line 973 of file Skin.php.

References getLogo(), ContextSource\msg(), and Title\newMainPage().

Referenced by SkinTemplate\prepareQuickTemplate().

◆ mainPageLink()

Skin::mainPageLink ( )

Gets the link to the wiki's main page.

Returns
string

Definition at line 1023 of file Skin.php.

References $s, ContextSource\msg(), and Title\newMainPage().

◆ makeFooterIcon()

Skin::makeFooterIcon (   $icon,
  $withImage = 'withImage' 
)

Renders a $wgFooterIcons icon according to the method's arguments.

Parameters
array$iconThe icon to build the html for, see $wgFooterIcons for the format of this array.
bool | string$withImageWhether to use the icon's image or output a text-only footericon.
Returns
string HTML

Definition at line 996 of file Skin.php.

References Html\element(), ContextSource\getConfig(), and Html\rawElement().

◆ makeI18nUrl()

static Skin::makeI18nUrl (   $name,
  $urlaction = '' 
)
static
Parameters
string$name
string | array$urlaction
Returns
string
Deprecated:
since 1.35, no longer used

Definition at line 1237 of file Skin.php.

References $title, checkTitle(), Title\newFromText(), wfDeprecated(), and wfMessage().

◆ makeInternalOrExternalUrl()

static Skin::makeInternalOrExternalUrl (   $name)
static

If url string starts with http, consider as external URL, else internal.

Parameters
string$name
Returns
string URL

Definition at line 1262 of file Skin.php.

References makeUrl(), and wfUrlProtocols().

Referenced by EmailNotification\composeCommonMailtext(), LoginSignupSpecialPage\getFieldDefinitions(), EditPage\showIntro(), and EditPage\showStandardInputs().

◆ makeKnownUrlDetails()

static Skin::makeKnownUrlDetails (   $name,
  $urlaction = '' 
)
staticprotected

Make URL details where the article exists (or at least it's convenient to think so)

Parameters
string$nameArticle name
string | array$urlaction
Returns
array

Definition at line 1308 of file Skin.php.

References $title, checkTitle(), Title\newFromText(), and true.

Referenced by SkinTemplate\setupTemplateContext().

◆ makeLink()

Skin::makeLink (   $key,
  $item,
  $options = [] 
)
final

Makes a link, usually used by makeListItem to generate a link for an item in a list used in navigation lists, portlets, portals, sidebars, etc...

Since
1.35
Parameters
string$keyUsually a key from the list you are generating this link from.
array$itemContains some of a specific set of keys.

The text of the link will be generated either from the contents of the "text" key in the $item array, if a "msg" key is present a message by that name will be used, and if neither of those are set the $key will be used as a message name.

If a "href" key is not present makeLink will just output htmlescaped text. The "href", "id", "class", "rel", and "type" keys are used as attributes for the link if present.

If an "id" or "single-id" (if you don't want the actual id to be output on the link) is present it will be used to generate a tooltip and accesskey for the link.

The keys "context" and "primary" are ignored; these keys are used internally by skins and are not supposed to be included in the HTML output.

If you don't want an accesskey, set $item['tooltiponly'] = true;

If a "data" key is present, it must be an array, where the keys represent the data-xxx properties with their provided values. For example, $item['data'] = [ 'foo' => 1, 'bar' => 'baz', ]; will render as element properties: data-foo='1' data-bar='baz'

Parameters
array$optionsCan be used to affect the output of a link. Possible options are:
  • 'text-wrapper' key to specify a list of elements to wrap the text of a link in. This should be an array of arrays containing a 'tag' and optionally an 'attributes' key. If you only have one element you don't need to wrap it in another array. eg: To use ... in all links use [ 'text-wrapper' => [ 'tag' => 'span' ] ] for your options.
  • 'link-class' key can be used to specify additional classes to apply to all links.
  • 'link-fallback' can be used to specify a tag to use instead of "<a>" if there is no link. eg: If you specify 'link-fallback' => 'span' than any non-link will output a "<span>" instead of just text.
Returns
string

Definition at line 2235 of file Skin.php.

References $options, $title, ContextSource\msg(), Html\rawElement(), Linker\titleAttrib(), and Linker\tooltipAndAccesskeyAttribs().

Referenced by makeListItem().

◆ makeListItem()

Skin::makeListItem (   $key,
  $item,
  $options = [] 
)
final

Generates a list item for a navigation, portlet, portal, sidebar...

list

Since
1.35
Parameters
string$keyUsually a key from the list you are generating this link from.
array$itemArray of list item data containing some of a specific set of keys. The "id", "class" and "itemtitle" keys will be used as attributes for the list item, if "active" contains a value of true a "active" class will also be appended to class. -param array{id?:string,class?:string,itemtitle?:string,active?:bool} $item
array$options-param array{tag?:string} $options

If you want something other than a "<li>" you can pass a tag name such as "tag" => "span" in the $options array to change the tag used. link/content data for the list item may come in one of two forms A "links" key may be used, in which case it should contain an array with a list of links to include inside the list item, see makeLink for the format of individual links array items.

Otherwise the relevant keys from the list item $item array will be passed to makeLink instead. Note however that "id" and "class" are used by the list item directly so they will not be passed to makeLink (however the link will still support a tooltip and accesskey from it) If you need an id or class on a single link you should include a "links" array with just one link item inside of it. You can also set "link-class" in $item to set a class on the link itself. If you want to add a title to the list item itself, you can set "itemtitle" to the value. $options is also passed on to makeLink calls

Returns
string

Definition at line 2343 of file Skin.php.

References $options, makeLink(), and Html\rawElement().

Referenced by SkinTemplate\makePersonalToolsList().

◆ makeMainPageUrl()

static Skin::makeMainPageUrl (   $urlaction = '')
static
Parameters
string | array$urlaction
Returns
string

Definition at line 1193 of file Skin.php.

References $title, checkTitle(), and Title\newMainPage().

Referenced by buildNavUrls().

◆ makeNSUrl()

static Skin::makeNSUrl (   $name,
  $urlaction = '',
  $namespace = NS_MAIN 
)
static

this can be passed the NS number as defined in Language.php

Parameters
string$name
string | array$urlaction
int$namespace
Returns
string
Deprecated:
since 1.35, no longer used

Definition at line 1278 of file Skin.php.

References $title, checkTitle(), Title\makeTitleSafe(), and wfDeprecated().

◆ makeSearchButton()

Skin::makeSearchButton (   $mode,
  $attrs = [] 
)
final
Parameters
string$moderepresenting the type of button wanted either go, fulltext or image
array$attrs(optional)
Exceptions
MWExceptionif bad value of $mode passed in
Returns
string of HTML button

Definition at line 2417 of file Skin.php.

References Html\element(), ContextSource\msg(), Html\rawElement(), and Linker\tooltipAndAccesskeyAttribs().

Referenced by SkinMustache\buildSearchProps().

◆ makeSearchInput()

Skin::makeSearchInput (   $attrs = [])
final
Since
1.35
Parameters
array$attrs(optional) will be passed to tooltipAndAccesskeyAttribs and decorate the resulting input
Returns
string of HTML input

Definition at line 2400 of file Skin.php.

References Html\element(), ContextSource\msg(), and Linker\tooltipAndAccesskeyAttribs().

Referenced by SkinMustache\buildSearchProps().

◆ makeSpecialUrl()

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.

Parameters
string$nameName of the Special page
string | array$urlactionQuery to append
string | null$protoProtocol to use or null for a local URL
Returns
string

Definition at line 1211 of file Skin.php.

References $title, and SpecialPage\getSafeTitleFor().

Referenced by buildNavUrls(), and SkinTemplate\buildPersonalUrls().

◆ makeSpecialUrlSubpage()

static Skin::makeSpecialUrlSubpage (   $name,
  $subpage,
  $urlaction = '' 
)
static
Parameters
string$name
string$subpage
string | array$urlaction
Returns
string

Definition at line 1226 of file Skin.php.

References $title, and SpecialPage\getSafeTitleFor().

Referenced by buildNavUrls(), and SkinTemplate\buildPersonalUrls().

◆ makeToolbox()

Skin::makeToolbox (   $navUrls,
  $feedUrls 
)

Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.

The resulting array is built according to a format intended to be passed through makeListItem to generate the html.

Parameters
array$navUrls
array$feedUrls
Returns
array

Definition at line 2035 of file Skin.php.

Referenced by buildSidebar().

◆ makeUrl()

static Skin::makeUrl (   $name,
  $urlaction = '' 
)
static
Parameters
string$name
string | array$urlaction
Returns
string

Definition at line 1249 of file Skin.php.

References $title, checkTitle(), and Title\newFromText().

Referenced by Action\addHelpLink(), SpecialPage\addHelpLink(), Article\addHelpLink(), and makeInternalOrExternalUrl().

◆ makeUrlDetails()

static Skin::makeUrlDetails (   $name,
  $urlaction = '' 
)
staticprotected

these return an array with the 'href' and boolean 'exists'

Parameters
string$name
string | array$urlaction
Returns
array

Definition at line 1292 of file Skin.php.

References $title, checkTitle(), and Title\newFromText().

Referenced by SkinTemplate\setupTemplateContext().

◆ makeVariablesScript()

static Skin::makeVariablesScript (   $data,
  $nonce = null 
)
static
Parameters
array$data
string | null$nonceOutputPage->getCSP()->getNonce()
Returns
string|WrappedString HTML

Definition at line 439 of file Skin.php.

References ResourceLoader\makeConfigSetScript(), and ResourceLoader\makeInlineScript().

Referenced by wfReportTime().

◆ mapInterwikiToLanguage()

Skin::mapInterwikiToLanguage (   $code)

Allows correcting the language of interlanguage links which, mostly due to legacy reasons, do not always match the standards compliant language tag.

Parameters
string$code
Returns
string
Since
1.35

Definition at line 1341 of file Skin.php.

References ContextSource\getConfig().

Referenced by getLanguages().

◆ normalizeKey()

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.

Parameters
string$key'monobook', 'vector', etc.
Returns
string

Definition at line 103 of file Skin.php.

References $fallback, $wgDefaultSkin, $wgFallbackSkin, and getSkinNames().

Referenced by ApiQuerySiteinfo\appendSkins(), ApiParse\execute(), MediaWiki\User\DefaultOptionsLookup\getDefaultOptions(), and RequestContext\getSkin().

◆ outputPage()

Skin::outputPage ( )
abstract

Outputs the HTML generated by other functions.

Reimplemented in SkinTemplate.

◆ preloadExistence()

Skin::preloadExistence ( )
protected

Preload the existence of three commonly-requested pages in a single query.

Definition at line 298 of file Skin.php.

References $title, footerLinkTitle(), ContextSource\getConfig(), getRelevantTitle(), and ContextSource\getUser().

Referenced by initPage().

◆ printSource()

Skin::printSource ( )

Text with the permalink to the source page, usually shown on the footer of a printed page.

Stable to override

Returns
string HTML text with an URL

Definition at line 713 of file Skin.php.

References $title, ContextSource\getOutput(), ContextSource\getTitle(), ContextSource\msg(), and wfExpandIRI().

Referenced by SkinMustache\getTemplateData(), and SkinTemplate\prepareQuickTemplate().

◆ privacyLink()

Skin::privacyLink ( )

Gets the link to the wiki's privacy policy page.

Returns
string HTML

Definition at line 1112 of file Skin.php.

References footerLink().

Referenced by getSiteFooterLinks().

◆ setRelevantTitle()

Skin::setRelevantTitle (   $t)

Set the "relevant" title.

See also
self::getRelevantTitle()
Parameters
Title$t

Definition at line 369 of file Skin.php.

References $t.

◆ setRelevantUser()

Skin::setRelevantUser (   $u)

Set the "relevant" user.

See also
self::getRelevantUser()
Parameters
User$u

Definition at line 392 of file Skin.php.

◆ setupSkinUserCss()

Skin::setupSkinUserCss ( OutputPage  $out)

Hook point for adding style modules to OutputPage.

Deprecated:
since 1.32 Use getDefaultModules() instead.
Parameters
OutputPage$outLegacy parameter, identical to $this->getOutput()

Definition at line 455 of file Skin.php.

◆ showEmailUser()

Skin::showEmailUser (   $id)
Parameters
User | int$id
Returns
bool

Definition at line 1154 of file Skin.php.

References ContextSource\getUser(), User\newFromId(), and SpecialEmailUser\validateTarget().

Referenced by buildNavUrls().

◆ subPageSubtitle()

Skin::subPageSubtitle (   $out = null)
Parameters
OutputPage | null$outDefaults to $this->getOutput() if left as null
Returns
string

Definition at line 780 of file Skin.php.

References $lang, $title, ContextSource\getLanguage(), ContextSource\getOutput(), ContextSource\msg(), and Title\newFromText().

Referenced by SkinTemplate\prepareSubtitle().

Member Data Documentation

◆ $mRelevantTitle

Skin::$mRelevantTitle = null
protected

Definition at line 53 of file Skin.php.

◆ $mRelevantUser

Skin::$mRelevantUser = null
protected

Definition at line 54 of file Skin.php.

Referenced by getRelevantUser().

◆ $options

array Skin::$options = []
protected

Skin options passed into constructor.

Definition at line 52 of file Skin.php.

Referenced by __construct(), editUrlOptions(), makeLink(), makeListItem(), and SkinTemplate\makePersonalToolsList().

◆ $skinname

string null Skin::$skinname = null
protected

Definition at line 47 of file Skin.php.

Referenced by getSkinName().

◆ $stylename

string Skin::$stylename = null

Stylesheets set to use.

Subdirectory in skins/ where various stylesheets are located. Only needs to be set if you intend to use the getSkinStylePath() method.

Definition at line 60 of file Skin.php.


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