Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit e324c0d

Browse files
authored
Merge pull request #7 from magento/2.2-develop
2.2 dev sync
2 parents d91c0c0 + cc4b174 commit e324c0d

File tree

238 files changed

+3590
-902
lines changed

Some content is hidden

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

238 files changed

+3590
-902
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ To learn more about issue gate labels click [here](https://github.com/magento/ma
5858

5959
<h2>Reporting security issues</h2>
6060

61-
To report security vulnerabilities in Magento software or web sites, please e-mail <a href="mailto:[email protected]">[email protected]</a>. Please do not report security issues using GitHub. Be sure to encrypt your e-mail with our <a href="https://info2.magento.com/rs/magentoenterprise/images/security_at_magento.asc">encryption key</a> if it includes sensitive information. Learn more about reporting security issues <a href="https://magento.com/security/reporting-magento-security-issue">here</a>.
61+
To report security vulnerabilities in Magento software or web sites, please create a Bugcrowd researcher account <a href="https://bugcrowd.com/magento">there</a> to submit and follow-up your issue. Learn more about reporting security issues <a href="https://magento.com/security/reporting-magento-security-issue">here</a>.
6262

6363
Stay up-to-date on the latest security news and patches for Magento by signing up for <a href="https://magento.com/security/sign-up">Security Alert Notifications</a>.
6464

app/code/Magento/Backend/App/Config.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ public function isSetFlag($path)
6868
if ($path) {
6969
$configPath .= '/' . $path;
7070
}
71-
return (bool) $this->appConfig->get(System::CONFIG_TYPE, $configPath);
71+
return (bool)$this->appConfig->get(System::CONFIG_TYPE, $configPath);
7272
}
7373
}

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public function getValue($index = null)
2626
{
2727
if ($index) {
2828
if ($data = $this->getData('value', 'orig_' . $index)) {
29-
// date('Y-m-d', strtotime($data));
3029
return $data;
3130
}
3231
return null;
@@ -154,7 +153,7 @@ public function getEscapedValue($index = null)
154153
if (is_string($value)) {
155154
return $this->escapeHtml($value);
156155
}
157-
156+
158157
return $value;
159158
}
160159

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function render(DataObject $row)
5858
$result .= $this->getColumn()->getEditOnly() ? ''
5959
: '<span class="admin__grid-control-value">' . $this->_getValue($row) . '</span>';
6060

61-
return $result . $this->_getInputValueElement($row) . '</div>' ;
61+
return $result . $this->_getInputValueElement($row) . '</div>';
6262
}
6363
return $this->_getValue($row);
6464
}

app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,13 @@ public function getGridIdsJson()
276276
}
277277
/** @var \Magento\Framework\Data\Collection $allIdsCollection */
278278
$allIdsCollection = clone $this->getParentBlock()->getCollection();
279-
279+
280280
if ($this->getMassactionIdField()) {
281281
$massActionIdField = $this->getMassactionIdField();
282282
} else {
283283
$massActionIdField = $this->getParentBlock()->getMassactionIdField();
284284
}
285-
285+
286286
$gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField);
287287
if (!empty($gridIds)) {
288288
return join(",", $gridIds);

app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,13 @@ public function getGridIdsJson()
273273

274274
/** @var \Magento\Framework\Data\Collection $allIdsCollection */
275275
$allIdsCollection = clone $this->getParentBlock()->getCollection();
276-
276+
277277
if ($this->getMassactionIdField()) {
278278
$massActionIdField = $this->getMassactionIdField();
279279
} else {
280280
$massActionIdField = $this->getParentBlock()->getMassactionIdField();
281281
}
282-
282+
283283
$gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField);
284284

285285
if (!empty($gridIds)) {

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

+94-19
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public function addTab($tabId, $tab)
117117
if (empty($tabId)) {
118118
throw new \Exception(__('Please correct the tab configuration and try again. Tab Id should be not empty'));
119119
}
120+
120121
if (is_array($tab)) {
121122
$this->_tabs[$tabId] = new \Magento\Framework\DataObject($tab);
122123
} elseif ($tab instanceof \Magento\Framework\DataObject) {
@@ -126,13 +127,15 @@ public function addTab($tabId, $tab)
126127
}
127128
} elseif (is_string($tab)) {
128129
$this->_addTabByName($tab, $tabId);
130+
129131
if (!$this->_tabs[$tabId] instanceof TabInterface) {
130132
unset($this->_tabs[$tabId]);
131133
return $this;
132134
}
133135
} else {
134136
throw new \Exception(__('Please correct the tab configuration and try again.'));
135137
}
138+
136139
if ($this->_tabs[$tabId]->getUrl() === null) {
137140
$this->_tabs[$tabId]->setUrl('#');
138141
}
@@ -143,10 +146,7 @@ public function addTab($tabId, $tab)
143146

