Skip to content

Commit 50b6536

Browse files
committed
MC-16295: Eliminate @escapeNotVerified in Search-related Modules
1 parent fba6cfb commit 50b6536

File tree

11 files changed

+78
-78
lines changed

11 files changed

+78
-78
lines changed

app/code/Magento/CatalogSearch/view/frontend/templates/advanced/form.phtml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
7+
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
98
?>
109
<?php
1110
/**
@@ -14,19 +13,20 @@
1413
* @var $block \Magento\CatalogSearch\Block\Advanced\Form
1514
*/
1615
?>
17-
<?php $maxQueryLength = $this->helper('Magento\CatalogSearch\Helper\Data')->getMaxQueryLength();?>
16+
<?php $maxQueryLength = $this->helper(\Magento\CatalogSearch\Helper\Data::class)->getMaxQueryLength();?>
1817
<form class="form search advanced" action="<?= $block->escapeUrl($block->getSearchPostUrl()) ?>" method="get" id="form-validate">
1918
<fieldset class="fieldset">
2019
<legend class="legend"><span><?= $block->escapeHtml(__('Search Settings')) ?></span></legend><br />
21-
<?php foreach ($block->getSearchableAttributes() as $_attribute): ?>
22-
<?php $_code = $_attribute->getAttributeCode() ?>
20+
<?php foreach ($block->getSearchableAttributes() as $_attribute) : ?>
21+
<?php $_code = $_attribute->getAttributeCode() ?>
2322
<div class="field <?= $block->escapeHtmlAttr($_code) ?>">
2423
<label class="label" for="<?= $block->escapeHtmlAttr($_code) ?>">
2524
<span><?= $block->escapeHtml(__($block->getAttributeLabel($_attribute))) ?></span>
2625
</label>
2726
<div class="control">
28-
<?php switch ($block->getAttributeInputType($_attribute)):
29-
case 'number': ?>
27+
<?php switch ($block->getAttributeInputType($_attribute)) :
28+
case 'number':
29+
?>
3030
<div class="range fields group group-2">
3131
<div class="field no-label">
3232
<div class="control">
@@ -53,8 +53,10 @@
5353
</div>
5454
</div>
5555
</div>
56-
<?php break;
57-
case 'price': ?>
56+
<?php
57+
break;
58+
case 'price':
59+
?>
5860
<div class="range price fields group group-2">
5961
<div class="field no-label">
6062
<div class="control">
@@ -87,14 +89,20 @@
8789
</div>
8890
</div>
8991
</div>
90-
<?php break;
91-
case 'select': ?>
92+
<?php
93+
break;
94+
case 'select':
95+
?>
9296
<?= /* @noEscape */ $block->getAttributeSelectElement($_attribute) ?>
93-
<?php break;
94-
case 'yesno': ?>
97+
<?php
98+
break;
99+
case 'yesno':
100+
?>
95101
<?= /* @noEscape */ $block->getAttributeYesNoElement($_attribute) ?>
96-
<?php break;
97-
case 'date': ?>
102+
<?php
103+
break;
104+
case 'date':
105+
?>
98106
<div class="range dates fields group group-2">
99107
<div class="field date no-label">
100108
<div class="control">
@@ -107,8 +115,10 @@
107115
</div>
108116
</div>
109117
</div>
110-
<?php break;
111-
default: ?>
118+
<?php
119+
break;
120+
default:
121+
?>
112122
<input type="text"
113123
name="<?= $block->escapeHtmlAttr($_code) ?>"
114124
id="<?= $block->escapeHtmlAttr($_code) ?>"

app/code/Magento/CatalogSearch/view/frontend/templates/advanced/link.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
7+
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
88

99
/** @var \Magento\CatalogSearch\Helper\Data $helper */
10-
$helper = $this->helper('Magento\CatalogSearch\Helper\Data');
10+
$helper = $this->helper(\Magento\CatalogSearch\Helper\Data::class);
1111
?>
1212
<div class="nested">
1313
<a class="action advanced" href="<?= $block->escapeUrl($helper->getAdvancedSearchUrl()) ?>" data-action="advanced-search">

