Skip to content

Commit 015206d

Browse files
Indrani SonawaneIndrani Sonawane
authored andcommitted
Merge remote-tracking branch '34643/patch-12' into compr_author
2 parents b832b85 + 4959aa5 commit 015206d

File tree

4 files changed

+41
-55
lines changed

4 files changed

+41
-55
lines changed

app/code/Magento/Review/view/frontend/templates/helper/summary.phtml

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/**
88
* @var \Magento\Review\Block\Product\ReviewRenderer $block
99
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
10+
* @var \Magento\Framework\Escaper $escaper
1011
*/
1112

1213
$url = $block->getReviewsUrl() . '#reviews';
@@ -18,43 +19,37 @@ $urlForm = $block->getReviewsUrl() . '#review-form';
1819
itemtype="http://schema.org/AggregateRating">
1920
<?php if ($rating):?>
2021
<div class="rating-summary">
21-
<span class="label"><span><?= $block->escapeHtml(__('Rating')) ?>:</span></span>
22+
<span class="label"><span><?= $escaper->escapeHtml(__('Rating')) ?>:</span></span>
2223
<div class="rating-result"
23-
id="rating-result_<?= $block->escapeHtmlAttr($block->getProduct()->getId()) ?>"
24-
title="<?= $block->escapeHtmlAttr($rating) ?>%"
25-
>
26-
<span>
24+
id="rating-result_<?= $escaper->escapeHtmlAttr($block->getProduct()->getId()) ?>"
25+
title="<?= $escaper->escapeHtmlAttr($rating); ?>%">
26+
<span style="width: <?= $escaper->escapeHtmlAttr($rating); ?>%;">
2727
<span>
28-
<span itemprop="ratingValue"><?= $block->escapeHtml($rating); ?>
28+
<span itemprop="ratingValue"><?= $escaper->escapeHtml($rating); ?>
2929
</span>% of <span itemprop="bestRating">100</span>
3030
</span>
3131
</span>
3232
</div>
3333
</div>
34-
<?= /* @noEscape */
35-
$secureRenderer->renderStyleAsTag(
36-
'width:' . $block->escapeHtmlAttr($rating) . '%',
37-
'#rating-result_' . $block->getProduct()->getId() . ' span'
38-
) ?>
3934
<?php endif;?>
4035
<div class="reviews-actions">
4136
<a class="action view"
42-
href="<?= $block->escapeUrl($url) ?>">
43-
<span itemprop="reviewCount"><?= $block->escapeHtml($block->getReviewsCount()) ?></span>&nbsp;
44-
<span><?= ($block->getReviewsCount() == 1) ? $block->escapeHtml(__('Review')) :
45-
$block->escapeHtml(__('Reviews')) ?>
37+
href="<?= $escaper->escapeUrl($url) ?>">
38+
<span itemprop="reviewCount"><?= $escaper->escapeHtml($block->getReviewsCount()) ?></span>&nbsp;
39+
<span><?= ($block->getReviewsCount() == 1) ? $escaper->escapeHtml(__('Review')) :
40+
$escaper->escapeHtml(__('Reviews')) ?>
4641
</span>
4742
</a>
48-
<a class="action add" href="<?= $block->escapeUrl($urlForm) ?>">
49-
<?= $block->escapeHtml(__('Add Your Review')) ?>
43+
<a class="action add" href="<?= $escaper->escapeUrl($urlForm) ?>">
44+
<?= $escaper->escapeHtml(__('Add Your Review')) ?>
5045
</a>
5146
</div>
5247
</div>
5348
<?php elseif ($block->isReviewEnabled() && $block->getDisplayIfEmpty()): ?>
5449
<div class="product-reviews-summary empty">
5550
<div class="reviews-actions">
56-
<a class="action add" href="<?= $block->escapeUrl($urlForm) ?>">
57-
<?= $block->escapeHtml(__('Be the first to review this product')) ?>
51+
<a class="action add" href="<?= $escaper->escapeUrl($urlForm) ?>">
52+
<?= $escaper->escapeHtml(__('Be the first to review this product')) ?>
5853
</a>
5954
</div>
6055
</div>

app/code/Magento/Review/view/frontend/templates/helper/summary_short.phtml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/** @var \Magento\Review\Block\Product\ReviewRenderer $block */
88
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
9+
/** @var \Magento\Framework\Escaper $escaper */
910

