Generates HTML-attributes string.

@param array $htmlAttributes Associative array of attributes.
@param array $ignore List of attributes to ignore.

@return string
185455
private static function buildAttributes($htmlAttributes, $ignore = array())
    {
        if (empty($htmlAttributes))
        {
            return '';
        }

        if ($ignore === null) {
            $ignore = array();
        }

        $filtered = array_filter($htmlAttributes, function($key) use ($ignore) {
            return !in_array($key, $ignore);
        }, \ARRAY_FILTER_USE_KEY);

        array_walk($filtered, function(&$value, $key) {
            $value = sprintf('%s="%s"', $key, self::encodeHtmlAttributeString($value));
        });

        return implode(' ', $filtered);
    }
648802
protected function renderAttributes(array $attributes)
    {
        $attributeString = '';
        foreach ($attributes as $key => $value) {
            if (is_array($value)) {
                $value = implode(' ', $value);
            }
            // Skip attributes that are not to be set (required, disabled, ...).
            if ($value !== false && $value !== '') {
                $attributeString .= ' ' . htmlspecialchars($key, ENT_QUOTES, 'UTF-8');
                // HTML5: do not add a value to boolean attributes.
                // HTML4: add the name of the key as value for the attribute.
                if (!$this->html5 && $value === true) {
                    $value = $key;
                }
                if ($value !== true) {
                    $attributeString .= '="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"';
                }
            }
        }
        return $attributeString;
    }
1289858
public function getHtml(array $attributes = []): string
    {
        if ($this->minimumValue !== null) {
            $attributes['min'] = $this->minimumValue;
        }

        if ($this->maximumValue !== null) {
            $attributes['max'] = $this->maximumValue;
        }

        return parent::getHtml($attributes);
    }
1018265
protected function addAttributes(&$html, array $attributes)
	{
		if ( count($attributes) > 0 )
		{
			$attributes = Html::arrayToAttributes($attributes);

			$html .= ' ' . $attributes;
		}
	}
1308354
public function htmlAttr()
    {
        $attributes = [
            'data-template' => $this->templateName(),
            'data-debug'    => $this->debug() ? 'true' : false,
            'lang'          => $this->lang(),
            'locale'        => $this->locale(),
            'class'         => $this->htmlClasses()
        ];

        return html_build_attributes($attributes);
    }
142587
protected function renderAttributes()
    {
        $output = '';

        foreach($this->_attr as $key => $value) {
            $output .= $key.' = "'.$value.'" ';
        }

        return $output;
    }
17229
static public function build(array $attr, callable $callback = null): string
    {
        if (!count($attr)) {
            return '';
        }

        $html = array_map(function ($val, $key) use ($callback) {
            if (is_bool($val)) {
                return $val ? self::getKey($key) : '';
            }

            if (isset($val)) {
                if ($val instanceof \Closure) {
                    $val = $val();
                } elseif ($val instanceof \JsonSerializable) {
                    $val = \json_encode($val->jsonSerialize(), (JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
                } elseif (is_callable([$val, 'toArray'])) {
                    $val = $val->toArray();
                } elseif (is_callable([$val, '__toString'])) {
                    $val = strval($val);
                }

                if (is_array($val)) {
                    $val = \json_encode($val);
                }

                if (is_callable($callback)) {
                    $val = call_user_func($callback, $val);
                } else {
                    $val = htmlspecialchars($val, ENT_QUOTES);
                }

                if (is_string($val)) {
                    return sprintf('%1$s="%2$s"', self::getKey($key), $val);
                }
            }

            return self::getKey($key);
        }, $attr, array_keys($attr));

        return implode(' ', $html);
    }
231618
protected function getAttributesAsHtml()
	{
		$htmlAttrs = '';
		
		foreach($this->attributes as $attrName => $attrValue) {
			$htmlAttrs .= ' ' . $attrName . (($attrValue === null || strlen($attrValue) === 0)?null:'="' . $attrValue . '"');
		}
		
		return $htmlAttrs;
	}
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);
    }
273202
public function getAttribute(string $attribute): string
    {
        if (!isset($this->attribute[$attribute])) {
            Throw new HtmlException(sprintf('The requested attribute "%s" does not exits in this html element "%s".', $attribute, get_called_class()));
        }

        return $this->attribute[$attribute];
    }
400668
public static function get_attribute_html( $attributes = array() ) {
		$html = '';

		if ( ! $attributes ) {
			return $html;
		}

		foreach ( $attributes as $key => $attribute ) {
			$html .= ' ' . esc_attr( $key ) . '="' . esc_attr( $attribute ) . '"';
		}

		return $html;
	}
