Skip to content

Commit a53dd19

Browse files
Merge branch '2.4.2-develop' of https://github.com/magento-commerce/magento2ce into MCLOUD-7366
2 parents 072fc9c + f5f0a20 commit a53dd19

File tree

200 files changed

+37557
-32360
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+37557
-32360
lines changed

app/code/Magento/Backend/Block/Store/Switcher.php

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -449,14 +449,17 @@ public function hasScopeSelected()
449449
*/
450450
public function getCurrentSelectionName()
451451
{
452-
if (!($name = $this->getCurrentStoreName())) {
453-
if (!($name = $this->getCurrentStoreGroupName())) {
454-
if (!($name = $this->getCurrentWebsiteName())) {
455-
$name = $this->getDefaultSelectionName();
456-
}
457-
}
452+
if ($this->getCurrentStoreName() !== '') {
453+
return $this->getCurrentStoreName();
454+
}
455+
if ($this->getCurrentStoreGroupName() !== '') {
456+
return $this->getCurrentStoreGroupName();
458457
}
459-
return $name;
458+
459+
if ($this->getCurrentWebsiteName() !== '') {
460+
return $this->getCurrentWebsiteName();
461+
}
462+
return $this->getDefaultSelectionName();
460463
}
461464

462465
/**
@@ -473,6 +476,8 @@ public function getCurrentWebsiteName()
473476
return $website->getName();
474477
}
475478
}
479+
480+
return '';
476481
}
477482

478483
/**
@@ -489,6 +494,8 @@ public function getCurrentStoreGroupName()
489494
return $group->getName();
490495
}
491496
}
497+
498+
return '';
492499
}
493500

494501
/**
@@ -505,6 +512,8 @@ public function getCurrentStoreName()
505512
return $store->getName();
506513
}
507514
}
515+
516+
return '';
508517
}
509518

510519
/**
@@ -586,13 +595,11 @@ public function getHintHtml()
586595
$html = '';
587596
$url = $this->getHintUrl();
588597
if ($url) {
589-
$html = '<div class="admin__field-tooltip tooltip">' . '<a' . ' href="' . $this->escapeUrl(
590-
$url
591-
) . '"' . ' onclick="this.target=\'_blank\'"' . ' title="' . __(
592-
'What is this?'
593-
) . '"' . ' class="admin__field-tooltip-action action-help"><span>' . __(
594-
'What is this?'
595-
) . '</span></a>' . ' </div>';
598+
$html = '<div class="admin__field-tooltip tooltip"><a href="%s" onclick="this.target=\'_blank\'" title="%s"
599+
class="admin__field-tooltip-action action-help"><span>%s</span></a></span></div>';
600+
$title = $this->escapeHtmlAttr(__('What is this?'));
601+
$span= $this->escapeHtml(__('What is this?'));
602+
$html = sprintf($html, $this->escapeUrl($url), $title, $span);
596603
}
597604
return $html;
598605
}

app/code/Magento/Backend/Block/Widget.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
class Widget extends \Magento\Backend\Block\Template
1616
{
1717
/**
18+
* Get ID
19+
*
1820
* @return string
1921
*/
2022
public function getId()
@@ -37,6 +39,8 @@ public function getSuffixId($suffix)
3739
}
3840

3941
/**
42+
* Get HTML ID
43+
*
4044
* @return string
4145
*/
4246
public function getHtmlId()
@@ -59,6 +63,8 @@ public function getCurrentUrl($params = [])
5963
}
6064

