Skip to content

Magento_Paypal: avoid using deprecated escape* methods from AbstractB… #31693

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 2 commits 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
4 changes: 2 additions & 2 deletions app/code/Magento/Paypal/Block/Billing/Agreement/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function getOrderItemValue(\Magento\Sales\Model\Order $order, $key)
$value = $this->formatDate($order->getCreatedAt(), \IntlDateFormatter::SHORT, true);
break;
case 'shipping_address':
$value = $order->getShippingAddress() ? $this->escapeHtml(
$value = $order->getShippingAddress() ? $this->_escaper->escapeHtml(
$order->getShippingAddress()->getName()
) : __(
'N/A'
Expand All @@ -162,7 +162,7 @@ public function getOrderItemValue(\Magento\Sales\Model\Order $order, $key)
$value = $order->getData($key) ? $order->getData($key) : __('N/A');
break;
}
return $escape ? $this->escapeHtml($value) : $value;
return $escape ? $this->_escaper->escapeHtml($value) : $value;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Paypal/Block/Billing/Agreements.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function getItemValue(\Magento\Paypal\Model\Billing\Agreement $item, $key
$value = $item->getData($key) ? $item->getData($key) : __('N/A');
break;
}
return $this->escapeHtml($value);
return $this->_escaper->escapeHtml($value);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Paypal/Block/Express/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxF

$incl = $this->_getShippingPrice($rate->getPrice(), true);
if ($incl != $price && $this->_taxHelper->displayShippingBothPrices()) {
$renderedInclTax = sprintf($inclTaxFormat, $this->escapeHtml(__('Incl. Tax')), $incl);
$renderedInclTax = sprintf($inclTaxFormat, $this->_escaper->escapeHtml(__('Incl. Tax')), $incl);
}
}
return sprintf($format, $this->escapeHtml($rate->getMethodTitle()), $price, $renderedInclTax);
return sprintf($format, $this->_escaper->escapeHtml($rate->getMethodTitle()), $price, $renderedInclTax);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@

/**
* @var \Magento\Paypal\Block\Adminhtml\Billing\Agreement\View\Form $block
* @var \Magento\Framework\Escaper $escaper
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/
?>
<?php $code = $block->escapeHtml($block->getMethodCode()) ?>
<?php $code = $escaper->escapeHtml($block->getMethodCode()) ?>
<fieldset class="form-list" id="payment_form_<?= /* @noEscape */ $code ?>">
<div class="admin__field _required">
<label for="<?= /* @noEscape */ $code ?>_ba_agreement_id" class="admin__field-label">
<span><?= $block->escapeHtml(__('Billing Agreement')) ?></span>
<span><?= $escaper->escapeHtml(__('Billing Agreement')) ?></span>
</label>
<div class="admin__field-control">
<select id="<?= /* @noEscape */ $code ?>_ba_agreement_id"
name="payment[<?= $block->escapeHtml($block->getTransportBAId()) ?>]"
name="payment[<?= $escaper->escapeHtml($block->getTransportBAId()) ?>]"
class="required-entry admin__control-select">
<option value=""><?= $block->escapeHtml(__('Please Select')) ?></option>
<option value=""><?= $escaper->escapeHtml(__('Please Select')) ?></option>
<?php foreach ($block->getBillingAgreements() as $id => $referenceId): ?>
<option value="<?= $block->escapeHtml($id) ?>">
<?= $block->escapeHtml($referenceId) ?>
<option value="<?= $escaper->escapeHtml($id) ?>">
<?= $escaper->escapeHtml($referenceId) ?>
</option>
<?php endforeach; ?>
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,42 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/** @var \Magento\Paypal\Block\Adminhtml\Billing\Agreement\View\Tab\Info $block */