1011
$url = $block->getReviewsUrl() . '#reviews';
1112
$urlForm = $block->getReviewsUrl() . '#review-form';
@@ -15,32 +16,30 @@ $urlForm = $block->getReviewsUrl() . '#review-form';
1516
<div class="product-reviews-summary short<?= !$rating ? ' no-rating' : '' ?>">
1617
<?php if ($rating):?>
1718
<div class="rating-summary">
18-
<span class="label"><span><?= $block->escapeHtml(__('Rating')) ?>:</span></span>
19+
<span class="label"><span><?= $escaper->escapeHtml(__('Rating')) ?>:</span></span>
1920
<div class="rating-result"
2021
id="rating-result_<?= /* @noEscape */ $block->getProduct()->getId() ?>"
21-
title="<?= $block->escapeHtmlAttr($rating) ?>%">
22-
<span><span><?= $block->escapeHtml($rating) ?>%</span></span>
22+
title="<?= $escaper->escapeHtmlAttr($rating) ?>%">
23+
<span style="width: <?= $escaper->escapeHtmlAttr($rating) ?>%;">
24+
<span><?= $escaper->escapeHtml($rating) ?>%</span>
25+
</span>
2326
</div>
24-
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
25-
'width:' . $block->escapeHtmlAttr($rating) . '%',
26-
'#rating-result_' . $block->getProduct()->getId() . ' span'
27-
) ?>
2827
</div>
2928
<?php endif;?>
3029
<div class="reviews-actions">
3130
<a class="action view"
32-
href="<?= $block->escapeUrl($url) ?>"><?= $block->escapeHtml($block->getReviewsCount()) ?>
31+
href="<?= $escaper->escapeUrl($url) ?>"><?= $escaper->escapeHtml($block->getReviewsCount()) ?>
3332
&nbsp;<span><?= ($block->getReviewsCount() == 1) ?
34-
$block->escapeHtml(__('Review')) : $block->escapeHtml(__('Reviews')) ?>
33+
$escaper->escapeHtml(__('Review')) : $escaper->escapeHtml(__('Reviews')) ?>
3534
</span>
3635
</a>
3736
</div>
3837
</div>
3938
<?php elseif ($block->isReviewEnabled() && $block->getDisplayIfEmpty()): ?>
4039
<div class="product-reviews-summary short empty">
4140
<div class="reviews-actions">
42-
<a class="action add" href="<?= $block->escapeUrl($urlForm) ?>">
43-
<?= $block->escapeHtml(__('Be the first to review this product')) ?>
41+
<a class="action add" href="<?= $escaper->escapeUrl($urlForm) ?>">
42+
<?= $escaper->escapeHtml(__('Be the first to review this product')) ?>
4443
</a>
4544
</div>
4645
</div>

app/code/Magento/Review/view/frontend/templates/product/view/list.phtml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,12 @@ $format = $block->getDateFormat() ?: \IntlDateFormatter::SHORT;
4949
title="<?= $escaper->escapeHtmlAttr($_vote->getPercent()) ?>%">
5050
<meta itemprop="worstRating" content="1"/>
5151
<meta itemprop="bestRating" content="100"/>
52-
<span>
52+
<span style="width: <?= $escaper->escapeHtml($_vote->getPercent()) ?>%;">
5353
<span itemprop="ratingValue">
5454
<?= $escaper->escapeHtml($_vote->getPercent()) ?>%
5555
</span>
5656
</span>
5757
</div>
58-
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
59-
'width:' . $_vote->getPercent() . '%',
60-
'div#review_' . $_review->getReviewId()
61-
. '_vote_' . $_vote->getVoteId() . ' span'
62-
) ?>
6358
</div>
6459
<?php endforeach; ?>
6560
</div>

