MediaWiki  1.29.1
BaseTemplate.php
Go to the documentation of this file.
1 <?php
26 abstract class BaseTemplate extends QuickTemplate {
27 
35  public function getMsg( $name /* ... */ ) {
36  return call_user_func_array( [ $this->getSkin(), 'msg' ], func_get_args() );
37  }
38 
39  function msg( $str ) {
40  echo $this->getMsg( $str )->escaped();
41  }
42 
43  function msgHtml( $str ) {
44  echo $this->getMsg( $str )->text();
45  }
46 
47  function msgWiki( $str ) {
48  echo $this->getMsg( $str )->parseAsBlock();
49  }
50 
58  function getToolbox() {
59  $toolbox = [];
60  if ( isset( $this->data['nav_urls']['whatlinkshere'] )
61  && $this->data['nav_urls']['whatlinkshere']
62  ) {
63  $toolbox['whatlinkshere'] = $this->data['nav_urls']['whatlinkshere'];
64  $toolbox['whatlinkshere']['id'] = 't-whatlinkshere';
65  }
66  if ( isset( $this->data['nav_urls']['recentchangeslinked'] )
67  && $this->data['nav_urls']['recentchangeslinked']
68  ) {
69  $toolbox['recentchangeslinked'] = $this->data['nav_urls']['recentchangeslinked'];
70  $toolbox['recentchangeslinked']['msg'] = 'recentchangeslinked-toolbox';
71  $toolbox['recentchangeslinked']['id'] = 't-recentchangeslinked';
72  $toolbox['recentchangeslinked']['rel'] = 'nofollow';
73  }
74  if ( isset( $this->data['feeds'] ) && $this->data['feeds'] ) {
75  $toolbox['feeds']['id'] = 'feedlinks';
76  $toolbox['feeds']['links'] = [];
77  foreach ( $this->data['feeds'] as $key => $feed ) {
78  $toolbox['feeds']['links'][$key] = $feed;
79  $toolbox['feeds']['links'][$key]['id'] = "feed-$key";
80  $toolbox['feeds']['links'][$key]['rel'] = 'alternate';
81  $toolbox['feeds']['links'][$key]['type'] = "application/{$key}+xml";
82  $toolbox['feeds']['links'][$key]['class'] = 'feedlink';
83  }
84  }
85  foreach ( [ 'contributions', 'log', 'blockip', 'emailuser',
86  'userrights', 'upload', 'specialpages' ] as $special
87  ) {
88  if ( isset( $this->data['nav_urls'][$special] ) && $this->data['nav_urls'][$special] ) {
89  $toolbox[$special] = $this->data['nav_urls'][$special];
90  $toolbox[$special]['id'] = "t-$special";
91  }
92  }
93  if ( isset( $this->data['nav_urls']['print'] ) && $this->data['nav_urls']['print'] ) {
94  $toolbox['print'] = $this->data['nav_urls']['print'];
95  $toolbox['print']['id'] = 't-print';
96  $toolbox['print']['rel'] = 'alternate';
97  $toolbox['print']['msg'] = 'printableversion';
98  }
99  if ( isset( $this->data['nav_urls']['permalink'] ) && $this->data['nav_urls']['permalink'] ) {
100  $toolbox['permalink'] = $this->data['nav_urls']['permalink'];
101  if ( $toolbox['permalink']['href'] === '' ) {
102  unset( $toolbox['permalink']['href'] );
103  $toolbox['ispermalink']['tooltiponly'] = true;
104  $toolbox['ispermalink']['id'] = 't-ispermalink';
105  $toolbox['ispermalink']['msg'] = 'permalink';
106  } else {
107  $toolbox['permalink']['id'] = 't-permalink';
108  }
109  }
110  if ( isset( $this->data['nav_urls']['info'] ) && $this->data['nav_urls']['info'] ) {
111  $toolbox['info'] = $this->data['nav_urls']['info'];
112  $toolbox['info']['id'] = 't-info';
113  }
114 
115  // Avoid PHP 7.1 warning from passing $this by reference
116  $template = $this;
117  Hooks::run( 'BaseTemplateToolbox', [ &$template, &$toolbox ] );
118  return $toolbox;
119  }
120 
131  function getPersonalTools() {
132  $personal_tools = [];
133  foreach ( $this->get( 'personal_urls' ) as $key => $plink ) {
134  # The class on a personal_urls item is meant to go on the <a> instead
135  # of the <li> so we have to use a single item "links" array instead
136  # of using most of the personal_url's keys directly.
137  $ptool = [
138  'links' => [
139  [ 'single-id' => "pt-$key" ],
140  ],
141  'id' => "pt-$key",
142  ];
143  if ( isset( $plink['active'] ) ) {
144  $ptool['active'] = $plink['active'];
145  }
146  foreach ( [ 'href', 'class', 'text', 'dir', 'data' ] as $k ) {
147  if ( isset( $plink[$k] ) ) {
148  $ptool['links'][0][$k] = $plink[$k];
149  }
150  }
151  $personal_tools[$key] = $ptool;
152  }
153  return $personal_tools;
154  }
155 
156  function getSidebar( $options = [] ) {
157  // Force the rendering of the following portals
158  $sidebar = $this->data['sidebar'];
159  if ( !isset( $sidebar['SEARCH'] ) ) {
160  $sidebar['SEARCH'] = true;
161  }
162  if ( !isset( $sidebar['TOOLBOX'] ) ) {
163  $sidebar['TOOLBOX'] = true;
164  }
165  if ( !isset( $sidebar['LANGUAGES'] ) ) {
166  $sidebar['LANGUAGES'] = true;
167  }
168 
169  if ( !isset( $options['search'] ) || $options['search'] !== true ) {
170  unset( $sidebar['SEARCH'] );
171  }
172  if ( isset( $options['toolbox'] ) && $options['toolbox'] === false ) {
173  unset( $sidebar['TOOLBOX'] );
174  }
175  if ( isset( $options['languages'] ) && $options['languages'] === false ) {
176  unset( $sidebar['LANGUAGES'] );
177  }
178 
179  $boxes = [];
180  foreach ( $sidebar as $boxName => $content ) {
181  if ( $content === false ) {
182  continue;
183  }
184  switch ( $boxName ) {
185  case 'SEARCH':
186  // Search is a special case, skins should custom implement this
187  $boxes[$boxName] = [
188  'id' => 'p-search',
189  'header' => $this->getMsg( 'search' )->text(),
190  'generated' => false,
191  'content' => true,
192  ];
193  break;
194  case 'TOOLBOX':
195  $msgObj = $this->getMsg( 'toolbox' );
196  $boxes[$boxName] = [
197  'id' => 'p-tb',
198  'header' => $msgObj->exists() ? $msgObj->text() : 'toolbox',
199  'generated' => false,
200  'content' => $this->getToolbox(),
201  ];
202  break;
203  case 'LANGUAGES':
204  if ( $this->data['language_urls'] ) {
205  $msgObj = $this->getMsg( 'otherlanguages' );
206  $boxes[$boxName] = [
207  'id' => 'p-lang',
208  'header' => $msgObj->exists() ? $msgObj->text() : 'otherlanguages',
209  'generated' => false,
210  'content' => $this->data['language_urls'],
211  ];
212  }
213  break;
214  default:
215  $msgObj = $this->getMsg( $boxName );
216  $boxes[$boxName] = [
217  'id' => "p-$boxName",
218  'header' => $msgObj->exists() ? $msgObj->text() : $boxName,
219  'generated' => true,
220  'content' => $content,
221  ];
222  break;
223  }
224  }
225 
226  // HACK: Compatibility with extensions still using SkinTemplateToolboxEnd
227  $hookContents = null;
228  if ( isset( $boxes['TOOLBOX'] ) ) {
229  ob_start();
230  // We pass an extra 'true' at the end so extensions using BaseTemplateToolbox
231  // can abort and avoid outputting double toolbox links
232  // Avoid PHP 7.1 warning from passing $this by reference
233  $template = $this;
234  Hooks::run( 'SkinTemplateToolboxEnd', [ &$template, true ] );
235  $hookContents = ob_get_contents();
236  ob_end_clean();
237  if ( !trim( $hookContents ) ) {
238  $hookContents = null;
239  }
240  }
241  // END hack
242 
243  if ( isset( $options['htmlOnly'] ) && $options['htmlOnly'] === true ) {
244  foreach ( $boxes as $boxName => $box ) {
245  if ( is_array( $box['content'] ) ) {
246  $content = '<ul>';
247  foreach ( $box['content'] as $key => $val ) {
248  $content .= "\n " . $this->makeListItem( $key, $val );
249  }
250  // HACK, shove the toolbox end onto the toolbox if we're rendering itself
251  if ( $hookContents ) {
252  $content .= "\n $hookContents";
253  }
254  // END hack
255  $content .= "\n</ul>\n";
256  $boxes[$boxName]['content'] = $content;
257  }
258  }
259  } else {
260  if ( $hookContents ) {
261  $boxes['TOOLBOXEND'] = [
262  'id' => 'p-toolboxend',
263  'header' => $boxes['TOOLBOX']['header'],
264  'generated' => false,
265  'content' => "<ul>{$hookContents}</ul>",
266  ];
267  // HACK: Make sure that TOOLBOXEND is sorted next to TOOLBOX
268  $boxes2 = [];
269  foreach ( $boxes as $key => $box ) {
270  if ( $key === 'TOOLBOXEND' ) {
271  continue;
272  }
273  $boxes2[$key] = $box;
274  if ( $key === 'TOOLBOX' ) {
275  $boxes2['TOOLBOXEND'] = $boxes['TOOLBOXEND'];
276  }
277  }
278  $boxes = $boxes2;
279  // END hack
280  }
281  }
282 
283  return $boxes;
284  }
285 
289  protected function renderAfterPortlet( $name ) {
290  echo $this->getAfterPortlet( $name );
291  }
292 
301  protected function getAfterPortlet( $name ) {
302  $html = '';
303  $content = '';
304  Hooks::run( 'BaseTemplateAfterPortlet', [ $this, $name, &$content ] );
305 
306  if ( $content !== '' ) {
308  'div',
309  [ 'class' => [ 'after-portlet', 'after-portlet-' . $name ] ],
310  $content
311  );
312  }
313 
314  return $html;
315  }
316 
369  function makeLink( $key, $item, $options = [] ) {
370  if ( isset( $item['text'] ) ) {
371  $text = $item['text'];
372  } else {
373  $text = $this->translator->translate( isset( $item['msg'] ) ? $item['msg'] : $key );
374  }
375 
376  $html = htmlspecialchars( $text );
377 
378  if ( isset( $options['text-wrapper'] ) ) {
379  $wrapper = $options['text-wrapper'];
380  if ( isset( $wrapper['tag'] ) ) {
381  $wrapper = [ $wrapper ];
382  }
383  while ( count( $wrapper ) > 0 ) {
384  $element = array_pop( $wrapper );
385  $html = Html::rawElement( $element['tag'], isset( $element['attributes'] )
386  ? $element['attributes']
387  : null, $html );
388  }
389  }
390 
391  if ( isset( $item['href'] ) || isset( $options['link-fallback'] ) ) {
392  $attrs = $item;
393  foreach ( [ 'single-id', 'text', 'msg', 'tooltiponly', 'context', 'primary',
394  'tooltip-params' ] as $k ) {
395  unset( $attrs[$k] );
396  }
397 
398  if ( isset( $attrs['data'] ) ) {
399  foreach ( $attrs['data'] as $key => $value ) {
400  $attrs[ 'data-' . $key ] = $value;
401  }
402  unset( $attrs[ 'data' ] );
403  }
404 
405  if ( isset( $item['id'] ) && !isset( $item['single-id'] ) ) {
406  $item['single-id'] = $item['id'];
407  }
408 
409  $tooltipParams = [];
410  if ( isset( $item['tooltip-params'] ) ) {
411  $tooltipParams = $item['tooltip-params'];
412  }
413 
414  if ( isset( $item['single-id'] ) ) {
415  if ( isset( $item['tooltiponly'] ) && $item['tooltiponly'] ) {
416  $title = Linker::titleAttrib( $item['single-id'], null, $tooltipParams );
417  if ( $title !== false ) {
418  $attrs['title'] = $title;
419  }
420  } else {
421  $tip = Linker::tooltipAndAccesskeyAttribs( $item['single-id'], $tooltipParams );
422  if ( isset( $tip['title'] ) && $tip['title'] !== false ) {
423  $attrs['title'] = $tip['title'];
424  }
425  if ( isset( $tip['accesskey'] ) && $tip['accesskey'] !== false ) {
426  $attrs['accesskey'] = $tip['accesskey'];
427  }
428  }
429  }
430  if ( isset( $options['link-class'] ) ) {
431  if ( isset( $attrs['class'] ) ) {
432  $attrs['class'] .= " {$options['link-class']}";
433  } else {
434  $attrs['class'] = $options['link-class'];
435  }
436  }
437  $html = Html::rawElement( isset( $attrs['href'] )
438  ? 'a'
439  : $options['link-fallback'], $attrs, $html );
440  }
441 
442  return $html;
443  }
444 
474  function makeListItem( $key, $item, $options = [] ) {
475  if ( isset( $item['links'] ) ) {
476  $links = [];
477  foreach ( $item['links'] as $linkKey => $link ) {
478  $links[] = $this->makeLink( $linkKey, $link, $options );
479  }
480  $html = implode( ' ', $links );
481  } else {
482  $link = $item;
483  // These keys are used by makeListItem and shouldn't be passed on to the link
484  foreach ( [ 'id', 'class', 'active', 'tag', 'itemtitle' ] as $k ) {
485  unset( $link[$k] );
486  }
487  if ( isset( $item['id'] ) && !isset( $item['single-id'] ) ) {
488  // The id goes on the <li> not on the <a> for single links
489  // but makeSidebarLink still needs to know what id to use when
490  // generating tooltips and accesskeys.
491  $link['single-id'] = $item['id'];
492  }
493  if ( isset( $link['link-class'] ) ) {
494  // link-class should be set on the <a> itself,
495  // so pass it in as 'class'
496  $link['class'] = $link['link-class'];
497  unset( $link['link-class'] );
498  }
499  $html = $this->makeLink( $key, $link, $options );
500  }
501 
502  $attrs = [];
503  foreach ( [ 'id', 'class' ] as $attr ) {
504  if ( isset( $item[$attr] ) ) {
505  $attrs[$attr] = $item[$attr];
506  }
507  }
508  if ( isset( $item['active'] ) && $item['active'] ) {
509  if ( !isset( $attrs['class'] ) ) {
510  $attrs['class'] = '';
511  }
512  $attrs['class'] .= ' active';
513  $attrs['class'] = trim( $attrs['class'] );
514  }
515  if ( isset( $item['itemtitle'] ) ) {
516  $attrs['title'] = $item['itemtitle'];
517  }
518  return Html::rawElement( isset( $options['tag'] ) ? $options['tag'] : 'li', $attrs, $html );
519  }
520 
521  function makeSearchInput( $attrs = [] ) {
522  $realAttrs = [
523  'type' => 'search',
524  'name' => 'search',
525  'placeholder' => wfMessage( 'searchsuggest-search' )->text(),
526  'value' => $this->get( 'search', '' ),
527  ];
528  $realAttrs = array_merge( $realAttrs, Linker::tooltipAndAccesskeyAttribs( 'search' ), $attrs );
529  return Html::element( 'input', $realAttrs );
530  }
531 
532  function makeSearchButton( $mode, $attrs = [] ) {
533  switch ( $mode ) {
534  case 'go':
535  case 'fulltext':
536  $realAttrs = [
537  'type' => 'submit',
538  'name' => $mode,
539  'value' => $this->translator->translate(
540  $mode == 'go' ? 'searcharticle' : 'searchbutton' ),
541  ];
542  $realAttrs = array_merge(
543  $realAttrs,
544  Linker::tooltipAndAccesskeyAttribs( "search-$mode" ),
545  $attrs
546  );
547  return Html::element( 'input', $realAttrs );
548  case 'image':
549  $buttonAttrs = [
550  'type' => 'submit',
551  'name' => 'button',
552  ];
553  $buttonAttrs = array_merge(
554  $buttonAttrs,
555  Linker::tooltipAndAccesskeyAttribs( 'search-fulltext' ),
556  $attrs
557  );
558  unset( $buttonAttrs['src'] );
559  unset( $buttonAttrs['alt'] );
560  unset( $buttonAttrs['width'] );
561  unset( $buttonAttrs['height'] );
562  $imgAttrs = [
563  'src' => $attrs['src'],
564  'alt' => isset( $attrs['alt'] )
565  ? $attrs['alt']
566  : $this->translator->translate( 'searchbutton' ),
567  'width' => isset( $attrs['width'] ) ? $attrs['width'] : null,
568  'height' => isset( $attrs['height'] ) ? $attrs['height'] : null,
569  ];
570  return Html::rawElement( 'button', $buttonAttrs, Html::element( 'img', $imgAttrs ) );
571  default:
572  throw new MWException( 'Unknown mode passed to BaseTemplate::makeSearchButton' );
573  }
574  }
575 
585  function getFooterLinks( $option = null ) {
586  $footerlinks = $this->get( 'footerlinks' );
587 
588  // Reduce footer links down to only those which are being used
589  $validFooterLinks = [];
590  foreach ( $footerlinks as $category => $links ) {
591  $validFooterLinks[$category] = [];
592  foreach ( $links as $link ) {
593  if ( isset( $this->data[$link] ) && $this->data[$link] ) {
594  $validFooterLinks[$category][] = $link;
595  }
596  }
597  if ( count( $validFooterLinks[$category] ) <= 0 ) {
598  unset( $validFooterLinks[$category] );
599  }
600  }
601 
602  if ( $option == 'flat' ) {
603  // fold footerlinks into a single array using a bit of trickery
604  $validFooterLinks = call_user_func_array(
605  'array_merge',
606  array_values( $validFooterLinks )
607  );
608  }
609 
610  return $validFooterLinks;
611  }
612 
625  function getFooterIcons( $option = null ) {
626  // Generate additional footer icons
627  $footericons = $this->get( 'footericons' );
628 
629  if ( $option == 'icononly' ) {
630  // Unset any icons which don't have an image
631  foreach ( $footericons as &$footerIconsBlock ) {
632  foreach ( $footerIconsBlock as $footerIconKey => $footerIcon ) {
633  if ( !is_string( $footerIcon ) && !isset( $footerIcon['src'] ) ) {
634  unset( $footerIconsBlock[$footerIconKey] );
635  }
636  }
637  }
638  // Redo removal of any empty blocks
639  foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) {
640  if ( count( $footerIconsBlock ) <= 0 ) {
641  unset( $footericons[$footerIconsKey] );
642  }
643  }
644  } elseif ( $option == 'nocopyright' ) {
645  unset( $footericons['copyright']['copyright'] );
646  if ( count( $footericons['copyright'] ) <= 0 ) {
647  unset( $footericons['copyright'] );
648  }
649  }
650 
651  return $footericons;
652  }
653 
663  protected function getFooter( $iconStyle = 'icononly', $linkStyle = 'flat' ) {
664  $validFooterIcons = $this->getFooterIcons( $iconStyle );
665  $validFooterLinks = $this->getFooterLinks( $linkStyle );
666 
667  $html = '';
668 
669  if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
670  $html .= Html::openElement( 'div', [
671  'id' => 'footer-bottom',
672  'role' => 'contentinfo',
673  'lang' => $this->get( 'userlang' ),
674  'dir' => $this->get( 'dir' )
675  ] );
676  $footerEnd = Html::closeElement( 'div' );
677  } else {
678  $footerEnd = '';
679  }
680  foreach ( $validFooterIcons as $blockName => $footerIcons ) {
681  $html .= Html::openElement( 'div', [
682  'id' => 'f-' . Sanitizer::escapeId( $blockName ) . 'ico',
683  'class' => 'footer-icons'
684  ] );
685  foreach ( $footerIcons as $icon ) {
686  $html .= $this->getSkin()->makeFooterIcon( $icon );
687  }
688  $html .= Html::closeElement( 'div' );
689  }
690  if ( count( $validFooterLinks ) > 0 ) {
691  $html .= Html::openElement( 'ul', [ 'id' => 'f-list', 'class' => 'footer-places' ] );
692  foreach ( $validFooterLinks as $aLink ) {
694  'li',
695  [ 'id' => Sanitizer::escapeId( $aLink ) ],
696  $this->get( $aLink )
697  );
698  }
699  $html .= Html::closeElement( 'ul' );
700  }
701 
702  $html .= $this->getClear() . $footerEnd;
703 
704  return $html;
705  }
706 
713  protected function getClear() {
714  return Html::element( 'div', [ 'class' => 'visualClear' ] );
715  }
716 
732  public function getIndicators() {
733  $out = "<div class=\"mw-indicators mw-body-content\">\n";
734  foreach ( $this->data['indicators'] as $id => $content ) {
736  'div',
737  [
738  'id' => Sanitizer::escapeId( "mw-indicator-$id" ),
739  'class' => 'mw-indicator',
740  ],
741  $content
742  ) . "\n";
743  }
744  $out .= "</div>\n";
745  return $out;
746  }
747 
751  function printTrail() {
752  echo $this->getTrail();
753  }
754 
763  function getTrail() {
765  $html .= $this->get( 'bottomscripts' );
766  $html .= $this->get( 'reporttime' );
767 
768  return $html;
769  }
770 }
BaseTemplate\getPersonalTools
getPersonalTools()
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.
Definition: BaseTemplate.php:131
BaseTemplate\getFooterLinks
getFooterLinks( $option=null)
Returns an array of footerlinks trimmed down to only those footer links that are valid.
Definition: BaseTemplate.php:585
BaseTemplate\msg
msg( $str)
Definition: BaseTemplate.php:39
BaseTemplate\msgWiki
msgWiki( $str)
An ugly, ugly hack.
Definition: BaseTemplate.php:47
$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
BaseTemplate\makeSearchButton
makeSearchButton( $mode, $attrs=[])
Definition: BaseTemplate.php:532
captcha-old.count
count
Definition: captcha-old.py:225
BaseTemplate\getClear
getClear()
Get a div with the core visualClear class, for clearing floats.
Definition: BaseTemplate.php:713
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:304
getContext
getContext()
QuickTemplate\getSkin
getSkin()
Get the Skin object related to this object.
Definition: QuickTemplate.php:173
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
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:309
$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:1956
MWException
MediaWiki exception.
Definition: MWException.php:26
$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:301
$content
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
Definition: hooks.txt:1049
BaseTemplate\printTrail
printTrail()
Output getTrail.
Definition: BaseTemplate.php:751
BaseTemplate\makeListItem
makeListItem( $key, $item, $options=[])
Generates a list item for a navigation, portlet, portal, sidebar...
Definition: BaseTemplate.php:474
BaseTemplate\getIndicators
getIndicators()
Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed i...
Definition: BaseTemplate.php:732
BaseTemplate\msgHtml
msgHtml( $str)
Definition: BaseTemplate.php:43
BaseTemplate\getFooter
getFooter( $iconStyle='icononly', $linkStyle='flat')
Renderer for getFooterIcons and getFooterLinks.
Definition: BaseTemplate.php:663
BaseTemplate\renderAfterPortlet
renderAfterPortlet( $name)
Definition: BaseTemplate.php:289
BaseTemplate\getMsg
getMsg( $name)
Get a Message object with its context set.
Definition: BaseTemplate.php:35
$value
$value
Definition: styleTest.css.php:45
Linker\tooltipAndAccesskeyAttribs
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[])
Returns the attributes for the tooltip and access key.
Definition: Linker.php:2096
BaseTemplate\makeSearchInput
makeSearchInput( $attrs=[])
Definition: BaseTemplate.php:521
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:1936
QuickTemplate
Generic wrapper for template functions, with interface compatible with what we use of PHPTAL 0....
Definition: QuickTemplate.php:27
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
BaseTemplate\getTrail
getTrail()
Get the basic end-page trail including bottomscripts, reporttime, and debug stuff.
Definition: BaseTemplate.php:763
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
$link
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:2929
BaseTemplate\makeLink
makeLink( $key, $item, $options=[])
Makes a link, usually used by makeListItem to generate a link for an item in a list used in navigatio...
Definition: BaseTemplate.php:369
$special
this hook is for auditing only RecentChangesLinked and Watchlist $special
Definition: hooks.txt:990
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
BaseTemplate\getFooterIcons
getFooterIcons( $option=null)
Returns an array of footer icons filtered down by options relevant to how the skin wishes to display ...
Definition: BaseTemplate.php:625
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
BaseTemplate
New base template for a skin's template extended from QuickTemplate this class features helper method...
Definition: BaseTemplate.php:26
$options
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
Definition: hooks.txt:1049
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
BaseTemplate\getSidebar
getSidebar( $options=[])
Definition: BaseTemplate.php:156
$out
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 see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition: hooks.txt:783