From 455619c8251084fd14bb8d2ddf10935098f8cf5d Mon Sep 17 00:00:00 2001 From: Dave Macaulay Date: Mon, 20 May 2019 17:18:59 +0200 Subject: [PATCH 01/16] MC-16618: Eliminate @escapeNotVerified in Sales-related Modules - Front-end templates --- .../templates/order/create/form/account.phtml | 6 +- .../templates/email/creditmemo/items.phtml | 14 +- .../templates/email/invoice/items.phtml | 12 +- .../view/frontend/templates/email/items.phtml | 31 +++-- .../email/items/creditmemo/default.phtml | 18 ++- .../email/items/invoice/default.phtml | 21 ++- .../templates/email/items/order/default.phtml | 33 +++-- .../templates/email/items/price/row.phtml | 5 +- .../email/items/shipment/default.phtml | 18 ++- .../templates/email/shipment/items.phtml | 10 +- .../templates/email/shipment/track.phtml | 40 +++--- .../view/frontend/templates/guest/form.phtml | 27 ++-- .../frontend/templates/items/price/row.phtml | 4 +- .../items/price/total_after_discount.phtml | 8 +- .../frontend/templates/items/price/unit.phtml | 4 +- .../frontend/templates/js/components.phtml | 3 - .../frontend/templates/order/comments.phtml | 14 +- .../frontend/templates/order/creditmemo.phtml | 6 +- .../templates/order/creditmemo/items.phtml | 81 ++++++----- .../creditmemo/items/renderer/default.phtml | 69 +++++----- .../frontend/templates/order/history.phtml | 47 ++++--- .../view/frontend/templates/order/info.phtml | 47 +++---- .../templates/order/info/buttons.phtml | 17 ++- .../templates/order/info/buttons/rss.phtml | 10 +- .../frontend/templates/order/invoice.phtml | 6 +- .../templates/order/invoice/items.phtml | 77 +++++------ .../invoice/items/renderer/default.phtml | 53 ++++--- .../view/frontend/templates/order/items.phtml | 60 ++++---- .../order/items/renderer/default.phtml | 72 +++++----- .../templates/order/order_comments.phtml | 15 +- .../frontend/templates/order/order_date.phtml | 6 +- .../templates/order/order_status.phtml | 2 +- .../templates/order/print/creditmemo.phtml | 47 +++---- .../templates/order/print/invoice.phtml | 55 ++++---- .../templates/order/print/shipment.phtml | 129 +++++++++--------- .../frontend/templates/order/recent.phtml | 55 ++++---- .../shipment/items/renderer/default.phtml | 55 ++++---- .../frontend/templates/order/totals.phtml | 34 +++-- .../view/frontend/templates/order/view.phtml | 30 ++-- .../frontend/templates/reorder/sidebar.phtml | 20 ++- .../templates/widget/guest/form.phtml | 24 ++-- 41 files changed, 623 insertions(+), 662 deletions(-) diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml index f7d5f4aa8aa33..85ca9c8159bcc 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml @@ -3,10 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +/** @var $block \Magento\Sales\Block\Adminhtml\Order\Create\Form\Account */ ?> -
- getHeaderText() ?> +
+ escapeHtml($block->getHeaderText()) ?>
diff --git a/app/code/Magento/Sales/view/frontend/templates/email/creditmemo/items.phtml b/app/code/Magento/Sales/view/frontend/templates/email/creditmemo/items.phtml index 8cef5d57664a9..90c3ddeee5a30 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/creditmemo/items.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/creditmemo/items.phtml @@ -4,28 +4,26 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> getCreditmemo() ?> getOrder() ?> - + - getAllItems() as $_item): ?> - getOrderItem()->getParentItem()) : ?> + getAllItems() as $_item) : ?> + getOrderItem()->getParentItem()) : ?> getItemHtml($_item) ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/invoice/items.phtml b/app/code/Magento/Sales/view/frontend/templates/email/invoice/items.phtml index 4c377dea47da2..e2efd650295d4 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/invoice/items.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/invoice/items.phtml @@ -4,27 +4,25 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> getInvoice() ?> getOrder() ?> - + - getAllItems() as $_item): ?> + getAllItems() as $_item) : ?> getOrderItem()->getParentItem()) : ?> getItemHtml($_item) ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items.phtml index 37469582865dc..1bba8166762c7 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items.phtml @@ -4,27 +4,28 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate +/** @var $block \Magento\Sales\Block\Order\Email\Items */ ?> getOrder() ?> - +getAllItems(); ?> - + getParentItem()) : ?> getItemHtml($_item) ?> @@ -35,17 +36,21 @@ getChildHtml('order_totals') ?> - helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?> - helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_order->getGiftMessageId()); ?> - + helper(\Magento\GiftMessage\Helper\Message::class) + ->isMessagesAllowed('order', $_order, $_order->getStore()) + && $_order->getGiftMessageId() + ) : ?> + helper(\Magento\GiftMessage\Helper\Message::class) + ->getGiftMessage($_order->getGiftMessageId()); ?> +
diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/creditmemo/default.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/creditmemo/default.phtml index 20c2c1869fedb..566b0060d1a74 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/creditmemo/default.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/creditmemo/default.phtml @@ -4,21 +4,19 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> getItem() ?> getItem()->getOrder(); ?> - - + diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml index 1fca65932b0b0..2ef34b406e25c 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml @@ -3,34 +3,31 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> getItem() ?> getItem()->getOrder(); ?> - - + diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/order/default.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/order/default.phtml index 2974e4cd7ad80..6edd536b2b8ce 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/order/default.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/order/default.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile +// phpcs:disable Magento2.Templates.ThisInTemplate /** @var $block \Magento\Sales\Block\Order\Email\Items\DefaultItems */ @@ -13,15 +13,15 @@ $_item = $block->getItem(); $_order = $_item->getOrder(); ?> - - + -getGiftMessageId() && $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_item->getGiftMessageId())): ?> - +getGiftMessageId() + && $_giftMessage = $this->helper(\Magento\GiftMessage\Helper\Message::class) + ->getGiftMessage($_item->getGiftMessageId()) +) : ?> + + + + + + + + +
-

