define( 'EXT_LINK_TEXT_CLASS', '[^\]\\x00-\\x1F\\x7F]' );
define( 'EXT_IMAGE_FNAME_CLASS', '[A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]' );
define( 'EXT_IMAGE_EXTENSIONS', 'gif|png|jpg|jpeg' );
-define( 'EXT_LINK_BRACKETED', '/\[(\b(' . wfUrlProtocols() . ')'.EXT_LINK_URL_CLASS.'+)( *)('.EXT_LINK_TEXT_CLASS.'*?)\]/S' );
+define( 'EXT_LINK_BRACKETED', '/\[(\b(' . wfUrlProtocols() . ')'.EXT_LINK_URL_CLASS.'+) *('.EXT_LINK_TEXT_CLASS.'*?)\]/S' );
define( 'EXT_IMAGE_REGEX',
'/^('.HTTP_PROTOCOLS.')'. # Protocol
'('.EXT_LINK_URL_CLASS.'+)\\/'. # Hostname and path
* performs brace substitution on MediaWiki messages
*
* Globals used:
- * objects: $wgLang
+ * objects: $wgLang, $wgContLang
*
* NOT $wgArticle, $wgUser or $wgTitle. Keep them away!
*
$this->replaceLinkHolders( $text );
- # the position of the convert() call should not be changed. it
- # assumes that the links are all replaces and the only thing left
+ # the position of the parserConvert() call should not be changed. it
+ # assumes that the links are all replaced and the only thing left
# is the <nowiki> mark.
- $text = $wgContLang->convert($text);
- $this->mOutput->setTitleText($wgContLang->getParsedTitle());
+ # Side-effects: this calls $this->mOutput->setTitleText()
+ $text = $wgContLang->parserConvert( $text, $this );
$text = $this->unstripNoWiki( $text, $this->mStripState );
return dechex(mt_rand(0, 0x7fffffff)) . dechex(mt_rand(0, 0x7fffffff));
}
+ function &getTitle() { return $this->mTitle; }
+ function getOptions() { return $this->mOptions; }
+
/**
* Replaces all occurrences of <$tag>content</$tag> in the text
* with a random marker and returns the new text. the output parameter
while ( $i<count( $bits ) ) {
$url = $bits[$i++];
$protocol = $bits[$i++];
- $spaces = $bits[$i++];
$text = $bits[$i++];
$trail = $bits[$i++];
# This means that users can paste URLs directly into the text
# Funny characters like ö aren't valid in URLs anyway
# This was changed in August 2004
- if ( strlen ( $spaces ) < 2 ) {
- # Normal case
- $s .= $sk->makeExternalLink( $url, $text, false, $linktype ) . $dtrail . $trail;
- } else {
- # Fix for [url text] (notice the two blanks)
- $s .= '[' . $sk->makeExternalLink( $url, $url, false, "free" ) . $spaces . $text . ']' . $dtrail . $trail;
- }
+ $s .= $sk->makeExternalLink( $url, $text, false, $linktype ) . $dtrail . $trail;
# Register link in the output object
$this->mOutput->addExternalLink( $url );
return $this->mTitle->getPrefixedText();
case MAG_FULLPAGENAMEE:
return $this->mTitle->getPrefixedURL();
+ case MAG_SUBPAGENAME:
+ return $this->mTitle->getSubpageText();
case MAG_REVISIONID:
return $this->mRevisionId;
case MAG_NAMESPACE:
# strip out HTML
$canonized_headline = preg_replace( '/<.*?' . '>/','',$canonized_headline );
$tocline = trim( $canonized_headline );
+ # Save headline for section edit hint before it's escaped
+ $headline_hint = trim( $canonized_headline );
$canonized_headline = Sanitizer::escapeId( $tocline );
$refers[$headlineCount] = $canonized_headline;
if( $istemplate )
$head[$headlineCount] .= $sk->editSectionLinkForOther($templatetitle, $templatesection);
else
- $head[$headlineCount] .= $sk->editSectionLink($this->mTitle, $sectionCount+1);
+ $head[$headlineCount] .= $sk->editSectionLink($this->mTitle, $sectionCount+1, $headline_hint);
}
# give headline the correct <h#> tag
/**
* Create an HTML-style tag, e.g. <yourtag>special text</yourtag>
- * Callback will be called with the text within
- * Transform and return the text within
+ * The callback should have the following form:
+ * function myParserHook( $text, $params, &$parser ) { ... }
+ *
+ * Transform and return $text. Use $parser for any required context, e.g. use
+ * $parser->getTitle() and $parser->getOptions() not $wgTitle or $wgOut->mParserOptions
*
* @access public
*