Fixes the attributes for the internal stylesheet.

@param array $attr Additional attributes for the <style> tag.

@return array

@access protected
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);
    }
114915
private function _checkAndReturnBelongs($attr, $values)
    {
        $cls = get_called_class();
        if (array_key_exists($cls, self::$_belongs_to)
            && array_key_exists($attr, self::$_belongs_to[$cls])
        ) {
            return $this->_resolveBelongsTo($attr, $values);
        }
    }
22063
private function _repair_row( $data = array(), $attr = array() ) {
		$row = array();
		foreach( $data as $key => $value ) {
			if ( !$value instanceof HTML || ( $value->name != 'td' && $value->name != 'th' ) ) {
				$value = static::cell( (string) $value );
			}
			if ( is_string( $key ) ) {
				$row[$key] = $value;
			} else {
				$row[] = $value;
			}
		}
		return array( $row, $attr );
	}
738414
protected function setDirty($attr = null)
    {
        if ($attr === null) {
            $this->setClean();
            foreach (array_keys(get_object_vars($this)) as $key) {
                $this->setDirty($key);
            }
        } elseif (
            !in_array($attr, $this->_dirtyAttr) &&
            !in_array($attr, $this->_readonlyAttr) &&
            substr($attr, 0, 1) != '_' &&
            $attr != 'id'
        ) {
            $this->_dirtyAttr[] = $attr;
        }
        return $this;
    }
102607
public function set_attribute($attr, $value = null)
	{
		$attr = is_array($attr) ? $attr : array($attr => $value);
		foreach ($attr as $key => $value)
		{
			if ($value === null)
			{
				unset($this->attributes[$key]);
			}
			else
			{
				$this->attributes[$key] = $value;
			}
		}

		return $this;
	}
47814
public function removeElementsAttr($attr) {
		foreach ($this->getElements() as $element) {
			if ($element instanceof Tag) {
				$element->removeAttr($attr);
			}
		}
		
		return $this;
	}
1137071
protected function html( $attr ) {

		$attr = [];

		$parts = wp_kses_hair( get_language_attributes(), [ 'http', 'https' ] );

		if ( $parts ) {

			foreach ( $parts as $part ) {

				$attr[ $part['name'] ] = $part['value'];
			}
		}

		return $attr;
	}
203568
private function escapeAttributes($attrs)
    {
        $script = '[';
        $first = true;
        foreach ($attrs as $name => $value) {
            if ($first) {
                $first = false;
            } else {
                $script .= ' ';
            }
            $script .= $name . '=' . self::escape($value);
        }
        $script .= ']';

        return $script;
    }
8676
public function attr_first($css, $attr)
    {
        $nodes = $this->_document->getQuery()->css($css, $this->_node);
        return $nodes ? $nodes->item(0)->getAttribute($attr) : null;
    }
1331530
public function getInjects(&$attr)
    {
        $inject = array(
            'before' => '',
            'between' => '',
            'after' => ''
        );

        if (! empty($attr['before'])) {
            $inject['before'] = $attr['before'];
            unset($attr['before']);
        }

        if (! empty($attr['between'])) {
            $inject['between'] = $attr['between'];
            unset($attr['between']);
        }

        if (! empty($attr['after'])) {
            $inject['after'] = $attr['after'];
            unset($attr['after']);
        }

        return $inject;
    }
74553
function getAttribute($attr)
    {
        $attr = strtolower($attr);
        if (isset($this->_attributes[$attr])) {
            return $this->_attributes[$attr];
        }
        return null;
    }
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;
    }
1069696
public static function getKeyAlias(array &$attr)
    {
        foreach (TagInfo::$attrKeyAliases as $alias => $key) {
            if (strpos($attr[0], $alias) === 0) {
                return compact('key', 'alias');
            }
        }

        return false;
    }
