X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=cfb78cd78d834d09c36c541f1990d08659da287e;hb=590f1bd8c261c882f23c2a404fbcc40ae4e5d460;hp=814c248304a0f03bfc7a3730a7c19e8453f96063;hpb=29115b9e5312bff77223ae2210ab372b0ada3f4d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 814c248304..cfb78cd78d 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -422,8 +422,6 @@ class EditPage { * @param Article $article */ public function __construct( Article $article ) { - global $wgOOUIEditPage; - $this->mArticle = $article; $this->page = $article->getPage(); // model object $this->mTitle = $article->getTitle(); @@ -434,7 +432,7 @@ class EditPage { $handler = ContentHandler::getForModelID( $this->contentModel ); $this->contentFormat = $handler->getDefaultFormat(); - $this->oouiEnabled = $wgOOUIEditPage; + $this->oouiEnabled = $this->context->getConfig()->get( 'OOUIEditPage' ); } /** @@ -1700,7 +1698,7 @@ class EditPage { global $wgParser; if ( $this->sectiontitle !== '' ) { - $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->sectiontitle ); + $sectionanchor = $this->guessSectionName( $this->sectiontitle ); // If no edit summary was specified, create one automatically from the section // title and have it link to the new section. Otherwise, respect the summary as // passed. @@ -1710,7 +1708,7 @@ class EditPage { ->rawParams( $cleanSectionTitle )->inContentLanguage()->text(); } } elseif ( $this->summary !== '' ) { - $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->summary ); + $sectionanchor = $this->guessSectionName( $this->summary ); # This is a new section, so create a link to the new section # in the revision summary. $cleanSummary = $wgParser->stripSectionName( $this->summary ); @@ -1745,7 +1743,7 @@ class EditPage { * time. */ public function internalAttemptSave( &$result, $bot = false ) { - global $wgUser, $wgRequest, $wgParser, $wgMaxArticleSize; + global $wgUser, $wgRequest, $wgMaxArticleSize; global $wgContentHandlerUseDB; $status = Status::newGood(); @@ -2119,7 +2117,7 @@ class EditPage { # We can't deal with anchors, includes, html etc in the header for now, # headline would need to be parsed to improve this. if ( $hasmatch && strlen( $matches[2] ) > 0 ) { - $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $matches[2] ); + $sectionanchor = $this->guessSectionName( $matches[2] ); } } $result['sectionanchor'] = $sectionanchor; @@ -2785,7 +2783,7 @@ class EditPage { $wgOut->addHTML( $this->editFormTextBeforeContent ); if ( !$this->isCssJsSubpage && $showToolbar && $wgUser->getOption( 'showtoolbar' ) ) { - $wgOut->addHTML( EditPage::getEditToolbar( $this->mTitle ) ); + $wgOut->addHTML( self::getEditToolbar( $this->mTitle ) ); } if ( $this->blankArticle ) { @@ -3078,7 +3076,7 @@ class EditPage { 'tabindex' => 1, 'size' => 60, 'spellcheck' => 'true', - ] + Linker::tooltipAndAccesskeyAttribs( 'summary' ); + ]; } /** @@ -3099,6 +3097,7 @@ class EditPage { $inputAttrs = null, $spanLabelAttrs = null ) { $inputAttrs = $this->getSummaryInputAttributes( $inputAttrs ); + $inputAttrs += Linker::tooltipAndAccesskeyAttribs( 'summary' ); $spanLabelAttrs = ( is_array( $spanLabelAttrs ) ? $spanLabelAttrs : [] ) + [ 'class' => $this->missingSummary ? 'mw-summarymissed' : 'mw-summary', @@ -3134,6 +3133,10 @@ class EditPage { $inputAttrs = OOUI\Element::configFromHtmlAttributes( $this->getSummaryInputAttributes( $inputAttrs ) ); + $inputAttrs += [ + 'title' => Linker::titleAttrib( 'summary' ), + 'accessKey' => Linker::accesskey( 'summary' ), + ]; // For compatibility with old scripts and extensions, we want the legacy 'id' on the `` $inputAttrs['inputId'] = $inputAttrs['id']; @@ -3222,16 +3225,13 @@ class EditPage { protected function showFormBeforeText() { global $wgOut; - $section = htmlspecialchars( $this->section ); - $wgOut->addHTML( <<
- - - - - -HTML - ); + + $wgOut->addHTML( Html::hidden( 'wpSection', htmlspecialchars( $this->section ) ) ); + $wgOut->addHTML( Html::hidden( 'wpStarttime', $this->starttime ) ); + $wgOut->addHTML( Html::hidden( 'wpEdittime', $this->edittime ) ); + $wgOut->addHTML( Html::hidden( 'editRevId', $this->editRevId ) ); + $wgOut->addHTML( Html::hidden( 'wpScrolltop', $this->scrolltop ) ); + if ( !$this->checkUnicodeCompliantBrowser() ) { $wgOut->addHTML( Html::hidden( 'safemode', '1' ) ); } @@ -3494,6 +3494,10 @@ HTML } } + /** + * Inserts optional text shown below edit and upload forms. Can be used to offer special + * characters not present on most keyboards for copying/pasting. + */ protected function showEditTools() { global $wgOut; $wgOut->addHTML( '