Skip to content

Commit 46d3df3

Browse files
Merge pull request #4376 from magento-qwerty/MAGETWO-56441
[Qwerty] MAGETWO-56441: Eliminate @escapeNotVerified in Product and Catalog Rules Modules
2 parents bef5f53 + 2490c0c commit 46d3df3

File tree

8 files changed

+64
-66
lines changed

8 files changed

+64
-66
lines changed

app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**@var \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $block */
108
?>
119
<?php $_element = $block->getElement() ?>
1210
<?php $_jsObjectName = $block->getFieldSetId() != null ? $block->getFieldSetId() : $_element->getHtmlId() ?>
1311
<div class="rule-tree">
14-
<fieldset id="<?= /* @escapeNotVerified */ $_jsObjectName ?>" <?= /* @escapeNotVerified */ $_element->serialize(['class']) ?> class="fieldset">
15-
<legend class="legend"><span><?= /* @escapeNotVerified */ $_element->getLegend() ?></span></legend>
12+
<fieldset id="<?= $block->escapeHtmlAttr($_jsObjectName) ?>" <?= /* @noEscape */ $_element->serialize(['class']) ?> class="fieldset">
13+
<legend class="legend"><span><?= $block->escapeHtml($_element->getLegend()) ?></span></legend>
1614
<br>
17-
<?php if ($_element->getComment()): ?>
15+
<?php if ($_element->getComment()) : ?>
1816
<div class="messages">
1917
<div class="message message-notice"><?= $block->escapeHtml($_element->getComment()) ?></div>
2018
</div>
@@ -30,9 +28,9 @@ require([
3028
"prototype"
3129
], function(VarienRulesForm){
3230

33-
window.<?= /* @escapeNotVerified */ $_jsObjectName ?> = new VarienRulesForm('<?= /* @escapeNotVerified */ $_jsObjectName ?>', '<?= /* @escapeNotVerified */ $block->getNewChildUrl() ?>');
34-
<?php if ($_element->getReadonly()): ?>
35-
<?= $_element->getHtmlId() ?>.setReadonly(true);
31+
window.<?= /* @noEscape */ $_jsObjectName ?> = new VarienRulesForm('<?= /* @noEscape */ $_jsObjectName ?>', '<?= /* @noEscape */ $block->getNewChildUrl() ?>');
32+
<?php if ($_element->getReadonly()) : ?>
33+
<?= /* @noEscape */ $_element->getHtmlId() ?>.setReadonly(true);
3634
<?php endif; ?>
3735

3836
});

app/code/Magento/CatalogRule/view/adminhtml/templates/promo/form.phtml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<div class="entry-edit rule-tree">
118
<?= $block->getFormHtml() ?>