app/code/Magento/CatalogSearch/view/frontend/templates/advanced/result.phtml

Lines changed: 8 additions & 11 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
/**
@@ -14,15 +11,15 @@
1411
/** this changes need for valid apply filters and configuration before search process is started */
1512
$productList = $block->getProductListHtml();
1613
?>
17-
<?php if ($results = $block->getResultCount()): ?>
14+
<?php if ($results = $block->getResultCount()) : ?>
1815
<div class="search found">
1916
<?php if ($results == 1) : ?>
2017
<?= /* @noEscape */ __('<strong>%1 item</strong> were found using the following search criteria', $results) ?>
21-
<?php else: ?>
18+
<?php else : ?>
2219
<?= /* @noEscape */ __('<strong>%1 items</strong> were found using the following search criteria', $results) ?>
2320
<?php endif; ?>
2421
</div>
25-
<?php else: ?>
22+
<?php else : ?>
2623
<div role="alert" class="message error">
2724
<div>
2825
<?= $block->escapeHtml(__('We can\'t find any items matching these search criteria.')) ?> <a href="<?= $block->escapeUrl($block->getFormUrl()) ?>"><?= $block->escapeHtml(__('Modify your search.')) ?></a>
@@ -32,25 +29,25 @@ $productList = $block->getProductListHtml();
3229

3330
<?php $searchCriterias = $block->getSearchCriterias(); ?>
3431
<div class="search summary">
35-
<?php foreach (['left', 'right'] as $side): ?>
36-
<?php if (@$searchCriterias[$side]): ?>
32+
<?php foreach (['left', 'right'] as $side) : ?>
33+
<?php if (!empty($searchCriterias[$side])) : ?>
3734
<ul class="items">
38-
<?php foreach ($searchCriterias[$side] as $criteria): ?>
35+
<?php foreach ($searchCriterias[$side] as $criteria) : ?>
3936
<li class="item"><strong><?= $block->escapeHtml(__($criteria['name'])) ?>:</strong> <?= $block->escapeHtml($criteria['value']) ?></li>
4037
<?php endforeach; ?>
4138
</ul>
4239
<?php endif; ?>
4340
<?php endforeach; ?>
4441
</div>
45-
<?php if ($block->getResultCount()): ?>
42+
<?php if ($block->getResultCount()) : ?>
4643
<div class="message notice">
4744
<div>
4845
<?= $block->escapeHtml(__("Don't see what you're looking for?")) ?>
4946
<a href="<?= $block->escapeUrl($block->getFormUrl()) ?>"><?= $block->escapeHtml(__('Modify your search.')) ?></a>
5047
</div>
5148
</div>
5249
<?php endif; ?>
53-
<?php if ($block->getResultCount()): ?>
50+
<?php if ($block->getResultCount()) : ?>
5451
<div class="search results"><?= /* @noEscape */ $productList ?></div>
5552
<?php endif; ?>
5653
<?php $block->getSearchCriterias(); ?>

app/code/Magento/CatalogSearch/view/frontend/templates/result.phtml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,29 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
10-
<?php if ($block->getResultCount()): ?>
11-
<?= /* @noEscape */ $block->getChildHtml('tagged_product_list_rss_link') ?>
7+
<?php if ($block->getResultCount()) : ?>
8+
<?= /* @noEscape */ $block->getChildHtml('tagged_product_list_rss_link') ?>
129
<div class="search results">
13-
<?php if ($messages = $block->getNoteMessages()):?>
10+
<?php if ($messages = $block->getNoteMessages()) :?>
1411
<div class="message notice">
1512
<div>
16-
<?php foreach ($messages as $message):?>
13+
<?php foreach ($messages as $message) :?>
1714
<?= /* @noEscape */ $message ?><br />
1815
<?php endforeach;?>
1916
</div>
2017
</div>
2118
<?php endif; ?>
2219
<?= $block->getProductListHtml() ?>
2320
</div>
24-
<?php else: ?>
21+
<?php else : ?>
2522

