This ensures that broken messages can't break the <div> wrapper and
that the output is tidy.
Bug: T205624
Change-Id: I2511adf593a13528e205a82d9fcdc8a524d0a95f
case self::AS_CANNOT_USE_CUSTOM_MODEL:
case self::AS_PARSE_ERROR:
case self::AS_UNICODE_NOT_SUPPORTED:
case self::AS_CANNOT_USE_CUSTOM_MODEL:
case self::AS_PARSE_ERROR:
case self::AS_UNICODE_NOT_SUPPORTED:
- $out->addWikiTextAsInterface(
- '<div class="error">' . "\n" .
- $status->getWikiText() .
- '</div>'
- );
+ $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
return true;
case self::AS_SUCCESS_NEW_ARTICLE:
return true;
case self::AS_SUCCESS_NEW_ARTICLE:
$this->contentFormat,
$ex->getMessage()
);
$this->contentFormat,
$ex->getMessage()
);
- $out->addWikiTextAsInterface( '<div class="error">' . $msg->plain() . '</div>' );
+ $out->wrapWikiTextAsInterface( 'error', $msg->plain() );
$this->contentFormat,
$ex->getMessage()
);
$this->contentFormat,
$ex->getMessage()
);
- $out->addWikiTextAsInterface( '<div class="error">' . $msg->plain() . '</div>' );
+ $out->wrapWikiTextAsInterface( 'error', $msg->plain() );
if ( !$status->isGood() ) {
$wgOut->addHTML( '<h2>' . $this->prepareMessage( 'filedeleteerror-short' ) . "</h2>\n" );
if ( !$status->isGood() ) {
$wgOut->addHTML( '<h2>' . $this->prepareMessage( 'filedeleteerror-short' ) . "</h2>\n" );
- $wgOut->addWikiTextAsInterface( '<div class="error">' .
+ $wgOut->wrapWikiTextAsInterface(
+ 'error',
$status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' )
$status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' )
}
if ( $status->isOK() ) {
$wgOut->setPageTitle( wfMessage( 'actioncomplete' ) );
}
if ( $status->isOK() ) {
$wgOut->setPageTitle( wfMessage( 'actioncomplete' ) );
$outputPage->setRobotPolicy( 'noindex,nofollow' );
$errortext = $error->getWikiText( false, 'view-pool-error' );
$outputPage->setRobotPolicy( 'noindex,nofollow' );
$errortext = $error->getWikiText( false, 'view-pool-error' );
- $outputPage->addWikiTextAsInterface( Html::errorBox( $errortext ) );
+ $outputPage->wrapWikiTextAsInterface( 'errorbox', $errortext );
}
# Connection or timeout error
return;
}
# Connection or timeout error
return;
- $outputPage->addWikiTextAsInterface(
- "<div class=\"error mw-error-cannotdelete\">\n" . $status->getWikiText() . "\n</div>"
+ $outputPage->wrapWikiTextAsInterface(
+ 'error mw-error-cannotdelete',
+ $status->getWikiText()
);
$deleteLogPage = new LogPage( 'delete' );
$outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );
);
$deleteLogPage = new LogPage( 'delete' );
$outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );
// to the filename, because it can get copied with it.
// See T27277.
// phpcs:disable Generic.Files.LineLength
// to the filename, because it can get copied with it.
// See T27277.
// phpcs:disable Generic.Files.LineLength
- $out->addWikiTextAsInterface( <<<EOT
-<div class="fullMedia"><span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span></div>
-<div class="mediaWarning">$warning</div>
+ $out->wrapWikiTextAsInterface( 'fullMedia', <<<EOT
+<span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span>
+ $out->wrapWikiTextAsInterface( 'mediaWarning', $warning );
- $out->addWikiTextAsInterface( <<<EOT
-<div class="fullMedia">{$medialink} {$dirmark}<span class="fileInfo">$longDesc</span>
-</div>
+ $out->wrapWikiTextAsInterface( 'fullMedia', <<<EOT
+{$medialink} {$dirmark}<span class="fileInfo">$longDesc</span>
'file-no-thumb-animation'
)->plain();
'file-no-thumb-animation'
)->plain();
- $out->addWikiTextAsInterface( <<<EOT
-<div class="mw-noanimatethumb">{$noAnimMesg}</div>
-EOT
- );
+ $out->wrapWikiTextAsInterface( 'mw-noanimatethumb', $noAnimMesg );
}
if ( !$this->displayImg->isLocal() ) {
}
if ( !$this->displayImg->isLocal() ) {
*/
protected function failure( $status ) {
$this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
*/
protected function failure( $status ) {
$this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
- $this->getOutput()->addWikiTextAsInterface(
- Html::errorBox( $status->getWikiText( 'tags-edit-failure' ) )
+ $this->getOutput()->wrapWikiTextAsInterface(
+ 'errorbox', $status->getWikiText( 'tags-edit-failure' )
$out = $this->getOutput();
if ( !$source->isGood() ) {
$out = $this->getOutput();
if ( !$source->isGood() ) {
- $out->addWikiTextAsInterface( "<div class=\"error\">\n" .
- $this->msg( 'importfailed', $source->getWikiText() )->parse() . "\n</div>" );
+ $out->wrapWikiTextAsInterface( 'error',
+ $this->msg( 'importfailed', $source->getWikiText() )->plain()
+ );
} else {
$importer = new WikiImporter( $source->value, $this->getConfig() );
if ( !is_null( $this->namespace ) ) {
} else {
$importer = new WikiImporter( $source->value, $this->getConfig() );
if ( !is_null( $this->namespace ) ) {
protected function failure( $status ) {
// Messages: revdelete-failure, logdelete-failure
$this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
protected function failure( $status ) {
// Messages: revdelete-failure, logdelete-failure
$this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
- $this->getOutput()->addWikiTextAsInterface(
- Html::errorBox(
- $status->getWikiText( $this->typeLabels['failure'] )
- )
+ $this->getOutput()->wrapWikiTextAsInterface(
+ 'errorbox',
+ $status->getWikiText( $this->typeLabels['failure'] )
$out->wrapWikiMsg(
"<h2 class=\"mw-specialpages-note-top\">$1</h2>", 'specialpages-note-top'
);
$out->wrapWikiMsg(
"<h2 class=\"mw-specialpages-note-top\">$1</h2>", 'specialpages-note-top'
);
- $out->addWikiTextAsInterface(
- "<div class=\"mw-specialpages-notes\">\n" .
- implode( "\n", $notes ) .
- "\n</div>"
+ $out->wrapWikiTextAsInterface(
+ 'mw-specialpages-notes',
+ implode( "\n", $notes )
$out->addBacklinkSubtitle( $this->getPageTitle() );
return true;
} else {
$out->addBacklinkSubtitle( $this->getPageTitle() );
return true;
} else {
- $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $status->getWikiText() .
- "\n</div>" );
+ $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
// is the tag actually able to be deleted?
$canDeleteResult = ChangeTags::canDeleteTag( $tag, $user );
if ( !$canDeleteResult->isGood() ) {
// is the tag actually able to be deleted?
$canDeleteResult = ChangeTags::canDeleteTag( $tag, $user );
if ( !$canDeleteResult->isGood() ) {
- $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $canDeleteResult->getWikiText() .
- "\n</div>" );
+ $out->wrapWikiTextAsInterface( 'error', $canDeleteResult->getWikiText() );
if ( !$canDeleteResult->isOK() ) {
return;
}
if ( !$canDeleteResult->isOK() ) {
return;
}
$func = $activate ? 'canActivateTag' : 'canDeactivateTag';
$result = ChangeTags::$func( $tag, $user );
if ( !$result->isGood() ) {
$func = $activate ? 'canActivateTag' : 'canDeactivateTag';
$result = ChangeTags::$func( $tag, $user );
if ( !$result->isGood() ) {
- $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $result->getWikiText() .
- "\n</div>" );
+ $out->wrapWikiTextAsInterface( 'error', $result->getWikiText() );
if ( !$result->isOK() ) {
return;
}
if ( !$result->isOK() ) {
return;
}
$out->addReturnTo( $this->getPageTitle() );
return true;
} else {
$out->addReturnTo( $this->getPageTitle() );
return true;
} else {
- $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $status->getWikitext() .
- "\n</div>" );
+ $out->wrapWikiTextAsInterface( 'error', $status->getWikitext() );
// Show revision undeletion warnings and errors
$status = $archive->getRevisionStatus();
if ( $status && !$status->isGood() ) {
// Show revision undeletion warnings and errors
$status = $archive->getRevisionStatus();
if ( $status && !$status->isGood() ) {
- $out->addWikiTextAsInterface( '<div class="error" id="mw-error-cannotundelete">' .
+ $out->wrapWikiTextAsInterface(
+ 'error',
+ '<div id="mw-error-cannotundelete">' .
$status->getWikiText(
'cannotundelete',
'cannotundelete'
$status->getWikiText(
'cannotundelete',
'cannotundelete'
// Show file undeletion warnings and errors
$status = $archive->getFileStatus();
if ( $status && !$status->isGood() ) {
// Show file undeletion warnings and errors
$status = $archive->getFileStatus();
if ( $status && !$status->isGood() ) {
- $out->addWikiTextAsInterface( '<div class="error">' .
+ $out->wrapWikiTextAsInterface(
+ 'error',
$status->getWikiText(
'undelete-error-short',
'undelete-error-long'
$status->getWikiText(
'undelete-error-short',
'undelete-error-long'
return;
} else {
// Print an error message and redisplay the form
return;
} else {
// Print an error message and redisplay the form
- $out->addWikiTextAsInterface( '<div class="error">' . $status->getWikiText() . '</div>' );
+ $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );