X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=4f6b7b4bbbaa1448bd418cb40214fe85f8e9670e;hb=4816ed72995acb2f849db10d7a552acc613044a9;hp=27671bcebf43e9cd18d57a7a695f32cae6a5b371;hpb=b33bc40e4026ba286569ab1b5baf609844f34a50;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 27671bcebf..4f6b7b4bbb 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -504,16 +504,6 @@ class EditPage { } } - /** - * Check if the edit page is using OOUI controls - * @return bool Always true - * @deprecated since 1.30 - */ - public function isOouiEnabled() { - wfDeprecated( __METHOD__, '1.30' ); - return true; - } - /** * Returns if the given content model is editable. * @@ -2473,9 +2463,11 @@ ERROR; if ( $namespace == NS_MEDIAWIKI ) { # Show a warning if editing an interface message $out->wrapWikiMsg( "
\n$1\n
", 'editinginterface' ); - # If this is a default message (but not css or js), + # If this is a default message (but not css, json, or js), # show a hint that it is translatable on translatewiki.net - if ( !$this->mTitle->hasContentModel( CONTENT_MODEL_CSS ) + if ( + !$this->mTitle->hasContentModel( CONTENT_MODEL_CSS ) + && !$this->mTitle->hasContentModel( CONTENT_MODEL_JSON ) && !$this->mTitle->hasContentModel( CONTENT_MODEL_JAVASCRIPT ) ) { $defaultMessageText = $this->mTitle->getDefaultMessageText(); @@ -3095,10 +3087,12 @@ ERROR; } if ( $this->getTitle()->isSubpageOf( $user->getUserPage() ) ) { $isUserCssConfig = $this->mTitle->isUserCssConfigPage(); + $isUserJsonConfig = $this->mTitle->isUserJsonConfigPage(); + $isUserJsConfig = $this->mTitle->isUserJsConfigPage(); $warning = $isUserCssConfig ? 'usercssispublic' - : 'userjsispublic'; + : ( $isUserJsonConfig ? 'userjsonispublic' : 'userjsispublic' ); $out->wrapWikiMsg( '
$1
', $warning ); @@ -3109,9 +3103,12 @@ ERROR; "
\n$1\n
", [ 'usercssyoucanpreview' ] ); - } - - if ( $this->mTitle->isJsSubpage() && $config->get( 'AllowUserJs' ) ) { + } elseif ( $isUserJsonConfig /* No comparable 'AllowUserJson' */ ) { + $out->wrapWikiMsg( + "
\n$1\n
", + [ 'userjsonyoucanpreview' ] + ); + } elseif ( $isUserJsConfig && $config->get( 'AllowUserJs' ) ) { $out->wrapWikiMsg( "
\n$1\n
", [ 'userjsyoucanpreview' ] @@ -3848,6 +3845,11 @@ ERROR; if ( $level === 'user' && !$config->get( 'AllowUserCss' ) ) { $format = false; } + } elseif ( $content->getModel() == CONTENT_MODEL_JSON ) { + $format = 'json'; + if ( $level === 'user' /* No comparable 'AllowUserJson' */ ) { + $format = false; + } } elseif ( $content->getModel() == CONTENT_MODEL_JAVASCRIPT ) { $format = 'js'; if ( $level === 'user' && !$config->get( 'AllowUserJs' ) ) { @@ -3858,7 +3860,8 @@ ERROR; } # Used messages to make sure grep find them: - # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview + # Messages: usercsspreview, userjsonpreview, userjspreview, + # sitecsspreview, sitejsonpreview, sitejspreview if ( $level && $format ) { $note = "
" . $this->context->msg( "{$level}{$format}preview" )->text() . @@ -3880,6 +3883,9 @@ ERROR; $previewHTML = $parserResult['html']; $this->mParserOutput = $parserOutput; $out->addParserOutputMetadata( $parserOutput ); + if ( $out->userCanPreview() ) { + $out->addContentOverride( $this->getTitle(), $content ); + } if ( count( $parserOutput->getWarnings() ) ) { $note .= "\n\n" . implode( "\n\n", $parserOutput->getWarnings() );