Skip to content

Commit 4989672

Browse files
committed
Merge branch 'develop' of https://github.com/magento/magento2ce into MPI-PR-develop
2 parents 956d4dc + 8c33f94 commit 4989672

File tree

139 files changed

+1276
-710
lines changed

Some content is hidden

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

139 files changed

+1276
-710
lines changed

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/checkbox.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<input class="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?> checkbox product bundle option change-container-classname"
3030
id="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?>-<?php /* @escapeNotVerified */ echo $_selection->getSelectionId() ?>"
3131
type="checkbox"
32-
<?php if ($_option->getRequired()) echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^=&quot;bundle_option[' . $_option->getId() . ']&quot;]:checked\'}"'?>
32+
<?php if ($_option->getRequired()) /* @escapeNotVerified */ echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^=&quot;bundle_option[' . $_option->getId() . ']&quot;]:checked\'}"'?>
3333
name="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>][<?php /* @escapeNotVerified */ echo $_selection->getId() ?>]"
3434
data-selector="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>][<?php /* @escapeNotVerified */ echo $_selection->getId() ?>]"
3535
<?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?>

app/code/Magento/Captcha/view/adminhtml/templates/default.phtml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66

77
// @codingStandardsIgnoreFile
88

9+
/** @var \Magento\Captcha\Block\Captcha\DefaultCaptcha $block */
10+
11+
/** @var \Magento\Captcha\Model\DefaultModel $captcha */
12+
$captcha = $block->getCaptchaModel();
913
?>
10-
<?php /* @var $captcha \Magento\Captcha\Model\DefaultModel */ ?>
11-
<?php /* @var $block \Magento\Captcha\Block\Captcha\DefaultCaptcha */ ?>
12-
<?php $captcha = $block->getCaptchaModel() ?>
1314
<div class="admin__field _required">
1415
<label for="captcha" class="admin__field-label">
15-
<span><?php /* @escapeNotVerified */ echo __('Please enter the letters from the image') ?></span>
16+
<span><?php echo $block->escapeHtml(__('Please enter the letters from the image')) ?></span>
1617
</label>
1718
<div class="admin__field-control">
1819
<input
@@ -23,7 +24,7 @@
2324
data-validate="{required:true}"/>
2425
<?php if ($captcha->isCaseSensitive()) :?>
2526
<div class="admin__field-note">
26-
<span><?php /* @escapeNotVerified */ echo __('<strong>Attention</strong>: Captcha is case sensitive.') ?></span>
27+
<span><?php echo $block->escapeHtml(__('<strong>Attention</strong>: Captcha is case sensitive.'), ['strong']) ?></span>
2728
</div>
2829
<?php endif; ?>
2930
</div>
@@ -33,7 +34,7 @@
3334
id="captcha-reload"
3435
class="captcha-reload"
3536
src="<?php echo $block->escapeUrl($block->getViewFileUrl('Magento_Captcha::reload.png')) ?>"
36-
alt="<?php /* @escapeNotVerified */ echo __('Reload captcha') ?>"/>
37+
alt="<?php echo $block->escapeHtmlAttr(__('Reload captcha')) ?>"/>
3738
<img
3839
id="<?php echo $block->escapeHtmlAttr($block->getFormId()) ?>"
3940
width="<?php /* @noEscape */ echo (float) $block->getImgWidth() ?>"
@@ -44,7 +45,7 @@
4445
require(["prototype", "mage/captcha"], function(){
4546

4647
//<![CDATA[
47-
var captcha = new Captcha('<?php echo $block->escapeUrl($block->getRefreshUrl()) ?>', '<?php echo $block->escapeJs($block->getFormId()) ?>');
48+
var captcha = new Captcha('<?php echo $block->escapeJs($block->escapeUrl($block->getRefreshUrl())) ?>', '<?php echo $block->escapeJs($block->escapeHtml($block->getFormId())) ?>');
4849

4950
$('captcha-reload').observe('click', function () {
5051
captcha.refresh(this);

app/code/Magento/Captcha/view/frontend/templates/default.phtml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
// @codingStandardsIgnoreFile
88

9+
/** @var \Magento\Captcha\Block\Captcha\DefaultCaptcha $block */
10+
11+
/** @var \Magento\Captcha\Model\DefaultModel $captcha */
12+
$captcha = $block->getCaptchaModel();
913
?>
10-
<?php /* @var $captcha \Magento\Captcha\Model\DefaultModel */ ?>
11-
<?php /* @var $block \Magento\Captcha\Block\Captcha\DefaultCaptcha */ ?>
12-
<?php $captcha = $block->getCaptchaModel() ?>
1314
<div class="field captcha required" role="<?php echo $block->escapeHtmlAttr($block->getFormId())?>">
14-
<label for="captcha_<?php echo $block->escapeHtmlAttr($block->getFormId()) ?>" class="label"><span><?php /* @escapeNotVerified */ echo __('Please type the letters below')?></span></label>
15+
<label for="captcha_<?php echo $block->escapeHtmlAttr($block->getFormId()) ?>" class="label"><span><?php echo $block->escapeHtml(__('Please type the letters below')) ?></span></label>
1516
<div class="control captcha">
1617
<input name="<?php echo $block->escapeHtmlAttr(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE) ?>[<?php echo $block->escapeHtmlAttr($block->getFormId())?>]" type="text" class="input-text required-entry" data-validate="{required:true}" id="captcha_<?php echo $block->escapeHtmlAttr($block->getFormId()) ?>" />
1718
<div class="nested">
@@ -22,13 +23,13 @@
2223
"imageLoader": "<?php echo $block->escapeUrl($block->getViewFileUrl('images/loader-2.gif')) ?>",
2324
"type": "<?php echo $block->escapeHtmlAttr($block->getFormId()) ?>"}}'>
2425
<div class="control captcha-image">
25-
<img alt="<?php /* @escapeNotVerified */ echo __('Please type the letters below')?>" class="captcha-img" height="<?php /* @noEscape */ echo (float) $block->getImgHeight() ?>" src="<?php echo $block->escapeUrl($captcha->getImgSrc()) ?>"/>
26-
<button type="button" class="action reload captcha-reload" title="<?php /* @escapeNotVerified */ echo __('Reload captcha') ?>"><span><?php /* @escapeNotVerified */ echo __('Reload captcha') ?></span></button>
26+
<img alt="<?php echo $block->escapeHtmlAttr(__('Please type the letters below')) ?>" class="captcha-img" height="<?php /* @noEscape */ echo (float) $block->getImgHeight() ?>" src="<?php echo $block->escapeUrl($captcha->getImgSrc()) ?>"/>
27+
<button type="button" class="action reload captcha-reload" title="<?php echo $block->escapeHtmlAttr(__('Reload captcha')) ?>"><span><?php echo $block->escapeHtml(__('Reload captcha')) ?></span></button>
2728
</div>
2829
</div>
2930
<?php if ($captcha->isCaseSensitive()) :?>
3031
<div class="captcha-note note">
31-
<?php /* @escapeNotVerified */ echo __('<strong>Attention</strong>: Captcha is case sensitive.') ?>
32+
<?php echo $block->escapeHtml(__('<strong>Attention</strong>: Captcha is case sensitive.'), ['strong']) ?>
3233
</div>
3334
<?php endif; ?>
3435
</div>

app/code/Magento/Catalog/view/base/web/js/price-box.js

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright © 2016 Magento. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
define([
67
'jquery',
78
'Magento_Catalog/js/price-utils',
@@ -29,6 +30,7 @@ define([
2930
*/
3031
_init: function initPriceBox() {
3132
var box = this.element;
33+
3234
box.trigger('updatePrice');
3335
this.cache.displayPrices = utils.deepClone(this.options.prices);
3436
},
@@ -70,7 +72,8 @@ define([
7072
updatePrice: function updatePrice(newPrices) {
7173
var prices = this.cache.displayPrices,
7274
additionalPrice = {},
73-
pricesCode = [];
75+
pricesCode = [],
76+
priceValue, origin, finalPrice;
7477

7578
this.cache.additionalPriceObject = this.cache.additionalPriceObject || {};
7679

@@ -89,19 +92,19 @@ define([
8992
pricesCode = _.keys(additional);
9093
}
9194
_.each(pricesCode, function (priceCode) {
92-
var priceValue = additional[priceCode] || {};
95+
priceValue = additional[priceCode] || {};
9396
priceValue.amount = +priceValue.amount || 0;
9497
priceValue.adjustments = priceValue.adjustments || {};
9598

9699
additionalPrice[priceCode] = additionalPrice[priceCode] || {
97-
'amount': 0,
98-
'adjustments': {}
99-
};
100-
additionalPrice[priceCode].amount = 0 + (additionalPrice[priceCode].amount || 0)
101-
+ priceValue.amount;
100+
'amount': 0,
101+
'adjustments': {}
102+
};
103+
additionalPrice[priceCode].amount = 0 + (additionalPrice[priceCode].amount || 0) +
104+
priceValue.amount;
102105
_.each(priceValue.adjustments, function (adValue, adCode) {
103-
additionalPrice[priceCode].adjustments[adCode] = 0
104-
+ (additionalPrice[priceCode].adjustments[adCode] || 0) + adValue;
106+
additionalPrice[priceCode].adjustments[adCode] = 0 +
107+
(additionalPrice[priceCode].adjustments[adCode] || 0) + adValue;
105108
});
106109
});
107110
});
@@ -110,23 +113,24 @@ define([
110113
this.cache.displayPrices = utils.deepClone(this.options.prices);
111114
} else {
112115
_.each(additionalPrice, function (option, priceCode) {
113-
var origin = this.options.prices[priceCode] || {},
114-
final = prices[priceCode] || {};
116+
origin = this.options.prices[priceCode] || {};
117+
finalPrice = prices[priceCode] || {};
115118
option.amount = option.amount || 0;
116119
origin.amount = origin.amount || 0;
117120
origin.adjustments = origin.adjustments || {};
118-
final.adjustments = final.adjustments || {};
121+
finalPrice.adjustments = finalPrice.adjustments || {};
119122

120-
final.amount = 0 + origin.amount + option.amount;
123+
finalPrice.amount = 0 + origin.amount + option.amount;
121124
_.each(option.adjustments, function (pa, paCode) {
122-
final.adjustments[paCode] = 0 + (origin.adjustments[paCode] || 0) + pa;
125+
finalPrice.adjustments[paCode] = 0 + (origin.adjustments[paCode] || 0) + pa;
123126
});
124127
}, this);
125128
}
126129

127130
this.element.trigger('reloadPrice');
128131
},
129132

133+
/*eslint-disable no-extra-parens*/
130134
/**
131135
* Render price unit block.
132136
*/
@@ -135,16 +139,19 @@ define([
135139
priceTemplate = mageTemplate(this.options.priceTemplate);
136140

137141
_.each(this.cache.displayPrices, function (price, priceCode) {
138-
price.final = _.reduce(price.adjustments, function(memo, amount) {
142+
price.final = _.reduce(price.adjustments, function (memo, amount) {
139143
return memo + amount;
140144
}, price.amount);
141145

142146
price.formatted = utils.formatPrice(price.final, priceFormat);
143147

144-
$('[data-price-type="' + priceCode + '"]', this.element).html(priceTemplate({data: price}));
148+
$('[data-price-type="' + priceCode + '"]', this.element).html(priceTemplate({
149+
data: price
150+
}));
145151
}, this);
146152
},
147153

154+
/*eslint-enable no-extra-parens*/
148155
/**
149156
* Overwrites initial (default) prices object.
150157
* @param {Object} prices
@@ -177,6 +184,7 @@ define([
177184
var box = this.element,
178185
priceHolders = $('[data-price-type]', box),
179186
prices = this.options.prices;
187+
180188
this.options.productId = box.data('productId');
181189

182190
if (_.isEmpty(prices)) {
@@ -199,10 +207,7 @@ define([
199207
_setDefaultsFromPriceConfig: function _setDefaultsFromPriceConfig() {
200208
var config = this.options.priceConfig;
201209

202-
if (config) {
203-
if (+config.productId !== +this.options.productId) {
204-
return;
205-
}
210+
if (config && config.prices) {
206211
this.options.prices = config.prices;
207212
}
208213
}

app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ define([
9797
addToCartCalls++;
9898
self.isLoading(true);
9999
});
100-
101-
if (cartData().websiteId !== window.checkout.websiteId) {
100+
if (cartData().website_id !== window.checkout.websiteId) {
102101
customerData.reload(['cart'], false);
103102
}
104103

app/code/Magento/Contact/view/frontend/templates/form.phtml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,48 @@
55
*/
66

77
// @codingStandardsIgnoreFile
8-
8+
/** @var \Magento\Contact\Block\ContactForm $block */
99
?>
10-
<?php /** @var $block \Magento\Contact\Block\ContactForm */ ?>
1110
<form class="form contact"
1211
action="<?php echo $block->escapeUrl($block->getFormAction()); ?>"
1312
id="contact-form"
1413
method="post"
15-
data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>"
14+
data-hasrequired="<?php echo $block->escapeHtmlAttr(__('* Required Fields')) ?>"
1615
data-mage-init='{"validation":{}}'>
1716
<fieldset class="fieldset">
18-
<legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Write Us') ?></span></legend><br />
19-
<div class="field note no-label"><?php /* @escapeNotVerified */ echo __('Jot us a note and we’ll get back to you as quickly as possible.') ?></div>
17+
<legend class="legend"><span><?php echo $block->escapeHtml(__('Write Us')) ?></span></legend><br />
18+
<div class="field note no-label"><?php echo $block->escapeHtml(__('Jot us a note and we’ll get back to you as quickly as possible.')) ?></div>
2019
<div class="field name required">
21-
<label class="label" for="name"><span><?php /* @escapeNotVerified */ echo __('Name') ?></span></label>
20+
<label class="label" for="name"><span><?php echo $block->escapeHtml(__('Name')) ?></span></label>
2221
<div class="control">
23-
<input name="name" id="name" title="<?php /* @escapeNotVerified */ echo __('Name') ?>" value="<?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getPostValue('name') ?: $this->helper('Magento\Contact\Helper\Data')->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/>
22+
<input name="name" id="name" title="<?php echo $block->escapeHtmlAttr(__('Name')) ?>" value="<?php echo $block->escapeHtmlAttr($this->helper('Magento\Contact\Helper\Data')->getPostValue('name') ?: $this->helper('Magento\Contact\Helper\Data')->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/>
2423
</div>
2524
</div>
2625
<div class="field email required">
27-
<label class="label" for="email"><span><?php /* @escapeNotVerified */ echo __('Email') ?></span></label>
26+
<label class="label" for="email"><span><?php echo $block->escapeHtml(__('Email')) ?></span></label>
2827
<div class="control">
29-
<input name="email" id="email" title="<?php /* @escapeNotVerified */ echo __('Email') ?>" value="<?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getPostValue('email') ?: $this->helper('Magento\Contact\Helper\Data')->getUserEmail()) ?>" class="input-text" type="email" data-validate="{required:true, 'validate-email':true}"/>
28+
<input name="email" id="email" title="<?php echo $block->escapeHtmlAttr(__('Email')) ?>" value="<?php echo $block->escapeHtmlAttr($this->helper('Magento\Contact\Helper\Data')->getPostValue('email') ?: $this->helper('Magento\Contact\Helper\Data')->getUserEmail()) ?>" class="input-text" type="email" data-validate="{required:true, 'validate-email':true}"/>
3029
</div>
3130
</div>
3231
<div class="field telephone">
33-
<label class="label" for="telephone"><span><?php /* @escapeNotVerified */ echo __('Phone Number') ?></span></label>
32+
<label class="label" for="telephone"><span><?php echo $block->escapeHtml(__('Phone Number')) ?></span></label>
3433
<div class="control">
35-
<input name="telephone" id="telephone" title="<?php /* @escapeNotVerified */ echo __('Phone Number') ?>" value="<?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getPostValue('telephone')) ?>" class="input-text" type="text" />
34+
<input name="telephone" id="telephone" title="<?php echo $block->escapeHtmlAttr(__('Phone Number')) ?>" value="<?php echo $block->escapeHtmlAttr($this->helper('Magento\Contact\Helper\Data')->getPostValue('telephone')) ?>" class="input-text" type="text" />
3635
</div>
3736
</div>
3837
<div class="field comment required">
39-
<label class="label" for="comment"><span><?php /* @escapeNotVerified */ echo __('What’s on your mind?') ?></span></label>
38+
<label class="label" for="comment"><span><?php echo $block->escapeHtml(__('What’s on your mind?')) ?></span></label>
4039
<div class="control">
41-
<textarea name="comment" id="comment" title="<?php /* @escapeNotVerified */ echo __('What’s on your mind?') ?>" class="input-text" cols="5" rows="3" data-validate="{required:true}"><?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getPostValue('comment')) ?></textarea>
40+
<textarea name="comment" id="comment" title="<?php echo $block->escapeHtmlAttr(__('What’s on your mind?')) ?>" class="input-text" cols="5" rows="3" data-validate="{required:true}"><?php echo $block->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getPostValue('comment')) ?></textarea>
4241
</div>
4342
</div>
4443
<?php echo $block->getChildHtml('form.additional.info'); ?>
4544
</fieldset>
4645
<div class="actions-toolbar">
4746
<div class="primary">
4847
<input type="hidden" name="hideit" id="hideit" value="" />
49-
<button type="submit" title="<?php /* @escapeNotVerified */ echo __('Submit') ?>" class="action submit primary">
50-
<span><?php /* @escapeNotVerified */ echo __('Submit') ?></span>
48+
<button type="submit" title="<?php echo $block->escapeHtmlAttr(__('Submit')) ?>" class="action submit primary">
49+
<span><?php echo $block->escapeHtml(__('Submit')) ?></span>
5150
</button>
5251
</div>
5352
</div>

app/code/Magento/Cookie/Block/RequireCookie.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ class RequireCookie extends \Magento\Framework\View\Element\Template
1818
*/
1919
public function getScriptOptions()
2020
{
21-
$params = ['noCookieUrl' => $this->getUrl('cookie/index/noCookies/'), 'triggers' => $this->getTriggers()];
21+
$params = [
22+
'noCookieUrl' => $this->escapeUrl($this->getUrl('cookie/index/noCookies/')),
23+
'triggers' => $this->escapeHtml($this->getTriggers())
24+
];
2225
return json_encode($params);
2326
}
2427
}

app/code/Magento/Cookie/Helper/Cookie.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function isUserNotAllowSaveCookie()
8484
public function getAcceptedSaveCookiesWebsiteIds()
8585
{
8686
$acceptedSaveCookiesWebsites = $this->_getAcceptedSaveCookiesWebsites();
87-
$acceptedSaveCookiesWebsites[$this->_website->getId()] = 1;
87+
$acceptedSaveCookiesWebsites[(int)$this->_website->getId()] = 1;
8888
return json_encode($acceptedSaveCookiesWebsites);
8989
}
9090

0 commit comments

Comments
 (0)