Skip to content

Commit a1bd4d9

Browse files
committed
MAGETWO-99488: Eliminate @escapeNotVerified in Tax-related Modules
1 parent 226ce2f commit a1bd4d9

File tree

47 files changed

+275
-454
lines changed

Some content is hidden

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

47 files changed

+275
-454
lines changed

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

Lines changed: 4 additions & 7 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
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */
@@ -16,18 +13,18 @@ $_item = $block->getItem();
1613
<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()): ?>
1714
<div class="price-excl-tax">
1815
<?php if ($block->displayBothPrices()): ?>
19-
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
16+
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
2017
<?php endif; ?>
21-
<?= /* @escapeNotVerified */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
18+
<?= /* @noEscape */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
2219
</div>
2320
<?php endif; ?>
2421
<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()): ?>
2522
<div class="price-incl-tax">
2623
<?php if ($block->displayBothPrices()): ?>
27-
<span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
24+
<span class="label"><?= $block->escapeHtml(('Incl. Tax')) ?>:</span>
2825
<?php endif; ?>
2926
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?>
3027
<?php $_baseIncl = $this->helper('Magento\Checkout\Helper\Data')->getBaseSubtotalInclTax($_item); ?>
31-
<?= /* @escapeNotVerified */ $block->displayPrices($_baseIncl, $_incl) ?>
28+
<?= /* @noEscape */ $block->displayPrices($_baseIncl, $_incl) ?>
3229
</div>
3330
<?php endif; ?>

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

Lines changed: 1 addition & 4 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\Tax\Block\Adminhtml\Items\Price\Renderer $block */
129

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

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

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

Lines changed: 4 additions & 7 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
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */
@@ -16,21 +13,21 @@ $_item = $block->getItem();
1613
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?>
1714
<div class="price-excl-tax">
1815
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices()): ?>
19-
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
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; ?>
2522
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceInclTax()): ?>
2623
<div class="price-incl-tax">
2724
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices()): ?>
28-
<span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
25+
<span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
2926
<?php endif; ?>
3027
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?>
3128
<?php $_baseIncl = $this->helper('Magento\Checkout\Helper\Data')->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: 4 additions & 7 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
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */
@@ -15,15 +12,15 @@ $_item = $block->getItem();
1512

1613
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?>
1714
<?php if ($block->displayBothPrices($block->getStore())): ?>
18-
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
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

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

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

Lines changed: 4 additions & 7 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
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */
@@ -16,16 +13,16 @@ $_item = $block->getItem();
1613
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?>
1714
<?php $_rowTotalWithoutDiscount = $_item->getRowTotal() - $_item->getTotalDiscountAmount(); ?>
1815
<?php if ($block->displayBothPrices()): ?>
19-
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
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

2522
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?>
2623
<?php if ($block->displayBothPrices($block->getStore())): ?>
27-
<br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
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: 4 additions & 7 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
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */
@@ -15,16 +12,16 @@ $_item = $block->getItem();
1512

1613
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?>
1714
<?php if ($block->displayBothPrices()): ?>
18-
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
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

2421
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?>
2522
<?php if ($block->displayBothPrices()): ?>
26-
<br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
23+
<br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
2724
<?php endif; ?>
2825
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?>
29-
<?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?>
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')->getRegionJson() ?>, 'disable');
1714
updater.disableRegionValidation();
1815

