/** * Формирует HTML-форму с помощью объекта формы $form * * @param Templates_HTML_Template $t * @param Forms_Form $form * @param array $attributes */ public function begin_form(Templates_HTML_Template $t, $form, array $attrs = array()) { $this->form = $form; $method = Net_HTTP::method_name_for($form->options['method']); $result = $t->tag('form', array_merge(array('action' => $form->action, 'method' => $method == 'post' || $method == 'get' ? $method : 'post', 'id' => "{$form->name}_form", 'enctype' => $form->options['enctype']), $attrs), false) . $this->begin_fieldset($t, Core_Arrays::pick($attrs, 'fieldset', array())); if ($method == 'put' || $method == 'delete') { $result .= $t->tag('input', array('type' => 'hidden', 'name' => '_method', 'value' => $method)); } return $result; }
/** * Возвращает значение свойства * * @param string $property * * @return mixed */ public function __get($property) { switch ($property) { case 'scheme': case 'host': case 'path': case 'port': case 'user': case 'pass': return $this->uri[$property]; case 'query': return $this->urlencode($this->query); case 'headers': case 'session': case 'meta': case 'body': return $this->{$property}; case 'content': return $this->{$property} ? $this->{$property} : ($this->{$property} = @file_get_contents('php://input')); case 'parameters': return Core_Arrays::merge($this->query, $this->parameters); case 'post_data': return $this->urlencode($this->parameters); case 'url': return $this->compose_url(); case 'uri': return $this->compose_uri(); case 'urn': return $this->compose_urn(); case 'method_name': case 'method': return Net_HTTP::method_name_for($this->method); case 'method_code': return $this->method; case 'id': if ($this->id) { return $this->id; } Core::load('Text.Process'); $id = Text_Process::process($this->path, 'translit'); $id = trim(preg_replace('{[^a-zA-Z0-9]+}ui', '_', $id), '_'); return $this->id = $id; default: return parent::__get($property); } }
/** * @return string */ protected function get_http_method_name() { return Net_HTTP::method_name_for($this->http_method); }