app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**
108
* Template for displaying product price at product view page, gift registry and wish-list
119
*
@@ -34,27 +32,29 @@ $msrpPrice = $block->renderAmount(
3432
$priceElementIdPrefix = $block->getPriceElementIdPrefix() ? $block->getPriceElementIdPrefix() : 'product-price-';
3533
?>
3634

37-
<?php if ($amount): ?>
38-
<span class="old-price map-old-price"><?= /* @escapeNotVerified */ $msrpPrice ?></span>
39-
<span class="map-fallback-price normal-price"><?= /* @escapeNotVerified */ $msrpPrice ?></span>
35+
<?php if ($amount) : ?>
36+
<span class="old-price map-old-price"><?= /* @noEscape */ $msrpPrice ?></span>
37+
<span class="map-fallback-price normal-price"><?= /* @noEscape */ $msrpPrice ?></span>
4038
<?php endif; ?>
4139

42-
<?php if ($priceType->isShowPriceOnGesture()): ?>
40+
<?php if ($priceType->isShowPriceOnGesture()) : ?>
4341
<?php
4442

4543
$addToCartUrl = '';
4644
if ($product->isSaleable()) {
4745
/** @var Magento\Catalog\Block\Product\AbstractProduct $addToCartUrlGenerator */
48-
$addToCartUrlGenerator = $block->getLayout()->getBlockSingleton('Magento\Catalog\Block\Product\AbstractProduct');
46+
$addToCartUrlGenerator = $block->getLayout()->getBlockSingleton(\Magento\Catalog\Block\Product\AbstractProduct::class);
47+
// phpcs:disable
4948
$addToCartUrl = $addToCartUrlGenerator->getAddToCartUrl(
5049
$product,
5150
['_query' => [
5251
\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED =>
53-
$this->helper('Magento\Framework\Url\Helper\Data')->getEncodedUrl(
52+
$this->helper(\Magento\Framework\Url\Helper\Data::class)->getEncodedUrl(
5453
$addToCartUrlGenerator->getAddToCartUrl($product)
5554
),
5655
]]
5756
);
57+
// phpcs:enable
5858
}
5959

6060
$priceElementId = $priceElementIdPrefix . $productId . $block->getIdSuffix();
@@ -79,30 +79,36 @@ $priceElementIdPrefix = $block->getPriceElementIdPrefix() ? $block->getPriceElem
7979
$data['addToCart']['addToCartButton'] = sprintf(
8080
'form:has(input[type="hidden"][name="product"][value="%s"]) button[type="submit"]',
8181
(int) $productId . ',' .
82-
sprintf('.block.widget .price-box[data-product-id=%s]+.product-item-actions button.tocart',
83-
(int) $productId));
82+
sprintf(
83+
'.block.widget .price-box[data-product-id=%s]+.product-item-actions button.tocart',
84+
(int)$productId
85+
)
86+
);
8487
}
8588
?>
86-
<span id="<?= /* @escapeNotVerified */ $block->getPriceId() ? $block->getPriceId() : $priceElementId ?>" style="display:none"></span>
89+
<span id="<?= $block->escapeHtmlAttr($block->getPriceId() ? $block->getPriceId() : $priceElementId) ?>" style="display:none"></span>
8790
<a href="javascript:void(0);"
88-
id="<?= /* @escapeNotVerified */ ($popupId) ?>"
91+
id="<?= /* @noEscape */ ($popupId) ?>"
8992
class="action map-show-info"
90-
data-mage-init='<?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($data) ?>'><?= /* @escapeNotVerified */ __('Click for price') ?>
93+
<?php //phpcs:disable ?>
94+
data-mage-init='<?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($data) ?>'>
95+
<?php //phpcs:enable ?>
96+
<?= $block->escapeHtml(__('Click for price')) ?>
9197
</a>
92-
<?php else: ?>
98+
<?php else : ?>
9399
<span class="msrp-message">
94-
<?= /* @escapeNotVerified */ $priceType->getMsrpPriceMessage() ?>
100+
<?= $block->escapeHtml($priceType->getMsrpPriceMessage()) ?>
95101
</span>
96102
<?php endif; ?>
97103

98-
<?php if ($block->getZone() == \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW): ?>
104+
<?php if ($block->getZone() == \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW) : ?>
99105
<?php $helpLinkId = 'msrp-help-' . $productId . $block->getRandomString(20); ?>
100106
<a href="javascript:void(0);"
101-
id="<?= /* @escapeNotVerified */ $helpLinkId ?>"
107+
id="<?= /* @noEscape */ $helpLinkId ?>"
102108
class="action map-show-info"
103109
data-mage-init='{"addToCart":{"origin": "info",
104-
"helpLinkId": "#<?= /* @escapeNotVerified */ $helpLinkId ?>",
110+
"helpLinkId": "#<?= /* @noEscape */ $helpLinkId ?>",
105111
"productName": "<?= $block->escapeJs($block->escapeHtml($product->getName())) ?>",
106-
"closeButtonId": "#map-popup-close"}}'><span><?= /* @escapeNotVerified */ __("What's this?") ?></span>
112+
"closeButtonId": "#map-popup-close"}}'><span><?= $block->escapeHtml(__("What's this?")) ?></span>
107113
</a>
108114
<?php endif; ?>

app/code/Magento/Msrp/view/frontend/templates/cart/subtotal.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
?>
77
<div class="subtotal">
88
<span class="mark msrp">
9-
<?= /* @escapeNotVerified */ __('Order total will be displayed before you submit the order') ?>
9+
<?= $block->escapeHtml(__('Order total will be displayed before you submit the order')) ?>
1010
</span>
1111
</div>

app/code/Magento/Msrp/view/frontend/templates/cart/totals.phtml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
86
?>
97
<div class="cart-totals">
10-
<div class="msrp totals"><?= /* @escapeNotVerified */ __('You will see the order total before you submit the order.') ?></div>
8+
<div class="msrp totals"><?= $block->escapeHtml(__('You will see the order total before you submit the order.')) ?></div>
119
</div>

