Merge "RCFilters: Only selectively scroll to popup when it's focused"
[lhc/web/wiklou.git] / includes / EditPage.php
index 7a8236c..9f3f586 100644 (file)
@@ -511,6 +511,7 @@ class EditPage {
         * @deprecated since 1.29, call edit directly
         */
        public function submit() {
+               wfDeprecated( __METHOD__, '1.29' );
                $this->edit();
        }
 
@@ -850,7 +851,7 @@ class EditPage {
         * @throws ErrorPageError
         */
        public function importFormData( &$request ) {
-               global $wgContLang, $wgUser;
+               global $wgUser;
 
                # Section edit can come from either the form or a link
                $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) );
@@ -876,8 +877,7 @@ class EditPage {
                                }
                        }
 
-                       # Truncate for whole multibyte characters
-                       $this->summary = $wgContLang->truncate( $request->getText( 'wpSummary' ), 255 );
+                       $this->summary = $request->getText( 'wpSummary' );
 
                        # If the summary consists of a heading, e.g. '==Foobar==', extract the title from the
                        # header syntax, e.g. 'Foobar'. This is mainly an issue when we are using wpSummary for
@@ -889,7 +889,7 @@ class EditPage {
                        # currently doing double duty as both edit summary and section title. Right now this
                        # is just to allow API edits to work around this limitation, but this should be
                        # incorporated into the actual edit form when EditPage is rewritten (Bugs 18654, 26312).
-                       $this->sectiontitle = $wgContLang->truncate( $request->getText( 'wpSectionTitle' ), 255 );
+                       $this->sectiontitle = $request->getText( 'wpSectionTitle' );
                        $this->sectiontitle = preg_replace( '/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->sectiontitle );
 
                        $this->edittime = $request->getVal( 'wpEdittime' );
@@ -2915,7 +2915,7 @@ class EditPage {
                                }
                        }
 
-                       $buttonLabel = $this->context->msg( $this->getSaveButtonLabel() )->text();
+                       $buttonLabel = $this->context->msg( $this->getSubmitButtonLabel() )->text();
 
                        if ( $this->missingComment ) {
                                $out->wrapWikiMsg( "<div id='mw-missingcommenttext'>\n$1\n</div>", 'missingcommenttext' );
@@ -3794,7 +3794,7 @@ class EditPage {
         * @return string
         */
        public function getPreviewText() {
-               global $wgRawHtml, $wgLang;
+               global $wgRawHtml;
                global $wgAllowUserCss, $wgAllowUserJs;
 
                $out = $this->context->getOutput();
@@ -3830,7 +3830,8 @@ class EditPage {
 
                        # provide a anchor link to the editform
                        $continueEditing = '<span class="mw-continue-editing">' .
-                               '[[#' . self::EDITFORM_ID . '|' . $wgLang->getArrow() . ' ' .
+                               '[[#' . self::EDITFORM_ID . '|' .
+                               $this->context->getLanguage()->getArrow() . ' ' .
                                $this->context->msg( 'continue-editing' )->text() . ']]</span>';
                        if ( $this->mTriedSave && !$this->mTokenOk ) {
                                if ( $this->mTokenOkExceptSuffix ) {
@@ -4333,9 +4334,9 @@ class EditPage {
         *
         * @return string
         */
-       private function getSaveButtonLabel() {
+       protected function getSubmitButtonLabel() {
                $labelAsPublish =
-                       $this->mArticle->getContext()->getConfig()->get( 'EditSubmitButtonLabelPublish' );
+                       $this->context->getConfig()->get( 'EditSubmitButtonLabelPublish' );
 
                // Can't use $this->isNew as that's also true if we're adding a new section to an extant page
                $newPage = !$this->mTitle->exists();
@@ -4360,7 +4361,7 @@ class EditPage {
        public function getEditButtons( &$tabindex ) {
                $buttons = [];
 
-               $buttonLabel = $this->context->msg( $this->getSaveButtonLabel() )->text();
+               $buttonLabel = $this->context->msg( $this->getSubmitButtonLabel() )->text();
 
                $attribs = [
                        'name' => 'wpSave',
@@ -4448,11 +4449,10 @@ class EditPage {
         * @param string|array|bool $match Text (or array of texts) which triggered one or more filters
         */
        public function spamPageWithContent( $match = false ) {
-               global $wgLang;
                $this->textbox2 = $this->textbox1;
 
                if ( is_array( $match ) ) {
-                       $match = $wgLang->listToText( $match );
+                       $match = $this->context->getLanguage()->listToText( $match );
                }
                $out = $this->context->getOutput();
                $out->prepareErrorPage( $this->context->msg( 'spamprotectiontitle' ) );
@@ -4640,19 +4640,20 @@ class EditPage {
         * @since 1.29
         */
        protected function addLongPageWarningHeader() {
-               global $wgMaxArticleSize, $wgLang;
+               global $wgMaxArticleSize;
 
                if ( $this->contentLength === false ) {
                        $this->contentLength = strlen( $this->textbox1 );
                }
 
                $out = $this->context->getOutput();
+               $lang = $this->context->getLanguage();
                if ( $this->tooBig || $this->contentLength > $wgMaxArticleSize * 1024 ) {
                        $out->wrapWikiMsg( "<div class='error' id='mw-edit-longpageerror'>\n$1\n</div>",
                                [
                                        'longpageerror',
-                                       $wgLang->formatNum( round( $this->contentLength / 1024, 3 ) ),
-                                       $wgLang->formatNum( $wgMaxArticleSize )
+                                       $lang->formatNum( round( $this->contentLength / 1024, 3 ) ),
+                                       $lang->formatNum( $wgMaxArticleSize )
                                ]
                        );
                } else {
@@ -4660,7 +4661,7 @@ class EditPage {
                                $out->wrapWikiMsg( "<div id='mw-edit-longpage-hint'>\n$1\n</div>",
                                        [
                                                'longpage-hint',
-                                               $wgLang->formatSize( strlen( $this->textbox1 ) ),
+                                               $lang->formatSize( strlen( $this->textbox1 ) ),
                                                strlen( $this->textbox1 )
                                        ]
                                );
@@ -4717,7 +4718,7 @@ class EditPage {
        protected function addExplainConflictHeader( OutputPage $out ) {
                $out->wrapWikiMsg(
                        "<div class='mw-explainconflict'>\n$1\n</div>",
-                       [ 'explainconflict', $this->context->msg( $this->getSaveButtonLabel() )->text() ]
+                       [ 'explainconflict', $this->context->msg( $this->getSubmitButtonLabel() )->text() ]
                );
        }