479158
private function styleStartHandler(array $attrs): void
    {
        if (empty($attrs['name'])) {
            throw new DomainException('REPORT ERROR Style: The "name" of the style is missing or not set in the XML file.');
        }

        // array Style that will be passed on
        $s = [];

        // string Name af the style
        $s['name'] = $attrs['name'];

        // string Name of the DEFAULT font
        $s['font'] = $this->wt_report->default_font;
        if (!empty($attrs['font'])) {
            $s['font'] = $attrs['font'];
        }

        // int The size of the font in points
        $s['size'] = $this->wt_report->default_font_size;
        if (!empty($attrs['size'])) {
            $s['size'] = (int) $attrs['size'];
        } // Get it as int to ignore all decimal points or text (if any text then int(0))

        // string B: bold, I: italic, U: underline, D: line trough, The default value is regular.
        $s['style'] = '';
        if (!empty($attrs['style'])) {
            $s['style'] = $attrs['style'];
        }

        $this->wt_report->addStyle($s);
    }
541569
protected function initializeStockItem(array $attr)
    {

        // load the stock item with the passed item/product/stock ID
        $entity = $this->loadStockItem(
            $attr[MemberNames::PRODUCT_ID],
            $attr[MemberNames::WEBSITE_ID],
            $attr[MemberNames::STOCK_ID]
        );

        // merge the attributes with the entity, if available
        if ($entity) {
            return $this->mergeEntity($entity, $attr);
        }

        // otherwise simply return the attributes
        return $attr;
    }
879098
protected function explodeAttributes($attr)
    {
        $attrarr = array();
        $mode = 0;
        $attrname = '';
        $skip = false;

        while (strlen($attr) != 0) {

            $working = 0;

            switch ($mode) {
                case 0:
                    // Attribute name, href for instance.
                    if (preg_match('/^([-a-zA-Z]+)/', $attr, $match)) {
                        $attrname = strtolower($match[1]);
                        $skip = ($attrname == 'style' || substr($attrname, 0, 2) == 'on');
                        $working = $mode = 1;
                        $attr = preg_replace('/^[-a-zA-Z]+/', '', $attr);
                    }
                    break;
                case 1:
                    // Equals sign or valueless ("selected").
                    if (preg_match('/^\s*=\s*/', $attr)) {
                        $working = 1;
                        $mode = 2;
                        $attr = preg_replace('/^\s*=\s*/', '', $attr);
                        break;
                    }

                    if (preg_match('/^\s+/', $attr)) {
                        $working = 1;
                        $mode = 0;

                        if (!$skip) {
                            $attrarr[] = $attrname;
                        }

                        $attr = preg_replace('/^\s+/', '', $attr);
                    }
                    break;
                case 2:
                    // Attribute value, a URL after href= for instance.
                    if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match)) {
                        $thisval = $this->badProtocol($match[1]);

                        if (!$skip) {
                            $attrarr[] = "$attrname=\"$thisval\"";
                        }

                        $working = 1;
                        $mode = 0;
                        $attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
                        break;
                    }

                    if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) {

                        $thisval = $this->badProtocol($match[1]);

                        if (!$skip) {
                            $attrarr[] = "$attrname='$thisval'";
                        }

                        $working = 1;
                        $mode = 0;
                        $attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
                        break;
                    }

                    if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) {
                        $thisval = $this->badProtocol($match[1]);

                        if (!$skip) {
                            $attrarr[] = "$attrname=\"$thisval\"";
                        }

                        $working = 1;
                        $mode = 0;
                        $attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);
                    }
                    break;
            }

            if ($working == 0) {
                // Not well formed; remove and try again.
                $attr = preg_replace('/
                ^
                (
                "[^"]*("|$)     # - a string that starts with a double quote, up until the next double quote or the end of the string
                |               # or
                \'[^\']*(\'|$)| # - a string that starts with a quote, up until the next quote or the end of the string
                |               # or
                \S              # - a non-whitespace character
                )*              # any number of the above three
                \s*             # any number of whitespaces
                /x', '', $attr);

                $mode = 0;
            }
        }

        // The attribute list ends with a valueless attribute like "selected".
        if ($mode == 1 && !$skip) {
            $attrarr[] = $attrname;
        }

        return $attrarr;
    }
449742
public static function parseAttributes(array $attrs = array())
    {
        $str = '';
        foreach($attrs as $var=>$val) {
            $str .= ' '.$var.'="'.(is_array($val) ? join(' ', $val) : $val).'"';
        }
        return $str;
    }