@param int|string $link
@param array      $attrs

@return Link
969930
public static function factory($link, array $attrs = [])
    {
        if (URL::getAssetId($link) > 0) {
            return new AssetLink($link, $attrs);
        }

        if (is_numeric($link) || URL::isInternal($link)) {
            return new PageLink($link, $attrs);
        }

        return new External($link, $attrs);
    }
667460
public function addAttributes(array $attrs)
	{
		$this->getElementPrototype('td')->addAttributes($attrs);
		$this->getElementPrototype('th')->addAttributes($attrs);

		return $this;
	}
603164
protected function getPriorityFromAttributes($attrs)
    {
        if (!is_array($attrs) || !isset($attrs['priority'])) {
            return 0;
        }
        $p = intval($attrs['priority']);

        return $p < 0 ? 0 : $p;
    }
396564
public static function style($href = '', array $attributes = [])
    {
        $attributes = array_merge([
            'rel'   => 'stylesheet',
            'href'  => $href,
            'type'  => 'text/css'
        ], $attributes);

        return self::tag('link', $attributes);
    }
579455
public function create($name, $attrs = NULL)
	{
		$this->insert(NULL, $child = static::el($name, $attrs));

		return $child;
	}
448243
public function link($text, $href, $label=false, array $attr=[]){
		$field = $this->factory('link', false, $label, array_merge(array('text' => $text, 'href' => $href), $attr));
		return $this->addField($field);
	}
1016036
public function buildAttrs(array $attrs = array())
    {
        $result = ' ';
        foreach ($attrs as $key => $param) {
            $param = (array) $param;
            if ($key === 'data') {
                $result .= $this->_buildDataAttrs($param);
                continue;
            }

            $value = implode(' ', $param);
            $value = $this->_cleanValue($value);

            if ($key !== 'data' && $attr = $this->_buildAttr($key, $value)) {
                $result .= $attr;
            }
        }

        return trim($result);
    }
790468
public function addField($name, $attrs)
    {
        if (is_string($attrs)) {
            $attrs = ['type' => $attrs];
        }
        $attrs = array_intersect_key($attrs, $this->_fieldDefaults);
        $this->_fields[$name] = $attrs + $this->_fieldDefaults;

        return $this;
    }
1349675
protected function _attr($attributes = [])
    {
        $attribute = '';

        if( is_array($attributes) )
        {
            foreach( $attributes as $key => $values )
            {
                if( is_numeric($key) )
                {
                    $key = $values;
                }

                $attribute .= ' '.$key.':'.$values.';';
            }
        }

        return $attribute;
    }
1128076
public function addAttrs(array $attrs)
    {
        foreach ($attrs as $attr => $val) {
            $this->addAttr($attr, $val);
        }

        return $this;
    }
512847
public static function link($href = '', $text = '', array $attributes = [])
    {
        $attributes = array_merge([
            'href'  => $href,
        ], $attributes);

        return self::tag('a', $attributes)->text($text);
    }
153915
protected static function parseAttributes($attrString)
    {
        $attributes = array();
        if (preg_match_all(
                "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" .
                "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/",
                $attrString,
                $regs
           )) {
            for ($i = 0; $i < count($regs[1]); $i++) {
                $name  = trim($regs[1][$i]);
                $check = trim($regs[0][$i]);
                $value = trim($regs[7][$i]);
                if ($name == $check) {
                    $attributes[strtolower($name)] = strtolower($name);
                } else {
                    if (!empty($value) && ($value[0] == '\'' || $value[0] == '"')) {
                        $value = substr($value, 1, -1);
                    }
                    $attributes[strtolower($name)] = $value;
                }
            }
        }
        return $attributes;
    }
788107
protected function _cleanAttrs(array $attrs = array())
    {
        foreach ($attrs as $key => $val) {
            if (Arr::in($key, $this->_disallowAttr)) {
                unset($attrs[$key]);
            }
        }

        return $attrs;
    }
420004
public function prepare(&$attrs)
    {
        $attrs['type'] = 'hidden';
        $attrs['name'] = $this->getFieldName();
        $attrs['id'] = $this->getAttribute('id', $this->getId());
        $attrs['class'] = $this->getAttribute('class');
        $attrs['disabled'] = $this->getAttribute('disabled');
        $attrs['onchange'] = $this->getAttribute('onchange');
        $attrs['value'] = $this->getValue();
    }
605074
public static function script($src, array $attrs = [])
    {
        $attrs = array_merge([
            'src' => $src
        ], $attrs);

        return static::tag('script', null, $attrs);
    }
948579
protected function _getBtnClasses(array $attrs = array())
    {
        if (Arr::key('button', $attrs)) {
            $classes = array($this->_btm);
            foreach ((array) $attrs['button'] as $btn) {
                $classes[] = $this->_btm . '-' . $btn;
            }

            $attrs = $this->_mergeAttr($attrs, implode(' ', $classes));
            unset($attrs['button']);
        }

        return $attrs;
    }
1300007
public function attr($attr)
    {
        $data = [];

        foreach ($this->_nodes as $node) {
            $data[] = $node->getAttribute($attr);
        }

        return $data;
    }