*/
public $mSubstWords;
# Initialised in constructor
- public $mConf, $mPreprocessor, $mExtLinkBracketedRegex, $mUrlProtocols;
+ public $mConf, $mExtLinkBracketedRegex, $mUrlProtocols;
+
+ # Initialized in getPreprocessor()
+ /** @var Preprocessor */
+ public $mPreprocessor;
# Cleared with clearState():
/**
*/
global $wgShowHostnames;
- $fname = __METHOD__ . '-' . wfGetCaller();
if ( $clearState ) {
$magicScopeVariable = $this->lock();
*
* @param string $text
* @param bool $isMain
- * @param bool $frame
+ * @param PPFrame|bool $frame
*
* @return string
*/
return $obj->tc_contents;
}
- $req = MWHttpRequest::factory( $url );
+ $req = MWHttpRequest::factory( $url, array(), __METHOD__ );
$status = $req->execute(); // Status object
if ( $status->isOK() ) {
$text = $req->getContent();
# HTML names must be case-insensitively unique (bug 10721).
# This does not apply to Unicode characters per
- # http://dev.w3.org/html5/spec/infrastructure.html#case-sensitivity-and-string-comparison
+ # http://www.w3.org/TR/html5/infrastructure.html#case-sensitivity-and-string-comparison
# @todo FIXME: We may be changing them depending on the current locale.
$arrayKey = strtolower( $safeHeadline );
if ( $legacyHeadline === false ) {
$legacyArrayKey = strtolower( $legacyHeadline );
}
- # count how many in assoc. array so we can track dupes in anchors
+ # Create the anchor for linking from the TOC to the section
+ $anchor = $safeHeadline;
+ $legacyAnchor = $legacyHeadline;
if ( isset( $refers[$arrayKey] ) ) {
- $refers[$arrayKey]++;
+ for ( $i = 2; isset( $refers["${arrayKey}_$i"] ); ++$i );
+ $anchor .= "_$i";
+ $refers["${arrayKey}_$i"] = true;
} else {
- $refers[$arrayKey] = 1;
+ $refers[$arrayKey] = true;
}
- if ( isset( $refers[$legacyArrayKey] ) ) {
- $refers[$legacyArrayKey]++;
+ if ( $legacyHeadline !== false && isset( $refers[$legacyArrayKey] ) ) {
+ for ( $i = 2; isset( $refers["${legacyArrayKey}_$i"] ); ++$i );
+ $legacyAnchor .= "_$i";
+ $refers["${legacyArrayKey}_$i"] = true;
} else {
- $refers[$legacyArrayKey] = 1;
+ $refers[$legacyArrayKey] = true;
}
# Don't number the heading if it is the only one (looks silly)
) . ' ' . $headline;
}
- # Create the anchor for linking from the TOC to the section
- $anchor = $safeHeadline;
- $legacyAnchor = $legacyHeadline;
- if ( $refers[$arrayKey] > 1 ) {
- $anchor .= '_' . $refers[$arrayKey];
- }
- if ( $legacyHeadline !== false && $refers[$legacyArrayKey] > 1 ) {
- $legacyAnchor .= '_' . $refers[$legacyArrayKey];
- }
if ( $enoughToc && ( !isset( $wgMaxTocLevel ) || $toclevel < $wgMaxTocLevel ) ) {
$toc .= Linker::tocLine( $anchor, $tocline,
$numbering, $toclevel, ( $isTemplate ? false : $sectionIndex ) );
/**
* Clean up signature text
*
- * 1) Strip ~~~, ~~~~ and ~~~~~ out of signatures @see cleanSigInSig
+ * 1) Strip 3, 4 or 5 tildes out of signatures @see cleanSigInSig
* 2) Substitute all transclusions
*
* @param string $text
}
/**
- * Strip ~~~, ~~~~ and ~~~~~ out of signatures
+ * Strip 3, 4 or 5 tildes out of signatures.
*
* @param string $text
* @return string Signature text with /~{3,5}/ removed
}
/**
- * @param string $handler
+ * @param MediaHandler $handler
* @return array
*/
public function getImageParams( $handler ) {
return null;
}
- $this->mRevisionObject = Revision::newFromId( $this->mRevisionId );
+ $rev = call_user_func(
+ $this->mOptions->getCurrentRevisionCallback(), $this->getTitle(), $this
+ );
+
+ # If the parse is for a new revision, then the callback should have
+ # already been set to force the object and should match mRevisionId.
+ # If not, try to fetch by mRevisionId for sanity.
+ if ( $rev && $rev->getId() != $this->mRevisionId ) {
+ $rev = Revision::newFromId( $this->mRevisionId );
+ }
+
+ $this->mRevisionObject = $rev;
+
return $this->mRevisionObject;
}
*/
public function getRevisionTimestamp() {
if ( is_null( $this->mRevisionTimestamp ) ) {
-
global $wgContLang;
$revObject = $this->getRevisionObject();