app/code/Magento/Msrp/view/frontend/templates/popup.phtml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<?php
118
/** @var \Magento\Msrp\Block\Popup $block */
129
?>
13-
<?php if ($block->isEnabled()): ?>
10+
<?php if ($block->isEnabled()) : ?>
1411
<script data-role="msrp-popup-template" type="text/x-magento-template">
1512
<div id="map-popup-click-for-price" class="map-popup">
1613
<div class="popup-header">
@@ -20,13 +17,13 @@
2017
<div class="map-info-price" id="map-popup-content">
2118
<div class="price-box">
2219
<div class="map-msrp" id="map-popup-msrp-box">
23-
<span class="label"><?= /* @escapeNotVerified */ __('Price') ?></span>
20+
<span class="label"><?= $block->escapeHtml(__('Price')) ?></span>
2421
<span class="old-price map-old-price" id="map-popup-msrp">
2522
<span class="price"></span>
2623
</span>
2724
</div>
2825
<div class="map-price" id="map-popup-price-box">
29-
<span class="label"><?= /* @escapeNotVerified */ __('Actual Price') ?></span>
26+
<span class="label"><?= $block->escapeHtml(__('Actual Price')) ?></span>
3027
<span id="map-popup-price" class="actual-price"></span>
3128
</div>
3229
</div>
@@ -35,15 +32,15 @@
3532
<button type="button"
3633
title="<?= $block->escapeHtml(__('Add to Cart')) ?>"
3734
class="action tocart primary">
38-
<span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span>
35+
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
3936
</button>
4037
<div class="additional-addtocart-box">
4138
<?= $block->getChildHtml() ?>
4239
</div>
4340
</form>
4441
</div>
4542
<div class="map-text" id="map-popup-text">
46-
<?= /* @escapeNotVerified */ $block->getExplanationMessage() ?>
43+
<?= /* @noEscape */ $block->getExplanationMessage() ?>
4744
</div>
4845
</div>
4946
</div>
@@ -55,7 +52,7 @@
5552
</div>
5653
<div class="popup-content">
5754
<div class="map-help-text" id="map-popup-text-what-this">
58-
<?= /* @escapeNotVerified */ $block->getExplanationMessageWhatsThis() ?>
55+
<?= /* @noEscape */ $block->getExplanationMessageWhatsThis() ?>
5956
</div>
6057
</div>
6158
</div>

app/code/Magento/Msrp/view/frontend/templates/render/item/price_msrp_item.phtml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107

118
<?php
@@ -16,40 +13,44 @@
1613
*/
1714
?>
1815
<?php
16+
//phpcs:disable
1917
/** @var $pricingHelper \Magento\Framework\Pricing\Helper\Data */
20-
$pricingHelper = $this->helper('Magento\Framework\Pricing\Helper\Data');
18+
$pricingHelper = $this->helper(\Magento\Framework\Pricing\Helper\Data::class);
2119
/** @var $_catalogHelper \Magento\Catalog\Helper\Data */
22-
$_catalogHelper = $this->helper('Magento\Catalog\Helper\Data');
20+
$_catalogHelper = $this->helper(\Magento\Catalog\Helper\Data::class);
21+
//phpcs:enable
2322

