/**
* Feature flags to indicate to extensions that MediaWiki core supports and
* uses getText() stateless transforms.
+ *
+ * @since 1.31
*/
const SUPPORTS_STATELESS_TRANSFORMS = 1;
+
+ /**
+ * @since 1.31
+ */
const SUPPORTS_UNWRAP_TRANSFORM = 1;
/**
/** @var int|null Assumed rev ID for {{REVISIONID}} if no revision is set */
private $mSpeculativeRevId;
+ /** @var int|null Assumed rev timestamp for {{REVISIONTIMESTAMP}} if no revision is set */
+ private $revisionTimestampUsed;
+
+ /** @var string|null SHA-1 base 36 hash of any self-transclusion */
+ private $revisionUsedSha1Base36;
+
/** string CSS classes to use for the wrapping div, stored in the array keys.
* If no class is given, no wrapper is added.
*/
return $this->mSpeculativeRevId;
}
+ /**
+ * @param string $timestamp TS_MW timestamp
+ * @since 1.34
+ */
+ public function setRevisionTimestampUsed( $timestamp ) {
+ $this->revisionTimestampUsed = $timestamp;
+ }
+
+ /**
+ * @return string|null TS_MW timestamp or null if not used
+ * @since 1.34
+ */
+ public function getRevisionTimestampUsed() {
+ return $this->revisionTimestampUsed;
+ }
+
+ /**
+ * @param string $hash Lowercase SHA-1 base 36 hash
+ * @since 1.34
+ */
+ public function setRevisionUsedSha1Base36( $hash ) {
+ if ( $hash === null ) {
+ return; // e.g. RevisionRecord::getSha1() returned null
+ }
+
+ if (
+ $this->revisionUsedSha1Base36 !== null &&
+ $this->revisionUsedSha1Base36 !== $hash
+ ) {
+ $this->revisionUsedSha1Base36 = ''; // mismatched
+ } else {
+ $this->revisionUsedSha1Base36 = $hash;
+ }
+ }
+
+ /**
+ * @return string|null Lowercase SHA-1 base 36 hash, null if unused, or "" on inconsistency
+ * @since 1.34
+ */
+ public function getRevisionUsedSha1Base36() {
+ return $this->revisionUsedSha1Base36;
+ }
+
public function &getLanguageLinks() {
return $this->mLanguageLinks;
}
}
/**
- * Fairly generic flag setter thingy.
+ * Attach a flag to the output so that it can be checked later to handle special cases
+ *
* @param string $flag
*/
public function setFlag( $flag ) {
$this->mFlags[$flag] = true;
}
+ /**
+ * @param string $flag
+ * @return bool Whether the given flag was set to signify a special case
+ */
public function getFlag( $flag ) {
return isset( $this->mFlags[$flag] );
}
+ /**
+ * @return string[] List of flags signifying special cases
+ * @since 1.34
+ */
+ public function getAllFlags() {
+ return array_keys( $this->mFlags );
+ }
+
/**
* Set a property to be stored in the page_props database table.
*