/**
* @var \Magento\Paypal\Block\Adminhtml\Billing\Agreement\View\Tab\Info $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<section class="admin__page-section">
<div class="admin__page-section-title">
<span class="title"><?= $block->escapeHtml(__('General Information')) ?></span>
<span class="title"><?= $escaper->escapeHtml(__('General Information')) ?></span>
</div>
<div class="admin__page-section-content log-details">
<table class="data-table admin__table-secondary order-billing-agreement-table">
<tbody>
<tr>
<th><?= $block->escapeHtml(__('Reference ID')) ?></th>
<td><?= $block->escapeHtml($block->getReferenceId()) ?></td>
<th><?= $escaper->escapeHtml(__('Reference ID')) ?></th>
<td><?= $escaper->escapeHtml($block->getReferenceId()) ?></td>
</tr>
<tr>
<th><?= $block->escapeHtml(__('Customer')) ?></th>
<th><?= $escaper->escapeHtml(__('Customer')) ?></th>
<td>
<a href="<?= $block->escapeUrl($block->getCustomerUrl()) ?>">
<?= $block->escapeHtml($block->getCustomerEmail()) ?>
<a href="<?= $escaper->escapeUrl($block->getCustomerUrl()) ?>">
<?= $escaper->escapeHtml($block->getCustomerEmail()) ?>
</a>
</td>
</tr>
<tr>
<th><?= $block->escapeHtml(__('Status')) ?></th>
<td><?= $block->escapeHtml($block->getStatus()) ?></td>
<th><?= $escaper->escapeHtml(__('Status')) ?></th>
<td><?= $escaper->escapeHtml($block->getStatus()) ?></td>
</tr>
<tr>
<th><?= $block->escapeHtml(__('Created At')) ?></th>
<td><?= $block->escapeHtml($block->getCreatedAt()) ?></td>
<th><?= $escaper->escapeHtml(__('Created At')) ?></th>
<td><?= $escaper->escapeHtml($block->getCreatedAt()) ?></td>
</tr>
<tr>
<th><?= $block->escapeHtml(__('Updated At')) ?></th>
<td><?= $block->escapeHtml($block->getUpdatedAt()) ?></td>
<th><?= $escaper->escapeHtml(__('Updated At')) ?></th>
<td><?= $escaper->escapeHtml($block->getUpdatedAt()) ?></td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@

use Magento\Vault\Model\Ui\TokenUiComponentProviderInterface;

/** @var \Magento\Framework\View\Element\Template $block */
/**
* @var \Magento\Framework\View\Element\Template $block
* @var \Magento\Framework\Escaper $escaper
*/
$details = $block->getData('details');
$icon = $block->getData('icons')[$details['cc_type']];
$id = $block->escapeHtml($block->getData('id'));
$id = $escaper->escapeHtml($block->getData('id'));
?>
<div data-mage-init='{
"Magento_Paypal/js/payflowpro/vault": {
"container": "payment_<?= /* @noEscape */ $id ?>",
"publicHash": "<?= $block->escapeHtml($block->getData(TokenUiComponentProviderInterface::COMPONENT_PUBLIC_HASH)); ?>"
"publicHash": "<?= $escaper->escapeHtml($block->getData(TokenUiComponentProviderInterface::COMPONENT_PUBLIC_HASH)); ?>"
}
}' id="payment_<?= /* @noEscape */ $id ?>" class="admin__field">
<div class="admin__field-control control">
<input type="radio" id="token_switcher_<?= /* @noEscape */ $id ?>" name="payment[token_switcher]"/>
<img src="<?= $block->escapeUrl($icon['url']) ?>"
width="<?= $block->escapeHtml($icon['width']) ?>"
height="<?= $block->escapeHtml($icon['height']) ?>"
<img src="<?= $escaper->escapeUrl($icon['url']) ?>"
width="<?= $escaper->escapeHtml($icon['width']) ?>"
height="<?= $escaper->escapeHtml($icon['height']) ?>"
class="payment-icon" >
<span><?= $block->escapeHtml(__('ending')) ?></span>
<span><?= $block->escapeHtml($details['cc_last_4']) ?></span>
(<span><?= $block->escapeHtml(__('expires')) ?></span>:
<span><?= /* @noEscape */ $block->escapeHtml($details['cc_exp_month'] . "/" . $details['cc_exp_year']); ?></span>)
<span><?= $escaper->escapeHtml(__('ending')) ?></span>
<span><?= $escaper->escapeHtml($details['cc_last_4']) ?></span>
(<span><?= $escaper->escapeHtml(__('expires')) ?></span>:
<span><?= /* @noEscape */ $escaper->escapeHtml($details['cc_exp_month'] . "/" . $details['cc_exp_year']); ?></span>)
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,29 @@
*/

