Exemplo n.º 1
0
 /**
  * @param $name
  * @return mixed
  */
 function getOption($name)
 {
     global $wgCategoryTreeDefaultOptions;
     if ($this->tree) {
         return $this->tree->getOption($name);
     } else {
         return $wgCategoryTreeDefaultOptions[$name];
     }
 }
Exemplo n.º 2
0
/**
 * Entry point for the <categorytree> tag parser hook.
 * This loads CategoryTreeFunctions.php and calls CategoryTree::getTag()
 */
function efCategoryTreeParserHook($cat, $argv, $parser = null, $allowMissing = false)
{
    global $wgOut;
    if ($parser) {
        $parser->mOutput->mCategoryTreeTag = true;
        # flag for use by efCategoryTreeParserOutput
    } else {
        CategoryTree::setHeaders($wgOut);
    }
    $ct = new CategoryTree($argv);
    $attr = Sanitizer::validateTagAttributes($argv, 'div');
    $hideroot = isset($argv['hideroot']) ? CategoryTree::decodeBoolean($argv['hideroot']) : null;
    $onlyroot = isset($argv['onlyroot']) ? CategoryTree::decodeBoolean($argv['onlyroot']) : null;
    $depthArg = isset($argv['depth']) ? (int) $argv['depth'] : null;
    $depth = efCategoryTreeCapDepth($ct->getOption('mode'), $depthArg);
    if ($onlyroot) {
        $depth = 0;
    }
    return $ct->getTag($parser, $cat, $hideroot, $attr, $depth, $allowMissing);
}