function buildSubdomain(&$node, $tldParts)
{
    $part = trim(array_pop($tldParts));
    if (!array_key_exists($part, $node)) {
        $node[$part] = array();
    }
    if (0 < count($tldParts)) {
        buildSubdomain($node[$part], $tldParts);
    }
}
示例#2
0
function buildSubdomain(&$node, $tldParts)
{
    $dom = trim(array_pop($tldParts));
    $isNotDomain = FALSE;
    if (startsWith($dom, "!")) {
        $dom = substr($dom, 1);
        $isNotDomain = TRUE;
    }
    if (!array_key_exists($dom, $node)) {
        if ($isNotDomain) {
            $node[$dom] = array("!" => "");
        } else {
            $node[$dom] = array();
        }
    }
    if (!$isNotDomain && count($tldParts) > 0) {
        buildSubdomain($node[$dom], $tldParts);
    }
}