Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
View
DesignExceptions.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\View
;
7
8
use
Magento\Framework\App\ObjectManager
;
9
use
Magento\Framework\Serialize\Serializer\Json
;
10
14
class
DesignExceptions
15
{
21
protected
$scopeConfig
;
22
28
protected
$exceptionConfigPath
;
29
35
protected
$scopeType
;
36
40
private
$serializer;
41
50
public
function
__construct
(
51
\
Magento
\Framework\
App
\
Config
\
ScopeConfigInterface
$scopeConfig
,
52
$exceptionConfigPath
,
53
$scopeType
,
54
Json
$serializer =
null
55
) {
56
$this->scopeConfig =
$scopeConfig
;
57
$this->exceptionConfigPath =
$exceptionConfigPath
;
58
$this->scopeType =
$scopeType
;
59
$this->serializer = $serializer ?:
ObjectManager::getInstance
()->get(Json::class);
60
}
61
68
public
function
getThemeByRequest
(\
Magento
\Framework\
App
\Request\Http
$request
)
69
{
70
$userAgent =
$request
->getServer(
'HTTP_USER_AGENT'
);
71
if
(empty($userAgent)) {
72
return
false
;
73
}
74
$expressions
= $this->scopeConfig->getValue(
75
$this->exceptionConfigPath,
76
$this->scopeType
77
);
78
if
(!
$expressions
) {
79
return
false
;
80
}
81
$expressions
= $this->serializer->unserialize(
$expressions
);
82
foreach
(
$expressions
as
$rule
) {
83
if
(preg_match(
$rule
[
'regexp'
], $userAgent)) {
84
return
$rule
[
'value'
];
85
}
86
}
87
return
false
;
88
}
89
}
Magento\Framework\App
Magento\Framework\Serialize\Serializer\Json
Definition:
Json.php:16
Magento\Framework\App\ObjectManager\getInstance
static getInstance()
Definition:
ObjectManager.php:33
$expressions
$expressions
Definition:
side-menu.phtml:10
$rule
$rule
Definition:
rule_by_attribute.php:10
Magento\Framework\View\DesignExceptions\$scopeType
$scopeType
Definition:
DesignExceptions.php:35
Magento\Framework\View\DesignExceptions\$exceptionConfigPath
$exceptionConfigPath
Definition:
DesignExceptions.php:28
Magento\Framework\View\DesignExceptions\__construct
__construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, $exceptionConfigPath, $scopeType, Json $serializer=null)
Definition:
DesignExceptions.php:50
Magento\Framework\View\DesignExceptions
Definition:
DesignExceptions.php:14
Magento\Framework\View\DesignExceptions\$scopeConfig
$scopeConfig
Definition:
DesignExceptions.php:21
Magento\Framework\App\ObjectManager
Definition:
ConfigCache.php:8
Magento
$request
$request
Definition:
quote_with_configurable_product_last_variation.php:22
Magento\Framework\View\Config
Definition:
Config.php:14
Magento\Framework\App\Config\ScopeConfigInterface
Definition:
ScopeConfigInterface.php:15
Magento\Framework\View\DesignExceptions\getThemeByRequest
getThemeByRequest(\Magento\Framework\App\Request\Http $request)
Definition:
DesignExceptions.php:68
Magento\Framework\View