Minifica o código CSS informado.

@param        string $cssCode
Código CSS que será minificado.

@return       string
978545
public static function minifyCode(string $cssCode) : string
    {
        if (trim($cssCode) !== "") {
            // Remove comentários
            $cssCode = preg_replace("!/\*[^*]*\*+([^/][^*]*\*+)*/!", "", $cssCode);

            // Remove tabs, espaços e novas linhas
            $cssCode = preg_replace("/(\s\s+|\t|\n)/", " ", $cssCode);

            // Remove espaços antes e depois de ";"
            $cssCode = preg_replace(["(( )+{)", "({( )+)"], "{", $cssCode);
            $cssCode = preg_replace(["(( )+})", "(}( )+)", "(;( )*})"], "}", $cssCode);
            $cssCode = preg_replace(["(;( )+)", "(( )+;)"], ";", $cssCode);

            $NonSpaceAround = [":", ",", ">", "+"];
            foreach ($NonSpaceAround as $char) {
                $arr = [" " . $char, $char . " "];
                $cssCode = str_replace($arr, $char, $cssCode);
            }
        }

        return trim($cssCode);
    }
218385
private static function MinifyCSS($sStr){
            $sStr = preg_replace('!/\*.*?\*/!s','', $sStr);
            $sStr = preg_replace('/\n\s*\n/',"\n", $sStr);
            $sStr = preg_replace('/[\n\r \t]/',' ', $sStr);
            $sStr = preg_replace('/ +/',' ', $sStr);
            $sStr = preg_replace('/ ?([,:;{}]) ?/','$1',$sStr);
            $sStr = preg_replace('/;}/','}',$sStr);
            return $sStr;
        }
80958
public static function styles_parse( $css = [] ) {

		// Pass our styles from the kirki_styles_array filter.
		$css = apply_filters( 'kirki_styles_array', $css );

		// Process the array of CSS properties and produce the final CSS.
		$final_css = '';
		if ( ! is_array( $css ) || empty( $css ) ) {
			return '';
		}
		foreach ( $css as $media_query => $styles ) {
			$final_css .= ( 'global' !== $media_query ) ? $media_query . '{' : '';
			foreach ( $styles as $style => $style_array ) {
				$css_for_style = '';

				foreach ( $style_array as $property => $value ) {
					if ( is_string( $value ) && '' !== $value ) {
						$css_for_style .= $property . ':' . $value . ';';
					} elseif ( is_array( $value ) ) {
						foreach ( $value as $subvalue ) {
							if ( is_string( $subvalue ) && '' !== $subvalue ) {
								$css_for_style .= $property . ':' . $subvalue . ';';
							}
						}
					}
					$value = ( is_string( $value ) ) ? $value : '';
				}
				if ( '' !== $css_for_style ) {
					$final_css .= $style . '{' . $css_for_style . '}';
				}
			}
			$final_css .= ( 'global' !== $media_query ) ? '}' : '';
		}
		return $final_css;
	}
556677
protected function minify($css)
	{
		$css = trim($css, " \n\t;");
		$css = preg_replace('(\\s*([,:;])\\s*)', '$1', $css);
		$css = preg_replace_callback(
			'((?<=[\\s:])#[0-9a-f]{3,6})i',
			function ($m)
			{
				return strtolower($m[0]);
			},
			$css
		);
		$css = preg_replace('((?<=[\\s:])#([0-9a-f])\\1([0-9a-f])\\2([0-9a-f])\\3)', '#$1$2$3', $css);
		$css = preg_replace('((?<=[\\s:])#f00\\b)', 'red', $css);
		$css = preg_replace('((?<=[\\s:])0px\\b)', '0', $css);

		return $css;
	}
508448
public static function css($css = null)
    {
        if (!is_null($css)) {
            return self::$css = array_merge(self::$css, (array) $css);
        }

        if (!$css = static::getMinifiedCss()) {
            $css = array_merge(static::$css, static::baseCss());
        }

        $css = array_filter(array_unique($css));

        return view('admin::partials.css', compact('css'));
    }
