MediaWiki
master
|
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. More... | |
getCategoryLinks () | |
Extends category links with Skin::getAfterPortlet functionality. More... | |
getStructuredPersonalTools () | |
Get personal tools for the user. More... | |
getTemplateData () | |
@inheritDoc More... | |
makePersonalToolsList ( $personalTools=null, $options=[]) | |
Get the HTML for the personal tools list. More... | |
makeSearchButton ( $mode, $attrs=[]) | |
makeSearchInput ( $attrs=[]) | |
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) | |
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 ( $triggerWarnings=true) | |
This gets called shortly before the "</body>" tag. More... | |
buildSidebar () | |
Build an array that represents the sidebar(s), the navigation bar among them. More... | |
doEditSectionLink (Title $nt, $section, $sectionTitle, Language $lang) | |
Create a section edit link. 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 () | |
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... | |
getFooterIcons () | |
Get template representation of the footer. More... | |
getHtmlElementAttributes () | |
Return values for <html> element. 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... | |
getOptions () | |
Returns skin options Recommended to use SkinFactory::getSkinOptions instead. More... | |
getPageClasses ( $title) | |
TODO: document. More... | |
getPersonalToolsForMakeListItem ( $urls, $applyClassesToListItems=false) | |
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... | |
getSiteNotice () | |
getSkinName () | |
getUndeleteLink () | |
initPage (OutputPage $out) | |
isResponsive () | |
Indicates if this skin is responsive. More... | |
logoText ( $align='') | |
makeFooterIcon ( $icon, $withImage='withImage') | |
Renders a $wgFooterIcons icon according to the method's arguments. More... | |
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... More... | |
makeListItem ( $key, $item, $options=[]) | |
Generates a list item for a navigation, portlet, portal, sidebar... More... | |
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 (bool $withContainer=true) | |
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... | |
setRelevantTitle ( $t) | |
setRelevantUser (?UserIdentity $u) | |
showEmailUser ( $id) | |
supportsMenu (string $menu) | |
Does the skin support the named menu? More... | |
![]() | |
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... | |
getActionName () | |
Get the action name for the current web request. More... | |
getAuthority () | |
getConfig () | |
getContext () | |
Get the base IContextSource object. More... | |
getCsrfTokenSet () | |
Get a repository to obtain and match CSRF tokens. More... | |
getLanguage () | |
getOutput () | |
getRequest () | |
getSkin () | |
getTiming () | |
getTitle () | |
getUser () | |
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) | |
Static Public Member Functions | |
static | makeSearchButtonInternal ( $mode, $searchData, $attrs=[]) |
![]() | |
static | getPortletLinkOptions (RL\Context $context) |
Returns skin options for portlet links, used by addPortletLink. 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 | 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 | normalizeKey ( $key) |
Normalize a skin preference value to a form that can be loaded. More... | |
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 | |
Protected Member Functions | |
buildContentNavigationUrls () | |
Wrapper for private buildContentNavigationUrlsInternal. More... | |
buildCreateAccountData ( $returnto) | |
Build "Create Account" link data. More... | |
buildLoginData ( $returnto, $useCombinedLoginLink) | |
Build "Login" link. More... | |
buildLogoutLinkData () | |
Build data required for "Logout" link. More... | |
buildPersonalPageItem ( $id='pt-userpage') | |
Build a user page link data. More... | |
buildPersonalUrls (bool $includeNotifications=true) | |
Build array of urls for personal toolbar. More... | |
getNameSpaceKey () | |
Generate strings used for xml 'id' names. More... | |
getReturnToParam () | |
Builds query params for the page to return to, used when building links. More... | |
injectLegacyMenusIntoPersonalTools (array $contentNavigation) | |
Insert legacy menu items from content navigation into the personal toolbar. More... | |
prepareQuickTemplate () | |
initialize various variables and generate the template More... | |
runOnSkinTemplateNavigationHooks (SkinTemplate $skin, &$content_navigation) | |
Run hooks relating to navigation menu data. 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 () | |
useCombinedLoginLink () | |
Returns if a combined login/signup link will be used. 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... | |
buildNavUrls () | |
Build array of common navigation links. More... | |
getAction () | |
getComponent (string $name) | |
getIndicatorsData ( $indicators) | |
Return an array of indicator data. More... | |
getJsConfigVars () | |
Returns array of config variables that should be added only to this skin for use in JavaScript. More... | |
getPortletData (string $name, array $items) | |
lastModified () | |
Get the timestamp of the latest revision, formatted in user language. More... | |
prepareUndeleteLink () | |
Prepare undelete link for output in page. More... | |
prepareUserLanguageAttributes () | |
Prepare user language attribute links. More... | |
wrapHTML ( $title, $html) | |
Wrap the body text with language information and identifiable element. More... | |
Additional Inherited Members | |
![]() | |
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 | |
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 QuickTemplate-based skins.
The template data is filled in SkinTemplate::prepareQuickTemplate.
Definition at line 40 of file SkinTemplate.php.
|
protected |
Wrapper for private buildContentNavigationUrlsInternal.
Definition at line 1476 of file SkinTemplate.php.
References wfDeprecated().
|
protected |
Build "Create Account" link data.
string[] | $returnto | query params for the page to return to |
Definition at line 742 of file SkinTemplate.php.
References $title, and getTitle().
Referenced by buildPersonalUrls().
|
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 599 of file SkinTemplate.php.
References $title, ContextSource\getAuthority(), ContextSource\getTitle(), Skin\makeSpecialUrl(), and ContextSource\msg().
Referenced by buildPersonalUrls().
|
finalprotected |
Build data required for "Logout" link.
Definition at line 718 of file SkinTemplate.php.
References $title, and getTitle().
Referenced by buildPersonalUrls().
|
protected |
Build a user page link data.
string | $id | of user page item to be output in HTML attribute (optional) |
Definition at line 772 of file SkinTemplate.php.
|
protected |
Build array of urls for personal toolbar.
bool | $includeNotifications | Since 1.36, notifications are optional |
Definition at line 409 of file SkinTemplate.php.
References $title, $username, buildCreateAccountData(), buildLoginData(), buildLogoutLinkData(), ContextSource\getAuthority(), ContextSource\getRequest(), getReturnToParam(), ContextSource\getTitle(), MediaWiki\Title\Title\isSpecialPage(), Skin\makeSpecialUrl(), Skin\makeSpecialUrlSubpage(), ContextSource\msg(), setupTemplateContext(), and useCombinedLoginLink().
Referenced by getStructuredPersonalTools(), and makePersonalToolsList().
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 tagsReimplemented in SkinMustache.
Definition at line 149 of file SkinTemplate.php.
References Skin\$options, Skin\getOptions(), ContextSource\getOutput(), and prepareQuickTemplate().
Referenced by outputPage().
SkinTemplate::getCategoryLinks | ( | ) |
Extends category links with Skin::getAfterPortlet functionality.
Reimplemented from Skin.
Definition at line 640 of file SkinTemplate.php.
|
protected |
Generate strings used for xml 'id' names.
Hard deprecated since 1.39.
Definition at line 1526 of file SkinTemplate.php.
References getTitle(), and wfDeprecated().
|
protected |
Builds query params for the page to return to, used when building links.
Definition at line 544 of file SkinTemplate.php.
References $title, ContextSource\getAuthority(), ContextSource\getRequest(), ContextSource\getTitle(), wfArrayToCgi(), and wfCgiToArray().
Referenced by buildPersonalUrls().
SkinTemplate::getStructuredPersonalTools | ( | ) |
Get personal tools for the user.
Definition at line 397 of file SkinTemplate.php.
References buildPersonalUrls(), and Skin\getPersonalToolsForMakeListItem().
SkinTemplate::getTemplateData | ( | ) |
@inheritDoc
Reimplemented from Skin.
Reimplemented in SkinMustache, and SkinFallback.
Definition at line 187 of file SkinTemplate.php.
|
finalprotected |
Insert legacy menu items from content navigation into the personal toolbar.
array | $contentNavigation |
Definition at line 1539 of file SkinTemplate.php.
References wfArrayInsertAfter().
SkinTemplate::makePersonalToolsList | ( | $personalTools = null , |
|
$options = [] |
|||
) |
Get the HTML for the personal tools list.
array | null | $personalTools | |
array | $options |
Definition at line 374 of file SkinTemplate.php.
References Skin\$options, buildPersonalUrls(), Skin\getPersonalToolsForMakeListItem(), and Skin\makeListItem().
|
final |
string | $mode | representing the type of button wanted either go , fulltext or image |
array | $attrs | (optional) |
MWException | if bad value of $mode passed in |
Reimplemented from Skin.
Definition at line 1604 of file SkinTemplate.php.
|
static |
string | $mode | representing the type of button wanted either go , fulltext or image |
array | $searchData | Skin data returned by Skin::getTemplateData()['data-search-box'] |
array | $attrs | (optional) |
MWException | if bad value of $mode passed in |
Definition at line 1631 of file SkinTemplate.php.
References wfMessage().
Referenced by Skin\makeSearchButton().
SkinTemplate::makeSearchInput | ( | $attrs = [] | ) |
array | $attrs | (optional) will be passed to tooltipAndAccesskeyAttribs and decorate the resulting input |
Reimplemented from Skin.
Definition at line 1584 of file SkinTemplate.php.
SkinTemplate::outputPage | ( | ) |
Initialize various variables and generate the template @stable to override.
Reimplemented from Skin.
Definition at line 173 of file SkinTemplate.php.
References generateHTML(), Skin\getJsConfigVars(), ContextSource\getOutput(), Skin\initPage(), and Profiler\instance().
|
protected |
initialize various variables and generate the template
Definition at line 197 of file SkinTemplate.php.
References $title, Skin\afterContentHook(), Skin\bottomScripts(), Skin\buildFeedUrls(), Skin\buildNavUrls(), Skin\buildSidebar(), MediaWiki\ResourceLoader\SkinModule\getAvailableLogos(), Skin\getCategories(), Skin\getComponent(), ContextSource\getConfig(), Skin\getFooterIcons(), MWDebug\getHTMLDebugLog(), ContextSource\getLanguage(), Skin\getLanguages(), Skin\getNewtalks(), ContextSource\getOutput(), ContextSource\getRequest(), Skin\getSiteNotice(), ContextSource\getTitle(), ContextSource\getUser(), Skin\logoText(), SpecialPage\newSearchPage(), Skin\prepareSubtitle(), Skin\prepareUndeleteLink(), Skin\prepareUserLanguageAttributes(), Skin\printSource(), setupTemplateForOutput(), wfReportTime(), and Skin\wrapHTML().
Referenced by generateHTML().
|
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 arbitrary order.
SkinTemplate | $skin | |
array | &$content_navigation | representing all menus. |
Definition at line 984 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 74 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 103 of file SkinTemplate.php.
References $title, ContextSource\getRequest(), ContextSource\getTitle(), ContextSource\getUser(), Skin\makeKnownUrlDetails(), Skin\makeUrlDetails(), and wfArrayToCgi().
Referenced by buildPersonalUrls(), SkinMustache\generateHTML(), and setupTemplateForOutput().
|
protected |
Definition at line 81 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 825 of file SkinTemplate.php.
References $title, getContext(), true, and wfMessageFallback().
|
protected |
Returns if a combined login/signup link will be used.
Definition at line 578 of file SkinTemplate.php.
References ContextSource\getConfig().
Referenced by buildPersonalUrls().
SkinTemplate::$loggedin |
Definition at line 52 of file SkinTemplate.php.
string SkinTemplate::$template |
For QuickTemplate, the name of the subclass which will actually fill the template.
Definition at line 45 of file SkinTemplate.php.
Referenced by SkinMustache\generateHTML(), and setupTemplateForOutput().
SkinTemplate::$thispage |
Definition at line 47 of file SkinTemplate.php.
SkinTemplate::$thisquery |
Definition at line 50 of file SkinTemplate.php.
SkinTemplate::$titletxt |
Definition at line 48 of file SkinTemplate.php.
SkinTemplate::$username |
Definition at line 53 of file SkinTemplate.php.
Referenced by buildPersonalUrls().
SkinTemplate::$userpage |
Definition at line 49 of file SkinTemplate.php.
SkinTemplate::$userpageUrlDetails |
Definition at line 54 of file SkinTemplate.php.