MediaWiki  1.30.0
InputBox.classes.php
Go to the documentation of this file.
1 <?php
9 // InputBox class
10 class InputBox {
11 
12  /* Fields */
13 
14  private $mParser;
15  private $mType = '';
16  private $mWidth = 50;
17  private $mPreload = null;
18  private $mPreloadparams = null;
19  private $mEditIntro = null;
20  private $mUseVE = null;
21  private $mSummary = null;
22  private $mNosummary = null;
23  private $mMinor = null;
24  private $mPage = '';
25  private $mBR = 'yes';
26  private $mDefaultText = '';
27  private $mPlaceholderText = '';
28  private $mBGColor = 'transparent';
29  private $mButtonLabel = '';
30  private $mSearchButtonLabel = '';
31  private $mFullTextButton = '';
32  private $mLabelText = '';
33  private $mHidden = '';
34  private $mNamespaces = '';
35  private $mID = '';
36  private $mInline = false;
37  private $mPrefix = '';
38  private $mDir = '';
39  private $mSearchFilter = '';
40  private $mTour = '';
41 
42  /* Functions */
43 
44  public function __construct( $parser ) {
45  $this->mParser = $parser;
46  // Default value for dir taken from the page language (bug 37018)
47  $this->mDir = $this->mParser->getTargetLanguage()->getDir();
48  // Split caches by language, to make sure visitors do not see a cached
49  // version in a random language (since labels are in the user language)
50  $this->mParser->getOptions()->getUserLangObj();
51  $this->mParser->getOutput()->addModuleStyles( [
52  'ext.inputBox.styles',
53  'mediawiki.ui.input',
54  'mediawiki.ui.checkbox',
55  ] );
56  }
57 
58  public function render() {
59  // Handle various types
60  switch ( $this->mType ) {
61  case 'create':
62  case 'comment':
63  $this->mParser->getOutput()->addModules( 'ext.inputBox' );
64  return $this->getCreateForm();
65  case 'move':
66  return $this->getMoveForm();
67  case 'commenttitle':
68  return $this->getCommentForm();
69  case 'search':
70  return $this->getSearchForm( 'search' );
71  case 'fulltext':
72  return $this->getSearchForm( 'fulltext' );
73  case 'search2':
74  return $this->getSearchForm2();
75  default:
76  return Xml::tags( 'div', null,
77  Xml::element( 'strong',
78  [ 'class' => 'error' ],
79  strlen( $this->mType ) > 0
80  ? wfMessage( 'inputbox-error-bad-type', $this->mType )->text()
81  : wfMessage( 'inputbox-error-no-type' )->text()
82  )
83  );
84  }
85  }
86 
87  /*
88  * Returns the action name and value to use in inputboxes which redirects to edit pages.
89  * Decides, if the link should redirect to VE edit page (veaction=edit) or to wikitext editor
90  * (action=edit).
91  *
92  * @return Array Array with name and value data
93  */
94  private function getEditActionArgs() {
95  // default is wikitext editor
96  $args = [
97  'name' => 'action',
98  'value' => 'edit',
99  ];
100  // check, if VE is installed and VE editor is requested
101  if ( $this->shouldUseVE() ) {
102  $args = [
103  'name' => 'veaction',
104  'value' => 'edit',
105  ];
106  }
107  return $args;
108  }
109 
116  private function getLinebreakClasses() {
117  return strtolower( $this->mBR ) === '<br />' ? 'mw-inputbox-input ' : '';
118  }
119 
125  public function getSearchForm( $type ) {
127 
128  // Use button label fallbacks
129  if ( !$this->mButtonLabel ) {
130  $this->mButtonLabel = wfMessage( 'inputbox-tryexact' )->text();
131  }
132  if ( !$this->mSearchButtonLabel ) {
133  $this->mSearchButtonLabel = wfMessage( 'inputbox-searchfulltext' )->text();
134  }
135  if ( $this->mID !== '' ) {
136  $idArray = [ 'id' => Sanitizer::escapeId( $this->mID ) ];
137  } else {
138  $idArray = [];
139  }
140  // We need a unqiue id to link <label> to checkboxes, but also
141  // want multiple <inputbox>'s to not be invalid html
142  $idRandStr = Sanitizer::escapeId( '-' . $this->mID . wfRandom(), 'noninitial' );
143 
144  // Build HTML
145  $htmlOut = Xml::openElement( 'div',
146  [
147  'class' => 'mw-inputbox-centered',
148  'style' => $this->bgColorStyle(),
149  ]
150  );
151  $htmlOut .= Xml::openElement( 'form',
152  [
153  'name' => 'searchbox',
154  'class' => 'searchbox',
155  'action' => SpecialPage::getTitleFor( 'Search' )->getLocalUrl(),
156  ] + $idArray
157  );
158  $htmlOut .= Xml::element( 'input',
159  [
160  'class' => $this->getLinebreakClasses() . 'searchboxInput mw-ui-input mw-ui-input-inline',
161  'name' => 'search',
162  'type' => $this->mHidden ? 'hidden' : 'text',
163  'value' => $this->mDefaultText,
164  'placeholder' => $this->mPlaceholderText,
165  'size' => $this->mWidth,
166  'dir' => $this->mDir,
167  ]
168  );
169 
170  if ( $this->mPrefix != '' ) {
171  $htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
172  }
173 
174  if ( $this->mSearchFilter != '' ) {
175  $htmlOut .= Html::hidden( 'searchfilter', $this->mSearchFilter );
176  }
177 
178  if ( $this->mTour != '' ) {
179  $htmlOut .= Html::hidden( 'tour', $this->mTour );
180  }
181 
182  $htmlOut .= $this->mBR;
183 
184  // Determine namespace checkboxes
185  $namespacesArray = explode( ',', $this->mNamespaces );
186  if ( $this->mNamespaces ) {
187  $namespaces = $wgContLang->getNamespaces();
188  $nsAliases = array_merge( $wgContLang->getNamespaceAliases(), $wgNamespaceAliases );
189  $showNamespaces = [];
190  $checkedNS = [];
191  // Check for valid namespaces
192  foreach ( $namespacesArray as $userNS ) {
193  $userNS = trim( $userNS ); // no whitespace
194 
195  // Namespace needs to be checked if flagged with "**"
196  if ( strpos( $userNS, '**' ) ) {
197  $userNS = str_replace( '**', '', $userNS );
198  $checkedNS[$userNS] = true;
199  }
200 
201  $mainMsg = wfMessage( 'inputbox-ns-main' )->inContentLanguage()->text();
202  if ( $userNS == 'Main' || $userNS == $mainMsg ) {
203  $i = 0;
204  } elseif ( array_search( $userNS, $namespaces ) ) {
205  $i = array_search( $userNS, $namespaces );
206  } elseif ( isset( $nsAliases[$userNS] ) ) {
207  $i = $nsAliases[$userNS];
208  } else {
209  continue; // Namespace not recognized, skip
210  }
211  $showNamespaces[$i] = $userNS;
212  if ( isset( $checkedNS[$userNS] ) && $checkedNS[$userNS] ) {
213  $checkedNS[$i] = true;
214  }
215  }
216 
217  // Show valid namespaces
218  foreach ( $showNamespaces as $i => $name ) {
219  $checked = [];
220  // Namespace flagged with "**" or if it's the only one
221  if ( ( isset( $checkedNS[$i] ) && $checkedNS[$i] ) || count( $showNamespaces ) == 1 ) {
222  $checked = [ 'checked' => 'checked' ];
223  }
224 
225  if ( count( $showNamespaces ) == 1 ) {
226  // Checkbox
227  $htmlOut .= Xml::element( 'input',
228  [
229  'type' => 'hidden',
230  'name' => 'ns' . $i,
231  'value' => 1,
232  'id' => 'mw-inputbox-ns' . $i . $idRandStr
233  ] + $checked
234  );
235  } else {
236  // Checkbox
237  $htmlOut .= ' <div class="mw-inputbox-element mw-ui-checkbox">';
238  $htmlOut .= Xml::element( 'input',
239  [
240  'type' => 'checkbox',
241  'name' => 'ns' . $i,
242  'value' => 1,
243  'id' => 'mw-inputbox-ns' . $i . $idRandStr
244  ] + $checked
245  );
246  // Label
247  $htmlOut .= Xml::label( $name, 'mw-inputbox-ns' . $i . $idRandStr );
248  $htmlOut .= '</div> ';
249  }
250  }
251 
252  // Line break
253  $htmlOut .= $this->mBR;
254  } elseif ( $type == 'search' ) {
255  // Go button
256  $htmlOut .= Xml::element( 'input',
257  [
258  'type' => 'submit',
259  'name' => 'go',
260  'class' => 'mw-ui-button',
261  'value' => $this->mButtonLabel
262  ]
263  );
264  $htmlOut .= '&#160;';
265  }
266 
267  // Search button
268  $htmlOut .= Xml::element( 'input',
269  [
270  'type' => 'submit',
271  'name' => 'fulltext',
272  'class' => 'mw-ui-button',
273  'value' => $this->mSearchButtonLabel
274  ]
275  );
276 
277  // Hidden fulltext param for IE (bug 17161)
278  if ( $type == 'fulltext' ) {
279  $htmlOut .= Html::hidden( 'fulltext', 'Search' );
280  }
281 
282  $htmlOut .= Xml::closeElement( 'form' );
283  $htmlOut .= Xml::closeElement( 'div' );
284 
285  // Return HTML
286  return $htmlOut;
287  }
288 
292  public function getSearchForm2() {
293  // Use button label fallbacks
294  if ( !$this->mButtonLabel ) {
295  $this->mButtonLabel = wfMessage( 'inputbox-tryexact' )->text();
296  }
297 
298  if ( $this->mID !== '' ) {
299  $unescapedID = $this->mID;
300  } else {
301  // The label element needs a unique id, use
302  // random number to avoid multiple input boxes
303  // having conflicts.
304  $unescapedID = wfRandom();
305  }
306  $id = Sanitizer::escapeId( $unescapedID, 'noninitial' );
307  $htmlLabel = '';
308  if ( isset( $this->mLabelText ) && strlen( trim( $this->mLabelText ) ) ) {
309  $this->mLabelText = $this->mParser->recursiveTagParse( $this->mLabelText );
310  $htmlLabel = Xml::openElement( 'label', [ 'for' => 'bodySearchInput' . $id ] );
311  $htmlLabel .= $this->mLabelText;
312  $htmlLabel .= Xml::closeElement( 'label' );
313  }
314  $htmlOut = Xml::openElement( 'form',
315  [
316  'name' => 'bodySearch' . $id,
317  'id' => 'bodySearch' . $id,
318  'class' => 'bodySearch' . ( $this->mInline ? ' mw-inputbox-inline' : '' ),
319  'action' => SpecialPage::getTitleFor( 'Search' )->getLocalUrl(),
320  ]
321  );
322  $htmlOut .= Xml::openElement( 'div',
323  [
324  'class' => 'bodySearchWrap' . ( $this->mInline ? ' mw-inputbox-inline' : '' ),
325  'style' => $this->bgColorStyle(),
326  ]
327  );
328  $htmlOut .= $htmlLabel;
329  $htmlOut .= Xml::element( 'input',
330  [
331  'type' => $this->mHidden ? 'hidden' : 'text',
332  'name' => 'search',
333  'class' => 'mw-ui-input mw-ui-input-inline',
334  'size' => $this->mWidth,
335  'id' => 'bodySearchInput' . $id,
336  'dir' => $this->mDir,
337  ]
338  );
339  $htmlOut .= '&#160;' . Xml::element( 'input',
340  [
341  'type' => 'submit',
342  'name' => 'go',
343  'value' => $this->mButtonLabel,
344  'class' => 'mw-ui-button',
345  ]
346  );
347 
348  // Better testing needed here!
349  if ( !empty( $this->mFullTextButton ) ) {
350  $htmlOut .= Xml::element( 'input',
351  [
352  'type' => 'submit',
353  'name' => 'fulltext',
354  'class' => 'mw-ui-button',
355  'value' => $this->mSearchButtonLabel
356  ]
357  );
358  }
359 
360  $htmlOut .= Xml::closeElement( 'div' );
361  $htmlOut .= Xml::closeElement( 'form' );
362 
363  // Return HTML
364  return $htmlOut;
365  }
366 
370  public function getCreateForm() {
372 
373  if ( $this->mType == "comment" ) {
374  if ( !$this->mButtonLabel ) {
375  $this->mButtonLabel = wfMessage( 'inputbox-postcomment' )->text();
376  }
377  } else {
378  if ( !$this->mButtonLabel ) {
379  $this->mButtonLabel = wfMessage( 'inputbox-createarticle' )->text();
380  }
381  }
382 
383  $htmlOut = Xml::openElement( 'div',
384  [
385  'class' => 'mw-inputbox-centered',
386  'style' => $this->bgColorStyle(),
387  ]
388  );
389  $createBoxParams = [
390  'name' => 'createbox',
391  'class' => 'createbox',
392  'action' => $wgScript,
393  'method' => 'get'
394  ];
395  if ( $this->mID !== '' ) {
396  $createBoxParams['id'] = Sanitizer::escapeId( $this->mID );
397  }
398  $htmlOut .= Xml::openElement( 'form', $createBoxParams );
399  $editArgs = $this->getEditActionArgs();
400  $htmlOut .= Html::hidden( $editArgs['name'], $editArgs['value'] );
401  if ( $this->mPreload !== null ) {
402  $htmlOut .= Html::hidden( 'preload', $this->mPreload );
403  }
404  if ( is_array( $this->mPreloadparams ) ) {
405  foreach ( $this->mPreloadparams as $preloadparams ) {
406  $htmlOut .= Html::hidden( 'preloadparams[]', $preloadparams );
407  }
408  }
409  if ( $this->mEditIntro !== null ) {
410  $htmlOut .= Html::hidden( 'editintro', $this->mEditIntro );
411  }
412  if ( $this->mSummary !== null ) {
413  $htmlOut .= Html::hidden( 'summary', $this->mSummary );
414  }
415  if ( $this->mNosummary !== null ) {
416  $htmlOut .= Html::hidden( 'nosummary', $this->mNosummary );
417  }
418  if ( $this->mPrefix !== '' ) {
419  $htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
420  }
421  if ( $this->mMinor !== null ) {
422  $htmlOut .= Html::hidden( 'minor', $this->mMinor );
423  }
424  if ( $this->mType == 'comment' ) {
425  $htmlOut .= Html::hidden( 'section', 'new' );
426  }
427  $htmlOut .= Xml::openElement( 'input',
428  [
429  'type' => $this->mHidden ? 'hidden' : 'text',
430  'name' => 'title',
431  'class' => $this->getLinebreakClasses() .
432  'mw-ui-input mw-ui-input-inline createboxInput',
433  'value' => $this->mDefaultText,
434  'placeholder' => $this->mPlaceholderText,
435  'size' => $this->mWidth,
436  'dir' => $this->mDir,
437  ]
438  );
439  $htmlOut .= $this->mBR;
440  $htmlOut .= Xml::openElement( 'input',
441  [
442  'type' => 'submit',
443  'name' => 'create',
444  'class' => 'mw-ui-button mw-ui-progressive createboxButton',
445  'value' => $this->mButtonLabel
446  ]
447  );
448  $htmlOut .= Xml::closeElement( 'form' );
449  $htmlOut .= Xml::closeElement( 'div' );
450 
451  // Return HTML
452  return $htmlOut;
453  }
454 
458  public function getMoveForm() {
460 
461  if ( !$this->mButtonLabel ) {
462  $this->mButtonLabel = wfMessage( 'inputbox-movearticle' )->text();
463  }
464 
465  $htmlOut = Xml::openElement( 'div',
466  [
467  'class' => 'mw-inputbox-centered',
468  'style' => $this->bgColorStyle(),
469  ]
470  );
471  $moveBoxParams = [
472  'name' => 'movebox',
473  'class' => 'mw-movebox',
474  'action' => $wgScript,
475  'method' => 'get'
476  ];
477  if ( $this->mID !== '' ) {
478  $moveBoxParams['id'] = Sanitizer::escapeId( $this->mID );
479  }
480  $htmlOut .= Xml::openElement( 'form', $moveBoxParams );
481  $htmlOut .= Html::hidden( 'title',
482  SpecialPage::getTitleFor( 'Movepage', $this->mPage )->getPrefixedText() );
483  $htmlOut .= Html::hidden( 'wpReason', $this->mSummary );
484  $htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
485  $htmlOut .= Xml::openElement( 'input',
486  [
487  'type' => $this->mHidden ? 'hidden' : 'text',
488  'name' => 'wpNewTitle',
489  'class' => $this->getLinebreakClasses() . 'mw-moveboxInput mw-ui-input mw-ui-input-inline',
490  'value' => $this->mDefaultText,
491  'placeholder' => $this->mPlaceholderText,
492  'size' => $this->mWidth,
493  'dir' => $this->mDir,
494  ]
495  );
496  $htmlOut .= $this->mBR;
497  $htmlOut .= Xml::openElement( 'input',
498  [
499  'type' => 'submit',
500  'class' => 'mw-ui-button mw-ui-progressive',
501  'value' => $this->mButtonLabel
502  ]
503  );
504  $htmlOut .= Xml::closeElement( 'form' );
505  $htmlOut .= Xml::closeElement( 'div' );
506 
507  // Return HTML
508  return $htmlOut;
509  }
510 
514  public function getCommentForm() {
516 
517  if ( !$this->mButtonLabel ) {
518  $this->mButtonLabel = wfMessage( 'inputbox-postcommenttitle' )->text();
519  }
520 
521  $htmlOut = Xml::openElement( 'div',
522  [
523  'class' => 'mw-inputbox-centered',
524  'style' => $this->bgColorStyle(),
525  ]
526  );
527  $commentFormParams = [
528  'name' => 'commentbox',
529  'class' => 'commentbox',
530  'action' => $wgScript,
531  'method' => 'get'
532  ];
533  if ( $this->mID !== '' ) {
534  $commentFormParams['id'] = Sanitizer::escapeId( $this->mID );
535  }
536  $htmlOut .= Xml::openElement( 'form', $commentFormParams );
537  $editArgs = $this->getEditActionArgs();
538  $htmlOut .= Html::hidden( $editArgs['name'], $editArgs['value'] );
539  if ( $this->mPreload !== null ) {
540  $htmlOut .= Html::hidden( 'preload', $this->mPreload );
541  }
542  if ( is_array( $this->mPreloadparams ) ) {
543  foreach ( $this->mPreloadparams as $preloadparams ) {
544  $htmlOut .= Html::hidden( 'preloadparams[]', $preloadparams );
545  }
546  }
547  if ( $this->mEditIntro !== null ) {
548  $htmlOut .= Html::hidden( 'editintro', $this->mEditIntro );
549  }
550  $htmlOut .= Xml::openElement( 'input',
551  [
552  'type' => $this->mHidden ? 'hidden' : 'text',
553  'name' => 'preloadtitle',
554  'class' => $this->getLinebreakClasses() . 'commentboxInput mw-ui-input mw-ui-input-inline',
555  'value' => $this->mDefaultText,
556  'placeholder' => $this->mPlaceholderText,
557  'size' => $this->mWidth,
558  'dir' => $this->mDir,
559  ]
560  );
561  $htmlOut .= Html::hidden( 'section', 'new' );
562  $htmlOut .= Html::hidden( 'title', $this->mPage );
563  $htmlOut .= $this->mBR;
564  $htmlOut .= Xml::openElement( 'input',
565  [
566  'type' => 'submit',
567  'name' => 'create',
568  'class' => 'mw-ui-button mw-ui-progressive',
569  'value' => $this->mButtonLabel
570  ]
571  );
572  $htmlOut .= Xml::closeElement( 'form' );
573  $htmlOut .= Xml::closeElement( 'div' );
574 
575  // Return HTML
576  return $htmlOut;
577  }
578 
584  public function extractOptions( $text ) {
585  // Parse all possible options
586  $values = [];
587  foreach ( explode( "\n", $text ) as $line ) {
588  if ( strpos( $line, '=' ) === false ) {
589  continue;
590  }
591  list( $name, $value ) = explode( '=', $line, 2 );
592  $name = strtolower( trim( $name ) );
593  $value = Sanitizer::decodeCharReferences( trim( $value ) );
594  if ( $name == 'preloadparams[]' ) {
595  // We have to special-case this one because it's valid for it to appear more than once.
596  $this->mPreloadparams[] = $value;
597  } else {
598  $values[ $name ] = $value;
599  }
600  }
601 
602  // Validate the dir value.
603  if ( isset( $values['dir'] ) && !in_array( $values['dir'], [ 'ltr', 'rtl' ] ) ) {
604  unset( $values['dir'] );
605  }
606 
607  // Build list of options, with local member names
608  $options = [
609  'type' => 'mType',
610  'width' => 'mWidth',
611  'preload' => 'mPreload',
612  'page' => 'mPage',
613  'editintro' => 'mEditIntro',
614  'useve' => 'mUseVE',
615  'summary' => 'mSummary',
616  'nosummary' => 'mNosummary',
617  'minor' => 'mMinor',
618  'break' => 'mBR',
619  'default' => 'mDefaultText',
620  'placeholder' => 'mPlaceholderText',
621  'bgcolor' => 'mBGColor',
622  'buttonlabel' => 'mButtonLabel',
623  'searchbuttonlabel' => 'mSearchButtonLabel',
624  'fulltextbutton' => 'mFullTextButton',
625  'namespaces' => 'mNamespaces',
626  'labeltext' => 'mLabelText',
627  'hidden' => 'mHidden',
628  'id' => 'mID',
629  'inline' => 'mInline',
630  'prefix' => 'mPrefix',
631  'dir' => 'mDir',
632  'searchfilter' => 'mSearchFilter',
633  'tour' => 'mTour'
634  ];
635  // Options we should maybe run through lang converter.
636  $convertOptions = [
637  'default' => true,
638  'buttonlabel' => true,
639  'searchbuttonlabel' => true,
640  'placeholder' => true
641  ];
642  foreach ( $options as $name => $var ) {
643  if ( isset( $values[$name] ) ) {
644  $this->$var = $values[$name];
645  if ( isset( $convertOptions[$name] ) ) {
646  $this->$var = $this->languageConvert( $this->$var );
647  }
648  }
649  }
650 
651  // Insert a line break if configured to do so
652  $this->mBR = ( strtolower( $this->mBR ) == "no" ) ? ' ' : '<br />';
653 
654  // Validate the width; make sure it's a valid, positive integer
655  $this->mWidth = intval( $this->mWidth <= 0 ? 50 : $this->mWidth );
656 
657  // Validate background color
658  if ( !$this->isValidColor( $this->mBGColor ) ) {
659  $this->mBGColor = 'transparent';
660  }
661  }
662 
666  public function isValidColor( $color ) {
667  $regex = <<<REGEX
668  /^ (
669  [a-zA-Z]* | # color names
670  \# [0-9a-f]{3} | # short hexadecimal
671  \# [0-9a-f]{6} | # long hexadecimal
672  rgb \s* \( \s* (
673  \d+ \s* , \s* \d+ \s* , \s* \d+ | # rgb integer
674  [0-9.]+% \s* , \s* [0-9.]+% \s* , \s* [0-9.]+% # rgb percent
675  ) \s* \)
676  ) $ /xi
677 REGEX;
678  return (bool)preg_match( $regex, $color );
679  }
680 
681  private function bgColorStyle() {
682  if ( $this->mBGColor != 'transparent' ) {
683  return 'background-color: ' . $this->mBGColor . ';';
684  }
685  return '';
686  }
687 
694  private function shouldUseVE() {
695  return ExtensionRegistry::getInstance()->isLoaded( 'VisualEditor' ) && $this->mUseVE !== null;
696  }
697 
712  private function languageConvert( $text ) {
713  $lang = $this->mParser->getConverterLanguage();
714  if ( $lang->hasVariants() && strpos( $text, '-{' ) !== false ) {
715  $text = $lang->convert( $text );
716  }
717  return $text;
718  }
719 }
InputBox::$mUseVE
$mUseVE
Definition: InputBox.classes.php:20
InputBox::$mDefaultText
$mDefaultText
Definition: InputBox.classes.php:26
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.classes.php:666
Xml\tags
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
InputBox::$mHidden
$mHidden
Definition: InputBox.classes.php:33
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:33
InputBox::bgColorStyle
bgColorStyle()
Definition: InputBox.classes.php:681
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.classes.php:15
text
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
$wgScript
$wgScript
The URL path to index.php.
Definition: DefaultSettings.php:202
InputBox::$mInline
$mInline
Definition: InputBox.classes.php:36
$namespaces
namespace and then decline to actually register it & $namespaces
Definition: hooks.txt:932
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
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
names
alter the names
Definition: COPYING.txt:329
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
InputBox::$mWidth
$mWidth
Definition: InputBox.classes.php:16
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
Definition: InputBox.classes.php:10
ExtensionRegistry\getInstance
static getInstance()
Definition: ExtensionRegistry.php:80
title
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
Definition: All_system_messages.txt:2696
InputBox::$mPrefix
$mPrefix
Definition: InputBox.classes.php:37
InputBox::getSearchForm
getSearchForm( $type)
Generate search form.
Definition: InputBox.classes.php:125
InputBox::$mNosummary
$mNosummary
Definition: InputBox.classes.php:22
InputBox::$mPreload
$mPreload
Definition: InputBox.classes.php:17
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:89
InputBox::$mTour
$mTour
Definition: InputBox.classes.php:40
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.classes.php:116
InputBox::getEditActionArgs
getEditActionArgs()
Definition: InputBox.classes.php:94
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:39
$parser
do that in ParserLimitReportFormat instead $parser
Definition: hooks.txt:2572
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
InputBox::$mNamespaces
$mNamespaces
Definition: InputBox.classes.php:34
InputBox::$mPage
$mPage
Definition: InputBox.classes.php:24
InputBox::getCommentForm
getCommentForm()
Generate new section form.
Definition: InputBox.classes.php:514
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.classes.php:58
InputBox::getSearchForm2
getSearchForm2()
Generate search form version 2.
Definition: InputBox.classes.php:292
InputBox::getCreateForm
getCreateForm()
Generate create page form.
Definition: InputBox.classes.php:370
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:725
$line
$line
Definition: cdb.php:58
$wgNamespaceAliases
$wgNamespaceAliases
Namespace aliases.
Definition: DefaultSettings.php:3921
InputBox::$mSearchButtonLabel
$mSearchButtonLabel
Definition: InputBox.classes.php:30
$value
$value
Definition: styleTest.css.php:45
InputBox::getMoveForm
getMoveForm()
Generate move page form.
Definition: InputBox.classes.php:458
InputBox::$mSearchFilter
$mSearchFilter
Definition: InputBox.classes.php:39
InputBox::$mBR
$mBR
Definition: InputBox.classes.php:25
InputBox::$mMinor
$mMinor
Definition: InputBox.classes.php:23
InputBox::$mSummary
$mSummary
Definition: InputBox.classes.php:21
InputBox::$mButtonLabel
$mButtonLabel
Definition: InputBox.classes.php:29
InputBox::__construct
__construct( $parser)
Definition: InputBox.classes.php:44
InputBox::$mPreloadparams
$mPreloadparams
Definition: InputBox.classes.php:18
style
Bar style
Definition: parserTests.txt:192
$args
if( $line===false) $args
Definition: cdb.php:63
wfRandom
wfRandom()
Get a random decimal value between 0 and 1, in a way not likely to give duplicate values for any real...
Definition: GlobalFunctions.php:352
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:118
InputBox::$mDir
$mDir
Definition: InputBox.classes.php:38
$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:1965
InputBox::$mFullTextButton
$mFullTextButton
Definition: InputBox.classes.php:31
InputBox::$mID
$mID
Definition: InputBox.classes.php:35
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.classes.php:712
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:1965
width
width
Definition: parserTests.txt:163
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
InputBox::$mBGColor
$mBGColor
Definition: InputBox.classes.php:28
InputBox::$mEditIntro
$mEditIntro
Definition: InputBox.classes.php:19
InputBox::extractOptions
extractOptions( $text)
Extract options from a blob of text.
Definition: InputBox.classes.php:584
InputBox::$mPlaceholderText
$mPlaceholderText
Definition: InputBox.classes.php:27
InputBox::shouldUseVE
shouldUseVE()
Returns true, if the VisualEditor is requested from the inputbox wikitext definition and if the Visua...
Definition: InputBox.classes.php:694
InputBox::$mLabelText
$mLabelText
Definition: InputBox.classes.php:32
href
shown</td >< td > a href
Definition: All_system_messages.txt:2667
$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
$type
$type
Definition: testCompression.php:48
InputBox::$mParser
$mParser
Definition: InputBox.classes.php:14