X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=2d5b9e20b585cf57020feb354d571d22afa507e2;hb=2e1ac38485b9c78890944413cba074474c06bd34;hp=add48d99b919d6c504d37c0fbdeac4890b9efb1b;hpb=7ecbff2360a07755f771c648ed1e27ee3dca8ad5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index add48d99b9..2d5b9e20b5 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -637,13 +637,6 @@ class EditPage { $this->context->getUser()->spreadAnyEditBlock(); } ); } - - $config = $this->context->getConfig(); - if ( $config->get( 'EnableBlockNoticeStats' ) ) { - $wiki = $config->get( 'DBname' ); - $statsd = MediaWikiServices::getInstance()->getStatsdDataFactory(); - $statsd->increment( 'BlockNotices.' . $wiki . '.WikitextEditor.shown' ); - } } $this->displayPermissionsError( $permErrors ); @@ -1816,15 +1809,14 @@ ERROR; * @return string */ private function newSectionSummary( &$sectionanchor = null ) { - global $wgParser; - if ( $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. if ( $this->summary === '' ) { - $cleanSectionTitle = $wgParser->stripSectionName( $this->sectiontitle ); + $cleanSectionTitle = MediaWikiServices::getInstance()->getParser() + ->stripSectionName( $this->sectiontitle ); return $this->context->msg( 'newsectionsummary' ) ->plaintextParams( $cleanSectionTitle )->inContentLanguage()->text(); } @@ -1832,7 +1824,8 @@ ERROR; $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 ); + $cleanSummary = MediaWikiServices::getInstance()->getParser() + ->stripSectionName( $this->summary ); return $this->context->msg( 'newsectionsummary' ) ->plaintextParams( $cleanSummary )->inContentLanguage()->text(); } @@ -2616,7 +2609,8 @@ ERROR; LogEventsList::showLogExtract( $out, 'block', - MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget(), + MediaWikiServices::getInstance()->getNamespaceInfo()-> + getCanonicalName( NS_USER ) . ':' . $block->getTarget(), '', [ 'lim' => 1, @@ -3058,8 +3052,8 @@ ERROR; public static function extractSectionTitle( $text ) { preg_match( "/^(=+)(.+)\\1\\s*(\n|$)/i", $text, $matches ); if ( !empty( $matches[2] ) ) { - global $wgParser; - return $wgParser->stripSectionName( trim( $matches[2] ) ); + return MediaWikiServices::getInstance()->getParser() + ->stripSectionName( trim( $matches[2] ) ); } else { return false; } @@ -3329,11 +3323,10 @@ ERROR; return ""; } - global $wgParser; - if ( $isSubjectPreview ) { $summary = $this->context->msg( 'newsectionsummary' ) - ->rawParams( $wgParser->stripSectionName( $summary ) ) + ->rawParams( MediaWikiServices::getInstance()->getParser() + ->stripSectionName( $summary ) ) ->inContentLanguage()->text(); } @@ -4459,7 +4452,9 @@ ERROR; protected function addPageProtectionWarningHeaders() { $out = $this->context->getOutput(); if ( $this->mTitle->isProtected( 'edit' ) && - MWNamespace::getRestrictionLevels( $this->mTitle->getNamespace() ) !== [ '' ] + MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels( + $this->mTitle->getNamespace() + ) !== [ '' ] ) { # Is the title semi-protected? if ( $this->mTitle->isSemiProtected() ) { @@ -4538,16 +4533,15 @@ ERROR; * @return string */ private function guessSectionName( $text ) { - global $wgParser; - // Detect Microsoft browsers $userAgent = $this->context->getRequest()->getHeader( 'User-Agent' ); + $parser = MediaWikiServices::getInstance()->getParser(); if ( $userAgent && preg_match( '/MSIE|Edge/', $userAgent ) ) { // ...and redirect them to legacy encoding, if available - return $wgParser->guessLegacySectionNameFromWikiText( $text ); + return $parser->guessLegacySectionNameFromWikiText( $text ); } // Meanwhile, real browsers get real anchors - $name = $wgParser->guessSectionNameFromWikiText( $text ); + $name = $parser->guessSectionNameFromWikiText( $text ); // With one little caveat: per T216029, fragments in HTTP redirects need to be urlencoded, // otherwise Chrome double-escapes the rest of the URL. return '#' . urlencode( mb_substr( $name, 1 ) );