Class it_html:

/**
 * Create a HTML object and global functions for all methods (exlcluding
 * methods starting with '_') in this class plus the default tags (see below).
 *
 * @param $p Configuration settings. Can be set/overridden in constructor, configure(), html() or head().
 *           See source code for a list of supported values
 */
function __construct($p = array())
{
    # Default configuration of html class
    $this->p = $p + array(
        'charset' => ini_get('default_charset') ?: 'iso-8859-1',
        'doctype' => null,                    # Custom doctype (will usually be calculated from htmltype)
        'head' => '',                         # Code to put into head() section
        'htmltype' => 'html5',                # 'html5', 'html' (=old-style), 'xhtml' or 'xhtml-mobile' for xhtml, or 'xml' for plain xml without magic
        'lang' => 'de',                       # Language code to use in <html lang="..."> tag
        'moretags' => '',                     # Comma-separated list of tag-functions to generate additionally to 'tags'
        'name' => $p['htmltype'] == 'xml' ? 'it_html_xml' : 'it_html',                  # Name of global variable $this is assigned to (string), XXX Copy and paste in configure()
        'nonewlinetags' => 'a,b,em,img,input,label,span,noscript', # tags that do not like newlines after them
        'prettyprint' => it::is_devel(),      # Should output be prettily indented?
        'show_content_type' => true,          # If true, add <meta http-equiv="Content-Type" ...> header
        'show_favicon' => true,               # If true, add <link> tag to /favicon.ico if it exists
        'favicon' => '',                  # If set, add favicon <link> tag to this url
        'staticallycallable' => 'Q,U,select', # Those methods are statically callable (have same arguments as global stubs) but are a bit slower
        'tags' => "a,b,br,button,div,em,fieldset,form,h1,h2,h3,h4,h5,h6,hr,img,input,label,legend,li,meta,noscript,p,pre,span,style,table,tbody,td,textarea,tfoot,th,thead,tr,ul,ol,article,section",
        'title' => '',                        # HTML title (default: no title added)
        'srclines' => $GLOBALS['debug_srclines'], # append stackdump to each tag
        'error_on_redefine' => false,         # Generate it::error when trying to redefine function for a tag
    );
    $this->p['notexported'] = trim($p['notexported'] . ',configure,sanitize,comment', ',');

    # We know these doctypes. If you need something else, supply 'doctype' in p
    $this->doctypes = array(
        'html5'        => '<!DOCTYPE html>',
        'html'        => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
        'xhtml'        => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
        'xhtml-mobile'    => '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">',
        'xml'        => ''
    );

    # @@@ Hack: Manually copy for new instance without custom value to keep setting from global auto_prepend instance
    if (!isset($p['error_on_redefine']) && isset($GLOBALS[$this->p['name']]))
        $this->p['error_on_redefine'] = $GLOBALS[$this->p['name']]->p['error_on_redefine'];

    # Since name is given as param, it is our duty to store it, not our caller's.
    $GLOBALS[$this->p['name']] =& $this;

    it_html::configure(array('name' => $this->p['name']));
    $notexported = array_flip(explode(',', "dummy," . $this->p['notexported']));        # dummy keeps values > 0

    # Create global functions for _tags
    foreach (array_keys($this->alltags) as $func)
    {
        if (!function_exists($func) && $func)
            $code[$func] = "function $func(...\$args) { return \$GLOBALS['{$this->p['name']}']->_tag('$func', \$args); }";
        else if ($this->p['error_on_redefine'])
            it::error("Trying to redefine existing function '$func' in it_html");
    }

    # Create global functions for it_html methods
    foreach (get_class_methods(get_class($this)) as $func)
    {
        if (!preg_match('/^_/', $func) && !is_a($this, $func) && $func && !function_exists($func) && !$notexported[$func])
            $code[$func] = "function $func(...\$args) { return \$GLOBALS['{$this->p['name']}']->$func(\$args); }";
    }

    # Create global functions for methods that are statically callable (have same arguments as global stubs)
    foreach (explode(',', $this->p['staticallycallable']) as $func)
    {
        if ($func && !function_exists($func))
            $code[$func] = "function $func(...\$args) { return \$GLOBALS['{$this->p['name']}']->$func(...\$args); }";
    }

    eval(implode('', (array)$code));
}