Skip to content

Commit 1163d1e

Browse files
author
Sergey Shvets
committed
MAGETWO-55814: East team cadenece 3 PR
fixed static tests
1 parent 585323c commit 1163d1e

File tree

5 files changed

+49
-39
lines changed

5 files changed

+49
-39
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ public function __construct(
3939
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
4040
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
4141
\Magento\Framework\View\LayoutFactory $layoutFactory
42-
)
43-
{
42+
) {
4443
parent::__construct($context, $attributeLabelCache, $coreRegistry, $resultPageFactory);
4544
$this->resultJsonFactory = $resultJsonFactory;
4645
$this->layoutFactory = $layoutFactory;
@@ -109,7 +108,7 @@ public function execute()
109108
*/
110109
private function isUniqueAdminValues(array $optionsValues, array $deletedOptions)
111110
{
112-
$adminValues = array();
111+
$adminValues = [];
113112
foreach ($optionsValues as $optionKey => $values) {
114113
if (!(isset($deletedOptions[$optionKey]) and $deletedOptions[$optionKey] === '1')) {
115114
$adminValues[] = reset($values);

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,21 @@
1111
$stores = $block->getStoresSortedBySortOrder();
1212
?>
1313
<fieldset class="fieldset">
14-
<legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Manage Options (Values of Your Attribute)') ?></span></legend>
14+
<legend class="legend">
15+
<span><?php echo $block->escapeHtml(__('Manage Options (Values of Your Attribute)')); ?></span>
16+
</legend>
1517
<div id="manage-options-panel" data-index="attribute_options_select_container">
1618
<table class="admin__control-table" data-index="attribute_options_select">
1719
<thead>
1820
<tr id="attribute-options-table">
1921
<th class="col-draggable"></th>
20-
<th class="col-default control-table-actions-th"><span><?php /* @escapeNotVerified */ echo __('Is Default') ?></span></th>
22+
<th class="col-default control-table-actions-th">
23+
<span><?php echo $block->escapeHtml(__('Is Default')); ?></span>
24+
</th>
2125
<?php
2226
foreach ($stores as $_store): ?>
2327
<th<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> class="_required"<?php endif; ?>>
24-
<span><?php /* @escapeNotVerified */ echo __($_store->getName()) ?></span>
28+
<span><?php echo $block->escapeHtml(__($_store->getName())) ?></span>
2529
</th>
2630
<?php endforeach;
2731
$storetotal = count($stores) + 3;
@@ -32,17 +36,18 @@ $stores = $block->getStoresSortedBySortOrder();
3236
<tbody data-role="options-container" class="ignore-validate"></tbody>
3337
<tfoot>
3438
<tr>
35-
<th colspan="<?php /* @escapeNotVerified */ echo $storetotal; ?>" class="validation">
39+
<th colspan="<?php echo (int)$storetotal; ?>" class="validation">
3640
<input type="hidden" class="required-dropdown-attribute-entry" name="dropdown_attribute_validation"/>
3741
<input type="hidden" class="required-dropdown-attribute-unique" name="dropdown_attribute_validation_unique"/>
3842
</th>
3943
</tr>
4044
<tr>
41-
<th colspan="<?php /* @escapeNotVerified */ echo $storetotal; ?>" class="col-actions-add">
45+
<th colspan="<?php echo (int) $storetotal; ?>" class="col-actions-add">
4246
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
43-
<button id="add_new_option_button" data-action="add_new_row" title="<?php /* @escapeNotVerified */ echo __('Add Option'); ?>"
44-
type="button" class="action- scalable add">
45-
<span><?php /* @escapeNotVerified */ echo __('Add Option'); ?></span>
47+
<button id="add_new_option_button" data-action="add_new_row"
48+
title="<?php echo $block->escapeHtml(__('Add Option')); ?>"
49+
type="button" class="action- scalable add">
50+
<span><?php echo $block->escapeHtml(__('Add Option')); ?></span>
4651
</button>
4752
<?php endif; ?>
4853
</th>
@@ -55,23 +60,25 @@ $stores = $block->getStoresSortedBySortOrder();
5560
<tr>
5661
<td class="col-draggable">
5762
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
58-
<div data-role="draggable-handle" class="draggable-handle" title="<?php /* @escapeNotVerified */ echo __('Sort Option'); ?>"></div>
63+
<div data-role="draggable-handle" class="draggable-handle"
64+
title="<?php echo $block->escapeHtml(__('Sort Option')); ?>">
65+
</div>
5966
<?php endif; ?>
6067
<input data-role="order" type="hidden" name="option[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/>
6168
</td>
6269
<td class="col-default control-table-actions-cell">
6370
<input class="input-radio" type="<%- data.intype %>" name="default[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/>
6471
</td>
6572
<?php foreach ($stores as $_store): ?>
66-
<td class="col-<%- data.id %>"><input name="option[value][<%- data.id %>][<?php /* @escapeNotVerified */ echo $_store->getId() ?>]" value="<%- data.store<?php /* @escapeNotVerified */ echo $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option required-unique<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/></td>
73+
<td class="col-<%- data.id %>"><input name="option[value][<%- data.id %>][<?php echo (int) $_store->getId() ?>]" value="<%- data.store<?php /* @noEscape */ echo (int) $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option required-unique<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/></td>
6774
<?php endforeach; ?>
6875
<td id="delete_button_container_<%- data.id %>" class="col-delete">
6976
<input type="hidden" class="delete-flag" name="option[delete][<%- data.id %>]" value="" />
7077
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
71-
<button id="delete_button_<%- data.id %>" title="<?php /* @escapeNotVerified */ echo __('Delete') ?>" type="button"
78+
<button id="delete_button_<%- data.id %>" title="<?php echo $block->escapeHtml(__('Delete'));?>" type="button"
7279
class="action- scalable delete delete-option"
7380
>
74-
<span><?php /* @escapeNotVerified */ echo __('Delete') ?></span>
81+
<span><?php echo $block->escapeHtml(__('Delete')) ?></span>
7582
</button>
7683
<?php endif;?>
7784
</td>
@@ -94,7 +101,7 @@ $stores = $block->getStoresSortedBySortOrder();
94101
},
95102
"Magento_Catalog/catalog/product/attribute/unique-validate": {
96103
"element": "required-dropdown-attribute-unique",
97-
"message": "<?php echo __("The value of Admin must be unique.") ?>"
104+
"message": "<?php echo $block->escapeHtml(__("The value of Admin must be unique.")); ?>"
98105
}
99106
}
100107
}

app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Validate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Validate
1919
/**
2020
* @param Attribute\Validate $subject
2121
* @param Json $response
22-
* @return array
22+
* @return \Magento\Framework\Controller\ResultInterface
2323
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2424
*/
2525
public function afterExecute(Attribute\Validate $subject, Json $response)
@@ -57,7 +57,7 @@ public function afterExecute(Attribute\Validate $subject, Json $response)
5757
*/
5858
private function isUniqueAdminValues(array $optionsValues, array $deletedOptions)
5959
{
60-
$adminValues = array();
60+
$adminValues = [];
6161
foreach ($optionsValues as $optionKey => $values) {
6262
if (!(isset($deletedOptions[$optionKey]) and $deletedOptions[$optionKey] === '1')) {
6363
$adminValues[] = reset($values);

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ $stores = $block->getStoresSortedBySortOrder();
8888
value="<%- data.store<?php /* @noEscape */ echo $storeId; ?> %>"
8989
class="input-text<?php if ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>"
9090
type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>
91-
placeholder="<?php echo __("Description"); ?>" />
91+
placeholder="<?php echo $block->escapeHtml(__("Description")); ?>"/>
9292
</td>
9393
<?php endforeach; ?>
9494
<td id="delete_button_swatch_container_<%- data.id %>" class="col-delete">
@@ -108,7 +108,7 @@ $stores = $block->getStoresSortedBySortOrder();
108108
"Magento_Swatches/js/text": <?php /* @escapeNotVerified */ echo $block->getJsonConfig(); ?> ,
109109
"Magento_Catalog/catalog/product/attribute/unique-validate": {
110110
"element": "required-text-swatch-unique",
111-
"message": "<?php echo __("The value of Admin must be unique.") ?>"
111+
"message": "<?php echo $block->escapeHtml(__("The value of Admin must be unique.")); ?>"
112112
}
113113
}
114114
}

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
$stores = $block->getStoresSortedBySortOrder();
1212
?>
1313
<fieldset class="fieldset">
14-
<legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Manage Swatch (Values of Your Attribute)') ?></span></legend>
14+
<legend class="legend"><span><?php echo $block->escapeHtml( __('Manage Swatch (Values of Your Attribute)')); ?></span></legend>
1515
<div id="swatch-visual-options-panel">
1616
<table class="data-table clearfix" cellspacing="0">
1717
<thead>
1818
<tr id="swatch-visual-options-table">
1919
<th class="col-draggable"></th>
20-
<th class="col-default"><span><?php /* @escapeNotVerified */ echo __('Is Default') ?></span></th>
21-
<th><span><?php /* @escapeNotVerified */ echo __('Swatch') ?></span></th>
20+
<th class="col-default"><span><?php echo $block->escapeHtml(__('Is Default')) ?></span></th>
21+
<th><span><?php echo $block->escapeHtml(__('Swatch')) ?></span></th>
2222
<?php foreach ($stores as $_store): ?>
2323
<th<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> class="_required"<?php endif; ?>>
24-
<span><?php /* @escapeNotVerified */ echo $_store->getName() ?></span>
24+
<span><?php echo $block->escapeHtml($_store->getName()) ?></span>
2525
</th>
2626
<?php endforeach;
2727
$colTotal = count($stores) * 2 + 3;
@@ -38,11 +38,12 @@ $stores = $block->getStoresSortedBySortOrder();
3838
</th>
3939
</tr>
4040
<tr>
41-
<th colspan="<?php /* @escapeNotVerified */ echo $colTotal; ?>" class="col-actions-add">
42-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
43-
<button id="add_new_swatch_visual_option_button" title="<?php /* @escapeNotVerified */ echo __('Add Swatch'); ?>"
41+
<th colspan="<?php echo (int)$colTotal; ?>" class="col-actions-add">
42+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
43+
<button id="add_new_swatch_visual_option_button"
44+
title="<?php echo $block->escapeHtml(__('Add Swatch')); ?>"
4445
type="button" class="action- scalable add">
45-
<span><?php /* @escapeNotVerified */ echo __('Add Swatch'); ?></span>
46+
<span><?php echo $block->escapeHtml(__('Add Swatch')); ?></span>
4647
</button>
4748
<?php endif; ?>
4849
</th>
@@ -55,7 +56,8 @@ $stores = $block->getStoresSortedBySortOrder();
5556
<tr>
5657
<td class="col-draggable">
5758
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
58-
<div data-role="draggable-handle" class="draggable-handle" title="<?php /* @escapeNotVerified */ echo __('Sort Option'); ?>"></div>
59+
<div data-role="draggable-handle" class="draggable-handle"
60+
title="<?php echo $block->escapeHtml(__('Sort Option')); ?>"></div>
5961
<?php endif; ?>
6062
<input data-role="order" type="hidden" name="optionvisual[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/>
6163
</td>
@@ -69,33 +71,35 @@ $stores = $block->getStoresSortedBySortOrder();
6971
<div class="swatch_sub-menu_container" id="swatch_container_option_<%- data.id %>">
7072
<div class="swatch_row position-relative">
7173
<div class="swatch_row_name colorpicker_handler">
72-
<p><?php /* @escapeNotVerified */ echo __('Choose a color'); ?></p>
74+
<p><?php echo $block->escapeHtml(__('Choose a color')); ?></p>
7375
</div>
7476
</div>
7577
<div class="swatch_row">
7678
<div class="swatch_row_name btn_choose_file_upload" id="swatch_choose_file_option_<%- data.id %>">
77-
<p><?php /* @escapeNotVerified */ echo __('Upload a file'); ?></p>
79+
<p><?php echo $block->escapeHtml(__('Upload a file')); ?></p>
7880
</div>
7981
</div>
8082
<div class="swatch_row">
8183
<div class="swatch_row_name btn_remove_swatch">
82-
<p><?php /* @escapeNotVerified */ echo __('Clear'); ?></p>
84+
<p><?php echo $block->escapeHtml(__('Clear')); ?></p>
8385
</div>
8486
</div>
8587
</div>
8688
</td>
8789
<?php foreach ($stores as $_store): ?>
8890
<td class="swatch-col-<%- data.id %>">
89-
<input name="optionvisual[value][<%- data.id %>][<?php /* @escapeNotVerified */ echo $_store->getId() ?>]" value="<%- data.store<?php /* @escapeNotVerified */ echo $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option required-unique<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/>
91+
<input name="optionvisual[value][<%- data.id %>][<?php echo (int)$_store->getId() ?>]"
92+
value="<%- data.store<?php echo (int) $_store->getId() ?> %>"
93+
class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option required-unique<?php endif; ?>"
94+
type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/>
9095
</td>
9196
<?php endforeach; ?>
9297
<td id="delete_button_swatch_container_<%- data.id %>" class="col-delete">
9398
<input type="hidden" class="delete-flag" name="optionvisual[delete][<%- data.id %>]" value="" />
9499
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
95-
<button title="<?php /* @escapeNotVerified */ echo __('Delete') ?>" type="button"
96-
class="action- scalable delete delete-option"
97-
>
98-
<span><?php /* @escapeNotVerified */ echo __('Delete') ?></span>
100+
<button title="<?php echo $block->escapeHtml(__('Delete')) ?>" type="button"
101+
class="action- scalable delete delete-option">
102+
<span><?php echo $block->escapeHtml(__('Delete')) ?></span>
99103
</button>
100104
<?php endif;?>
101105
</td>
@@ -104,10 +108,10 @@ $stores = $block->getStoresSortedBySortOrder();
104108
<script type="text/x-magento-init">
105109
{
106110
"*": {
107-
"Magento_Swatches/js/visual": <?php /* @escapeNotVerified */ echo $block->getJsonConfig(); ?> ,
111+
"Magento_Swatches/js/visual": <?php /* @noEscape */ echo $block->getJsonConfig(); ?> ,
108112
"Magento_Catalog/catalog/product/attribute/unique-validate": {
109113
"element": "required-visual-swatch-unique",
110-
"message": "<?php echo __("The value of Admin must be unique.") ?>"
114+
"message": "<?php echo $block->escapeHtml(__("The value of Admin must be unique.")); ?>"
111115
}
112116
}
113117
}

0 commit comments

Comments
 (0)