roundcubemail/program/lib/Roundcube/html.php
public static function tag($tagname, $attrib = array(), $content = null, $allowed = null)
    {
        if (is_string($attrib)) {
            $attrib = array('class' => $attrib);
        }

        $inline_tags = array('a','span','img');
        $suffix = $attrib['nl'] || ($content && $attrib['nl'] !== false && !in_array($tagname, $inline_tags)) ? "\n" : '';

        $tagname = self::$lc_tags ? strtolower($tagname) : $tagname;
        if (isset($content) || in_array($tagname, self::$containers)) {
            $suffix = $attrib['noclose'] ? $suffix : '</' . $tagname . '>' . $suffix;
            unset($attrib['noclose'], $attrib['nl']);
            return '<' . $tagname  . self::attrib_string($attrib, $allowed) . '>' . $content . $suffix;
        }
        else {
            return '<' . $tagname  . self::attrib_string($attrib, $allowed) . '>' . $suffix;
        }
    }
public static function tag($tagname, $attrib = array(), $content = null, $allowed = null)
    {
        if (is_string($attrib)) {
            $attrib = array('class' => $attrib);
        }

        $inline_tags = array('a','span','img');
        $suffix = $attrib['nl'] || ($content && $attrib['nl'] !== false && !in_array($tagname, $inline_tags)) ? "\n" : '';

        $tagname = self::$lc_tags ? strtolower($tagname) : $tagname;
        if (isset($content) || in_array($tagname, self::$containers)) {
            $suffix = $attrib['noclose'] ? $suffix : '</' . $tagname . '>' . $suffix;
            unset($attrib['noclose'], $attrib['nl']);
            return '<' . $tagname  . self::attrib_string($attrib, $allowed) . '>' . $content . $suffix;
        }
        else {
            return '<' . $tagname  . self::attrib_string($attrib, $allowed) . '>' . $suffix;
        }
    }
public static function tag ( $ tagname , $ attrib = array ( ) , $ content = null , $ allowed = null ) { if ( is_string ( $ attrib ) ) { $ attrib = array ( 'class' => $ attrib ) ; } $ inline_tags = array ( 'a' , 'span' , 'img' ) ; $ suffix = $ attrib [ 'nl' ] || ( $ content && $ attrib [ 'nl' ] !== false && ! in_array ( $ tagname , $ inline_tags ) ) ? "\n" : '' ; $ tagname = self :: $ lc_tags ? strtolower ( $ tagname ) : $ tagname ; if ( isset ( $ content ) || in_array ( $ tagname , self :: $ containers ) ) { $ suffix = $ attrib [ 'noclose' ] ? $ suffix : '</' . $ tagname . '>' . $ suffix ; unset ( $ attrib [ 'noclose' ] , $ attrib [ 'nl' ] ) ; return '<' . $ tagname . self :: attrib_string ( $ attrib , $ allowed ) . '>' . $ content . $ suffix ; } else { return '<' . $ tagname . self :: attrib_string ( $ attrib , $ allowed ) . '>' . $ suffix ; } }
Generic method to create a HTML tag

@param string $tagname Tag name
@param array  $attrib  Tag attributes as key/value pairs
@param string $content Optional Tag content (creates a container tag)
@param array  $allowed List with allowed attributes, omit to allow all

@return string The XHTML tag
Generic method to create a HTML tag