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

Pelago

Emogrifier::translateCssToXpathPassWithMatchClassAttributesCallback() private WC 1.0

Flexibly translates the CSS selector $trimmedLowercaseSelector to an xPath selector while using $matchClassAttributesCallback as to match the class attributes.

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

Хуков нет.

Возвращает

Строку.

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

// private - только в коде основоного (родительского) класса
$result = $this->translateCssToXpathPassWithMatchClassAttributesCallback(;

Код Emogrifier::translateCssToXpathPassWithMatchClassAttributesCallback() WC 5.4.1

<?php
private function translateCssToXpathPassWithMatchClassAttributesCallback(
    $trimmedLowercaseSelector,
    callable $matchClassAttributesCallback
) {
    $roughXpath = \preg_replace(\array_keys($this->xPathRules), $this->xPathRules, $trimmedLowercaseSelector);
    $xPathWithIdAttributeMatchers = \preg_replace_callback(
        self::ID_ATTRIBUTE_MATCHER,
        [$this, 'matchIdAttributes'],
        $roughXpath
    );
    $xPathWithIdAttributeAndClassMatchers = \preg_replace_callback(
        self::CLASS_ATTRIBUTE_MATCHER,
        $matchClassAttributesCallback,
        $xPathWithIdAttributeMatchers
    );

    // Advanced selectors are going to require a bit more advanced emogrification.
    $xPathWithIdAttributeAndClassMatchers = \preg_replace_callback(
        '/([^\\/]+):nth-child\\(\\s*(odd|even|[+\\-]?\\d|[+\\-]?\\d?n(\\s*[+\\-]\\s*\\d)?)\\s*\\)/i',
        [$this, 'translateNthChild'],
        $xPathWithIdAttributeAndClassMatchers
    );
    $finalXpath = \preg_replace_callback(
        '/([^\\/]+):nth-of-type\\(\\s*(odd|even|[+\\-]?\\d|[+\\-]?\\d?n(\\s*[+\\-]\\s*\\d)?)\\s*\\)/i',
        [$this, 'translateNthOfType'],
        $xPathWithIdAttributeAndClassMatchers
    );

    return $finalXpath;
}