From f605082c3d6f3e483b00f1e38d0e607e72f688d8 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 28 Feb 2006 05:18:36 +0000 Subject: [PATCH] Documentation, plus two accessor functions that might be useful in parser extensions some day. I haven't updated the extensions yet, to maintain their compatibility with old versions of Parser.php. --- includes/Parser.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 47644b8a89..3cc201d6f6 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -237,9 +237,15 @@ class Parser $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 + # assumes that the links are all replaced and the only thing left # is the 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()); $text = $this->unstripNoWiki( $text, $this->mStripState ); @@ -270,6 +276,9 @@ class Parser 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 in the text * with a random marker and returns the new text. the output parameter @@ -3428,8 +3437,11 @@ class Parser /** * Create an HTML-style tag, e.g. special text - * 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 * -- 2.20.1