Fixed class-wc-shortcode-order-tracking.php PHPCS violations

This commit is contained in:
Claudio Sanches 2018-03-09 13:15:53 -03:00
parent af8c59de94
commit 505d906c66
1 changed files with 20 additions and 19 deletions

View File

@ -1,25 +1,24 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Order Tracking Shortcode
*
* Lets a user see the status of an order by entering their order details.
*
* @author WooThemes
* @category Shortcodes
* @package WooCommerce/Shortcodes/Order_Tracking
* @version 3.0.0
* @package WooCommerce/Shortcodes/Order_Tracking
* @version 3.0.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Shortcode order tracking class.
*/
class WC_Shortcode_Order_Tracking {
/**
* Get the shortcode content.
*
* @param array $atts
* @param array $atts Shortcode attributes.
* @return string
*/
public static function get( $atts ) {
@ -29,20 +28,20 @@ class WC_Shortcode_Order_Tracking {
/**
* Output the shortcode.
*
* @param array $atts
* @param array $atts Shortcode attributes.
*/
public static function output( $atts ) {
// Check cart class is loaded or abort
// Check cart class is loaded or abort.
if ( is_null( WC()->cart ) ) {
return;
}
extract( shortcode_atts( array(), $atts, 'woocommerce_order_tracking' ) );
$atts = shortcode_atts( array(), $atts, 'woocommerce_order_tracking' );
if ( isset( $_REQUEST['orderid'], $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-order_tracking' ) ) {
if ( isset( $_REQUEST['orderid'], $_POST['_wpnonce'] ) && wp_verify_nonce( wc_clean( wp_unslash( $_POST['_wpnonce'] ) ), 'woocommerce-order_tracking' ) ) { // WPCS: input var ok.
$order_id = empty( $_REQUEST['orderid'] ) ? 0 : wc_clean( ltrim( $_REQUEST['orderid'], '#' ) );
$order_email = empty( $_REQUEST['order_email'] ) ? '' : sanitize_email( $_REQUEST['order_email'] );
$order_id = empty( $_REQUEST['orderid'] ) ? 0 : ltrim( wc_clean( wp_unslash( $_REQUEST['orderid'] ) ), '#' ); // WPCS: input var ok.
$order_email = empty( $_REQUEST['order_email'] ) ? '' : sanitize_email( wp_unslash( $_REQUEST['order_email'] ) ); // WPCS: input var ok.
if ( ! $order_id ) {
wc_add_notice( __( 'Please enter a valid order ID', 'woocommerce' ), 'error' );
@ -53,9 +52,11 @@ class WC_Shortcode_Order_Tracking {
if ( $order && $order->get_id() && strtolower( $order->get_billing_email() ) === strtolower( $order_email ) ) {
do_action( 'woocommerce_track_order', $order->get_id() );
wc_get_template( 'order/tracking.php', array(
'order' => $order,
) );
wc_get_template(
'order/tracking.php', array(
'order' => $order,
)
);
return;
} else {
wc_add_notice( __( 'Sorry, the order could not be found. Please contact us if you are having difficulty finding your order details.', 'woocommerce' ), 'error' );