/** @var array Array of elements in "<head>". Parser might add its own headers! */
protected $mHeadItems = [];
+ /** @var array Additional <body> classes; there are also <body> classes from other sources */
+ protected $mAdditionalBodyClasses = [];
+
/** @var array */
protected $mModules = [];
* @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 $param
+ * @param string $type
* @return array Array of module names
*/
public function getModules( $filter = false, $position = null, $param = 'mModules',
return isset( $this->mHeadItems[$name] );
}
+ /**
+ * Add a class to the <body> element
+ *
+ * @since 1.30
+ * @param string|string[] $classes One or more classes to add
+ */
+ public function addBodyClasses( $classes ) {
+ $this->mAdditionalBodyClasses = array_merge( $this->mAdditionalBodyClasses, (array)$classes );
+ }
+
/**
* @deprecated since 1.28 Obsolete - wgUseETag experiment was removed.
* @param string $tag
* the TTL is higher the older the $mtime timestamp is. Essentially, the
* TTL is 90% of the age of the object, subject to the min and max.
*
- * @param string|integer|float|bool|null $mtime Last-Modified timestamp
- * @param integer $minTTL Mimimum TTL in seconds [default: 1 minute]
- * @param integer $maxTTL Maximum TTL in seconds [default: $wgSquidMaxage]
- * @return integer TTL in seconds
+ * @param string|int|float|bool|null $mtime Last-Modified timestamp
+ * @param int $minTTL Mimimum TTL in seconds [default: 1 minute]
+ * @param int $maxTTL Maximum TTL in seconds [default: $wgSquidMaxage]
+ * @return int TTL in seconds
* @since 1.28
*/
public function adaptCdnTTL( $mtime, $minTTL = 0, $maxTTL = 0 ) {
}
$age = time() - wfTimestamp( TS_UNIX, $mtime );
- $adaptiveTTL = max( .9 * $age, $minTTL );
+ $adaptiveTTL = max( 0.9 * $age, $minTTL );
$adaptiveTTL = min( $adaptiveTTL, $maxTTL );
$this->lowerCdnMaxage( (int)$adaptiveTTL );
$pieces[] = Html::closeElement( 'head' );
- $bodyClasses = [];
+ $bodyClasses = $this->mAdditionalBodyClasses;
$bodyClasses[] = 'mediawiki';
# Classes for LTR/RTL directionality support