Remove useless title parameter in CategoryPager
[lhc/web/wiklou.git] / includes / EditPage.php
index 1f871e1..e070ca3 100644 (file)
@@ -498,6 +498,9 @@ class EditPage {
                $this->enableApiEditOverride = $enableOverride;
        }
 
+       /**
+        * @deprecated since 1.29, call edit directly
+        */
        function submit() {
                $this->edit();
        }
@@ -1621,15 +1624,7 @@ class EditPage {
         */
        protected function runPostMergeFilters( Content $content, Status $status, User $user ) {
                // Run old style post-section-merge edit filter
-               if ( !ContentHandler::runLegacyHooks( 'EditFilterMerged',
-                       [ $this, $content, &$this->hookError, $this->summary ],
-                       '1.21'
-               ) ) {
-                       # Error messages etc. could be handled within the hook...
-                       $status->fatal( 'hookaborted' );
-                       $status->value = self::AS_HOOK_ERROR;
-                       return false;
-               } elseif ( $this->hookError != '' ) {
+               if ( $this->hookError != '' ) {
                        # ...or the hook could be expecting us to produce an error
                        $status->fatal( 'hookaborted' );
                        $status->value = self::AS_HOOK_ERROR_EXPECTED;
@@ -2602,7 +2597,9 @@ class EditPage {
                        $previewOutput = $this->getPreviewText();
                }
 
-               Hooks::run( 'EditPage::showEditForm:initial', [ &$this, &$wgOut ] );
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $editPage = $this;
+               Hooks::run( 'EditPage::showEditForm:initial', [ &$editPage, &$wgOut ] );
 
                $this->setHeaders();
 
@@ -2679,7 +2676,9 @@ class EditPage {
                        . Xml::closeElement( 'div' )
                );
 
-               Hooks::run( 'EditPage::showEditForm:fields', [ &$this, &$wgOut ] );
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $editPage = $this;
+               Hooks::run( 'EditPage::showEditForm:fields', [ &$editPage, &$wgOut ] );
 
                // Put these up at the top to ensure they aren't lost on early form submission
                $this->showFormBeforeText();
@@ -2839,7 +2838,7 @@ class EditPage {
         * @param Title[] $templates
         * @return string HTML
         */
-       protected function makeTemplatesOnThisPageList( array $templates ) {
+       public function makeTemplatesOnThisPageList( array $templates ) {
                $templateListFormatter = new TemplatesOnThisPageFormatter(
                        $this->context, MediaWikiServices::getInstance()->getLinkRenderer()
                );
@@ -3541,7 +3540,9 @@ HTML
        protected function showConflict() {
                global $wgOut;
 
-               if ( Hooks::run( 'EditPageBeforeConflictDiff', [ &$this, &$wgOut ] ) ) {
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $editPage = $this;
+               if ( Hooks::run( 'EditPageBeforeConflictDiff', [ &$editPage, &$wgOut ] ) ) {
                        $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
                        $stats->increment( 'edit.failures.conflict' );
                        // Only include 'standard' namespaces to avoid creating unknown numbers of statsd metrics
@@ -3575,6 +3576,7 @@ HTML
         */
        public function getCancelLink() {
                $cancelParams = [];
+               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
                if ( !$this->isConflict && $this->oldid > 0 ) {
                        $cancelParams['oldid'] = $this->oldid;
                } elseif ( $this->getContextTitle()->isRedirect() ) {
@@ -3582,9 +3584,9 @@ HTML
                }
                $attrs = [ 'id' => 'mw-editform-cancel' ];
 
-               return Linker::linkKnown(
+               return $linkRenderer->makeKnownLink(
                        $this->getContextTitle(),
-                       $this->context->msg( 'cancel' )->parse(),
+                       new HtmlArmor( $this->context->msg( 'cancel' )->parse() ),
                        Html::buttonAttributes( $attrs, [ 'mw-ui-quiet' ] ),
                        $cancelParams
                );
@@ -3773,7 +3775,6 @@ HTML
                        }
 
                        $hook_args = [ $this, &$content ];
-                       ContentHandler::runLegacyHooks( 'EditPageGetPreviewText', $hook_args, '1.25' );
                        Hooks::run( 'EditPageGetPreviewContent', $hook_args );
 
                        $parserResult = $this->doPreviewParse( $content );
@@ -4069,7 +4070,10 @@ HTML
                                $checkboxes['watch'] = $watchThisHtml;
                        }
                }
-               Hooks::run( 'EditPageBeforeEditChecks', [ &$this, &$checkboxes, &$tabindex ] );
+
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $editPage = $this;
+               Hooks::run( 'EditPageBeforeEditChecks', [ &$editPage, &$checkboxes, &$tabindex ] );
                return $checkboxes;
        }
 
@@ -4118,7 +4122,9 @@ HTML
                $buttons['diff'] = Html::submitButton( $this->context->msg( 'showdiff' )->text(),
                        $attribs );
 
-               Hooks::run( 'EditPageBeforeEditButtons', [ &$this, &$buttons, &$tabindex ] );
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $editPage = $this;
+               Hooks::run( 'EditPageBeforeEditButtons', [ &$editPage, &$buttons, &$tabindex ] );
                return $buttons;
        }
 
@@ -4132,7 +4138,10 @@ HTML
                $wgOut->prepareErrorPage( $this->context->msg( 'nosuchsectiontitle' ) );
 
                $res = $this->context->msg( 'nosuchsectiontext', $this->section )->parseAsBlock();
-               Hooks::run( 'EditPageNoSuchSection', [ &$this, &$res ] );
+
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $editPage = $this;
+               Hooks::run( 'EditPageNoSuchSection', [ &$editPage, &$res ] );
                $wgOut->addHTML( $res );
 
                $wgOut->returnToMain( false, $this->mTitle );
@@ -4427,8 +4436,8 @@ HTML
                $attribs = $customAttribs + [
                                'accesskey' => ',',
                                'id' => $name,
-                               'cols' => $user->getIntOption( 'cols' ),
-                               'rows' => $user->getIntOption( 'rows' ),
+                               'cols' => 80,
+                               'rows' => 25,
                                // Avoid PHP notices when appending preferences
                                // (appending allows customAttribs['style'] to still work).
                                'style' => ''