* Some performance and validity tweaks

This commit is contained in:
Niklas Laxström 2008-03-02 13:37:26 +00:00
parent e2b7792145
commit de7401f502

View file

@ -96,7 +96,7 @@ $wgAjaxExportList[] = 'efCategoryTreeAjaxWrapper';
* Hook it up * Hook it up
*/ */
function efCategoryTree() { function efCategoryTree() {
global $wgUseAjax, $wgParser, $wgCategoryTreeAllowTag; global $wgUseAjax, $wgHooks;
# Abort if AJAX is not enabled # Abort if AJAX is not enabled
if ( !$wgUseAjax ) { if ( !$wgUseAjax ) {
@ -104,10 +104,21 @@ function efCategoryTree() {
return; return;
} }
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
$wgHooks['ParserFirstCallInit'][] = 'efCategoryTreeSetHooks';
} else {
efCategoryTreeSetHooks();
}
}
function efCategoryTreeSetHooks() {
global $wgParser, $wgCategoryTreeAllowTag;
if ( $wgCategoryTreeAllowTag ) { if ( $wgCategoryTreeAllowTag ) {
$wgParser->setHook( 'categorytree' , 'efCategoryTreeParserHook' ); $wgParser->setHook( 'categorytree' , 'efCategoryTreeParserHook' );
$wgParser->setFunctionHook( 'categorytree' , 'efCategoryTreeParserFunction' ); $wgParser->setFunctionHook( 'categorytree' , 'efCategoryTreeParserFunction' );
} }
return true;
} }
/** /**