MediaWiki  1.33.0
InputBox.php
Go to the documentation of this file.
1 <?php
12 class InputBox {
13 
14  /* Fields */
15 
16  private $mParser;
17  private $mType = '';
18  private $mWidth = 50;
19  private $mPreload = null;
20  private $mPreloadparams = null;
21  private $mEditIntro = null;
22  private $mUseVE = null;
23  private $mSummary = null;
24  private $mNosummary = null;
25  private $mMinor = null;
26  private $mPage = '';
27  private $mBR = 'yes';
28  private $mDefaultText = '';
29  private $mPlaceholderText = '';
30  private $mBGColor = 'transparent';
31  private $mButtonLabel = '';
32  private $mSearchButtonLabel = '';
33  private $mFullTextButton = '';
34  private $mLabelText = '';
35  private $mHidden = '';
36  private $mNamespaces = '';
37  private $mID = '';
38  private $mInline = false;
39  private $mPrefix = '';
40  private $mDir = '';
41  private $mSearchFilter = '';
42  private $mTour = '';
43 
44  /* Functions */
45 
49  public function __construct( $parser ) {
50  $this->mParser = $parser;
51  // Default value for dir taken from the page language (bug 37018)
52  $this->mDir = $this->mParser->getTargetLanguage()->getDir();
53  // Split caches by language, to make sure visitors do not see a cached
54  // version in a random language (since labels are in the user language)
55  $this->mParser->getOptions()->getUserLangObj();
56  $this->mParser->getOutput()->addModuleStyles( [
57  'ext.inputBox.styles',
58  'mediawiki.ui.input',
59  'mediawiki.ui.checkbox',
60  ] );
61  }
62 
63  public function render() {
64  // Handle various types
65  switch ( $this->mType ) {
66  case 'create':
67  case 'comment':
68  $this->mParser->getOutput()->addModules( 'ext.inputBox' );
69  return $this->getCreateForm();
70  case 'move':
71  return $this->getMoveForm();
72  case 'commenttitle':
73  return $this->getCommentForm();
74  case 'search':
75  return $this->getSearchForm( 'search' );
76  case 'fulltext':
77  return $this->getSearchForm( 'fulltext' );
78  case 'search2':
79  return $this->getSearchForm2();
80  default:
81  return Xml::tags( 'div', null,
82  Xml::element( 'strong',
83  [ 'class' => 'error' ],
84  strlen( $this->mType ) > 0
85  ? wfMessage( 'inputbox-error-bad-type', $this->mType )->text()
86  : wfMessage( 'inputbox-error-no-type' )->text()
87  )
88  );
89  }
90  }
91 
99  private function getEditActionArgs() {
100  // default is wikitext editor
101  $args = [
102  'name' => 'action',
103  'value' => 'edit',
104  ];
105  // check, if VE is installed and VE editor is requested
106  if ( $this->shouldUseVE() ) {
107  $args = [
108  'name' => 'veaction',
109  'value' => 'edit',
110  ];
111  }
112  return $args;
113  }
114 
121  private function getLinebreakClasses() {
122  return strtolower( $this->mBR ) === '<br />' ? 'mw-inputbox-input ' : '';
123  }
124 
130  public function getSearchForm( $type ) {
132 
133  // Use button label fallbacks
134  if ( !$this->mButtonLabel ) {
135  $this->mButtonLabel = wfMessage( 'inputbox-tryexact' )->text();
136  }
137  if ( !$this->mSearchButtonLabel ) {
138  $this->mSearchButtonLabel = wfMessage( 'inputbox-searchfulltext' )->text();
139  }
140  if ( $this->mID !== '' ) {
141  $idArray = [ 'id' => Sanitizer::escapeIdForAttribute( $this->mID ) ];
142  } else {
143  $idArray = [];
144  }
145  // We need a unqiue id to link <label> to checkboxes, but also
146  // want multiple <inputbox>'s to not be invalid html
147  $idRandStr = Sanitizer::escapeIdForAttribute( '-' . $this->mID . wfRandom() );
148 
149  // Build HTML
150  $htmlOut = Xml::openElement( 'div',
151  [
152  'class' => 'mw-inputbox-centered',
153  'style' => $this->bgColorStyle(),
154  ]
155  );
156  $htmlOut .= Xml::openElement( 'form',
157  [
158  'name' => 'searchbox',
159  'class' => 'searchbox',
160  'action' => SpecialPage::getTitleFor( 'Search' )->getLocalUrl(),
161  ] + $idArray
162  );
163  $htmlOut .= Xml::element( 'input',
164  [
165  'class' => $this->getLinebreakClasses() . 'searchboxInput mw-ui-input mw-ui-input-inline',
166  'name' => 'search',
167  'type' => $this->mHidden ? 'hidden' : 'text',
168  'value' => $this->mDefaultText,
169  'placeholder' => $this->mPlaceholderText,
170  'size' => $this->mWidth,
171  'dir' => $this->mDir,
172  ]
173  );
174 
175  if ( $this->mPrefix != '' ) {
176  $htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
177  }
178 
179  if ( $this->mSearchFilter != '' ) {
180  $htmlOut .= Html::hidden( 'searchfilter', $this->mSearchFilter );
181  }
182 
183  if ( $this->mTour != '' ) {
184  $htmlOut .= Html::hidden( 'tour', $this->mTour );
185  }
186 
187  $htmlOut .= $this->mBR;
188 
189  // Determine namespace checkboxes
190  $namespacesArray = explode( ',', $this->mNamespaces );
191  if ( $this->mNamespaces ) {
192  $namespaces = $wgContLang->getNamespaces();
193  $nsAliases = array_merge( $wgContLang->getNamespaceAliases(), $wgNamespaceAliases );
194  $showNamespaces = [];
195  $checkedNS = [];
196  // Check for valid namespaces
197  foreach ( $namespacesArray as $userNS ) {
198  $userNS = trim( $userNS ); // no whitespace
199 
200  // Namespace needs to be checked if flagged with "**"
201  if ( strpos( $userNS, '**' ) ) {
202  $userNS = str_replace( '**', '', $userNS );
203  $checkedNS[$userNS] = true;
204  }
205 
206  $mainMsg = wfMessage( 'inputbox-ns-main' )->inContentLanguage()->text();
207  if ( $userNS == 'Main' || $userNS == $mainMsg ) {
208  $i = 0;
209  } elseif ( array_search( $userNS, $namespaces ) ) {
210  $i = array_search( $userNS, $namespaces );
211  } elseif ( isset( $nsAliases[$userNS] ) ) {
212  $i = $nsAliases[$userNS];
213  } else {
214  continue; // Namespace not recognized, skip
215  }
216  $showNamespaces[$i] = $userNS;
217  if ( isset( $checkedNS[$userNS] ) && $checkedNS[$userNS] ) {
218  $checkedNS[$i] = true;
219  }
220  }
221 
222  // Show valid namespaces
223  foreach ( $showNamespaces as $i => $name ) {
224  $checked = [];
225  // Namespace flagged with "**" or if it's the only one
226  if ( ( isset( $checkedNS[$i] ) && $checkedNS[$i] ) || count( $showNamespaces ) == 1 ) {
227  $checked = [ 'checked' => 'checked' ];
228  }
229 
230  if ( count( $showNamespaces ) == 1 ) {
231  // Checkbox
232  $htmlOut .= Xml::element( 'input',
233  [
234  'type' => 'hidden',
235  'name' => 'ns' . $i,
236  'value' => 1,
237  'id' => 'mw-inputbox-ns' . $i . $idRandStr
238  ] + $checked
239  );
240  } else {
241  // Checkbox
242  $htmlOut .= ' <div class="mw-inputbox-element mw-ui-checkbox">';
243  $htmlOut .= Xml::element( 'input',
244  [
245  'type' => 'checkbox',
246  'name' => 'ns' . $i,
247  'value' => 1,
248  'id' => 'mw-inputbox-ns' . $i . $idRandStr
249  ] + $checked
250  );
251  // Label
252  $htmlOut .= Xml::label( $name, 'mw-inputbox-ns' . $i . $idRandStr );
253  $htmlOut .= '</div> ';
254  }
255  }
256 
257  // Line break
258  $htmlOut .= $this->mBR;
259  } elseif ( $type == 'search' ) {
260  // Go button
261  $htmlOut .= Xml::element( 'input',
262  [
263  'type' => 'submit',
264  'name' => 'go',
265  'class' => 'mw-ui-button',
266  'value' => $this->mButtonLabel
267  ]
268  );
269  $htmlOut .= '&#160;';
270  }
271 
272  // Search button
273  $htmlOut .= Xml::element( 'input',
274  [
275  'type' => 'submit',
276  'name' => 'fulltext',
277  'class' => 'mw-ui-button',
278  'value' => $this->mSearchButtonLabel
279  ]
280  );
281 
282  // Hidden fulltext param for IE (bug 17161)
283  if ( $type == 'fulltext' ) {
284  $htmlOut .= Html::hidden( 'fulltext', 'Search' );
285  }
286 
287  $htmlOut .= Xml::closeElement( 'form' );
288  $htmlOut .= Xml::closeElement( 'div' );
289 
290  // Return HTML
291  return $htmlOut;
292  }
293 
298  public function getSearchForm2() {
299  // Use button label fallbacks
300  if ( !$this->mButtonLabel ) {
301  $this->mButtonLabel = wfMessage( 'inputbox-tryexact' )->text();
302  }
303 
304  if ( $this->mID !== '' ) {
305  $unescapedID = $this->mID;
306  } else {
307  // The label element needs a unique id, use
308  // random number to avoid multiple input boxes
309  // having conflicts.
310  $unescapedID = wfRandom();
311  }
312  $id = Sanitizer::escapeIdForAttribute( $unescapedID );
313  $htmlLabel = '';
314  if ( isset( $this->mLabelText ) && strlen( trim( $this->mLabelText ) ) ) {
315  $htmlLabel = Xml::openElement( 'label', [ 'for' => 'bodySearchInput' . $id ] );
316  $htmlLabel .= $this->mParser->recursiveTagParse( $this->mLabelText );
317  $htmlLabel .= Xml::closeElement( 'label' );
318  }
319  $htmlOut = Xml::openElement( 'form',
320  [
321  'name' => 'bodySearch' . $id,
322  'id' => 'bodySearch' . $id,
323  'class' => 'bodySearch' . ( $this->mInline ? ' mw-inputbox-inline' : '' ),
324  'action' => SpecialPage::getTitleFor( 'Search' )->getLocalUrl(),
325  ]
326  );
327  $htmlOut .= Xml::openElement( 'div',
328  [
329  'class' => 'bodySearchWrap' . ( $this->mInline ? ' mw-inputbox-inline' : '' ),
330  'style' => $this->bgColorStyle(),
331  ]
332  );
333  $htmlOut .= $htmlLabel;
334  $htmlOut .= Xml::element( 'input',
335  [
336  'type' => $this->mHidden ? 'hidden' : 'text',
337  'name' => 'search',
338  'class' => 'mw-ui-input mw-ui-input-inline',
339  'size' => $this->mWidth,
340  'id' => 'bodySearchInput' . $id,
341  'dir' => $this->mDir,
342  ]
343  );
344  $htmlOut .= '&#160;' . Xml::element( 'input',
345  [
346  'type' => 'submit',
347  'name' => 'go',
348  'value' => $this->mButtonLabel,
349  'class' => 'mw-ui-button',
350  ]
351  );
352 
353  // Better testing needed here!
354  if ( !empty( $this->mFullTextButton ) ) {
355  $htmlOut .= Xml::element( 'input',
356  [
357  'type' => 'submit',
358  'name' => 'fulltext',
359  'class' => 'mw-ui-button',
360  'value' => $this->mSearchButtonLabel
361  ]
362  );
363  }
364 
365  $htmlOut .= Xml::closeElement( 'div' );
366  $htmlOut .= Xml::closeElement( 'form' );
367 
368  // Return HTML
369  return $htmlOut;
370  }
371 
376  public function getCreateForm() {
377  global $wgScript;
378 
379  if ( $this->mType == "comment" ) {
380  if ( !$this->mButtonLabel ) {
381  $this->mButtonLabel = wfMessage( 'inputbox-postcomment' )->text();
382  }
383  } else {
384  if ( !$this->mButtonLabel ) {
385  $this->mButtonLabel = wfMessage( 'inputbox-createarticle' )->text();
386  }
387  }
388 
389  $htmlOut = Xml::openElement( 'div',
390  [
391  'class' => 'mw-inputbox-centered',
392  'style' => $this->bgColorStyle(),
393  ]
394  );
395  $createBoxParams = [
396  'name' => 'createbox',
397  'class' => 'createbox',
398  'action' => $wgScript,
399  'method' => 'get'
400  ];
401  if ( $this->mID !== '' ) {
402  $createBoxParams['id'] = Sanitizer::escapeIdForAttribute( $this->mID );
403  }
404  $htmlOut .= Xml::openElement( 'form', $createBoxParams );
405  $editArgs = $this->getEditActionArgs();
406  $htmlOut .= Html::hidden( $editArgs['name'], $editArgs['value'] );
407  if ( $this->mPreload !== null ) {
408  $htmlOut .= Html::hidden( 'preload', $this->mPreload );
409  }
410  if ( is_array( $this->mPreloadparams ) ) {
411  foreach ( $this->mPreloadparams as $preloadparams ) {
412  $htmlOut .= Html::hidden( 'preloadparams[]', $preloadparams );
413  }
414  }
415  if ( $this->mEditIntro !== null ) {
416  $htmlOut .= Html::hidden( 'editintro', $this->mEditIntro );
417  }
418  if ( $this->mSummary !== null ) {
419  $htmlOut .= Html::hidden( 'summary', $this->mSummary );
420  }
421  if ( $this->mNosummary !== null ) {
422  $htmlOut .= Html::hidden( 'nosummary', $this->mNosummary );
423  }
424  if ( $this->mPrefix !== '' ) {
425  $htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
426  }
427  if ( $this->mMinor !== null ) {
428  $htmlOut .= Html::hidden( 'minor', $this->mMinor );
429  }
430  if ( $this->mType == 'comment' ) {
431  $htmlOut .= Html::hidden( 'section', 'new' );
432  }
433  $htmlOut .= Xml::openElement( 'input',
434  [
435  'type' => $this->mHidden ? 'hidden' : 'text',
436  'name' => 'title',
437  'class' => $this->getLinebreakClasses() .
438  'mw-ui-input mw-ui-input-inline createboxInput',
439  'value' => $this->mDefaultText,
440  'placeholder' => $this->mPlaceholderText,
441  'size' => $this->mWidth,
442  'dir' => $this->mDir,
443  ]
444  );
445  $htmlOut .= $this->mBR;
446  $htmlOut .= Xml::openElement( 'input',
447  [
448  'type' => 'submit',
449  'name' => 'create',
450  'class' => 'mw-ui-button mw-ui-progressive createboxButton',
451  'value' => $this->mButtonLabel
452  ]
453  );
454  $htmlOut .= Xml::closeElement( 'form' );
455  $htmlOut .= Xml::closeElement( 'div' );
456 
457  // Return HTML
458  return $htmlOut;
459  }
460 
465  public function getMoveForm() {
466  global $wgScript;
467 
468  if ( !$this->mButtonLabel ) {
469  $this->mButtonLabel = wfMessage( 'inputbox-movearticle' )->text();
470  }
471 
472  $htmlOut = Xml::openElement( 'div',
473  [
474  'class' => 'mw-inputbox-centered',
475  'style' => $this->bgColorStyle(),
476  ]
477  );
478  $moveBoxParams = [
479  'name' => 'movebox',
480  'class' => 'mw-movebox',
481  'action' => $wgScript,
482  'method' => 'get'
483  ];
484  if ( $this->mID !== '' ) {
485  $moveBoxParams['id'] = Sanitizer::escapeIdForAttribute( $this->mID );
486  }
487  $htmlOut .= Xml::openElement( 'form', $moveBoxParams );
488  $htmlOut .= Html::hidden( 'title',
489  SpecialPage::getTitleFor( 'Movepage', $this->mPage )->getPrefixedText() );
490  $htmlOut .= Html::hidden( 'wpReason', $this->mSummary );
491  $htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
492  $htmlOut .= Xml::openElement( 'input',
493  [
494  'type' => $this->mHidden ? 'hidden' : 'text',
495  'name' => 'wpNewTitle',
496  'class' => $this->getLinebreakClasses() . 'mw-moveboxInput mw-ui-input mw-ui-input-inline',
497  'value' => $this->mDefaultText,
498  'placeholder' => $this->mPlaceholderText,
499  'size' => $this->mWidth,
500  'dir' => $this->mDir,
501  ]
502  );
503  $htmlOut .= $this->mBR;
504  $htmlOut .= Xml::openElement( 'input',
505  [
506  'type' => 'submit',
507  'class' => 'mw-ui-button mw-ui-progressive',
508  'value' => $this->mButtonLabel
509  ]
510  );
511  $htmlOut .= Xml::closeElement( 'form' );
512  $htmlOut .= Xml::closeElement( 'div' );
513 
514  // Return HTML
515  return $htmlOut;
516  }
517 
522  public function getCommentForm() {
523  global $wgScript;
524 
525  if ( !$this->mButtonLabel ) {
526  $this->mButtonLabel = wfMessage( 'inputbox-postcommenttitle' )->text();
527  }
528 
529  $htmlOut = Xml::openElement( 'div',
530  [
531  'class' => 'mw-inputbox-centered',
532  'style' => $this->bgColorStyle(),
533  ]
534  );
535  $commentFormParams = [
536  'name' => 'commentbox',
537  'class' => 'commentbox',
538  'action' => $wgScript,
539  'method' => 'get'
540  ];
541  if ( $this->mID !== '' ) {
542  $commentFormParams['id'] = Sanitizer::escapeIdForAttribute( $this->mID );
543  }
544  $htmlOut .= Xml::openElement( 'form', $commentFormParams );
545  $editArgs = $this->getEditActionArgs();
546  $htmlOut .= Html::hidden( $editArgs['name'], $editArgs['value'] );
547  if ( $this->mPreload !== null ) {
548  $htmlOut .= Html::hidden( 'preload', $this->mPreload );
549  }
550  if ( is_array( $this->mPreloadparams ) ) {
551  foreach ( $this->mPreloadparams as $preloadparams ) {
552  $htmlOut .= Html::hidden( 'preloadparams[]', $preloadparams );
553  }
554  }
555  if ( $this->mEditIntro !== null ) {
556  $htmlOut .= Html::hidden( 'editintro', $this->mEditIntro );
557  }
558  $htmlOut .= Xml::openElement( 'input',
559  [
560  'type' => $this->mHidden ? 'hidden' : 'text',
561  'name' => 'preloadtitle',
562  'class' => $this->getLinebreakClasses() . 'commentboxInput mw-ui-input mw-ui-input-inline',
563  'value' => $this->mDefaultText,
564  'placeholder' => $this->mPlaceholderText,
565  'size' => $this->mWidth,
566  'dir' => $this->mDir,
567  ]
568  );
569  $htmlOut .= Html::hidden( 'section', 'new' );
570  $htmlOut .= Html::hidden( 'title', $this->mPage );
571  $htmlOut .= $this->mBR;
572  $htmlOut .= Xml::openElement( 'input',
573  [
574  'type' => 'submit',
575  'name' => 'create',
576  'class' => 'mw-ui-button mw-ui-progressive',
577  'value' => $this->mButtonLabel
578  ]
579  );
580  $htmlOut .= Xml::closeElement( 'form' );
581  $htmlOut .= Xml::closeElement( 'div' );
582 
583  // Return HTML
584  return $htmlOut;
585  }
586 
592  public function extractOptions( $text ) {
593  // Parse all possible options
594  $values = [];
595  foreach ( explode( "\n", $text ) as $line ) {
596  if ( strpos( $line, '=' ) === false ) {
597  continue;
598  }
599  list( $name, $value ) = explode( '=', $line, 2 );
600  $name = strtolower( trim( $name ) );
601  $value = Sanitizer::decodeCharReferences( trim( $value ) );
602  if ( $name == 'preloadparams[]' ) {
603  // We have to special-case this one because it's valid for it to appear more than once.
604  $this->mPreloadparams[] = $value;
605  } else {
606  $values[ $name ] = $value;
607  }
608  }
609 
610  // Validate the dir value.
611  if ( isset( $values['dir'] ) && !in_array( $values['dir'], [ 'ltr', 'rtl' ] ) ) {
612  unset( $values['dir'] );
613  }
614 
615  // Build list of options, with local member names
616  $options = [
617  'type' => 'mType',
618  'width' => 'mWidth',
619  'preload' => 'mPreload',
620  'page' => 'mPage',
621  'editintro' => 'mEditIntro',
622  'useve' => 'mUseVE',
623  'summary' => 'mSummary',
624  'nosummary' => 'mNosummary',
625  'minor' => 'mMinor',
626  'break' => 'mBR',
627  'default' => 'mDefaultText',
628  'placeholder' => 'mPlaceholderText',
629  'bgcolor' => 'mBGColor',
630  'buttonlabel' => 'mButtonLabel',
631  'searchbuttonlabel' => 'mSearchButtonLabel',
632  'fulltextbutton' => 'mFullTextButton',
633  'namespaces' => 'mNamespaces',
634  'labeltext' => 'mLabelText',
635  'hidden' => 'mHidden',
636  'id' => 'mID',
637  'inline' => 'mInline',
638  'prefix' => 'mPrefix',
639  'dir' => 'mDir',
640  'searchfilter' => 'mSearchFilter',
641  'tour' => 'mTour'
642  ];
643  // Options we should maybe run through lang converter.
644  $convertOptions = [
645  'default' => true,
646  'buttonlabel' => true,
647  'searchbuttonlabel' => true,
648  'placeholder' => true
649  ];
650  foreach ( $options as $name => $var ) {
651  if ( isset( $values[$name] ) ) {
652  $this->$var = $values[$name];
653  if ( isset( $convertOptions[$name] ) ) {
654  $this->$var = $this->languageConvert( $this->$var );
655  }
656  }
657  }
658 
659  // Insert a line break if configured to do so
660  $this->mBR = ( strtolower( $this->mBR ) == "no" ) ? ' ' : '<br />';
661 
662  // Validate the width; make sure it's a valid, positive integer
663  $this->mWidth = intval( $this->mWidth <= 0 ? 50 : $this->mWidth );
664 
665  // Validate background color
666  if ( !$this->isValidColor( $this->mBGColor ) ) {
667  $this->mBGColor = 'transparent';
668  }
669  }
670 
676  public function isValidColor( $color ) {
677  $regex = <<<REGEX
678  /^ (
679  [a-zA-Z]* | # color names
680  \# [0-9a-f]{3} | # short hexadecimal
681  \# [0-9a-f]{6} | # long hexadecimal
682  rgb \s* \( \s* (
683  \d+ \s* , \s* \d+ \s* , \s* \d+ | # rgb integer
684  [0-9.]+% \s* , \s* [0-9.]+% \s* , \s* [0-9.]+% # rgb percent
685  ) \s* \)
686  ) $ /xi
687 REGEX;
688  return (bool)preg_match( $regex, $color );
689  }
690 
691  private function bgColorStyle() {
692  if ( $this->mBGColor != 'transparent' ) {
693  return 'background-color: ' . $this->mBGColor . ';';
694  }
695  return '';
696  }
697 
704  private function shouldUseVE() {
705  return ExtensionRegistry::getInstance()->isLoaded( 'VisualEditor' ) && $this->mUseVE !== null;
706  }
707 
724  private function languageConvert( $text ) {
725  $lang = $this->mParser->getTargetLanguage();
726  if ( $lang->hasVariants() && strpos( $text, '-{' ) !== false ) {
727  $text = $lang->convert( $text );
728  }
729  return $text;
730  }
731 }
InputBox\$mUseVE
$mUseVE
Definition: InputBox.php:22
InputBox\$mDefaultText
$mDefaultText
Definition: InputBox.php:28
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
InputBox\isValidColor
isValidColor( $color)
Do a security check on the bgcolor parameter.
Definition: InputBox.php:676
InputBox\$mHidden
$mHidden
Definition: InputBox.php:35
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:33
InputBox\bgColorStyle
bgColorStyle()
Definition: InputBox.php:691
Xml\label
static label( $label, $id, $attribs=[])
Convenience function to build an HTML form label.
Definition: Xml.php:358
captcha-old.count
count
Definition: captcha-old.py:249
InputBox\$mType
$mType
Definition: InputBox.php:17
$wgScript
$wgScript
The URL path to index.php.
Definition: DefaultSettings.php:186
InputBox\$mInline
$mInline
Definition: InputBox.php:38
$namespaces
namespace and then decline to actually register it & $namespaces
Definition: hooks.txt:925
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
a
</source > ! result< div class="mw-highlight mw-content-ltr" dir="ltr">< pre >< span ></span >< span class="kd"> var</span >< span class="nx"> a</span >< span class="p"></span ></pre ></div > ! end ! test Multiline< source/> in lists !input *< source > a b</source > *foo< source > a b</source > ! html< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! html tidy< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! end ! test Custom attributes !input< source lang="javascript" id="foo" class="bar" dir="rtl" style="font-size: larger;"> var a
Definition: parserTests.txt:85
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:108
InputBox\$mWidth
$mWidth
Definition: InputBox.php:18
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
InputBox
InputBox class.
Definition: InputBox.php:12
ExtensionRegistry\getInstance
static getInstance()
Definition: ExtensionRegistry.php:98
InputBox\$mPrefix
$mPrefix
Definition: InputBox.php:39
InputBox\getSearchForm
getSearchForm( $type)
Generate search form.
Definition: InputBox.php:130
InputBox\$mNosummary
$mNosummary
Definition: InputBox.php:24
InputBox\$mPreload
$mPreload
Definition: InputBox.php:19
InputBox\$mTour
$mTour
Definition: InputBox.php:42
InputBox\getLinebreakClasses
getLinebreakClasses()
Get common classes, that could be added and depend on, if a line break between a button and an input ...
Definition: InputBox.php:121
InputBox\getEditActionArgs
getEditActionArgs()
Returns the action name and value to use in inputboxes which redirects to edit pages.
Definition: InputBox.php:99
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:41
div
div
Definition: parserTests.txt:6850
$parser
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
Definition: hooks.txt:1802
InputBox\$mNamespaces
$mNamespaces
Definition: InputBox.php:36
InputBox\$mPage
$mPage
Definition: InputBox.php:26
InputBox\getCommentForm
getCommentForm()
Generate new section form.
Definition: InputBox.php:522
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
InputBox\render
render()
Definition: InputBox.php:63
InputBox\getSearchForm2
getSearchForm2()
Generate search form version 2.
Definition: InputBox.php:298
InputBox\getCreateForm
getCreateForm()
Generate create page form.
Definition: InputBox.php:376
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
$line
$line
Definition: cdb.php:59
$wgNamespaceAliases
$wgNamespaceAliases
Namespace aliases.
Definition: DefaultSettings.php:3878
InputBox\$mSearchButtonLabel
$mSearchButtonLabel
Definition: InputBox.php:32
$value
$value
Definition: styleTest.css.php:49
InputBox\getMoveForm
getMoveForm()
Generate move page form.
Definition: InputBox.php:465
InputBox\$mSearchFilter
$mSearchFilter
Definition: InputBox.php:41
InputBox\$mBR
$mBR
Definition: InputBox.php:27
InputBox\$mMinor
$mMinor
Definition: InputBox.php:25
Xml\tags
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:130
title
title
Definition: parserTests.txt:245
InputBox\$mSummary
$mSummary
Definition: InputBox.php:23
InputBox\$mButtonLabel
$mButtonLabel
Definition: InputBox.php:31
InputBox\__construct
__construct( $parser)
Definition: InputBox.php:49
InputBox\$mPreloadparams
$mPreloadparams
Definition: InputBox.php:20
style
Bar style
Definition: parserTests.txt:218
text
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
Definition: All_system_messages.txt:1267
$args
if( $line===false) $args
Definition: cdb.php:64
wfRandom
wfRandom()
Get a random decimal value in the domain of [0, 1), in a way not likely to give duplicate values for ...
Definition: GlobalFunctions.php:280
Image
! test dummy test ! input< imagemap > Image
Definition: imageMapParserTests.txt:8
Xml\closeElement
static closeElement( $element)
Shortcut to close an XML element.
Definition: Xml.php:117
InputBox\$mDir
$mDir
Definition: InputBox.php:40
$options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:1985
InputBox\$mFullTextButton
$mFullTextButton
Definition: InputBox.php:33
InputBox\$mID
$mID
Definition: InputBox.php:37
color
in the sidebar</td >< td > font color
Definition: All_system_messages.txt:425
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
InputBox\languageConvert
languageConvert( $text)
For compatability with pre T119158 behaviour.
Definition: InputBox.php:724
true
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 true
Definition: hooks.txt:1985
width
width
Definition: parserTests.txt:189
InputBox\$mBGColor
$mBGColor
Definition: InputBox.php:30
InputBox\$mEditIntro
$mEditIntro
Definition: InputBox.php:21
InputBox\extractOptions
extractOptions( $text)
Extract options from a blob of text.
Definition: InputBox.php:592
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 use $formDescriptor instead 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
InputBox\$mPlaceholderText
$mPlaceholderText
Definition: InputBox.php:29
$wgContLang
$wgContLang
Definition: Setup.php:790
InputBox\shouldUseVE
shouldUseVE()
Returns true, if the VisualEditor is requested from the inputbox wikitext definition and if the Visua...
Definition: InputBox.php:704
InputBox\$mLabelText
$mLabelText
Definition: InputBox.php:34
href
shown</td >< td > a href
Definition: All_system_messages.txt:2667
names
alter the names
Definition: COPYING.txt:329
$type
$type
Definition: testCompression.php:48
InputBox\$mParser
$mParser
Definition: InputBox.php:16