MediaWiki  1.31.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-site-navigation' ],
40  $this->getLogo( 'p-logo', 'image' ) .
41  $this->getMainNavigation() .
42  $this->getSidebarChunk(
43  'site-tools',
44  'timeless-sitetools',
45  $this->getPortlet(
46  'tb',
47  $this->pileOfTools['general'],
48  'timeless-sitetools'
49  )
50  )
51  ) .
52  Html::rawElement( 'div', [ 'id' => 'mw-related-navigation' ],
53  $this->getPageToolSidebar() .
54  $this->getInterlanguageLinks() .
55  $this->getCategories()
56  ) .
57  Html::rawElement( 'div', [ 'id' => 'mw-content' ],
58  Html::rawElement( 'div', [ 'id' => 'content', 'class' => 'mw-body', 'role' => 'main' ],
59  $this->getSiteNotices() .
60  $this->getIndicators() .
62  'h1',
63  [
64  'id' => 'firstHeading',
65  'class' => 'firstHeading',
66  'lang' => $this->get( 'pageLanguage' )
67  ],
68  $this->get( 'title' )
69  ) .
70  Html::rawElement( 'div', [ 'id' => 'mw-page-header-links' ],
71  $this->getPortlet(
72  'namespaces',
73  $this->pileOfTools['namespaces'],
74  'timeless-namespaces'
75  ) .
76  $this->getPortlet(
77  'views',
78  $this->pileOfTools['page-primary'],
79  'timeless-pagetools'
80  )
81  ) .
82  $this->getClear() .
83  Html::rawElement( 'div', [ 'class' => 'mw-body-content', 'id' => 'bodyContent' ],
84  $this->getContentSub() .
85  $this->get( 'bodytext' ) .
86  $this->getClear()
87  )
88  )
89  ) .
90  $this->getAfterContent() .
91  $this->getClear()
92  )
93  );
94 
95  $html .= Html::rawElement( 'div', [ 'id' => 'mw-footer-container', 'class' => 'ts-container' ],
96  Html::rawElement( 'div', [ 'id' => 'mw-footer', 'class' => 'ts-inner' ],
97  $this->getFooter()
98  )
99  );
100 
101  $html .= Html::closeElement( 'div' );
102 
103  // BaseTemplate::printTrail() stuff (has no get version)
104  // Required for RL to run
105  $html .= MWDebug::getDebugHTML( $this->getSkin()->getContext() );
106  $html .= $this->get( 'bottomscripts' );
107  $html .= $this->get( 'reporttime' );
108 
109  $html .= Html::closeElement( 'body' );
110  $html .= Html::closeElement( 'html' );
111 
112  // The unholy echo
113  echo $html;
114  }
115 
137  protected function getPortlet( $name, $content, $msg = null ) {
138  if ( $msg === null ) {
139  $msg = $name;
140  } elseif ( is_array( $msg ) ) {
141  $msgString = array_shift( $msg );
142  $msgParams = $msg;
143  $msg = $msgString;
144  }
145  $msgObj = wfMessage( $msg );
146  if ( $msgObj->exists() ) {
147  if ( isset( $msgParams ) && !empty( $msgParams ) ) {
148  $msgString = $this->getMsg( $msg, $msgParams )->parse();
149  } else {
150  $msgString = $msgObj->parse();
151  }
152  } else {
153  $msgString = htmlspecialchars( $msg );
154  }
155 
156  // HACK: Compatibility with extensions still using SkinTemplateToolboxEnd
157  $hookContents = '';
158  if ( $name == 'tb' ) {
159  if ( isset( $boxes['TOOLBOX'] ) ) {
160  ob_start();
161  // We pass an extra 'true' at the end so extensions using BaseTemplateToolbox
162  // can abort and avoid outputting double toolbox links
163  // Avoid PHP 7.1 warning from passing $this by reference
164  $template = $this;
165  Hooks::run( 'SkinTemplateToolboxEnd', [ &$template, true ] );
166  $hookContents = ob_get_contents();
167  ob_end_clean();
168  if ( !trim( $hookContents ) ) {
169  $hookContents = '';
170  }
171  }
172  }
173  // END hack
174 
175  $labelId = Sanitizer::escapeId( "p-$name-label" );
176 
177  if ( is_array( $content ) ) {
178  $contentText = Html::openElement( 'ul' );
179  if ( $content !== [] ) {
180  foreach ( $content as $key => $item ) {
181  $contentText .= $this->makeListItem(
182  $key,
183  $item,
184  [ 'text-wrapper' => [ 'tag' => 'span' ] ]
185  );
186  }
187  }
188  // Add in SkinTemplateToolboxEnd, if any
189  $contentText .= $hookContents;
190  $contentText .= Html::closeElement( 'ul' );
191  } else {
192  $contentText = $content;
193  }
194 
195  $html = Html::rawElement( 'div', [
196  'role' => 'navigation',
197  'class' => [ 'mw-portlet', 'emptyPortlet' => !$content ],
198  'id' => Sanitizer::escapeId( 'p-' . $name ),
199  'title' => Linker::titleAttrib( 'p-' . $name ),
200  'aria-labelledby' => $labelId
201  ],
202  Html::rawElement( 'h3', [
203  'id' => $labelId,
204  'lang' => $this->get( 'userlang' ),
205  'dir' => $this->get( 'dir' )
206  ],
207  $msgString
208  ) .
209  Html::rawElement( 'div', [ 'class' => 'mw-portlet-body' ],
210  $contentText .
211  $this->getAfterPortlet( $name )
212  )
213  );
214 
215  return $html;
216  }
217 
227  protected function getSidebarChunk( $id, $headerMessage, $content ) {
228  $html = '';
229 
231  'div',
232  [ 'id' => Sanitizer::escapeId( $id ), 'class' => 'sidebar-chunk' ],
233  Html::rawElement( 'h2', [],
234  Html::element( 'span', [],
235  $this->getMsg( $headerMessage )->text()
236  ) .
237  Html::element( 'div', [ 'class' => 'pokey' ] )
238  ) .
239  Html::rawElement( 'div', [ 'class' => 'sidebar-inner' ], $content )
240  );
241 
242  return $html;
243  }
244 
253  protected function getLogo( $id = 'p-logo', $part = 'both' ) {
254  $html = '';
255  $language = $this->getSkin()->getLanguage();
256 
258  'div',
259  [
260  'id' => Sanitizer::escapeId( $id ),
261  'class' => 'mw-portlet',
262  'role' => 'banner'
263  ]
264  );
265  if ( $part !== 'image' ) {
266  $titleClass = '';
267  if ( $language->hasVariants() ) {
268  $siteTitle = $language->convert( $this->getMsg( 'timeless-sitetitle' )->text() );
269  } else {
270  $siteTitle = $this->getMsg( 'timeless-sitetitle' )->text();
271  }
272  // width is 11em; 13 characters will probably fit?
273  if ( mb_strlen( $siteTitle ) > 13 ) {
274  $titleClass = 'long';
275  }
276  $html .= Html::element( 'a', [
277  'id' => 'p-banner',
278  'class' => [ 'mw-wiki-title', $titleClass ],
279  'href' => $this->data['nav_urls']['mainpage']['href']
280  ],
281  $siteTitle
282  );
283  }
284  if ( $part !== 'text' ) {
285  $html .= Html::element( 'a', array_merge(
286  [
287  'class' => 'mw-wiki-logo',
288  'href' => $this->data['nav_urls']['mainpage']['href']
289  ],
291  ) );
292  }
293  $html .= Html::closeElement( 'div' );
294 
295  return $html;
296  }
297 
303  protected function getSearch() {
304  $html = '';
305 
306  $html .= Html::openElement( 'div', [ 'class' => 'mw-portlet', 'id' => 'p-search' ] );
307 
309  'h3',
310  [ 'lang' => $this->get( 'userlang' ), 'dir' => $this->get( 'dir' ) ],
311  Html::rawElement( 'label', [ 'for' => 'searchInput' ], $this->getMsg( 'search' )->text() )
312  );
313 
314  $html .= Html::rawElement( 'form', [ 'action' => $this->get( 'wgScript' ), 'id' => 'searchform' ],
315  Html::rawElement( 'div', [ 'id' => 'simpleSearch' ],
316  Html::rawElement( 'div', [ 'id' => 'searchInput-container' ],
317  $this->makeSearchInput( [
318  'id' => 'searchInput',
319  'placeholder' => $this->getMsg( 'timeless-search-placeholder' )->text(),
320  ] )
321  ) .
322  Html::hidden( 'title', $this->get( 'searchtitle' ) ) .
323  $this->makeSearchButton(
324  'fulltext',
325  [ 'id' => 'mw-searchButton', 'class' => 'searchButton mw-fallbackSearchButton' ]
326  ) .
327  $this->makeSearchButton(
328  'go',
329  [ 'id' => 'searchButton', 'class' => 'searchButton' ]
330  )
331  )
332  );
333 
334  $html .= Html::closeElement( 'div' );
335 
336  return $html;
337  }
338 
344  protected function getMainNavigation() {
345  $sidebar = $this->getSidebar();
346  $html = '';
347 
348  // Already hardcoded into header
349  $sidebar['SEARCH'] = false;
350  // Parsed as part of pageTools
351  $sidebar['TOOLBOX'] = false;
352  // Forcibly removed to separate chunk
353  $sidebar['LANGUAGES'] = false;
354 
355  foreach ( $sidebar as $name => $content ) {
356  if ( $content === false ) {
357  continue;
358  }
359  // Numeric strings gets an integer when set as key, cast back - T73639
360  $name = (string)$name;
361  $html .= $this->getPortlet( $name, $content['content'] );
362  }
363 
364  $html = $this->getSidebarChunk( 'site-navigation', 'navigation', $html );
365 
366  return $html;
367  }
368 
375  protected function getHeaderHack() {
376  $html = '';
377 
378  // These are almost exactly the same and this is stupid.
379  $html .= Html::rawElement( 'div', [ 'id' => 'mw-header-hack', 'class' => 'color-bar' ],
380  Html::rawElement( 'div', [ 'class' => 'color-middle-container' ],
381  Html::element( 'div', [ 'class' => 'color-middle' ] )
382  ) .
383  Html::element( 'div', [ 'class' => 'color-left' ] ) .
384  Html::element( 'div', [ 'class' => 'color-right' ] )
385  );
386  $html .= Html::rawElement( 'div', [ 'id' => 'mw-header-nav-hack' ],
387  Html::rawElement( 'div', [ 'class' => 'color-bar' ],
388  Html::rawElement( 'div', [ 'class' => 'color-middle-container' ],
389  Html::element( 'div', [ 'class' => 'color-middle' ] )
390  ) .
391  Html::element( 'div', [ 'class' => 'color-left' ] ) .
392  Html::element( 'div', [ 'class' => 'color-right' ] )
393  )
394  );
395 
396  return $html;
397  }
398 
404  protected function getPageToolSidebar() {
405  $pageTools = '';
406  $pageTools .= $this->getPortlet(
407  'cactions',
408  $this->pileOfTools['page-secondary'],
409  'timeless-pageactions'
410  );
411  $pageTools .= $this->getPortlet(
412  'userpagetools',
413  $this->pileOfTools['user'],
414  'timeless-userpagetools'
415  );
416  $pageTools .= $this->getPortlet(
417  'pagemisc',
418  $this->pileOfTools['page-tertiary'],
419  'timeless-pagemisc'
420  );
421 
422  return $this->getSidebarChunk( 'page-tools', 'timeless-pageactions', $pageTools );
423  }
424 
431  protected function getUserLinks() {
432  $user = $this->getSkin()->getUser();
433  $personalTools = $this->getPersonalTools();
434 
435  $html = '';
436  $extraTools = [];
437 
438  // Remove Echo badges
439  if ( isset( $personalTools['notifications-alert'] ) ) {
440  $extraTools['notifications-alert'] = $personalTools['notifications-alert'];
441  unset( $personalTools['notifications-alert'] );
442  }
443  if ( isset( $personalTools['notifications-notice'] ) ) {
444  $extraTools['notifications-notice'] = $personalTools['notifications-notice'];
445  unset( $personalTools['notifications-notice'] );
446  }
447  $class = empty( $extraTools ) ? '' : 'extension-icons';
448 
449  // Re-label some messages
450  if ( isset( $personalTools['userpage'] ) ) {
451  $personalTools['userpage']['links'][0]['text'] = $this->getMsg( 'timeless-userpage' )->text();
452  }
453  if ( isset( $personalTools['mytalk'] ) ) {
454  $personalTools['mytalk']['links'][0]['text'] = $this->getMsg( 'timeless-talkpage' )->text();
455  }
456 
457  // Labels
458  if ( $user->isLoggedIn() ) {
459  $userName = $user->getName();
460  // Make sure it fits first (numbers slightly made up, may need adjusting)
461  $fit = empty( $extraTools ) ? 13 : 9;
462  if ( mb_strlen( $userName ) < $fit ) {
463  $dropdownHeader = $userName;
464  } else {
465  $dropdownHeader = wfMessage( 'timeless-loggedin' )->text();
466  }
467  $headerMsg = [ 'timeless-loggedinas', $user->getName() ];
468  } else {
469  $dropdownHeader = wfMessage( 'timeless-anonymous' )->text();
470  $headerMsg = 'timeless-notloggedin';
471  }
472  $html .= Html::openElement( 'div', [ 'id' => 'user-tools' ] );
473 
474  $html .= Html::rawElement( 'div', [ 'id' => 'personal' ],
475  Html::rawElement( 'h2', [],
476  Html::element( 'span', [], $dropdownHeader ) .
477  Html::element( 'div', [ 'class' => 'pokey' ] )
478  ) .
479  Html::rawElement( 'div', [ 'id' => 'personal-inner', 'class' => 'dropdown' ],
480  $this->getPortlet( 'personal', $personalTools, $headerMsg )
481  )
482  );
483 
484  // Extra icon stuff (echo etc)
485  if ( !empty( $extraTools ) ) {
486  $iconList = '';
487  foreach ( $extraTools as $key => $item ) {
488  $iconList .= $this->makeListItem( $key, $item );
489  }
490 
492  'div',
493  [ 'id' => 'personal-extra', 'class' => 'p-body' ],
494  Html::rawElement( 'ul', [], $iconList )
495  );
496  }
497 
498  $html .= Html::closeElement( 'div' );
499 
500  return [
501  'html' => $html,
502  'class' => $class
503  ];
504  }
505 
511  protected function getSiteNotices() {
512  $html = '';
513 
514  if ( $this->data['sitenotice'] ) {
515  $html .= Html::rawElement( 'div', [ 'id' => 'siteNotice' ], $this->get( 'sitenotice' ) );
516  }
517  if ( $this->data['newtalk'] ) {
518  $html .= Html::rawElement( 'div', [ 'class' => 'usermessage' ], $this->get( 'newtalk' ) );
519  }
520 
521  return $html;
522  }
523 
529  protected function getContentSub() {
530  $html = '';
531 
532  $html .= Html::openElement( 'div', [ 'id' => 'contentSub' ] );
533  if ( $this->data['subtitle'] ) {
534  $html .= $this->get( 'subtitle' );
535  }
536  if ( $this->data['undelete'] ) {
537  $html .= $this->get( 'undelete' );
538  }
539  $html .= Html::closeElement( 'div' );
540 
541  return $html;
542  }
543 
550  protected function getAfterContent() {
551  $html = '';
552 
553  if ( $this->data['catlinks'] || $this->data['dataAfterContent'] ) {
554  $html .= Html::openElement( 'div', [ 'id' => 'content-bottom-stuff' ] );
555  if ( $this->data['catlinks'] ) {
556  $html .= $this->get( 'catlinks' );
557  }
558  if ( $this->data['dataAfterContent'] ) {
559  $html .= $this->get( 'dataAfterContent' );
560  }
561  $html .= Html::closeElement( 'div' );
562  }
563 
564  return $html;
565  }
566 
576  protected function getPageTools() {
577  $title = $this->getSkin()->getTitle();
578  $namespace = $title->getNamespace();
579 
580  $sortedPileOfTools = [
581  'namespaces' => [],
582  'page-primary' => [],
583  'page-secondary' => [],
584  'user' => [],
585  'page-tertiary' => [],
586  'general' => []
587  ];
588 
589  // Tools specific to the page
590  $pileOfEditTools = [];
591  foreach ( $this->data['content_navigation'] as $navKey => $navBlock ) {
592  // Just use namespaces items as they are
593  if ( $navKey == 'namespaces' ) {
594  if ( $namespace < 0 ) {
595  // Put special page ns_pages in the more pile so they're not so lonely
596  $sortedPileOfTools['page-tertiary'] = $navBlock;
597  } else {
598  $sortedPileOfTools['namespaces'] = $navBlock;
599  }
600  } else {
601  $pileOfEditTools = array_merge( $pileOfEditTools, $navBlock );
602  }
603  }
604 
605  // Tools that may be general or page-related (typically the toolbox)
606  $pileOfTools = $this->getToolbox();
607  if ( $namespace >= 0 ) {
608  $pileOfTools['pagelog'] = [
609  'text' => $this->getMsg( 'timeless-pagelog' )->text(),
610  'href' => SpecialPage::getTitleFor( 'Log', $title->getPrefixedText() )->getLocalURL(),
611  'id' => 't-pagelog'
612  ];
613  }
614  $pileOfTools['more'] = [
615  'text' => $this->getMsg( 'timeless-more' )->text(),
616  'id' => 'ca-more',
617  'class' => 'dropdown-toggle'
618  ];
619 
620  // Goes in the page-primary in mobile, doesn't appear otherwise
621  if ( $this->data['language_urls'] !== false ) {
622  $pileOfTools['languages'] = [
623  'text' => $this->getMsg( 'timeless-languages' )->escaped(),
624  'id' => 'ca-languages',
625  'class' => 'dropdown-toggle'
626  ];
627  }
628 
629  // This is really dumb, and you're an idiot for doing it this way.
630  // Obviously if you're not the idiot who did this, I don't mean you.
631  foreach ( $pileOfEditTools as $navKey => $navBlock ) {
632  $currentSet = null;
633 
634  if ( in_array( $navKey, [
635  'watch',
636  'unwatch'
637  ] ) ) {
638  $currentSet = 'namespaces';
639  } elseif ( in_array( $navKey, [
640  'edit',
641  'view',
642  'history',
643  'addsection',
644  'viewsource'
645  ] ) ) {
646  $currentSet = 'page-primary';
647  } elseif ( in_array( $navKey, [
648  'delete',
649  'rename',
650  'protect',
651  'unprotect',
652  'move'
653  ] ) ) {
654  $currentSet = 'page-secondary';
655  } else {
656  // Catch random extension ones?
657  $currentSet = 'page-primary';
658  }
659  $sortedPileOfTools[$currentSet][$navKey] = $navBlock;
660  }
661  foreach ( $pileOfTools as $navKey => $navBlock ) {
662  $currentSet = null;
663 
664  if ( in_array( $navKey, [
665  'contributions',
666  'more',
667  'languages'
668  ] ) ) {
669  $currentSet = 'page-primary';
670  } elseif ( in_array( $navKey, [
671  'blockip',
672  'userrights',
673  'log'
674  ] ) ) {
675  $currentSet = 'user';
676  } elseif ( in_array( $navKey, [
677  'whatlinkshere',
678  'print',
679  'info',
680  'pagelog',
681  'recentchangeslinked',
682  'permalink'
683  ] ) ) {
684  $currentSet = 'page-tertiary';
685  } else {
686  $currentSet = 'general';
687  }
688  $sortedPileOfTools[$currentSet][$navKey] = $navBlock;
689  }
690 
691  return $sortedPileOfTools;
692  }
693 
703  protected function getCategories() {
705 
706  $skin = $this->getSkin();
707  $title = $skin->getTitle();
708  $catList = false;
709  $html = '';
710 
711  // Get list from outputpage if in preview; otherwise get list from title
712  if ( in_array( $skin->getRequest()->getVal( 'action' ), [ 'submit', 'edit' ] ) ) {
713  $allCats = [];
714  // Can't just use getCategoryLinks because there's no equivalent for Title
715  $allCats2 = $skin->getOutput()->getCategories();
716  foreach ( $allCats2 as $displayName ) {
717  $catTitle = Title::makeTitleSafe( NS_CATEGORY, $displayName );
718  $allCats[] = $catTitle->getDBkey();
719  }
720  } else {
721  // This is probably to trim out some excessive stuff. Unless I was just high on cough syrup.
722  $allCats = array_keys( $title->getParentCategories() );
723 
724  $len = strlen( $wgContLang->getNsText( NS_CATEGORY ) . ':' );
725  foreach ( $allCats as $i => $catName ) {
726  $allCats[$i] = substr( $catName, $len );
727  }
728  }
729  if ( $allCats !== [] ) {
730  $dbr = wfGetDB( DB_REPLICA );
731  $res = $dbr->select(
732  [ 'page', 'page_props' ],
733  [ 'page_id', 'page_title' ],
734  [
735  'page_title' => $allCats,
736  'page_namespace' => NS_CATEGORY,
737  'pp_propname' => 'hiddencat'
738  ],
739  __METHOD__,
740  [],
741  [ 'page_props' => [ 'JOIN', 'pp_page = page_id' ] ]
742  );
743  $hiddenCats = [];
744  foreach ( $res as $row ) {
745  $hiddenCats[] = $row->page_title;
746  }
747  $normalCats = array_diff( $allCats, $hiddenCats );
748 
749  $normalCount = count( $normalCats );
750  $hiddenCount = count( $hiddenCats );
751  $count = $normalCount;
752 
753  // Mostly consistent with how Skin does it.
754  // Doesn't have the classes. Either way can't be good for caching.
755  if (
756  $skin->getUser()->getBoolOption( 'showhiddencats' ) ||
757  $title->getNamespace() == NS_CATEGORY
758  ) {
759  $count += $hiddenCount;
760  } else {
761  /* We don't care if there are hidden ones. */
762  $hiddenCount = 0;
763  }
764 
765  // Assemble the html...
766  if ( $count ) {
767  if ( $normalCount ) {
768  $catHeader = 'categories';
769  } else {
770  $catHeader = 'hidden-categories';
771  }
772  $catList = '';
773  if ( $normalCount ) {
774  $catList .= $this->getCatList( $normalCats, 'catlist-normal', 'categories' );
775  }
776  if ( $hiddenCount ) {
777  $catList .= $this->getCatList(
778  $hiddenCats,
779  'catlist-hidden',
780  [ 'hidden-categories', $hiddenCount ]
781  );
782  }
783  }
784  }
785  if ( $catList ) {
786  $html = $this->getSidebarChunk( 'catlinks-sidebar', $catHeader, $catList );
787  }
788 
789  return $html;
790  }
791 
801  protected function getCatList( $list, $id, $message ) {
802  $html = '';
803 
804  $categories = [];
805  // Generate portlet content
806  foreach ( $list as $category ) {
807  $title = Title::makeTitleSafe( NS_CATEGORY, $category );
808  if ( !$title ) {
809  continue;
810  }
811  $categories[ htmlspecialchars( $category ) ] = [ 'links' => [ 0 => [
812  'href' => $title->getLinkURL(),
813  'text' => $title->getText()
814  ] ] ];
815  }
816 
817  $html .= $this->getPortlet( $id, $categories, $message );
818 
819  return $html;
820  }
821 
827  protected function getInterlanguageLinks() {
828  $html = '';
829 
830  if ( isset( $this->data['variant_urls'] ) && $this->data['variant_urls'] !== false ) {
831  $variants = $this->getPortlet( 'variants', $this->data['variant_urls'], true );
832  } else {
833  $variants = '';
834  }
835  if ( $this->data['language_urls'] !== false ) {
836  $html .= $this->getSidebarChunk(
837  'other-languages',
838  'timeless-languages',
839  $variants .
840  $this->getPortlet(
841  'lang',
842  $this->data['language_urls'] ?: [],
843  'otherlanguages'
844  )
845  );
846  }
847 
848  return $html;
849  }
850 }
BaseTemplate\getPersonalTools
getPersonalTools()
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.
Definition: BaseTemplate.php:124
TimelessTemplate\getSidebarChunk
getSidebarChunk( $id, $headerMessage, $content)
Sidebar chunk containing one or more portlets.
Definition: TimelessTemplate.php:227
$user
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
Definition: hooks.txt:244
$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 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
Definition: hooks.txt:783
MWDebug\getDebugHTML
static getDebugHTML(IContextSource $context)
Returns the HTML to add to the page for the toolbar.
Definition: MWDebug.php:422
TimelessTemplate\getPortlet
getPortlet( $name, $content, $msg=null)
Generates a block of navigation links with a header.
Definition: TimelessTemplate.php:137
BaseTemplate\makeSearchButton
makeSearchButton( $mode, $attrs=[])
Definition: BaseTemplate.php:530
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:710
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
$res
$res
Definition: database.txt:21
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
TimelessTemplate\getContentSub
getContentSub()
Links and information that may appear below the firstHeading.
Definition: TimelessTemplate.php:529
TimelessTemplate\getPageToolSidebar
getPageToolSidebar()
Page tools in sidebar.
Definition: TimelessTemplate.php:404
getContext
getContext()
QuickTemplate\getSkin
getSkin()
Get the Skin object related to this object.
Definition: QuickTemplate.php:190
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:2135
$dbr
$dbr
Definition: testCompression.php:50
TimelessTemplate\getSearch
getSearch()
The search box at the top.
Definition: TimelessTemplate.php:303
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:309
TimelessTemplate
BaseTemplate class for the Timeless skin.
Definition: TimelessTemplate.php:7
TimelessTemplate\getCatList
getCatList( $list, $id, $message)
List of categories.
Definition: TimelessTemplate.php:801
$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:1987
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:934
BaseTemplate\getAfterPortlet
getAfterPortlet( $name)
Allows extensions to hook into known portlets and add stuff to them.
Definition: BaseTemplate.php:294
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2800
BaseTemplate\makeListItem
makeListItem( $key, $item, $options=[])
Generates a list item for a navigation, portlet, portal, sidebar...
Definition: BaseTemplate.php:473
BaseTemplate\getIndicators
getIndicators()
Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed i...
Definition: BaseTemplate.php:729
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
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:375
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:79
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
BaseTemplate\getFooter
getFooter( $iconStyle='icononly', $linkStyle='flat')
Renderer for getFooterIcons and getFooterLinks.
Definition: BaseTemplate.php:660
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:774
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:562
QuickTemplate\text
text( $str)
Definition: QuickTemplate.php:125
BaseTemplate\getMsg
getMsg( $name)
Get a Message object with its context set.
Definition: BaseTemplate.php:35
TimelessTemplate\getSiteNotices
getSiteNotices()
Notices that may appear above the firstHeading.
Definition: TimelessTemplate.php:511
BaseTemplate\makeSearchInput
makeSearchInput( $attrs=[])
Definition: BaseTemplate.php:520
TimelessTemplate\getLogo
getLogo( $id='p-logo', $part='both')
The logo and (optionally) site title.
Definition: TimelessTemplate.php:253
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:1969
TimelessTemplate\getMainNavigation
getMainNavigation()
Left sidebar navigation, usually.
Definition: TimelessTemplate.php:344
BaseTemplate\getToolbox
getToolbox()
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.
Definition: BaseTemplate.php:58
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
Html\openElement
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:251
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:209
$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:1987
TimelessTemplate\getInterlanguageLinks
getInterlanguageLinks()
Interlanguage links block, also with variants.
Definition: TimelessTemplate.php:827
TimelessTemplate\getPageTools
getPageTools()
Generate pile of all the tools.
Definition: TimelessTemplate.php:576
TimelessTemplate\getAfterContent
getAfterContent()
The data after content, catlinks, and potential other stuff that may appear within the content block ...
Definition: TimelessTemplate.php:550
wfMessage
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 "&lt
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:231
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:203
BaseTemplate
New base template for a skin's template extended from QuickTemplate this class features helper method...
Definition: BaseTemplate.php:26
TimelessTemplate\getUserLinks
getUserLinks()
Personal/user links portlet for header.
Definition: TimelessTemplate.php:431
TimelessTemplate\execute
execute()
Outputs the entire contents of the page.
Definition: TimelessTemplate.php:15
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
TimelessTemplate\$pileOfTools
array $pileOfTools
Definition: TimelessTemplate.php:10
array
the array() calling protocol came about after MediaWiki 1.4rc1.
$wgContLang
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
Definition: design.txt:56
BaseTemplate\getSidebar
getSidebar( $options=[])
Definition: BaseTemplate.php:149
TimelessTemplate\getCategories
getCategories()
Categories for the sidebar.
Definition: TimelessTemplate.php:703