Example #1
0
 function render()
 {
     list($csrf_name, $csrf_value) = HC_App::csrf();
     $out = HC_Html_Factory::element('form')->add_attr('method', $this->method())->add_attr('accept-charset', 'utf-8')->add_attr('id', $this->id());
     $attr = $this->attr();
     foreach ($attr as $k => $v) {
         $out->add_attr($k, $v);
     }
     /* add csrf */
     if ($this->method() != 'get') {
         if (strlen($csrf_name) && strlen($csrf_value)) {
             $hidden = HC_Html_Factory::input('hidden', $csrf_name)->set_value($csrf_value);
             $out->add_child(HC_Html_Factory::element('div')->add_attr('style', 'display:none')->add_child($hidden));
         }
     }
     $out->add_child(parent::render());
     return $out->render();
 }
Example #2
0
 function __construct()
 {
     parent::__construct('div');
 }