diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Checkboxes/Tree.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Checkboxes/Tree.php index 1e0015d2be2c6..8373c3fcb18ac 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Checkboxes/Tree.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Checkboxes/Tree.php @@ -83,7 +83,7 @@ protected function setExpandedPath($path) protected function _getNodeJson($node, $level = 1) { $item = []; - $item['text'] = $this->escapeHtml($node->getName()); + $item['text'] = $this->_escaper->escapeHtml($node->getName()); if ($this->_withProductCount) { $item['text'] .= ' (' . $node->getProductCount() . ')'; } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php index a66dcece2bef0..32c4fe5ba255e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php @@ -418,7 +418,7 @@ protected function _getNodeJson($node, $level = 0) */ public function buildNodeName($node) { - $result = $this->escapeHtml($node->getName()); + $result = $this->_escaper->escapeHtml($node->getName()); $result .= ' (ID: ' . $node->getId() . ')'; if ($this->_withProductCount) { $result .= ' (' . $node->getProductCount() . ')'; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php index 9c83d4aea61c7..b76fdc73780ed 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php @@ -121,7 +121,7 @@ function (node, e) { } '; } else { - $chooserJsObject = $this->escapeJs($this->getId()); + $chooserJsObject = $this->_escaper->escapeJs($this->getId()); $js = ' function (node, e) { ' . diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php index efb7d6dbbeff3..65c8243e3a320 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php @@ -122,7 +122,7 @@ public function getHeaderText() if (is_array($frontendLabel)) { $frontendLabel = $frontendLabel[0]; } - return __('Edit Product Attribute "%1"', $this->escapeHtml($frontendLabel)); + return __('Edit Product Attribute "%1"', $this->_escaper->escapeHtml($frontendLabel)); } return __('New Product Attribute'); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php index 3b9036c1fbbc0..5f8e86e84c15f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php @@ -132,7 +132,7 @@ protected function _prepareLayout() \Magento\Backend\Block\Widget\Button::class, [ 'label' => __('Delete'), - 'onclick' => 'deleteConfirm(\'' . $this->escapeJs( + 'onclick' => 'deleteConfirm(\'' . $this->_escaper->escapeJs( __( 'You are about to delete all products in this attribute set. ' . 'Are you sure you want to do that?' @@ -233,7 +233,7 @@ public function getGroupTreeJson() /* @var $node \Magento\Eav\Model\Entity\Attribute\Group */ foreach ($groups as $node) { $item = []; - $item['text'] = $this->escapeHtml($node->getAttributeGroupName()); + $item['text'] = $this->_escaper->escapeHtml($node->getAttributeGroupName()); $item['id'] = $node->getAttributeGroupId(); $item['cls'] = 'folder'; $item['allowDrop'] = true; @@ -280,7 +280,7 @@ public function getAttributeTreeJson() foreach ($attributes as $child) { $attr = [ - 'text' => $this->escapeHtml($child->getAttributeCode()), + 'text' => $this->_escaper->escapeHtml($child->getAttributeCode()), 'id' => $child->getAttributeId(), 'cls' => 'leaf', 'allowDrop' => false, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php index 822580801c4e4..a3e313e374c5e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php @@ -299,7 +299,7 @@ public function getDuplicateUrl() public function getHeader() { if ($this->getProduct()->getId()) { - $header = $this->escapeHtml($this->getProduct()->getName()); + $header = $this->_escaper->escapeHtml($this->getProduct()->getName()); } else { $header = __('New Product'); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php index 6419ae2d70588..e025a204e43ba 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/AttributeSet.php @@ -56,7 +56,7 @@ public function getSelectorOptions() 'showRecent' => true, 'storageKey' => 'product-template-key', 'minLength' => 0, - 'currentlySelected' => $this->escapeHtml( + 'currentlySelected' => $this->_escaper->escapeHtml( $this->_coreRegistry->registry('product')->getAttributeSetId() ) ]; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php index 6189a97dbe761..83050d51fa0a2 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php @@ -140,14 +140,14 @@ public function getChooseFromStoreHtml($storeTo) if (!$this->hasWebsite($_website->getId())) { continue; } - $optGroupLabel = $this->escapeHtml($_website->getName()); + $optGroupLabel = $this->_escaper->escapeHtml($_website->getName()); $this->_storeFromHtml .= ''; foreach ($this->getGroupCollection($_website) as $_group) { - $optGroupName = $this->escapeHtml($_group->getName()); + $optGroupName = $this->_escaper->escapeHtml($_group->getName()); $this->_storeFromHtml .= ''; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php index 22a56ec0a210d..0c2fc69100454 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php @@ -202,7 +202,7 @@ function (node, e) { {jsObject}.categoryName = node.attributes.id != "none" ? node.text : false; } '; - $js = str_replace('{jsObject}', $this->escapeJs($this->getJsObjectName()), $js); + $js = str_replace('{jsObject}', $this->_escaper->escapeJs($this->getJsObjectName()), $js); return $js; } diff --git a/app/code/Magento/Catalog/Block/Product/Price.php b/app/code/Magento/Catalog/Block/Product/Price.php index 8bed7451cd555..9f3a9152ca007 100644 --- a/app/code/Magento/Catalog/Block/Product/Price.php +++ b/app/code/Magento/Catalog/Block/Product/Price.php @@ -169,7 +169,7 @@ public function getRealPriceJs($product) */ public function prepareSku($sku) { - return $this->escapeHtml($this->string->splitInjection($sku)); + return $this->_escaper->escapeHtml($this->string->splitInjection($sku)); } /** diff --git a/app/code/Magento/Catalog/Block/Product/View/GalleryOptions.php b/app/code/Magento/Catalog/Block/Product/View/GalleryOptions.php index 0384c9cd9acce..df385e07ea4bb 100644 --- a/app/code/Magento/Catalog/Block/Product/View/GalleryOptions.php +++ b/app/code/Magento/Catalog/Block/Product/View/GalleryOptions.php @@ -60,7 +60,7 @@ public function getOptionsJson() if (is_bool($this->getVar("gallery/nav"))) { $optionItems['nav'] = $this->getVar("gallery/nav") ? 'true' : 'false'; } else { - $optionItems['nav'] = $this->escapeHtml($this->getVar("gallery/nav")); + $optionItems['nav'] = $this->_escaper->escapeHtml($this->getVar("gallery/nav")); } $optionItems['loop'] = $this->getVar("gallery/loop"); @@ -68,16 +68,16 @@ public function getOptionsJson() $optionItems['arrows'] = $this->getVar("gallery/arrows"); $optionItems['allowfullscreen'] = $this->getVar("gallery/allowfullscreen"); $optionItems['showCaption'] = $this->getVar("gallery/caption"); - $optionItems['width'] = (int)$this->escapeHtml( + $optionItems['width'] = (int)$this->_escaper->escapeHtml( $this->gallery->getImageAttribute('product_page_image_medium', 'width') ); - $optionItems['thumbwidth'] = (int)$this->escapeHtml( + $optionItems['thumbwidth'] = (int)$this->_escaper->escapeHtml( $this->gallery->getImageAttribute('product_page_image_small', 'width') ); if ($this->gallery->getImageAttribute('product_page_image_small', 'height') || $this->gallery->getImageAttribute('product_page_image_small', 'width')) { - $optionItems['thumbheight'] = (int)$this->escapeHtml( + $optionItems['thumbheight'] = (int)$this->_escaper->escapeHtml( $this->gallery->getImageAttribute('product_page_image_small', 'height') ?: $this->gallery->getImageAttribute('product_page_image_small', 'width') ); @@ -85,7 +85,7 @@ public function getOptionsJson() if ($this->gallery->getImageAttribute('product_page_image_medium', 'height') || $this->gallery->getImageAttribute('product_page_image_medium', 'width')) { - $optionItems['height'] = (int)$this->escapeHtml( + $optionItems['height'] = (int)$this->_escaper->escapeHtml( $this->gallery->getImageAttribute('product_page_image_medium', 'height') ?: $this->gallery->getImageAttribute('product_page_image_medium', 'width') ); @@ -93,16 +93,16 @@ public function getOptionsJson() if ($this->getVar("gallery/transition/duration")) { $optionItems['transitionduration'] = - (int)$this->escapeHtml($this->getVar("gallery/transition/duration")); + (int)$this->_escaper->escapeHtml($this->getVar("gallery/transition/duration")); } - $optionItems['transition'] = $this->escapeHtml($this->getVar("gallery/transition/effect")); + $optionItems['transition'] = $this->_escaper->escapeHtml($this->getVar("gallery/transition/effect")); $optionItems['navarrows'] = $this->getVar("gallery/navarrows"); - $optionItems['navtype'] = $this->escapeHtml($this->getVar("gallery/navtype")); - $optionItems['navdir'] = $this->escapeHtml($this->getVar("gallery/navdir")); + $optionItems['navtype'] = $this->_escaper->escapeHtml($this->getVar("gallery/navtype")); + $optionItems['navdir'] = $this->_escaper->escapeHtml($this->getVar("gallery/navdir")); if ($this->getVar("gallery/thumbmargin")) { - $optionItems['thumbmargin'] = (int)$this->escapeHtml($this->getVar("gallery/thumbmargin")); + $optionItems['thumbmargin'] = (int)$this->_escaper->escapeHtml($this->getVar("gallery/thumbmargin")); } return $this->jsonSerializer->serialize($optionItems); @@ -124,23 +124,23 @@ public function getFSOptionsJson() if (is_bool($this->getVar("gallery/fullscreen/nav"))) { $fsOptionItems['nav'] = $this->getVar("gallery/fullscreen/nav") ? 'true' : 'false'; } else { - $fsOptionItems['nav'] = $this->escapeHtml($this->getVar("gallery/fullscreen/nav")); + $fsOptionItems['nav'] = $this->_escaper->escapeHtml($this->getVar("gallery/fullscreen/nav")); } $fsOptionItems['loop'] = $this->getVar("gallery/fullscreen/loop"); - $fsOptionItems['navdir'] = $this->escapeHtml($this->getVar("gallery/fullscreen/navdir")); + $fsOptionItems['navdir'] = $this->_escaper->escapeHtml($this->getVar("gallery/fullscreen/navdir")); $fsOptionItems['navarrows'] = $this->getVar("gallery/fullscreen/navarrows"); - $fsOptionItems['navtype'] = $this->escapeHtml($this->getVar("gallery/fullscreen/navtype")); + $fsOptionItems['navtype'] = $this->_escaper->escapeHtml($this->getVar("gallery/fullscreen/navtype")); $fsOptionItems['arrows'] = $this->getVar("gallery/fullscreen/arrows"); $fsOptionItems['showCaption'] = $this->getVar("gallery/fullscreen/caption"); if ($this->getVar("gallery/fullscreen/transition/duration")) { - $fsOptionItems['transitionduration'] = (int)$this->escapeHtml( + $fsOptionItems['transitionduration'] = (int)$this->_escaper->escapeHtml( $this->getVar("gallery/fullscreen/transition/duration") ); } - $fsOptionItems['transition'] = $this->escapeHtml($this->getVar("gallery/fullscreen/transition/effect")); + $fsOptionItems['transition'] = $this->_escaper->escapeHtml($this->getVar("gallery/fullscreen/transition/effect")); if ($this->getVar("gallery/fullscreen/keyboard")) { $fsOptionItems['keyboard'] = $this->getVar("gallery/fullscreen/keyboard"); @@ -148,7 +148,7 @@ public function getFSOptionsJson() if ($this->getVar("gallery/fullscreen/thumbmargin")) { $fsOptionItems['thumbmargin'] = - (int)$this->escapeHtml($this->getVar("gallery/fullscreen/thumbmargin")); + (int)$this->_escaper->escapeHtml($this->getVar("gallery/fullscreen/thumbmargin")); } return $this->jsonSerializer->serialize($fsOptionItems); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml index cea54e883d2aa..91b1707888730 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml @@ -5,11 +5,11 @@ */ /** - * @var $block \Magento\Catalog\Block\Adminhtml\Category\Tree + * @var \Magento\Catalog\Block\Adminhtml\Category\Tree $block + * @var \Magento\Framework\Escaper $escaper */ ?> - -escapeHtml('tree-div_' . time()) ?> +escapeHtml('tree-div_' . time()) ?>
@@ -17,14 +17,14 @@ { "*": { "categoryCheckboxTree": { - "dataUrl": "= $block->escapeUrl($block->getLoadTreeUrl()) ?>", + "dataUrl": "= $escaper->escapeUrl($block->getLoadTreeUrl()) ?>", "divId": "= /* @noEscape */ $divId ?>", "rootVisible": false, - "useAjax": = $block->escapeHtml($block->getUseAjax()) ?>, + "useAjax": = $escaper->escapeHtml($block->getUseAjax()) ?>, "currentNodeId": = (int)$block->getCategoryId() ?>, "jsFormObject": "= /* @noEscape */ $block->getJsFormObject() ?>", - "name": "= $block->escapeHtml($block->getRoot()->getName()) ?>", - "checked": "= $block->escapeHtml($block->getRoot()->getChecked()) ?>", + "name": "= $escaper->escapeHtml($block->getRoot()->getName()) ?>", + "checked": "= $escaper->escapeHtml($block->getRoot()->getChecked()) ?>", "allowdDrop": = /* @noEscape */ $block->getRoot()->getIsVisible() ? 'true' : 'false' ?>, "rootId": = (int)$block->getRoot()->getId() ?>, "expanded": true, diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml index c19f140687bbc..f78c38946c352 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml @@ -5,13 +5,14 @@ */ /** - * @var $block \Magento\Catalog\Block\Adminhtml\Category\Edit + * @var \Magento\Catalog\Block\Adminhtml\Category\Edit $block + * @var \Magento\Framework\Escaper $escaper * @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ ?> = /* @noEscape */ $secureRenderer->renderStyleAsTag('display: none;', 'div[data-id="information-dialog-category"]') ?> @@ -19,7 +20,7 @@ diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml index e52b43b1c3d24..fafe592bc0968 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/assign_products.phtml @@ -4,9 +4,11 @@ * See COPYING.txt for license details. */ -/** @var \Magento\Catalog\Block\Adminhtml\Category\AssignProducts $block */ -/** @var \Magento\Catalog\Block\Adminhtml\Category\Tab\Product $blockGrid */ -/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ +/** + * @var \Magento\Catalog\Block\Adminhtml\Category\AssignProducts $block + * @var \Magento\Catalog\Block\Adminhtml\Category\Tab\Product $blockGrid + * @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer + */ $blockGrid = $block->getBlockGrid(); $gridJsObjectName = $blockGrid->getJsObjectName(); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml index 0cd00e88f4350..21575fca75e9a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml @@ -4,8 +4,11 @@ * See COPYING.txt for license details. */ -/** @var $block \Magento\Catalog\Block\Adminhtml\Category\Tree */ -/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ +/** + * @var \Magento\Catalog\Block\Adminhtml\Category\Tree $block + * @var \Magento\Framework\Escaper $escaper + * @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer + */ ?>