/** * Constructor. * * @param string target action url * @param array hidden fields */ public function __construct($url = '', array $hiddenFields = array(), $html5 = false) { ++self::$form_id; if ($url) { $this->httpAction = preg_match('#^http(s)?\\:\\/\\/#', $url) ? $url : COnfigure::siteurl($url); } else { $this->httpAction = Request::currenturl(); } $this->hiddenFields = (array) $hiddenFields; $this->html5 = true === $html5 ? true : false; }
/** * show. * * @return string anchor element */ public function show() { if ($this->src == '#') { $src = '#'; } else { $src = !preg_match('#^\\w+\\:\\/\\/#', $this->src) ? Configure::siteurl($this->src) : $this->src; } $text = empty($this->text) ? $src : $this->text; $title = empty($this->title) ? $text : $this->title; if ($this->autoActive === true) { if ($href == Request::currenturl()) { $this->addAttr('class', 'active'); } } $this->addAttr('title', $title)->addAttr('href', $src); return "<a{$this->htmlAttribute}>{$text}</a>"; }