X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/supprimer.php?a=blobdiff_plain;f=includes%2FOutputPage.php;h=a1c59192c8e97124d863aaaebccc2d0baab4e320;hb=243e0f5d6ced10dbd5c2a82884db4ccb5787c03f;hp=3b4b14a34dd84e4e185d3d4cd89f2a360c5fd5d3;hpb=285134ac5644fe424cf6e7df37aca5b831565641;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 3b4b14a34d..a1c59192c8 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -55,9 +55,8 @@ class OutputPage extends ContextSource { protected $mCanonicalUrl = false; /** - * @var string Should be private - has getter and setter. Contains - * the HTML title */ - public $mPagetitle = ''; + * @var string The contents of

*/ + private $mPageTitle = ''; /** * @var string Contains all of the "" content. Should be private we @@ -404,18 +403,6 @@ class OutputPage extends ContextSource { return $this->mLinktags; } - /** - * Add a new \ with "rel" attribute set to "meta" - * - * @param array $linkarr Associative array mapping attribute names to their - * values, both keys and values will be escaped, and the - * "rel" attribute will be automatically added - */ - function addMetadataLink( array $linkarr ) { - $linkarr['rel'] = $this->getMetadataAttribute(); - $this->addLink( $linkarr ); - } - /** * Set the URL to be used for the . This should be used * in preference to addLink(), to avoid duplicate link tags. @@ -436,22 +423,6 @@ class OutputPage extends ContextSource { return $this->mCanonicalUrl; } - /** - * Get the value of the "rel" attribute for metadata links - * - * @return string - */ - public function getMetadataAttribute() { - # note: buggy CC software only reads first "meta" link - static $haveMeta = false; - if ( $haveMeta ) { - return 'alternate meta'; - } else { - $haveMeta = true; - return 'meta'; - } - } - /** * Add raw HTML to the list of scripts (including \ tag, etc.) * Internal use only. Use OutputPage::addModules() or OutputPage::addJsConfigVars() @@ -809,7 +780,7 @@ class OutputPage extends ContextSource { # this breaks strtotime(). $clientHeader = preg_replace( '/;.*$/', '', $clientHeader ); - Wikimedia\suppressWarnings(); // E_STRICT system time bitching + Wikimedia\suppressWarnings(); // E_STRICT system time warnings $clientHeaderTime = strtotime( $clientHeader ); Wikimedia\restoreWarnings(); if ( !$clientHeaderTime ) { @@ -992,7 +963,7 @@ class OutputPage extends ContextSource { # change "" to "<script>foo&bar</script>" # but leave "foobar" alone $nameWithTags = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $name ) ); - $this->mPagetitle = $nameWithTags; + $this->mPageTitle = $nameWithTags; # change "foo&bar" to "foo&bar" $this->setHTMLTitle( @@ -1007,7 +978,7 @@ class OutputPage extends ContextSource { * @return string */ public function getPageTitle() { - return $this->mPagetitle; + return $this->mPageTitle; } /** @@ -2677,30 +2648,56 @@ class OutputPage extends ContextSource { } } + /** + * Output an error page + * + * @note FatalError exception class provides an alternative. + * @param string $message Error to output. Must be escaped for HTML. + */ public function showFatalError( $message ) { $this->prepareErrorPage( $this->msg( 'internalerror' ) ); $this->addHTML( $message ); } + /** + * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. + */ public function showUnexpectedValueError( $name, $val ) { - $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() ); + wfDeprecated( __METHOD__, '1.32' ); + $this->showFatalError( $this->msg( 'unexpected', $name, $val )->escaped() ); } + /** + * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. + */ public function showFileCopyError( $old, $new ) { - $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() ); + wfDeprecated( __METHOD__, '1.32' ); + $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->escaped() ); } + /** + * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. + */ public function showFileRenameError( $old, $new ) { - $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() ); + wfDeprecated( __METHOD__, '1.32' ); + $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->escpaed() ); } + /** + * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. + */ public function showFileDeleteError( $name ) { - $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() ); + wfDeprecated( __METHOD__, '1.32' ); + $this->showFatalError( $this->msg( 'filedeleteerror', $name )->escaped() ); } + /** + * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead. + */ public function showFileNotFoundError( $name ) { - $this->showFatalError( $this->msg( 'filenotfound', $name )->text() ); + wfDeprecated( __METHOD__, '1.32' ); + $this->showFatalError( $this->msg( 'filenotfound', $name )->escaped() ); } /** @@ -3504,6 +3501,13 @@ class OutputPage extends ContextSource { ] ); } + // Allow extensions to add, remove and/or otherwise manipulate these links + // If you want only to *add* links, please use the addHeadItem() + // (or addHeadItems() for multiple items) method instead. + // This hook is provided as a last resort for extensions to modify these + // links before the output is sent to client. + Hooks::run( 'OutputPageAfterGetHeadLinksArray', [ &$tags, $this ] ); + return $tags; } @@ -4011,7 +4015,7 @@ class OutputPage extends ContextSource { * @since 1.32 */ public function getCSPNonce() { - if ( !ContentSecurityPolicy::isEnabled( $this->getConfig() ) ) { + if ( !ContentSecurityPolicy::isNonceRequired( $this->getConfig() ) ) { return false; } if ( $this->CSPNonce === null ) {