[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

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

Base class for template-based 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: 2123 lines (71 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

MediaWikiI18N:: (2 methods):
  set()
  translate()

SkinTemplate:: (47 methods):
  setupSkinUserCss()
  setupTemplate()
  getLanguages()
  setupTemplateForOutput()
  outputPage()
  prepareQuickTemplate()
  getPersonalToolsList()
  formatLanguageName()
  printOrError()
  useCombinedLoginLink()
  buildPersonalUrls()
  tabAction()
  makeTalkUrlDetails()
  makeArticleUrlDetails()
  buildContentNavigationUrls()
  buildContentActionUrls()
  buildNavUrls()
  getNameSpaceKey()
  __construct()
  set()
  get()
  setRef()
  setTranslator()
  text()
  html()
  msg()
  msgHtml()
  msgWiki()
  haveData()
  haveMsg()
  getSkin()
  getHTML()
  getMsg()
  msg()
  msgHtml()
  msgWiki()
  getToolbox()
  getPersonalTools()
  getSidebar()
  renderAfterPortlet()
  makeLink()
  makeListItem()
  makeSearchInput()
  makeSearchButton()
  getFooterLinks()
  getFooterIcons()
  printTrail()


Class: MediaWikiI18N  - X-Ref

Wrapper object for MediaWiki's localization functions,
to be passed to the template engine.

set( $varName, $value )   X-Ref
No description

translate( $value )   X-Ref
No description

Class: SkinTemplate  - X-Ref

Template-filler skin base class
Formerly generic PHPTal (http://phptal.sourceforge.net/) skin
Based on Brion's smarty skin

setupSkinUserCss( OutputPage $out )   X-Ref
Add specific styles for this skin

param: OutputPage $out

setupTemplate( $classname, $repository = false, $cache_dir = false )   X-Ref
Create the template engine object; we feed it a bunch of data
and eventually it spits out some HTML. Should have interface
roughly equivalent to PHPTAL 0.7.

param: string $classname
param: bool|string $repository Subdirectory where we keep template files
param: bool|string $cache_dir
return: QuickTemplate

getLanguages()   X-Ref
Generates array of language links for the current page

return: array

setupTemplateForOutput()   X-Ref
No description

outputPage( OutputPage $out = null )   X-Ref
initialize various variables and generate the template

param: OutputPage $out

prepareQuickTemplate()   X-Ref
initialize various variables and generate the template

return: QuickTemplate The template to be executed by outputPage

getPersonalToolsList()   X-Ref
Get the HTML for the p-personal list

return: string

formatLanguageName( $name )   X-Ref
Format language name for use in sidebar interlanguage links list.
By default it is capitalized.

param: string $name Language name, e.g. "English" or "espaƱol"
return: string

printOrError( $str )   X-Ref
Output the string, or print error message if it's
an error object of the appropriate type.
For the base class, assume strings all around.

param: string $str

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

return: bool

buildPersonalUrls()   X-Ref
build array of urls for personal toolbar

return: array

tabAction( $title, $message, $selected, $query = '', $checkEdit = false )   X-Ref
Builds an array with tab definition

param: Title $title Page Where the tab links to
param: string|array $message Message key or an array of message keys (will fall back)
param: bool $selected Display the tab as selected
param: string $query Query string attached to tab URL
param: bool $checkEdit Check if $title exists and mark with .new if one doesn't
return: array

makeTalkUrlDetails( $name, $urlaction = '' )   X-Ref
No description

makeArticleUrlDetails( $name, $urlaction = '' )   X-Ref
No description

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

return: array

buildContentActionUrls( $content_navigation )   X-Ref
an array of edit links by default used for the tabs

param: array $content_navigation
return: array

buildNavUrls()   X-Ref
build array of common navigation links

return: array

getNameSpaceKey()   X-Ref
Generate strings used for xml 'id' names

return: string

__construct( Config $config = null )   X-Ref

param: Config $config

set( $name, $value )   X-Ref
Sets the value $value to $name

param: string $name
param: mixed $value

get( $name, $default = null )   X-Ref
Gets the template data requested

param: string $name Key for the data
param: mixed $default Optional default (or null)
return: mixed The value of the data requested or the deafult

setRef( $name, &$value )   X-Ref

param: string $name
param: mixed $value

setTranslator( &$t )   X-Ref

param: MediaWikiI18N $t

text( $str )   X-Ref

param: string $str
return: string

html( $str )   X-Ref

param: string $str
return: string

msg( $str )   X-Ref

param: string $str
return: string

msgHtml( $str )   X-Ref

param: string $str
return: string

msgWiki( $str )   X-Ref
An ugly, ugly hack.

param: string $str
return: string

haveData( $str )   X-Ref

param: string $str
return: bool

haveMsg( $str )   X-Ref

param: string $str
return: bool

getSkin()   X-Ref
Get the Skin object related to this object

return: Skin

getHTML()   X-Ref
Fetch the output of a QuickTemplate and return it

return: string

getMsg( $name )   X-Ref
Get a Message object with its context set

param: string $name Message name
return: Message

msg( $str )   X-Ref
No description

msgHtml( $str )   X-Ref
No description

msgWiki( $str )   X-Ref
No description

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

return: array

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

return: array

getSidebar( $options = array()   X-Ref
No description

renderAfterPortlet( $name )   X-Ref

param: string $name

makeLink( $key, $item, $options = array()   X-Ref
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...

param: string $key Usually a key from the list you are generating this
param: array $item Contains some of a specific set of keys.
param: array $options Can be used to affect the output of a link.
return: string

makeListItem( $key, $item, $options = array()   X-Ref
Generates a list item for a navigation, portlet, portal, sidebar... list

param: string $key Usually a key from the list you are generating this link from.
param: array $item Array of list item data containing some of a specific set of keys.
param: array $options
return: string

makeSearchInput( $attrs = array()   X-Ref
No description

makeSearchButton( $mode, $attrs = array()   X-Ref
No description

getFooterLinks( $option = null )   X-Ref
Returns an array of footerlinks trimmed down to only those footer links that
are valid.
If you pass "flat" as an option then the returned array will be a flat array
of footer icons instead of a key/value array of footerlinks arrays broken
up into categories.

param: string $option
return: array|mixed

getFooterIcons( $option = null )   X-Ref
Returns an array of footer icons filtered down by options relevant to how
the skin wishes to display them.
If you pass "icononly" as the option all footer icons which do not have an
image icon set will be filtered out.
If you pass "nocopyright" then MediaWiki's copyright icon will not be included
in the list of footer icons. This is mostly useful for skins which only
display the text from footericons instead of the images and don't want a
duplicate copyright statement because footerlinks already rendered one.

param: string $option
return: string

printTrail()   X-Ref
Output the basic end-page trail including bottomscripts, reporttime, and
debug stuff. This should be called right before outputting the closing
body and html tags.




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