* @return string
*/
function testSrvus( $text, $title, ParserOptions $options, $outputType = self::OT_HTML ) {
- if ( !$title instanceof Title ) {
- $title = Title::newFromText( $title );
- }
$this->startParse( $title, $options, $outputType, true );
$text = $this->replaceVariables( $text );
}
function testPst( $text, $title, $options ) {
- global $wgUser;
- if ( !$title instanceof Title ) {
- $title = Title::newFromText( $title );
- }
- return $this->preSaveTransform( $text, $title, $wgUser, $options );
+ return $this->preSaveTransform( $text, $title, $options->getUser(), $options );
}
function testPreprocess( $text, $title, $options ) {
- if ( !$title instanceof Title ) {
- $title = Title::newFromText( $title );
- }
return $this->testSrvus( $text, $title, $options, self::OT_PREPROCESS );
}
$wgUser->mFrom = 'name';
$wgUser->ppfz_test = $this;
- $options = new ParserOptions;
+ $options = ParserOptions::newFromUser( $wgUser );
$options->setTemplateCallback( array( $this, 'templateHook' ) );
$options->setTimestamp( wfTimestampNow() );
- $this->output = call_user_func( array( $wgParser, $this->entryPoint ), $this->mainText, $this->title->getPrefixedText(), $options );
+ $this->output = call_user_func( array( $wgParser, $this->entryPoint ), $this->mainText, $this->title, $options );
return $this->output;
}
}
class PPFuzzUser extends User {
- var $ppfz_test;
+ var $ppfz_test, $mDataLoaded;
function load() {
if ( $this->mDataLoaded ) {
$this->loadDefaults( $this->mName );
}
- function getOption( $option, $defaultOverride = '' ) {
+ function getOption( $oname, $defaultOverride = null, $ignoreHidden = false ) {
if ( $option === 'fancysig' ) {
return $this->ppfz_test->fancySig;
} elseif ( $option === 'nickname' ) {
return $this->ppfz_test->nickname;
} else {
- return parent::getOption( $option, $defaultOverride );
+ return parent::getOption( $option, $defaultOverride, $ignoreHidden );
}
}
}