2623
<div class="message notice">
2724
<div>
2825
<?= $block->escapeHtml($block->getNoResultText() ? $block->getNoResultText() : __('Your search returned no results.')) ?>
2926
<?= /* @noEscape */ $block->getAdditionalHtml() ?>
30-
<?php if ($messages = $block->getNoteMessages()):?>
31-
<?php foreach ($messages as $message):?>
27+
<?php if ($messages = $block->getNoteMessages()) :?>
28+
<?php foreach ($messages as $message) :?>
3229
<br /><?= /* @noEscape */ $message ?>
3330
<?php endforeach;?>
3431
<?php endif; ?>

app/code/Magento/CatalogSearch/view/frontend/templates/search_terms_log.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
// @codingStandardsIgnoreFile
76
?>
8-
<?php if ($block->getSearchTermsLog()->isPageCacheable()): ?>
7+
<?php if ($block->getSearchTermsLog()->isPageCacheable()) : ?>
98
<script type="text/x-magento-init">
109
{
1110
"*": {

app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
7+
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
98
?>
109
<?php
1110
/**
@@ -16,21 +15,29 @@
1615
?>
1716

1817
<ol class="items">
19-
<?php foreach ($filterItems as $filterItem): ?>
18+
<?php foreach ($filterItems as $filterItem) : ?>
2019
<li class="item">
21-
<?php if ($filterItem->getCount() > 0): ?>
20+
<?php if ($filterItem->getCount() > 0) : ?>
2221
<a href="<?= $block->escapeUrl($filterItem->getUrl()) ?>">
2322
<?= /* @noEscape */ $filterItem->getLabel() ?>
24-
<?php if ($this->helper('\Magento\Catalog\Helper\Data')->shouldDisplayProductCountOnLayer()): ?>
23+
<?php if ($this->helper(\Magento\Catalog\Helper\Data::class)->shouldDisplayProductCountOnLayer()) : ?>
2524
<span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?><span class="filter-count-label">
26-
<?php if ($filterItem->getCount() == 1):?> <?= $block->escapeHtml(__('item')) ?><?php else:?> <?= $block->escapeHtml(__('item')) ?><?php endif;?></span></span>
25+
<?php if ($filterItem->getCount() == 1) :
26+
?> <?= $block->escapeHtml(__('item')) ?><?php
27+
else :
28+
?> <?= $block->escapeHtml(__('item')) ?><?php
29+
endif;?></span></span>
2730
<?php endif; ?>
2831
</a>
29-
<?php else:?>
32+
<?php else :?>
3033
<?= /* @noEscape */ $filterItem->getLabel() ?>
31-
<?php if ($this->helper('\Magento\Catalog\Helper\Data')->shouldDisplayProductCountOnLayer()): ?>
34+
<?php if ($this->helper(\Magento\Catalog\Helper\Data::class)->shouldDisplayProductCountOnLayer()) : ?>
3235
<span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?><span class="filter-count-label">
33-
<?php if ($filterItem->getCount() == 1):?><?= $block->escapeHtml(__('items')) ?><?php else:?><?= $block->escapeHtml(__('items')) ?><?php endif;?></span></span>
36+
<?php if ($filterItem->getCount() == 1) :
37+
?><?= $block->escapeHtml(__('items')) ?><?php
38+
else :
39+
?><?= $block->escapeHtml(__('items')) ?><?php
40+
endif;?></span></span>
3441
<?php endif; ?>
3542
<?php endif; ?>
3643
</li>

app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.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
/**
@@ -15,21 +12,21 @@
1512
*/
1613
?>
1714
<?php $_filters = $block->getActiveFilters() ?>
18-
<?php if (!empty($_filters)): ?>
15+
<?php if (!empty($_filters)) : ?>
1916
<div class="filter-current">
2017
<strong class="block-subtitle filter-current-subtitle"
2118
role="heading"
2219
aria-level="2"
2320
data-count="<?= /* @noEscape */ count($_filters) ?>"><?= $block->escapeHtml(__('Now Shopping by')) ?></strong>
2421
<ol class="items">
25-
<?php foreach ($_filters as $_filter): ?>
22+
<?php foreach ($_filters as $_filter) : ?>
2623
<li class="item">
2724
<span class="filter-label"><?= $block->escapeHtml(__($_filter->getName())) ?></span>
2825
<span class="filter-value"><?= $block->escapeHtml($block->stripTags($_filter->getLabel())) ?></span>
2926
<?php
3027
$clearLinkUrl = $_filter->getClearLinkUrl();
3128
$currentFilterName = $block->escapeHtmlAttr(__($_filter->getName()) . " " . $block->stripTags($_filter->getLabel()));
32-
if ($clearLinkUrl):
29+
if ($clearLinkUrl) :
3330
?>
3431
<a class="action previous" href="<?= $block->escapeUrl($_filter->getRemoveUrl()) ?>"
3532
title="<?= $block->escapeHtmlAttr(__('Previous')) ?>">
@@ -40,7 +37,7 @@
4037
href="<?= $block->escapeUrl($clearLinkUrl) ?>">
4138
<span><?= $block->escapeHtml($_filter->getFilter()->getClearLinkText()) ?></span>
4239
</a>
43-
<?php else: ?>
40+
<?php else : ?>
4441
<a class="action remove" href="<?= $block->escapeUrl($_filter->getRemoveUrl()) ?>"
4542
title="<?= /* @noEscape */ $block->escapeHtmlAttr(__('Remove')) . " " . $currentFilterName ?>">
4643
<span><?= $block->escapeHtml(__('Remove This Item')) ?></span>

app/code/Magento/LayeredNavigation/view/frontend/templates/layer/view.phtml

Lines changed: 9 additions & 10 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
/**
@@ -15,7 +12,7 @@
1512
*/
1613
?>
1714

18-
<?php if ($block->canShowBlock()): ?>
15+
<?php if ($block->canShowBlock()) : ?>
1916
<div class="block filter">
2017
<div class="block-title filter-title">
2118
<strong><?= $block->escapeHtml(__('Shop By')) ?></strong>
@@ -24,23 +21,25 @@
2421
<div class="block-content filter-content">
2522
<?= $block->getChildHtml('state') ?>
2623

27-
<?php if ($block->getLayer()->getState()->getFilters()): ?>
24+
<?php if ($block->getLayer()->getState()->getFilters()) : ?>
2825
<div class="block-actions filter-actions">
2926
<a href="<?= $block->escapeUrl($block->getClearUrl()) ?>" class="action clear filter-clear"><span><?= $block->escapeHtml(__('Clear All')) ?></span></a>
3027
</div>
3128
<?php endif; ?>
3229
<?php $wrapOptions = false; ?>
33-
<?php foreach ($block->getFilters() as $filter): ?>
34-
<?php if (!$wrapOptions): ?>
30+
<?php foreach ($block->getFilters() as $filter) : ?>
31+
<?php if (!$wrapOptions) : ?>
3532
<strong role="heading" aria-level="2" class="block-subtitle filter-subtitle"><?= $block->escapeHtml(__('Shopping Options')) ?></strong>
3633
<dl class="filter-options" id="narrow-by-list">
37-
<?php $wrapOptions = true; endif; ?>
38-
<?php if ($filter->getItemsCount()): ?>
34+
<?php $wrapOptions = true;
35+
36+
endif; ?>
37+
<?php if ($filter->getItemsCount()) : ?>
3938
<dt role="heading" aria-level="3" class="filter-options-title"><?= $block->escapeHtml(__($filter->getName())) ?></dt>
4039
<dd class="filter-options-content"><?= /* @noEscape */ $block->getChildBlock('renderer')->render($filter) ?></dd>
4140
<?php endif; ?>
4241
<?php endforeach; ?>
43-
<?php if ($wrapOptions): ?>
42+
<?php if ($wrapOptions) : ?>
4443
</dl>
4544
<?php endif; ?>
4645
</div>

app/code/Magento/MediaStorage/view/adminhtml/templates/system/config/system/storage/media/synchronize.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

118
<?php /* @var $block \Magento\MediaStorage\Block\System\Config\System\Storage\Media\Synchronize */ ?>

app/code/Magento/Search/view/frontend/templates/form.mini.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
7+
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
88
?>
99
<?php
1010
/** @var $block \Magento\Framework\View\Element\Template */

0 commit comments

Comments
 (0)