BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
Skin Class Reference
Inheritance diagram for Skin:
Collaboration diagram for Skin:

Public Member Functions

 __construct ($skinname=null)
 
 getSkinName ()
 
 initPage (OutputPage $out)
 
 getDefaultModules ()
 
 getRevisionId ()
 
 isRevisionCurrent ()
 
 setRelevantTitle ($t)
 
 getRelevantTitle ()
 
 setRelevantUser ($u)
 
 getRelevantUser ()
 
 outputPage (OutputPage $out=null)
 
 setupSkinUserCss (OutputPage $out)
 
 getPageClasses ($title)
 
 getHtmlElementAttributes ()
 
 addToBodyAttributes ($out, &$bodyAttrs)
 
 getLogo ()
 
 shouldPreloadLogo ()
 
 getCategoryLinks ()
 
 drawCategoryBrowser ($tree)
 
 getCategories ()
 
 bottomScripts ()
 
 printSource ()
 
 getUndeleteLink ()
 
 subPageSubtitle ($out=null)
 
 getSearchLink ()
 
 escapeSearchLink ()
 
 getCopyright ($type= 'detect')
 
 getCopyrightIcon ()
 
 getPoweredBy ()
 
 logoText ($align= '')
 
 makeFooterIcon ($icon, $withImage= 'withImage')
 
 mainPageLink ()
 
 footerLink ($desc, $page)
 
 privacyLink ()
 
 aboutLink ()
 
 disclaimerLink ()
 
 showEmailUser ($id)
 
 getSkinStylePath ($name)
 
 buildSidebar ()
 
 addToSidebar (&$bar, $message)
 
 addToSidebarPlain (&$bar, $text)
 
 getNewtalks ()
 
 getSiteNotice ()
 
 doEditSectionLink (Title $nt, $section, $tooltip=null, $lang=false)
 
- Public Member Functions inherited from ContextSource
 getContext ()
 
 setContext (IContextSource $context)
 
 getConfig ()
 
 getRequest ()
 
 getTitle ()
 
 canUseWikiPage ()
 
 getWikiPage ()
 
 getOutput ()
 
 getUser ()
 
 getLanguage ()
 
 getSkin ()
 
 getTiming ()
 
 getStats ()
 
 msg ($key)
 
 exportSession ()
 

Static Public Member Functions

static getSkinNames ()
 
static getSkinNameMessages ()
 
static getAllowedSkins ()
 
static normalizeKey ($key)
 
static makeVariablesScript ($data)
 
static getDynamicStylesheetQuery ()
 
static makeMainPageUrl ($urlaction= '')
 
static makeSpecialUrl ($name, $urlaction= '', $proto=null)
 
static makeSpecialUrlSubpage ($name, $subpage, $urlaction= '')
 
static makeI18nUrl ($name, $urlaction= '')
 
static makeUrl ($name, $urlaction= '')
 
static makeInternalOrExternalUrl ($name)
 
static makeNSUrl ($name, $urlaction= '', $namespace=NS_MAIN)
 
static makeUrlDetails ($name, $urlaction= '')
 
static makeKnownUrlDetails ($name, $urlaction= '')
 
static checkTitle (&$title, $name)
 

Public Attributes

 $stylename = null
 

Protected Member Functions

 preloadExistence ()
 
 afterContentHook ()
 
 generateDebugHTML ()
 
 lastModified ()
 

Protected Attributes

 $skinname = null
 
 $mRelevantTitle = null
 
 $mRelevantUser = null
 

Detailed Description

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

See docs/skin.txt for more information.

Constructor & Destructor Documentation

Skin::__construct (   $skinname = null)
Since
1.31
Parameters
string | null$skinname

Member Function Documentation

Skin::aboutLink ( )

Gets the link to the wiki's about page.

Returns
string HTML
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.

Parameters
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

Parameters
array&$bar
string$message
Skin::addToSidebarPlain ( $bar,
  $text 
)

Add content from plain text

Since
1.17
Parameters
array&$bar
string$text
Returns
array
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.
Skin::bottomScripts ( )

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

Returns
string HTML-wrapped JS code to be put before "</body>"
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' / ...)
    • 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.

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

make sure we have some title to operate on

Parameters
Title&$title
string$name
Skin::disclaimerLink ( )

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

Returns
string HTML
Skin::doEditSectionLink ( Title  $nt,
  $section,
  $tooltip = null,
  $lang = false 
)