683814
private function translateCssToXpath($cssSelector)
    {
        $paddedSelector = ' ' . $cssSelector . ' ';
        $lowercasePaddedSelector = \preg_replace_callback(
            '/\\s+\\w+\\s+/',
            function (array $matches) {
                return \strtolower($matches[0]);
            },
            $paddedSelector
        );
        $trimmedLowercaseSelector = \trim($lowercasePaddedSelector);
        $xPathKey = \md5($trimmedLowercaseSelector);
        if (isset($this->caches[static::CACHE_KEY_XPATH][$xPathKey])) {
            return $this->caches[static::CACHE_KEY_SELECTOR][$xPathKey];
        }

        $hasNotSelector = (bool)\preg_match(
            '/^([^:]+):not\\(\\s*([[:ascii:]]+)\\s*\\)$/',
            $trimmedLowercaseSelector,
            $matches
        );
        if (!$hasNotSelector) {
            $xPath = '//' . $this->translateCssToXpathPass($trimmedLowercaseSelector);
        } else {
            /** @var string[] $matches */
            list(, $partBeforeNot, $notContents) = $matches;
            $xPath = '//' . $this->translateCssToXpathPass($partBeforeNot) .
                '[not(' . $this->translateCssToXpathPassInline($notContents) . ')]';
        }
        $this->caches[static::CACHE_KEY_SELECTOR][$xPathKey] = $xPath;

        return $this->caches[static::CACHE_KEY_SELECTOR][$xPathKey];
    }
718440
protected function _minify($css)
    {
        return ($this->_minifier instanceof \Tollwerk\Squeezr\Css\Minifier) ? $this->_minifier->minify($css) : $css;
    }
233474
public function getCssClass()
    {
        $cssClasses = [
            'news_category_'.$this->id,
            'category_'.$this->id,
        ];

        if ($this->cssClass) {
            $cssClasses[] = $this->cssClass;
        }

        return \implode(' ', \array_unique($cssClasses));
    }
1105788
public static function css_to_string($css){
    if ( \is_string($css) ){
      return ' style="'.bbn\str::escape_dquotes($css).'"';
    }
    else if ( \is_array($css) && \count($css) > 0 ){
      $st = '';
      foreach ( $css as $prop => $val ){
        $st .= $prop.':'.$val.';';
      }
      return ' style="'.bbn\str::escape_dquotes($st).'"';
    }
  }
561430
public function get_css_content() {

        $csscontent = '';
        foreach ($this->get_css_files(false) as $type => $value) {
            foreach ($value as $identifier => $val) {
                if (is_array($val)) {
                    foreach ($val as $v) {
                        $csscontent .= file_get_contents($v) . "\n";
                    }
                } else {
                    if ($type === 'theme' && $identifier === self::SCSS_KEY) {
                        // We need the content from SCSS because this is the SCSS file from the theme.
                        if ($compiled = $this->get_css_content_from_scss(false)) {
                            $csscontent .= $compiled;
                        } else {
                            // The compiler failed so default back to any precompiled css that might
                            // exist.
                            $csscontent .= $this->get_precompiled_css_content();
                        }
                    } else if ($type === 'theme' && $identifier === $this->lessfile) {
                        // We need the content from LESS because this is the LESS file from the theme.
                        $csscontent .= $this->get_css_content_from_less(false);
                    } else {
                        $csscontent .= file_get_contents($val) . "\n";
                    }
                }
            }
        }
        $csscontent = $this->post_process($csscontent);
        $csscontent = core_minify::css($csscontent);

        return $csscontent;
    }
1140491
public function getCssCode()
    {
        $html = '';
        foreach ($this->css as $css) {
            $html .= sprintf('<link rel="stylesheet" href="%s"/>', $css);
        }
        return $html;
    }
