|
35 | 35 | ?> |
36 | 36 | <?php |
37 | 37 | $mfpValue = $block->getMFPValue(); |
38 | | - $size = str_replace("--",'',$block->getSize()); |
39 | | - list($width, $height) = explode('x',$size); |
| 38 | + $size = str_replace("--", '', $block->getSize()); |
| 39 | + list($width, $height) = explode('x', $size); |
40 | 40 | $affirmAssetsUrl = $block->getAffirmAssetsUrl(); |
41 | 41 | $options = $block->getOptions(); |
42 | 42 | $pageType = $block->getPageType(); |
43 | 43 | ?> |
44 | 44 | <?= /* @noEscape */ $block->getStartContainerTag() ?> |
45 | | -<?php |
46 | | - /** @noEscape - Server-generated JSON for data-mage-init */ $optionsSafe = $options; |
47 | | - $escapedMfpValue = $block->escapeHtmlAttr($mfpValue); |
48 | | - $escapedPageType = $block->escapeHtmlAttr($pageType); |
49 | | - $escapedWidth = $block->escapeHtmlAttr($width); |
50 | | - $escapedHeight = $block->escapeHtmlAttr($height); |
51 | | - $escapedImageUrl = $block->escapeUrl($affirmAssetsUrl . $size . '.png'); |
52 | | - // phpcs:ignore Magento2.Security.XssTemplate.FoundUnescaped -- All variables are pre-escaped above |
53 | | - echo '<div class="affirm-banner-container"> |
54 | | - <a class="affirm-site-modal" data-mage-init=\'{"Astound_Affirm/js/affirmWidget": ' . /* @noEscape */ $optionsSafe . '}\'' |
55 | | - . (!empty($mfpValue) ? ' data-promo-id="' . /* @noEscape */ $escapedMfpValue . '"' : '') |
56 | | - . (!empty($pageType) ? ' data-page-type="' . /* @noEscape */ $escapedPageType . '"' : '') . '> |
57 | | - <img style="max-width:' . /* @noEscape */ $escapedWidth . 'px; max-height:' . /* @noEscape */ $escapedHeight . 'px; " src="' . /* @noEscape */ $escapedImageUrl . '"> |
58 | | - </a> |
59 | | - </div>'; |
60 | | -?> |
| 45 | +<div class="affirm-banner-container"> |
| 46 | + <a class="affirm-site-modal" |
| 47 | + data-mage-init='{"Astound_Affirm/js/affirmWidget": <?= /* @noEscape */ $options ?>}' |
| 48 | + <?php if (!empty($mfpValue)): ?> |
| 49 | + data-promo-id="<?= $escaper->escapeHtmlAttr($mfpValue) ?>" |
| 50 | + <?php endif; ?> |
| 51 | + <?php if (!empty($pageType)): ?> |
| 52 | + data-page-type="<?= $escaper->escapeHtmlAttr($pageType) ?>" |
| 53 | + <?php endif; ?>> |
| 54 | + <img style="max-width:<?= $escaper->escapeHtmlAttr($width) ?>px; max-height:<?= $escaper->escapeHtmlAttr($height) ?>px;" |
| 55 | + src="<?= $escaper->escapeUrl($affirmAssetsUrl . $size . '.png') ?>"> |
| 56 | + </a> |
| 57 | +</div> |
61 | 58 | <?= /* @noEscape */ $block->getEndContainerTag() ?> |
0 commit comments