144147
$this->_tabs[$tabId]->setId($tabId);
145148
$this->_tabs[$tabId]->setTabId($tabId);
146-
147-
if ($this->_activeTab === null) {
148-
$this->_activeTab = $tabId;
149-
}
149+
150150
if (true === $this->_tabs[$tabId]->getActive()) {
151151
$this->setActiveTab($tabId);
152152
}
@@ -235,33 +235,108 @@ protected function _setActiveTab($tabId)
235235
*/
236236
protected function _beforeToHtml()
237237
{
238+
$this->_tabs = $this->reorderTabs();
239+
238240
if ($activeTab = $this->getRequest()->getParam('active_tab')) {
239241
$this->setActiveTab($activeTab);
240242
} elseif ($activeTabId = $this->_authSession->getActiveTabId()) {
241243
$this->_setActiveTab($activeTabId);
242244
}
243245

244-
$_new = [];
246+
if ($this->_activeTab === null && !empty($this->_tabs)) {
247+
/** @var TabInterface $tab */
248+
$this->_activeTab = (reset($this->_tabs))->getId();
249+
}
250+
251+
$this->assign('tabs', $this->_tabs);
252+
return parent::_beforeToHtml();
253+
}
254+
255+
/**
256+
* Reorder the tabs.
257+
*
258+
* @return array
259+
*/
260+
private function reorderTabs()
261+
{
262+
$orderByIdentity = [];
263+
$orderByPosition = [];
264+
$position = 100;
265+
266+
/**
267+
* Set the initial positions for each tab.
268+
*
269+
* @var string $key
270+
* @var TabInterface $tab
271+
*/
245272
foreach ($this->_tabs as $key => $tab) {
246-
foreach ($this->_tabs as $k => $t) {
247-
if ($t->getAfter() == $key) {
248-
$_new[$key] = $tab;
249-
$_new[$k] = $t;
250-
} else {
251-
if (!$tab->getAfter() || !in_array($tab->getAfter(), array_keys($this->_tabs))) {
252-
$_new[$key] = $tab;
253-
}
254-
}
255-
}
273+
$tab->setPosition($position);
274+
275+
$orderByIdentity[$key] = $tab;
276+
$orderByPosition[$position] = $tab;
277+
278+
$position += 100;
256279
}
257280

258-
$this->_tabs = $_new;
259-
unset($_new);
281+
return $this->applyTabsCorrectOrder($orderByPosition, $orderByIdentity);
282+
}
283+
284+
/**
285+
* @param array $orderByPosition
286+
* @param array $orderByIdentity
287+
*
288+
* @return array
289+
*/
290+
private function applyTabsCorrectOrder(array $orderByPosition, array $orderByIdentity)
291+
{
292+
$positionFactor = 1;
293+
294+
/**
295+
* Rearrange the positions by using the after tag for each tab.
296+
*
297+
* @var integer $position
298+
* @var TabInterface $tab
299+
*/
300+
foreach ($orderByPosition as $position => $tab) {
301+
if (!$tab->getAfter() || !in_array($tab->getAfter(), array_keys($orderByIdentity))) {
302+
$positionFactor = 1;
303+
continue;
304+
}
305+
306+
$grandPosition = $orderByIdentity[$tab->getAfter()]->getPosition();
307+
$newPosition = $grandPosition + $positionFactor;
260308

261-
$this->assign('tabs', $this->_tabs);
262-
return parent::_beforeToHtml();
309+
unset($orderByPosition[$position]);
310+
$orderByPosition[$newPosition] = $tab;
311+
$tab->setPosition($newPosition);
312+
313+
$positionFactor++;
314+
}
315+
316+
return $this->finalTabsSortOrder($orderByPosition);
263317
}
264318

