Go to the documentation of this file.
20 $html = $this->
get(
'headelement' );
27 $this->
getLogo(
'p-logo-text',
'text' ) .
38 Html::rawElement(
'div', [
'id' =>
'mw-content-block',
'class' =>
'ts-inner' ],
40 $this->
getLogo(
'p-logo',
'image' ) .
47 $this->pileOfTools[
'general'],
58 Html::rawElement(
'div', [
'id' =>
'content',
'class' =>
'mw-body',
'role' =>
'main' ],
64 'id' =>
'firstHeading',
65 'class' =>
'firstHeading',
66 'lang' => $this->
get(
'pageLanguage' )
73 $this->pileOfTools[
'namespaces'],
78 $this->pileOfTools[
'page-primary'],
83 Html::rawElement(
'div', [
'class' =>
'mw-body-content',
'id' =>
'bodyContent' ],
85 $this->
get(
'bodytext' ) .
106 $html .= $this->
get(
'bottomscripts' );
107 $html .= $this->
get(
'reporttime' );
138 if ( $msg ===
null ) {
140 } elseif ( is_array( $msg ) ) {
141 $msgString = array_shift( $msg );
146 if ( $msgObj->exists() ) {
147 if ( isset( $msgParams ) && !empty( $msgParams ) ) {
148 $msgString = $this->
getMsg( $msg, $msgParams )->parse();
150 $msgString = $msgObj->parse();
153 $msgString = htmlspecialchars( $msg );
158 if (
$name ==
'tb' ) {
159 if ( isset( $boxes[
'TOOLBOX'] ) ) {
166 $hookContents = ob_get_contents();
168 if ( !trim( $hookContents ) ) {
175 $labelId = Sanitizer::escapeId(
"p-$name-label" );
177 if ( is_array( $content ) ) {
179 if ( $content !== [] ) {
180 foreach ( $content
as $key => $item ) {
184 [
'text-wrapper' => [
'tag' =>
'span' ] ]
189 $contentText .= $hookContents;
192 $contentText = $content;
196 'role' =>
'navigation',
197 'class' => [
'mw-portlet',
'emptyPortlet' => !$content ],
198 'id' => Sanitizer::escapeId(
'p-' .
$name ),
200 'aria-labelledby' => $labelId
204 'lang' => $this->
get(
'userlang' ),
205 'dir' => $this->
get(
'dir' )
232 [
'id' => Sanitizer::escapeId( $id ),
'class' =>
'sidebar-chunk' ],
253 protected function getLogo( $id =
'p-logo', $part =
'both' ) {
255 $language = $this->
getSkin()->getLanguage();
260 'id' => Sanitizer::escapeId( $id ),
261 'class' =>
'mw-portlet',
265 if ( $part !==
'image' ) {
267 if ( $language->hasVariants() ) {
268 $siteTitle = $language->convert( $this->
getMsg(
'timeless-sitetitle' )->
text() );
270 $siteTitle = $this->
getMsg(
'timeless-sitetitle' )->text();
273 if ( mb_strlen( $siteTitle ) > 13 ) {
274 $titleClass =
'long';
278 'class' => [
'mw-wiki-title', $titleClass ],
279 'href' => $this->
data[
'nav_urls'][
'mainpage'][
'href']
284 if ( $part !==
'text' ) {
287 'class' =>
'mw-wiki-logo',
288 'href' => $this->
data[
'nav_urls'][
'mainpage'][
'href']
310 [
'lang' => $this->
get(
'userlang' ),
'dir' => $this->
get(
'dir' ) ],
318 'id' =>
'searchInput',
319 'placeholder' => $this->
getMsg(
'timeless-search-placeholder' )->
text(),
325 [
'id' =>
'mw-searchButton',
'class' =>
'searchButton mw-fallbackSearchButton' ]
329 [
'id' =>
'searchButton',
'class' =>
'searchButton' ]
349 $sidebar[
'SEARCH'] =
false;
351 $sidebar[
'TOOLBOX'] =
false;
353 $sidebar[
'LANGUAGES'] =
false;
355 foreach ( $sidebar
as $name => $content ) {
356 if ( $content ===
false ) {
408 $this->pileOfTools[
'page-secondary'],
409 'timeless-pageactions'
413 $this->pileOfTools[
'user'],
414 'timeless-userpagetools'
418 $this->pileOfTools[
'page-tertiary'],
422 return $this->
getSidebarChunk(
'page-tools',
'timeless-pageactions', $pageTools );
439 if ( isset( $personalTools[
'notifications-alert'] ) ) {
440 $extraTools[
'notifications-alert'] = $personalTools[
'notifications-alert'];
441 unset( $personalTools[
'notifications-alert'] );
443 if ( isset( $personalTools[
'notifications-notice'] ) ) {
444 $extraTools[
'notifications-notice'] = $personalTools[
'notifications-notice'];
445 unset( $personalTools[
'notifications-notice'] );
447 $class = empty( $extraTools ) ?
'' :
'extension-icons';
450 if ( isset( $personalTools[
'userpage'] ) ) {
451 $personalTools[
'userpage'][
'links'][0][
'text'] = $this->
getMsg(
'timeless-userpage' )->text();
453 if ( isset( $personalTools[
'mytalk'] ) ) {
454 $personalTools[
'mytalk'][
'links'][0][
'text'] = $this->
getMsg(
'timeless-talkpage' )->text();
458 if (
$user->isLoggedIn() ) {
459 $userName =
$user->getName();
461 $fit = empty( $extraTools ) ? 13 : 9;
462 if ( mb_strlen( $userName ) < $fit ) {
463 $dropdownHeader = $userName;
465 $dropdownHeader =
wfMessage(
'timeless-loggedin' )->text();
467 $headerMsg = [
'timeless-loggedinas',
$user->getName() ];
469 $dropdownHeader =
wfMessage(
'timeless-anonymous' )->text();
470 $headerMsg =
'timeless-notloggedin';
479 Html::rawElement(
'div', [
'id' =>
'personal-inner',
'class' =>
'dropdown' ],
480 $this->
getPortlet(
'personal', $personalTools, $headerMsg )
485 if ( !empty( $extraTools ) ) {
487 foreach ( $extraTools
as $key => $item ) {
493 [
'id' =>
'personal-extra',
'class' =>
'p-body' ],
514 if ( $this->
data[
'sitenotice'] ) {
517 if ( $this->
data[
'newtalk'] ) {
533 if ( $this->
data[
'subtitle'] ) {
534 $html .= $this->
get(
'subtitle' );
536 if ( $this->
data[
'undelete'] ) {
537 $html .= $this->
get(
'undelete' );
553 if ( $this->
data[
'catlinks'] || $this->
data[
'dataAfterContent'] ) {
555 if ( $this->
data[
'catlinks'] ) {
556 $html .= $this->
get(
'catlinks' );
558 if ( $this->
data[
'dataAfterContent'] ) {
559 $html .= $this->
get(
'dataAfterContent' );
578 $namespace =
$title->getNamespace();
580 $sortedPileOfTools = [
582 'page-primary' => [],
583 'page-secondary' => [],
585 'page-tertiary' => [],
590 $pileOfEditTools = [];
591 foreach ( $this->
data[
'content_navigation']
as $navKey => $navBlock ) {
593 if ( $navKey ==
'namespaces' ) {
594 if ( $namespace < 0 ) {
596 $sortedPileOfTools[
'page-tertiary'] = $navBlock;
598 $sortedPileOfTools[
'namespaces'] = $navBlock;
601 $pileOfEditTools = array_merge( $pileOfEditTools, $navBlock );
607 if ( $namespace >= 0 ) {
609 'text' => $this->
getMsg(
'timeless-pagelog' )->text(),
615 'text' => $this->
getMsg(
'timeless-more' )->text(),
617 'class' =>
'dropdown-toggle'
621 if ( $this->
data[
'language_urls'] !==
false ) {
623 'text' => $this->
getMsg(
'timeless-languages' )->escaped(),
624 'id' =>
'ca-languages',
625 'class' =>
'dropdown-toggle'
631 foreach ( $pileOfEditTools
as $navKey => $navBlock ) {
634 if ( in_array( $navKey, [
638 $currentSet =
'namespaces';
639 } elseif ( in_array( $navKey, [
646 $currentSet =
'page-primary';
647 } elseif ( in_array( $navKey, [
654 $currentSet =
'page-secondary';
657 $currentSet =
'page-primary';
659 $sortedPileOfTools[$currentSet][$navKey] = $navBlock;
664 if ( in_array( $navKey, [
669 $currentSet =
'page-primary';
670 } elseif ( in_array( $navKey, [
675 $currentSet =
'user';
676 } elseif ( in_array( $navKey, [
681 'recentchangeslinked',
684 $currentSet =
'page-tertiary';
686 $currentSet =
'general';
688 $sortedPileOfTools[$currentSet][$navKey] = $navBlock;
691 return $sortedPileOfTools;
712 if ( in_array(
$skin->getRequest()->getVal(
'action' ), [
'submit',
'edit' ] ) ) {
715 $allCats2 =
$skin->getOutput()->getCategories();
716 foreach ( $allCats2
as $displayName ) {
718 $allCats[] = $catTitle->getDBkey();
722 $allCats = array_keys(
$title->getParentCategories() );
725 foreach ( $allCats
as $i => $catName ) {
726 $allCats[$i] = substr( $catName, $len );
729 if ( $allCats !== [] ) {
732 [
'page',
'page_props' ],
733 [
'page_id',
'page_title' ],
735 'page_title' => $allCats,
737 'pp_propname' =>
'hiddencat'
741 [
'page_props' => [
'JOIN',
'pp_page = page_id' ] ]
744 foreach (
$res as $row ) {
745 $hiddenCats[] = $row->page_title;
747 $normalCats = array_diff( $allCats, $hiddenCats );
749 $normalCount =
count( $normalCats );
750 $hiddenCount =
count( $hiddenCats );
751 $count = $normalCount;
756 $skin->getUser()->getBoolOption(
'showhiddencats' ) ||
759 $count += $hiddenCount;
767 if ( $normalCount ) {
768 $catHeader =
'categories';
770 $catHeader =
'hidden-categories';
773 if ( $normalCount ) {
774 $catList .= $this->
getCatList( $normalCats,
'catlist-normal',
'categories' );
776 if ( $hiddenCount ) {
780 [
'hidden-categories', $hiddenCount ]
806 foreach ( $list
as $category ) {
811 $categories[ htmlspecialchars( $category ) ] = [
'links' => [ 0 => [
812 'href' =>
$title->getLinkURL(),
813 'text' =>
$title->getText()
830 if ( isset( $this->
data[
'variant_urls'] ) && $this->
data[
'variant_urls'] !==
false ) {
831 $variants = $this->
getPortlet(
'variants', $this->
data[
'variant_urls'],
true );
835 if ( $this->
data[
'language_urls'] !==
false ) {
838 'timeless-languages',
842 $this->
data[
'language_urls'] ?: [],
getPersonalTools()
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.
getSidebarChunk( $id, $headerMessage, $content)
Sidebar chunk containing one or more portlets.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping $template
static getDebugHTML(IContextSource $context)
Returns the HTML to add to the page for the toolbar.
getPortlet( $name, $content, $msg=null)
Generates a block of navigation links with a header.
makeSearchButton( $mode, $attrs=[])
getClear()
Get a div with the core visualClear class, for clearing floats.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Allows to change the fields on the form that will be generated $name
getContentSub()
Links and information that may appear below the firstHeading.
getPageToolSidebar()
Page tools in sidebar.
getSkin()
Get the Skin object related to this object.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[], $options=null)
Returns the attributes for the tooltip and access key.
getSearch()
The search box at the top.
static closeElement( $element)
Returns "</$element>".
BaseTemplate class for the Timeless skin.
getCatList( $list, $id, $message)
List of categories.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
namespace and then decline to actually register it file or subcat img or subcat $title
getAfterPortlet( $name)
Allows extensions to hook into known portlets and add stuff to them.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
makeListItem( $key, $item, $options=[])
Generates a list item for a navigation, portlet, portal, sidebar...
getIndicators()
Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed i...
when a variable name is used in a it is silently declared as a new masking the global
getHeaderHack()
The colour bars Split this out so we don't have to look at it/can easily kill it later.
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
getFooter( $iconStyle='icononly', $linkStyle='flat')
Renderer for getFooterIcons and getFooterLinks.
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
getMsg( $name)
Get a Message object with its context set.
getSiteNotices()
Notices that may appear above the firstHeading.
makeSearchInput( $attrs=[])
getLogo( $id='p-logo', $part='both')
The logo and (optionally) site title.
static titleAttrib( $name, $options=null, array $msgParams=[])
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
getMainNavigation()
Left sidebar navigation, usually.
getToolbox()
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned $skin
getInterlanguageLinks()
Interlanguage links block, also with variants.
getPageTools()
Generate pile of all the tools.
getAfterContent()
The data after content, catlinks, and potential other stuff that may appear within the content block ...
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
New base template for a skin's template extended from QuickTemplate this class features helper method...
getUserLinks()
Personal/user links portlet for header.
execute()
Outputs the entire contents of the page.
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of data
the array() calling protocol came about after MediaWiki 1.4rc1.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
getCategories()
Categories for the sidebar.