MediaWiki  1.33.0
TimelessTemplate.php
Go to the documentation of this file.
1 <?php
8 
10  protected $pileOfTools;
11 
15  public function execute() {
16  $this->pileOfTools = $this->getPageTools();
17  $userLinks = $this->getUserLinks();
18 
19  // Open html, body elements, etc
20  $html = $this->get( 'headelement' );
21 
22  $html .= Html::openElement( 'div', [ 'id' => 'mw-wrapper', 'class' => $userLinks['class'] ] );
23 
24  $html .= Html::rawElement( 'div', [ 'id' => 'mw-header-container', 'class' => 'ts-container' ],
25  Html::rawElement( 'div', [ 'id' => 'mw-header', 'class' => 'ts-inner' ],
26  $userLinks['html'] .
27  $this->getLogo( 'p-logo-text', 'text' ) .
28  $this->getSearch()
29  ) .
30  $this->getClear()
31  );
32  $html .= $this->getHeaderHack();
33 
34  // For mobile
35  $html .= Html::element( 'div', [ 'id' => 'menus-cover' ] );
36 
37  $html .= Html::rawElement( 'div', [ 'id' => 'mw-content-container', 'class' => 'ts-container' ],
38  Html::rawElement( 'div', [ 'id' => 'mw-content-block', 'class' => 'ts-inner' ],
39  Html::rawElement( 'div', [ 'id' => 'mw-content-wrapper' ],
40  Html::rawElement( 'div', [ 'id' => 'mw-content' ],
41  Html::rawElement( 'div', [ 'id' => 'content', 'class' => 'mw-body', 'role' => 'main' ],
42  $this->getSiteNotices() .
43  $this->getIndicators() .
44  Html::rawElement(
45  'h1',
46  [
47  'id' => 'firstHeading',
48  'class' => 'firstHeading',
49  'lang' => $this->get( 'pageLanguage' )
50  ],
51  $this->get( 'title' )
52  ) .
53  Html::rawElement( 'div', [ 'id' => 'siteSub' ], $this->getMsg( 'tagline' )->parse() ) .
54  Html::rawElement( 'div', [ 'id' => 'mw-page-header-links' ],
55  $this->getPortlet(
56  'namespaces',
57  $this->pileOfTools['namespaces'],
58  'timeless-namespaces'
59  ) .
60  $this->getPortlet(
61  'more',
62  $this->pileOfTools['more'],
63  'timeless-more'
64  ) .
65  $this->getPortlet(
66  'views',
67  $this->pileOfTools['page-primary'],
68  'timeless-pagetools'
69  )
70  ) .
71  $this->getClear() .
72  Html::rawElement( 'div', [ 'class' => 'mw-body-content', 'id' => 'bodyContent' ],
73  $this->getContentSub() .
74  $this->get( 'bodytext' ) .
75  $this->getClear()
76  )
77  )
78  ) .
79  $this->getAfterContent()
80  ) .
81  Html::rawElement( 'div', [ 'id' => 'mw-site-navigation' ],
82  $this->getLogo( 'p-logo', 'image' ) .
83  $this->getMainNavigation() .
84  $this->getSidebarChunk(
85  'site-tools',
86  'timeless-sitetools',
87  $this->getPortlet(
88  'tb',
89  $this->pileOfTools['general'],
90  'timeless-sitetools'
91  )
92  )
93  ) .
94  Html::rawElement( 'div', [ 'id' => 'mw-related-navigation' ],
95  $this->getPageToolSidebar() .
96  $this->getInterlanguageLinks() .
97  $this->getCategories()
98  ) .
99  $this->getClear()
100  )
101  );
102 
103  $html .= Html::rawElement( 'div', [ 'id' => 'mw-footer-container', 'class' => 'ts-container' ],
104  Html::rawElement( 'div', [ 'id' => 'mw-footer', 'class' => 'ts-inner' ],
105  $this->getFooter()
106  )
107  );
108 
109  $html .= Html::closeElement( 'div' );
110 
111  // BaseTemplate::printTrail() stuff (has no get version)
112  // Required for RL to run
113  $html .= MWDebug::getDebugHTML( $this->getSkin()->getContext() );
114  $html .= $this->get( 'bottomscripts' );
115  $html .= $this->get( 'reporttime' );
116 
117  $html .= Html::closeElement( 'body' );
118  $html .= Html::closeElement( 'html' );
119 
120  // The unholy echo
121  echo $html;
122  }
123 
145  protected function getPortlet( $name, $content, $msg = null ) {
146  if ( $msg === null ) {
147  $msg = $name;
148  } elseif ( is_array( $msg ) ) {
149  $msgString = array_shift( $msg );
150  $msgParams = $msg;
151  $msg = $msgString;
152  }
153  $msgObj = $this->getMsg( $msg );
154  if ( $msgObj->exists() ) {
155  if ( isset( $msgParams ) && !empty( $msgParams ) ) {
156  $msgObj->params( $msgParams );
157  }
158  $msgString = $msgObj->parse();
159  } else {
160  $msgString = htmlspecialchars( $msg );
161  }
162 
163  // HACK: Compatibility with extensions still using SkinTemplateToolboxEnd
164  $hookContents = '';
165  if ( $name == 'tb' ) {
166  if ( isset( $boxes['TOOLBOX'] ) ) {
167  ob_start();
168  // We pass an extra 'true' at the end so extensions using BaseTemplateToolbox
169  // can abort and avoid outputting double toolbox links
170  // Avoid PHP 7.1 warning from passing $this by reference
171  $template = $this;
172  Hooks::run( 'SkinTemplateToolboxEnd', [ &$template, true ] );
173  $hookContents = ob_get_contents();
174  ob_end_clean();
175  if ( !trim( $hookContents ) ) {
176  $hookContents = '';
177  }
178  }
179  }
180  // END hack
181 
182  $labelId = Sanitizer::escapeId( "p-$name-label" );
183 
184  if ( is_array( $content ) ) {
185  $contentText = Html::openElement( 'ul' );
186  if ( $content !== [] ) {
187  foreach ( $content as $key => $item ) {
188  $contentText .= $this->makeListItem(
189  $key,
190  $item,
191  [ 'text-wrapper' => [ 'tag' => 'span' ] ]
192  );
193  }
194  }
195  // Add in SkinTemplateToolboxEnd, if any
196  $contentText .= $hookContents;
197  $contentText .= Html::closeElement( 'ul' );
198  } else {
199  $contentText = $content;
200  }
201 
202  $html = Html::rawElement( 'div', [
203  'role' => 'navigation',
204  'class' => [ 'mw-portlet', 'emptyPortlet' => !$content ],
205  'id' => Sanitizer::escapeId( 'p-' . $name ),
206  'title' => Linker::titleAttrib( 'p-' . $name ),
207  'aria-labelledby' => $labelId
208  ],
209  Html::rawElement( 'h3', [
210  'id' => $labelId,
211  'lang' => $this->get( 'userlang' ),
212  'dir' => $this->get( 'dir' )
213  ],
214  $msgString
215  ) .
216  Html::rawElement( 'div', [ 'class' => 'mw-portlet-body' ],
217  $contentText .
218  $this->getAfterPortlet( $name )
219  )
220  );
221 
222  return $html;
223  }
224 
234  protected function getSidebarChunk( $id, $headerMessage, $content ) {
235  $html = '';
236 
237  $html .= Html::rawElement(
238  'div',
239  [ 'id' => Sanitizer::escapeId( $id ), 'class' => 'sidebar-chunk' ],
240  Html::rawElement( 'h2', [],
241  Html::element( 'span', [],
242  $this->getMsg( $headerMessage )->text()
243  ) .
244  Html::element( 'div', [ 'class' => 'pokey' ] )
245  ) .
246  Html::rawElement( 'div', [ 'class' => 'sidebar-inner' ], $content )
247  );
248 
249  return $html;
250  }
251 
260  protected function getLogo( $id = 'p-logo', $part = 'both' ) {
261  $html = '';
262  $language = $this->getSkin()->getLanguage();
263 
264  $html .= Html::openElement(
265  'div',
266  [
267  'id' => Sanitizer::escapeId( $id ),
268  'class' => 'mw-portlet',
269  'role' => 'banner'
270  ]
271  );
272  if ( $part !== 'image' ) {
273  $titleClass = '';
274  if ( $language->hasVariants() ) {
275  $siteTitle = $language->convert( $this->getMsg( 'timeless-sitetitle' )->escaped() );
276  } else {
277  $siteTitle = $this->getMsg( 'timeless-sitetitle' )->escaped();
278  }
279  // width is 11em; 13 characters will probably fit?
280  if ( mb_strlen( $siteTitle ) > 13 ) {
281  $titleClass = 'long';
282  }
283  $html .= Html::rawElement( 'a', [
284  'id' => 'p-banner',
285  'class' => [ 'mw-wiki-title', $titleClass ],
286  'href' => $this->data['nav_urls']['mainpage']['href']
287  ],
288  $siteTitle
289  );
290  }
291  if ( $part !== 'text' ) {
292  $html .= Html::element( 'a', array_merge(
293  [
294  'class' => 'mw-wiki-logo',
295  'href' => $this->data['nav_urls']['mainpage']['href']
296  ],
298  ) );
299  }
300  $html .= Html::closeElement( 'div' );
301 
302  return $html;
303  }
304 
310  protected function getSearch() {
311  $html = '';
312 
313  $html .= Html::openElement( 'div', [ 'class' => 'mw-portlet', 'id' => 'p-search' ] );
314 
315  $html .= Html::rawElement(
316  'h3',
317  [ 'lang' => $this->get( 'userlang' ), 'dir' => $this->get( 'dir' ) ],
318  Html::rawElement( 'label', [ 'for' => 'searchInput' ], $this->getMsg( 'search' )->escaped() )
319  );
320 
321  $html .= Html::rawElement( 'form', [ 'action' => $this->get( 'wgScript' ), 'id' => 'searchform' ],
322  Html::rawElement( 'div', [ 'id' => 'simpleSearch' ],
323  Html::rawElement( 'div', [ 'id' => 'searchInput-container' ],
324  $this->makeSearchInput( [
325  'id' => 'searchInput'
326  ] )
327  ) .
328  Html::hidden( 'title', $this->get( 'searchtitle' ) ) .
329  $this->makeSearchButton(
330  'fulltext',
331  [ 'id' => 'mw-searchButton', 'class' => 'searchButton mw-fallbackSearchButton' ]
332  ) .
333  $this->makeSearchButton(
334  'go',
335  [ 'id' => 'searchButton', 'class' => 'searchButton' ]
336  )
337  )
338  );
339 
340  $html .= Html::closeElement( 'div' );
341 
342  return $html;
343  }
344 
350  protected function getMainNavigation() {
351  $sidebar = $this->getSidebar();
352  $html = '';
353 
354  // Already hardcoded into header
355  $sidebar['SEARCH'] = false;
356  // Parsed as part of pageTools
357  $sidebar['TOOLBOX'] = false;
358  // Forcibly removed to separate chunk
359  $sidebar['LANGUAGES'] = false;
360 
361  foreach ( $sidebar as $name => $content ) {
362  if ( $content === false ) {
363  continue;
364  }
365  // Numeric strings gets an integer when set as key, cast back - T73639
366  $name = (string)$name;
367  $html .= $this->getPortlet( $name, $content['content'] );
368  }
369 
370  $html = $this->getSidebarChunk( 'site-navigation', 'navigation', $html );
371 
372  return $html;
373  }
374 
381  protected function getHeaderHack() {
382  $html = '';
383 
384  // These are almost exactly the same and this is stupid.
385  $html .= Html::rawElement( 'div', [ 'id' => 'mw-header-hack', 'class' => 'color-bar' ],
386  Html::rawElement( 'div', [ 'class' => 'color-middle-container' ],
387  Html::element( 'div', [ 'class' => 'color-middle' ] )
388  ) .
389  Html::element( 'div', [ 'class' => 'color-left' ] ) .
390  Html::element( 'div', [ 'class' => 'color-right' ] )
391  );
392  $html .= Html::rawElement( 'div', [ 'id' => 'mw-header-nav-hack' ],
393  Html::rawElement( 'div', [ 'class' => 'color-bar' ],
394  Html::rawElement( 'div', [ 'class' => 'color-middle-container' ],
395  Html::element( 'div', [ 'class' => 'color-middle' ] )
396  ) .
397  Html::element( 'div', [ 'class' => 'color-left' ] ) .
398  Html::element( 'div', [ 'class' => 'color-right' ] )
399  )
400  );
401 
402  return $html;
403  }
404 
410  protected function getPageToolSidebar() {
411  $pageTools = '';
412  $pageTools .= $this->getPortlet(
413  'cactions',
414  $this->pileOfTools['page-secondary'],
415  'timeless-pageactions'
416  );
417  $pageTools .= $this->getPortlet(
418  'userpagetools',
419  $this->pileOfTools['user'],
420  'timeless-userpagetools'
421  );
422  $pageTools .= $this->getPortlet(
423  'pagemisc',
424  $this->pileOfTools['page-tertiary'],
425  'timeless-pagemisc'
426  );
427 
428  return $this->getSidebarChunk( 'page-tools', 'timeless-pageactions', $pageTools );
429  }
430 
437  protected function getUserLinks() {
438  $user = $this->getSkin()->getUser();
439  $personalTools = $this->getPersonalTools();
440 
441  $html = '';
442  $extraTools = [];
443 
444  // Remove Echo badges
445  if ( isset( $personalTools['notifications-alert'] ) ) {
446  $extraTools['notifications-alert'] = $personalTools['notifications-alert'];
447  unset( $personalTools['notifications-alert'] );
448  }
449  if ( isset( $personalTools['notifications-notice'] ) ) {
450  $extraTools['notifications-notice'] = $personalTools['notifications-notice'];
451  unset( $personalTools['notifications-notice'] );
452  }
453  $class = empty( $extraTools ) ? '' : 'extension-icons';
454 
455  // Re-label some messages
456  if ( isset( $personalTools['userpage'] ) ) {
457  $personalTools['userpage']['links'][0]['text'] = $this->getMsg( 'timeless-userpage' )->text();
458  }
459  if ( isset( $personalTools['mytalk'] ) ) {
460  $personalTools['mytalk']['links'][0]['text'] = $this->getMsg( 'timeless-talkpage' )->text();
461  }
462 
463  // Labels
464  if ( $user->isLoggedIn() ) {
465  $userName = $user->getName();
466  // Make sure it fits first (numbers slightly made up, may need adjusting)
467  $fit = empty( $extraTools ) ? 13 : 9;
468  if ( mb_strlen( $userName ) < $fit ) {
469  $dropdownHeader = $userName;
470  } else {
471  $dropdownHeader = $this->getMsg( 'timeless-loggedin' )->text();
472  }
473  $headerMsg = [ 'timeless-loggedinas', $user->getName() ];
474  } else {
475  $dropdownHeader = $this->getMsg( 'timeless-anonymous' )->text();
476  $headerMsg = 'timeless-notloggedin';
477  }
478  $html .= Html::openElement( 'div', [ 'id' => 'user-tools' ] );
479 
480  $html .= Html::rawElement( 'div', [ 'id' => 'personal' ],
481  Html::rawElement( 'h2', [],
482  Html::element( 'span', [], $dropdownHeader ) .
483  Html::element( 'div', [ 'class' => 'pokey' ] )
484  ) .
485  Html::rawElement( 'div', [ 'id' => 'personal-inner', 'class' => 'dropdown' ],
486  $this->getPortlet( 'personal', $personalTools, $headerMsg )
487  )
488  );
489 
490  // Extra icon stuff (echo etc)
491  if ( !empty( $extraTools ) ) {
492  $iconList = '';
493  foreach ( $extraTools as $key => $item ) {
494  $iconList .= $this->makeListItem( $key, $item );
495  }
496 
497  $html .= Html::rawElement(
498  'div',
499  [ 'id' => 'personal-extra', 'class' => 'p-body' ],
500  Html::rawElement( 'ul', [], $iconList )
501  );
502  }
503 
504  $html .= Html::closeElement( 'div' );
505 
506  return [
507  'html' => $html,
508  'class' => $class
509  ];
510  }
511 
517  protected function getSiteNotices() {
518  $html = '';
519 
520  if ( $this->data['sitenotice'] ) {
521  $html .= Html::rawElement( 'div', [ 'id' => 'siteNotice' ], $this->get( 'sitenotice' ) );
522  }
523  if ( $this->data['newtalk'] ) {
524  $html .= Html::rawElement( 'div', [ 'class' => 'usermessage' ], $this->get( 'newtalk' ) );
525  }
526 
527  return $html;
528  }
529 
535  protected function getContentSub() {
536  $html = '';
537 
538  $html .= Html::openElement( 'div', [ 'id' => 'contentSub' ] );
539  if ( $this->data['subtitle'] ) {
540  $html .= $this->get( 'subtitle' );
541  }
542  if ( $this->data['undelete'] ) {
543  $html .= $this->get( 'undelete' );
544  }
545  $html .= Html::closeElement( 'div' );
546 
547  return $html;
548  }
549 
556  protected function getAfterContent() {
557  $html = '';
558 
559  if ( $this->data['catlinks'] || $this->data['dataAfterContent'] ) {
560  $html .= Html::openElement( 'div', [ 'id' => 'content-bottom-stuff' ] );
561  if ( $this->data['catlinks'] ) {
562  $html .= $this->get( 'catlinks' );
563  }
564  if ( $this->data['dataAfterContent'] ) {
565  $html .= $this->get( 'dataAfterContent' );
566  }
567  $html .= Html::closeElement( 'div' );
568  }
569 
570  return $html;
571  }
572 
582  protected function getPageTools() {
583  $title = $this->getSkin()->getTitle();
584  $namespace = $title->getNamespace();
585 
586  $sortedPileOfTools = [
587  'namespaces' => [],
588  'page-primary' => [],
589  'page-secondary' => [],
590  'user' => [],
591  'page-tertiary' => [],
592  'more' => [],
593  'general' => []
594  ];
595 
596  // Tools specific to the page
597  $pileOfEditTools = [];
598  foreach ( $this->data['content_navigation'] as $navKey => $navBlock ) {
599  // Just use namespaces items as they are
600  if ( $navKey == 'namespaces' ) {
601  if ( $namespace < 0 ) {
602  // Put special page ns_pages in the more pile so they're not so lonely
603  $sortedPileOfTools['page-tertiary'] = $navBlock;
604  } else {
605  $sortedPileOfTools['namespaces'] = $navBlock;
606  }
607  } else {
608  $pileOfEditTools = array_merge( $pileOfEditTools, $navBlock );
609  }
610  }
611 
612  // Tools that may be general or page-related (typically the toolbox)
613  $pileOfTools = $this->getToolbox();
614  if ( $namespace >= 0 ) {
615  $pileOfTools['pagelog'] = [
616  'text' => $this->getMsg( 'timeless-pagelog' )->text(),
617  'href' => SpecialPage::getTitleFor( 'Log' )->getLocalURL(
618  [ 'page' => $title->getPrefixedText() ]
619  ),
620  'id' => 't-pagelog'
621  ];
622  }
623  $pileOfTools['more'] = [
624  'text' => $this->getMsg( 'timeless-more' )->text(),
625  'id' => 'ca-more',
626  'class' => 'dropdown-toggle'
627  ];
628 
629  // Only appears in mobile
630  if ( $this->data['language_urls'] !== false ) {
631  $pileOfTools['languages'] = [
632  'text' => $this->getMsg( 'timeless-languages' )->escaped(),
633  'id' => 'ca-languages',
634  'class' => 'dropdown-toggle'
635  ];
636  }
637 
638  // This is really dumb, and you're an idiot for doing it this way.
639  // Obviously if you're not the idiot who did this, I don't mean you.
640  foreach ( $pileOfEditTools as $navKey => $navBlock ) {
641  $currentSet = null;
642 
643  if ( in_array( $navKey, [
644  'watch',
645  'unwatch'
646  ] ) ) {
647  $currentSet = 'namespaces';
648  } elseif ( in_array( $navKey, [
649  'edit',
650  'view',
651  'history',
652  'addsection',
653  'viewsource'
654  ] ) ) {
655  $currentSet = 'page-primary';
656  } elseif ( in_array( $navKey, [
657  'delete',
658  'rename',
659  'protect',
660  'unprotect',
661  'move'
662  ] ) ) {
663  $currentSet = 'page-secondary';
664  } else {
665  // Catch random extension ones?
666  $currentSet = 'page-primary';
667  }
668  $sortedPileOfTools[$currentSet][$navKey] = $navBlock;
669  }
670  foreach ( $pileOfTools as $navKey => $navBlock ) {
671  $currentSet = null;
672 
673  if ( $navKey === 'contributions' ) {
674  $currentSet = 'page-primary';
675  } elseif ( in_array( $navKey, [
676  'blockip',
677  'userrights',
678  'log'
679  ] ) ) {
680  $currentSet = 'user';
681  } elseif ( in_array( $navKey, [
682  'whatlinkshere',
683  'print',
684  'info',
685  'pagelog',
686  'recentchangeslinked',
687  'permalink'
688  ] ) ) {
689  $currentSet = 'page-tertiary';
690  } elseif ( in_array( $navKey, [
691  'more',
692  'languages'
693  ] ) ) {
694  $currentSet = 'more';
695  } else {
696  $currentSet = 'general';
697  }
698  $sortedPileOfTools[$currentSet][$navKey] = $navBlock;
699  }
700 
701  return $sortedPileOfTools;
702  }
703 
712  protected function getCategories() {
713  $skin = $this->getSkin();
714  $catList = '';
715  $html = '';
716 
717  $allCats = $skin->getOutput()->getCategoryLinks();
718  if ( !empty( $allCats ) ) {
719  if ( !empty( $allCats['normal'] ) ) {
720  $catHeader = 'categories';
721  $catList .= $this->getCatList(
722  $allCats['normal'],
723  'normal-catlinks',
724  'mw-normal-catlinks',
725  'categories'
726  );
727  } else {
728  $catHeader = 'hidden-categories';
729  }
730 
731  if ( isset( $allCats['hidden'] ) ) {
732  $hiddenCatClass = [ 'mw-hidden-catlinks' ];
733  if ( $skin->getUser()->getBoolOption( 'showhiddencats' ) ) {
734  $hiddenCatClass[] = 'mw-hidden-cats-user-shown';
735  } elseif ( $skin->getTitle()->getNamespace() == NS_CATEGORY ) {
736  $hiddenCatClass[] = 'mw-hidden-cats-ns-shown';
737  } else {
738  $hiddenCatClass[] = 'mw-hidden-cats-hidden';
739  }
740  $catList .= $this->getCatList(
741  $allCats['hidden'],
742  'hidden-catlinks',
743  $hiddenCatClass,
744  [ 'hidden-categories', count( $allCats['hidden'] ) ]
745  );
746  }
747  }
748 
749  if ( $catList !== '' ) {
750  $html = $this->getSidebarChunk( 'catlinks-sidebar', $catHeader, $catList );
751  }
752 
753  return $html;
754  }
755 
766  protected function getCatList( $list, $id, $class, $message ) {
767  $html = Html::openElement( 'div', [ 'id' => "sidebar-{$id}", 'class' => $class ] );
768 
769  $makeLinkItem = function ( $linkHtml ) {
770  return Html::rawElement( 'li', [], $linkHtml );
771  };
772 
773  $categoryItems = array_map( $makeLinkItem, $list );
774 
775  $categoriesHtml = Html::rawElement( 'ul',
776  [],
777  implode( '', $categoryItems )
778  );
779 
780  $html .= $this->getPortlet( $id, $categoriesHtml, $message );
781 
782  $html .= Html::closeElement( 'div' );
783 
784  return $html;
785  }
786 
792  protected function getInterlanguageLinks() {
793  $html = '';
794 
795  if ( isset( $this->data['variant_urls'] ) && $this->data['variant_urls'] !== false ) {
796  $variants = $this->getPortlet( 'variants', $this->data['variant_urls'], true );
797  } else {
798  $variants = '';
799  }
800  if ( $this->data['language_urls'] !== false ) {
801  $html .= $this->getSidebarChunk(
802  'other-languages',
803  'timeless-languages',
804  $variants .
805  $this->getPortlet(
806  'lang',
807  $this->data['language_urls'] ?: [],
808  'otherlanguages'
809  )
810  );
811  }
812 
813  return $html;
814  }
815 }
BaseTemplate\getPersonalTools
getPersonalTools()
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.
Definition: BaseTemplate.php:139
TimelessTemplate\getSidebarChunk
getSidebarChunk( $id, $headerMessage, $content)
Sidebar chunk containing one or more portlets.
Definition: TimelessTemplate.php:234
$user
return true to allow those checks to and false if checking is done & $user
Definition: hooks.txt:1476
MWDebug\getDebugHTML
static getDebugHTML(IContextSource $context)
Returns the HTML to add to the page for the toolbar.
Definition: MWDebug.php:421
TimelessTemplate\getPortlet
getPortlet( $name, $content, $msg=null)
Generates a block of navigation links with a header.
Definition: TimelessTemplate.php:145
BaseTemplate\makeSearchButton
makeSearchButton( $mode, $attrs=[])
Definition: BaseTemplate.php:537
captcha-old.count
count
Definition: captcha-old.py:249
BaseTemplate\getClear
getClear()
Get a div with the core visualClear class, for clearing floats.
Definition: BaseTemplate.php:712
SpecialPage\getTitleFor
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,...
Definition: SpecialPage.php:82
TimelessTemplate\getContentSub
getContentSub()
Links and information that may appear below the firstHeading.
Definition: TimelessTemplate.php:535
TimelessTemplate\getPageToolSidebar
getPageToolSidebar()
Page tools in sidebar.
Definition: TimelessTemplate.php:410
data
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
Definition: hooks.txt:6
getContext
getContext()
QuickTemplate\getSkin
getSkin()
Get the Skin object related to this object.
Definition: QuickTemplate.php:179
php
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
Definition: injection.txt:35
Linker\tooltipAndAccesskeyAttribs
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[], $options=null)
Returns the attributes for the tooltip and access key.
Definition: Linker.php:2130
TimelessTemplate\getSearch
getSearch()
The search box at the top.
Definition: TimelessTemplate.php:310
TimelessTemplate
BaseTemplate class for the Timeless skin.
Definition: TimelessTemplate.php:7
$html
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
Definition: hooks.txt:1985
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:925
BaseTemplate\getAfterPortlet
getAfterPortlet( $name)
Allows extensions to hook into known portlets and add stuff to them.
Definition: BaseTemplate.php:307
BaseTemplate\makeListItem
makeListItem( $key, $item, $options=[])
Generates a list item for a navigation, portlet, portal, sidebar...
Definition: BaseTemplate.php:480
BaseTemplate\getIndicators
getIndicators()
Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed i...
Definition: BaseTemplate.php:731
TimelessTemplate\getHeaderHack
getHeaderHack()
The colour bars Split this out so we don't have to look at it/can easily kill it later.
Definition: TimelessTemplate.php:381
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:78
array
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
string
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
Definition: hooks.txt:175
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
BaseTemplate\getFooter
getFooter( $iconStyle='icononly', $linkStyle='flat')
Renderer for getFooterIcons and getFooterLinks.
Definition: BaseTemplate.php:662
QuickTemplate\text
text( $str)
Definition: QuickTemplate.php:107
BaseTemplate\getMsg
getMsg( $name)
Get a Message object with its context set.
Definition: BaseTemplate.php:38
TimelessTemplate\getSiteNotices
getSiteNotices()
Notices that may appear above the firstHeading.
Definition: TimelessTemplate.php:517
BaseTemplate\makeSearchInput
makeSearchInput( $attrs=[])
Definition: BaseTemplate.php:527
TimelessTemplate\getLogo
getLogo( $id='p-logo', $part='both')
The logo and (optionally) site title.
Definition: TimelessTemplate.php:260
Linker\titleAttrib
static titleAttrib( $name, $options=null, array $msgParams=[])
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
Definition: Linker.php:1965
TimelessTemplate\getMainNavigation
getMainNavigation()
Left sidebar navigation, usually.
Definition: TimelessTemplate.php:350
BaseTemplate\getToolbox
getToolbox()
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.
Definition: BaseTemplate.php:73
as
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
Definition: distributors.txt:9
$skin
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
Definition: hooks.txt:1985
TimelessTemplate\getInterlanguageLinks
getInterlanguageLinks()
Interlanguage links block, also with variants.
Definition: TimelessTemplate.php:792
$content
$content
Definition: pageupdater.txt:72
TimelessTemplate\getPageTools
getPageTools()
Generate pile of all the tools.
Definition: TimelessTemplate.php:582
TimelessTemplate\getCatList
getCatList( $list, $id, $class, $message)
List of categories.
Definition: TimelessTemplate.php:766
TimelessTemplate\getAfterContent
getAfterContent()
The data after content, catlinks, and potential other stuff that may appear within the content block ...
Definition: TimelessTemplate.php:556
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
$template
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
Definition: hooks.txt:780
BaseTemplate
New base template for a skin's template extended from QuickTemplate this class features helper method...
Definition: BaseTemplate.php:29
TimelessTemplate\getUserLinks
getUserLinks()
Personal/user links portlet for header.
Definition: TimelessTemplate.php:437
TimelessTemplate\execute
execute()
Outputs the entire contents of the page.
Definition: TimelessTemplate.php:15
TimelessTemplate\$pileOfTools
array $pileOfTools
Definition: TimelessTemplate.php:10
BaseTemplate\getSidebar
getSidebar( $options=[])
Definition: BaseTemplate.php:164
TimelessTemplate\getCategories
getCategories()
Categories for the sidebar.
Definition: TimelessTemplate.php:712