* a OutputPage tied to that context.
* @param IContextSource $context
*/
- function __construct( IContextSource $context ) {
+ public function __construct( IContextSource $context ) {
$this->setContext( $context );
}
* @param string $name Name of the meta tag
* @param string $val Value of the meta tag
*/
- function addMeta( $name, $val ) {
- array_push( $this->mMetatags, [ $name, $val ] );
+ public function addMeta( $name, $val ) {
+ $this->mMetatags[] = [ $name, $val ];
}
/**
*
* @param array $linkarr Associative array of attributes.
*/
- function addLink( array $linkarr ) {
- array_push( $this->mLinktags, $linkarr );
+ public function addLink( array $linkarr ) {
+ $this->mLinktags[] = $linkarr;
}
/**
* in preference to addLink(), to avoid duplicate link tags.
* @param string $url
*/
- function setCanonicalUrl( $url ) {
+ public function setCanonicalUrl( $url ) {
$this->mCanonicalUrl = $url;
}
*
* @param string $script Raw HTML
*/
- function addScript( $script ) {
+ public function addScript( $script ) {
$this->mScripts .= $script;
}
*
* @return array
*/
- function getHeadItemsArray() {
+ public function getHeadItemsArray() {
return $this->mHeadItems;
}
* @param Title $t
*/
public function setTitle( Title $t ) {
+ // @phan-suppress-next-next-line PhanUndeclaredMethod
+ // @fixme Not all implementations of IContextSource have this method!
$this->getContext()->setTitle( $t );
}
* @param ParserOptions|null $options Either the ParserOption to use or null to only get the
* current ParserOption object. This parameter is deprecated since 1.31.
* @return ParserOptions
+ * @suppress PhanUndeclaredProperty For isBogus
*/
public function parserOptions( $options = null ) {
if ( $options !== null ) {
* @param ParserOutput $parserOutput
* @param array $poOptions Options to ParserOutput::getText()
*/
- function addParserOutput( ParserOutput $parserOutput, $poOptions = [] ) {
+ public function addParserOutput( ParserOutput $parserOutput, $poOptions = [] ) {
$this->addParserOutputMetadata( $parserOutput );
$this->addParserOutputText( $parserOutput, $poOptions );
}
*
* @return array
*/
- function getCacheVaryCookies() {
+ public function getCacheVaryCookies() {
if ( self::$cacheVaryCookies === null ) {
$config = $this->getConfig();
self::$cacheVaryCookies = array_values( array_unique( array_merge(
*
* @return bool
*/
- function haveCacheVaryCookies() {
+ public function haveCacheVaryCookies() {
$request = $this->getRequest();
foreach ( $this->getCacheVaryCookies() as $cookieName ) {
if ( $request->getCookie( $cookieName, '', '' ) !== '' ) {
$this->mCdnMaxage != 0 &&
!$this->haveCacheVaryCookies()
) {
- if ( $config->get( 'UseESI' ) ) {
- wfDeprecated( '$wgUseESI = true', '1.33' );
- # We'll purge the proxy cache explicitly, but require end user agents
- # to revalidate against the proxy on each visit.
- # Surrogate-Control controls our CDN, Cache-Control downstream caches
- wfDebug( __METHOD__ .
- ": proxy caching with ESI; {$this->mLastModified} **", 'private' );
- # start with a shorter timeout for initial testing
- # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
- $response->header(
- "Surrogate-Control: max-age={$config->get( 'CdnMaxAge' )}" .
- "+{$this->mCdnMaxage}, content=\"ESI/1.0\""
- );
- $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
- } else {
- # We'll purge the proxy cache for anons explicitly, but require end user agents
- # to revalidate against the proxy on each visit.
- # IMPORTANT! The CDN needs to replace the Cache-Control header with
- # Cache-Control: s-maxage=0, must-revalidate, max-age=0
- wfDebug( __METHOD__ .
- ": local proxy caching; {$this->mLastModified} **", 'private' );
- # start with a shorter timeout for initial testing
- # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
- $response->header( "Cache-Control: " .
- "s-maxage={$this->mCdnMaxage}, must-revalidate, max-age=0" );
- }
+ # We'll purge the proxy cache for anons explicitly, but require end user agents
+ # to revalidate against the proxy on each visit.
+ # IMPORTANT! The CDN needs to replace the Cache-Control header with
+ # Cache-Control: s-maxage=0, must-revalidate, max-age=0
+ wfDebug( __METHOD__ .
+ ": local proxy caching; {$this->mLastModified} **", 'private' );
+ # start with a shorter timeout for initial testing
+ # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
+ $response->header( "Cache-Control: " .
+ "s-maxage={$this->mCdnMaxage}, must-revalidate, max-age=0" );
} else {
# We do want clients to cache if they can, but they *must* check for updates
# on revisiting the page.
/**
* Add a "return to" link pointing to a specified title
*
- * @param Title $title Title to link
+ * @param LinkTarget $title Title to link
* @param array $query Query string parameters
* @param string|null $text Text of the link (input is not escaped)
* @param array $options Options array to pass to Linker
$sitedir = MediaWikiServices::getInstance()->getContentLanguage()->getDir();
$pieces = [];
- $pieces[] = Html::htmlHeader( Sanitizer::mergeAttributes(
+ $htmlAttribs = Sanitizer::mergeAttributes(
$this->getRlClient()->getDocumentAttributes(),
$sk->getHtmlElementAttributes()
- ) );
+ );
+ $pieces[] = Html::htmlHeader( $htmlAttribs );
$pieces[] = Html::openElement( 'head' );
if ( $this->getHTMLTitle() == '' ) {
}
$pieces[] = Html::element( 'title', null, $this->getHTMLTitle() );
- $pieces[] = $this->getRlClient()->getHeadHtml();
+ $pieces[] = $this->getRlClient()->getHeadHtml( $htmlAttribs['class'] ?? null );
$pieces[] = $this->buildExemptModules();
$pieces = array_merge( $pieces, array_values( $this->getHeadLinksArray() ) );
$pieces = array_merge( $pieces, array_values( $this->mHeadItems ) );