1916
(function ($) {

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

Lines changed: 7 additions & 8 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() ?>
129
<?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
1716
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[<?= $block->escapeHtml($_store->getId()) ?>]"
19+
value="<?= $block->escapeHtml($_labels[$_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>

app/code/Magento/Tax/view/adminhtml/templates/rule/edit.phtml

Lines changed: 15 additions & 17 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
/** @var $block \Magento\Tax\Block\Adminhtml\Rule\Edit\Form */
108
?>
119
<script>
@@ -78,7 +76,7 @@ require([
7876
$.ajax({
7977
type: "POST",
8078
data: {id:id},
81-
url: '<?= /* @escapeNotVerified */ $block->getTaxRateLoadUrl() ?>',
79+
url: '<?= $block->escapeUrl($block->getTaxRateLoadUrl()) ?>',
8280
success: function(result, status) {
8381
$('body').trigger('processStop');
8482
if (result.success) {
@@ -95,14 +93,14 @@ require([
9593
});
9694
else
9795
alert({
98-
content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>'
96+
content: '<?= $block->escapeJs(__('An error occurred')) ?>'
9997
});
10098
}
10199
},
102100
error: function () {
103101
$('body').trigger('processStop');
104102
alert({
105-
content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>'
103+
content: '<?= $block->escapeJs(__('An error occurred')) ?>'
106104
});
107105
},
108106
dataType: "json"
@@ -113,7 +111,7 @@ require([
113111
var options = {
114112
mselectContainer: '#tax_rate + section.mselect-list',
115113
toggleAddButton:false,
116-
addText: '<?= /* @escapeNotVerified */ __('Add New Tax Rate') ?>',
114+
addText: '<?= $block->escapeJs(__('Add New Tax Rate')) ?>',
117115
parse: null,
118116
nextPageUrl: '<?php echo $block->escapeHtml($block->getTaxRatesPageUrl())?>',
119117
selectedValues: this.settings.selected_values,
@@ -138,7 +136,7 @@ require([
138136
var taxRate = $('#tax_rate'),
139137
taxRateField = taxRate.parent(),
140138
taxRateForm = $('#tax-rate-form'),
141-
taxRateFormElement = $('#<?= /* @escapeNotVerified */ \Magento\Tax\Block\Adminhtml\Rate\Form::FORM_ELEMENT_ID ?>');
139+
taxRateFormElement = $('#<?= /* @noEscape */ \Magento\Tax\Block\Adminhtml\Rate\Form::FORM_ELEMENT_ID ?>');
142140

143141
if (!this.isEntityEditable) {
144142
// Override default layout of editable multiselect
@@ -162,7 +160,7 @@ require([
162160
taxRateField.find('.mselect-list')
163161
.on('click.mselect-edit', '.mselect-edit', this.edit)
164162
.on("click.mselect-delete", ".mselect-delete", function () {
165-
if (!confirm('<?= /* @escapeNotVerified */ __('Do you really want to delete this tax rate?') ?>')) {
163+
if (!confirm('<?= $block->escapeJs(__('Do you really want to delete this tax rate?')) ?>')) {
166164
return;
167165
}
168166

@@ -178,7 +176,7 @@ require([
178176
form_key: $('input[name="form_key"]').val()
179177
},
180178
dataType: 'json',
181-
url: '<?= /* @escapeNotVerified */ $block->getTaxRateDeleteUrl() ?>',
179+
url: '<?= $block->escapeUrl($block->getTaxRateDeleteUrl()) ?>',
182180
success: function(result, status) {
183181
$('body').trigger('processStop');
184182
if (result.success) {
@@ -196,14 +194,14 @@ require([
196194
});
197195
else
198196
alert({
199-
content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>'
197+
content: '<?= $block->escapeJs(__('An error occurred')) ?>'
200198
});
201199
}
202200
},
203201
error: function () {
204202
$('body').trigger('processStop');
205203
alert({
206-
content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>'
204+
content: '<?= $block->escapeJs(__('An error occurred')) ?>'
207205
});
208206
}
209207
};
@@ -224,15 +222,15 @@ require([
224222
taxRateFormElement.mage('form').mage('validation');
225223

226224
taxRateForm.dialogRates({
227-
title: '<?= /* @escapeNotVerified */ __('Tax Rate') ?>',
225+
title: '<?= $block->escapeJs(__('Tax Rate')) ?>',
228226
type: 'slide',
229-
id: '<?= /* @escapeNotVerified */ $block->getJsId() ?>',
227+
id: '<?= $block->escapeJs($block->getJsId()) ?>',
230228
modalClass: 'tax-rate-popup',
231229
closed: function () {
232230
taxRateFormElement.data('validation').clearError();
233231
},
234232
buttons: [{
235-
text: '<?= /* @escapeNotVerified */ __('Save') ?>',
233+
text: '<?= $block->escapeJs(__('Save')) ?>',
236234
'class': 'action-save action-primary',
237235
click: function() {
238236
this.updateItemRate();
@@ -252,7 +250,7 @@ require([
252250
type: 'POST',
253251
data: itemRateData,
254252
dataType: 'json',
255-
url: '<?= /* @escapeNotVerified */ $block->getTaxRateSaveUrl() ?>',
253+
url: '<?= $block->escapeUrl($block->getTaxRateSaveUrl()) ?>',
256254
success: function(result, status) {
257255
$('body').trigger('processStop');
258256
if (result.success) {
@@ -277,14 +275,14 @@ require([
277275
});
278276
else
279277
alert({
280-
content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>'
278+
content: '<?= $block->escapeJs(__('An error occurred')) ?>'
281279
});
282280
}
283281
},
284282
error: function () {
285283
$('body').trigger('processStop');
286284
alert({
287-
content: '<?= /* @escapeNotVerified */ __('An error occurred') ?>'
285+
content: '<?= $block->escapeJs(__('An error occurred')) ?>'
288286
});
289287
}
290288
};

0 commit comments

Comments
 (0)