PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.2.2
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.2.2
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Helpers / CssInlinerHelper.php

CssInlinerHelper.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.2.2, at back/Helpers/CssInlinerHelper.php

46 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AcyMailing\Helpers;
4
5 use Pelago\Emogrifier\CssInliner;
6
7 class CssInlinerHelper extends CssInliner
8 {
9 public function renderBodyContent(): string
10 {
11 $htmlWithPossibleErroneousClosingTags = $this->getDomDocument()->saveHTML($this->getBodyElement());
12
13 return $this->removeSelfClosingTagsClosingTags($htmlWithPossibleErroneousClosingTags);
14 }
15
16 protected function addStyleElementToDocument(string $css): void
17 {
18 global $emogrifiedMediaCSS;
19 $emogrifiedMediaCSS = $css;
20 }
21
22 private function getBodyElement(): \DOMElement
23 {
24 $node = $this->getDomDocument()->getElementsByTagName('body')->item(0);
25 if (!$node instanceof \DOMElement) {
26 throw new \RuntimeException('There is no body element.', 1617922607);
27 }
28
29 return $node;
30 }
31
32 private function removeSelfClosingTagsClosingTags(string $html): string
33 {
34 return \preg_replace('%</'.self::PHP_UNRECOGNIZED_VOID_TAGNAME_MATCHER.'>%', '', $html);
35 }
36
37 public function getMatchingUninlinableSelectors(): array
38 {
39 $selectors = parent::getMatchingUninlinableSelectors();
40 $selectors[] = '.hideonline';
41 $selectors[] = '#acym__wysid__template center > table';
42
43 return $selectors;
44 }
45 }
46