Go to the documentation of this file.
40 $html = $this->
get(
'headelement' );
48 'parameters' => [
'id' =>
'siteNotice',
'class' =>
'mw-body-content' ]
55 'id' =>
'firstHeading',
56 'class' =>
'firstHeading',
57 'lang' => $this->
getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode()
60 Html::rawElement(
'div', [
'id' =>
'bodyContent',
'class' =>
'mw-body-content' ],
64 [
'id' =>
'contentSub',
'lang' => $this->
get(
'userlang' ),
'dir' => $this->
get(
'dir' ) ],
65 $this->
get(
'subtitle' )
67 $this->
getIfExists(
'undelete', [
'wrapper' =>
'div', [
'id' =>
'contentSub2' ] ] ) .
68 $this->
getIfExists(
'newtalk', [
'wrapper' =>
'div', [
'class' =>
'usermessage' ] ] ) .
70 $this->
getMsg(
'jumpto' )->escaped() .
74 $this->
getMsg(
'comma-separator' )->escaped() .
79 '<!-- start content -->' .
81 $this->
get(
'bodytext' ) .
84 '<!-- end content -->' .
95 'lang' => $this->
get(
'userlang' ),
96 'dir' => $this->
get(
'dir' )
99 $this->
getBox(
'cactions', $this->
data[
'content_actions'],
'views' ) .
101 Html::rawElement(
'div', [
'class' =>
'portlet',
'id' =>
'p-logo',
'role' =>
'banner' ],
104 'href' => $this->
data[
'nav_urls'][
'mainpage'][
'href'],
105 'class' =>
'mw-wiki-logo',
112 $html .=
'<!-- end of the left (by default at least) column -->';
133 $sidebar = $this->
data[
'sidebar'];
136 if ( !isset( $sidebar[
'SEARCH'] ) ) {
137 $sidebar[
'SEARCH'] =
true;
139 if ( !isset( $sidebar[
'TOOLBOX'] ) ) {
140 $sidebar[
'TOOLBOX'] =
true;
142 if ( !isset( $sidebar[
'LANGUAGES'] ) ) {
143 $sidebar[
'LANGUAGES'] =
true;
146 foreach ( $sidebar
as $boxName => $content ) {
147 if ( $content ===
false ) {
152 $boxName = (
string)$boxName;
154 if ( $boxName ==
'SEARCH' ) {
156 } elseif ( $boxName ==
'TOOLBOX' ) {
158 } elseif ( $boxName ==
'LANGUAGES' ) {
165 [
'extra-classes' =>
'generated-sidebar' ]
181 if ( $this->config->get(
'UseTwoButtonsSearchForm' ) ) {
184 [
'id' =>
'mw-searchButton',
'class' =>
'searchButton' ]
188 Html::rawElement(
'a', [
'href' => $this->
get(
'searchaction' ),
'rel' =>
'search' ],
189 $this->
getMsg(
'powersearch-legend' )->escaped()
193 $searchInputId =
'searchInput';
195 'action' => $this->
get(
'wgScript' ),
200 $this->
makeSearchButton(
'go', [
'id' =>
'searchGoButton',
'class' =>
'searchButton' ] ) .
204 $html .= $this->
getBox(
'search', $searchForm,
null, [
205 'search-input-id' => $searchInputId,
207 'body-id' =>
'searchBody'
224 'MonoBookTemplateToolboxEnd' => [ &
$skin ],
225 'SkinTemplateToolboxEnd' => [ &
$skin,
true ]
241 if ( $this->
data[
'language_urls'] !==
false ) {
242 $html .= $this->
getBox(
'lang', $this->
data[
'language_urls'],
'otherlanguages' );
258 protected function getBox(
$name, $contents, $msg =
null, $setOptions = [] ) {
260 'class' =>
'portlet',
261 'body-class' =>
'pBody',
264 foreach ( $setOptions
as $key =>
$value ) {
269 if (
$name ==
'personal' ) {
273 if ( array_key_exists(
'uls', $contents ) ) {
274 $prependiture .= $this->
makeListItem(
'uls', $contents[
'uls'] );
275 unset( $contents[
'uls'] );
277 if ( !$this->
getSkin()->getUser()->isLoggedIn() &&
282 [
'id' =>
'pt-anonuserpage' ],
283 $this->
getMsg(
'notloggedin' )->escaped()
286 $options[
'list-prepend'] = $prependiture;
306 'role' =>
'navigation',
307 'search-input-id' =>
'searchInput',
309 'id' =>
'p-' .
$name,
310 'class' =>
'mw-portlet',
311 'extra-classes' =>
'',
313 'body-class' =>
'mw-portlet-body',
314 'body-extra-classes' =>
'',
316 'text-wrapper' => [
'tag' =>
'span' ],
323 foreach ( $setOptions
as $key =>
$value ) {
328 if ( $msg ===
null ) {
331 } elseif ( is_array( $msg ) ) {
332 $msgString = array_shift( $msg );
338 $msgObj = $this->
getMsg( $msg, $msgParams );
339 if ( $msgObj->exists() ) {
340 $msgString = $msgObj->parse();
342 $msgString = htmlspecialchars( $msg );
345 $labelId = Sanitizer::escapeIdForAttribute(
"p-$name-label" );
347 if ( is_array( $content ) ) {
349 [
'lang' => $this->
get(
'userlang' ),
'dir' => $this->
get(
'dir' ) ]
351 $contentText .=
$options[
'list-prepend'];
352 foreach ( $content
as $key => $item ) {
353 if ( is_array(
$options[
'text-wrapper'] ) ) {
357 [
'text-wrapper' =>
$options[
'text-wrapper'] ]
367 if ( is_array(
$options[
'hooks'] ) ) {
368 foreach (
$options[
'hooks']
as $hook => $hookOptions ) {
375 $contentText = $content;
382 'id' => Sanitizer::escapeIdForAttribute(
$options[
'id'] ),
385 if (
$options[
'role'] !==
'search' ) {
386 $divOptions[
'aria-labelledby'] = $labelId;
390 'lang' => $this->
get(
'userlang' ),
391 'dir' => $this->
get(
'dir' )
393 if (
$options[
'role'] ==
'search' ) {
400 if ( is_string(
$options[
'body-id'] ) ) {
401 $bodyDivOptions[
'id'] =
$options[
'body-id'];
427 if ( !is_array( $class ) ) {
430 if ( !is_array( $extraClasses ) ) {
431 $extraClasses = [ $extraClasses ];
434 return array_merge( $class, $extraClasses );
450 $hookContents = ob_get_contents();
452 if ( !trim( $hookContents ) ) {
456 return $hookContents;
473 foreach ( $setOptions
as $key =>
$value ) {
479 if ( (
$options[
'loose'] && $this->
data[$object] !=
'' ) ||
481 if (
$options[
'wrapper'] ==
'none' ) {
482 $html .= $this->
get( $object );
487 $this->
get( $object )
508 'role' =>
'contentinfo',
509 'lang' => $this->
get(
'userlang' ),
510 'dir' => $this->
get(
'dir' )
513 foreach ( $validFooterIcons
as $blockName => $footerIcons ) {
515 'id' => Sanitizer::escapeIdForAttribute(
"f-{$blockName}ico" ),
516 'class' =>
'footer-icons'
518 foreach ( $footerIcons
as $icon ) {
523 if (
count( $validFooterLinks ) > 0 ) {
525 foreach ( $validFooterLinks
as $aLink ) {
528 [
'id' => Sanitizer::escapeIdForAttribute( $aLink ) ],
getPersonalTools()
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.
getFooterLinks( $option=null)
Returns an array of footerlinks trimmed down to only those footer links that are valid.
mergeClasses( $class, $extraClasses)
Helper function for getPortlet.
makeSearchButton( $mode, $attrs=[])
execute()
Template filter callback for MonoBook skin.
getBox( $name, $contents, $msg=null, $setOptions=[])
Generate a sidebar box using getPortlet(); prefill some common stuff.
getClear()
Get a div with the core visualClear class, for clearing floats.
getToolboxBox()
Generate the toolbox, complete with all three old hooks.
Allows to change the fields on the form that will be generated $name
getPortlet( $name, $content, $msg=null, $setOptions=[])
Generates a block of navigation links with a header.
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
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.
static closeElement( $element)
Returns "</$element>".
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
getAfterPortlet( $name)
Allows extensions to hook into known portlets and add stuff to them.
makeListItem( $key, $item, $options=[])
Generates a list item for a navigation, portlet, portal, sidebar...
getSimpleFooter()
Renderer for getFooterIcons and getFooterLinks as a generic footer block.
getIndicators()
Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed i...
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
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
getMsg( $name)
Get a Message object with its context set.
makeSearchInput( $attrs=[])
getLanguageBox()
Generate the languages box.
getSearchBox()
Generate the search, using config options for buttons (?)
static titleAttrib( $name, $options=null, array $msgParams=[])
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
getRenderedSidebar()
Generate the full sidebar.
getToolbox()
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.
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 & $options
getIfExists( $object, $setOptions=[])
Simple wrapper for random if-statement-wrapped $this->data things.
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
getTrail()
Get the basic end-page trail including bottomscripts, reporttime, and debug stuff.
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
deprecatedHookHack( $hook, $hookOptions=[])
Wrapper to catch output of old hooks expecting to write directly to page We no longer do things that ...
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
getFooterIcons( $option=null)
Returns an array of footer icons filtered down by options relevant to how the skin wishes to display ...
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...
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