diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index d3b0b8501c864..05b6922673e49 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -25,6 +25,11 @@ class Feed extends \Magento\Framework\Model\AbstractModel const XML_LAST_UPDATE_PATH = 'system/adminnotification/last_update'; + /** + * @var \Magento\Framework\Escaper + */ + private $escaper; + /** * Feed url * @@ -77,6 +82,7 @@ class Feed extends \Magento\Framework\Model\AbstractModel * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data + * @param \Magento\Framework\Escaper|null $escaper * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -90,21 +96,26 @@ public function __construct( \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, - array $data = [] + array $data = [], + \Magento\Framework\Escaper $escaper = null ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); - $this->_backendConfig = $backendConfig; - $this->_inboxFactory = $inboxFactory; - $this->curlFactory = $curlFactory; + $this->_backendConfig = $backendConfig; + $this->_inboxFactory = $inboxFactory; + $this->curlFactory = $curlFactory; $this->_deploymentConfig = $deploymentConfig; - $this->productMetadata = $productMetadata; - $this->urlBuilder = $urlBuilder; + $this->productMetadata = $productMetadata; + $this->urlBuilder = $urlBuilder; + $this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Escaper::class + ); } /** * Init model * * @return void + * phpcs:disable Magento2.CodeAnalysis.EmptyBlock */ protected function _construct() { @@ -252,6 +263,6 @@ public function getFeedXml() */ private function escapeString(\SimpleXMLElement $data) { - return htmlspecialchars((string)$data); + return $this->escaper->escapeHtml((string)$data); } } diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml index 843328fbf17d7..be309423c48d2 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml @@ -3,14 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?>
@@ -21,10 +20,10 @@
  • escapeHtml(__('Contact a system administrator or store owner to gain permissions.')) ?>
  • escapeHtml(__('Return to ')) ?> - + escapeHtml(__('previous page')) ?>escapeHtml(__('.')) ?> - + escapeHtml(__('previous page')) ?>escapeHtml(__('.')) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/formkey.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/formkey.phtml index 9629db9fa455b..edc14190e4edf 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/formkey.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/formkey.phtml @@ -4,4 +4,4 @@ * See COPYING.txt for license details. */ ?> -
    +
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml index 52d5dd6d114ee..1d05450f44c99 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml @@ -4,19 +4,20 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - +/** + * @var \Magento\Framework\View\Element\AbstractBlock $block + */ ?>
    - + escapeHtml(__('Welcome, please sign in')) ?>
    - +
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/login_buttons.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/login_buttons.phtml index 2459bc54e0c34..18ee8a86517c1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/login_buttons.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/login_buttons.phtml @@ -8,6 +8,6 @@
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml index 93509cc62f7d5..ac81861c9930d 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/overlay_popup.phtml @@ -3,15 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?>
    - getChildHtml('left')): ?> -
    + getChildHtml('left')) : ?> +
    getChildHtml('left') ?>
    @@ -24,13 +21,13 @@
    - +
    getLayout()->getMessagesBlock()->getGroupedHtml() ?>
    getChildHtml('content') ?> - +
    - getChildHtml('footer')): ?> + getChildHtml('footer')) : ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml index ebb8e26c93f9d..d8cab67ecb79b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml @@ -3,19 +3,16 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> - + getChildHtml('head') ?> -getBodyClass() ? ' class="' . $block->getBodyClass() . '"' : '' ?> data-container="body" data-mage-init='{"loaderAjax":{},"loader":{}}'> +
    getChildHtml('notification_window') ?> getChildHtml('global_notices') ?> @@ -31,8 +28,8 @@ getLayout()->getMessagesBlock()->getGroupedHtml() ?>
    getChildHtml('page_main_actions') ?> - getChildHtml('left')): ?> -
    + getChildHtml('left')) : ?> +
    getChildHtml('content') ?>
    @@ -41,7 +38,7 @@ getChildHtml('left') ?>
    - +
    getChildHtml('content') ?>
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml index ae123511bd478..12b388c210774 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph.phtml @@ -3,33 +3,33 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?>
    + class="label">escapeHtml(__('Select Range:')) ?>
    - getCount()): ?> + getCount()) : ?>
    - Chart + Chart
    - +
    - + escapeHtml(__('No Data Found')) ?>
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml index 7dddc15121831..f8e584ce5b9cd 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/graph/disabled.phtml @@ -3,9 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile ?>
    - here.', $block->getConfigUrl()) ?> + here.', $block->escapeUrl($block->getConfigUrl())) ?>
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml index 1041aef59ceac..7c05335642ba7 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml @@ -3,90 +3,87 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> getColumns()); +$numColumns = count($block->getColumns()); ?> -getCollection()): ?> +getCollection()) : ?>
    - getCollection()->getSize()>0): ?> - + getCollection()->getSize() > 0) : ?> +
    tags from the code. */ /* foreach ($block->getColumns() as $_column): ?> getHtmlProperty() ?> /> - getHeadersVisibility() || $block->getFilterVisibility()): ?> + getHeadersVisibility() || $block->getFilterVisibility()) : ?> - getHeadersVisibility()): ?> + getHeadersVisibility()) : ?> - getColumns() as $_column): ?> + getColumns() as $_column) : ?> getHeaderHtml() ?> - getIsCollapsed()): ?> + getIsCollapsed()) : ?> - getCollection() as $_index => $_item): ?> - - getColumns() as $_column): ?> - + getCollection() as $_index => $_item) : ?> + + getColumns() as $_column) : ?> +
    getRowField($_item)) != '' ? $_html : ' ') ?>
    getRowField($_item)) != '' ? $_html : ' ') ?>
    - -
    getEmptyText() ?>
    + +
    escapeHtml($block->getEmptyText()) ?>
    -canDisplayContainer()): ?> + canDisplayContainer()) : ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml index 865e0fac38314..6152c8fe1cff1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/index.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> getChildBlock('diagrams')->getTabsIds())) : ?> @@ -17,13 +14,13 @@ require([ window.changeDiagramsPeriod = function(periodObj) { periodParam = periodObj.value ? 'period/' + periodObj.value + '/' : ''; -getChildBlock('diagrams')->getTabsIds() as $tabId): ?> - ajaxBlockParam = 'block/tab_/'; - ajaxBlockUrl = 'getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => '', 'period' => '']) ?>' + ajaxBlockParam + periodParam; + getChildBlock('diagrams')->getTabsIds() as $tabId) : ?> + ajaxBlockParam = 'block/tab_escapeJs($tabId) ?>/'; + ajaxBlockUrl = 'escapeJs($block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => '', 'period' => ''])) ?>' + ajaxBlockParam + periodParam; new Ajax.Request(ajaxBlockUrl, { parameters: {isAjax: 'true', form_key: FORM_KEY}, onSuccess: function(transport) { - tabContentElementId = 'getChildBlock('diagrams')->getId() ?>__content'; + tabContentElementId = 'escapeJs($block->getChildBlock('diagrams')->getId()) ?>_escapeJs($tabId) ?>_content'; try { if (transport.responseText.isJSON()) { var response = transport.responseText.evalJSON() @@ -44,8 +41,8 @@ window.changeDiagramsPeriod = function(periodObj) { } } }); - - ajaxBlockUrl = 'getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => 'totals', 'period' => '']) ?>' + periodParam; + + ajaxBlockUrl = 'escapeJs($block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => 'totals', 'period' => ''])) ?>' + periodParam; new Ajax.Request(ajaxBlockUrl, { parameters: {isAjax: 'true', form_key: FORM_KEY}, onSuccess: function(transport) { @@ -93,15 +90,15 @@ window.changeDiagramsPeriod = function(periodObj) {
    getChildHtml('sales') ?>
    -
    +
    escapeHtml(__('Last Orders')) ?>
    getChildHtml('lastOrders') ?>
    -
    +
    escapeHtml(__('Last Search Terms')) ?>
    getChildHtml('lastSearches') ?>
    -
    +
    escapeHtml(__('Top Search Terms')) ?>
    getChildHtml('topSearches') ?>
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml index 450a2c89b50da..139a7cad4185f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/salebar.phtml @@ -3,18 +3,15 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -getTotals()) > 0): ?> - getTotals() as $_total): ?> +getTotals()) > 0) : ?> + getTotals() as $_total) : ?>
    -
    +
    escapeHtml($_total['label']) ?>
    - - + +
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml index f6e837fd54ede..7a7a71f07fa55 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/searches.phtml @@ -3,16 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -getCollection()->getItems()) > 0): ?> +getCollection()->getItems()) > 0) : ?>
    - getCollection()->getItems() as $item): ?> - getQueryText() ?>
    + getCollection()->getItems() as $item) : ?> + escapeHtml($item->getQueryText()) ?>
    - -
    + +
    escapeHtml(__('There are no search keywords.')) ?>
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml index bf9ae27f17b48..87e5399ddda44 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/store/switcher.phtml @@ -3,31 +3,28 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -

    +

    getHintHtml() ?> + escapeHtml(__('Browse Files...')) ?> +

  • diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml index c6c7bcc901e7e..5277a1df2f31e 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml index 5418ad58b9519..93df0aec94ef1 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/notices.phtml @@ -3,29 +3,26 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -displayNoscriptNotice()): ?> +displayNoscriptNotice()) : ?> -displayDemoNotice()): ?> +displayDemoNotice()) : ?>
    - + escapeHtml(__('This is only a demo store. You can browse and place orders, but nothing will be processed.')) ?>
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml index 4ef6d378cc4a4..2965983e12150 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml @@ -3,12 +3,9 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -getBugreportUrl()): ?> - - +getBugreportUrl()) : ?> + + escapeHtml(__('Report an Issue')) ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml b/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml index 0a1dcb0b626e6..56a8161b57e0b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/pageactions.phtml @@ -3,12 +3,9 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> -getChildHtml()):?> -
    getUiId('content-header') ?>> +getChildHtml()) :?> +
    getUiId('content-header') ?>> getChildHtml() ?>
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml index bb968c57610be..8674a167d28e5 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml @@ -4,27 +4,25 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /* @var $block \Magento\Backend\Block\Store\Switcher */ ?> -getWebsites()): ?> +getWebsites()) : ?>
    - + escapeHtml(__('Store View:')) ?>
    diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml index 22d93241f43f2..7ac867970e820 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/autocomplete.phtml @@ -3,15 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?>