134 if ( !$this->mButtonLabel ) {
135 $this->mButtonLabel =
wfMessage(
'inputbox-tryexact' )->text();
137 if ( !$this->mSearchButtonLabel ) {
138 $this->mSearchButtonLabel =
wfMessage(
'inputbox-searchfulltext' )->text();
140 if ( $this->mID !==
'' ) {
141 $idArray = [
'id' => Sanitizer::escapeIdForAttribute( $this->mID ) ];
147 $idRandStr = Sanitizer::escapeIdForAttribute(
'-' . $this->mID .
wfRandom() );
150 $htmlOut = Xml::openElement(
'div',
152 'class' =>
'mw-inputbox-centered',
156 $htmlOut .= Xml::openElement(
'form',
158 'name' =>
'searchbox',
159 'class' =>
'searchbox',
160 'action' => SpecialPage::getTitleFor(
'Search' )->getLocalUrl(),
163 $htmlOut .= Xml::element(
'input',
167 'type' => $this->mHidden ?
'hidden' :
'text',
175 if ( $this->mPrefix !=
'' ) {
176 $htmlOut .= Html::hidden(
'prefix', $this->mPrefix );
179 if ( $this->mSearchFilter !=
'' ) {
180 $htmlOut .= Html::hidden(
'searchfilter', $this->mSearchFilter );
183 if ( $this->mTour !=
'' ) {
184 $htmlOut .= Html::hidden(
'tour', $this->mTour );
190 $namespacesArray = explode(
',', $this->mNamespaces );
191 if ( $this->mNamespaces ) {
194 $showNamespaces = [];
197 foreach ( $namespacesArray as $userNS ) {
198 $userNS =
trim( $userNS );
201 if (
strpos( $userNS,
'**' ) ) {
206 $mainMsg =
wfMessage(
'inputbox-ns-main' )->inContentLanguage()->text();
207 if ( $userNS ==
'Main' || $userNS == $mainMsg ) {
217 if (
isset( $checkedNS[$userNS] ) && $checkedNS[$userNS] ) {
218 $checkedNS[
$i] =
true;
223 foreach ( $showNamespaces as $i => $name ) {
226 if ( (
isset( $checkedNS[$i] ) && $checkedNS[$i] ) || count( $showNamespaces ) == 1 ) {
227 $checked = [
'checked' =>
'checked' ];
230 if ( count( $showNamespaces ) == 1 ) {
232 $htmlOut .= Xml::element(
'input',
237 'id' =>
'mw-inputbox-ns' . $i . $idRandStr
242 $htmlOut .=
' <div class="mw-inputbox-element mw-ui-checkbox">';
243 $htmlOut .= Xml::element(
'input',
245 'type' =>
'checkbox',
248 'id' =>
'mw-inputbox-ns' . $i . $idRandStr
252 $htmlOut .= Xml::label( $name,
'mw-inputbox-ns' . $i . $idRandStr );
253 $htmlOut .=
'</div> ';
261 $htmlOut .= Xml::element(
'input',
265 'class' =>
'mw-ui-button',
266 'value' => $this->mButtonLabel
269 $htmlOut .=
' ';
273 $htmlOut .= Xml::element(
'input',
276 'name' =>
'fulltext',
277 'class' =>
'mw-ui-button',
278 'value' => $this->mSearchButtonLabel
283 if (
$type ==
'fulltext' ) {
284 $htmlOut .= Html::hidden(
'fulltext',
'Search' );
287 $htmlOut .= Xml::closeElement(
'form' );
288 $htmlOut .= Xml::closeElement(
'div' );
300 if ( !$this->mButtonLabel ) {
301 $this->mButtonLabel =
wfMessage(
'inputbox-tryexact' )->text();
304 if ( $this->mID !==
'' ) {
312 $id = Sanitizer::escapeIdForAttribute( $unescapedID );
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' );
319 $htmlOut = Xml::openElement(
'form',
321 'name' =>
'bodySearch' . $id,
322 'id' =>
'bodySearch' . $id,
323 'class' =>
'bodySearch' . ( $this->mInline ?
' mw-inputbox-inline' :
'' ),
324 'action' => SpecialPage::getTitleFor(
'Search' )->getLocalUrl(),
327 $htmlOut .= Xml::openElement(
'div',
329 'class' =>
'bodySearchWrap' . ( $this->mInline ?
' mw-inputbox-inline' :
'' ),
334 $htmlOut .= Xml::element(
'input',
336 'type' => $this->mHidden ?
'hidden' :
'text',
338 'class' =>
'mw-ui-input mw-ui-input-inline',
340 'id' =>
'bodySearchInput' . $id,
344 $htmlOut .=
' ' . Xml::element(
'input',
348 'value' => $this->mButtonLabel,
349 'class' =>
'mw-ui-button',
354 if ( !empty( $this->mFullTextButton ) ) {
355 $htmlOut .= Xml::element(
'input',
358 'name' =>
'fulltext',
359 'class' =>
'mw-ui-button',
360 'value' => $this->mSearchButtonLabel
365 $htmlOut .= Xml::closeElement(
'div' );
366 $htmlOut .= Xml::closeElement(
'form' );
379 if ( $this->mType ==
"comment" ) {
380 if ( !$this->mButtonLabel ) {
381 $this->mButtonLabel =
wfMessage(
'inputbox-postcomment' )->text();
384 if ( !$this->mButtonLabel ) {
385 $this->mButtonLabel =
wfMessage(
'inputbox-createarticle' )->text();
389 $htmlOut = Xml::openElement(
'div',
391 'class' =>
'mw-inputbox-centered',
396 'name' =>
'createbox',
397 'class' =>
'createbox',
401 if ( $this->mID !==
'' ) {
402 $createBoxParams[
'id'] = Sanitizer::escapeIdForAttribute( $this->mID );
404 $htmlOut .= Xml::openElement(
'form', $createBoxParams );
406 $htmlOut .= Html::hidden( $editArgs[
'name'], $editArgs[
'value'] );
407 if ( $this->mPreload !==
null ) {
408 $htmlOut .= Html::hidden(
'preload', $this->mPreload );
410 if (
is_array( $this->mPreloadparams ) ) {
411 foreach ( $this->mPreloadparams as $preloadparams ) {
412 $htmlOut .= Html::hidden(
'preloadparams[]', $preloadparams );
415 if ( $this->mEditIntro !==
null ) {
416 $htmlOut .= Html::hidden(
'editintro', $this->mEditIntro );
418 if ( $this->mSummary !==
null ) {
419 $htmlOut .= Html::hidden(
'summary', $this->mSummary );
421 if ( $this->mNosummary !==
null ) {
422 $htmlOut .= Html::hidden(
'nosummary', $this->mNosummary );
424 if ( $this->mPrefix !==
'' ) {
425 $htmlOut .= Html::hidden(
'prefix', $this->mPrefix );
427 if ( $this->mMinor !==
null ) {
428 $htmlOut .= Html::hidden(
'minor', $this->mMinor );
430 if ( $this->mType ==
'comment' ) {
431 $htmlOut .= Html::hidden(
'section',
'new' );
433 $htmlOut .= Xml::openElement(
'input',
435 'type' => $this->mHidden ?
'hidden' :
'text',
438 'mw-ui-input mw-ui-input-inline createboxInput',
446 $htmlOut .= Xml::openElement(
'input',
450 'class' =>
'mw-ui-button mw-ui-progressive createboxButton',
451 'value' => $this->mButtonLabel
454 $htmlOut .= Xml::closeElement(
'form' );
455 $htmlOut .= Xml::closeElement(
'div' );
468 if ( !$this->mButtonLabel ) {
469 $this->mButtonLabel =
wfMessage(
'inputbox-movearticle' )->text();
472 $htmlOut = Xml::openElement(
'div',
474 'class' =>
'mw-inputbox-centered',
480 'class' =>
'mw-movebox',
484 if ( $this->mID !==
'' ) {
485 $moveBoxParams[
'id'] = Sanitizer::escapeIdForAttribute( $this->mID );
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',
494 'type' => $this->mHidden ?
'hidden' :
'text',
495 'name' =>
'wpNewTitle',
496 'class' => $this->
getLinebreakClasses() .
'mw-moveboxInput mw-ui-input mw-ui-input-inline',
504 $htmlOut .= Xml::openElement(
'input',
507 'class' =>
'mw-ui-button mw-ui-progressive',
508 'value' => $this->mButtonLabel
511 $htmlOut .= Xml::closeElement(
'form' );
512 $htmlOut .= Xml::closeElement(
'div' );
525 if ( !$this->mButtonLabel ) {
526 $this->mButtonLabel =
wfMessage(
'inputbox-postcommenttitle' )->text();
529 $htmlOut = Xml::openElement(
'div',
531 'class' =>
'mw-inputbox-centered',
535 $commentFormParams = [
536 'name' =>
'commentbox',
537 'class' =>
'commentbox',
541 if ( $this->mID !==
'' ) {
542 $commentFormParams[
'id'] = Sanitizer::escapeIdForAttribute( $this->mID );
544 $htmlOut .= Xml::openElement(
'form', $commentFormParams );
546 $htmlOut .= Html::hidden( $editArgs[
'name'], $editArgs[
'value'] );
547 if ( $this->mPreload !==
null ) {
548 $htmlOut .= Html::hidden(
'preload', $this->mPreload );
550 if (
is_array( $this->mPreloadparams ) ) {
551 foreach ( $this->mPreloadparams as $preloadparams ) {
552 $htmlOut .= Html::hidden(
'preloadparams[]', $preloadparams );
555 if ( $this->mEditIntro !==
null ) {
556 $htmlOut .= Html::hidden(
'editintro', $this->mEditIntro );
558 $htmlOut .= Xml::openElement(
'input',
560 'type' => $this->mHidden ?
'hidden' :
'text',
561 'name' =>
'preloadtitle',
562 'class' => $this->
getLinebreakClasses() .
'commentboxInput mw-ui-input mw-ui-input-inline',
569 $htmlOut .= Html::hidden(
'section',
'new' );
570 $htmlOut .= Html::hidden(
'title', $this->mPage );
572 $htmlOut .= Xml::openElement(
'input',
576 'class' =>
'mw-ui-button mw-ui-progressive',
577 'value' => $this->mButtonLabel
580 $htmlOut .= Xml::closeElement(
'form' );
581 $htmlOut .= Xml::closeElement(
'div' );