Horde_Template::_doSearch PHP Method

_doSearch() protected method

TODO
protected _doSearch ( $tag, $key, $noclose = false )
    protected function _doSearch($tag, $key, $noclose = false)
    {
        $out = array();
        $level = is_null($key) ? 0 : substr_count($key, '.') + 1;
        if (!isset($this->_pregcache[$key])) {
            $regex = $noclose ? "/<" . $tag . ":(.+?)\\s\\/>/" : "/<" . $tag . ":([^>]+)>/";
            preg_match_all($regex, $this->_template, $this->_pregcache[$tag], PREG_SET_ORDER);
        }
        foreach ($this->_pregcache[$tag] as $pkey => $val) {
            $val_level = substr_count($val[1], '.');
            $add = false;
            if (is_null($key)) {
                $add = !$val_level;
            } else {
                $add = $val_level == $level && strpos($val[1], $key . '.') === 0;
            }
            if ($add) {
                if (!$noclose) {
                    $val[2] = '</' . $tag . ':' . $val[1] . '>';
                }
                $out[] = $val;
                unset($this->_pregcache[$tag][$pkey]);
            }
        }
        return $out;
    }