Пример #1
0
 public function __construct()
 {
     parent::__construct('head');
     $this->add("<!-- B.H. -->");
     $this->add($this->meta_content_type = new html_element('meta'));
     $this->add($this->title_elm = new html_element('title'));
 }
Пример #2
0
 public function __construct($src, $alt = "", $size = null)
 {
     parent::__construct('img');
     $this->attr['src'] = $src;
     $this->attr['alt'] = $alt;
     $this->attr['border'] = 0;
     $this->size = $size;
 }
Пример #3
0
 public function __construct()
 {
     parent::__construct('table');
     $this->attr['border'] = 0;
     $this->attr['cellspacing'] = 0;
     $this->attr['cellpadding'] = 0;
     $args = func_get_args();
     foreach ($args as $key => $col) {
         if ($col instanceof html_column) {
             $this->columns[$key] = $col;
         } else {
             throw new Exception("Invalid column");
         }
     }
 }
Пример #4
0
 /**
  * @desc Construct a form element, any arguments after the 3 first are passed to html_block::__construct()
  * @param string $action action URL
  * @param string $method post or get
  * @param boolean $file_upload if true, enctype="multipart/form-data"
  * @param unknown_type $attr
  */
 public function __construct($action, $method = 'post', $file_upload = false)
 {
     parent::__construct('form', $attr);
     $this->form_context = new html_form_context($method);
     $this->attr['action'] = (string) $action;
     $this->attr['method'] = $method;
     if ($file_upload) {
         $this->set_upload();
     }
     if (func_num_args() > 4) {
         $args = func_get_args();
         array_shift($args);
         array_shift($args);
         array_shift($args);
         $this->add($args);
     }
 }
Пример #5
0
 public function __construct($script, $is_link = true, $do_shrink = true)
 {
     $attr = array('type' => 'text/javascript');
     // check for character mask to distinguish inline script
     if (strcspn($script, "\n\r{}\$;") != strlen($script)) {
         $is_link = false;
     }
     if ($is_link) {
         $attr['src'] = $script;
         parent::__construct("script", $attr, " ");
     } else {
         $is_xml = empty($this->htdoc) ? true : $this->htdoc->is_xml;
         // strip out any comments
         if ($do_shrink) {
             $script = preg_replace("#//.*#", "", $script);
             $script = preg_replace("#/\\*.*\\*/#s", "", $script);
             $script = preg_replace('/[\\s]+/', ' ', $script);
         }
         if ($is_xml) {
             $script = "/* <![CDATA[ */ {$script} /* ]]> */";
         }
         parent::__construct("script", $attr, $script);
     }
 }