1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2015 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
use Magento \Customer \ViewModel \Customer \Data ;
7
- use Magento \Framework \App \ObjectManager ;
8
7
use Magento \Customer \ViewModel \CookieSettings ;
9
8
10
- /** @var \Magento\Customer\Block\CustomerData $block */
9
+ /**
10
+ * @var \Magento\Customer\Block\CustomerData $block
11
+ * @var \Magento\Framework\Escaper $escaper
12
+ */
11
13
12
14
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
13
15
/** @var Auth $auth */
14
- $ auth = $ block ->getAuth () ?? ObjectManager:: getInstance ()-> get (Auth::class) ;
16
+ $ auth = $ block ->getAuth ();
15
17
/** @var JsonSerializer $jsonSerializer */
16
- $ jsonSerializer = $ block ->getJsonSerializer () ??
17
- ObjectManager::getInstance ()->get (JsonSerializer::class);
18
+ $ jsonSerializer = $ block ->getJsonSerializer ();
18
19
$ customerDataUrl = $ block ->getCustomerDataUrl ('customer/account/updateSession ' );
19
20
$ expirableSectionNames = $ block ->getExpirableSectionNames ();
20
21
/** @var CookieSettings $cookieSettings */
@@ -24,14 +25,14 @@ $cookieSettings = $block->getCookieSettings();
24
25
{
25
26
"*": {
26
27
"Magento_Customer/js/customer-data": {
27
- "sectionLoadUrl": "<?= $ block ->escapeJs ($ block ->getCustomerDataUrl ('customer/section/load ' )) ?> ",
28
+ "sectionLoadUrl": "<?= $ escaper ->escapeJs ($ block ->getCustomerDataUrl ('customer/section/load ' )) ?> ",
28
29
"expirableSectionLifetime": <?= (int )$ block ->getExpirableSectionLifetime () ?> ,
29
30
"expirableSectionNames": <?= /* @noEscape */ $ jsonSerializer ->serialize (
30
31
$ expirableSectionNames
31
32
) ?> ,
32
- "cookieLifeTime": "<?= $ block ->escapeJs ($ block ->getCookieLifeTime ()) ?> ",
33
- "cookieDomain": "<?= $ block ->escapeJs ($ cookieSettings ->getCookieDomain ()) ?> ",
34
- "updateSessionUrl": "<?= $ block ->escapeJs ($ customerDataUrl ) ?> ",
33
+ "cookieLifeTime": "<?= $ escaper ->escapeJs ($ block ->getCookieLifeTime ()) ?> ",
34
+ "cookieDomain": "<?= $ escaper ->escapeJs ($ cookieSettings ->getCookieDomain ()) ?> ",
35
+ "updateSessionUrl": "<?= $ escaper ->escapeJs ($ customerDataUrl ) ?> ",
35
36
"isLoggedIn": "<?= /* @noEscape */ $ auth ->isLoggedIn () ?> "
36
37
}
37
38
}
0 commit comments