Skip to content

Commit fedca22

Browse files
authored
Merge pull request #4338 from magento-obsessive-owls/MC-16764
[Owls] MC-16764 [Backport for 2.2.x] Eliminate @escapeNotVerified in Tax-related Modules
2 parents 045e15c + 8198410 commit fedca22

File tree

48 files changed

+628
-722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+628
-722
lines changed

app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,27 @@
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\Tax\Block\Adminhtml\Items\Price\Renderer $block */
129

1310
$_item = $block->getItem();
1411
?>
15-
16-
<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()): ?>
12+
<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()) : ?>
1713
<div class="price-excl-tax">
18-
<?php if ($block->displayBothPrices()): ?>
19-
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
14+
<?php if ($block->displayBothPrices()) : ?>
15+
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
2016
<?php endif; ?>
21-
<?= /* @escapeNotVerified */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
17+
<?= /* @noEscape */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
2218
</div>
2319
<?php endif; ?>
24-
<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()): ?>
20+
<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()) : ?>
2521
<div class="price-incl-tax">
26-
<?php if ($block->displayBothPrices()): ?>
27-
<span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
22+
<?php if ($block->displayBothPrices()) : ?>
23+
<span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
2824
<?php endif; ?>
29-
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?>
30-
<?php $_baseIncl = $this->helper('Magento\Checkout\Helper\Data')->getBaseSubtotalInclTax($_item); ?>
31-
<?= /* @escapeNotVerified */ $block->displayPrices($_baseIncl, $_incl) ?>
25+
<?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getSubtotalInclTax($_item); ?>
26+
<?php $_baseIncl = $this->helper(\Magento\Checkout\Helper\Data::class)->getBaseSubtotalInclTax($_item); ?>
27+
<?= /* @noEscape */ $block->displayPrices($_baseIncl, $_incl) ?>
3228
</div>
3329
<?php endif; ?>

app/code/Magento/Tax/view/adminhtml/templates/items/price/total.phtml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
6+
// phpcs:disable PSR2.Files.ClosingTag
97
?>
108
<?php
119
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */
1210

1311
$_item = $block->getItem();
1412
?>
1513

16-
<?= /* @escapeNotVerified */ $block->displayPrices($block->getBaseTotalAmount($_item), $block->getTotalAmount($_item)) ?>
14+
<?= /* @noEscape */ $block->displayPrices($block->getBaseTotalAmount($_item), $block->getTotalAmount($_item)) ?>

app/code/Magento/Tax/view/adminhtml/templates/items/price/unit.phtml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,31 @@
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\Tax\Block\Adminhtml\Items\Price\Renderer $block */
129

1310
$_item = $block->getItem();
1411
?>
1512

16-
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?>
13+
<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices() || $this->helper(\Magento\Tax\Helper\Data::class)->displaySalesPriceExclTax()) : ?>
1714
<div class="price-excl-tax">
18-
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices()): ?>
19-
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
15+
<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices()) : ?>
16+
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
2017
<?php endif; ?>
2118

22-
<?= /* @escapeNotVerified */ $block->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
19+
<?= /* @noEscape */ $block->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
2320
</div>
2421
<?php endif; ?>
25-
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceInclTax()): ?>
22+
<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices() || $this->helper(\Magento\Tax\Helper\Data::class)->displaySalesPriceInclTax()) : ?>
2623
<div class="price-incl-tax">
27-
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices()): ?>
28-
<span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
24+
<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices()) : ?>
25+
<span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
2926
<?php endif; ?>
30-
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?>
31-
<?php $_baseIncl = $this->helper('Magento\Checkout\Helper\Data')->getBasePriceInclTax($_item); ?>
27+
<?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getPriceInclTax($_item); ?>
28+
<?php $_baseIncl = $this->helper(\Magento\Checkout\Helper\Data::class)->getBasePriceInclTax($_item); ?>
3229

33-
<?= /* @escapeNotVerified */ $block->displayPrices($_baseIncl, $_incl) ?>
30+
<?= /* @noEscape */ $block->displayPrices($_baseIncl, $_incl) ?>
3431

3532
</div>
3633
<?php endif; ?>

app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/row.phtml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,24 @@
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\Tax\Block\Adminhtml\Items\Price\Renderer $block */
129

1310
$_item = $block->getItem();
1411
?>
1512

16-
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?>
17-
<?php if ($block->displayBothPrices($block->getStore())): ?>
18-
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
13+
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?>
14+
<?php if ($block->displayBothPrices($block->getStore())) : ?>
15+
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
1916
<?php endif; ?>
20-
<?= /* @escapeNotVerified */ $block->formatPrice($_item->getRowTotal()) ?>
17+
<?= /* @noEscape */ $block->formatPrice($_item->getRowTotal()) ?>
2118
<?php endif; ?>
2219

23-
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?>
24-
<?php if ($block->displayBothPrices()): ?>
25-
<br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
20+
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?>
21+
<?php if ($block->displayBothPrices()) : ?>
22+
<br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
2623
<?php endif; ?>
27-
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?>
28-
<?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?>
24+
<?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getSubtotalInclTax($_item); ?>
25+
<?= /* @noEscape */ $block->formatPrice($_incl) ?>
2926
<?php endif; ?>

