MediaWiki
master
|
Base class for template-based skins. More...
Public Member Functions | |
generateHTML () | |
Subclasses not wishing to use the QuickTemplate render method can rewrite this method, for example to use TemplateParser::processTemplate. More... | |
getPersonalToolsList () | |
Get the HTML for the p-personal list. More... | |
getStructuredPersonalTools () | |
Get personal tools for the user. More... | |
makeArticleUrlDetails ( $name, $urlaction='') | |
makePersonalToolsList ( $personalTools=null, $options=[]) | |
Get the HTML for the personal tools list Please ensure setupTemplateContext is called before calling this method. More... | |
outputPage () | |
Initialize various variables and generate the template @stable to override. More... | |
tabAction ( $title, $message, $selected, $query='', $checkEdit=false) | |
Builds an array with tab definition. More... | |
![]() | |
__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... | |
doSetupSkinUserCss (OutputPage $out) | |
Call the subclass's setupSkinUserCss and throw a deprecation warning if required. More... | |
editUrlOptions () | |
Return URL options for the 'edit page' link. More... | |
footerLink ( $desc, $page) | |
Given a pair of message keys for link and text label, return 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 () | |
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... | |
prepareSubtitle () | |
Prepare the subtitle of the page for output in the skin if one has been set. 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) | |
setRelevantUser ( $u) | |
setupSkinUserCss (OutputPage $out) | |
Hook point for adding style modules to OutputPage. More... | |
showEmailUser ( $id) | |
subPageSubtitle ( $out) | |
![]() | |
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) | |
Public Attributes | |
$loggedin | |
string | $template |
For QuickTemplate, the name of the subclass which will actually fill the template. More... | |
$thispage | |
$thisquery | |
$titletxt | |
$username | |
$userpage | |
$userpageUrlDetails | |
![]() | |
string | $stylename = null |
Stylesheets set to use. More... | |
Protected Member Functions | |
buildContentNavigationUrls () | |
a structured array of links usually used for the tabs in a skin More... | |
buildNavUrls () | |
build array of common navigation links and run the SkinTemplateBuildNavUrlsNav_urlsAfterPermalink hook. More... | |
buildPersonalUrls () | |
build array of urls for personal toolbar Please ensure setupTemplateContext is called before calling this method. More... | |
getFooterIcons () | |
Get template representation of the footer. More... | |
getJsConfigVars () | |
Returns array of config variables that should be added only to this skin for use in JavaScript. More... | |
getNameSpaceKey () | |
Generate strings used for xml 'id' names. More... | |
prepareQuickTemplate () | |
initialize various variables and generate the template More... | |
prepareUndeleteLink () | |
Prepare undelete link for output in page. More... | |
prepareUserLanguageAttributes () | |
Prepare user language attribute links. More... | |
setupTemplate ( $classname) | |
Create the template engine object; we feed it a bunch of data and eventually it spits out some HTML. More... | |
setupTemplateContext () | |
Setup class properties that are necessary prior to calling setupTemplateForOutput. More... | |
setupTemplateForOutput () | |
wrapHTML ( $title, $html) | |
Wrap the body text with language information and identifiable element. More... | |
![]() | |
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... | |
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 () | |
getFooterLinks () | |
Get template representation of the footer containing site footer links as well as standard footer links. More... | |
getIndicatorsData ( $indicators) | |
Return an array of indicator data. More... | |
getLogo () | |
URL to the default square logo (1x key) 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... | |
Private Member Functions | |
buildContentActionUrls ( $content_navigation) | |
an array of edit links by default used for the tabs More... | |
getWatchLinkAttrs (string $mode, User $user, Title $title, ?string $action, bool $onPage) | |
Get the attributes for the watch link. More... | |
makeTalkUrlDetails ( $name, $urlaction='') | |
Additional Inherited Members | |
![]() | |
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 | getVersion () |
Get the current major version of Skin. More... | |
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... | |
![]() | |
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... | |
![]() | |
$mRelevantTitle = null | |
$mRelevantUser = null | |
array | $options = [] |
Skin options passed into constructor. More... | |
string null | $skinname = null |
const | VERSION_MAJOR = 1 |
The current major version of the skin specification. More... | |
Base class for template-based skins.
Template-filler skin base class Formerly generic PHPTal (http://phptal.sourceforge.net/) skin Based on Brion's smarty skin
Stable to extend
Definition at line 39 of file SkinTemplate.php.
|
private |
an array of edit links by default used for the tabs
array | $content_navigation |
Definition at line 1175 of file SkinTemplate.php.
References wfDebug().
Referenced by prepareQuickTemplate().
|
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:
Views also have an extra key which can be used:
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:
Definition at line 836 of file SkinTemplate.php.
References Skin\$skinname, $title, LanguageCode\bcp47(), ContextSource\canUseWikiPage(), Skin\editUrlOptions(), Action\getActionName(), ContextSource\getContext(), ContextSource\getOutput(), Skin\getRelevantTitle(), ContextSource\getRequest(), ContextSource\getTitle(), SpecialPage\getTitleFor(), ContextSource\getUser(), getWatchLinkAttrs(), ContextSource\getWikiPage(), ContextSource\msg(), NS_MEDIAWIKI, ContextSource\setContext(), tabAction(), wfMessage(), and wfMessageFallback().
Referenced by SkinMustache\getPortletsTemplateData(), and prepareQuickTemplate().
|
protected |
build array of common navigation links and run the SkinTemplateBuildNavUrlsNav_urlsAfterPermalink hook.
Build array of common navigation links.Assumes thispage property has been set before execution.
Reimplemented from Skin.
Definition at line 1216 of file SkinTemplate.php.
References ContextSource\getOutput().
Referenced by prepareQuickTemplate().
|
protected |
build array of urls for personal toolbar Please ensure setupTemplateContext is called before calling this method.
Definition at line 481 of file SkinTemplate.php.
References $title, $username, ContextSource\getConfig(), ContextSource\getRequest(), ContextSource\getTitle(), ContextSource\getUser(), Title\isSpecialPage(), Skin\makeSpecialUrl(), Skin\makeSpecialUrlSubpage(), makeTalkUrlDetails(), ContextSource\msg(), Title\newFromText(), wfArrayToCgi(), and wfCgiToArray().
Referenced by SkinMustache\getPortletsTemplateData(), getStructuredPersonalTools(), makePersonalToolsList(), and prepareQuickTemplate().
SkinTemplate::generateHTML | ( | ) |
Subclasses not wishing to use the QuickTemplate render method can rewrite this method, for example to use TemplateParser::processTemplate.
<!DOCTYPE>
and opening and closing html tags. Reimplemented in SkinMustache.
Definition at line 128 of file SkinTemplate.php.
References prepareQuickTemplate().
Referenced by outputPage().
|
protected |
Get template representation of the footer.
Definition at line 215 of file SkinTemplate.php.
References ContextSource\getConfig().
Referenced by SkinMustache\getFooterTemplateData(), and prepareQuickTemplate().
|
protected |
Returns array of config variables that should be added only to this skin for use in JavaScript.
Skins can override this to add variables to the page.
Definition at line 156 of file SkinTemplate.php.
Referenced by outputPage().
|
protected |
Generate strings used for xml 'id' names.
Definition at line 1242 of file SkinTemplate.php.
References ContextSource\getTitle().
SkinTemplate::getPersonalToolsList | ( | ) |
Get the HTML for the p-personal list.
Definition at line 429 of file SkinTemplate.php.
References makePersonalToolsList().
SkinTemplate::getStructuredPersonalTools | ( | ) |
Get personal tools for the user.
Definition at line 467 of file SkinTemplate.php.
References buildPersonalUrls(), Skin\getPersonalToolsForMakeListItem(), and setupTemplateContext().
|
private |
Get the attributes for the watch link.
string | $mode | Either 'watch' or 'unwatch' |
User | $user | |
Title | $title | |
string | null | $action | |
bool | $onPage |
Definition at line 775 of file SkinTemplate.php.
References $title, ContextSource\getConfig(), User\isTempWatched(), and ContextSource\msg().
Referenced by buildContentNavigationUrls().
SkinTemplate::makeArticleUrlDetails | ( | $name, | |
$urlaction = '' |
|||
) |
string | $name | |
string | array | $urlaction |
Definition at line 755 of file SkinTemplate.php.
References $title, Skin\checkTitle(), Title\newFromText(), and wfDeprecated().
SkinTemplate::makePersonalToolsList | ( | $personalTools = null , |
|
$options = [] |
|||
) |
Get the HTML for the personal tools list Please ensure setupTemplateContext is called before calling this method.
array | null | $personalTools | |
array | $options |
Definition at line 443 of file SkinTemplate.php.
References Skin\$options, buildPersonalUrls(), Skin\getPersonalToolsForMakeListItem(), Skin\makeListItem(), and setupTemplateContext().
Referenced by getPersonalToolsList().
|
private |
string | $name | |
string | array | $urlaction |
Definition at line 736 of file SkinTemplate.php.
References $title, Skin\checkTitle(), and Title\newFromText().
Referenced by buildPersonalUrls().
SkinTemplate::outputPage | ( | ) |
Initialize various variables and generate the template @stable to override.
Reimplemented from Skin.
Definition at line 138 of file SkinTemplate.php.
References generateHTML(), getJsConfigVars(), ContextSource\getOutput(), Skin\initPage(), and Profiler\instance().
|
protected |
initialize various variables and generate the template
Definition at line 262 of file SkinTemplate.php.
References $title, Skin\afterContentHook(), Skin\bottomScripts(), buildContentActionUrls(), buildContentNavigationUrls(), Skin\buildFeedUrls(), buildNavUrls(), buildPersonalUrls(), Skin\buildSidebar(), ResourceLoaderSkinModule\getAvailableLogos(), Skin\getCategories(), ContextSource\getConfig(), Skin\getCopyrightIcon(), getFooterIcons(), Skin\getFooterLinks(), MWDebug\getHTMLDebugLog(), ContextSource\getLanguage(), Skin\getLanguages(), Skin\getNewtalks(), ContextSource\getOutput(), Skin\getPoweredBy(), ContextSource\getRequest(), Skin\getSiteNotice(), ContextSource\getTitle(), SpecialPage\getTitleFor(), Skin\logoText(), Skin\prepareSubtitle(), prepareUndeleteLink(), prepareUserLanguageAttributes(), Skin\printSource(), Html\rawElement(), setupTemplateForOutput(), wfDebug(), wfReportTime(), and wrapHTML().
Referenced by generateHTML().
|
finalprotected |
Prepare undelete link for output in page.
Definition at line 251 of file SkinTemplate.php.
References Skin\getUndeleteLink().
Referenced by SkinMustache\getTemplateData(), and prepareQuickTemplate().
|
finalprotected |
Prepare user language attribute links.
Definition at line 192 of file SkinTemplate.php.
References ContextSource\getLanguage().
Referenced by SkinMustache\getTemplateData(), and prepareQuickTemplate().
|
protected |
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.
string | $classname |
Definition at line 63 of file SkinTemplate.php.
References ContextSource\getConfig().
Referenced by setupTemplateForOutput().
|
finalprotected |
Setup class properties that are necessary prior to calling setupTemplateForOutput.
It must be called inside prepareQuickTemplate. This function may set local class properties that will be used by other methods, but should not make assumptions about the implementation of setupTemplateForOutput
Definition at line 92 of file SkinTemplate.php.
References $title, ContextSource\getRequest(), ContextSource\getTitle(), ContextSource\getUser(), Skin\makeKnownUrlDetails(), Skin\makeUrlDetails(), and wfArrayToCgi().
Referenced by SkinMustache\generateHTML(), getStructuredPersonalTools(), makePersonalToolsList(), and setupTemplateForOutput().
|
protected |
Definition at line 70 of file SkinTemplate.php.
References $template, setupTemplate(), and setupTemplateContext().
Referenced by prepareQuickTemplate().
SkinTemplate::tabAction | ( | $title, | |
$message, | |||
$selected, | |||
$query = '' , |
|||
$checkEdit = false |
|||
) |
Builds an array with tab definition.
Title | $title | Page Where the tab links to |
string | string[] | MessageSpecifier | $message | Message or an array of message keys (will fall back) |
bool | $selected | Display the tab as selected |
string | $query | Query string attached to tab URL |
bool | $checkEdit | Check if $title exists and mark with .new if one doesn't |
-taint | $message | tainted |
Definition at line 668 of file SkinTemplate.php.
References $title, ContextSource\getContext(), true, and wfMessageFallback().
Referenced by buildContentNavigationUrls().
|
protected |
Wrap the body text with language information and identifiable element.
Title | $title | |
string | $html | body text |
Definition at line 167 of file SkinTemplate.php.
References $title, Action\getActionName(), NS_FILE, NS_SPECIAL, and Html\rawElement().
Referenced by SkinMustache\getTemplateData(), and prepareQuickTemplate().
SkinTemplate::$loggedin |
Definition at line 51 of file SkinTemplate.php.
string SkinTemplate::$template |
For QuickTemplate, the name of the subclass which will actually fill the template.
Definition at line 44 of file SkinTemplate.php.
Referenced by SkinMustache\generateHTML(), and setupTemplateForOutput().
SkinTemplate::$thispage |
Definition at line 46 of file SkinTemplate.php.
SkinTemplate::$thisquery |
Definition at line 49 of file SkinTemplate.php.
SkinTemplate::$titletxt |
Definition at line 47 of file SkinTemplate.php.
SkinTemplate::$username |
Definition at line 52 of file SkinTemplate.php.
Referenced by buildPersonalUrls().
SkinTemplate::$userpage |
Definition at line 48 of file SkinTemplate.php.
SkinTemplate::$userpageUrlDetails |
Definition at line 53 of file SkinTemplate.php.