* 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
+ # 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);
-
- # FIXME: Unexpected data flow
- # Set the title text in mOutput to a converted version of the global
- # title. The title is stored in $wgContLang from a previous call to
- # OutputPage::setPageTitle(). If no call has been made, this will be
- # blank, a condition which Parser callers are expected to ignore.
- $this->mOutput->setTitleText($wgContLang->getParsedTitle());
+ # Side-effects: this calls $this->mOutput->setTitleText()
+ $text = $wgContLang->parserConvert( $text, $this );
$text = $this->unstripNoWiki( $text, $this->mStripState );
$process = proc_open("$wgTidyBin -config $wgTidyConf $wgTidyOpts$opts", $descriptorspec, $pipes);
if (is_resource($process)) {
// Theoretically, this style of communication could cause a deadlock
- // here. If the stdout buffer fills up, then writes to stdin could
+ // here. If the stdout buffer fills up, then writes to stdin could
// block. This doesn't appear to happen with tidy, because tidy only
- // writes to stdout after it's finished reading from stdin. Search
+ // writes to stdout after it's finished reading from stdin. Search
// for tidyParseStdin and tidySaveStdout in console/tidy.c
fwrite($pipes[0], $text);
fclose($pipes[0]);
* @access private
*/
function internalParse( $text ) {
- global $wgContLang;
$args = array();
$isMain = true;
$fname = 'Parser::internalParse';
/**
* Replace unusual URL escape codes with their equivalent characters
- * @param string
+ * @param string
* @return string
* @static
*/
function replaceUnusualEscapes( $url ) {
- return preg_replace_callback( '/%[0-9A-Fa-f]{2}/',
+ return preg_replace_callback( '/%[0-9A-Fa-f]{2}/',
array( 'Parser', 'replaceUnusualEscapesCallback' ), $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:
$fname = 'Parser::braceSubstitution';
wfProfileIn( $fname );
- # Flags
+ # Flags
$found = false; # $text has been filled
$nowiki = false; # wiki markup in $text should be escaped
$noparse = false; # Unsafe HTML tags should not be stripped, etc.
}
/**
- * Fetch the unparsed text of a template and register a reference to it.
+ * Fetch the unparsed text of a template and register a reference to it.
*/
function fetchTemplate( $title ) {
$text = false;
# 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
# Signatures
$sigText = $this->getUserSig( $user );
- $text = strtr( $text, array(
+ $text = strtr( $text, array(
'~~~~~' => $d,
'~~~~' => "$sigText $d",
'~~~' => $sigText
* @access private
*/
function getUserSig( &$user ) {
- global $wgContLang;
-
$username = $user->getName();
$nickname = $user->getOption( 'nickname' );
$nickname = $nickname === '' ? $username : $nickname;
* @return string
*/
function replaceLinkHoldersText( $text ) {
- global $wgUser;
- global $wgOutputReplace;
-
$fname = 'Parser::replaceLinkHoldersText';
wfProfileIn( $fname );
* Parse image options text and use it to make an image
*/
function makeImage( &$nt, $options ) {
- global $wgContLang, $wgUseImageResize, $wgUser;
+ global $wgUseImageResize;
$align = '';
$this->mOutput->mCacheTime = -1;
}
- /**#@+
+ /**#@+
* Callback from the Sanitizer for expanding items found in HTML attribute
* values, so they can be safely tested and escaped.
* @param string $text
/** Get user options */
function initialiseFromUser( &$userInput ) {
- global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages,
- $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion;
+ global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages;
+ global $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion;
$fname = 'ParserOptions::initialiseFromUser';
wfProfileIn( $fname );
if ( !$userInput ) {