Use OutputPage::parseAsInterface() to tidy the output and make the
selection of user interface language explicit.
Bug: T198214
Change-Id: Ifeb1ca6eb8b5c743421b8f9e329f1e3658050e47
// Messages: undo-success, undo-failure, undo-main-slot-only, undo-norev,
// undo-nochange.
$class = ( $undoMsg == 'success' ? '' : 'error ' ) . "mw-undo-{$undoMsg}";
// Messages: undo-success, undo-failure, undo-main-slot-only, undo-norev,
// undo-nochange.
$class = ( $undoMsg == 'success' ? '' : 'error ' ) . "mw-undo-{$undoMsg}";
- $this->editFormPageTop .= $out->parse( "<div class=\"{$class}\">" .
- $this->context->msg( 'undo-' . $undoMsg )->plain() . '</div>', true, /* interface */true );
+ $this->editFormPageTop .= Html::rawElement(
+ 'div', [ 'class' => $class ],
+ $out->parseAsInterface(
+ $this->context->msg( 'undo-' . $undoMsg )->plain()
+ )
+ );
}
if ( $content === false ) {
}
if ( $content === false ) {
// Do not put big scary notice, if previewing the empty
// string, which happens when you initially edit
// a category page, due to automatic preview-on-open.
// Do not put big scary notice, if previewing the empty
// string, which happens when you initially edit
// a category page, due to automatic preview-on-open.
- $parsedNote = $out->parse( "<div class='previewnote'>" .
- $this->context->msg( 'session_fail_preview_html' )->text() . "</div>",
- true, /* interface */true );
+ $parsedNote = Html::rawElement( 'div', [ 'class' => 'previewnote' ],
+ $out->parseAsInterface(
+ $this->context->msg( 'session_fail_preview_html' )->plain()
+ ) );
}
$this->incrementEditFailureStats( 'session_loss' );
return $parsedNote;
}
$this->incrementEditFailureStats( 'session_loss' );
return $parsedNote;
}
if ( $this->isConflict ) {
}
if ( $this->isConflict ) {
- $conflict = '<h2 id="mw-previewconflict">'
- . $this->context->msg( 'previewconflict' )->escaped() . "</h2>\n";
+ $conflict = Html::rawElement(
+ 'h2', [ 'id' => 'mw-previewconflict' ],
+ $this->context->msg( 'previewconflict' )->escaped()
+ );
} else {
$conflict = '<hr />';
}
} else {
$conflict = '<hr />';
}
- $previewhead = "<div class='previewnote'>\n" .
- '<h2 id="mw-previewheader">' . $this->context->msg( 'preview' )->escaped() . "</h2>" .
- $out->parse( $note, true, /* interface */true ) . $conflict . "</div>\n";
+ $previewhead = Html::rawElement(
+ 'div', [ 'class' => 'previewnote' ],
+ Html::rawElement(
+ 'h2', [ 'id' => 'mw-previewheader' ],
+ $this->context->msg( 'preview' )->escaped()
+ ) .
+ $out->parseAsInterface( $note ) . $conflict
+ );
$pageViewLang = $this->mTitle->getPageViewLanguage();
$attribs = [ 'lang' => $pageViewLang->getHtmlCode(), 'dir' => $pageViewLang->getDir(),
$pageViewLang = $this->mTitle->getPageViewLanguage();
$attribs = [ 'lang' => $pageViewLang->getHtmlCode(), 'dir' => $pageViewLang->getDir(),
- $previewhead = "<div class='previewnote'>\n" .
- '<h2 id="mw-previewheader">' . $this->context->msg( 'preview' )->escaped() . "</h2>" .
- $out->parse( $note, true, /* interface */true ) . "<hr /></div>\n";
+ $previewhead = Html::rawElement(
+ 'div', [ 'class' => 'previewnote' ],
+ Html::element(
+ 'h2', [ 'id' => 'mw-previewheader' ],
+ $this->context->msg( 'preview' )->text()
+ ) .
+ $out->parseAsInterface( $note ) .
+ "<hr />"
+ );
$pageViewLang = $this->getTitle()->getPageViewLanguage();
$attribs = [ 'lang' => $pageViewLang->getHtmlCode(), 'dir' => $pageViewLang->getDir(),
$pageViewLang = $this->getTitle()->getPageViewLanguage();
$attribs = [ 'lang' => $pageViewLang->getHtmlCode(), 'dir' => $pageViewLang->getDir(),
function msgWiki( $msgKey ) {
global $wgOut;
function msgWiki( $msgKey ) {
global $wgOut;
- $text = wfMessage( $msgKey )->text();
- echo $wgOut->parse( $text );
+ $text = wfMessage( $msgKey )->plain();
+ echo $wgOut->parseAsInterface( $text );
// TTL in seconds
600,
function () use ( $notice ) {
// TTL in seconds
600,
function () use ( $notice ) {
- return $this->getOutput()->parse( $notice );
+ return $this->getOutput()->parseAsInterface( $notice );
$headerText = $this->msg( 'tags-create-warnings-above', $tag,
count( $status->getWarningsArray() ) )->parseAsBlock() .
$headerText = $this->msg( 'tags-create-warnings-above', $tag,
count( $status->getWarningsArray() ) )->parseAsBlock() .
- $out->parse( $status->getWikiText() ) .
+ $out->parseAsInterface( $status->getWikiText() ) .
$this->msg( 'tags-create-warnings-below' )->parseAsBlock();
$subform = HTMLForm::factory( 'ooui', $fields, $this->getContext() );
$this->msg( 'tags-create-warnings-below' )->parseAsBlock();
$subform = HTMLForm::factory( 'ooui', $fields, $this->getContext() );
// Fetch the file if required
$status = $this->mUpload->fetchFile();
if ( !$status->isOK() ) {
// Fetch the file if required
$status = $this->mUpload->fetchFile();
if ( !$status->isOK() ) {
- $this->showUploadError( $this->getOutput()->parse( $status->getWikiText() ) );
+ $this->showUploadError( $this->getOutput()->parseAsInterface( $status->getWikiText() ) );
$changeTagsStatus = ChangeTags::canAddTagsAccompanyingChange(
$changeTags, $this->getUser() );
if ( !$changeTagsStatus->isOK() ) {
$changeTagsStatus = ChangeTags::canAddTagsAccompanyingChange(
$changeTags, $this->getUser() );
if ( !$changeTagsStatus->isOK() ) {
- $this->showUploadError( $this->getOutput()->parse( $changeTagsStatus->getWikiText() ) );
+ $this->showUploadError( $this->getOutput()->parseAsInterface(
+ $changeTagsStatus->getWikiText()
+ ) );
);
if ( !$status->isGood() ) {
);
if ( !$status->isGood() ) {
- $this->showRecoverableUploadError( $this->getOutput()->parse( $status->getWikiText() ) );
+ $this->showRecoverableUploadError(
+ $this->getOutput()->parseAsInterface( $status->getWikiText() )
+ );