$out->addHTML( $this->editFormTextTop );
if ( $errorMessage !== '' ) {
- $out->addWikiText( $errorMessage );
+ $out->addWikiTextAsInterface( $errorMessage );
$out->addHTML( "<hr />\n" );
}
case self::AS_CANNOT_USE_CUSTOM_MODEL:
case self::AS_PARSE_ERROR:
case self::AS_UNICODE_NOT_SUPPORTED:
- $out->addWikiText( '<div class="error">' . "\n" . $status->getWikiText() . '</div>' );
+ $out->addWikiTextAsInterface(
+ '<div class="error">' . "\n" .
+ $status->getWikiText() .
+ '</div>'
+ );
return true;
case self::AS_SUCCESS_NEW_ARTICLE:
$this->contentFormat,
$ex->getMessage()
);
- $out->addWikiText( '<div class="error">' . $msg->plain() . '</div>' );
+ $out->addWikiTextAsInterface( '<div class="error">' . $msg->plain() . '</div>' );
}
}
}
if ( $this->hookError !== '' ) {
- $out->addWikiText( $this->hookError );
+ $out->addWikiTextAsInterface( $this->hookError );
}
if ( $this->section != 'new' ) {
$this->contentFormat,
$ex->getMessage()
);
- $out->addWikiText( '<div class="error">' . $msg->plain() . '</div>' );
+ $out->addWikiTextAsInterface( '<div class="error">' . $msg->plain() . '</div>' );
}
}
}
$out->addHTML( "<div class='editCheckboxes'>" . $checkboxesHTML . "</div>\n" );
// Show copyright warning.
- $out->addWikiText( $this->getCopywarn() );
+ $out->addWikiTextAsInterface( $this->getCopywarn() );
$out->addHTML( $this->editFormTextAfterWarn );
$out->addHTML( "<div class='editButtons'>\n" );
if ( !$status->isGood() ) {
$wgOut->addHTML( '<h2>' . $this->prepareMessage( 'filedeleteerror-short' ) . "</h2>\n" );
- $wgOut->addWikiText( '<div class="error">' .
+ $wgOut->addWikiTextAsInterface( '<div class="error">' .
$status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' )
. '</div>' );
}
}
} else {
$this->prepareErrorPage( $this->msg( 'permissionserrors' ) );
- $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
+ $this->addWikiTextAsInterface( $this->formatPermissionsErrorMessage( $errors, $action ) );
}
}
*
* Is equivalent to:
*
- * $wgOut->addWikiText( "<div class='error'>\n"
+ * $wgOut->addWikiTextAsInterface( "<div class='error'>\n"
* . wfMessage( 'some-error' )->plain() . "\n</div>" );
*
* The newline after the opening div is needed in some wikitext. See T21226.
}
$s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
}
- $this->addWikiText( $s );
+ $this->addWikiTextAsInterface( $s );
}
/**
'protect-norestrictiontypes-title',
$this->mTitle->getPrefixedText()
) );
- $out->addWikiText( $this->mContext->msg( 'protect-norestrictiontypes-text' )->plain() );
+ $out->addWikiTextAsInterface(
+ $this->mContext->msg( 'protect-norestrictiontypes-text' )->plain()
+ );
// Show the log in case protection was possible once
$this->showLogExtract( $out );
$this->mContext->msg( 'protect-title-notallowed',
$this->mTitle->getPrefixedText() )
);
- $out->addWikiText( $out->formatPermissionsErrorMessage( $this->mPermErrors, 'protect' ) );
+ $out->addWikiTextAsInterface( $out->formatPermissionsErrorMessage(
+ $this->mPermErrors, 'protect'
+ ) );
} else {
$out->setPageTitle( $this->mContext->msg( 'protect-title', $this->mTitle->getPrefixedText() ) );
$out->addWikiMsg( 'protect-text',
$outputPage->setRobotPolicy( 'noindex,nofollow' );
$errortext = $error->getWikiText( false, 'view-pool-error' );
- $outputPage->addWikiText( Html::errorBox( $errortext ) );
+ $outputPage->addWikiTextAsInterface( Html::errorBox( $errortext ) );
}
# Connection or timeout error
return;
$dir = $this->getContext()->getLanguage()->getDir();
$lang = $this->getContext()->getLanguage()->getHtmlCode();
- $outputPage->addWikiText( Xml::openElement( 'div', [
+ $outputPage->addWikiTextAsInterface( Xml::openElement( 'div', [
'class' => "noarticletext mw-content-$dir",
'dir' => $dir,
'lang' => $lang,
);
if ( $error == '' ) {
- $outputPage->addWikiText(
+ $outputPage->addWikiTextAsInterface(
"<div class=\"error mw-error-cannotdelete\">\n" . $status->getWikiText() . "\n</div>"
);
$deleteLogPage = new LogPage( 'delete' );
if ( $this->mExtraDescription ) {
$fol = $this->getContext()->msg( 'shareddescriptionfollows' );
if ( !$fol->isDisabled() ) {
- $out->addWikiText( $fol->plain() );
+ $out->addWikiTextAsInterface( $fol->plain() );
}
$out->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription . "</div>\n" );
}
'h2',
[ 'id' => 'metadata' ],
$this->getContext()->msg( 'metadata' )->text() ) . "\n" );
- $out->addWikiText( $this->makeMetadataTable( $formattedMetadata ) );
+ $out->addWikiTextAsInterface( $this->makeMetadataTable( $formattedMetadata ) );
$out->addModules( [ 'mediawiki.action.view.metadata' ] );
}
// to the filename, because it can get copied with it.
// See T27277.
// phpcs:disable Generic.Files.LineLength
- $out->addWikiText( <<<EOT
+ $out->addWikiTextAsInterface( <<<EOT
<div class="fullMedia"><span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span></div>
<div class="mediaWarning">$warning</div>
EOT
);
// phpcs:enable
} else {
- $out->addWikiText( <<<EOT
+ $out->addWikiTextAsInterface( <<<EOT
<div class="fullMedia">{$medialink} {$dirmark}<span class="fileInfo">$longDesc</span>
</div>
EOT
'file-no-thumb-animation'
)->plain();
- $out->addWikiText( <<<EOT
+ $out->addWikiTextAsInterface( <<<EOT
<div class="mw-noanimatethumb">{$noAnimMesg}</div>
EOT
);
$out->setRobotPolicy( 'noindex,nofollow' );
$out->setArticleRelated( false );
$out->enableClientCache( false );
- $out->addWikiText( $description );
+ $out->addWikiTextAsInterface( $description );
}
/**
}
/**
- * Send the text to be displayed before the options. Should use $this->getOutput()->addWikiText()
+ * Send the text to be displayed before the options.
+ * Should use $this->getOutput()->addWikiTextAsInterface()
* or similar methods to print the text.
*
* @param FormOptions $opts
}
/**
- * Send the text to be displayed after the options. Should use $this->getOutput()->addWikiText()
+ * Send the text to be displayed after the options.
+ * Should use $this->getOutput()->addWikiTextAsInterface()
* or similar methods to print the text.
*
* @param FormOptions $opts
}
if ( $extraMessages ) {
$extraMessages = Status::wrap( $extraMessages );
- $out->addWikiText( $extraMessages->getWikiText() );
+ $out->addWikiTextAsInterface( $extraMessages->getWikiText() );
}
$out->addHTML( $injected_html );
// XXX: in the future, this could be stored as structured data, defining a list of book sources
$text = $content->getNativeData();
- $out->addWikiText( str_replace( 'MAGICNUMBER', $isbn, $text ) );
+ $out->addWikiTextAsInterface( str_replace( 'MAGICNUMBER', $isbn, $text ) );
return true;
} else {
// should never happen, but if so, don't let the user without any message
$out->addWikiMsg( 'confirmemail_sent' );
} elseif ( $retval instanceof Status && $retval->isGood() ) {
- $out->addWikiText( $retval->getValue() );
+ $out->addWikiTextAsInterface( $retval->getValue() );
}
} else {
// date and time are separate parameters to facilitate localisation.
*/
protected function failure( $status ) {
$this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
- $this->getOutput()->addWikiText(
+ $this->getOutput()->addWikiTextAsInterface(
Html::errorBox( $status->getWikiText( 'tags-edit-failure' ) )
);
$this->showForm();
$out = $this->getOutput();
if ( !$source->isGood() ) {
- $out->addWikiText( "<div class=\"error\">\n" .
+ $out->addWikiTextAsInterface( "<div class=\"error\">\n" .
$this->msg( 'importfailed', $source->getWikiText() )->parse() . "\n</div>" );
} else {
$importer = new WikiImporter( $source->value, $this->getConfig() );
$this->outputTableEnd();
// add total size of all files
$this->outputMediaType( 'total' );
- $this->getOutput()->addWikiText(
+ $this->getOutput()->addWikiTextAsInterface(
$this->msg( 'mediastatistics-allbytes' )
->numParams( $this->totalSize )
->sizeParams( $this->totalSize )
*/
protected function outputTableEnd() {
$this->getOutput()->addHTML( Html::closeElement( 'table' ) );
- $this->getOutput()->addWikiText(
+ $this->getOutput()->addWikiTextAsInterface(
$this->msg( 'mediastatistics-bytespertype' )
->numParams( $this->totalPerType )
->sizeParams( $this->totalPerType )
protected function failure( $status ) {
// Messages: revdelete-failure, logdelete-failure
$this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
- $this->getOutput()->addWikiText(
+ $this->getOutput()->addWikiTextAsInterface(
Html::errorBox(
$status->getWikiText( $this->typeLabels['failure'] )
)
$out->wrapWikiMsg(
"<h2 class=\"mw-specialpages-note-top\">$1</h2>", 'specialpages-note-top'
);
- $out->addWikiText(
+ $out->addWikiTextAsInterface(
"<div class=\"mw-specialpages-notes\">\n" .
implode( "\n", $notes ) .
"\n</div>"
$out->addBacklinkSubtitle( $this->getPageTitle() );
return true;
} else {
- $out->addWikiText( "<div class=\"error\">\n" . $status->getWikiText() .
+ $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $status->getWikiText() .
"\n</div>" );
return false;
}
// is the tag actually able to be deleted?
$canDeleteResult = ChangeTags::canDeleteTag( $tag, $user );
if ( !$canDeleteResult->isGood() ) {
- $out->addWikiText( "<div class=\"error\">\n" . $canDeleteResult->getWikiText() .
+ $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $canDeleteResult->getWikiText() .
"\n</div>" );
if ( !$canDeleteResult->isOK() ) {
return;
$func = $activate ? 'canActivateTag' : 'canDeactivateTag';
$result = ChangeTags::$func( $tag, $user );
if ( !$result->isGood() ) {
- $out->addWikiText( "<div class=\"error\">\n" . $result->getWikiText() .
+ $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $result->getWikiText() .
"\n</div>" );
if ( !$result->isOK() ) {
return;
return true;
} elseif ( $status->isOK() && $form->tagAction === 'delete' ) {
// deletion succeeded, but hooks raised a warning
- $out->addWikiText( $this->msg( 'tags-delete-warnings-after-delete', $tag,
+ $out->addWikiTextAsInterface( $this->msg( 'tags-delete-warnings-after-delete', $tag,
count( $status->getWarningsArray() ) )->text() . "\n" .
$status->getWikitext() );
$out->addReturnTo( $this->getPageTitle() );
return true;
} else {
- $out->addWikiText( "<div class=\"error\">\n" . $status->getWikitext() .
+ $out->addWikiTextAsInterface( "<div class=\"error\">\n" . $status->getWikitext() .
"\n</div>" );
return false;
}
// Show revision undeletion warnings and errors
$status = $archive->getRevisionStatus();
if ( $status && !$status->isGood() ) {
- $out->addWikiText( '<div class="error" id="mw-error-cannotundelete">' .
+ $out->addWikiTextAsInterface( '<div class="error" id="mw-error-cannotundelete">' .
$status->getWikiText(
'cannotundelete',
'cannotundelete'
// Show file undeletion warnings and errors
$status = $archive->getFileStatus();
if ( $status && !$status->isGood() ) {
- $out->addWikiText( '<div class="error">' .
+ $out->addWikiTextAsInterface( '<div class="error">' .
$status->getWikiText(
'undelete-error-short',
'undelete-error-long'
// save settings
if ( !$fetchedStatus->isOK() ) {
- $this->getOutput()->addWikiText( $fetchedStatus->getWikiText() );
+ $this->getOutput()->addWikiTextAsInterface( $fetchedStatus->getWikiText() );
return;
}
return;
} else {
// Print an error message and redisplay the form
- $out->addWikiText( '<div class="error">' . $status->getWikiText() . '</div>' );
+ $out->addWikiTextAsInterface( '<div class="error">' . $status->getWikiText() . '</div>' );
}
}
}
function editUserGroupsForm( $username ) {
$status = $this->fetchUser( $username, true );
if ( !$status->isOK() ) {
- $this->getOutput()->addWikiText( $status->getWikiText() );
+ $this->getOutput()->addWikiTextAsInterface( $status->getWikiText() );
return;
} else {
}
$out->setPageTitle( $this->msg( 'version-credits-title', $extName ) );
- $out->addWikiText( $wikiText );
+ $out->addWikiTextAsInterface( $wikiText );
break;
case 'license':
}
$out->setPageTitle( $this->msg( 'version-license-title', $extName ) );
- $out->addWikiText( $wikiText );
+ $out->addWikiTextAsInterface( $wikiText );
break;
default:
$out->addModuleStyles( 'mediawiki.special.version' );
- $out->addWikiText(
+ $out->addWikiTextAsInterface(
$this->getMediaWikiCredits() .
$this->softwareInformation() .
$this->getEntryPointInfo()
$this->getParserTags() .
$this->getParserFunctionHooks()
);
- $out->addWikiText( $this->getWgHooks() );
+ $out->addWikiTextAsInterface( $this->getWgHooks() );
$out->addHTML( $this->IPInfo() );
break;
$op = $this->newInstance();
$this->assertSame( '', $op->getHTML() );
$op->wrapWikiMsg( '[$1]', [ 'parentheses', "<b>a" ] );
- // This is known to be bad unbalanced HTML; this will be fixed
- // by I743f4185a03403f8d9b9db010ff1ee4e9342e062 (T198214)
- $this->assertSame( "<p>[(<b>a)]\n</p>", $op->getHTML() );
+ // The input is bad unbalanced HTML, but the output is tidied
+ $this->assertSame( "<p>[(<b>a)]\n</b></p>", $op->getHTML() );
}
/**