app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/total.phtml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,26 @@
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\Tax\Block\Adminhtml\Items\Price\Renderer $block */
129

1310
$_item = $block->getItem();
1411
?>
1512

16-
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?>
13+
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?>
1714
<?php $_rowTotalWithoutDiscount = $_item->getRowTotal() - $_item->getTotalDiscountAmount(); ?>
18-
<?php if ($block->displayBothPrices()): ?>
19-
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
15+
<?php if ($block->displayBothPrices()) : ?>
16+
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
2017
<?php endif; ?>
21-
<?= /* @escapeNotVerified */ $block->formatPrice(max(0, $_rowTotalWithoutDiscount)) ?>
18+
<?= /* @noEscape */ $block->formatPrice(max(0, $_rowTotalWithoutDiscount)) ?>
2219
<?php endif; ?>
2320

2421

25-
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?>
26-
<?php if ($block->displayBothPrices($block->getStore())): ?>
27-
<br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
22+
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?>
23+
<?php if ($block->displayBothPrices($block->getStore())) : ?>
24+
<br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
2825
<?php endif; ?>
2926
<?php $_incl = $block->getTotalAmount($_item); ?>
30-
<?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?>
27+
<?= /* @noEscape */ $block->formatPrice($_incl) ?>
3128
<?php endif; ?>

app/code/Magento/Tax/view/adminhtml/templates/order/create/items/price/unit.phtml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,25 @@
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\Tax\Block\Adminhtml\Items\Price\Renderer $block */
129

1310
$_item = $block->getItem();
1411
?>
1512

16-
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?>
17-
<?php if ($block->displayBothPrices()): ?>
18-
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
13+
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?>
14+
<?php if ($block->displayBothPrices()) : ?>
15+
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
1916
<?php endif; ?>
20-
<?= /* @escapeNotVerified */ $block->formatPrice($_item->getCalculationPrice()) ?>
17+
<?= /* @noEscape */ $block->formatPrice($_item->getCalculationPrice()) ?>
2118
<?php endif; ?>
2219

2320

24-
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?>
25-
<?php if ($block->displayBothPrices()): ?>
26-
<br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
21+
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?>
22+
<?php if ($block->displayBothPrices()) : ?>
23+
<br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
2724
<?php endif; ?>
28-
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?>
29-
<?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?>
25+
<?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getPriceInclTax($_item); ?>
26+
<?= /* @noEscape */ $block->formatPrice($_incl) ?>
3027
<?php endif; ?>

app/code/Magento/Tax/view/adminhtml/templates/rate/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 form-inline">
118
<?= $block->getFormHtml() ?>

app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<script>
118
require([
129
"jquery",
1310
"mage/adminhtml/form"
1411
], function(jQuery){
1512

16-
var updater = new RegionUpdater('tax_country_id', 'tax_region', 'tax_region_id', <?= /* @escapeNotVerified */ $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>, 'disable');
13+
var updater = new RegionUpdater('tax_country_id', 'tax_region', 'tax_region_id', <?= /* @noEscape */ $this->helper(\Magento\Directory\Helper\Data::class)->getRegionJson() ?>, 'disable');
1714
updater.disableRegionValidation();
1815

1916
(function ($) {

app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,29 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<fieldset id="tax-rate-titles-table" class="admin__fieldset">
118
<?php $_labels = $block->getTitles() ?>
12-
<?php foreach ($block->getStores() as $_store): ?>
9+
<?php foreach ($block->getStores() as $_store) : ?>
1310
<div class="admin__field">
14-
<label class="admin__field-label"><span><?= /* @escapeNotVerified */ $_store->getName() ?></span></label>
11+
<label class="admin__field-label">
12+
<span><?= $block->escapeHtml($_store->getName()) ?></span>
13+
</label>
1514
<div class="admin__field-control">
1615
<input
17-
class="admin__control-text<?php if ($_store->getId() == 0): ?> required-entry<?php endif; ?>"
16+
class="admin__control-text<?php if ($_store->getId() == 0) : ?> required-entry<?php endif; ?>"
1817
type="text"
19-
name="title[<?= /* @escapeNotVerified */ $_store->getId() ?>]"
20-
value="<?= /* @escapeNotVerified */ $_labels[$_store->getId()] ?>" />
18+
name="title[<?= (int) $_store->getId() ?>]"
19+
value="<?= $block->escapeHtmlAttr($_labels[(int) $_store->getId()]) ?>" />
2120
</div>
2221
</div>
2322
<?php endforeach; ?>
2423

2524
<div class="messages">
2625
<div class="message message-notice">
2726
<div>
28-
<strong><?= /* @escapeNotVerified */ __('Note:') ?></strong>
29-
<?= /* @escapeNotVerified */ __('Leave this field empty if you wish to use the tax identifier.') ?>
27+
<strong><?= $block->escapeHtml(__('Note:')) ?></strong>
28+
<?= $block->escapeHtml(__('Leave this field empty if you wish to use the tax identifier.')) ?>
3029
</div>
3130
</div>
3231
</div>

0 commit comments

Comments
 (0)