319+
/**
320+
* Apply the last sort order to tabs.
321+
*
322+
* @param array $orderByPosition
323+
*
324+
* @return array
325+
*/
326+
private function finalTabsSortOrder(array $orderByPosition)
327+
{
328+
ksort($orderByPosition);
329+
330+
$ordered = [];
331+
332+
/** @var TabInterface $tab */
333+
foreach ($orderByPosition as $tab) {
334+
$ordered[$tab->getId()] = $tab;
335+
}
336+
337+
return $ordered;
338+
}
339+
265340
/**
266341
* @return string
267342
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminPromptModalSection">
12+
<element name="promptField" type="input" selector="input[data-role='promptField']"/>
13+
<element name="modalOk" type="button" selector="aside.prompt .modal-footer button.action-accept" timeout="30"/>
14+
</section>
15+
</sections>

app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Dashboard/AbstractTestCase.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ protected function assertExecute($controllerName, $blockName)
2121
{
2222
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
2323
$outPut = "data";
24-
$resultRawMock = $this->createPartialMock(\Magento\Framework\Controller\Result\Raw::class, ['setContents'])
25-
;
24+
$resultRawMock = $this->createPartialMock(\Magento\Framework\Controller\Result\Raw::class, ['setContents']);
2625
$resultRawFactoryMock =
2726
$this->createPartialMock(\Magento\Framework\Controller\Result\RawFactory::class, ['create']);
2827
$layoutFactoryMock = $this->createPartialMock(\Magento\Framework\View\LayoutFactory::class, ['create']);

app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<?= /* @escapeNotVerified */ $edition ?>
1818
class="logo">
1919
<img class="logo-img" src="<?= /* @escapeNotVerified */ $block->getViewFileUrl($logoSrc) ?>"
20-
alt="<?= $block->escapeHtml(__('Magento Admin Panel')) ?>"/>
20+
alt="<?= $block->escapeHtml(__('Magento Admin Panel')) ?>" title="<?= $block->escapeHtml(__('Magento Admin Panel')) ?>"/>
2121
</a>
2222
<?php break; ?>
2323
<?php case 'user': ?>

app/code/Magento/Backend/view/adminhtml/templates/widget/form/element/gallery.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<?php foreach ($block->getValues()->getAttributeBackend()->getImageTypes() as $type): ?>
3535
<td class="gallery" align="center" style="vertical-align:bottom;">
3636
<a href="<?= /* @escapeNotVerified */ $image->setType($type)->getSourceUrl() ?>" target="_blank" onclick="imagePreview('<?= $block->getElement()->getHtmlId() ?>_image_<?= /* @escapeNotVerified */ $type ?>_<?= /* @escapeNotVerified */ $image->getValueId() ?>');return false;">
37-
<img id="<?= $block->getElement()->getHtmlId() ?>_image_<?= /* @escapeNotVerified */ $type ?>_<?= /* @escapeNotVerified */ $image->getValueId() ?>" src="<?= /* @escapeNotVerified */ $image->setType($type)->getSourceUrl() ?>?<?= /* @escapeNotVerified */ time() ?>" alt="<?= /* @escapeNotVerified */ $image->getValue() ?>" height="25" class="small-image-preview v-middle"/></a><br/>
37+
<img id="<?= $block->getElement()->getHtmlId() ?>_image_<?= /* @escapeNotVerified */ $type ?>_<?= /* @escapeNotVerified */ $image->getValueId() ?>" src="<?= /* @escapeNotVerified */ $image->setType($type)->getSourceUrl() ?>?<?= /* @escapeNotVerified */ time() ?>" alt="<?= /* @escapeNotVerified */ $image->getValue() ?>" title="<?= /* @escapeNotVerified */ $image->getValue() ?>" height="25" class="small-image-preview v-middle"/></a><br/>
3838
<input type="file" name="<?= /* @escapeNotVerified */ $block->getElement()->getName() ?>_<?= /* @escapeNotVerified */ $type ?>[<?= /* @escapeNotVerified */ $image->getValueId() ?>]" size="1"></td>
3939
<?php endforeach; ?>
4040
<td class="gallery" align="center" style="vertical-align:bottom;"><input type="input" name="<?= /* @escapeNotVerified */ $block->getElement()->getParentName() ?>[position][<?= /* @escapeNotVerified */ $image->getValueId() ?>]" value="<?= /* @escapeNotVerified */ $image->getPosition() ?>" id="<?= $block->getElement()->getHtmlId() ?>_position_<?= /* @escapeNotVerified */ $image->getValueId() ?>" size="3"/></td>

app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
</select>
9393
</formElements>
9494
</field>
95-
<actionDelete template="Magento_Backend/dynamic-rows/cells/action-delete" sortOrder="50">
95+
<actionDelete template="Magento_Backend/dynamic-rows/cells/action-delete">
9696
<argument name="data" xsi:type="array">
9797
<item name="config" xsi:type="array">
9898
<item name="fit" xsi:type="boolean">false</item>

