Skip to content

Magento_Multishipping: avoid using deprecated escape* methods from Ab… #31697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
* See COPYING.txt for license details.
*/

/** @var \Magento\Multishipping\Block\Checkout\Address\Select $block */
/**
* @var \Magento\Multishipping\Block\Checkout\Address\Select $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<div class="multicheckout">
<div class="block block-billing">
Expand All @@ -14,33 +17,33 @@
<address>
<?= $block->getAddressAsHtml($address) ?>
<?php if ($block->isAddressDefaultBilling($address)) : ?>
<br /><strong><?= $block->escapeHtml(__('Default Billing')); ?></strong>
<br /><strong><?= $escaper->escapeHtml(__('Default Billing')); ?></strong>
<?php endif; ?>
<?php if ($block->isAddressDefaultShipping($address)) : ?>
<br /><strong><?= $block->escapeHtml(__('Default Shipping')); ?></strong>
<br /><strong><?= $escaper->escapeHtml(__('Default Shipping')); ?></strong>
<?php endif; ?>
</address>
</div>
<div class="box-actions">
<a href="<?= $block->escapeUrl($block->getEditAddressUrl($address)); ?>" class="action edit">
<span><?= $block->escapeHtml(__('Edit Address')); ?></span>
<a href="<?= $escaper->escapeUrl($block->getEditAddressUrl($address)); ?>" class="action edit">
<span><?= $escaper->escapeHtml(__('Edit Address')); ?></span>
</a>
<a href="<?= $block->escapeUrl($block->getSetAddressUrl($address)); ?>" class="action select">
<span><?= $block->escapeHtml(__('Select Address')); ?></span>
<a href="<?= $escaper->escapeUrl($block->getSetAddressUrl($address)); ?>" class="action select">
<span><?= $escaper->escapeHtml(__('Select Address')); ?></span>
</a>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="actions-toolbar">
<div class="primary">
<button type="button" class="action add primary" role="add-address" title="<?= $block->escapeHtml(__('Add New Address')); ?>">
<span><?= $block->escapeHtml(__('Add New Address')); ?></span>
<button type="button" class="action add primary" role="add-address" title="<?= $escaper->escapeHtml(__('Add New Address')); ?>">
<span><?= $escaper->escapeHtml(__('Add New Address')); ?></span>
</button>
</div>
<div class="secondary">
<a href="<?= $block->escapeUrl($block->getBackUrl()); ?>" class="action back">
<span><?= $block->escapeHtml(__('Back to Billing Information')); ?></span>
<a href="<?= $escaper->escapeUrl($block->getBackUrl()); ?>" class="action back">
<span><?= $escaper->escapeHtml(__('Back to Billing Information')); ?></span>
</a>
</div>
</div>
Expand All @@ -50,7 +53,7 @@
".action": {
"address": {
"addAddress": "button[role='add-address']",
"addAddressLocation": "<?= $block->escapeUrl($block->getAddNewUrl()); ?>"
"addAddressLocation": "<?= $escaper->escapeUrl($block->getAddNewUrl()); ?>"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,95 +6,95 @@

// phpcs:disable Generic.Files.LineLength
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
?>
<?php

/**
* Ship to multiple address template
*
* @var $block \Magento\Multishipping\Block\Checkout\Addresses
* @var \Magento\Multishipping\Block\Checkout\Addresses $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<form id="checkout_multishipping_form"
data-mage-init='{
"multiShipping": {"itemsQty": <?= /* @noEscape */ (int)$block->getCheckout()->getQuote()->getItemsSummaryQty() ?>},
"cartUpdate": {
"validationURL": "<?= $block->escapeUrl($block->getUrl('multishipping/checkout/checkItems')) ?>",
"validationURL": "<?= $escaper->escapeUrl($block->getUrl('multishipping/checkout/checkItems')) ?>",
"eventName": "updateMulticartItemQty"
}}'
action="<?= $block->escapeUrl($block->getPostActionUrl()) ?>"
action="<?= $escaper->escapeUrl($block->getPostActionUrl()) ?>"
method="post"
class="multicheckout address form">
<div class="title">
<strong><?= $block->escapeHtml(__('Please select a shipping address for applicable items.')) ?></strong>
<strong><?= $escaper->escapeHtml(__('Please select a shipping address for applicable items.')) ?></strong>
</div>
<input type="hidden" name="continue" value="0" id="can_continue_flag"/>
<input type="hidden" name="new_address" value="0" id="add_new_address_flag"/>
<div class="table-wrapper">
<table class="items data table" id="multiship-addresses-table">
<caption class="table-caption">
<?= $block->escapeHtml(__('Please select a shipping address for applicable items.')) ?>
<?= $escaper->escapeHtml(__('Please select a shipping address for applicable items.')) ?>
</caption>
<thead>
<tr>
<th class="col product" scope="col"><?= $block->escapeHtml(__('Product')) ?></th>
<th class="col qty" scope="col"><?= $block->escapeHtml(__('Qty')) ?></th>
<th class="col address" scope="col"><?= $block->escapeHtml(__('Send To')) ?></th>
<th class="col product" scope="col"><?= $escaper->escapeHtml(__('Product')) ?></th>
<th class="col qty" scope="col"><?= $escaper->escapeHtml(__('Qty')) ?></th>
<th class="col address" scope="col"><?= $escaper->escapeHtml(__('Send To')) ?></th>
<th class="col actions" scope="col">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php foreach ($block->getItems() as $_index => $_item): ?>
<?php if ($_item->getQuoteItem()): ?>
<tr>
<td class="col product" data-th="<?= $block->escapeHtml(__('Product')) ?>">
<td class="col product" data-th="<?= $escaper->escapeHtml(__('Product')) ?>">
<?= $block->getItemHtml($_item->getQuoteItem()) ?>
</td>
<td class="col qty" data-th="<?= $block->escapeHtml(__('Qty')) ?>">
<td class="col qty" data-th="<?= $escaper->escapeHtml(__('Qty')) ?>">
<div class="field qty">
<label for="ship-<?= $block->escapeHtml($_index) ?>-<?= $block->escapeHtml($_item->getQuoteItemId()) ?>-qty"
<label for="ship-<?= $escaper->escapeHtml($_index) ?>-<?= $escaper->escapeHtml($_item->getQuoteItemId()) ?>-qty"
class="label">
<span><?= $block->escapeHtml(__('Qty')) ?></span>
<span><?= $escaper->escapeHtml(__('Qty')) ?></span>
</label>
<div class="control">
<input type="number"
data-multiship-item-id="<?= $block->escapeHtml($_item->getSku()) ?>"
id="ship-<?= $block->escapeHtml($_index) ?>-<?= $block->escapeHtml($_item->getQuoteItemId()) ?>-qty"
name="ship[<?= $block->escapeHtml($_index) ?>][<?= $block->escapeHtml($_item->getQuoteItemId()) ?>][qty]"
value="<?= $block->escapeHtml($_item->getQty()) ?>"
data-multiship-item-id="<?= $escaper->escapeHtml($_item->getSku()) ?>"
id="ship-<?= $escaper->escapeHtml($_index) ?>-<?= $escaper->escapeHtml($_item->getQuoteItemId()) ?>-qty"
name="ship[<?= $escaper->escapeHtml($_index) ?>][<?= $escaper->escapeHtml($_item->getQuoteItemId()) ?>][qty]"
value="<?= $escaper->escapeHtml($_item->getQty()) ?>"
size="2"
min="0"
class="input-text qty"
data-validate="{number: true, required:true, 'validate-greater-than-zero':true}"/>
</div>
</div>
</td>
<td class="col address" data-th="<?= $block->escapeHtml(__('Send To')) ?>">
<td class="col address" data-th="<?= $escaper->escapeHtml(__('Send To')) ?>">
<?php if ($_item->getProduct()->getIsVirtual()): ?>
<div class="applicable">
<?= $block->escapeHtml(__('A shipping selection is not applicable.')) ?>
<?= $escaper->escapeHtml(__('A shipping selection is not applicable.')) ?>
</div>
<?php else: ?>
<div class="field address">
<label for="ship_<?= $block->escapeHtml($_index) ?>_<?= $block->escapeHtml($_item->getQuoteItemId()) ?>_address"
<label for="ship_<?= $escaper->escapeHtml($_index) ?>_<?= $escaper->escapeHtml($_item->getQuoteItemId()) ?>_address"
class="label">
<span><?= $block->escapeHtml(__('Send To')) ?></span>
<span><?= $escaper->escapeHtml(__('Send To')) ?></span>
</label>
<div class="control">
<?= $block->getAddressesHtmlSelect($_item, $_index) ?>
</div>
</div>
<?php endif; ?>
</td>
<td class="col actions" data-th="<?= $block->escapeHtml(__('Actions')) ?>">
<td class="col actions" data-th="<?= $escaper->escapeHtml(__('Actions')) ?>">
<a href="#"
title="<?= $block->escapeHtml(__('Remove Item')) ?>"
title="<?= $escaper->escapeHtml(__('Remove Item')) ?>"
data-post='<?= /* @noEscape */
$this->helper(\Magento\Framework\Data\Helper\PostHelper::class)
->getPostData($block->getItemDeleteUrl($_item))
?>'
class="action delete"
data-multiship-item-remove="">
<span><?= $block->escapeHtml(__('Remove item')) ?></span>
<span><?= $escaper->escapeHtml(__('Remove item')) ?></span>
</a>
</td>
</tr>
Expand All @@ -106,14 +106,14 @@
<div class="actions-toolbar">
<div class="primary">
<button type="submit"
title="<?= $block->escapeHtml(__('Go to Shipping Information')) ?>"
title="<?= $escaper->escapeHtml(__('Go to Shipping Information')) ?>"
class="action primary continue<?= $block->isContinueDisabled() ? ' disabled' : '' ?>"
data-role="can-continue"
data-flag="1"
<?php if ($block->isContinueDisabled()): ?>
disabled="disabled"
<?php endif; ?>>
<span><?= $block->escapeHtml(__('Go to Shipping Information')) ?></span>
<span><?= $escaper->escapeHtml(__('Go to Shipping Information')) ?></span>
</button>
</div>
<div class="secondary">
Expand All @@ -122,17 +122,17 @@
class="action update"
data-role="can-continue"
data-flag="0">
<span><?= $block->escapeHtml(__('Update Qty &amp; Addresses')) ?></span>
<span><?= $escaper->escapeHtml(__('Update Qty &amp; Addresses')) ?></span>
</button>
<button type="button"
title="<?= $block->escapeHtml(__('Enter a New Address')) ?>"
title="<?= $escaper->escapeHtml(__('Enter a New Address')) ?>"
class="action add"
data-role="add-new-address">
<span><?= $block->escapeHtml(__('Enter a New Address')) ?></span>
<span><?= $escaper->escapeHtml(__('Enter a New Address')) ?></span>
</button>
<a href="<?= $block->escapeUrl($block->getBackUrl()) ?>"
<a href="<?= $escaper->escapeUrl($block->getBackUrl()) ?>"
class="action back">
<span><?= $block->escapeHtml(__('Back to Shopping Cart')) ?></span>
<span><?= $escaper->escapeHtml(__('Back to Shopping Cart')) ?></span>
</a>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/**
* Multishipping checkout billing information
*
* @var $block \Magento\Multishipping\Block\Checkout\Billing
* @var $escaper \Magento\Framework\Escaper
* @var \Magento\Multishipping\Block\Checkout\Billing $block
* @var \Magento\Framework\Escaper $escaper
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/
?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,32 @@
* See COPYING.txt for license details.
*/