/**
* @var $block \Magento\Paypal\Block\Payment\Form\Billing\Agreement
* @var \Magento\Paypal\Block\Payment\Form\Billing\Agreement $block
* @var \Magento\Framework\Escaper $escaper
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/
?>
<?php $code = $block->escapeHtml($block->getMethodCode()) ?>
<?php $code = $escaper->escapeHtml($block->getMethodCode()) ?>
<fieldset class="admin__fieldset payment-method form-list" id="payment_form_<?= /* @noEscape */ $code ?>">
<div class="admin__field _required">
<label class="admin__field-label"
for="<?= /* @noEscape */ $code ?>_ba_agreement_id">
<span><?= $block->escapeHtml(__('Billing Agreement')) ?></span>
<span><?= $escaper->escapeHtml(__('Billing Agreement')) ?></span>
</label>
<div class="admin__field-control">
<select id="<?= /* @noEscape */ $code ?>_ba_agreement_id"
name="payment[<?= $block->escapeHtml($block->getTransportName()) ?>]"
name="payment[<?= $escaper->escapeHtml($block->getTransportName()) ?>]"
class="required-entry admin__control-select">
<option value=""><?= $block->escapeHtml(__('Please Select')) ?></option>
<option value=""><?= $escaper->escapeHtml(__('Please Select')) ?></option>
<?php foreach ($block->getBillingAgreements() as $id => $referenceId): ?>
<option value="<?= $block->escapeHtml($id) ?>"
<option value="<?= $escaper->escapeHtml($id) ?>"
<?= ($id == $block->getInfoData($block->getTransportName())) ?
' selected="selected"' : '';
?>>
<?= $block->escapeHtml($referenceId) ?>
<?= $escaper->escapeHtml($referenceId) ?>
</option>
<?php endforeach; ?>
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

/**
* @see \Magento\Paypal\Block\Adminhtml\System\Config\ApiWizard
* @var \Magento\Paypal\Block\Adminhtml\System\Config\ApiWizard $block
* @var \Magento\Framework\Escaper $escaper
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/
?>
Expand All @@ -26,13 +26,13 @@ script;

<a class="action-default"
data-paypal-button="true"
href="<?= /* @noEscape */ $block->escapeUrl($block->getButtonUrl() . '?' . $block->getQuery()) ?>"
target="PPFrame"><?= $block->escapeHtml($block->getButtonLabel()) ?></a>
href="<?= /* @noEscape */ $escaper->escapeUrl($block->getButtonUrl() . '?' . $block->getQuery()) ?>"
target="PPFrame"><?= $escaper->escapeHtml($block->getButtonLabel()) ?></a>

<a class="action-default"
data-paypal-button="true"
href="<?= /* @noEscape */ $block->escapeUrl($block->getSandboxButtonUrl(). '?' . $block->getQuery()) ?>"
target="PPFrame"><?= $block->escapeHtml($block->getSandboxButtonLabel()) ?></a>
href="<?= /* @noEscape */ $escaper->escapeUrl($block->getSandboxButtonUrl(). '?' . $block->getQuery()) ?>"
target="PPFrame"><?= $escaper->escapeHtml($block->getSandboxButtonLabel()) ?></a>
</div>
</div>
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag("text-align: left;", 'div#paypal_api_config') ?>
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
*/

/**
* @see \Magento\Paypal\Block\Adminhtml\System\Config\BmlApiWizard
* @var \Magento\Paypal\Block\Adminhtml\System\Config\BmlApiWizard $block
* @var \Magento\Framework\Escaper $escaper
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/
?>
<div class="pp-buttons-container">
<button class="scalable" type="button" id="<?= $block->escapeHtml($block->getHtmlId()) ?>">
<span><span><span><?= $block->escapeHtml($block->getButtonLabel()) ?></span></span></span>
<button class="scalable" type="button" id="<?= $escaper->escapeHtml($block->getHtmlId()) ?>">
<span><span><span><?= $escaper->escapeHtml($block->getButtonLabel()) ?></span></span></span>
</button>
</div>
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
'onclick',
"window.open(
'" . $block->escapeUrl($block->getButtonUrl()) . "',
'" . $escaper->escapeUrl($block->getButtonUrl()) . "',
'bmlapiwizard',
'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ,' +
'left=100, top=100, width=550, height=550'
);event.preventDefault()",
'button#' . $block->escapeHtml($block->getHtmlId())
'button#' . $escaper->escapeHtml($block->getHtmlId())
) ?>
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
*/

