Automattic\WooCommerce\EmailEditorVendor\Pelago\Emogrifier\HtmlProcessor
CssVariableEvaluator::replaceVariablesInPropertyValue
Regular expression based on {@see https://stackoverflow.com/a/54143883/2511031 a StackOverflow answer}.
Метод класса: CssVariableEvaluator{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->replaceVariablesInPropertyValue( $propertyValue ): string;
- $propertyValue(строка) (обязательный)
- .
Код CssVariableEvaluator::replaceVariablesInPropertyValue() CssVariableEvaluator::replaceVariablesInPropertyValue WC 11.3.0
private function replaceVariablesInPropertyValue(string $propertyValue): string
{
return (new Preg())->replaceCallback(
'/
var\\(
\\s*+
# capture variable name including `--` prefix
(
--[^\\s\\),]++
)
\\s*+
# capture optional fallback value
(?:
# capture separator to confirm there is a fallback value
(,)\\s*
# begin capture with named group that can be used recursively
(?<recursable>
# begin named group to match sequence without parentheses, except in strings
(?<noparentheses>
# repeated zero or more times:
(?:
# sequence without parentheses or quotes
[^\\(\\)\'"]++
|
# string in double quotes
"(?>[^"\\\\]++|\\\\.)*"
|
# string in single quotes
\'(?>[^\'\\\\]++|\\\\.)*\'
)*+
)
# repeated zero or more times:
(?:
# sequence in parentheses
\\(
# using the named recursable pattern
(?&recursable)
\\)
# sequence without parentheses, except in strings
(?&noparentheses)
)*+
)
)?+
\\)
/x',
\Closure::fromCallable([$this, 'getPropertyValueReplacement']),
$propertyValue
);
}