End html form.

@param   array $secureAttributes
@return  string
493913
public function end(array $secureAttributes = [])
    {
        if ($this->_isJsForm) {
            return implode('', [
                $this->hidden('action', ['value' => '', 'class' => 'jsFormAction']),
                parent::end($secureAttributes)
            ]);
        }

        return parent::end($secureAttributes);
    }
627618
public function attr(array $attributes)
    {
        $result = '';

        foreach ($attributes as $attribute => $value) {
            $result .= ' '.(is_int($attribute) ? $value : $attribute.'="'.str_replace('"', '&quot;', $value).'"');
        }

        return $result;
    }
750283
public function filterHiddenAttributes($attributes, array $_hiddenAttributes = [])
    {
        $hiddenAttributes = $_hiddenAttributes !== null ? $_hiddenAttributes : $this->getHiddenAttributes();

        if (count($hiddenAttributes) > 0) {
            foreach ($hiddenAttributes as $hiddenAttributeName) {
                if (isset($attributes[$hiddenAttributeName])) {
                    unset($attributes[$hiddenAttributeName]);
                }
            }
        }

        unset ($attributes[self::ENTRY_HIDDENATTRIBUTES]);

        return $attributes;
    }
823370
public function header(array $validate = array())
    {
        $this->validator->jquery('form[name='.$this->header['name'].']', array_merge(array(
            'ignore' => '[]',
            'errorClass' => '"has-error"',
            'validClass' => '""',
            'errorElement' => '"span"',
            'highlight' => 'function(element, errorClass, validClass){ $(element).closest("div.form-group").addClass(errorClass).removeClass(validClass).find("p.validation").show(); }',
            'unhighlight' => 'function(element, errorClass, validClass){ $(element).closest("div.form-group").removeClass(errorClass).addClass(validClass).find("p.validation").text("").hide(); }',
            'errorPlacement' => 'function(error, element){ $(element).closest("div.form-group").find("p.validation").html(error); }',
            'submitHandler' => 'function(form, event){ event.preventDefault(); $(form).find("button[type=submit]").button("loading"); form.submit(); }',
            'onkeyup' => 'false',
        ), $validate));
        $html = "\n";
        if ($flash = $this->page->session->getFlash(array(__CLASS__, $this->header['name']))) {
            $html .= ($flash['status'] == 'html') ? $flash['msg'] : $this->bp->alert($flash['status'], $flash['msg']);
        }
        $html .= trim(parent::header());
        if (!empty($this->align)) {
            $html = $this->addClass($html, array('form' => $this->align));
        }

        return $html;
    }
894712
protected function out($value, $secure = true): void
    {
        if ($secure === true) {
            $value = (string) $value;
            echo htmlentities($value);
        } else {
            echo $value;
        }
    }
183917
public static function form( array $attributes = array(), $value = null, $close = false )
    {
        return static::tag( 'form', $attributes, $value, $close );
    }
1328695
public static function attributes(array $attributes = null) : string
    {
        if (empty($attributes)) return '';

        // Init var
        $sorted = [];

        foreach (Html::$attribute_order as $key) {

            if (isset($attributes[$key])) {
                // Add the attribute to the sorted list
                $sorted[$key] = $attributes[$key];
            }

        }

        // Combine the sorted attributes
        $attributes = $sorted + $attributes;

        $compiled = '';

        foreach ($attributes as $key => $value) {

            if ($value === NULL) {
                // Skip attributes that have NULL values
                continue;
            }

            if (is_int($key)) {
                // Assume non-associative keys are mirrored attributes
                $key = $value;
            }

            // Add the attribute value
            $compiled .= ' '.$key.'="'.Html::toText($value).'"';
        }

        return $compiled;
    }
1347073
public function close()
    {
        $tag = new Tag('form');
        $tag->closeMode = Tag::CLOSE_ONLY;

        $this->model = null;

        return $tag;
    }
75936
public function secure($secure = null)
    {
        if (func_num_args() === 0) {
            return $this->_data['secure'];
        }
        return $this->_data['secure'] = (boolean) $secure;
    }
166650
public function attributesToString(array $attributes = []): string
    {
        $html = [];
        foreach ($attributes as $key => $value) {
            if (is_array($value)) {
                $value = json_encode($value);
            }

            if (in_array($key, $this->booleanAttributes, true)) {
                $value = $this->prepareBooleanAttribute($key, $value);
            }

            if ($value === '') {
                continue;
            }

            $html[] = sprintf(
                '%s="%s"',
                $this->escapeAttribute($key),
                $this->escapeAttribute($value)
            );
        }

        return implode(' ', $html);
    }
1003836
public static function createAttributeString($attributes)
    {
        $return = '';
        if (is_array($attributes)) {
            foreach ($attributes as $key => $value) {
                $key = self::clearAttributeKey($key);
                $value = self::clearAttributeValue($value);
                if ($key === '') {
                    continue;
                }
                $return .= " {$key}=\"{$value}\"";
            }
        }

        return trim($return);
    }
717311
public function formatAttribute($attributes = [])
    {
        $attributes = $attributes ?: $this->attributes;

        if ($this->hasFile()) {
            $attributes['enctype'] = 'multipart/form-data';
        }

        $html = [];
        foreach ($attributes as $key => $val) {
            $html[] = "$key=\"$val\"";
        }

        return implode(' ', $html) ?: '';
    }
459849
public function link($url, $title = null, $attributes = [], $secure = null, $escape = true)
    {
        $url = $this->url->to($url, [], $secure);

        if (is_null($title) || $title === false) {
            $title = $url;
        }

        if ($escape) {
            $title = $this->entities($title);
        }

        return $this->toHtmlString('<a href="' . $this->entities($url) . '"' . $this->attributes($attributes) . '>' . $title . '</a>');
    }
17448
protected function attributes($attributes)
    {
        $html = array();
        foreach ((array) $attributes as $key => $value)
        {
            $element = $this->attributeElement($key, $value);

            if ( ! is_null($element)) $html[] = $element;
        }

        $output = count($html) > 0 ? ' '.implode(' ', $html) : '';

        return trim($output);
    }
85196
public function getHtml(array $attributes = []): string
    {
        return self::buildTag('input', null,
            array_merge(
                [
                    'type'    => 'radio',
                    'name'    => $this->name !== '' ? $this->name : false,
                    'value'   => $this->value,
                    'checked' => $this->isSelected,
                ],
                $attributes
            )
        );
    }
1206087
public function secureLink($url, $title = null, $attributes = array())
	{
		return $this->link($url, $title, $attributes, true);
	}
486378
public static function attributes(array $attributes = array())
    {
        $text = array();
        foreach ($attributes as $key => $value) {
            //if we have numeric keys (e.g. checked), set the value as
            //the $key (e.g. checked="checked"), but only if it
            //doesn't exist already
            if (is_numeric($key)) {
                $value = htmlspecialchars($value);
                if (!isset($attributes[$value])) {
                    $text[] = $value . '="' . $value . '"';
                }
                continue;
            }
            $text[] = $key . '="' . htmlspecialchars($value) . '"';
        }

        return empty($text) ? '' : ' ' . implode(' ', $text);
    }