Takes a reference to an attribute associative array and performs
all inclusions specified by the zero index.
@param array &$attr Reference to attribute array
8996
public function performInclusions(&$attr)
    {
        if (!isset($attr[0])) {
            return;
        }
        $merge = $attr[0];
        $seen  = array(); // recursion guard
        // loop through all the inclusions
        for ($i = 0; isset($merge[$i]); $i++) {
            if (isset($seen[$merge[$i]])) {
                continue;
            }
            $seen[$merge[$i]] = true;
            // foreach attribute of the inclusion, copy it over
            if (!isset($this->info[$merge[$i]])) {
                continue;
            }
            foreach ($this->info[$merge[$i]] as $key => $value) {
                if (isset($attr[$key])) {
                    continue;
                } // also catches more inclusions
                $attr[$key] = $value;
            }
            if (isset($this->info[$merge[$i]][0])) {
                // recursion
                $merge = array_merge($merge, $this->info[$merge[$i]][0]);
            }
        }
        unset($attr[0]);
    }
516466
protected function initializeUrlRewrite(array $attr)
    {

        // load the category ID of the passed URL rewrite entity
        $categoryId = $this->getCategoryIdFromMetadata($attr);

        // iterate over the available URL rewrites to find the one that matches the category ID
        foreach ($this->existingUrlRewrites as $urlRewrite) {
            // compare the category IDs AND the request path
            if ($categoryId === $this->getCategoryIdFromMetadata($urlRewrite) &&
                $attr[MemberNames::REQUEST_PATH] === $urlRewrite[MemberNames::REQUEST_PATH]
            ) {
                // if a URL rewrite has been found, do NOT create OR keep an existing redirect
                $this->removeExistingUrlRewrite($urlRewrite);

                // if the found URL rewrite has been created manually
                if ((integer) $urlRewrite[MemberNames::IS_AUTOGENERATED] === 0) {
                    // do NOT update it nor create another redirect
                    return false;
                }

                // if the found URL rewrite has been autogenerated, then update it
                return $this->mergeEntity($urlRewrite, $attr);
            }
        }

        // simple return the attributes
        return $attr;
    }
833861
public function attr(Array $attr = [])
    {
        if( isset($this->settings['attr']) && is_array($this->settings['attr']) )
        {
            $settings = $this->settings['attr'];
        }
        else
        {
            $settings = [];
        }

        $this->settings['attr'] = array_merge($settings, $attr);

        return $this;
    }
570674
public static function MergeAttr($attr, $_ = null)
  {
    $out = false;
    $arr = func_get_args();
    foreach ($arr as $v) {
      if (is_string($v)) {
        $v = array('class' => $v);
      }

      if (is_array($v)) {
        foreach ($v as $key => $val) {
          if ($key == 'style') {
            $val = static::ProcessStyle($val);
          }

          $val_arr = array();
          if (isset($out[$key])) {
            $val_arr[] = $out[$key];
          }
          $val_arr[] = $val;

          $out[$key] = join(' ', $val_arr);
        }
      }
    }

    return $out;
  }
20748
public function set_row_attribs($attr = array(), $index = null)
    {
        if (is_string($attr)) {
            $attr = array('class' => $attr);
        }

        if ($index === null) {
            $index = $this->rowindex;
        }

        // make sure row object exists (#1489094)
        if (!$this->rows[$index]) {
            $this->rows[$index] = new stdClass;
        }

        $this->rows[$index]->attrib = $attr;
    }
1076352
protected function initializeCustomerAddress(array $attr)
    {

        // try to load the customer address with the given entity ID
        if ($entity = $this->loadCustomerAddress($attr[MemberNames::ENTITY_ID])) {
            return $this->mergeEntity($entity, $attr);
        }

        // remove the entity ID
        unset($attr[MemberNames::ENTITY_ID]);

        // simply return the attributes
        return $attr;
    }
234139
public void setAttr(String attr) {
		String[] list = attr.split(";");
		for (int i = 0; i < list.length; ++i) {
			String[] val = list[i].split("=");
			if (val.length != 2)
				return ;
			getElement().setAttribute(val[0].trim(), val[1].trim());
		}
	}
439268
protected function initializeProductLink(array $attr)
    {

        // load the product/linked product/link type ID
        $productId = $attr[MemberNames::PRODUCT_ID];
        $linkTypeId = $attr[MemberNames::LINK_TYPE_ID];
        $linkedProductId = $attr[MemberNames::LINKED_PRODUCT_ID];

        // try to load the link with the passed product/linked product/link type ID
        if ($entity = $this->loadProductLink($productId, $linkedProductId, $linkTypeId)) {
            return $this->mergeEntity($entity, $attr);
        }

        // simply return the attributes
        return $attr;
    }
610375
public function setModelDefaults($attr, $value = null)
    {
        if (is_array($attr))
            $this->modelDefaults = array_merge($this->modelDefaults, $attr);
        else
            $this->modelDefaults[$attr] = $value;

        return $this;
    }
970218
private static function strToArray($attr){
        //字符串模式 转为数组模式

        $attr['option'] = explode('|',$attr['option']);
        $tem = [];

        foreach($attr['option'] as $k => $v){
            $arg = explode('-',$v);
            if(count($arg) == 1){
                $tem[$k] = $arg[0];
            }else{
                $tem[$arg[0]] = $arg[1];
            }

        }
        $attr['option'] = $tem;


        return $attr['option'];
    }
1311644
protected function initializeProductLinkAttributeDecimal(array $attr)
    {

        // load link/product link attribute ID
        $linkId = $attr[MemberNames::LINK_ID];
        $productLinkAttributeId = $attr[MemberNames::PRODUCT_LINK_ATTRIBUTE_ID];

        // try to load the product link attribute decimal value with the passed product link attribute/link ID
        if ($entity = $this->loadProductLinkAttributeDecimal($productLinkAttributeId, $linkId)) {
            return $this->mergeEntity($entity, $attr);
        }

        // simply return the attributes
        return $attr;
    }
788044
public function addAttrs(array $keys, array $attr)
    {
        foreach ($keys as $key) {
            $this->addAttr($key, $attr);
        }

        return $this;
    }
717857
public function addAttr($attr, $value = '')
    {
        if (func_num_args() > 1) {
            $this->optionAttr[$attr] = $value;
        } elseif (is_array($attr)) {
            $this->optionAttr = $attr;
        }

        return $this;
    }
133287
protected function prepareAttr($attr, $add_placeholder = false)
  {
    if (is_null($attr)) {
      $attr = $this->getAttr();
    }

    $arr = array('id' => $this->getInputId());
    if ($add_placeholder && $ph = $this->getPlaceholder()) {
      $arr['placeholder'] = $ph;
    }

    return array_merge($arr, Tag::MergeAttr($attr) ?: array());
  }
496898
protected function checkAttr($values, $attr)
    {
        if (!is_array($values)) $values = array($values);

        foreach ($values as $value) {
            if (!@in_array($value, $this->get_value($attr, 'all'))) {
                return false;
            }
        }
        return true;
    }
559718
protected function fixInternalAttr(array $attr = null)
    {
        $attr = (array) $attr;

        $base = array(
            'type' => 'text/css',
            'media' => 'screen',
        );

        unset($attr['rel']);
        unset($attr['href']);

        return array_merge($base, (array) $attr);
    }
1300007
public function attr($attr)
    {
        $data = [];

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

        return $data;
    }