PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 1.5.21
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v1.5.21
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
fluent-booking / app / Services / Libs / Emogrifier / Emogrifier.php

Emogrifier.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 1.5.21, at app/Services/Libs/Emogrifier/Emogrifier.php

55 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 FluentBooking\App\Services\Libs\Emogrifier;
4
5
6 class Emogrifier
7 {
8 private $html = '';
9
10 private $disableInvisibleNode = false;
11
12 public function __construct($html)
13 {
14 $this->html = (string) $html;
15 }
16
17 public function disableInvisibleNodeRemoval()
18 {
19 $this->disableInvisibleNode = true;
20 return $this;
21 }
22
23 public function emogrify()
24 {
25 // check if php version is less than 8.1
26 if (version_compare(phpversion(), '8.1', '<')) {
27 return $this->handleLegacy();
28 }
29
30 if (!class_exists('\FluentEmogrifier\Vendor\Pelago\Emogrifier\CssInliner')) {
31 require_once __DIR__ . '/scoped-vendor/autoload.php';
32 }
33
34 if (!class_exists('\FluentEmogrifier\Vendor\Pelago\Emogrifier\CssInliner')) {
35 return $this->handleLegacy();
36 }
37
38 // check if css inlines is available or not
39 return \FluentEmogrifier\Vendor\Pelago\Emogrifier\CssInliner::fromHtml($this->html)
40 ->inlineCss()
41 ->render();
42 }
43
44 private function handleLegacy()
45 {
46 $emogrifier = new EmogrifierPhp7($this->html);
47 if ($this->disableInvisibleNode) {
48 $emogrifier->disableInvisibleNodeRemoval();
49 }
50
51 return $emogrifier->emogrify();
52 }
53
54 }
55