thomascube
2008-07-28 0ece58dfaffa79fe86d9e981f39d4902736fe67d
program/include/html.php
@@ -29,7 +29,7 @@
{
    protected $tagname;
    protected $attrib = array();
    protected $allowed;
    protected $allowed = array();
    protected $content;
    public static $common_attrib = array('id','class','style','title','align');
@@ -55,7 +55,7 @@
     */
    public function show()
    {
        return self::tag($this->tagname, $this->attrib, $this->content, $this->allowed);
        return self::tag($this->tagname, $this->attrib, $this->content, array_merge(self::$common_attrib, $this->allowed));
    }
    /****** STATIC METHODS *******/
@@ -248,6 +248,7 @@
{
    protected $tagname = 'input';
    protected $type = 'text';
    protected $allowed = array('type','name','value','size','tabindex','autocomplete','checked','onchange','onclick');
    public function __construct($attrib = array())
    {
@@ -415,7 +416,7 @@
class html_textarea extends html
{
    protected $tagname = 'textarea';
    protected $allowed_attrib = array('name','rows','cols','wrap','tabindex');
    protected $allowed = array('name','rows','cols','wrap','tabindex','onchange');
    /**
     * Get HTML code for this object
@@ -445,7 +446,7 @@
            $value = Q($value, 'strict', false);
        }
        return self::tag($this->tagname, $this->attrib, $value, array_merge(self::$common_attrib, $this->allowed_attrib));
        return self::tag($this->tagname, $this->attrib, $value, array_merge(self::$common_attrib, $this->allowed));
    }
}
@@ -472,6 +473,7 @@
{
    protected $tagname = 'select';
    protected $options = array();
    protected $allowed = array('name','size','tabindex','autocomplete','multiple','onchange');
    
    /**
     * Add a new option to this drop-down
@@ -512,7 +514,7 @@
            $attr = array(
                'value' => $option['value'],
                'selected' => (in_array($option['value'], $select, true) ||
            in_array($option['text'], $select, true)) ? 1 : null);
                  in_array($option['text'], $select, true)) ? 1 : null);
            $this->content .= self::tag('option', $attr, Q($option['text']));
        }
@@ -603,10 +605,12 @@
     * @param array Table attributes
     * @return string The final table HTML code
     */
    public function show($attr = array())
    public function show($attrib = null)
    {
        $this->attrib = array_merge($this->attrib, $attr);
        $thead = $tbody = "";
   if (is_array($attrib))
           $this->attrib = array_merge($this->attrib, $attrib);
   $thead = $tbody = "";
        // include <thead>
        if (!empty($this->header)) {