6165
/**
66+
* Prepare Breadcrumbs
67+
*
6268
* @param string $label
6369
* @param string|null $title
6470
* @param string|null $link
@@ -84,7 +90,13 @@ public function getButtonHtml($label, $onclick, $class = '', $buttonId = null, $
8490
return $this->getLayout()->createBlock(
8591
\Magento\Backend\Block\Widget\Button::class
8692
)->setData(
87-
['label' => $label, 'onclick' => $onclick, 'class' => $class, 'type' => 'button', 'id' => $buttonId]
93+
[
94+
'label' => $label,
95+
'onclick' => $onclick,
96+
'class' => $class,
97+
'type' => 'button',
98+
'id' => $buttonId
99+
]
88100
)->setDataAttribute(
89101
$dataAttr
90102
)->toHtml();

app/code/Magento/Backend/Test/Mftf/Test/AdminExpireCustomerSessionTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<after>
2323
<!-- 6. Restore default configuration settings. -->
2424
<magentoCLI command="config:set {{DefaultWebCookieLifetimeConfigData.path}} {{DefaultWebCookieLifetimeConfigData.value}}" stepKey="setDefaultCookieLifetime"/>
25+
<!-- Customer Log Out -->
26+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
2527
<!-- Delete data -->
2628
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
2729
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function getOptionHtml(Option $option)
222222
{
223223
$optionBlock = $this->getChildBlock($option->getType());
224224
if (!$optionBlock) {
225-
return __('There is no defined renderer for "%1" option type.', $option->getType());
225+
return __('There is no defined renderer for "%1" option type.', $this->escapeHtml($option->getType()));
226226
}
227227
return $optionBlock->setOption($option)->toHtml();
228228
}
@@ -411,15 +411,18 @@ private function processOptions(string $optionId, array $options, DataObject $pr
411411
{
412412
$preConfiguredQtys = $preConfiguredValues->getData("bundle_option_qty/${optionId}") ?? [];
413413
$selections = $options[$optionId]['selections'];
414-
array_walk($selections, function (&$selection, $selectionId) use ($preConfiguredQtys) {
415-
if (is_array($preConfiguredQtys) && isset($preConfiguredQtys[$selectionId])) {
416-
$selection['qty'] = $preConfiguredQtys[$selectionId];
417-
} else {
418-
if ((int)$preConfiguredQtys > 0) {
419-
$selection['qty'] = $preConfiguredQtys;
414+
array_walk(
415+
$selections,
416+
function (&$selection, $selectionId) use ($preConfiguredQtys) {
417+
if (is_array($preConfiguredQtys) && isset($preConfiguredQtys[$selectionId])) {
418+
$selection['qty'] = $preConfiguredQtys[$selectionId];
419+
} else {
420+
if ((int)$preConfiguredQtys > 0) {
421+
$selection['qty'] = $preConfiguredQtys;
422+
}
420423
}
421424
}
422-
});
425+
);
423426
$options[$optionId]['selections'] = $selections;
424427

425428
return $options;

app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Magento\Catalog\Pricing\Price\RegularPrice;
2222
use Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor;
2323
use Magento\Framework\DataObject;
24+
use Magento\Framework\Escaper;
2425
use Magento\Framework\Event\ManagerInterface;
2526
use Magento\Framework\Json\Encoder;
2627
use Magento\Framework\Pricing\Amount\AmountInterface;
@@ -66,6 +67,11 @@ class BundleTest extends TestCase
6667
*/
6768
private $bundleBlock;
6869

70+
/**
71+
* @var Escaper|MockObject
72+
*/
73+
private $escaperMock;
74+
6975
protected function setUp(): void
7076
{
7177
$objectHelper = new ObjectManager($this);
@@ -103,6 +109,9 @@ protected function setUp(): void
103109
$this->catalogProduct = $this->getMockBuilder(Product::class)
104110
->disableOriginalConstructor()
105111
->getMock();
112+
$this->escaperMock = $this->getMockBuilder(Escaper::class)
113+
->disableOriginalConstructor()
114+
->getMock();
106115
/** @var BundleBlock $bundleBlock */
107116
$this->bundleBlock = $objectHelper->getObject(
108117
\Magento\Bundle\Block\Catalog\Product\View\Type\Bundle::class,
@@ -111,7 +120,8 @@ protected function setUp(): void
111120
'eventManager' => $this->eventManager,
112121
'jsonEncoder' => $this->jsonEncoder,
113122
'productPrice' => $this->bundleProductPriceFactory,
114-
'catalogProduct' => $this->catalogProduct
123+
'catalogProduct' => $this->catalogProduct,
124+
'escaper' => $this->escaperMock,
115125
]
116126
);
117127

