WordPress at a glance
function is not described

Pelago

Emogrifier::process() protected WC 1.0

Applies $this->css to $this->domDocument.

This method places the CSS inline.

{} It's a method of the class: Emogrifier{}

No Hooks.

Return

null.

Usage

// protected - for code of main (parent) or child class
$result = $this->process();

Code of Emogrifier::process() WC 5.0.0

<?php
protected function process()
{
    $this->clearAllCaches();
    $this->purgeVisitedNodes();

    \set_error_handler([$this, 'handleXpathQueryWarnings'], E_WARNING);
    $this->removeUnprocessableTags();
    $this->normalizeStyleAttributesOfAllNodes();

    // grab any existing style blocks from the html and append them to the existing CSS
    // (these blocks should be appended so as to have precedence over conflicting styles in the existing CSS)
    $allCss = $this->css;
    if ($this->isStyleBlocksParsingEnabled) {
        $allCss .= $this->getCssFromAllStyleNodes();
    }

    $cssWithoutComments = $this->removeCssComments($allCss);
    list($cssWithoutCommentsCharsetOrImport, $cssImportRules)
        = $this->extractImportAndCharsetRules($cssWithoutComments);

    $excludedNodes = $this->getNodesToExclude();
    $cssRules = $this->parseCssRules($cssWithoutCommentsCharsetOrImport);
    foreach ($cssRules['inlinable'] as $cssRule) {
        // There's no real way to test "PHP Warning" output generated by the following XPath query unless PHPUnit
        // converts it to an exception. Unfortunately, this would only apply to tests and not work for production
        // executions, which can still flood logs/output unnecessarily. Instead, Emogrifier's error handler should
        // always throw an exception and it must be caught here and only rethrown if in debug mode.
        try {
            // \DOMXPath::query will always return a DOMNodeList or throw an exception when errors are caught.
            $nodesMatchingCssSelectors = $this->xPath->query($this->translateCssToXpath($cssRule['selector']));
        } catch (\InvalidArgumentException $e) {
            if ($this->debug) {
                throw $e;
            }
            continue;
        }

        /** @var \DOMElement $node */
        foreach ($nodesMatchingCssSelectors as $node) {
            if (\in_array($node, $excludedNodes, true)) {
                continue;
            }
            $this->copyInlinableCssToStyleAttribute($node, $cssRule);
        }
    }

    if ($this->isInlineStyleAttributesParsingEnabled) {
        $this->fillStyleAttributesWithMergedStyles();
    }

    $this->removeImportantAnnotationFromAllInlineStyles();

    $this->copyUninlinableCssToStyleNode($cssRules['uninlinable'], $cssImportRules);

    \restore_error_handler();
}