/**
* @see \Magento\Paypal\Block\System\Config\Fieldset\Hint
* @var \Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint $block
* @var \Magento\Framework\Escaper $escaper
*/
$helpLink = $block->escapeUrl($block->getHelpLink());
$helpLink = $escaper->escapeUrl($block->getHelpLink());
?>
<?php if ($helpLink) : ?>
<div class="paypal-payment-notice">
<?= $block->escapeHtml(__('Not sure what PayPal payment method to use? Click ')) ?>
<a href="<?= /* @noEscape */ $helpLink; ?>" target="_blank"><?= $block->escapeHtml(__('here')) ?></a>
<?= $block->escapeHtml(__(' to learn more.')) ?>
<?= $escaper->escapeHtml(__('Not sure what PayPal payment method to use? Click ')) ?>
<a href="<?= /* @noEscape */ $helpLink; ?>" target="_blank"><?= $escaper->escapeHtml(__('here')) ?></a>
<?= $escaper->escapeHtml(__(' to learn more.')) ?>
</div>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
* See COPYING.txt for license details.
*/

/*
* @var $block \Magento\Paypal\Block\Adminhtml\System\Config\Payflowlink\Advanced
/**
* @var \Magento\Paypal\Block\Adminhtml\System\Config\Payflowlink\Advanced $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<div class="payflow-settings-notice">
<p>
<strong class="important-label"><?= $block->escapeHtml(__('Important: ')) ?></strong>
<?= $block->escapeHtml(__('To use PayPal Payments Advanced, you must configure your PayPal Payments Advanced account on the PayPal website.')) ?>
<?= $block->escapeHtml(__('Once you log into your PayPal Advanced account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below')) ?>
<strong class="important-label"><?= $escaper->escapeHtml(__('Important: ')) ?></strong>
<?= $escaper->escapeHtml(__('To use PayPal Payments Advanced, you must configure your PayPal Payments Advanced account on the PayPal website.')) ?>
<?= $escaper->escapeHtml(__('Once you log into your PayPal Advanced account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below')) ?>
</p>
<ul class="options-list">
<li><strong>AVS:</strong> No</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
*/

/**
* @see \Magento\Paypal\Block\Adminhtml\System\Config\Payflowlink\Info
* @var \Magento\Paypal\Block\Adminhtml\System\Config\Payflowlink\Info $block
* @var \Magento\Framework\Escaper $escaper
*/

?>
<div class="payflow-settings-notice">
<strong class="important-label"><?= $block->escapeHtml(__('Important: ')) ?></strong>
<?= $block->escapeHtml(__('To use PayPal Payflow Link, you must configure your PayPal Payflow Link account on the PayPal website.')) ?>
<?= $block->escapeHtml(__('Once you log into your PayPal Payflow Link account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below')) ?>
<strong class="important-label"><?= $escaper->escapeHtml(__('Important: ')) ?></strong>
<?= $escaper->escapeHtml(__('To use PayPal Payflow Link, you must configure your PayPal Payflow Link account on the PayPal website.')) ?>
<?= $escaper->escapeHtml(__('Once you log into your PayPal Payflow Link account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below')) ?>
<ul class="options-list">
<li><strong>AVS:</strong> No</li>
<li><strong>CSC:</strong> No</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

/**
* @var \Magento\Paypal\Block\Adminhtml\System\Config\ResolutionRules $block
* @var \Magento\Framework\Escaper $escaper
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/
?>

<?php $scriptString = <<<script
require([
"Magento_Paypal/js/solutions",
Expand Down
Loading