Passed
Push — master ( 039be9...9e3ef1 )
by Brian
04:51
created
widgets/buy-item.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
                     'advanced'    => false
39 39
                 ),
40 40
                 'items'  => array(
41
-	                'title'       => __( 'Items to buy', 'invoicing' ),
42
-	                'desc'        => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2 ', 'invoicing' ),
43
-	                'type'        => 'text',
44
-	                'desc_tip'    => true,
45
-	                'default'     => '',
46
-	                'placeholder' => __('Items to buy','invoicing'),
47
-	                'advanced'    => false
41
+                    'title'       => __( 'Items to buy', 'invoicing' ),
42
+                    'desc'        => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2 ', 'invoicing' ),
43
+                    'type'        => 'text',
44
+                    'desc_tip'    => true,
45
+                    'default'     => '',
46
+                    'placeholder' => __('Items to buy','invoicing'),
47
+                    'advanced'    => false
48 48
                 ),
49 49
                 'label'  => array(
50
-	                'title'       => __( 'Button Label', 'invoicing' ),
51
-	                'desc'        => __( 'Enter button label. Default "Buy Now".', 'invoicing' ),
52
-	                'type'        => 'text',
53
-	                'desc_tip'    => true,
54
-	                'default'     => __( 'Buy Now', 'invoicing' ),
55
-	                'advanced'    => false
50
+                    'title'       => __( 'Button Label', 'invoicing' ),
51
+                    'desc'        => __( 'Enter button label. Default "Buy Now".', 'invoicing' ),
52
+                    'type'        => 'text',
53
+                    'desc_tip'    => true,
54
+                    'default'     => __( 'Buy Now', 'invoicing' ),
55
+                    'advanced'    => false
56 56
                 ),
57 57
                 'post_id'  => array(
58
-	                'title'       => __( 'Post ID', 'invoicing' ),
59
-	                'desc'        => __( 'Enter related post ID. This is for 3rd party add ons and not mandatory field.', 'invoicing' ),
60
-	                'type'        => 'number',
61
-	                'desc_tip'    => true,
62
-	                'default'     => '',
63
-	                'advanced'    => true
58
+                    'title'       => __( 'Post ID', 'invoicing' ),
59
+                    'desc'        => __( 'Enter related post ID. This is for 3rd party add ons and not mandatory field.', 'invoicing' ),
60
+                    'type'        => 'number',
61
+                    'desc_tip'    => true,
62
+                    'default'     => '',
63
+                    'advanced'    => true
64 64
                 ),
65 65
             )
66 66
 
@@ -70,43 +70,43 @@  discard block
 block discarded – undo
70 70
         parent::__construct( $options );
71 71
     }
72 72
 
73
-	/**
74
-	 * The Super block output function.
75
-	 *
76
-	 * @param array $args
77
-	 * @param array $widget_args
78
-	 * @param string $content
79
-	 *
80
-	 * @return string
81
-	 */
73
+    /**
74
+     * The Super block output function.
75
+     *
76
+     * @param array $args
77
+     * @param array $widget_args
78
+     * @param string $content
79
+     *
80
+     * @return string
81
+     */
82 82
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
83 83
 
84
-	    $defaults = array(
85
-		    'items'     	=> '', // should be used like: item_id|quantity,item_id|quantity,item_id|quantity
86
-		    'label'  	    => __( 'Buy Now', 'invoicing' ), // the button title
87
-		    'post_id'   	=> '', // any related post_id
88
-	    );
84
+        $defaults = array(
85
+            'items'     	=> '', // should be used like: item_id|quantity,item_id|quantity,item_id|quantity
86
+            'label'  	    => __( 'Buy Now', 'invoicing' ), // the button title
87
+            'post_id'   	=> '', // any related post_id
88
+        );
89 89
 
90
-	    /**
91
-	     * Parse incoming $args into an array and merge it with $defaults
92
-	     */
93
-	    $args = wp_parse_args( $args, $defaults );
90
+        /**
91
+         * Parse incoming $args into an array and merge it with $defaults
92
+         */
93
+        $args = wp_parse_args( $args, $defaults );
94 94
 
95
-		$html = '<div class="wpi-buy-button-wrapper wpi-g">';
95
+        $html = '<div class="wpi-buy-button-wrapper wpi-g">';
96 96
 		
97
-		if ( empty( $args['items'] ) ) {
98
-			$html .= __( 'No items selected', 'invoicing' );
99
-		} else {
100
-			$post_id = isset( $args['post_id'] ) && is_numeric( $args['post_id'] ) ? sanitize_text_field( $args['post_id'] ) : 0;
101
-			$label   = isset( $args['label'] ) ? sanitize_text_field( $args['label'] ) : __( 'Buy Now', 'invoicing' );
102
-			$items   = esc_attr( $args['items'] );
103
-			$html   .= "<button class='button button-primary wpi-buy-button' type='button' onclick=\"wpi_buy(this, '$items','$post_id');\">$label</button>";
104
-		}
97
+        if ( empty( $args['items'] ) ) {
98
+            $html .= __( 'No items selected', 'invoicing' );
99
+        } else {
100
+            $post_id = isset( $args['post_id'] ) && is_numeric( $args['post_id'] ) ? sanitize_text_field( $args['post_id'] ) : 0;
101
+            $label   = isset( $args['label'] ) ? sanitize_text_field( $args['label'] ) : __( 'Buy Now', 'invoicing' );
102
+            $items   = esc_attr( $args['items'] );
103
+            $html   .= "<button class='button button-primary wpi-buy-button' type='button' onclick=\"wpi_buy(this, '$items','$post_id');\">$label</button>";
104
+        }
105 105
 	
106
-	    $html .= wp_nonce_field( 'wpinv_buy_items', 'wpinv_buy_nonce', true, false );
107
-	    $html .= '</div>';
106
+        $html .= wp_nonce_field( 'wpinv_buy_items', 'wpinv_buy_nonce', true, false );
107
+        $html .= '</div>';
108 108
 
109
-	    return $html;
109
+        return $html;
110 110
 
111 111
     }
112 112
 
Please login to merge, or discard this patch.