Returns a "style" tag

@param mixed $css  The source CSS
@param array $attr The attributes for the tag

@return string

@access protected
549643
protected function style($css, array $attr = null)
    {
        $attr = $this->fixInternalAttr($attr);
        $attr = $this->escaper->attr($attr);
        return "<style $attr>$css</style>";
    }
1037371
public function css($css) {
        $css = trim($css);
        if (substr($css, -1) !== ';') {
            $css = $css . ';';
        }
        return $this->att(['style' => $css]);
    }
760026
public static function img($attr = null)
    {
        if (is_string($attr)) {
            $attr = array('src' => $attr);
        }

        return self::tag('img', $attr + array('alt' => ''), null, array_merge(self::$common_attrib,
            array('src','alt','width','height','border','usemap','onclick','onerror','onload')));
    }
425020
private static function getAttributes($attr)
    {
        $html = "";
        foreach ($attr as $key => $value) {
            $html .= $key . '="' . $value . '" ';
        }

        return $html;
    }
1298984
public function getAttribute($attr) {
        $url = "entities/{$this->_id}/attrs/$attr";

        if ($this->_type) {
            $url .= "?type={$this->_type}";
        }

        return $this->_orion->get($url);
    }
928665
public function inlineCond($cond, $style, array $attr = null)
    {
        $style = $this->inline($style, $attr);
        $cond  = $this->escaper->html($cond);
        return "<!--[if {$cond}]>{$style}<![endif]-->";
    }
1354041
public static function parseAttrs($attr)
    {
        /*
         * Skip empty strings
         */
        if (trim($attr) == '') {
            return '';
        }

        /*
         * Match all attribute like parts from string.
         */
        preg_match_all('/[a-zA-Z0-9-_:.]+(\s?=\s?("|\')[^\2]*\2|\s)/U', $attr, $attr);

        /*
         * Get the interessting part.
         */
        $attr = $attr[0];

        $r = array();
        foreach ($attr as $k => $v) {
            /*
             * Skip empty matches
             */
            if (trim($v) == '') {
                continue;
            }

            /*
             * Split by the first = symbol.
             */
            $e = explode('=', $v, 2);
            /*
             * attribute name.
             */
            $at = trim($e[0]);
            /*
             * attribute value.
             */
            $val = isset($e[1]) ? trim($e[1]) : null;

            if ($val !== null) {
                /*
                 * trim the quotation symbols
                 */
                $val = trim($val, substr($val, 0, 1));
            }

            /*
             * store it in the return variable.
             */
            $r[$at] = $val;
        }

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

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

        return $data;
    }
1107502
private function sortCssClassNames($attrName, $attrValue): string
    {
        if ($attrName !== 'class' || !$attrValue) {
            return $attrValue;
        }

        $classes = \array_unique(
            \explode(' ', $attrValue)
        );
        \sort($classes);

        $attrValue = '';
        foreach ($classes as $class) {
            if (!$class) {
                continue;
            }

            $attrValue .= \trim($class) . ' ';
        }

        return \trim($attrValue);
    }
316720
private function parse_attributes($attr)
    {
        $html = '';

        if (!empty($attr)) {
            $html = '';

            foreach ($attr as $key => $value) {
                $html .= \sprintf('%s="%s" ', $key, \esc_attr($value));
            }
        }

        return \trim($html);
    }
575711
private function proxify_css($str){
		
		// The HTML5 standard does not require quotes around attribute values.
		
		// if {1} is not there then youtube breaks for some reason
		$str = preg_replace_callback('@[^a-z]{1}url\s*\((?:\'|"|)(.*?)(?:\'|"|)\)@im', array($this, 'css_url'), $str);
		
		// https://developer.mozilla.org/en-US/docs/Web/CSS/@import
		// TODO: what about @import directives that are outside <style>?
		$str = preg_replace_callback('/@import (\'|")(.*?)\1/i', array($this, 'css_import'), $str);
		
		return $str;
	}
860989
public static function style($content, array $attrs = [])
    {
        $attrs = array_merge(['type' => 'text/css'], $attrs);

        return static::tag('style', PHP_EOL . trim($content) . PHP_EOL, $attrs);
    }
47814
public function removeElementsAttr($attr) {
		foreach ($this->getElements() as $element) {
			if ($element instanceof Tag) {
				$element->removeAttr($attr);
			}
		}
		
		return $this;
	}
587221
public function getAttr($attr)
    {
        $attributeValue = $this->con->evaluateJavascript(sprintf('%s.getAttribute(%s)', $this->getAccessor(), json_encode($attr)));

        if ($attributeValue === false) {
            // see https://github.com/kriswallsmith/Buzz/pull/138 bug
            return '';
        }

        return $attributeValue;
    }
166969
protected function _renderStyle($style, $link, $attribs = array())
    {
        $attribs = AnHelperArray::toString($attribs);

        if (!$link) {
            $html  = '<style type="text/css" '.$attribs.'>'."\n";
            $html .= trim($style['data']);
            $html .= '</style>'."\n";
        } else {
            $html = '<link type="text/css" rel="stylesheet" href="'.$style.'" '.$attribs.' />'."\n";
        }

        return $html;
    }
728157
static public function htmlClassTr($html, $css_tr) {
    $html = preg_replace_callback('@<(?<tag>[a-z]+)(?<other>\s+[^>]*)class="(?<class>[^"]+)"@s', function ($attrs) use ($css_tr) {
      $class = ' '
        . strtr($attrs['class'], array(
          "\n" => ' ',
          "\r" => ' ',
          "\t" => ' ',
        )) . ' ';
      $class = strtr($class, $css_tr['*']);
      if (isset($css_tr[$attrs['tag']])) {
        $class = strtr($class, $css_tr[$attrs['tag']]);
      }
      $class = trim($class);
      if ($class !== '') {
        $class = 'class="' . $class . '"';
      }
      return '<' . $attrs['tag'] . $attrs['other'] . $class;
    }, $html);
    return $html;
  }
1313966
public function addInternal($css, array $attr = null, $pos = 100)
    {
        $style = $this->style($css, $attr);
        $this->addElement($pos, $style);
        return $this;
    }