1111811
public function build( $bodyAttributes = array(), $htmlAttributes = array() )
	{
		if( !is_array( $bodyAttributes ) )
			throw new InvalidArgumentException( 'Parameter "bodyAttributes" need to be an array or empty' );
		if( !is_array( $htmlAttributes ) )
			throw new InvalidArgumentException( 'Parameter "htmlAttributes" need to be an array or empty' );
		$tagsHead	= array();
		$tagsBody	= array();

		if( $this->baseHref )
			$tagsHead[]	= UI_HTML_Tag::create( 'base', NULL, array( 'href' => $this->baseHref ) );
		foreach( $this->metaTags as $attributes )
			$tagsHead[]	= UI_HTML_Tag::create( 'meta', NULL, $attributes );

		if( $this->title )
			$tagsHead[]	= UI_HTML_Tag::create( 'title', $this->title );

		if( $this->heading )
			$tagsBody[]	= UI_HTML_Tag::create( 'h1', $this->heading );

		foreach( $this->links as $attributes )
			$tagsHead[]	= UI_HTML_Tag::create( "link", NULL, $attributes );

		foreach( $this->scripts as $attributes )
			$tagsHead[]	= UI_HTML_Tag::create( "script", "", $attributes );

		$headAttributes	= array(
			'profile'	=> $this->profile
		);

		$tagsHead	= implode( "\n".$this->indent.$this->indent, $tagsHead );
		$tagsHead	.= implode( "\n".$this->indent.$this->indent, $this->head );
		$tagsBody	= implode( "\n".$this->indent.$this->indent, $tagsBody );
		$tagsBody	.= implode( "\n".$this->indent.$this->indent, $this->body );
		if( $tagsBody )
			$tagsBody	= "\n".$this->indent.$this->indent.$tagsBody."\n".$this->indent;
		if( $tagsHead )
			$tagsHead	= "\n".$this->indent.$this->indent.$tagsHead."\n".$this->indent;
		$head		= UI_HTML_Tag::create( "head", $tagsHead, $headAttributes );
		$body		= UI_HTML_Tag::create( "body", $tagsBody, $bodyAttributes );

		$doctype	= $this->doctypes[$this->doctype];
		$attributes	= array( 'lang' => $this->language );
		if( is_int( strpos( $doctype, 'xhtml' ) )/* || $this->doctype == 'HTML_5'*/ ){
			$attributes	= array( 'xml:lang' => $this->language ) + $attributes;
			$attributes	= array( 'xmlns' => "http://www.w3.org/1999/xhtml" ) + $attributes;
		}
		if( $this->prefixes ){
			$list	= array();
			foreach( $this->prefixes as $prefix => $namespace )
				$list[]	= $prefix.": ".$namespace;
			$attributes['prefix']	= join( " ", $list );
		}
		foreach( $htmlAttributes as $key => $value ){
			if( isset( $attributes[$key] ) && $key == "prefix" )
				$attributes['prefix']	.= " ".$value;
			else
				$attributes[$key]	= $value;
		}
		$content	= "\n".$this->indent.$head."\n".$this->indent.$body."\n";
		$html		= UI_HTML_Tag::create( "html", $content, $attributes );
		return $doctype."\n".$html;
	}
182900
protected function htmlAttribs($attribs)
    {
        $html           = '';
        $escapeHtml     = $this->getView()->plugin('escapehtml');
        $escapeHtmlAttr = $this->getView()->plugin('escapehtmlattr');

        foreach ((array) $attribs as $key => $value) {
            $key = $escapeHtml($key);
            $this->cleanHtmlAttribValue($key, $value);
            if (!$value) {
                continue;
            }

            switch ($key) {
                case 'class':
                case 'href':
                    $value = $escapeHtml($value);
                    break;
                default:
                    $value = $escapeHtmlAttr($value);
                    break;
            }

            if ('id' == $key) {
                $value = $this->normalizeId($value);
            }
            
            $html .= $this->getKeyValuePair($key, $value);
        }

        return $html;
    }
935426
public function getAttributesString(array $attributes = array())
    {
        $attributesString = '';

        foreach ($attributes as $name => $values) {
            $value = is_array($values) ? implode(' ', $values) : $values;
            $attributesString .= ' '.$name.'="'.$value.'"';
        }

        return $attributesString;
    }
231990
final public function parseAttributes($ignore = array()) {
        $return = '';
        foreach ($this->attributes as $attr => $val) {
            if (in_array($attr, $ignore))
                continue;
            $return .= Util::camelToHyphen($attr) . '="' . $val . '" ';
        }
        return $return;
    }
458914
final public static function parseAttributes($attributes, $ignore = array()) {
        if (!is_array($attributes)) {
            return $attributes;
        }
        $return = "";
        foreach ($attributes as $attr => $value) {
            if (in_array($attr, $ignore))
                continue;
            $return .= $attr . '="' . $value . '" ';
        }

        return $return;
    }
728112
public static function areValidHtmlAttributes($htmlAttributes)
    {
        /*
         * Not a string?
         * Nothing to do
         */
        if (!is_string($htmlAttributes)) {
            return false;
        }

        $pattern = self::getHtmlAttributePattern();

        return (bool)preg_match_all($pattern, $htmlAttributes);
    }