945678
public function toCSS(CSSDocument $css, $selector)
    {
        if ($this->url) {
            $size = 'contain';
            $repeat = 'no-repeat';
            $positionHor = 'center';
            $positionVer = 'center';

            switch ($this->style) {
                case self::TYPE_STRETCH:
                    $size = '100% 100%';
                    break;
                case self::TYPE_TILE:
                    $repeat = 'repeat';
                    break;
                case self::TYPE_CENTER:
                    if (is_array($this->size)) {
                        $size = "{$this->size['width']}px {$this->size['height']}px";
                    } else {
                        $size = 'auto';
                    }
                    break;
                case self::TYPE_FILL:
                    $size = 'cover';
                    break;
            }

            if ($this->attachment) {
                $i = $this->attachment & 3;
                if ($i == 1) {
                    $positionHor = 'left';
                } else {
                    if ($i == 3) {
                        $positionHor = 'right';
                    }
                }
                $i = $this->attachment & 12;
                if ($i == 4) {
                    $positionVer = 'top';
                } else {
                    if ($i == 12) {
                        $positionVer = 'bottom';
                    }
                }
            }

            $css->addRule($selector, 'background-image', $css->getURLValue($this->url));
            $css->addRule($selector, 'background-repeat', $repeat);
            $css->addRule($selector, 'background-position', "$positionHor $positionVer");
            $css->addRule($selector, 'background-size', $size);
        }
        $css->addRule($selector, 'background-color', $css->getColorValue($this->color));
    }
811339
public function css( $cssClasses )
    {
        if ( ! $cssClasses )
        {
            return $this;
        }

        $cssClasses = explode( ' ', $cssClasses );

        foreach ( $cssClasses as $cssClass )
        {
            if ( $cssClass && false === in_array( $cssClass, $this->cssClasses ) )
            {
                $this->cssClasses[] = $cssClass;
            }
        }

        return $this;
    }
1017042
private static function cssMatcher($matches) {

        $chr = $matches[0];

        if(1 === strlen($chr)) {
            $ord = ord($chr);
        }
        else {
            
            $chr = static :: convert($chr, 'UTF-8', 'UTF-32BE');
            $ord = hexdec(bin2hex($chr));
        }

        return sprintf('\\%X ', $ord);
    }
549643
protected function style($css, array $attr = null)
    {
        $attr = $this->fixInternalAttr($attr);
        $attr = $this->escaper->attr($attr);
        return "<style $attr>$css</style>";
    }
480498
public function getCustomCSS()
    {
        // Create CSS Array:
        
        $css = [];
        
        // Merge Custom CSS from Template:
        
        foreach (ClassTools::singleton()->getObjectAncestry($this, self::class) as $class) {
            
            $template = $this->getCustomCSSTemplate($class);
            
            if (SSViewer::hasTemplate($template)) {
                $css = ViewTools::singleton()->renderCSS($this, $template, $css);
            }
            
        }
        
        // Update CSS via Extensions:
        
        $this->extend('updateCustomCSS', $css);
        
        // Filter CSS Array:
        
        $css = array_filter($css);
        
        // Answer CSS Array:
        
        return $css;
    }
138697
public static function add_prefixes( $css ) {
		if ( is_array( $css ) ) {
			foreach ( $css as $media_query => $elements ) {
				foreach ( $elements as $element => $style_array ) {
					foreach ( $style_array as $property => $value ) {

						// Add -webkit-* and -moz-*.
						if ( is_string( $property ) && in_array(
							$property,
							[
								'border-radius',
								'box-shadow',
								'box-sizing',
								'text-shadow',
								'transform',
								'background-size',
								'transition',
								'transition-property',
							],
							true
						) ) {
							unset( $css[ $media_query ][ $element ][ $property ] );
							$css[ $media_query ][ $element ][ '-webkit-' . $property ] = $value;
							$css[ $media_query ][ $element ][ '-moz-' . $property ]    = $value;
							$css[ $media_query ][ $element ][ $property ]              = $value;
						}

						// Add -ms-* and -o-*.
						if ( is_string( $property ) && in_array(
							$property,
							[
								'transform',
								'background-size',
								'transition',
								'transition-property',
							],
							true
						) ) {
							unset( $css[ $media_query ][ $element ][ $property ] );
							$css[ $media_query ][ $element ][ '-ms-' . $property ] = $value;
							$css[ $media_query ][ $element ][ '-o-' . $property ]  = $value;
							$css[ $media_query ][ $element ][ $property ]          = $value;
						}
					}
				}
			}
		}
		return $css;
	}