MediaWiki REL1_37
|
Base class for QuickTemplate-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. | |
getPersonalToolsList () | |
Get the HTML for the p-personal list. | |
getStructuredPersonalTools () | |
Get personal tools for the user. | |
getTemplateData () | |
Subclasses may extend this method to add additional template data. | |
makePersonalToolsList ( $personalTools=null, $options=[]) | |
Get the HTML for the personal tools list Please ensure setupTemplateContext is called before calling this method. | |
outputPage () | |
Initialize various variables and generate the template. | |
tabAction ( $title, $message, $selected, $query='', $checkEdit=false) | |
Builds an array with tab definition. | |
Public Member Functions inherited from Skin | |
__construct ( $options=null) | |
aboutLink () | |
Gets the link to the wiki's about page. | |
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. | |
buildSidebar () | |
Build an array that represents the sidebar(s), the navigation bar among them. | |
disclaimerLink () | |
Gets the link to the wiki's general disclaimers page. | |
doEditSectionLink (Title $nt, $section, $tooltip, Language $lang) | |
Create a section edit link. | |
editUrlOptions () | |
Return URL options for the 'edit page' link. | |
footerLink ( $desc, $page) | |
Given a pair of message keys for link and text label, return an HTML link for use in the footer. | |
getAfterPortlet (string $name) | |
Allows extensions to hook into known portlets and add stuff to them. | |
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. | |
getHtmlElementAttributes () | |
Return values for <html> element. | |
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. | |
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) | |
getPageClasses ( $title) | |
TODO: document. | |
getPersonalToolsForMakeListItem ( $urls, $applyClassesToListItems=false) | |
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate. | |
getRelevantTitle () | |
Return the "relevant" title. | |
getRelevantUser () | |
Return the "relevant" user. | |
getSearchPageTitle () | |
getSiteFooterLinks () | |
Gets the link to the wiki's privacy policy, about page, and disclaimer page. | |
getSiteNotice () | |
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) | |
isResponsive () | |
Indicates if this skin is responsive. | |
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. | |
makeLink ( $key, $item, $linkOptions=[]) | |
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... | |
makeListItem ( $key, $item, $options=[]) | |
Generates a list item for a navigation, portlet, portal, sidebar... list. | |
makeSearchButton ( $mode, $attrs=[]) | |
makeSearchInput ( $attrs=[]) | |
makeToolbox ( $navUrls, $feedUrls) | |
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate. | |
mapInterwikiToLanguage ( $code) | |
Allows correcting the language of interlanguage links which, mostly due to legacy reasons, do not always match the standards compliant language tag. | |
prepareSubtitle () | |
Prepare the subtitle of the page for output in the skin if one has been set. | |
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) | |
setRelevantUser (?UserIdentity $u) | |
setSearchPageTitle (Title $title) | |
showEmailUser ( $id) | |
subPageSubtitle ( $out) | |
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. | |
getAuthority () | |
getConfig () | |
getContext () | |
Get the base IContextSource object. | |
getCsrfTokenSet () | |
Get a repository to obtain and match CSRF tokens. | |
getLanguage () | |
getOutput () | |
getRequest () | |
getSkin () | |
getStats () | |
getTiming () | |
getTitle () | |
getUser () | |
getWikiPage () | |
Get the WikiPage object. | |
msg ( $key,... $params) | |
Get a Message object with context set Parameters are the same as wfMessage() | |
setContext (IContextSource $context) | |
Public Attributes | |
$loggedin | |
string | $template |
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 | |
buildCreateAccountData ( $returnto) | |
Build "Create Account" link. | |
buildLoginData ( $returnto, $useCombinedLoginLink) | |
Build "Login" link. | |
buildLogoutLinkData () | |
Build data required for "Logout" link. | |
buildPersonalPageItem ( $id='pt-userpage') | |
Build a personal page link. | |
buildPersonalUrls (bool $includeNotifications=true) | |
build array of urls for personal toolbar Please ensure setupTemplateContext is called before calling this method. | |
getFooterIcons () | |
Get template representation of the footer. | |
getJsConfigVars () | |
Returns array of config variables that should be added only to this skin for use in JavaScript. | |
getNameSpaceKey () | |
Generate strings used for xml 'id' names. | |
getPortletData ( $name, array $items) | |
getReturnToParam () | |
Builds query params for the page to return to, used when building links. | |
injectLegacyMenusIntoPersonalTools (array $contentNavigation) | |
Insert legacy menu items from content navigation into the personal toolbar. | |
prepareQuickTemplate () | |
initialize various variables and generate the template | |
prepareUndeleteLink () | |
Prepare undelete link for output in page. | |
prepareUserLanguageAttributes () | |
Prepare user language attribute links. | |
runOnSkinTemplateNavigationHooks (SkinTemplate $skin, &$content_navigation) | |
Run hooks relating to navigation menu data. | |
setupTemplate ( $classname) | |
Create the template engine object; we feed it a bunch of data and eventually it spits out some HTML. | |
setupTemplateContext () | |
Setup class properties that are necessary prior to calling setupTemplateForOutput. | |
setupTemplateForOutput () | |
useCombinedLoginLink () | |
Returns if a combined login/signup link will be used. | |
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. | |
buildFeedUrls () | |
Build data structure representing syndication links. | |
buildNavUrls () | |
Build array of common navigation links. | |
drawCategoryBrowser ( $tree) | |
Render the array as a series of links. | |
getCopyrightIcon () | |
getFooterLinks () | |
Get template representation of the footer containing site footer links as well as standard footer links. | |
getIndicatorsData ( $indicators) | |
Return an array of indicator data. | |
getLogo () | |
URL to the default square logo (1x key) | |
getPoweredBy () | |
Gets the powered by MediaWiki icon. | |
getSearchLink () | |
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. | |
Protected Attributes | |
$action | |
Protected Attributes inherited from Skin | |
$mRelevantTitle = null | |
array | $options = [] |
Skin options passed into constructor. | |
string null | $skinname = null |
const | VERSION_MAJOR = 1 |
The current major version of the skin specification. | |
Private Member Functions | |
buildContentActionUrls ( $content_navigation) | |
an array of edit links by default used for the tabs | |
buildSearchProps () | |
getFooterTemplateData () | |
Get rows that make up the footer. | |
getLogoData () | |
getPortletLabel ( $name) | |
getPortletsTemplateData () | |
getWatchLinkAttrs (string $mode, Authority $performer, Title $title, ?string $action, bool $onPage) | |
Get the attributes for the watch link. | |
makeSkinTemplatePersonalUrls (array $contentNavigation) | |
Build the personal urls array. | |
makeTalkUrlDetails ( $name, $urlaction='') | |
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 | getSkinNames () |
Fetch the set of available skins. | |
static | getVersion () |
Get the current major version of Skin. | |
static | makeInternalOrExternalUrl ( $name) |
If url string starts with http, consider as external URL, else internal. | |
static | makeMainPageUrl ( $urlaction='') |
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 | makeVariablesScript ( $data, $nonce=null) |
static | normalizeKey ( $key) |
Normalize a skin preference value to a form that can be loaded. | |
Static Protected Member Functions inherited from Skin | |
static | makeKnownUrlDetails ( $name, $urlaction='') |
Make URL details where the article exists (or at least it's convenient to think so) | |
static | makeUrlDetails ( $name, $urlaction='') |
these return an array with the 'href' and boolean 'exists' | |
Base class for QuickTemplate-based skins.
The template data is filled in SkinTemplate::prepareQuickTemplate.
Definition at line 34 of file SkinTemplate.php.
|
private |
an array of edit links by default used for the tabs
array | $content_navigation |
Definition at line 1578 of file SkinTemplate.php.
References wfDebug().
|
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 1238 of file SkinTemplate.php.
References $title, getAuthority(), getContext(), Title\getLocalURL(), getTitle(), SpecialPage\getTitleFor(), MediaWiki\Permissions\Authority\getUser(), NS_MEDIAWIKI, true, wfMessage(), and wfMessageFallback().
|
protected |
Build "Create Account" link.
string[] | $returnto | query params for the page to return to |
Definition at line 1026 of file SkinTemplate.php.
References $title, and getTitle().
|
protected |
Build "Login" link.
string[] | $returnto | query params for the page to return to |
bool | $useCombinedLoginLink | when set a single link to login form will be created with alternative label. |
Definition at line 721 of file SkinTemplate.php.
References $title, getAuthority(), and getTitle().
|
finalprotected |
Build data required for "Logout" link.
Definition at line 1003 of file SkinTemplate.php.
References $title, and getTitle().
|
protected |
Build a personal page link.
string | $id | of user page item to be output in HTML attribute (optional) |
Definition at line 1044 of file SkinTemplate.php.
|
protected |
build array of urls for personal toolbar Please ensure setupTemplateContext is called before calling this method.
bool | $includeNotifications | Sinc 1.36, notifications are optional |
Definition at line 522 of file SkinTemplate.php.
References $title, getAuthority(), getTitle(), and Title\isSpecialPage().
|
private |
Definition at line 973 of file SkinTemplate.php.
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 126 of file SkinTemplate.php.
References prepareQuickTemplate().
Referenced by outputPage().
|
protected |
Get template representation of the footer.
Definition at line 218 of file SkinTemplate.php.
|
private |
Get rows that make up the footer.
Definition at line 885 of file SkinTemplate.php.
|
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 154 of file SkinTemplate.php.
Referenced by outputPage().
|
private |
Definition at line 952 of file SkinTemplate.php.
|
protected |
Generate strings used for xml 'id' names.
Definition at line 1618 of file SkinTemplate.php.
References getTitle().
SkinTemplate::getPersonalToolsList | ( | ) |
Get the HTML for the p-personal list.
Definition at line 469 of file SkinTemplate.php.
|
protected |
string | $name | of the portal e.g. p-personal the name is personal. |
array | $items | that are accepted input to Skin::makeListItem |
Definition at line 746 of file SkinTemplate.php.
References $content, and Linker\tooltip().
|
private |
string | $name | of the portal e.g. p-personal the name is personal. |
Definition at line 804 of file SkinTemplate.php.
|
private |
Definition at line 821 of file SkinTemplate.php.
|
protected |
Builds query params for the page to return to, used when building links.
Definition at line 666 of file SkinTemplate.php.
References $title, getAuthority(), getTitle(), wfArrayToCgi(), and wfCgiToArray().
SkinTemplate::getStructuredPersonalTools | ( | ) |
Get personal tools for the user.
Definition at line 507 of file SkinTemplate.php.
SkinTemplate::getTemplateData | ( | ) |
Subclasses may extend this method to add additional template data.
The data keys should be valid English words. Compound words should be hypenated except if they are normally written as one word. Each key should be prefixed with a type hint, this may be enforced by the class PHPUnit test.
Plain strings are prefixed with 'html-', plain arrays with 'array-' and complex array data with 'data-'. 'is-' and 'has-' prefixes can be used for boolean variables. Messages are prefixed with 'msg-', followed by their message key. All messages specified in the skin option 'messages' will be available under 'msg-MESSAGE-NAME'.
Reimplemented in SkinFallback, and SkinMustache.
Definition at line 283 of file SkinTemplate.php.
|
private |
Get the attributes for the watch link.
string | $mode | Either 'watch' or 'unwatch' |
Authority | $performer | |
Title | $title | |
string | null | $action | |
bool | $onPage |
Definition at line 1154 of file SkinTemplate.php.
|
finalprotected |
Insert legacy menu items from content navigation into the personal toolbar.
array | $contentNavigation |
Definition at line 1630 of file SkinTemplate.php.
References wfArrayInsertAfter().
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 483 of file SkinTemplate.php.
|
private |
Build the personal urls array.
array | $contentNavigation |
Definition at line 1660 of file SkinTemplate.php.
|
private |
string | $name | |
string | array | $urlaction |
Definition at line 1132 of file SkinTemplate.php.
References $title.
SkinTemplate::outputPage | ( | ) |
Initialize various variables and generate the template.
Reimplemented from Skin.
Definition at line 136 of file SkinTemplate.php.
References generateHTML(), getJsConfigVars(), ContextSource\getOutput(), and Skin\initPage().
|
protected |
initialize various variables and generate the template
Definition at line 297 of file SkinTemplate.php.
References $title, ResourceLoaderSkinModule\getAvailableLogos(), getTitle(), and wfReportTime().
Referenced by generateHTML().
|
finalprotected |
Prepare undelete link for output in page.
Definition at line 260 of file SkinTemplate.php.
Referenced by SkinMustache\getTemplateData().
|
finalprotected |
Prepare user language attribute links.
Definition at line 195 of file SkinTemplate.php.
Referenced by SkinMustache\getTemplateData().
|
protected |
Run hooks relating to navigation menu data.
Skins should extend this if they want to run opinionated transformations to the data after all hooks have been run. Note hooks are run in an arbitary order.
SkinTemplate | $skin | |
array | &$content_navigation | representing all menus. |
Definition at line 1190 of file SkinTemplate.php.
References $title.
|
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 59 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 88 of file SkinTemplate.php.
References $title, ContextSource\getRequest(), getTitle(), ContextSource\getUser(), and wfArrayToCgi().
Referenced by SkinMustache\generateHTML(), and setupTemplateForOutput().
|
protected |
Definition at line 66 of file SkinTemplate.php.
References setupTemplate(), and setupTemplateContext().
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 1071 of file SkinTemplate.php.
References $title, getContext(), true, and wfMessageFallback().
|
protected |
Returns if a combined login/signup link will be used.
Definition at line 700 of file SkinTemplate.php.
|
protected |
Wrap the body text with language information and identifiable element.
Title | $title | |
string | $html | body text |
Definition at line 165 of file SkinTemplate.php.
References $title, NS_FILE, and NS_SPECIAL.
Referenced by SkinMustache\getTemplateData().
|
protected |
Definition at line 41 of file SkinTemplate.php.
SkinTemplate::$loggedin |
Definition at line 47 of file SkinTemplate.php.
string SkinTemplate::$template |
For QuickTemplate, the name of the subclass which will actually fill the template.
Definition at line 39 of file SkinTemplate.php.
Referenced by SkinMustache\generateHTML().
SkinTemplate::$thispage |
Definition at line 42 of file SkinTemplate.php.
SkinTemplate::$thisquery |
Definition at line 45 of file SkinTemplate.php.
SkinTemplate::$titletxt |
Definition at line 43 of file SkinTemplate.php.
SkinTemplate::$username |
Definition at line 48 of file SkinTemplate.php.
SkinTemplate::$userpage |
Definition at line 44 of file SkinTemplate.php.
SkinTemplate::$userpageUrlDetails |
Definition at line 49 of file SkinTemplate.php.