thomascube
2008-07-14 e3e597e3b6c9ae10e5c7c1e5592726c71793cfe7
program/include/html.php
@@ -29,10 +29,10 @@
{
    protected $tagname;
    protected $attrib = array();
    protected $allowed;
    protected $allowed = array();
    protected $content;
    protected static $common_attrib = array('id','class','style','title','align');
    public static $common_attrib = array('id','class','style','title','align');
    public static $containers = array('div','span','p','h1','h2','h3','form','textarea');
    public static $lc_tags = true;
@@ -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');
    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');
    protected $allowed = array('name','rows','cols','wrap','tabindex');
    /**
     * Get HTML code for this object
@@ -441,10 +442,11 @@
            unset($this->attrib['value']);
        }
        if (!empty($value) && !isset($this->attrib['mce_editable'])) {
        if (!empty($value) && !ereg('mce_editor', $this->attrib['class'])) {
            $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));
    }
}
@@ -570,7 +572,7 @@
     * @param array Cell attributes
     * @param string Cell content
     */
    private function add_header($attr, $cont)
    public function add_header($attr, $cont)
    {
        if (is_string($attr))
        $attr = array('class' => $attr);
@@ -586,7 +588,7 @@
     *
     * @param array Row attributes
     */
    private function add_row($attr = array())
    public function add_row($attr = array())
    {
        $this->rowindex++;
        $this->colindex = 0;
@@ -602,16 +604,18 @@
     * @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)) {
            $rowcontent = '';
            foreach ($this->header as $c => $col) {
                $rowcontent .= self::tag('th', $col->attrib, $col->content);
                $rowcontent .= self::tag('td', $col->attrib, $col->content);
            }
            $thead = self::tag('thead', null, self::tag('tr', null, $rowcontent));
        }
@@ -623,7 +627,7 @@
            }
            if ($r < $this->rowindex || count($row->cells)) {
                $tbody .= self::tag('tr', $rows->attrib, $rowcontent);
                $tbody .= self::tag('tr', $row->attrib, $rowcontent);
            }
        }