// Having a user with id = 0 safeguards us from DB access via User::loadOptions().
$wgUser = User::newFromId( 0 );
- // Set our custom <doclink> hook.
- $wgHooks['ParserFirstCallInit'][] = array( $this, 'registerDocLink' );
-
$this->settings = $this->internalDefaults;
foreach ( $this->defaultVarNames as $var ) {
return false;
}
- /**
- * Register tag hook below.
- *
- * @todo Move this to WebInstaller with the two things below?
- *
- * @param $parser Parser
- */
- public function registerDocLink( Parser &$parser ) {
- $parser->setHook( 'doclink', array( $this, 'docLink' ) );
- return true;
- }
-
/**
* ParserOptions are constructed before we determined the language, so fix it
*/
$this->parserOptions->setUserLang( $lang->getCode() );
}
- /**
- * Extension tag hook for a documentation link.
- */
- public function docLink( $linkText, $attribs, $parser ) {
- $url = $this->getDocUrl( $attribs['href'] );
- return '<a href="' . htmlspecialchars( $url ) . '">' .
- htmlspecialchars( $linkText ) .
- '</a>';
- }
-
/**
* Overridden by WebInstaller to provide lastPage parameters.
*/
$this->output = new WebInstallerOutput( $this );
$this->request = $request;
- // Add parser hook for WebInstaller_Complete
+ // Add parser hooks
global $wgParser;
$wgParser->setHook( 'downloadlink', array( $this, 'downloadLinkHook' ) );
+ $wgParser->setHook( 'doclink', array( $this, 'docLink' ) );
}
/**
return $url;
}
+ /**
+ * Extension tag hook for a documentation link.
+ */
+ public function docLink( $linkText, $attribs, $parser ) {
+ $url = $this->getDocUrl( $attribs['href'] );
+ return '<a href="' . htmlspecialchars( $url ) . '">' .
+ htmlspecialchars( $linkText ) .
+ '</a>';
+ }
+
/**
* Helper for "Download LocalSettings" link on WebInstall_Complete
* @return String Html for download link