Skip to content

Magento_UrlRewrite: avoid using deprecated escape* methods from Abstr… #31710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected function _getNodesArray($node)
'children_count' => (int)$node->getChildrenCount(),
'is_active' => (bool)$node->getIsActive(),
// Scrub names for raw js output
'name' => $this->escapeHtml($node->getName()),
'name' => $this->_escaper->escapeHtml($node->getName()),
'level' => (int)$node->getLevel(),
'product_count' => (int)$node->getProductCount(),
];
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/UrlRewrite/Block/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Link extends \Magento\Framework\View\Element\AbstractBlock
*/
protected function _toHtml()
{
return '<p>' . $this->getLabel() . ' <a href="' . $this->getItemUrl() . '">' . $this->escapeHtml(
return '<p>' . $this->getLabel() . ' <a href="' . $this->getItemUrl() . '">' . $this->_escaper->escapeHtml(
$this->getItemName()
) . '</a></p>';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
* See COPYING.txt for license details.
*/

/** @var \Magento\UrlRewrite\Block\Catalog\Category\Tree $block */
/**
* @var \Magento\UrlRewrite\Block\Catalog\Category\Tree $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<fieldset class="admin__fieldset" data-ui-id="category-selector">
<legend class="admin__legend"><span><?= $block->escapeHtml(__('Select Category')) ?></span></legend>
<legend class="admin__legend"><span><?= $escaper->escapeHtml(__('Select Category')) ?></span></legend>
<div class="content content-category-tree">
<input type="hidden" name="categories" id="product_categories" value=""/>
<?php if ($block->getRoot()) : ?>
Expand All @@ -22,7 +25,7 @@
"categoryTree": {
"data": <?= /* @noEscape */
$this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getTreeArray()); ?>,
"url": "<?= $block->escapeJs($block->escapeUrl($block->getLoadTreeUrl())); ?>"
"url": "<?= $escaper->escapeJs($escaper->escapeUrl($block->getLoadTreeUrl())); ?>"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
* See COPYING.txt for license details.
*/

/** @var \Magento\UrlRewrite\Block\Edit $block */
/**
* @var \Magento\UrlRewrite\Block\Edit $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<?= $block->getChildHtml() ?>
<?php if ($block->getChildBlock('form')) : ?>
<script type="text/x-magento-init">
{
"#edit_form": {
"Magento_UrlRewrite/js/url-rewrite-validation" : {
"url": "<?= $block->escapeUrl($block->getValidationUrl()) ?>"
"url": "<?= $escaper->escapeUrl($block->getValidationUrl()) ?>"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
* See COPYING.txt for license details.
*/

/** @var \Magento\Framework\View\Element\Template $block */
/**
* @var \Magento\Framework\View\Element\Template $block
* @var \Magento\Framework\Escaper $escaper
*/
$urls = $block->getData('urls');
?>
<h4>
<?=$block->escapeHtml(__('The value specified in the URL Key field would generate a URL that already exists.')); ?>
<?=$escaper->escapeHtml(__('The value specified in the URL Key field would generate a URL that already exists.')); ?>
</h4>
<p>
<?=$block->escapeHtml(
<?=$escaper->escapeHtml(
__(
'To resolve this conflict, you can either change the value of the URL Key field '
. '(located in the Search Engine Optimization section) to a unique value, or change the Request Path fields'
Expand All @@ -23,7 +26,7 @@ $urls = $block->getData('urls');
if (!empty($urls)) {
foreach ($urls as $url => $urlTitle) {
?>
<?='<p> - <a href="' . $block->escapeHtml($url) . '">' . $block->escapeHtml($urlTitle) . '</a></p>'; ?>
<?='<p> - <a href="' . $escaper->escapeHtml($url) . '">' . $escaper->escapeHtml($urlTitle) . '</a></p>'; ?>
<?php
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@

/**
* @var \Magento\UrlRewrite\Block\Selector $block
* @var \Magento\Framework\Escaper $escaper
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/
?>
<div class="form-inline">
<fieldset class="admin__fieldset fieldset" data-container-for="entity-type-selector">
<div class="admin__field field field-entity-type-selector">
<label for="entity-type-selector" class="admin__field-label label">
<span><?= $block->escapeHtml($block->getSelectorLabel()) ?></span>
<span><?= $escaper->escapeHtml($block->getSelectorLabel()) ?></span>
</label>
<div class="admin__field-control control">
<select data-role="entity-type-selector" class="admin__control-select select" id="entity-type-selector">
<?php foreach ($block->getModes() as $mode => $label): ?>
<option <?= /* @noEscape */ $block->isMode($mode) ? 'selected="selected" ' : '' ?>
value="<?= $block->escapeUrl($block->getModeUrl($mode)) ?>"><?= $block->escapeHtml($label) ?>
value="<?= $escaper->escapeUrl($block->getModeUrl($mode)) ?>"><?= $escaper->escapeHtml($label) ?>
</option>
<?php endforeach; ?>
</select>
Expand Down