/** * Hook it up */ function efCategoryTree() { global $wgUseAjax, $wgHooks, $wgOut, $wgRequest; global $wgCategoryTreeDefaultOptions, $wgCategoryTreeDefaultMode, $wgCategoryTreeOmitNamespace; global $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeCategoryPageMode, $wgCategoryTreeAllowTag; global $wgCategoryTreeSidebarRoot, $wgCategoryTreeForceHeaders, $wgCategoryTreeHijackPageCategories; # Abort if AJAX is not enabled if (!$wgUseAjax) { wfDebug('efCategoryTree: $wgUseAjax is not enabled, aborting extension setup.'); return; } if ($wgCategoryTreeSidebarRoot) { $wgCategoryTreeForceHeaders = true; # needed on every page anyway $wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'efCategoryTreeSkinTemplateOutputPageBeforeExec'; } if ($wgCategoryTreeHijackPageCategories) { $wgCategoryTreeForceHeaders = true; # needed on almost every page anyway $wgHooks['OutputPageMakeCategoryLinks'][] = 'efCategoryTreeOutputPageMakeCategoryLinks'; $wgHooks['SkinJoinCategoryLinks'][] = 'efCategoryTreeSkinJoinCategoryLinks'; } if ($wgCategoryTreeAllowTag) { $wgHooks['ParserFirstCallInit'][] = 'efCategoryTreeSetHooks'; } if (!isset($wgCategoryTreeDefaultOptions['mode']) || is_null($wgCategoryTreeDefaultOptions['mode'])) { $wgCategoryTreeDefaultOptions['mode'] = $wgCategoryTreeDefaultMode; } if (!isset($wgCategoryTreeDefaultOptions['hideprefix']) || is_null($wgCategoryTreeDefaultOptions['hideprefix'])) { $wgCategoryTreeDefaultOptions['hideprefix'] = $wgCategoryTreeOmitNamespace; } if (!isset($wgCategoryTreeCategoryPageOptions['mode']) || is_null($wgCategoryTreeCategoryPageOptions['mode'])) { $wgCategoryTreeCategoryPageOptions['mode'] = ($mode = $wgRequest->getVal('mode')) ? CategoryTree::decodeMode($mode) : $wgCategoryTreeCategoryPageMode; } if ($wgCategoryTreeForceHeaders) { CategoryTree::setHeaders($wgOut); } else { $wgHooks['OutputPageParserOutput'][] = 'efCategoryTreeParserOutput'; } $wgHooks['MakeGlobalVariablesScript'][] = 'efCategoryTreeGetConfigVars'; }