From 61df98ff433868b635ce33a9a847bef925369ef4 Mon Sep 17 00:00:00 2001 From: Kiel Pykett Date: Thu, 9 Mar 2023 01:24:39 +0000 Subject: [PATCH] Chore: Wishlist - Replace Block Escaping with Escaper --- .../customer/edit/tab/wishlist.phtml | 28 ++++++---- .../price/bundle/configured_price.phtml | 22 ++++---- .../price/configurable/configured_price.phtml | 26 +++++---- .../frontend/templates/button/share.phtml | 14 +++-- .../frontend/templates/button/tocart.phtml | 14 +++-- .../frontend/templates/button/update.phtml | 15 ++++-- .../renderer/actions/move_to_wishlist.phtml | 9 +++- .../catalog/product/list/addto/wishlist.phtml | 7 ++- .../catalog/product/view/addto/wishlist.phtml | 9 +++- .../view/frontend/templates/email/items.phtml | 19 ++++--- .../templates/item/column/actions.phtml | 9 +++- .../frontend/templates/item/column/cart.phtml | 31 ++++++----- .../templates/item/column/comment.phtml | 17 +++--- .../frontend/templates/item/column/edit.phtml | 14 +++-- .../templates/item/column/image.phtml | 11 ++-- .../frontend/templates/item/column/name.phtml | 13 +++-- .../templates/item/column/remove.phtml | 16 ++++-- .../templates/item/configure/addto.phtml | 14 +++-- .../item/configure/addto/wishlist.phtml | 9 +++- .../view/frontend/templates/item/list.phtml | 15 +++--- .../view/frontend/templates/link.phtml | 9 +++- .../messages/addProductSuccessMessage.phtml | 9 +++- .../removeWishlistItemSuccessMessage.phtml | 9 +++- .../frontend/templates/options_list.phtml | 16 +++--- .../view/frontend/templates/rss/email.phtml | 16 ++++-- .../frontend/templates/rss/wishlist.phtml | 11 ++-- .../view/frontend/templates/shared.phtml | 53 ++++++++++--------- .../view/frontend/templates/sharing.phtml | 27 ++++++---- .../view/frontend/templates/sidebar.phtml | 29 +++++----- .../view/frontend/templates/view.phtml | 21 +++++--- 30 files changed, 335 insertions(+), 177 deletions(-) diff --git a/app/code/Magento/Wishlist/view/adminhtml/templates/customer/edit/tab/wishlist.phtml b/app/code/Magento/Wishlist/view/adminhtml/templates/customer/edit/tab/wishlist.phtml index 7ee04bf192f29..82b5299639ef9 100644 --- a/app/code/Magento/Wishlist/view/adminhtml/templates/customer/edit/tab/wishlist.phtml +++ b/app/code/Magento/Wishlist/view/adminhtml/templates/customer/edit/tab/wishlist.phtml @@ -3,11 +3,17 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); -/** @var \Magento\Framework\View\Element\Template $block */ -/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ -?> -escapeJs($block->getJsObjectName())}.url + '?ajax=true' + urlParams; + var url = {$escaper->escapeJs($block->getJsObjectName())}.url + '?ajax=true' + urlParams; new Ajax.Updater( - {$block->escapeJs($block->getJsObjectName())}.containerId, + {$escaper->escapeJs($block->getJsObjectName())}.containerId, url, { parameters: {form_key: FORM_KEY}, - onComplete: {$block->escapeJs($block->getJsObjectName())}.initGrid - .bind({$block->escapeJs($block->getJsObjectName())}), + onComplete: {$escaper->escapeJs($block->getJsObjectName())}.initGrid + .bind({$escaper->escapeJs($block->getJsObjectName())}), evalScripts:true } ); @@ -51,7 +57,7 @@ var self = this; confirm({ - content: '{$block->escapeJs(__('Are you sure you want to remove this item?'))}', + content: '{$escaper->escapeJs(__('Are you sure you want to remove this item?'))}', actions: { confirm: function () { self.reload('&delete=' + itemId); @@ -64,8 +70,8 @@ productConfigure.addListType( 'wishlist', { - urlFetch: '{$block->escapeJs($block->getUrl('customer/wishlist_product_composite_wishlist/configure'))}', - urlConfirm: '{$block->escapeJs($block->getUrl('customer/wishlist_product_composite_wishlist/update'))}' + urlFetch: '{$escaper->escapeJs($block->getUrl('customer/wishlist_product_composite_wishlist/configure'))}', + urlConfirm: '{$escaper->escapeJs($block->getUrl('customer/wishlist_product_composite_wishlist/update'))}' } ); //--> diff --git a/app/code/Magento/Wishlist/view/base/templates/product/price/bundle/configured_price.phtml b/app/code/Magento/Wishlist/view/base/templates/product/price/bundle/configured_price.phtml index 260dd5a24396a..b611386943d5b 100644 --- a/app/code/Magento/Wishlist/view/base/templates/product/price/bundle/configured_price.phtml +++ b/app/code/Magento/Wishlist/view/base/templates/product/price/bundle/configured_price.phtml @@ -3,9 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -?> -getZone() == 'item_view'); $idSuffix = $block->getIdSuffix() ?: ''; ?> @@ -15,8 +19,8 @@ $idSuffix = $block->getIdSuffix() ?: ''; renderAmount( $block->getConfiguredPrice()->getAmount(), [ - 'display_label' => $block->escapeHtml(__('Special Price')), - 'price_id' => $block->escapeHtml($block->getPriceId('product-price-' . $idSuffix)), + 'display_label' => $escaper->escapeHtml(__('Special Price')), + 'price_id' => $escaper->escapeHtml($block->getPriceId('product-price-' . $idSuffix)), 'price_type' => 'finalPrice', 'include_container' => true, 'schema' => $schema, @@ -27,8 +31,8 @@ $idSuffix = $block->getIdSuffix() ?: ''; renderAmount( $block->getConfiguredRegularPrice()->getAmount(), [ - 'display_label' => $block->escapeHtml(__('Regular Price')), - 'price_id' => $block->escapeHtml($block->getPriceId('old-price-' . $idSuffix)), + 'display_label' => $escaper->escapeHtml(__('Regular Price')), + 'price_id' => $escaper->escapeHtml($block->getPriceId('old-price-' . $idSuffix)), 'price_type' => 'oldPrice', 'include_container' => true, 'skip_adjustments' => true, @@ -46,8 +50,8 @@ $idSuffix = $block->getIdSuffix() ?: ''; renderAmount( $block->getConfiguredPrice()->getAmount(), [ - 'display_label' => $block->escapeHtml($priceLabel), - 'price_id' => $block->escapeHtml($block->getPriceId('product-price-' . $idSuffix)), + 'display_label' => $escaper->escapeHtml($priceLabel), + 'price_id' => $escaper->escapeHtml($block->getPriceId('product-price-' . $idSuffix)), 'price_type' => 'finalPrice', 'include_container' => true, 'schema' => $schema, diff --git a/app/code/Magento/Wishlist/view/base/templates/product/price/configurable/configured_price.phtml b/app/code/Magento/Wishlist/view/base/templates/product/price/configurable/configured_price.phtml index f9517a106a79a..df3f10bd6a2e8 100644 --- a/app/code/Magento/Wishlist/view/base/templates/product/price/configurable/configured_price.phtml +++ b/app/code/Magento/Wishlist/view/base/templates/product/price/configurable/configured_price.phtml @@ -3,12 +3,18 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -?> -getZone() == 'item_view'); $idSuffix = $block->getIdSuffix() ?: ''; -/** @var \Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct $configuredPrice */ + +/** @var ConfigurableProduct $configuredPrice */ $configuredPrice = $block->getPrice(); $configuredRegularAmountValue = $configuredPrice->getConfiguredRegularAmount()->getValue(); ?> @@ -20,8 +26,8 @@ $configuredRegularAmountValue = $configuredPrice->getConfiguredRegularAmount()-> renderAmount( $configuredPrice->getConfiguredAmount(), [ - 'display_label' => $block->escapeHtml(__('Special Price')), - 'price_id' => $block->escapeHtml($block->getPriceId('product-price-' . $idSuffix)), + 'display_label' => $escaper->escapeHtml(__('Special Price')), + 'price_id' => $escaper->escapeHtml($block->getPriceId('product-price-' . $idSuffix)), 'price_type' => 'finalPrice', 'include_container' => true, 'schema' => $schema, @@ -32,8 +38,8 @@ $configuredRegularAmountValue = $configuredPrice->getConfiguredRegularAmount()-> renderAmount( $configuredPrice->getConfiguredRegularAmount(), [ - 'display_label' => $block->escapeHtml(__('Regular Price')), - 'price_id' => $block->escapeHtml($block->getPriceId('old-price-' . $idSuffix)), + 'display_label' => $escaper->escapeHtml(__('Regular Price')), + 'price_id' => $escaper->escapeHtml($block->getPriceId('old-price-' . $idSuffix)), 'price_type' => 'oldPrice', 'include_container' => true, 'skip_adjustments' => true, @@ -51,8 +57,8 @@ $configuredRegularAmountValue = $configuredPrice->getConfiguredRegularAmount()-> renderAmount( $configuredPrice->getAmount(), [ - 'display_label' => $block->escapeHtml($priceLabel), - 'price_id' => $block->escapeHtml($block->getPriceId('product-price-' . $idSuffix)), + 'display_label' => $escaper->escapeHtml($priceLabel), + 'price_id' => $escaper->escapeHtml($block->getPriceId('product-price-' . $idSuffix)), 'price_type' => 'finalPrice', 'include_container' => true, 'schema' => $schema, diff --git a/app/code/Magento/Wishlist/view/frontend/templates/button/share.phtml b/app/code/Magento/Wishlist/view/frontend/templates/button/share.phtml index 0ec1febaf2f7f..4e3a3ef9a9224 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/button/share.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/button/share.phtml @@ -3,11 +3,19 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); -/** @var \Magento\Wishlist\Block\Customer\Wishlist\Button $block */ +use Magento\Framework\Escaper; +use Magento\Wishlist\Block\Customer\Wishlist\Button; + +/** @var Escaper $escaper */ +/** @var Button $block */ ?> getWishlist()->getItemsCount() && $block->getWishlist()->getShared() < $block->getConfig()->getSharingEmailLimit()) : ?> - diff --git a/app/code/Magento/Wishlist/view/frontend/templates/button/tocart.phtml b/app/code/Magento/Wishlist/view/frontend/templates/button/tocart.phtml index 30d6c85ab64cd..b150647dc2546 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/button/tocart.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/button/tocart.phtml @@ -3,12 +3,20 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); -/** @var \Magento\Wishlist\Block\Customer\Wishlist\Button $block */ +use Magento\Framework\Escaper; +use Magento\Wishlist\Block\Customer\Wishlist\Button; + +/** @var Escaper $escaper */ +/** @var Button $block */ ?> getWishlist()->getItemsCount() && $block->getWishlist()->isSalable()) : ?> - diff --git a/app/code/Magento/Wishlist/view/frontend/templates/button/update.phtml b/app/code/Magento/Wishlist/view/frontend/templates/button/update.phtml index 6d8e13eeca5fd..5baf217da5c9b 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/button/update.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/button/update.phtml @@ -3,12 +3,19 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); -/** @var \Magento\Wishlist\Block\Customer\Wishlist\Button $block */ -?> +use Magento\Framework\Escaper; +use Magento\Wishlist\Block\Customer\Wishlist\Button; +/** @var Escaper $escaper */ +/** @var Button $block */ +?> getWishlist()->getItemsCount()) : ?> - diff --git a/app/code/Magento/Wishlist/view/frontend/templates/cart/item/renderer/actions/move_to_wishlist.phtml b/app/code/Magento/Wishlist/view/frontend/templates/cart/item/renderer/actions/move_to_wishlist.phtml index 99732791e108b..82807549cc80a 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/cart/item/renderer/actions/move_to_wishlist.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/cart/item/renderer/actions/move_to_wishlist.phtml @@ -3,13 +3,18 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); -/** @var \Magento\Wishlist\Block\Cart\Item\Renderer\Actions\MoveToWishlist $block */ +use Magento\Framework\Escaper; +use Magento\Wishlist\Block\Cart\Item\Renderer\Actions\MoveToWishlist; + +/** @var Escaper $escaper */ +/** @var MoveToWishlist $block */ ?> isAllowInCart() && $block->isProductVisibleInSiteVisibility()) : ?> - escapeHtml(__('Move to Wishlist')) ?> + escapeHtml(__('Move to Wishlist')) ?> diff --git a/app/code/Magento/Wishlist/view/frontend/templates/catalog/product/list/addto/wishlist.phtml b/app/code/Magento/Wishlist/view/frontend/templates/catalog/product/list/addto/wishlist.phtml index 2427f883c2b53..1e9d0e10e831d 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/catalog/product/list/addto/wishlist.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/catalog/product/list/addto/wishlist.phtml @@ -3,8 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); -/** @var Magento\Wishlist\Block\Catalog\Product\ProductList\Item\AddTo\Wishlist $block */ +use Magento\Framework\Escaper; +use Magento\Wishlist\Block\Catalog\Product\ProductList\Item\AddTo\Wishlist; + +/** @var Escaper $escaper */ +/** @var Wishlist $block */ ?> getWishlistHelper()->isAllow()) : ?> isWishListAllowed()) : ?> escapeHtml(__('Add to Wish List')) ?> + data-action="add-to-wishlist">escapeHtml(__('Add to Wish List')) ?>