[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/skins/ -> Skin.php (summary)

Base class for all skins. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 1620 lines (45 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 69 functions

  getSkinNames()
  getSkinNameMessages()
  getAllowedSkins()
  getUsableSkins()
  normalizeKey()
  newFromKey()
  getSkinName()
  initPage()
  getDefaultModules()
  preloadExistence()
  getRevisionId()
  isRevisionCurrent()
  setRelevantTitle()
  getRelevantTitle()
  setRelevantUser()
  getRelevantUser()
  makeVariablesScript()
  getDynamicStylesheetQuery()
  getPageClasses()
  getHtmlElementAttributes()
  addToBodyAttributes()
  getLogo()
  getCategoryLinks()
  drawCategoryBrowser()
  getCategories()
  afterContentHook()
  generateDebugHTML()
  bottomScripts()
  printSource()
  getUndeleteLink()
  subPageSubtitle()
  showIPinHeader()
  getSearchLink()
  escapeSearchLink()
  getCopyright()
  getCopyrightIcon()
  getPoweredBy()
  lastModified()
  logoText()
  makeFooterIcon()
  mainPageLink()
  footerLink()
  privacyLink()
  aboutLink()
  disclaimerLink()
  editUrlOptions()
  showEmailUser()
  getCommonStylePath()
  getSkinStylePath()
  makeMainPageUrl()
  makeSpecialUrl()
  makeSpecialUrlSubpage()
  makeI18nUrl()
  makeUrl()
  makeInternalOrExternalUrl()
  makeNSUrl()
  makeUrlDetails()
  makeKnownUrlDetails()
  checkTitle()
  buildSidebar()
  addToSidebar()
  addToSidebarPlain()
  commonPrintStylesheet()
  getNewtalks()
  getCachedNotice()
  getNamespaceNotice()
  getSiteNotice()
  doEditSectionLink()
  __call()

Functions
Functions that are not part of a class:

getSkinNames()   X-Ref
Fetch the set of available skins.

return: array Associative array of strings

getSkinNameMessages()   X-Ref
Fetch the skinname messages for available skins.

return: string[]

getAllowedSkins()   X-Ref
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.

return: string[]

getUsableSkins()   X-Ref

return: string[]

normalizeKey( $key )   X-Ref
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.

param: string $key 'monobook', 'vector', etc.
return: string

newFromKey( $key )   X-Ref
Factory method for loading a skin of a given type

param: string $key 'monobook', 'vector', etc.
return: Skin

getSkinName()   X-Ref

return: string Skin name

initPage( OutputPage $out )   X-Ref

param: OutputPage $out

getDefaultModules()   X-Ref
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

return: array Array of modules with helper keys for easy overriding

preloadExistence()   X-Ref
Preload the existence of three commonly-requested pages in a single query


getRevisionId()   X-Ref
Get the current revision ID

return: int

isRevisionCurrent()   X-Ref
Whether the revision displayed is the latest revision of the page

return: bool

setRelevantTitle( $t )   X-Ref
Set the "relevant" title

param: Title $t

getRelevantTitle()   X-Ref
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.

return: Title

setRelevantUser( $u )   X-Ref
Set the "relevant" user

param: User $u

getRelevantUser()   X-Ref
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.

return: User

makeVariablesScript( $data )   X-Ref

param: array $data
return: string

getDynamicStylesheetQuery()   X-Ref
Get the query to generate a dynamic stylesheet

return: array

getPageClasses( $title )   X-Ref
TODO: document

param: Title $title
return: string

getHtmlElementAttributes()   X-Ref
Return values for <html> element

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

addToBodyAttributes( $out, &$bodyAttrs )   X-Ref
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.

param: OutputPage $out
param: array $bodyAttrs

getLogo()   X-Ref
URL to the logo

return: string

getCategoryLinks()   X-Ref

return: string

drawCategoryBrowser( $tree )   X-Ref
Render the array as a series of links.

param: array $tree Categories tree returned by Title::getParentCategoryTree
return: string Separated by &gt;, terminate with "\n"

getCategories()   X-Ref

return: string

afterContentHook()   X-Ref
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.

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

generateDebugHTML()   X-Ref
Generate debug data HTML for displaying at the bottom of the main content
area.

return: string HTML containing debug data, if enabled (otherwise empty).

bottomScripts()   X-Ref
This gets called shortly before the "</body>" tag.

return: string HTML-wrapped JS code to be put before "</body>"

printSource()   X-Ref
Text with the permalink to the source page,
usually shown on the footer of a printed page

return: string HTML text with an URL

getUndeleteLink()   X-Ref

return: string

subPageSubtitle()   X-Ref

return: string

showIPinHeader()   X-Ref
Returns true if the IP should be shown in the header

return: bool

getSearchLink()   X-Ref

return: string

escapeSearchLink()   X-Ref

return: string

getCopyright( $type = 'detect' )   X-Ref

param: string $type
return: string

getCopyrightIcon()   X-Ref

return: null|string

getPoweredBy()   X-Ref
Gets the powered by MediaWiki icon.

return: string

lastModified()   X-Ref
Get the timestamp of the latest revision, formatted in user language

return: string

logoText( $align = '' )   X-Ref

param: string $align
return: string

makeFooterIcon( $icon, $withImage = 'withImage' )   X-Ref
Renders a $wgFooterIcons icon according to the method's arguments

param: array $icon The icon to build the html for, see $wgFooterIcons
param: bool|string $withImage Whether to use the icon's image or output
return: string HTML

mainPageLink()   X-Ref
Gets the link to the wiki's main page.

return: string

footerLink( $desc, $page )   X-Ref
Returns an HTML link for use in the footer

param: string $desc The i18n message key for the link text
param: string $page The i18n message key for the page to link to
return: string HTML anchor

privacyLink()   X-Ref
Gets the link to the wiki's privacy policy page.

return: string HTML

aboutLink()   X-Ref
Gets the link to the wiki's about page.

return: string HTML

disclaimerLink()   X-Ref
Gets the link to the wiki's general disclaimers page.

return: string HTML

editUrlOptions()   X-Ref
Return URL options for the 'edit page' link.
This may include an 'oldid' specifier, if the current page view is such.

return: array

showEmailUser( $id )   X-Ref

param: User|int $id
return: bool

getCommonStylePath( $name )   X-Ref
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.

param: string $name The name or path of a skin resource file
return: string Empty string

getSkinStylePath( $name )   X-Ref
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.

param: string $name The name or path of a skin resource file
return: string The fully resolved style path url including styleversion

makeMainPageUrl( $urlaction = '' )   X-Ref

param: string $urlaction
return: string

makeSpecialUrl( $name, $urlaction = '', $proto = null )   X-Ref
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.

param: string $name Name of the Special page
param: string $urlaction Query to append
param: string|null $proto Protocol to use or null for a local URL
return: string

makeSpecialUrlSubpage( $name, $subpage, $urlaction = '' )   X-Ref

param: string $name
param: string $subpage
param: string $urlaction
return: string

makeI18nUrl( $name, $urlaction = '' )   X-Ref

param: string $name
param: string $urlaction
return: string

makeUrl( $name, $urlaction = '' )   X-Ref

param: string $name
param: string $urlaction
return: string

makeInternalOrExternalUrl( $name )   X-Ref
If url string starts with http, consider as external URL, else
internal

param: string $name
return: string URL

makeNSUrl( $name, $urlaction = '', $namespace = NS_MAIN )   X-Ref
this can be passed the NS number as defined in Language.php

param: string $name
param: string $urlaction
param: int $namespace
return: string

makeUrlDetails( $name, $urlaction = '' )   X-Ref
these return an array with the 'href' and boolean 'exists'

param: string $name
param: string $urlaction
return: array

makeKnownUrlDetails( $name, $urlaction = '' )   X-Ref
Make URL details where the article exists (or at least it's convenient to think so)

param: string $name Article name
param: string $urlaction
return: array

checkTitle( &$title, $name )   X-Ref
make sure we have some title to operate on

param: Title $title
param: string $name

buildSidebar()   X-Ref
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:
- 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:
- HTML text (<ul><li>...</li>...</ul>)
- array of link data in a format accepted by BaseTemplate::makeListItem()
- (for a magic string as a key, any value)

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.

return: array

addToSidebar( &$bar, $message )   X-Ref
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

param: array $bar
param: string $message

addToSidebarPlain( &$bar, $text )   X-Ref
Add content from plain text

param: array $bar
param: string $text
return: array

commonPrintStylesheet()   X-Ref
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).

return: bool

getNewtalks()   X-Ref
Gets new talk page messages for the current user and returns an
appropriate alert message (or an empty string if there are no messages)

return: string

getCachedNotice( $name )   X-Ref
Get a cached notice

param: string $name Message name, or 'default' for $wgSiteNotice
return: string HTML fragment

getNamespaceNotice()   X-Ref
Get a notice based on page's namespace

return: string HTML fragment

getSiteNotice()   X-Ref
Get the site notice

return: string HTML fragment

doEditSectionLink( Title $nt, $section, $tooltip = null, $lang = false )   X-Ref
Create a section edit link.  This supersedes editSectionLink() and
editSectionLinkForOther().

param: Title $nt The title being linked to (may not be the same as
param: string $section The designation of the section being pointed to,
param: string $tooltip The tooltip to use for the link: will be escaped
param: string $lang Language code
return: string HTML to use for edit link

__call( $fname, $args )   X-Ref
Use PHP's magic __call handler to intercept legacy calls to the linker
for backwards compatibility.

param: string $fname Name of called method
param: array $args Arguments to the method
return: mixed



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1