2423
/** @var $_product \Magento\Catalog\Model\Product */
2524
$_product = $block->getProduct();
2625
$_id = $_product->getId();
2726
$_msrpPrice = '';
2827
?>
2928
<div class="price-box msrp">
30-
<?php if ($_product->getMsrp()): ?>
29+
<?php if ($_product->getMsrp()) : ?>
3130
<?php $_msrpPrice = $pricingHelper->currency($_product->getMsrp(), true, false) ?>
32-
<span class="old-price"><?= /* @escapeNotVerified */ $_msrpPrice ?></span>
31+
<span class="old-price"><?= /* @noEscape */ $_msrpPrice ?></span>
3332
<?php endif; ?>
34-
<?php if ($_catalogHelper->isShowPriceOnGesture($_product)): ?>
33+
<?php if ($_catalogHelper->isShowPriceOnGesture($_product)) : ?>
3534
<?php $priceElementId = 'product-price-' . $_id . $block->getIdSuffix(); ?>
36-
<span id="<?= /* @escapeNotVerified */ $priceElementId ?>" style="display: none"></span>
35+
<span id="<?= /* @noEscape */ $priceElementId ?>" style="display: none"></span>
3736
<?php $popupId = 'msrp-popup-' . $_id . $block->getRandomString(20); ?>
3837
<a href="javascript:void(0);"
39-
id="<?= /* @escapeNotVerified */ ($popupId) ?>"
40-
data-mage-init='{"addToCart":{"popupId": "#<?= /* @escapeNotVerified */ ($popupId) ?>",
38+
id="<?= /* @noEscape */ ($popupId) ?>"
39+
data-mage-init='{"addToCart":{"popupId": "#<?= /* @noEscape */ ($popupId) ?>",
4140
"productName": "<?= /* @noEscape */ $block->escapeJs($block->escapeHtml($_product->getName())) ?>",
42-
"realPrice": <?= /* @escapeNotVerified */ $block->getRealPriceJs($_product) ?>,
43-
"msrpPrice": "<?= /* @escapeNotVerified */ $_msrpPrice ?>",
44-
"priceElementId":"<?= /* @escapeNotVerified */ $priceElementId ?>",
41+
"realPrice": <?= /* @noEscape */ $block->getRealPriceJs($_product) ?>,
42+
"msrpPrice": "<?= /* @noEscape */ $_msrpPrice ?>",
43+
"priceElementId":"<?= /* @noEscape */ $priceElementId ?>",
4544
"popupCartButtonId": "#map-popup-button",
46-
"cartForm": "#wishlist-view-form"}}'><?= /* @escapeNotVerified */ __('Click for price') ?>
45+
"cartForm": "#wishlist-view-form"}}'><?= $block->escapeHtml(__('Click for price')) ?>
4746
</a>
48-
<?php else: ?>
47+
<?php else : ?>
4948
<span class="msrp-message">
50-
<?= /* @escapeNotVerified */ $_catalogHelper->getMsrpPriceMessage($_product) ?>
49+
<?= $block->escapeHtml($_catalogHelper->getMsrpPriceMessage($_product)) ?>
5150
</span>
5251
<?php endif; ?>
5352
<?php $helpLinkId = 'msrp-help-' . $_id . $block->getRandomString(20); ?>
54-
<a href="javascript:void(0);" id="<?= /* @escapeNotVerified */ ($helpLinkId) ?>" data-mage-init='{"addToCart":{"helpLinkId": "#<?= /* @escapeNotVerified */ ($helpLinkId) ?>", "productName": "<?= /* @noEscape */ $block->escapeJs($block->escapeHtml($_product->getName())) ?>"}}' class="link tip"><?= /* @escapeNotVerified */ __("What's this?") ?></a>
53+
<a href="javascript:void(0);" id="<?= /* @noEscape */ ($helpLinkId) ?>" data-mage-init='{"addToCart":{"helpLinkId": "#<?= /* @noEscape */ ($helpLinkId) ?>", "productName": "<?= /* @noEscape */$block->escapeJs($block->escapeHtml($_product->getName())) ?>"}}' class="link tip">
54+
<?= $block->escapeHtml(__("What's this?")) ?>
55+
</a>
5556
</div>

app/code/Magento/Msrp/view/frontend/templates/render/item/price_msrp_rss.phtml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<?php
118
/**
@@ -15,7 +12,11 @@
1512
*/
1613
?>
1714
<div class="price-box msrp">
18-
<?php if ($this->helper('Magento\Msrp\Helper\Data')->canApplyMsrp($block->getProduct())): ?>
19-
<a href="<?= /* @escapeNotVerified */ $block->getProduct()->getProductUrl() ?>"><?= /* @escapeNotVerified */ __('Click for price') ?></a>
15+
<?php //phpcs:disable ?>
16+
<?php if ($this->helper(\Magento\Msrp\Helper\Data::class)->canApplyMsrp($block->getProduct())) : ?>
17+
<?php //phpcs:enable ?>
18+
<a href="<?= $block->escapeUrl($block->getProduct()->getProductUrl()) ?>">
19+
<?= $block->escapeHtml(__('Click for price')) ?>
20+
</a>
2021
<?php endif; ?>
2122
</div>

0 commit comments

Comments
 (0)