X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=8226da5a78e3ce9138141dca26e5800075b20e06;hb=a381d40d949c2380ab8b7c13b881137624b3f442;hp=606b4cde02592bf27a9f38e71824948b0d350a94;hpb=eb2f439768d34254964e798d9523211ba8ea2f5f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 606b4cde02..8226da5a78 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1613,8 +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 ] + ) ) { # Error messages etc. could be handled within the hook... $status->fatal( 'hookaborted' ); $status->value = self::AS_HOOK_ERROR; @@ -1846,8 +1846,17 @@ class EditPage { } elseif ( !$wgUser->isAllowed( 'editcontentmodel' ) ) { $status->setResult( false, self::AS_NO_CHANGE_CONTENT_MODEL ); return $status; - } + // Make sure the user can edit the page under the new content model too + $titleWithNewContentModel = clone $this->mTitle; + $titleWithNewContentModel->setContentModel( $this->contentModel ); + if ( !$titleWithNewContentModel->userCan( 'editcontentmodel', $wgUser ) + || !$titleWithNewContentModel->userCan( 'edit', $wgUser ) + ) { + $status->setResult( false, self::AS_NO_CHANGE_CONTENT_MODEL ); + return $status; + } + $changingContentModel = true; $oldContentModel = $this->mTitle->getContentModel(); } @@ -3296,6 +3305,23 @@ HTML 'style' => '' ]; + // The following classes can be used here: + // * mw-editfont-default + // * mw-editfont-monospace + // * mw-editfont-sans-serif + // * mw-editfont-serif + $class = 'mw-editfont-' . $wgUser->getOption( 'editfont' ); + + if ( isset( $attribs['class'] ) ) { + if ( is_string( $attribs['class'] ) ) { + $attribs['class'] .= ' ' . $class; + } elseif ( is_array( $attribs['class'] ) ) { + $attribs['class'][] = $class; + } + } else { + $attribs['class'] = $class; + } + $pageLang = $this->mTitle->getPageLanguage(); $attribs['lang'] = $pageLang->getHtmlCode(); $attribs['dir'] = $pageLang->getDir(); @@ -3401,7 +3427,7 @@ HTML } if ( $newContent ) { - ContentHandler::runLegacyHooks( 'EditPageGetDiffText', [ $this, &$newContent ] ); + ContentHandler::runLegacyHooks( 'EditPageGetDiffText', [ $this, &$newContent ], '1.21' ); Hooks::run( 'EditPageGetDiffContent', [ $this, &$newContent ] ); $popts = ParserOptions::newFromUserAndLang( $wgUser, $wgContLang ); @@ -3487,7 +3513,7 @@ HTML * @param string $format Output format, valid values are any function of a Message object * @return string */ - public static function getCopyrightWarning( $title, $format = 'plain' ) { + public static function getCopyrightWarning( $title, $format = 'plain', $langcode = null ) { global $wgRightsText; if ( $wgRightsText ) { $copywarnMsg = [ 'copyrightwarning', @@ -3500,8 +3526,12 @@ HTML // Allow for site and per-namespace customization of contribution/copyright notice. Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsg ] ); + $msg = call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title ); + if ( $langcode ) { + $msg->inLanguage( $langcode ); + } return "
\n" . - call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title )->$format() . "\n
"; + $msg->$format() . "\n"; } /** @@ -3810,7 +3840,7 @@ HTML } $hook_args = [ $this, &$content ]; - ContentHandler::runLegacyHooks( 'EditPageGetPreviewText', $hook_args ); + ContentHandler::runLegacyHooks( 'EditPageGetPreviewText', $hook_args, '1.25' ); Hooks::run( 'EditPageGetPreviewContent', $hook_args ); $parserResult = $this->doPreviewParse( $content ); @@ -4136,7 +4166,7 @@ HTML 'name' => 'wpSave', 'tabindex' => ++$tabindex, ] + Linker::tooltipAndAccesskeyAttribs( 'save' ); - $buttons['save'] = Html::submitButton( $buttonLabel, $attribs, [ 'mw-ui-constructive' ] ); + $buttons['save'] = Html::submitButton( $buttonLabel, $attribs, [ 'mw-ui-progressive' ] ); ++$tabindex; // use the same for preview and live preview $attribs = [ @@ -4254,7 +4284,7 @@ HTML protected function safeUnicodeOutput( $text ) { return $this->checkUnicodeCompliantBrowser() ? $text - : $this->makesafe( $text ); + : $this->makeSafe( $text ); } /**