- escapeHtml($_giftMessage->getSender()) ?> -
escapeHtml($_giftMessage->getRecipient()) ?> -
+

escapeHtml(__('Gift Message for this Order')) ?>

+ escapeHtml(__('From:')) ?> escapeHtml($_giftMessage->getSender()) ?> +
escapeHtml(__('To:')) ?> escapeHtml($_giftMessage->getRecipient()) ?> +
escapeHtml(__('Message:')) ?>
escapeHtml($_giftMessage->getMessage()) ?>
+

escapeHtml($_item->getName()) ?>

-

: escapeHtml($block->getSku($_item)) ?>

- getItemOptions()): ?> +

escapeHtml(__('SKU')) ?>: escapeHtml($block->getSku($_item)) ?>

+ getItemOptions()) : ?>
- getItemOptions() as $option): ?> -
+ getItemOptions() as $option) : ?> +
escapeHtml($option['label']) ?>
- +
@@ -29,8 +27,8 @@ escapeHtml($_item->getDescription()) ?>
getQty() * 1 ?>getQty() * 1 ?> - getItemPrice($_item) ?> + getItemPrice($_item) ?>
+

escapeHtml($_item->getName()) ?>

-

: escapeHtml($block->getSku($_item)) ?>

- getItemOptions()): ?> +

escapeHtml(__('SKU')) ?>: escapeHtml($block->getSku($_item)) ?>

+ getItemOptions()) : ?>
- getItemOptions() as $option): ?> -
+ getItemOptions() as $option) : ?> +
escapeHtml($option['label']) ?>
- +
getProductAdditionalInformationBlock(); ?> - + setItem($_item->getOrderItem())->toHtml() ?> escapeHtml($_item->getDescription()) ?>
getQty() * 1 ?>getQty() * 1 ?> - getItemPrice($_item->getOrderItem()) ?> + getItemPrice($_item->getOrderItem()) ?>
+

