-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathTemplate.php
executable file
·62 lines (54 loc) · 1.74 KB
/
Template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
// React-Luma extended Template for Block
namespace React\React;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\ObjectManagerInterface as ObjectManager;
use Magento\Framework\Registry;
use Magento\Framework\View\Element\Template as MTemplate;
use Magento\Framework\View\Element\Template\Context;
class Template extends MTemplate
{
public $om;
public $registry;
public $config;
public function __construct(
Context $context,
ObjectManager $om,
Registry $registry,
ScopeConfigInterface $config,
array $data = []
) {
$this->om = $om;
$this->registry = $registry;
$this->config = $config;
parent::__construct($context, $data);
}
// Function to encode an image as Base64
public function imageToBase64($imagePath)
{
if (file_exists($imagePath)) {
$imageData = file_get_contents($imagePath);
$base64 = base64_encode($imageData);
$mimeType = mime_content_type($imagePath); // Get MIME type
return "data:$mimeType;base64,$base64";
}
return "";
}
public function removeAdobeJSJunk()
{
return boolval($this->config->getValue('react_vue_config/junk/remove'));
}
public function removeAdobeCSSJunk()
{
if (!isset($_GET['css-react'])) {
return $removeCSSjunk = boolval($this->config->getValue('react_vue_config/junk/remove'));
}
if (isset($_GET['css-react']) && $_GET['css-react'] === "false") {
$removeCSSjunk = false;
}
if (isset($_GET['css-react']) && $_GET['css-react'] === "true") {
$removeCSSjunk = true;
}
return $removeCSSjunk;
}
}