X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FOutputPage.php;h=99dd4a7c0e629c77591b82723db2cbf6c7b7a2cf;hb=1f664ea4ebc686f3879e806d2059a85df18e3cd2;hp=e6345ba7ec2727ebd0392512a3649a223141a90c;hpb=92571d7c1a9c25604382f9c395e487e44cc442d5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e6345ba7ec..99dd4a7c0e 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -287,11 +287,6 @@ class OutputPage extends ContextSource { */ private $mEnableTOC = false; - /** - * @var bool Whether parser output should contain section edit links - */ - private $mEnableSectionEditLinks = true; - /** * @var string|null The URL to send in a element with rel=license */ @@ -493,7 +488,7 @@ class OutputPage extends ContextSource { * Filter an array of modules to remove insufficiently trustworthy members, and modules * which are no longer registered (eg a page is cached before an extension is disabled) * @param array $modules - * @param string|null $position If not null, only return modules with this position + * @param string|null $position Unused * @param string $type * @return array */ @@ -506,7 +501,6 @@ class OutputPage extends ContextSource { $module = $resourceLoader->getModule( $val ); if ( $module instanceof ResourceLoaderModule && $module->getOrigin() <= $this->getAllowedModules( $type ) - && ( is_null( $position ) || $module->getPosition() == $position ) ) { if ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) ) { $this->warnModuleTargetFilter( $module->getName() ); @@ -537,7 +531,7 @@ class OutputPage extends ContextSource { * Get the list of modules to include on this page * * @param bool $filter Whether to filter out insufficiently trustworthy modules - * @param string|null $position If not null, only return modules with this position + * @param string|null $position Unused * @param string $param * @param string $type * @return array Array of module names @@ -547,7 +541,7 @@ class OutputPage extends ContextSource { ) { $modules = array_values( array_unique( $this->$param ) ); return $filter - ? $this->filterModules( $modules, $position, $type ) + ? $this->filterModules( $modules, null, $type ) : $modules; } @@ -566,11 +560,11 @@ class OutputPage extends ContextSource { * Get the list of module JS to include on this page * * @param bool $filter - * @param string|null $position + * @param string|null $position Unused * @return array Array of module names */ public function getModuleScripts( $filter = false, $position = null ) { - return $this->getModules( $filter, $position, 'mModuleScripts', + return $this->getModules( $filter, null, 'mModuleScripts', ResourceLoaderModule::TYPE_SCRIPTS ); } @@ -590,11 +584,11 @@ class OutputPage extends ContextSource { * Get the list of module CSS to include on this page * * @param bool $filter - * @param string|null $position + * @param string|null $position Unused * @return array Array of module names */ public function getModuleStyles( $filter = false, $position = null ) { - return $this->getModules( $filter, $position, 'mModuleStyles', + return $this->getModules( $filter, null, 'mModuleStyles', ResourceLoaderModule::TYPE_STYLES ); } @@ -777,9 +771,9 @@ class OutputPage extends ContextSource { # this breaks strtotime(). $clientHeader = preg_replace( '/;.*$/', '', $clientHeader ); - MediaWiki\suppressWarnings(); // E_STRICT system time bitching + Wikimedia\suppressWarnings(); // E_STRICT system time bitching $clientHeaderTime = strtotime( $clientHeader ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); if ( !$clientHeaderTime ) { wfDebug( __METHOD__ . ": unable to parse the client's If-Modified-Since header: $clientHeader\n" ); @@ -1548,7 +1542,6 @@ class OutputPage extends ContextSource { // Someone is trying to set a bogus pre-$wgUser PO. Check if it has // been changed somehow, and keep it if so. $anonPO = ParserOptions::newFromAnon(); - $anonPO->setEditSection( false ); $anonPO->setAllowUnsafeRawHtml( false ); if ( !$options->matches( $anonPO ) ) { wfLogWarning( __METHOD__ . ': Setting a changed bogus ParserOptions: ' . wfGetAllCallers( 5 ) ); @@ -1562,7 +1555,6 @@ class OutputPage extends ContextSource { // ParserOptions for it. And don't cache this ParserOptions // either. $po = ParserOptions::newFromAnon(); - $po->setEditSection( false ); $po->setAllowUnsafeRawHtml( false ); $po->isBogus = true; if ( $options !== null ) { @@ -1572,7 +1564,6 @@ class OutputPage extends ContextSource { } $this->mParserOptions = ParserOptions::newFromContext( $this->getContext() ); - $this->mParserOptions->setEditSection( false ); $this->mParserOptions->setAllowUnsafeRawHtml( false ); } @@ -1822,7 +1813,7 @@ class OutputPage extends ContextSource { // so that extensions may modify ParserOutput to toggle TOC. // This cannot be moved to addParserOutputText because that is not // called by EditPage for Preview. - if ( $parserOutput->getTOCEnabled() && $parserOutput->getTOCHTML() ) { + if ( $parserOutput->getTOCHTML() ) { $this->mEnableTOC = true; } } @@ -1868,17 +1859,6 @@ class OutputPage extends ContextSource { */ function addParserOutput( $parserOutput, $poOptions = [] ) { $this->addParserOutputMetadata( $parserOutput ); - - // Touch section edit links only if not previously disabled - if ( $parserOutput->getEditSectionTokens() ) { - $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks ); - } - if ( !$this->mEnableSectionEditLinks - && !array_key_exists( 'enableSectionEditLinks', $poOptions ) - ) { - $poOptions['enableSectionEditLinks'] = false; - } - $this->addParserOutputText( $parserOutput, $poOptions ); } @@ -2808,7 +2788,9 @@ class OutputPage extends ContextSource { $this->rlUserModuleState = $exemptStates['user'] = $userState; } - $rlClient = new ResourceLoaderClientHtml( $context, $this->getTarget() ); + $rlClient = new ResourceLoaderClientHtml( $context, [ + 'target' => $this->getTarget(), + ] ); $rlClient->setConfig( $this->getJSVars() ); $rlClient->setModules( $this->getModules( /*filter*/ true ) ); $rlClient->setModuleStyles( $moduleStyles ); @@ -2965,20 +2947,20 @@ class OutputPage extends ContextSource { private function isUserJsPreview() { return $this->getConfig()->get( 'AllowUserJs' ) && $this->getTitle() - && $this->getTitle()->isJsSubpage() + && $this->getTitle()->isUserJsConfigPage() && $this->userCanPreview(); } protected function isUserCssPreview() { return $this->getConfig()->get( 'AllowUserCss' ) && $this->getTitle() - && $this->getTitle()->isCssSubpage() + && $this->getTitle()->isUserCssConfigPage() && $this->userCanPreview(); } /** - * JS stuff to put at the bottom of the ``. These are modules with position 'bottom', - * legacy scripts ($this->mScripts), and user JS. + * JS stuff to put at the bottom of the ``. + * These are legacy scripts ($this->mScripts), and user JS. * * @return string|WrappedStringList HTML */ @@ -3224,7 +3206,10 @@ class OutputPage extends ContextSource { } $title = $this->getTitle(); - if ( !$title->isJsSubpage() && !$title->isCssSubpage() ) { + if ( + !$title->isUserJsConfigPage() + && !$title->isUserCssConfigPage() + ) { return false; } if ( !$title->isSubpageOf( $user->getUserPage() ) ) { @@ -3896,7 +3881,7 @@ class OutputPage extends ContextSource { * @deprecated since 1.31, use $poOptions to addParserOutput() instead. */ public function enableSectionEditLinks( $flag = true ) { - $this->mEnableSectionEditLinks = $flag; + wfDeprecated( __METHOD__, '1.31' ); } /** @@ -3905,7 +3890,8 @@ class OutputPage extends ContextSource { * @deprecated since 1.31, use $poOptions to addParserOutput() instead. */ public function sectionEditLinksEnabled() { - return $this->mEnableSectionEditLinks; + wfDeprecated( __METHOD__, '1.31' ); + return true; } /**