Merge "resources: Deprecate the 'jquery.badge' module"
[lhc/web/wiklou.git] / includes / EditPage.php
index 1588f82..bc91623 100644 (file)
@@ -519,6 +519,7 @@ class EditPage {
         * @deprecated since 1.30
         */
        public function isOouiEnabled() {
+               wfDeprecated( __METHOD__, '1.30' );
                return true;
        }
 
@@ -821,8 +822,15 @@ class EditPage {
         * @return bool
         */
        protected function previewOnOpen() {
-               $previewOnOpenNamespaces = $this->context->getConfig()->get( 'PreviewOnOpenNamespaces' );
+               $config = $this->context->getConfig();
+               $previewOnOpenNamespaces = $config->get( 'PreviewOnOpenNamespaces' );
                $request = $this->context->getRequest();
+               if ( $config->get( 'RawHtml' ) ) {
+                       // If raw HTML is enabled, disable preview on open
+                       // since it has to be posted with a token for
+                       // security reasons
+                       return false;
+               }
                if ( $request->getVal( 'preview' ) == 'yes' ) {
                        // Explicit override from request
                        return true;
@@ -1684,7 +1692,7 @@ class EditPage {
 
                // Run new style post-section-merge edit filter
                if ( !Hooks::run( 'EditFilterMergedContent',
-                               [ $this->mArticle->getContext(), $content, $status, $this->summary,
+                               [ $this->context, $content, $status, $this->summary,
                                $user, $this->minoredit ] )
                ) {
                        # Error messages etc. could be handled within the hook...
@@ -3158,7 +3166,7 @@ class EditPage {
         */
        function getSummaryInputOOUI( $summary = "", $labelText = null, $inputAttrs = null ) {
                wfDeprecated( __METHOD__, '1.30' );
-               $this->getSummaryInputWidget( $summary, $labelText, $inputAttrs );
+               return $this->getSummaryInputWidget( $summary, $labelText, $inputAttrs );
        }
 
        /**
@@ -3477,7 +3485,7 @@ class EditPage {
                                $newContent = $oldContent->getContentHandler()->makeEmptyContent();
                        }
 
-                       $de = $oldContent->getContentHandler()->createDifferenceEngine( $this->mArticle->getContext() );
+                       $de = $oldContent->getContentHandler()->createDifferenceEngine( $this->context );
                        $de->setContent( $oldContent, $newContent );
 
                        $difftext = $de->getDiff( $oldtitle, $newtitle );
@@ -3685,7 +3693,7 @@ class EditPage {
                        $content2 = $this->toEditContent( $this->textbox2 );
 
                        $handler = ContentHandler::getForModelID( $this->contentModel );
-                       $de = $handler->createDifferenceEngine( $this->mArticle->getContext() );
+                       $de = $handler->createDifferenceEngine( $this->context );
                        $de->setContent( $content2, $content1 );
                        $de->showDiff(
                                $this->context->msg( 'yourtext' )->parse(),
@@ -3968,7 +3976,7 @@ class EditPage {
         * @return ParserOptions
         */
        protected function getPreviewParserOptions() {
-               $parserOptions = $this->page->makeParserOptions( $this->mArticle->getContext() );
+               $parserOptions = $this->page->makeParserOptions( $this->context );
                $parserOptions->setIsPreview( true );
                $parserOptions->setIsSectionPreview( !is_null( $this->section ) && $this->section !== '' );
                $parserOptions->enableLimitReport();
@@ -4220,6 +4228,7 @@ class EditPage {
         * @return array
         */
        public function getCheckboxes( &$tabindex, $checked ) {
+               wfDeprecated( __METHOD__, '1.30' );
                $checkboxes = [];
                $checkboxesDef = $this->getCheckboxesDefinition( $checked );
 
@@ -4275,6 +4284,7 @@ class EditPage {
         * @return array Associative array of string keys to OOUI\FieldLayout instances
         */
        public function getCheckboxesOOUI( &$tabindex, $checked ) {
+               wfDeprecated( __METHOD__, '1.30' );
                return $this->getCheckboxesWidget( $tabindex, $checked );
        }
 
@@ -4352,6 +4362,7 @@ class EditPage {
        /**
         * Get the message key of the label for the button to save the page
         *
+        * @since 1.30
         * @return string
         */
        protected function getSubmitButtonLabel() {
@@ -4653,7 +4664,6 @@ class EditPage {
                        ];
 
                // The following classes can be used here:
-               // * mw-editfont-default
                // * mw-editfont-monospace
                // * mw-editfont-sans-serif
                // * mw-editfont-serif