|
4 | 4 | * See COPYING.txt for license details.
|
5 | 5 | */
|
6 | 6 |
|
7 |
| -// @codingStandardsIgnoreFile |
8 |
| - |
9 | 7 | /**
|
10 | 8 | * Product media data template
|
11 | 9 | *
|
|
15 | 13 | <div class="gallery-placeholder _block-content-loading" data-gallery-role="gallery-placeholder">
|
16 | 14 | <div data-role="loader" class="loading-mask">
|
17 | 15 | <div class="loader">
|
18 |
| - <img src="<?= /* @escapeNotVerified */ $block->getViewFileUrl('images/loader-1.gif') ?>" |
19 |
| - alt="<?= /* @escapeNotVerified */ __('Loading...') ?>"> |
| 16 | + <img src="<?= $block->escapeUrl($block->getViewFileUrl('images/loader-1.gif')) ?>" |
| 17 | + alt="<?= $block->escapeHtml(__('Loading...')) ?>"> |
20 | 18 | </div>
|
21 | 19 | </div>
|
22 | 20 | </div>
|
23 | 21 | <!--Fix for jumping content. Loader must be the same size as gallery.-->
|
24 | 22 | <script>
|
25 | 23 | var config = {
|
26 |
| - "width": <?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>, |
27 |
| - "thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height') |
28 |
| - ?: $block->getImageAttribute('product_page_image_small', 'width'); ?>, |
29 |
| - "navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>", |
30 |
| - "height": <?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'height') ?> |
| 24 | + "width": <?= $block->escapeHtml($block->getImageAttribute('product_page_image_medium', 'width')) ?>, |
| 25 | + "thumbheight": <?= $block->escapeHtml($block->getImageAttribute('product_page_image_small', 'height') |
| 26 | + ?: $block->getImageAttribute('product_page_image_small', 'width')); ?>, |
| 27 | + "navtype": "<?= $block->escapeHtml($block->getVar("gallery/navtype")) ?>", |
| 28 | + "height": <?= $block->escapeHtml($block->getImageAttribute('product_page_image_medium', 'height')) ?> |
31 | 29 | },
|
32 | 30 | thumbBarHeight = 0,
|
33 | 31 | loader = document.querySelectorAll('[data-gallery-role="gallery-placeholder"] [data-role="loader"]')[0];
|
|
43 | 41 | "[data-gallery-role=gallery-placeholder]": {
|
44 | 42 | "mage/gallery/gallery": {
|
45 | 43 | "mixins":["magnifier/magnify"],
|
46 |
| - "magnifierOpts": <?= /* @escapeNotVerified */ $block->getMagnifier() ?>, |
47 |
| - "data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>, |
| 44 | + "magnifierOpts": <?= /* @noEscape */ $block->getMagnifier() ?>, |
| 45 | + "data": <?= /* @noEscape */ $block->getGalleryImagesJson() ?>, |
48 | 46 | "options": {
|
49 |
| - "nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/nav") ?>", |
50 |
| - <?php if (($block->getVar("gallery/loop"))): ?> |
51 |
| - "loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ?>, |
| 47 | + "nav": "<?= $block->escapeHtml($block->getVar("gallery/nav")) ?>", |
| 48 | + <?php if (($block->getVar("gallery/loop"))) : ?> |
| 49 | + "loop": <?= $block->escapeHtml($block->getVar("gallery/loop")) ?>, |
52 | 50 | <?php endif; ?>
|
53 |
| - <?php if (($block->getVar("gallery/keyboard"))): ?> |
54 |
| - "keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ?>, |
| 51 | + <?php if (($block->getVar("gallery/keyboard"))) : ?> |
| 52 | + "keyboard": <?= $block->escapeHtml($block->getVar("gallery/keyboard")) ?>, |
55 | 53 | <?php endif; ?>
|
56 |
| - <?php if (($block->getVar("gallery/arrows"))): ?> |
57 |
| - "arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ?>, |
| 54 | + <?php if (($block->getVar("gallery/arrows"))) : ?> |
| 55 | + "arrows": <?= $block->escapeHtml($block->getVar("gallery/arrows")) ?>, |
58 | 56 | <?php endif; ?>
|
59 |
| - <?php if (($block->getVar("gallery/allowfullscreen"))): ?> |
60 |
| - "allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ?>, |
| 57 | + <?php if (($block->getVar("gallery/allowfullscreen"))) : ?> |
| 58 | + "allowfullscreen": <?= $block->escapeHtml($block->getVar("gallery/allowfullscreen")) ?>, |
61 | 59 | <?php endif; ?>
|
62 |
| - <?php if (($block->getVar("gallery/caption"))): ?> |
63 |
| - "showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ?>, |
| 60 | + <?php if (is_bool($block->getVar("gallery/caption"))) : ?> |
| 61 | + "showCaption": <?= /* @noEscape */ $block->getVar("gallery/caption") ? 'true' : 'false'; ?>, |
64 | 62 | <?php endif; ?>
|
65 |
| - "width": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>", |
66 |
| - "thumbwidth": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_small', 'width') ?>", |
67 |
| - <?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?> |
68 |
| - "thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height') |
69 |
| - ?: $block->getImageAttribute('product_page_image_small', 'width'); ?>, |
| 63 | + <?php |
| 64 | + $imgWidth = $block->getImageAttribute('product_page_image_medium', 'width'); |
| 65 | + $thumbWidth = $block->getImageAttribute('product_page_image_small', 'width'); |
| 66 | + ?> |
| 67 | + "width": "<?= $block->escapeHtml($imgWidth) ?>", |
| 68 | + "thumbwidth": "<?= $block->escapeHtml($thumbWidth) ?>", |
| 69 | + <?php |
| 70 | + $thumbHeight = $block->getImageAttribute('product_page_image_small', 'height') |
| 71 | + ?: $block->getImageAttribute('product_page_image_small', 'width'); |
| 72 | + ?> |
| 73 | + <?php if ($thumbHeight) : ?> |
| 74 | + "thumbheight": <?= $block->escapeHtml($thumbHeight); ?>, |
70 | 75 | <?php endif; ?>
|
71 |
| - <?php if (($block->getVar("gallery/thumbmargin"))): ?> |
72 |
| - "thumbmargin": <?= /* @noEscape */ (int)$block->getVar("gallery/thumbmargin"); ?>, |
| 76 | + <?php if (($block->getVar("gallery/thumbmargin"))) : ?> |
| 77 | + "thumbmargin": <?= (int)$block->getVar("gallery/thumbmargin"); ?>, |
73 | 78 | <?php endif; ?>
|
74 |
| - <?php if ($block->getImageAttribute('product_page_image_medium', 'height') || $block->getImageAttribute('product_page_image_medium', 'width')): ?> |
75 |
| - "height": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'height') |
76 |
| - ?: $block->getImageAttribute('product_page_image_medium', 'width'); ?>, |
| 79 | + <?php |
| 80 | + $imgHeight = $block->getImageAttribute('product_page_image_medium', 'height') |
| 81 | + ?: $block->getImageAttribute('product_page_image_medium', 'width') |
| 82 | + ?> |
| 83 | + <?php if ($imgHeight) : ?> |
| 84 | + "height": <?= $block->escapeHtml($imgHeight); ?>, |
77 | 85 | <?php endif; ?>
|
78 |
| - <?php if ($block->getVar("gallery/transition/duration")): ?> |
79 |
| - "transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/transition/duration") ?>, |
| 86 | + <?php if ($block->getVar("gallery/transition/duration")) : ?> |
| 87 | + "transitionduration": <?= $block->escapeHtml($block->getVar("gallery/transition/duration")) ?>, |
80 | 88 | <?php endif; ?>
|
81 |
| - "transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/transition/effect") ?>", |
82 |
| - <?php if (($block->getVar("gallery/navarrows"))): ?> |
83 |
| - "navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ?>, |
| 89 | + "transition": "<?= $block->escapeHtml($block->getVar("gallery/transition/effect")) ?>", |
| 90 | + <?php if (($block->getVar("gallery/navarrows"))) : ?> |
| 91 | + "navarrows": <?= $block->escapeHtml($block->getVar("gallery/navarrows")) ?>, |
84 | 92 | <?php endif; ?>
|
85 |
| - "navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>", |
86 |
| - "navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navdir") ?>" |
| 93 | + "navtype": "<?= $block->escapeHtml($block->getVar("gallery/navtype")) ?>", |
| 94 | + "navdir": "<?= $block->escapeHtml($block->getVar("gallery/navdir")) ?>" |
87 | 95 | },
|
88 | 96 | "fullscreen": {
|
89 |
| - "nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/nav") ?>", |
90 |
| - <?php if ($block->getVar("gallery/fullscreen/loop")): ?> |
91 |
| - "loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ?>, |
| 97 | + "nav": "<?= $block->escapeHtml($block->getVar("gallery/fullscreen/nav")) ?>", |
| 98 | + <?php if ($block->getVar("gallery/fullscreen/loop")) : ?> |
| 99 | + "loop": <?= $block->escapeHtml($block->getVar("gallery/fullscreen/loop")) ?>, |
92 | 100 | <?php endif; ?>
|
93 |
| - "navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navdir") ?>", |
94 |
| - <?php if ($block->getVar("gallery/transition/navarrows")): ?> |
95 |
| - "navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ?>, |
| 101 | + "navdir": "<?= $block->escapeHtml($block->getVar("gallery/fullscreen/navdir")) ?>", |
| 102 | + <?php if ($block->getVar("gallery/transition/navarrows")) : ?> |
| 103 | + "navarrows": <?= $block->escapeHtml($block->getVar("gallery/fullscreen/navarrows")) ?>, |
96 | 104 | <?php endif; ?>
|
97 |
| - "navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navtype") ?>", |
98 |
| - <?php if ($block->getVar("gallery/fullscreen/arrows")): ?> |
99 |
| - "arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ?>, |
| 105 | + "navtype": "<?= $block->escapeHtml($block->getVar("gallery/fullscreen/navtype")) ?>", |
| 106 | + <?php if ($block->getVar("gallery/fullscreen/arrows")) : ?> |
| 107 | + "arrows": <?= $block->escapeHtml($block->getVar("gallery/fullscreen/arrows")) ?>, |
100 | 108 | <?php endif; ?>
|
101 |
| - <?php if ($block->getVar("gallery/fullscreen/caption")): ?> |
102 |
| - "showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ?>, |
| 109 | + <?php if (is_bool($block->getVar("gallery/fullscreen/caption"))) : ?> |
| 110 | + <?php $showCaption = $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false'; ?> |
| 111 | + "showCaption": <?= /* @noEscape */ $showCaption ?>, |
103 | 112 | <?php endif; ?>
|
104 |
| - <?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?> |
105 |
| - "transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/duration") ?>, |
| 113 | + <?php if ($block->getVar("gallery/fullscreen/transition/duration")) : ?> |
| 114 | + "transitionduration": <?= |
| 115 | + $block->escapeHtml($block->getVar("gallery/fullscreen/transition/duration")) ?>, |
106 | 116 | <?php endif; ?>
|
107 |
| - "transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/effect") ?>" |
| 117 | + "transition": "<?= $block->escapeHtml($block->getVar("gallery/fullscreen/transition/effect")) ?>" |
108 | 118 | },
|
109 |
| - "breakpoints": <?= /* @escapeNotVerified */ $block->getBreakpoints() ?> |
| 119 | + "breakpoints": <?= /* @noEscape */ $block->getBreakpoints() ?> |
110 | 120 | }
|
111 | 121 | }
|
112 | 122 | }
|
|
0 commit comments