MediaWiki REL1_32
SkinApi Class Reference

SkinTemplate class for API output. More...

Inheritance diagram for SkinApi:
Collaboration diagram for SkinApi:

Public Member Functions

 buildSidebar ()
 Build an array that represents the sidebar(s), the navigation bar among them.
 
 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.
 
 getLanguages ()
 Generates array of language links for the current page.
 
 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)
 
 getSiteNotice ()
 Get the site notice.
 
- Public Member Functions inherited from SkinTemplate
 formatLanguageName ( $name)
 Format language name for use in sidebar interlanguage links list.
 
 getPersonalToolsList ()
 Get the HTML for the p-personal list.
 
 getStructuredPersonalTools ()
 Get personal tools for the user.
 
 makeArticleUrlDetails ( $name, $urlaction='')
 
 makePersonalToolsList ( $personalTools=null, $options=[])
 Get the HTML for the personal tools list.
 
 makeTalkUrlDetails ( $name, $urlaction='')
 
 outputPage (OutputPage $out=null)
 initialize various variables and generate the template
 
 printOrError ( $str)
 Output the string, or print error message if it's an error object of the appropriate type.
 
 setupTemplate ( $classname, $repository=false, $cache_dir=false)
 Create the template engine object; we feed it a bunch of data and eventually it spits out some HTML.
 
 tabAction ( $title, $message, $selected, $query='', $checkEdit=false)
 Builds an array with tab definition.
 
 useCombinedLoginLink ()
 Output a boolean indicating if buildPersonalUrls should output separate login and create account links or output a combined link By default we simply return a global config setting that affects most skins This is setup as a method so that like with $wgLogo and getLogo() a skin can override this setting and always output one or the other if it has a reason it can't output one of the two modes.
 
- Public Member Functions inherited from Skin
 __construct ( $skinname=null)
 
 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.
 
 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 ()
 
 getCopyright ( $type='detect')
 
 getCopyrightIcon ()
 
 getHtmlElementAttributes ()
 Return values for <html> element.
 
 getLogo ()
 URL to the logo.
 
 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 ()
 
 getSkinName ()
 
 getSkinStylePath ( $name)
 Return a fully resolved style path URL to images or styles stored in the current skin'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.
 
 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)
 Hook point for adding style modules to OutputPage.
 
 shouldPreloadLogo ()
 Whether the logo should be preloaded with an HTTP link header or not.
 
 showEmailUser ( $id)
 
 subPageSubtitle ( $out=null)
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage().
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID.
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object.
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

Public Attributes

 $skinname = 'apioutput'
 
 $template = SkinApiTemplate::class
 
- Public Attributes inherited from SkinTemplate
 $loggedin
 
string $skinname = 'monobook'
 Name of our skin, it probably needs to be all lower case.
 
string $template = QuickTemplate::class
 For QuickTemplate, the name of the subclass which will actually fill the template.
 
 $thispage
 
 $thisquery
 
 $titletxt
 
 $username
 
 $userpage
 
 $userpageUrlDetails
 
- Public Attributes inherited from Skin
string $stylename = null
 Stylesheets set to use.
 

Protected Member Functions

 buildContentNavigationUrls ()
 a structured array of links usually used for the tabs in a skin
 
 buildNavUrls ()
 build array of common navigation links
 
 buildPersonalUrls ()
 build array of urls for personal toolbar
 
- Protected Member Functions inherited from SkinTemplate
 getNameSpaceKey ()
 Generate strings used for xml 'id' names.
 
 prepareQuickTemplate ()
 initialize various variables and generate the template
 
 setupTemplateForOutput ()
 
 wrapHTML ( $title, $html)
 Wrap the body text with language information and identifiable element.
 
- Protected Member Functions inherited from Skin
 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.
 
 preloadExistence ()
 Preload the existence of three commonly-requested pages in a single query.
 

Additional Inherited Members

- Static Public Member Functions inherited from Skin
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 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, $nonce=null)
 
static normalizeKey ( $key)
 Normalize a skin preference value to a form that can be loaded.
 
- Protected Attributes inherited from Skin
 $mRelevantTitle = null
 
 $mRelevantUser = null
 
string null $skinname = null
 

Detailed Description

SkinTemplate class for API output.

Since
1.25

Definition at line 31 of file SkinApi.php.

Member Function Documentation

◆ buildContentNavigationUrls()

SkinApi::buildContentNavigationUrls ( )
protected

a structured array of links usually used for the tabs in a skin

There are 4 standard sections namespaces: Used for namespace tabs like special, page, and talk namespaces views: Used for primary page views like read, edit, history actions: Used for most extra page actions like deletion, protection, etc... variants: Used to list the language variants for the page

Each section's value is a key/value array of links for that section. The links themselves have these common keys:

  • class: The css classes to apply to the tab
  • text: The text to display on the tab
  • href: The href for the tab to point to
  • rel: An optional rel= for the tab's link
  • redundant: If true the tab will be dropped in skins using content_actions this is useful for tabs like "Read" which only have meaning in skins that take special meaning from the grouped structure of content_navigation

Views also have an extra key which can be used:

  • primary: If this is not true skins like vector may try to hide the tab when the user has limited space in their browser window

content_navigation using code also expects these ids to be present on the links, however these are usually automatically generated by SkinTemplate itself and are not necessary when using a hook. The only things these may matter to are people modifying content_navigation after it's initial creation:

  • id: A "preferred" id, most skins are best off outputting this preferred id for best compatibility.
  • tooltiponly: This is set to true for some tabs in cases where the system believes that the accesskey should not be added to the tab.
Returns
array

Reimplemented from SkinTemplate.

Definition at line 63 of file SkinApi.php.

◆ buildNavUrls()

SkinApi::buildNavUrls ( )
protected

build array of common navigation links

Returns
array

Reimplemented from SkinTemplate.

Definition at line 67 of file SkinApi.php.

◆ buildPersonalUrls()

SkinApi::buildPersonalUrls ( )
protected

build array of urls for personal toolbar

Returns
array

Reimplemented from SkinTemplate.

Definition at line 59 of file SkinApi.php.

◆ buildSidebar()

SkinApi::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

Reimplemented from Skin.

Definition at line 43 of file SkinApi.php.

◆ getDefaultModules()

SkinApi::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

Reimplemented from Skin.

Definition at line 35 of file SkinApi.php.

References $modules.

◆ getLanguages()

SkinApi::getLanguages ( )

Generates array of language links for the current page.

Returns
array

Reimplemented from SkinTemplate.

Definition at line 55 of file SkinApi.php.

◆ getNewtalks()

SkinApi::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

Reimplemented from Skin.

Definition at line 47 of file SkinApi.php.

◆ getSiteNotice()

SkinApi::getSiteNotice ( )

Get the site notice.

Returns
string HTML fragment

Reimplemented from Skin.

Definition at line 51 of file SkinApi.php.

Member Data Documentation

◆ $skinname

SkinApi::$skinname = 'apioutput'

Definition at line 32 of file SkinApi.php.

◆ $template

SkinApi::$template = SkinApiTemplate::class

Definition at line 33 of file SkinApi.php.


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