-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Chore: Wishlist - Replace Block Escaping with Escaper #37042
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,13 @@ | |
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
?> | ||
<?php | ||
/** @var \Magento\Catalog\Pricing\Render\ConfiguredPriceBox $block */ | ||
declare(strict_types=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing new line above copyright |
||
|
||
use Magento\Catalog\Pricing\Render\ConfiguredPriceBox; | ||
use Magento\Framework\Escaper; | ||
|
||
/** @var Escaper $escaper */ | ||
/** @var ConfiguredPriceBox $block */ | ||
$schema = ($block->getZone() == 'item_view'); | ||
$idSuffix = $block->getIdSuffix() ?: ''; | ||
?> | ||
|
@@ -15,8 +19,8 @@ $idSuffix = $block->getIdSuffix() ?: ''; | |
<?= /* @noEscape */ $block->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() ?: ''; | |
<?= /* @noEscape */ $block->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() ?: ''; | |
<?= /* @noEscape */ $block->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, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,18 @@ | |
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
?> | ||
<?php | ||
/** @var \Magento\Wishlist\Pricing\Render\ConfiguredPriceBox $block */ | ||
declare(strict_types=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing new line above copyright |
||
|
||
use Magento\Framework\Escaper; | ||
use Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct; | ||
use Magento\Wishlist\Pricing\Render\ConfiguredPriceBox; | ||
|
||
/** @var Escaper $escaper */ | ||
/** @var ConfiguredPriceBox $block */ | ||
$schema = ($block->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()-> | |
<?= /* @noEscape */ $block->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()-> | |
<?= /* @noEscape */ $block->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()-> | |
<?= /* @noEscape */ $block->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, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,19 @@ | |
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing new line above copyright |
||
|
||
/** @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 */ | ||
?> | ||
<?php if ($block->getWishlist()->getItemsCount() && $block->getWishlist()->getShared() < $block->getConfig()->getSharingEmailLimit()) : ?> | ||
<button type="submit" name="save_and_share" title="<?= $block->escapeHtmlAttr(__('Share Wish List')) ?>" class="action share"> | ||
<span><?= $block->escapeHtml(__('Share Wish List')) ?></span> | ||
<button type="submit" | ||
name="save_and_share" | ||
title="<?= $escaper->escapeHtmlAttr(__('Share Wish List')) ?>" | ||
class="action share"> | ||
<span><?= $escaper->escapeHtml(__('Share Wish List')) ?></span> | ||
</button> | ||
<?php endif;?> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,20 @@ | |
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing new line above copyright |
||
|
||
/** @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 */ | ||
?> | ||
|
||
<?php if ($block->getWishlist()->getItemsCount() && $block->getWishlist()->isSalable()) : ?> | ||
<button type="button" data-role="all-tocart" title="<?= $block->escapeHtmlAttr(__('Add All to Cart')) ?>" class="action tocart"> | ||
<span><?= $block->escapeHtml(__('Add All to Cart')) ?></span> | ||
<button type="button" | ||
data-role="all-tocart" | ||
title="<?= $escaper->escapeHtmlAttr(__('Add All to Cart')) ?>" | ||
class="action tocart"> | ||
<span><?= $escaper->escapeHtml(__('Add All to Cart')) ?></span> | ||
</button> | ||
<?php endif;?> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,19 @@ | |
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing new line above copyright |
||
|
||
/** @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 */ | ||
?> | ||
<?php if ($block->getWishlist()->getItemsCount()) : ?> | ||
<button type="submit" name="do" title="<?= $block->escapeHtmlAttr(__('Update Wish List')) ?>" class="action update"> | ||
<span><?= $block->escapeHtml(__('Update Wish List')) ?></span> | ||
<button type="submit" | ||
name="do" | ||
title="<?= $escaper->escapeHtmlAttr(__('Update Wish List')) ?>" | ||
class="action update"> | ||
<span><?= $escaper->escapeHtml(__('Update Wish List')) ?></span> | ||
</button> | ||
<?php endif;?> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,18 @@ | |
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing new line above copyright |
||
|
||
/** @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 */ | ||
?> | ||
<?php if ($block->isAllowInCart() && $block->isProductVisibleInSiteVisibility()) : ?> | ||
<a href="#" | ||
data-post='<?= /* @noEscape */ $block->getMoveFromCartParams() ?>' | ||
class="use-ajax action towishlist action-towishlist"> | ||
<span><?= $block->escapeHtml(__('Move to Wishlist')) ?></span> | ||
<span><?= $escaper->escapeHtml(__('Move to Wishlist')) ?></span> | ||
</a> | ||
<?php endif ?> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,19 @@ | |
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing new line above copyright |
||
|
||
/** @var \Magento\Wishlist\Block\Catalog\Product\View\AddTo\Wishlist $block */ | ||
use Magento\Framework\Escaper; | ||
use Magento\Wishlist\Block\Catalog\Product\View\AddTo\Wishlist; | ||
|
||
/** @var Escaper $escaper */ | ||
/** @var Wishlist $block */ | ||
?> | ||
<?php if ($block->isWishListAllowed()) : ?> | ||
<a href="#" | ||
class="action towishlist" | ||
data-post='<?= /* @noEscape */ $block->getWishlistParams() ?>' | ||
data-action="add-to-wishlist"><span><?= $block->escapeHtml(__('Add to Wish List')) ?></span></a> | ||
data-action="add-to-wishlist"><span><?= $escaper->escapeHtml(__('Add to Wish List')) ?></span></a> | ||
<?php endif; ?> | ||
<script type="text/x-magento-init"> | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,13 @@ | |
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing new line above copyright |
||
|
||
/* @var \Magento\Wishlist\Block\Share\Email\Items $block */ | ||
use Magento\Framework\Escaper; | ||
use Magento\Wishlist\Block\Share\Email\Items; | ||
|
||
/** @var Escaper $escaper */ | ||
/* @var Items $block */ | ||
?> | ||
<?php $l = $block->getWishlistItemsCount() ?> | ||
<div> | ||
|
@@ -17,26 +22,26 @@ | |
<?php $_product = $item->getProduct(); ?> | ||
<td class="col product"> | ||
<p> | ||
<a href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>"> | ||
<a href="<?= $escaper->escapeUrl($block->getProductUrl($item)) ?>"> | ||
<?php $productThumbnail = $block->getProductForThumbnail($item) ?> | ||
<?= /* @noEscape */ $block->getImage($productThumbnail, 'product_small_image')->toHtml() ?> | ||
</a> | ||
</p> | ||
|
||
<p> | ||
<a href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>"> | ||
<strong><?= $block->escapeHtml($_product->getName()) ?></strong> | ||
<a href="<?= $escaper->escapeUrl($block->getProductUrl($item)) ?>"> | ||
<strong><?= $escaper->escapeHtml($_product->getName()) ?></strong> | ||
</a> | ||
</p> | ||
<?php if ($block->hasDescription($item)): ?> | ||
<p> | ||
<strong><?= $block->escapeHtml(__('Comment')) ?>:</strong> | ||
<strong><?= $escaper->escapeHtml(__('Comment')) ?>:</strong> | ||
<br/><?= /* @noEscape */ $block->getEscapedDescription($item) ?> | ||
</p> | ||
<?php endif; ?> | ||
<p> | ||
<a href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>"> | ||
<?= $block->escapeHtml(__('View Product')) ?> | ||
<a href="<?= $escaper->escapeUrl($block->getProductUrl($item)) ?>"> | ||
<?= $escaper->escapeHtml(__('View Product')) ?> | ||
</a> | ||
</p> | ||
</td> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,17 @@ | |
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing new line above copyright |
||
|
||
/** @var \Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions $block */ | ||
use Magento\Framework\Escaper; | ||
use Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions; | ||
|
||
/** @var Escaper $escaper */ | ||
/** @var Actions $block */ | ||
?> | ||
<?php $children = $block->getChildNames(); ?> | ||
<?php if ($children) : ?> | ||
<div class="<?= $block->escapeHtmlAttr($block->getCssClass()) ?>"> | ||
<div class="<?= $escaper->escapeHtmlAttr($block->getCssClass()) ?>"> | ||
<?php foreach ($children as $childName) : ?> | ||
<?= /* @noEscape */ $block->getLayout()->renderElement($childName, false) ?> | ||
<?php endforeach;?> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing new line above copyright