X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22lang_raccourcis%22%2C%22module=%24nom_module%22%29%20.%20%22?a=blobdiff_plain;f=includes%2FEditPage.php;h=1c13d56e2f779930ffa6936caefc59f63da51685;hb=8195f481a6b6083138d6258ff85f9fc1a4307b65;hp=8226da5a78e3ce9138141dca26e5800075b20e06;hpb=0a6f97bf407959b2dc06a39aab4b351d75e27b98;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 8226da5a78..1c13d56e2f 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1613,7 +1613,8 @@ 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 ] + [ $this, $content, &$this->hookError, $this->summary ], + '1.21' ) ) { # Error messages etc. could be handled within the hook... $status->fatal( 'hookaborted' ); @@ -1639,7 +1640,7 @@ class EditPage { // being set. This is used by ConfirmEdit to display a captcha // without any error message cruft. } else { - $this->hookError = $status->getWikiText(); + $this->hookError = $this->formatStatusErrors( $status ); } // Use the existing $status->value if the hook set it if ( !$status->value ) { @@ -1649,7 +1650,7 @@ class EditPage { } elseif ( !$status->isOK() ) { # ...or the hook could be expecting us to produce an error // FIXME this sucks, we should just use the Status object throughout - $this->hookError = $status->getWikiText(); + $this->hookError = $this->formatStatusErrors( $status ); $status->fatal( 'hookaborted' ); $status->value = self::AS_HOOK_ERROR_EXPECTED; return false; @@ -1658,6 +1659,26 @@ class EditPage { return true; } + /** + * Wrap status errors in an errorbox for increased visiblity + * + * @param Status $status + * @return string + */ + private function formatStatusErrors( Status $status ) { + $errmsg = $status->getHTML( + 'edit-error-short', + 'edit-error-long', + $this->context->getLanguage() + ); + return << +{$errmsg} + +
+ERROR; + } + /** * Return the summary to be used for a new section. *