Create a section edit link. This supersedes editSectionLink() and editSectionLinkForOther().

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$tooltipThe tooltip to use for the link: will be escaped and wrapped in the 'editsectionhint' message
string$langLanguage code
Returns
string HTML to use for edit link
Skin::drawCategoryBrowser (   $tree)

Render the array as a series of links.

Parameters
array$treeCategories tree returned by Title::getParentCategoryTree
Returns
string Separated by >, terminate with "\n"
Skin::escapeSearchLink ( )
Returns
string
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
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).
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
Skin::getCategories ( )
Returns
string HTML
Skin::getCategoryLinks ( )
Returns
string HTML
Skin::getCopyright (   $type = 'detect')
Parameters
string$type
Returns
string
Skin::getCopyrightIcon ( )
Returns
null|string
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

Returns
array Array of modules with helper keys for easy overriding
static Skin::getDynamicStylesheetQuery ( )
static

Get the query to generate a dynamic stylesheet

Returns
array
Skin::getHtmlElementAttributes ( )

Return values for <html> element

Returns
array Array of associative name-to-value elements for <html> element
Skin::getLogo ( )

URL to the logo

Returns
string
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
Skin::getPageClasses (   $title)

TODO: document

Parameters
Title$title
Returns
string
Skin::getPoweredBy ( )

Gets the powered by MediaWiki icon.

Returns
string
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
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
Skin::getRevisionId ( )

Get the current revision ID

Returns
int
Skin::getSearchLink ( )
Returns
string
Skin::getSiteNotice ( )

Get the site notice

Returns
string HTML fragment
Skin::getSkinName ( )
Returns
string|null Skin name
static Skin::getSkinNameMessages ( )
static

Fetch the skinname messages for available skins.

Returns
string[]
static Skin::getSkinNames ( )
static

Fetch the set of available skins.

Returns
array Associative array of strings
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.

Parameters
string$nameThe name or path of a skin resource file
Returns
string The fully resolved style path url including styleversion
Exceptions
MWException
Skin::getUndeleteLink ( )
Returns
string HTML
Skin::initPage ( OutputPage  $out)
Parameters
OutputPage$out
Skin::isRevisionCurrent ( )

Whether the revision displayed is the latest revision of the page

Returns
bool
Skin::lastModified ( )
protected

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

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

Gets the link to the wiki's main page.

Returns
string
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
static Skin::makeI18nUrl (   $name,
  $urlaction = '' 
)
static
Parameters
string$name
string|string[]$urlaction
Returns
string
static Skin::makeInternalOrExternalUrl (   $name)
static

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

Parameters
string$name
Returns
string URL
static Skin::makeKnownUrlDetails (   $name,
  $urlaction = '' 
)
static

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

Parameters
string$nameArticle name
string|string[]$urlaction
Returns
array
static Skin::makeMainPageUrl (   $urlaction = '')
static
Parameters
string|string[]$urlaction
Returns
string
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|string[]$urlaction
int$namespace
Returns
string
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|string[]$urlaction Query to append
string | null$protoProtocol to use or null for a local URL
Returns
string
static Skin::makeSpecialUrlSubpage (   $name,
  $subpage,
  $urlaction = '' 
)
static
Parameters
string$name
string$subpage
string|string[]$urlaction
Returns
string
static Skin::makeUrl (   $name,
  $urlaction = '' 
)
static
Parameters
string$name
string|string[]$urlaction
Returns
string
static Skin::makeUrlDetails (   $name,
  $urlaction = '' 
)
static

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

Parameters
string$name
string|string[]$urlaction
Returns
array
static Skin::makeVariablesScript (   $data)
static
Parameters
array$data
Returns
string
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
Skin::outputPage ( OutputPage  $out = null)
abstract

Outputs the HTML generated by other functions.

Parameters
OutputPage$out
Skin::preloadExistence ( )
protected

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

Skin::printSource ( )

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

Returns
string HTML text with an URL
Skin::privacyLink ( )

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

Returns
string HTML
Skin::setRelevantTitle (   $t)

Set the "relevant" title

See Also
self::getRelevantTitle()
Parameters
Title$t
Skin::setRelevantUser (   $u)

Set the "relevant" user

See Also
self::getRelevantUser()
Parameters
User$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.

Parameters
OutputPage$out
Todo:
delete
Skin::shouldPreloadLogo ( )

Whether the logo should be preloaded with an HTTP link header or not

Since
1.29
Returns
bool
Skin::showEmailUser (   $id)
Parameters
User | int$id
Returns
bool
Skin::subPageSubtitle (   $out = null)
Parameters
OutputPage$outDefaults to $this->getOutput() if left as null
Returns
string

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