app/code/Magento/Review/view/frontend/templates/view.phtml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,48 @@
77
/**
88
* @var \Magento\Review\Block\View $block
99
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
10+
* @var \Magento\Framework\Escaper $escaper
1011
*/
1112
?>
1213
<?php if ($block->getProductData()->getId()): ?>
1314
<div class="product-review">
1415
<div class="page-title-wrapper">
15-
<h1><?= $block->escapeHtml(__('Review Details')) ?></h1>
16+
<h1><?= $escaper->escapeHtml(__('Review Details')) ?></h1>
1617
</div>
1718
<div class="product-img-box">
18-
<a href="<?= $block->escapeUrl($block->getProductData()->getProductUrl()) ?>">
19-
<?= $block->getImage($block->getProductData(), 'product_base_image', ['class' => 'product-image'])->toHtml()
19+
<a href="<?= $escaper->escapeUrl($block->getProductData()->getProductUrl()) ?>">
20+
<?= $block->getImage($block->getProductData(), 'product_base_image', [
21+
'class' => 'product-image'])->toHtml()
2022
?>
2123
</a>
2224
<?php if ($block->getRating() && $block->getRating()->getSize()): ?>
23-
<p><?= $block->escapeHtml(__('Average Customer Rating')) ?>:</p>
25+
<p><?= $escaper->escapeHtml(__('Average Customer Rating')) ?>:</p>
2426
<?= $block->getReviewsSummaryHtml($block->getProductData()) ?>
2527
<?php endif; ?>
2628
</div>
2729
<div class="details">
28-
<h3 class="product-name"><?= $block->escapeHtml($block->getProductData()->getName()) ?></h3>
30+
<h3 class="product-name"><?= $escaper->escapeHtml($block->getProductData()->getName()) ?></h3>
2931
<?php if ($block->getRating() && $block->getRating()->getSize()): ?>
30-
<h4><?= $block->escapeHtml(__('Product Rating:')) ?></h4>
32+
<h4><?= $escaper->escapeHtml(__('Product Rating:')) ?></h4>
3133
<div class="table-wrapper">
3234
<table class="data-table review-summary-table">
33-
<caption class="table-caption"><?= $block->escapeHtml(__('Product Rating')) ?></caption>
35+
<caption class="table-caption"><?= $escaper->escapeHtml(__('Product Rating')) ?></caption>
3436
<?php foreach ($block->getRating() as $_rating): ?>
3537
<?php if ($_rating->getPercent()): ?>
3638
<?php $rating = ceil($_rating->getPercent()) ?>
3739
<tr>
3840
<td class="label" width="10%">
39-
<?= $block->escapeHtml(__($_rating->getRatingCode())) ?>
41+
<?= $escaper->escapeHtml(__($_rating->getRatingCode())) ?>
4042
</td>
4143
<td class="value">
4244
<?php $ratingId = $_rating->getRatingId() ?>
4345
<div class="rating-summary item"
44-
id="rating-div-<?= $block->escapeHtml($ratingId) ?>">
46+
id="rating-div-<?= $escaper->escapeHtml($ratingId) ?>">
4547
<div class="rating-result" title="<?= /* @noEscape */ $rating ?>%">
46-
<span>
48+
<span style="width: <?= /* @noEscape */ $rating ?>%;">
4749
<span><?= /* @noEscape */ $rating ?>%</span>
4850
</span>
4951
</div>
50-
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
51-
"width:" . /* @noEscape */ $rating . "%",
52-
'div#rating-div-'.$_rating->getRatingId().
53-
'>div.rating-result>span:first-child'
54-
) ?>
5552
</div>
5653
</td>
5754
</tr>
@@ -61,16 +58,16 @@
6158
</div>
6259
<?php endif; ?>
6360
<p class="date">
64-
<?= $block->escapeHtml(
61+
<?= $escaper->escapeHtml(
6562
__('Product Review (submitted on %1):', $block->dateFormat($block->getReviewData()->getCreatedAt()))
6663
) ?>
6764
</p>
68-
<p><?= /* @noEscape */ nl2br($block->escapeHtml($block->getReviewData()->getDetail())) ?></p>
65+
<p><?= /* @noEscape */ nl2br($escaper->escapeHtml($block->getReviewData()->getDetail())) ?></p>
6966
</div>
7067
<div class="actions">
7168
<div class="secondary">
72-
<a class="action back" href="<?= $block->escapeUrl($block->getBackUrl()) ?>">
73-
<span><?= $block->escapeHtml(__('Back to Product Reviews')) ?></span>
69+
<a class="action back" href="<?= $escaper->escapeUrl($block->getBackUrl()) ?>">
70+
<span><?= $escaper->escapeHtml(__('Back to Product Reviews')) ?></span>
7471
</a>
7572
</div>
7673
</div>

0 commit comments

Comments
 (0)