app/code/Magento/Backup/Model/ResourceModel/Db.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function getTableForeignKeysSql($tableName = null)
115115
}
116116

117117
/**
118-
* Return triggers fro table(s)
118+
* Return triggers for table(s)
119119
*
120120
* @param string|null $tableName
121121
* @param bool $addDropIfExists

app/code/Magento/Braintree/Gateway/Config/Config.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function getCountryAvailableCardTypes($country, $storeId = null)
131131
*/
132132
public function isCvvEnabled($storeId = null)
133133
{
134-
return (bool) $this->getValue(self::KEY_USE_CVV, $storeId);
134+
return (bool)$this->getValue(self::KEY_USE_CVV, $storeId);
135135
}
136136

137137
/**
@@ -142,7 +142,7 @@ public function isCvvEnabled($storeId = null)
142142
*/
143143
public function isVerify3DSecure($storeId = null)
144144
{
145-
return (bool) $this->getValue(self::KEY_VERIFY_3DSECURE, $storeId);
145+
return (bool)$this->getValue(self::KEY_VERIFY_3DSECURE, $storeId);
146146
}
147147

148148
/**
@@ -233,7 +233,7 @@ public function getSdkUrl()
233233
*/
234234
public function hasFraudProtection($storeId = null)
235235
{
236-
return (bool) $this->getValue(Config::FRAUD_PROTECTION, $storeId);
236+
return (bool)$this->getValue(Config::FRAUD_PROTECTION, $storeId);
237237
}
238238

239239
/**
@@ -244,7 +244,7 @@ public function hasFraudProtection($storeId = null)
244244
*/
245245
public function isActive($storeId = null)
246246
{
247-
return (bool) $this->getValue(self::KEY_ACTIVE, $storeId);
247+
return (bool)$this->getValue(self::KEY_ACTIVE, $storeId);
248248
}
249249

250250
/**

app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ public function __construct(
6060
*/
6161
public function isActive()
6262
{
63-
return (bool) $this->getValue(self::KEY_ACTIVE);
63+
return (bool)$this->getValue(self::KEY_ACTIVE);
6464
}
6565

6666
/**
6767
* @return bool
6868
*/
6969
public function isDisplayShoppingCart()
7070
{
71-
return (bool) $this->getValue(self::KEY_DISPLAY_ON_SHOPPING_CART);
71+
return (bool)$this->getValue(self::KEY_DISPLAY_ON_SHOPPING_CART);
7272
}
7373

7474
/**
@@ -78,7 +78,7 @@ public function isDisplayShoppingCart()
7878
*/
7979
public function isAllowToEditShippingAddress()
8080
{
81-
return (bool) $this->getValue(self::KEY_ALLOW_TO_EDIT_SHIPPING_ADDRESS);
81+
return (bool)$this->getValue(self::KEY_ALLOW_TO_EDIT_SHIPPING_ADDRESS);
8282
}
8383

8484
/**
@@ -117,7 +117,7 @@ public function getTitle()
117117
*/
118118
public function isSkipOrderReview()
119119
{
120-
return (bool) $this->getValue('skip_order_review');
120+
return (bool)$this->getValue('skip_order_review');
121121
}
122122

123123
/**

app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ $config = [
2929
class="action-braintree-paypal-logo" disabled>
3030
<img class="braintree-paypal-button-hidden"
3131
src="https://checkout.paypal.com/pwpp/2.17.6/images/pay-with-paypal.png"
32-
alt="Pay with PayPal"/>
32+
alt="<?= $block->escapeHtml(__('Pay with PayPal')) ?>"
33+
title="<?= $block->escapeHtml(__('Pay with PayPal')) ?>"/>
3334
</button>
3435
</div>

app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" />
1313
<label class="label" data-bind="attr: {'for': getCode()}">
1414
<!-- PayPal Logo -->
15-
<img data-bind="attr: {src: getPaymentAcceptanceMarkSrc(), alt: $t('Acceptance Mark')}"
15+
<img data-bind="attr: {src: getPaymentAcceptanceMarkSrc(), alt: $t('Acceptance Mark')}, title: $t('Acceptance Mark')}"
1616
class="payment-icon"/>
1717
<!-- PayPal Logo -->
1818
<span text="getTitle()"></span>

0 commit comments

Comments
 (0)