/**
* @var \Magento\Framework\Escaper $escaper
*/
?>
<?php if ($block->getQuote()->hasVirtualItems()) : ?>
<div class="block block-other">
<div class="block-title">
<strong><?= $block->escapeHtml(__('Other items in your order')) ?></strong>
<a href="<?= $block->escapeUrl($block->getVirtualProductEditUrl()) ?>" class="action edit"><span><?= $block->escapeHtml(__('Edit Items')) ?></span></a>
<strong><?= $escaper->escapeHtml(__('Other items in your order')) ?></strong>
<a href="<?= $escaper->escapeUrl($block->getVirtualProductEditUrl()) ?>" class="action edit"><span><?= $escaper->escapeHtml(__('Edit Items')) ?></span></a>
</div>
<div class="block-content">
<p><?= $block->escapeHtml(__('Shipping is not applicable.')) ?></p>
<p><?= $escaper->escapeHtml(__('Shipping is not applicable.')) ?></p>
<div class="table-wrapper">
<table class="items data table" id="unavailable-shipping-table">
<caption class="table-caption"><?= $block->escapeHtml(__('Other items in your order')) ?></caption>
<caption class="table-caption"><?= $escaper->escapeHtml(__('Other items in your order')) ?></caption>
<thead>
<tr>
<th class="col item" scope="col"><?= $block->escapeHtml(__('Product Name')) ?></th>
<th class="col qty" scope="col"><?= $block->escapeHtml(__('Qty')) ?></th>
<th class="col item" scope="col"><?= $escaper->escapeHtml(__('Product Name')) ?></th>
<th class="col qty" scope="col"><?= $escaper->escapeHtml(__('Qty')) ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($block->getVirtualQuoteItems() as $_item) : ?>
<tr>
<td class="col item" data-th="<?= $block->escapeHtml(__('Product Name')) ?>"><?= $block->getItemHtml($_item) ?></td>
<td class="col qty" data-th="<?= $block->escapeHtml(__('Qty')) ?>"><?= $block->escapeHtml($_item->getQty()) ?></td>
<td class="col item" data-th="<?= $escaper->escapeHtml(__('Product Name')) ?>"><?= $block->getItemHtml($_item) ?></td>
<td class="col qty" data-th="<?= $escaper->escapeHtml(__('Qty')) ?>"><?= $escaper->escapeHtml($_item->getQty()) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/

// phpcs:disable Magento2.Files.LineLength
?>
<?php
/** @var \Magento\Checkout\Block\Cart\Item\Renderer\ $block */
/** @var \Magento\Framework\Escaper $escaper */
?>

/**
* @var \Magento\Checkout\Block\Cart\Item\Renderer $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<strong class="product name product-item-name"><a href="<?= $escaper->escapeUrl($block->getProductUrl()) ?>"><?= $escaper->escapeHtml($block->getProductName()) ?></a></strong>
<?php if ($_options = $block->getOptionList()) : ?>
<dl class="item-options">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
* See COPYING.txt for license details.
*/

/**
* @var \Magento\Framework\Escaper $escaper
*/
?>
<a class="action multicheckout" href="<?= $block->escapeUrl($block->getCheckoutUrl()) ?>"><span><?= $block->escapeHtml(__('Check Out with Multiple Addresses')) ?></span></a>
<a class="action multicheckout" href="<?= $escaper->escapeUrl($block->getCheckoutUrl()) ?>"><span><?= $escaper->escapeHtml(__('Check Out with Multiple Addresses')) ?></span></a>
Loading