protected static function openTag($tag, $add, $whitespace)
    {
        $tabs = str_pad('', self::$tabCount ++, "\t");

        if (preg_match('#^<(a|label|option|textarea|h1|h2|h3|h4|h5|h6|strong|b|em|i|abbr|acronym|cite|span|sub|sup|u|s|title)(?: [^>]*|)>#', $tag)) {
            // if it's one of those tag it's inline so it does not require a leading line break
            $result = $tag . $whitespace . str_replace("\n", "\n" . $tabs, $add);
        } elseif (substr($tag, 0, 9) == '<!DOCTYPE') {
            // it's the doctype declaration so no line break here either
            $result = $tabs . $tag;
        } else {
            // normal block tag
            $result = "\n" . $tabs . $tag;

            if (!empty($add)) {
                $result .= "\n" . $tabs . "\t" . str_replace("\n", "\n\t" . $tabs, $add);
            }
        }

        self::$lastCallAdd = $add;

        return $result;
    }
protected static function openTag($tag, $add, $whitespace)
    {
        $tabs = str_pad('', self::$tabCount ++, "\t");

        if (preg_match('#^<(a|label|option|textarea|h1|h2|h3|h4|h5|h6|strong|b|em|i|abbr|acronym|cite|span|sub|sup|u|s|title)(?: [^>]*|)>#', $tag)) {
            // if it's one of those tag it's inline so it does not require a leading line break
            $result = $tag . $whitespace . str_replace("\n", "\n" . $tabs, $add);
        } elseif (substr($tag, 0, 9) == '<!DOCTYPE') {
            // it's the doctype declaration so no line break here either
            $result = $tabs . $tag;
        } else {
            // normal block tag
            $result = "\n" . $tabs . $tag;

            if (!empty($add)) {
                $result .= "\n" . $tabs . "\t" . str_replace("\n", "\n\t" . $tabs, $add);
            }
        }

        self::$lastCallAdd = $add;

        return $result;
    }
protected static function openTag ( $ tag , $ add , $ whitespace ) { $ tabs = str_pad ( '' , self :: $ tabCount ++ , "\t" ) ; if ( preg_match ( '#^<(a|label|option|textarea|h1|h2|h3|h4|h5|h6|strong|b|em|i|abbr|acronym|cite|span|sub|sup|u|s|title)(?: [^>]*|)>#' , $ tag ) ) { // if it's one of those tag it's inline so it does not require a leading line break $ result = $ tag . $ whitespace . str_replace ( "\n" , "\n" . $ tabs , $ add ) ; } elseif ( substr ( $ tag , 0 , 9 ) == '<!DOCTYPE' ) { // it's the doctype declaration so no line break here either $ result = $ tabs . $ tag ; } else { // normal block tag $ result = "\n" . $ tabs . $ tag ; if ( ! empty ( $ add ) ) { $ result .= "\n" . $ tabs . "\t" . str_replace ( "\n" , "\n\t" . $ tabs , $ add ) ; } } self :: $ lastCallAdd = $ add ; return $ result ; }
returns an open tag and adds a tab into the auto indenting.

@param string $tag        content of the tag
@param string $add        additional data (anything before the following tag)
@param string $whitespace white space between the tag and the additional data

@return string
returns an open tag and adds a tab into the auto indenting .