WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Pelago\Emogrifier

CssInliner::parseCssDeclarationsBlock() private WC 1.0

Parses a CSS declaration block into property name/value pairs.

Example:

The declaration block

"color: #000; font-weight: bold;"

will be parsed into the following array:

"color" => "#000" "font-weight" => "bold"

Это метод класса: CssInliner{}

Хуков нет.

Возвращает

Строку[]
. the CSS declarations with the property names as array keys and the property values as array values

Использование

// private - только в коде основоного (родительского) класса
$result = $this->parseCssDeclarationsBlock( $cssDeclarationsBlock );
$cssDeclarationsBlock(строка) (обязательный)
the CSS declarations block without the curly braces, may be empty

Код CssInliner::parseCssDeclarationsBlock() WC 4.5.2

woocommerce/vendor/pelago/emogrifier/src/Emogrifier/CssInliner.php
<?php
private function parseCssDeclarationsBlock($cssDeclarationsBlock)
{
    if (isset($this->caches[self::CACHE_KEY_CSS_DECLARATIONS_BLOCK][$cssDeclarationsBlock])) {
        return $this->caches[self::CACHE_KEY_CSS_DECLARATIONS_BLOCK][$cssDeclarationsBlock];
    }

    $properties = [];
    foreach (\preg_split('/;(?!base64|charset)/', $cssDeclarationsBlock) as $declaration) {
        $matches = [];
        if (!\preg_match('/^([A-Za-z\\-]+)\\s*:\\s*(.+)$/s', \trim($declaration), $matches)) {
            continue;
        }

        $propertyName = \strtolower($matches[1]);
        $propertyValue = $matches[2];
        $properties[$propertyName] = $propertyValue;
    }
    $this->caches[self::CACHE_KEY_CSS_DECLARATIONS_BLOCK][$cssDeclarationsBlock] = $properties;

    return $properties;
}