From c67bae46913db461fcb371d8b2bb2a4590c3d3eb Mon Sep 17 00:00:00 2001 From: WMDE-Fisch Date: Wed, 26 Oct 2016 16:34:08 +0200 Subject: [PATCH] Factor out some methods in the header generation As preparation for some more minor refactoring there. Change-Id: I31f585e5c4fcf724d9aaf670a21f4f0af42e98ce --- includes/EditPage.php | 45 +++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index e8ea20f16a..4aa87d6c89 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2885,24 +2885,9 @@ ERROR; global $wgOut, $wgUser, $wgMaxArticleSize, $wgLang; global $wgAllowUserCss, $wgAllowUserJs; - if ( $this->mTitle->isTalkPage() ) { - $wgOut->addWikiMsg( 'talkpagetext' ); - } + $this->addTalkPageText(); - // Add edit notices - $editNotices = $this->mTitle->getEditNotices( $this->oldid ); - if ( count( $editNotices ) ) { - $wgOut->addHTML( implode( "\n", $editNotices ) ); - } else { - $msg = $this->context->msg( 'editnotice-notext' ); - if ( !$msg->isDisabled() ) { - $wgOut->addHTML( - '
' - . $msg->parseAsBlock() - . '
' - ); - } - } + $this->addEditNotices(); if ( $this->isConflict ) { $wgOut->wrapWikiMsg( "
\n$1\n
", 'explainconflict' ); @@ -4435,4 +4420,30 @@ HTML // reverse the transform that we made for reversibility reasons. return strtr( $result, [ "�" => "&#x" ] ); } + + protected function addEditNotices() { + global $wgOut; + + $editNotices = $this->mTitle->getEditNotices( $this->oldid ); + if ( count( $editNotices ) ) { + $wgOut->addHTML( implode( "\n", $editNotices ) ); + } else { + $msg = $this->context->msg( 'editnotice-notext' ); + if ( !$msg->isDisabled() ) { + $wgOut->addHTML( + '
' + . $msg->parseAsBlock() + . '
' + ); + } + } + } + + protected function addTalkPageText() { + global $wgOut; + + if ( $this->mTitle->isTalkPage() ) { + $wgOut->addWikiMsg( 'talkpagetext' ); + } + } } -- 2.20.1