escapeHtml($_item->getName()) ?>

-

: escapeHtml($block->getSku($_item)) ?>

- getItemOptions()): ?> +

escapeHtml(__('SKU')) ?>: escapeHtml($block->getSku($_item)) ?>

+ getItemOptions()) : ?>
- getItemOptions() as $option): ?> -
+ getItemOptions() as $option) : ?> +
escapeHtml($option['label']) ?>
- +
@@ -32,21 +32,24 @@ $_order = $_item->getOrder(); escapeHtml($_item->getDescription()) ?>
getQtyOrdered() * 1 ?>getQtyOrdered() * 1 ?> - getItemPrice($_item) ?> + getItemPrice($_item) ?>
diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/price/row.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/price/row.phtml index 106aeb16c2897..a2148a4f8fcb9 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/price/row.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/price/row.phtml @@ -3,9 +3,6 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// @codingStandardsIgnoreFile - ?> getItem(); $_order = $_item->getOrder(); ?> -formatPrice($_item->getRowTotal()) ?> +formatPrice($_item->getRowTotal()) ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/shipment/default.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/shipment/default.phtml index f41a09f5da0f3..8fba7f9b66c84 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/shipment/default.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/shipment/default.phtml @@ -4,29 +4,27 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** @var $_item \Magento\Sales\Model\Order\Item */ $_item = $block->getItem() ?> - - + diff --git a/app/code/Magento/Sales/view/frontend/templates/email/shipment/items.phtml b/app/code/Magento/Sales/view/frontend/templates/email/shipment/items.phtml index 022511ae3cfd0..956705fb7b55d 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/shipment/items.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/shipment/items.phtml @@ -4,24 +4,22 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> getShipment() ?> getOrder() ?> - +
-

- escapeHtml($_giftMessage->getSender()) ?> -
escapeHtml($_giftMessage->getRecipient()) ?> -
+

escapeHtml(__('Gift Message')) ?>

+ escapeHtml(__('From:')) ?> escapeHtml($_giftMessage->getSender()) ?> +
escapeHtml(__('To:')) ?> escapeHtml($_giftMessage->getRecipient()) ?> +
escapeHtml(__('Message:')) ?>
escapeHtml($_giftMessage->getMessage()) ?>
+

escapeHtml($_item->getName()) ?>

-

: escapeHtml($block->getSku($_item)) ?>

- getItemOptions()): ?> +

escapeHtml(__('SKU')) ?>: escapeHtml($block->getSku($_item)) ?>

+ getItemOptions()) : ?>
- getItemOptions() as $option): ?> -
+ getItemOptions() as $option) : ?> +
escapeHtml($option['label']) ?>
- +
getProductAdditionalInformationBlock(); ?> - + setItem($_item->getOrderItem())->toHtml() ?> escapeHtml($_item->getDescription()) ?>
getQty() * 1 ?>getQty() * 1 ?>
- getAllItems() as $_item): ?> + getAllItems() as $_item) : ?> getOrderItem()->getParentItem()) : ?> getItemHtml($_item) ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml b/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml index 6de8e42dea583..4c9993c764a8c 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml @@ -4,30 +4,28 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> getShipment() ?> getOrder() ?> - -getTracksCollection($_shipment->getId()) ?> - -
- - - - - - - - - + + getTracksCollection($_shipment->getId()) ?> + +
+
+ - - + + - - -
escapeHtml($_item->getTitle()) ?>:escapeHtml($_item->getNumber()) ?>escapeHtml(__('Shipped By')) ?>escapeHtml(__('Tracking Number')) ?>
- + +
escapeHtml($_item->getTitle()) ?>:escapeHtml($_item->getNumber()) ?>
+ diff --git a/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml b/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml index 89be190588677..a8dd694f13e60 100644 --- a/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml @@ -4,17 +4,18 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - ?> -