@@ -133,16 +143,16 @@ public function testGetOptionHtmlNoRenderer()
133143
->disableOriginalConstructor()
134144
->getMock();
135145
$option->expects($this->any())->method('getType')->willReturn('checkbox');
136-
146+
$this->escaperMock->expects($this->once())->method('escapeHtml')->willReturn('checkbox');
147+
$expected='There is no defined renderer for "checkbox" option type.';
137148
$layout = $this->getMockBuilder(Layout::class)
138149
->setMethods(['getChildName', 'getBlock'])
139150
->disableOriginalConstructor()
140151
->getMock();
141152
$layout->expects($this->any())->method('getChildName')->willReturn(false);
142153
$this->bundleBlock->setLayout($layout);
143-
144154
$this->assertEquals(
145-
'There is no defined renderer for "checkbox" option type.',
155+
$expected,
146156
$this->bundleBlock->getOptionHtml($option)
147157
);
148158
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Captcha\Api;
9+
10+
/**
11+
* Interface contains methods for post processing and modifies client-side CAPTCHA config
12+
*/
13+
interface CaptchaConfigPostProcessorInterface
14+
{
15+
/**
16+
* Filters the data object by a filter list
17+
*
18+
* @param array $config
19+
* @return array
20+
*/
21+
public function process(array $config): array;
22+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Captcha\Model\Filter;
9+
10+
use Magento\Captcha\Api\CaptchaConfigPostProcessorInterface;
11+
12+
/**
13+
* Composite class for post processing captcha configuration
14+
*/
15+
class CaptchaConfigPostProcessorComposite implements CaptchaConfigPostProcessorInterface
16+
{
17+
/**
18+
* @var CaptchaConfigPostProcessorInterface[] $processors
19+
*/
20+
private $processors = [];
21+
22+
/**
23+
* @param CaptchaConfigPostProcessorInterface[] $processors
24+
*/
25+
public function __construct(
26+
$processors = []
27+
) {
28+
$this->processors = $processors;
29+
}
30+
31+
/**
32+
* Loops through all leafs of the composite and calls process method
33+
*
34+
* @param array $config
35+
* @return array
36+
*/
37+
public function process(array $config): array
38+
{
39+
$result = [];
40+
foreach ($this->processors as $processor) {
41+
$result = array_merge_recursive($result, $processor->process($config));
42+
}
43+
return $result;
44+
}
45+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Captcha\Model\Filter;
9+
10+
use Magento\Captcha\Api\CaptchaConfigPostProcessorInterface;
11+
12+
/**
13+
* Class QuoteDataConfigFilter used for filtering config quote data based on filter list
14+
*/
15+
class QuoteDataConfigFilter implements CaptchaConfigPostProcessorInterface
16+
{
17+
/**
18+
* @var array $filterList
19+
*/
20+
private $filterList;
21+
22+
/**
23+
* @param array $filterList
24+
*/
25+
public function __construct(
26+
array $filterList = []
27+
) {
28+
$this->filterList = $filterList;
29+
}
30+
31+
/**
32+
* Filters the quote config with values from a filter list
33+
*
34+
* @param array $config
35+
* @return array
36+
*/
37+
public function process(array $config): array
38+
{
39+
foreach ($this->filterList as $filterKey) {
40+
/** @var string $filterKey */
41+
if (isset($config['quoteData']) && array_key_exists($filterKey, $config['quoteData'])) {
42+
unset($config['quoteData'][$filterKey]);
43+
}
44+
}
45+
return $config;
46+
}
47+
}

0 commit comments

Comments
 (0)