Passed
Push — master ( b3b246...bcec86 )
by Brian
05:30
created
templates/payment-forms/elements/ip_address.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-if ( empty( $text ) ) {
13
-    $text = __( 'Your IP address is:', 'invoicing' );
12
+if (empty($text)) {
13
+    $text = __('Your IP address is:', 'invoicing');
14 14
 }
15 15
 
16
-$ip_address = sanitize_text_field( wpinv_get_ip() );
17
-$url        = esc_url( getpaid_ip_location_url( $ip_address ) );
16
+$ip_address = sanitize_text_field(wpinv_get_ip());
17
+$url        = esc_url(getpaid_ip_location_url($ip_address));
18 18
 
19 19
 ?>
20 20
 <div class="form-group getpaid-ip-info">
21
-    <span><?php echo wp_kses_post( $text ); ?></span>
21
+    <span><?php echo wp_kses_post($text); ?></span>
22 22
     <a target='_blank' href='<?php echo $url; ?>'><?php echo $ip_address; ?>&nbsp;&nbsp;<i class='fa fa-external-link-square' aria-hidden='true'></i></a>
23 23
 </div>
Please login to merge, or discard this patch.
templates/payment-forms/cart.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,29 +7,29 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Cart table columns.
13 13
 $columns = array(
14
-    'name'     => __( 'Item', 'invoicing' ),
15
-    'price'    => __( 'Price', 'invoicing' ),
16
-    'quantity' => __( 'Quantity', 'invoicing' ),
17
-    'subtotal' => __( 'Subtotal', 'invoicing' ),
14
+    'name'     => __('Item', 'invoicing'),
15
+    'price'    => __('Price', 'invoicing'),
16
+    'quantity' => __('Quantity', 'invoicing'),
17
+    'subtotal' => __('Subtotal', 'invoicing'),
18 18
 );
19 19
 
20
-if ( ! empty( $form->invoice ) ) {
21
-    $columns = getpaid_invoice_item_columns( $form->invoice );
20
+if (!empty($form->invoice)) {
21
+    $columns = getpaid_invoice_item_columns($form->invoice);
22 22
 }
23 23
 
24
-$columns = apply_filters( 'getpaid_payment_form_cart_table_columns', $columns, $form );
24
+$columns = apply_filters('getpaid_payment_form_cart_table_columns', $columns, $form);
25 25
 
26 26
 ?>
27 27
     <div class="getpaid-payment-form-items-cart border">
28 28
         <div class="getpaid-payment-form-items-cart-header">
29 29
             <div class="form-row">
30
-            <?php foreach ( $columns as $key => $label ) : ?>
31
-                <div class="<?php echo 'name' == $key ? 'col-12 col-sm-5' : 'col-12 col-sm' ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>">
32
-                    <?php echo sanitize_text_field( $label ); ?>
30
+            <?php foreach ($columns as $key => $label) : ?>
31
+                <div class="<?php echo 'name' == $key ? 'col-12 col-sm-5' : 'col-12 col-sm' ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>">
32
+                    <?php echo sanitize_text_field($label); ?>
33 33
                 </div>
34 34
             <?php endforeach; ?>
35 35
             </div>
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
         <?php
38 38
 
39 39
             // Display the item totals.
40
-            foreach ( $form->get_items() as $item ) {
41
-                wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'columns' ) );
40
+            foreach ($form->get_items() as $item) {
41
+                wpinv_get_template('payment-forms/cart-item.php', compact('form', 'item', 'columns'));
42 42
             }
43 43
 
44 44
             // Display the cart totals.
45
-            wpinv_get_template( 'payment-forms/cart-totals.php', compact( 'form' ) );
45
+            wpinv_get_template('payment-forms/cart-totals.php', compact('form'));
46 46
 
47 47
         ?>
48 48
     </div>
Please login to merge, or discard this patch.
templates/geolocation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 
13 13
 ?><!DOCTYPE html>
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 
17 17
     <head>
18 18
 
19
-		<meta charset="<?php bloginfo( 'charset' ); ?>">
19
+		<meta charset="<?php bloginfo('charset'); ?>">
20 20
         <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" >
21 21
 
22 22
         <meta name="robots" content="noindex,nofollow">
23 23
 
24 24
 		<link rel="profile" href="https://gmpg.org/xfn/11">
25 25
 
26
-        <title><?php _e( 'GetPaid GeoLocation', 'invoicing' ); ?></title>
26
+        <title><?php _e('GetPaid GeoLocation', 'invoicing'); ?></title>
27 27
 
28 28
         <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
29 29
         <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
70 70
                 osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
71 71
                 osm = L.tileLayer( osmUrl, { maxZoom: 18, attribution: osmAttrib } ),
72
-                latlng = new L.LatLng( <?php echo sanitize_text_field( $latitude );?>, <?php echo sanitize_text_field( $longitude );?> );
72
+                latlng = new L.LatLng( <?php echo sanitize_text_field($latitude); ?>, <?php echo sanitize_text_field($longitude); ?> );
73 73
 
74 74
             var map = new L.Map( 'map', {center: latlng, zoom: 18, layers: [osm]});
75 75
 
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
             map.addLayer(marker);
78 78
 
79 79
             marker
80
-                .bindPopup("<p><?php echo esc_attr( $address );?></p>")
80
+                .bindPopup("<p><?php echo esc_attr($address); ?></p>")
81 81
                 .openPopup();
82 82
         </script>
83 83
 
84
-        <div style="height:100px"><?php echo wp_kses_post( $content ); ?></div>
84
+        <div style="height:100px"><?php echo wp_kses_post($content); ?></div>
85 85
 
86 86
     </body>
87 87
 
Please login to merge, or discard this patch.
includes/class-getpaid-form-item.php 2 patches
Indentation   +348 added lines, -348 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 /**
@@ -10,60 +10,60 @@  discard block
 block discarded – undo
10 10
 class GetPaid_Form_Item  extends WPInv_Item {
11 11
 
12 12
     /**
13
-	 * Stores a custom description for the item.
14
-	 *
15
-	 * @var string
16
-	 */
17
-	protected $custom_description = null;
18
-
19
-	/**
20
-	 * Stores the item quantity.
21
-	 *
22
-	 * @var int
23
-	 */
24
-	protected $quantity = 1;
25
-
26
-	/**
27
-	 * Stores the item meta.
28
-	 *
29
-	 * @var array
30
-	 */
31
-	protected $meta = array();
32
-
33
-	/**
34
-	 * Is this item required?
35
-	 *
36
-	 * @var int
37
-	 */
38
-	protected $is_required = true;
39
-
40
-	/**
41
-	 * Are quantities allowed?
42
-	 *
43
-	 * @var int
44
-	 */
45
-	protected $allow_quantities = false;
46
-
47
-	/**
48
-	 * Associated invoice.
49
-	 *
50
-	 * @var int
51
-	 */
52
-	public $invoice_id = 0;
53
-
54
-	/**
55
-	 * Item discount.
56
-	 *
57
-	 * @var float
58
-	 */
59
-	public $item_discount = 0;
60
-
61
-	/**
62
-	 * Item tax.
63
-	 *
64
-	 * @var float
65
-	 */
66
-	public $item_tax = 0;
13
+     * Stores a custom description for the item.
14
+     *
15
+     * @var string
16
+     */
17
+    protected $custom_description = null;
18
+
19
+    /**
20
+     * Stores the item quantity.
21
+     *
22
+     * @var int
23
+     */
24
+    protected $quantity = 1;
25
+
26
+    /**
27
+     * Stores the item meta.
28
+     *
29
+     * @var array
30
+     */
31
+    protected $meta = array();
32
+
33
+    /**
34
+     * Is this item required?
35
+     *
36
+     * @var int
37
+     */
38
+    protected $is_required = true;
39
+
40
+    /**
41
+     * Are quantities allowed?
42
+     *
43
+     * @var int
44
+     */
45
+    protected $allow_quantities = false;
46
+
47
+    /**
48
+     * Associated invoice.
49
+     *
50
+     * @var int
51
+     */
52
+    public $invoice_id = 0;
53
+
54
+    /**
55
+     * Item discount.
56
+     *
57
+     * @var float
58
+     */
59
+    public $item_discount = 0;
60
+
61
+    /**
62
+     * Item tax.
63
+     *
64
+     * @var float
65
+     */
66
+    public $item_tax = 0;
67 67
 
68 68
     /*
69 69
 	|--------------------------------------------------------------------------
@@ -81,226 +81,226 @@  discard block
 block discarded – undo
81 81
     */
82 82
 
83 83
     /**
84
-	 * Get the item name.
85
-	 *
86
-	 * @since 1.0.19
87
-	 * @param  string $context View or edit context.
88
-	 * @return string
89
-	 */
90
-	public function get_name( $context = 'view' ) {
91
-		$name = parent::get_name( $context );
92
-		return $name . wpinv_get_item_suffix( $this );
93
-	}
94
-
95
-	/**
96
-	 * Get the item name without a suffix.
97
-	 *
98
-	 * @since 1.0.19
99
-	 * @param  string $context View or edit context.
100
-	 * @return string
101
-	 */
102
-	public function get_raw_name( $context = 'view' ) {
103
-		return parent::get_name( $context );
104
-	}
105
-
106
-	/**
107
-	 * Get the item description.
108
-	 *
109
-	 * @since 1.0.19
110
-	 * @param  string $context View or edit context.
111
-	 * @return string
112
-	 */
113
-	public function get_description( $context = 'view' ) {
114
-
115
-		if ( isset( $this->custom_description ) ) {
116
-			return $this->custom_description;
117
-		}
118
-
119
-		return parent::get_description( $context );
120
-	}
121
-
122
-	/**
123
-	 * Returns the sub total.
124
-	 *
125
-	 * @since 1.0.19
126
-	 * @param  string $context View or edit context.
127
-	 * @return int
128
-	 */
129
-	public function get_sub_total( $context = 'view' ) {
130
-		return $this->get_quantity( $context ) * $this->get_initial_price( $context );
131
-	}
132
-
133
-	/**
134
-	 * Returns the recurring sub total.
135
-	 *
136
-	 * @since 1.0.19
137
-	 * @param  string $context View or edit context.
138
-	 * @return int
139
-	 */
140
-	public function get_recurring_sub_total( $context = 'view' ) {
141
-		return $this->get_quantity( $context ) * $this->get_price( $context );
142
-	}
143
-
144
-	/**
145
-	 * @deprecated
146
-	 */
147
-	public function get_qantity( $context = 'view' ) {
148
-		return $this->get_quantity( $context );
149
-	}
150
-
151
-	/**
152
-	 * Get the item quantity.
153
-	 *
154
-	 * @since 1.0.19
155
-	 * @param  string $context View or edit context.
156
-	 * @return int
157
-	 */
158
-	public function get_quantity( $context = 'view' ) {
159
-		$quantity = (int) $this->quantity;
160
-
161
-		if ( empty( $quantity ) || 1 > $quantity ) {
162
-			$quantity = 1;
163
-		}
164
-
165
-		if ( 'view' == $context ) {
166
-			return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this );
167
-		}
168
-
169
-		return $quantity;
170
-
171
-	}
172
-
173
-	/**
174
-	 * Get the item meta data.
175
-	 *
176
-	 * @since 1.0.19
177
-	 * @param  string $context View or edit context.
178
-	 * @return meta
179
-	 */
180
-	public function get_item_meta( $context = 'view' ) {
181
-		$meta = $this->meta;
182
-
183
-		if ( 'view' == $context ) {
184
-			return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this );
185
-		}
186
-
187
-		return $meta;
188
-
189
-	}
190
-
191
-	/**
192
-	 * Returns whether or not customers can update the item quantity.
193
-	 *
194
-	 * @since 1.0.19
195
-	 * @param  string $context View or edit context.
196
-	 * @return bool
197
-	 */
198
-	public function get_allow_quantities( $context = 'view' ) {
199
-		$allow_quantities = (bool) $this->allow_quantities;
200
-
201
-		if ( 'view' == $context ) {
202
-			return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
203
-		}
204
-
205
-		return $allow_quantities;
206
-
207
-	}
208
-
209
-	/**
210
-	 * Returns whether or not the item is required.
211
-	 *
212
-	 * @since 1.0.19
213
-	 * @param  string $context View or edit context.
214
-	 * @return bool
215
-	 */
216
-	public function get_is_required( $context = 'view' ) {
217
-		$is_required = (bool) $this->is_required;
218
-
219
-		if ( 'view' == $context ) {
220
-			return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
221
-		}
222
-
223
-		return $is_required;
224
-
225
-	}
226
-
227
-	/**
228
-	 * Prepares form data for use.
229
-	 *
230
-	 * @since 1.0.19
231
-	 * @return array
232
-	 */
233
-	public function prepare_data_for_use() {
234
-
235
-		return array(
236
-			'title'            => sanitize_text_field( $this->get_name() ),
237
-			'id'               => $this->get_id(),
238
-			'price'            => $this->get_price(),
239
-			'recurring'        => $this->is_recurring(),
240
-			'description'      => $this->get_description(),
241
-			'allow_quantities' => $this->allows_quantities(),
242
-			'required'         => $this->is_required(),
243
-		);
244
-
245
-	}
246
-
247
-	/**
248
-	 * Prepares form data for ajax use.
249
-	 *
250
-	 * @since 1.0.19
251
-	 * @return array
252
-	 */
253
-	public function prepare_data_for_invoice_edit_ajax( $currency = '' ) {
254
-
255
-		$description = getpaid_item_recurring_price_help_text( $this, $currency );
256
-
257
-		if ( $description ) {
258
-			$description = "<div class='getpaid-subscription-help-text'>$description</div>";
259
-		}
260
-
261
-		return array(
262
-			'id'     => $this->get_id(),
263
-			'texts'  => array(
264
-				'item-name'        => sanitize_text_field( $this->get_name() ),
265
-				'item-description' => wp_kses_post( $this->get_description() ) . $description,
266
-				'item-quantity'    => absint( $this->get_quantity() ),
267
-				'item-price'       => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ),
268
-				'item-total'       => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ),
269
-			),
270
-			'inputs' => array(
271
-				'item-id'          => $this->get_id(),
272
-				'item-name'        => sanitize_text_field( $this->get_name() ),
273
-				'item-description' => wp_kses_post( $this->get_description() ),
274
-				'item-quantity'    => absint( $this->get_quantity() ),
275
-				'item-price'       => $this->get_price(),
276
-			)
277
-		);
278
-
279
-	}
280
-
281
-	/**
282
-	 * Prepares form data for saving (cart_details).
283
-	 *
284
-	 * @since 1.0.19
285
-	 * @return array
286
-	 */
287
-	public function prepare_data_for_saving() {
288
-
289
-		return array(
290
-			'post_id'           => $this->invoice_id,
291
-			'item_id'           => $this->get_id(),
292
-			'item_name'         => sanitize_text_field( $this->get_raw_name() ),
293
-			'item_description'  => $this->get_description(),
294
-			'tax'               => $this->item_tax,
295
-			'item_price'        => $this->get_price(),
296
-			'quantity'          => (int) $this->get_quantity(),
297
-			'discount'          => $this->item_discount,
298
-			'subtotal'          => $this->get_sub_total(),
299
-			'price'             => $this->get_sub_total() + $this->item_tax + $this->item_discount,
300
-			'meta'              => $this->get_item_meta(),
301
-		);
302
-
303
-	}
84
+     * Get the item name.
85
+     *
86
+     * @since 1.0.19
87
+     * @param  string $context View or edit context.
88
+     * @return string
89
+     */
90
+    public function get_name( $context = 'view' ) {
91
+        $name = parent::get_name( $context );
92
+        return $name . wpinv_get_item_suffix( $this );
93
+    }
94
+
95
+    /**
96
+     * Get the item name without a suffix.
97
+     *
98
+     * @since 1.0.19
99
+     * @param  string $context View or edit context.
100
+     * @return string
101
+     */
102
+    public function get_raw_name( $context = 'view' ) {
103
+        return parent::get_name( $context );
104
+    }
105
+
106
+    /**
107
+     * Get the item description.
108
+     *
109
+     * @since 1.0.19
110
+     * @param  string $context View or edit context.
111
+     * @return string
112
+     */
113
+    public function get_description( $context = 'view' ) {
114
+
115
+        if ( isset( $this->custom_description ) ) {
116
+            return $this->custom_description;
117
+        }
118
+
119
+        return parent::get_description( $context );
120
+    }
121
+
122
+    /**
123
+     * Returns the sub total.
124
+     *
125
+     * @since 1.0.19
126
+     * @param  string $context View or edit context.
127
+     * @return int
128
+     */
129
+    public function get_sub_total( $context = 'view' ) {
130
+        return $this->get_quantity( $context ) * $this->get_initial_price( $context );
131
+    }
132
+
133
+    /**
134
+     * Returns the recurring sub total.
135
+     *
136
+     * @since 1.0.19
137
+     * @param  string $context View or edit context.
138
+     * @return int
139
+     */
140
+    public function get_recurring_sub_total( $context = 'view' ) {
141
+        return $this->get_quantity( $context ) * $this->get_price( $context );
142
+    }
143
+
144
+    /**
145
+     * @deprecated
146
+     */
147
+    public function get_qantity( $context = 'view' ) {
148
+        return $this->get_quantity( $context );
149
+    }
150
+
151
+    /**
152
+     * Get the item quantity.
153
+     *
154
+     * @since 1.0.19
155
+     * @param  string $context View or edit context.
156
+     * @return int
157
+     */
158
+    public function get_quantity( $context = 'view' ) {
159
+        $quantity = (int) $this->quantity;
160
+
161
+        if ( empty( $quantity ) || 1 > $quantity ) {
162
+            $quantity = 1;
163
+        }
164
+
165
+        if ( 'view' == $context ) {
166
+            return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this );
167
+        }
168
+
169
+        return $quantity;
170
+
171
+    }
172
+
173
+    /**
174
+     * Get the item meta data.
175
+     *
176
+     * @since 1.0.19
177
+     * @param  string $context View or edit context.
178
+     * @return meta
179
+     */
180
+    public function get_item_meta( $context = 'view' ) {
181
+        $meta = $this->meta;
182
+
183
+        if ( 'view' == $context ) {
184
+            return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this );
185
+        }
186
+
187
+        return $meta;
188
+
189
+    }
190
+
191
+    /**
192
+     * Returns whether or not customers can update the item quantity.
193
+     *
194
+     * @since 1.0.19
195
+     * @param  string $context View or edit context.
196
+     * @return bool
197
+     */
198
+    public function get_allow_quantities( $context = 'view' ) {
199
+        $allow_quantities = (bool) $this->allow_quantities;
200
+
201
+        if ( 'view' == $context ) {
202
+            return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
203
+        }
204
+
205
+        return $allow_quantities;
206
+
207
+    }
208
+
209
+    /**
210
+     * Returns whether or not the item is required.
211
+     *
212
+     * @since 1.0.19
213
+     * @param  string $context View or edit context.
214
+     * @return bool
215
+     */
216
+    public function get_is_required( $context = 'view' ) {
217
+        $is_required = (bool) $this->is_required;
218
+
219
+        if ( 'view' == $context ) {
220
+            return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
221
+        }
222
+
223
+        return $is_required;
224
+
225
+    }
226
+
227
+    /**
228
+     * Prepares form data for use.
229
+     *
230
+     * @since 1.0.19
231
+     * @return array
232
+     */
233
+    public function prepare_data_for_use() {
234
+
235
+        return array(
236
+            'title'            => sanitize_text_field( $this->get_name() ),
237
+            'id'               => $this->get_id(),
238
+            'price'            => $this->get_price(),
239
+            'recurring'        => $this->is_recurring(),
240
+            'description'      => $this->get_description(),
241
+            'allow_quantities' => $this->allows_quantities(),
242
+            'required'         => $this->is_required(),
243
+        );
244
+
245
+    }
246
+
247
+    /**
248
+     * Prepares form data for ajax use.
249
+     *
250
+     * @since 1.0.19
251
+     * @return array
252
+     */
253
+    public function prepare_data_for_invoice_edit_ajax( $currency = '' ) {
254
+
255
+        $description = getpaid_item_recurring_price_help_text( $this, $currency );
256
+
257
+        if ( $description ) {
258
+            $description = "<div class='getpaid-subscription-help-text'>$description</div>";
259
+        }
260
+
261
+        return array(
262
+            'id'     => $this->get_id(),
263
+            'texts'  => array(
264
+                'item-name'        => sanitize_text_field( $this->get_name() ),
265
+                'item-description' => wp_kses_post( $this->get_description() ) . $description,
266
+                'item-quantity'    => absint( $this->get_quantity() ),
267
+                'item-price'       => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ),
268
+                'item-total'       => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ),
269
+            ),
270
+            'inputs' => array(
271
+                'item-id'          => $this->get_id(),
272
+                'item-name'        => sanitize_text_field( $this->get_name() ),
273
+                'item-description' => wp_kses_post( $this->get_description() ),
274
+                'item-quantity'    => absint( $this->get_quantity() ),
275
+                'item-price'       => $this->get_price(),
276
+            )
277
+        );
278
+
279
+    }
280
+
281
+    /**
282
+     * Prepares form data for saving (cart_details).
283
+     *
284
+     * @since 1.0.19
285
+     * @return array
286
+     */
287
+    public function prepare_data_for_saving() {
288
+
289
+        return array(
290
+            'post_id'           => $this->invoice_id,
291
+            'item_id'           => $this->get_id(),
292
+            'item_name'         => sanitize_text_field( $this->get_raw_name() ),
293
+            'item_description'  => $this->get_description(),
294
+            'tax'               => $this->item_tax,
295
+            'item_price'        => $this->get_price(),
296
+            'quantity'          => (int) $this->get_quantity(),
297
+            'discount'          => $this->item_discount,
298
+            'subtotal'          => $this->get_sub_total(),
299
+            'price'             => $this->get_sub_total() + $this->item_tax + $this->item_discount,
300
+            'meta'              => $this->get_item_meta(),
301
+        );
302
+
303
+    }
304 304
 
305 305
     /*
306 306
 	|--------------------------------------------------------------------------
@@ -312,70 +312,70 @@  discard block
 block discarded – undo
312 312
 	| object.
313 313
     */
314 314
 
315
-	/**
316
-	 * Set the item qantity.
317
-	 *
318
-	 * @since 1.0.19
319
-	 * @param  int $quantity The item quantity.
320
-	 */
321
-	public function set_quantity( $quantity ) {
322
-
323
-		if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
324
-			$quantity = 1;
325
-		}
326
-
327
-		$this->quantity = (int) $quantity;
328
-
329
-	}
330
-
331
-	/**
332
-	 * Set the item meta data.
333
-	 *
334
-	 * @since 1.0.19
335
-	 * @param  array $meta The item meta data.
336
-	 */
337
-	public function set_item_meta( $meta ) {
338
-		$this->meta = maybe_unserialize( $meta );
339
-	}
340
-
341
-	/**
342
-	 * Set whether or not the quantities are allowed.
343
-	 *
344
-	 * @since 1.0.19
345
-	 * @param  bool $allow_quantities
346
-	 */
347
-	public function set_allow_quantities( $allow_quantities ) {
348
-		$this->allow_quantities = (bool) $allow_quantities;
349
-	}
350
-
351
-	/**
352
-	 * Set whether or not the item is required.
353
-	 *
354
-	 * @since 1.0.19
355
-	 * @param  bool $is_required
356
-	 */
357
-	public function set_is_required( $is_required ) {
358
-		$this->is_required = (bool) $is_required;
359
-	}
360
-
361
-	/**
362
-	 * Sets the custom item description.
363
-	 *
364
-	 * @since 1.0.19
365
-	 * @param  string $description
366
-	 */
367
-	public function set_custom_description( $description ) {
368
-		$this->custom_description = $description;
369
-	}
315
+    /**
316
+     * Set the item qantity.
317
+     *
318
+     * @since 1.0.19
319
+     * @param  int $quantity The item quantity.
320
+     */
321
+    public function set_quantity( $quantity ) {
322
+
323
+        if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
324
+            $quantity = 1;
325
+        }
326
+
327
+        $this->quantity = (int) $quantity;
328
+
329
+    }
330
+
331
+    /**
332
+     * Set the item meta data.
333
+     *
334
+     * @since 1.0.19
335
+     * @param  array $meta The item meta data.
336
+     */
337
+    public function set_item_meta( $meta ) {
338
+        $this->meta = maybe_unserialize( $meta );
339
+    }
340
+
341
+    /**
342
+     * Set whether or not the quantities are allowed.
343
+     *
344
+     * @since 1.0.19
345
+     * @param  bool $allow_quantities
346
+     */
347
+    public function set_allow_quantities( $allow_quantities ) {
348
+        $this->allow_quantities = (bool) $allow_quantities;
349
+    }
350
+
351
+    /**
352
+     * Set whether or not the item is required.
353
+     *
354
+     * @since 1.0.19
355
+     * @param  bool $is_required
356
+     */
357
+    public function set_is_required( $is_required ) {
358
+        $this->is_required = (bool) $is_required;
359
+    }
360
+
361
+    /**
362
+     * Sets the custom item description.
363
+     *
364
+     * @since 1.0.19
365
+     * @param  string $description
366
+     */
367
+    public function set_custom_description( $description ) {
368
+        $this->custom_description = $description;
369
+    }
370 370
 
371 371
     /**
372 372
      * We do not want to save items to the database.
373 373
      * 
374
-	 * @return int item id
374
+     * @return int item id
375 375
      */
376 376
     public function save( $data = array() ) {
377 377
         return $this->get_id();
378
-	}
378
+    }
379 379
 
380 380
     /*
381 381
 	|--------------------------------------------------------------------------
@@ -387,23 +387,23 @@  discard block
 block discarded – undo
387 387
 	*/
388 388
 
389 389
     /**
390
-	 * Checks whether the item has enabled dynamic pricing.
391
-	 *
392
-	 * @since 1.0.19
393
-	 * @return bool
394
-	 */
395
-	public function is_required() {
390
+     * Checks whether the item has enabled dynamic pricing.
391
+     *
392
+     * @since 1.0.19
393
+     * @return bool
394
+     */
395
+    public function is_required() {
396 396
         return (bool) $this->get_is_required();
397
-	}
398
-
399
-	/**
400
-	 * Checks whether users can edit the quantities.
401
-	 *
402
-	 * @since 1.0.19
403
-	 * @return bool
404
-	 */
405
-	public function allows_quantities() {
397
+    }
398
+
399
+    /**
400
+     * Checks whether users can edit the quantities.
401
+     *
402
+     * @since 1.0.19
403
+     * @return bool
404
+     */
405
+    public function allows_quantities() {
406 406
         return (bool) $this->get_allow_quantities();
407
-	}
407
+    }
408 408
 
409 409
 }
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	 * @param  string $context View or edit context.
88 88
 	 * @return string
89 89
 	 */
90
-	public function get_name( $context = 'view' ) {
91
-		$name = parent::get_name( $context );
92
-		return $name . wpinv_get_item_suffix( $this );
90
+	public function get_name($context = 'view') {
91
+		$name = parent::get_name($context);
92
+		return $name . wpinv_get_item_suffix($this);
93 93
 	}
94 94
 
95 95
 	/**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 * @param  string $context View or edit context.
100 100
 	 * @return string
101 101
 	 */
102
-	public function get_raw_name( $context = 'view' ) {
103
-		return parent::get_name( $context );
102
+	public function get_raw_name($context = 'view') {
103
+		return parent::get_name($context);
104 104
 	}
105 105
 
106 106
 	/**
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 	 * @param  string $context View or edit context.
111 111
 	 * @return string
112 112
 	 */
113
-	public function get_description( $context = 'view' ) {
113
+	public function get_description($context = 'view') {
114 114
 
115
-		if ( isset( $this->custom_description ) ) {
115
+		if (isset($this->custom_description)) {
116 116
 			return $this->custom_description;
117 117
 		}
118 118
 
119
-		return parent::get_description( $context );
119
+		return parent::get_description($context);
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @param  string $context View or edit context.
127 127
 	 * @return int
128 128
 	 */
129
-	public function get_sub_total( $context = 'view' ) {
130
-		return $this->get_quantity( $context ) * $this->get_initial_price( $context );
129
+	public function get_sub_total($context = 'view') {
130
+		return $this->get_quantity($context) * $this->get_initial_price($context);
131 131
 	}
132 132
 
133 133
 	/**
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 	 * @param  string $context View or edit context.
138 138
 	 * @return int
139 139
 	 */
140
-	public function get_recurring_sub_total( $context = 'view' ) {
141
-		return $this->get_quantity( $context ) * $this->get_price( $context );
140
+	public function get_recurring_sub_total($context = 'view') {
141
+		return $this->get_quantity($context) * $this->get_price($context);
142 142
 	}
143 143
 
144 144
 	/**
145 145
 	 * @deprecated
146 146
 	 */
147
-	public function get_qantity( $context = 'view' ) {
148
-		return $this->get_quantity( $context );
147
+	public function get_qantity($context = 'view') {
148
+		return $this->get_quantity($context);
149 149
 	}
150 150
 
151 151
 	/**
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
 	 * @param  string $context View or edit context.
156 156
 	 * @return int
157 157
 	 */
158
-	public function get_quantity( $context = 'view' ) {
158
+	public function get_quantity($context = 'view') {
159 159
 		$quantity = (int) $this->quantity;
160 160
 
161
-		if ( empty( $quantity ) || 1 > $quantity ) {
161
+		if (empty($quantity) || 1 > $quantity) {
162 162
 			$quantity = 1;
163 163
 		}
164 164
 
165
-		if ( 'view' == $context ) {
166
-			return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this );
165
+		if ('view' == $context) {
166
+			return apply_filters('getpaid_payment_form_item_quantity', $quantity, $this);
167 167
 		}
168 168
 
169 169
 		return $quantity;
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 * @param  string $context View or edit context.
178 178
 	 * @return meta
179 179
 	 */
180
-	public function get_item_meta( $context = 'view' ) {
180
+	public function get_item_meta($context = 'view') {
181 181
 		$meta = $this->meta;
182 182
 
183
-		if ( 'view' == $context ) {
184
-			return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this );
183
+		if ('view' == $context) {
184
+			return apply_filters('getpaid_payment_form_item_meta', $meta, $this);
185 185
 		}
186 186
 
187 187
 		return $meta;
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 	 * @param  string $context View or edit context.
196 196
 	 * @return bool
197 197
 	 */
198
-	public function get_allow_quantities( $context = 'view' ) {
198
+	public function get_allow_quantities($context = 'view') {
199 199
 		$allow_quantities = (bool) $this->allow_quantities;
200 200
 
201
-		if ( 'view' == $context ) {
202
-			return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
201
+		if ('view' == $context) {
202
+			return apply_filters('getpaid_payment_form_item_allow_quantities', $allow_quantities, $this);
203 203
 		}
204 204
 
205 205
 		return $allow_quantities;
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	 * @param  string $context View or edit context.
214 214
 	 * @return bool
215 215
 	 */
216
-	public function get_is_required( $context = 'view' ) {
216
+	public function get_is_required($context = 'view') {
217 217
 		$is_required = (bool) $this->is_required;
218 218
 
219
-		if ( 'view' == $context ) {
220
-			return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
219
+		if ('view' == $context) {
220
+			return apply_filters('getpaid_payment_form_item_is_required', $is_required, $this);
221 221
 		}
222 222
 
223 223
 		return $is_required;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	public function prepare_data_for_use() {
234 234
 
235 235
 		return array(
236
-			'title'            => sanitize_text_field( $this->get_name() ),
236
+			'title'            => sanitize_text_field($this->get_name()),
237 237
 			'id'               => $this->get_id(),
238 238
 			'price'            => $this->get_price(),
239 239
 			'recurring'        => $this->is_recurring(),
@@ -250,28 +250,28 @@  discard block
 block discarded – undo
250 250
 	 * @since 1.0.19
251 251
 	 * @return array
252 252
 	 */
253
-	public function prepare_data_for_invoice_edit_ajax( $currency = '' ) {
253
+	public function prepare_data_for_invoice_edit_ajax($currency = '') {
254 254
 
255
-		$description = getpaid_item_recurring_price_help_text( $this, $currency );
255
+		$description = getpaid_item_recurring_price_help_text($this, $currency);
256 256
 
257
-		if ( $description ) {
257
+		if ($description) {
258 258
 			$description = "<div class='getpaid-subscription-help-text'>$description</div>";
259 259
 		}
260 260
 
261 261
 		return array(
262 262
 			'id'     => $this->get_id(),
263 263
 			'texts'  => array(
264
-				'item-name'        => sanitize_text_field( $this->get_name() ),
265
-				'item-description' => wp_kses_post( $this->get_description() ) . $description,
266
-				'item-quantity'    => absint( $this->get_quantity() ),
267
-				'item-price'       => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ),
268
-				'item-total'       => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ),
264
+				'item-name'        => sanitize_text_field($this->get_name()),
265
+				'item-description' => wp_kses_post($this->get_description()) . $description,
266
+				'item-quantity'    => absint($this->get_quantity()),
267
+				'item-price'       => wpinv_price(wpinv_format_amount($this->get_price()), $currency),
268
+				'item-total'       => wpinv_price(wpinv_format_amount($this->get_sub_total()), $currency),
269 269
 			),
270 270
 			'inputs' => array(
271 271
 				'item-id'          => $this->get_id(),
272
-				'item-name'        => sanitize_text_field( $this->get_name() ),
273
-				'item-description' => wp_kses_post( $this->get_description() ),
274
-				'item-quantity'    => absint( $this->get_quantity() ),
272
+				'item-name'        => sanitize_text_field($this->get_name()),
273
+				'item-description' => wp_kses_post($this->get_description()),
274
+				'item-quantity'    => absint($this->get_quantity()),
275 275
 				'item-price'       => $this->get_price(),
276 276
 			)
277 277
 		);
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		return array(
290 290
 			'post_id'           => $this->invoice_id,
291 291
 			'item_id'           => $this->get_id(),
292
-			'item_name'         => sanitize_text_field( $this->get_raw_name() ),
292
+			'item_name'         => sanitize_text_field($this->get_raw_name()),
293 293
 			'item_description'  => $this->get_description(),
294 294
 			'tax'               => $this->item_tax,
295 295
 			'item_price'        => $this->get_price(),
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 	 * @since 1.0.19
319 319
 	 * @param  int $quantity The item quantity.
320 320
 	 */
321
-	public function set_quantity( $quantity ) {
321
+	public function set_quantity($quantity) {
322 322
 
323
-		if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
323
+		if (empty($quantity) || !is_numeric($quantity)) {
324 324
 			$quantity = 1;
325 325
 		}
326 326
 
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
 	 * @since 1.0.19
335 335
 	 * @param  array $meta The item meta data.
336 336
 	 */
337
-	public function set_item_meta( $meta ) {
338
-		$this->meta = maybe_unserialize( $meta );
337
+	public function set_item_meta($meta) {
338
+		$this->meta = maybe_unserialize($meta);
339 339
 	}
340 340
 
341 341
 	/**
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 * @since 1.0.19
345 345
 	 * @param  bool $allow_quantities
346 346
 	 */
347
-	public function set_allow_quantities( $allow_quantities ) {
347
+	public function set_allow_quantities($allow_quantities) {
348 348
 		$this->allow_quantities = (bool) $allow_quantities;
349 349
 	}
350 350
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 * @since 1.0.19
355 355
 	 * @param  bool $is_required
356 356
 	 */
357
-	public function set_is_required( $is_required ) {
357
+	public function set_is_required($is_required) {
358 358
 		$this->is_required = (bool) $is_required;
359 359
 	}
360 360
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 * @since 1.0.19
365 365
 	 * @param  string $description
366 366
 	 */
367
-	public function set_custom_description( $description ) {
367
+	public function set_custom_description($description) {
368 368
 		$this->custom_description = $description;
369 369
 	}
370 370
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
      * 
374 374
 	 * @return int item id
375 375
      */
376
-    public function save( $data = array() ) {
376
+    public function save($data = array()) {
377 377
         return $this->get_id();
378 378
 	}
379 379
 
Please login to merge, or discard this patch.
templates/emails/wpinv-email-invoice-items.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$column_count = count( $columns );
12
+$column_count = count($columns);
13 13
 ?>
14 14
 
15
-<?php do_action( 'wpinv_before_email_items', $invoice ); ?>
15
+<?php do_action('wpinv_before_email_items', $invoice); ?>
16 16
 
17 17
 
18 18
 <div id="wpinv-email-items">
19 19
 
20 20
     <h3 class="wpinv-items-t">
21
-        <?php echo apply_filters( 'wpinv_email_items_title', __( 'Items', 'invoicing' ) ); ?>
21
+        <?php echo apply_filters('wpinv_email_items_title', __('Items', 'invoicing')); ?>
22 22
     </h3>
23 23
 
24 24
     <table id="wpinv_checkout_cart" class="table table-bordered table-hover">
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 
28 28
             <tr class="wpinv_cart_header_row">
29 29
 
30
-                <?php foreach ( $columns as $key => $label ) : ?>
31
-                    <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class( $key ); ?>">
32
-                        <?php echo sanitize_text_field( $label ); ?>
30
+                <?php foreach ($columns as $key => $label) : ?>
31
+                    <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class($key); ?>">
32
+                        <?php echo sanitize_text_field($label); ?>
33 33
                     </th>
34 34
                 <?php endforeach; ?>
35 35
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
             <?php
43 43
 
44 44
                 // Display the item totals.
45
-                foreach ( $invoice->get_items() as $item ) {
46
-                    wpinv_get_template( 'emails/invoice-item.php', compact( 'invoice', 'item', 'columns' ) );
45
+                foreach ($invoice->get_items() as $item) {
46
+                    wpinv_get_template('emails/invoice-item.php', compact('invoice', 'item', 'columns'));
47 47
                 }
48 48
 
49 49
             ?>
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         </tbody>
52 52
 
53 53
         <tfoot>
54
-            <?php wpinv_get_template( 'emails/invoice-totals.php', compact( 'invoice', 'column_count' ) ); ?>
54
+            <?php wpinv_get_template('emails/invoice-totals.php', compact('invoice', 'column_count')); ?>
55 55
         </tfoot>
56 56
     
57 57
     </table>
Please login to merge, or discard this patch.
templates/payment-forms/cart-totals.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Totals rows.
13 13
 $totals = apply_filters(
14 14
     'getpaid_payment_form_cart_table_totals',
15 15
     array(
16
-        'subtotal' => __( 'Subtotal', 'invoicing' ),
17
-        'tax'      => __( 'Tax', 'invoicing' ),
18
-        'discount' => __( 'Discount', 'invoicing' ),
19
-        'total'    => __( 'Total', 'invoicing' ),
16
+        'subtotal' => __('Subtotal', 'invoicing'),
17
+        'tax'      => __('Tax', 'invoicing'),
18
+        'discount' => __('Discount', 'invoicing'),
19
+        'total'    => __('Total', 'invoicing'),
20 20
     ),
21 21
     $form
22 22
 );
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
 $currency = $form->get_currency();
25 25
 $country  = wpinv_get_default_country();
26 26
 
27
-if ( ! empty( $form->invoice ) ) {
28
-    $country  = $form->invoice->get_country();
27
+if (!empty($form->invoice)) {
28
+    $country = $form->invoice->get_country();
29 29
 }
30 30
 
31
-if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) {
32
-    unset( $totals['tax'] );
31
+if (!wpinv_use_taxes() && isset($totals['tax'])) {
32
+    unset($totals['tax']);
33 33
 }
34 34
 
35
-do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals );
35
+do_action('getpaid_before_payment_form_cart_totals', $form, $totals);
36 36
 
37 37
 $tax       = 0;
38 38
 $sub_total = 0;
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 $discount  = 0;
41 41
 
42 42
 // Calculate totals.
43
-foreach ( $form->get_items() as $item ) {
43
+foreach ($form->get_items() as $item) {
44 44
 
45
-    if ( ! empty( $form->invoice ) && 'amount' == $form->invoice->get_template() ) {
45
+    if (!empty($form->invoice) && 'amount' == $form->invoice->get_template()) {
46 46
         $amount = $item->get_price();
47 47
     } else {
48 48
         $amount = $item->get_sub_total();
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
     // Include the tax.
53
-    if ( wpinv_use_taxes() ) {
54
-        $rate = wpinv_get_tax_rate( $country, false, $item->get_id() );
53
+    if (wpinv_use_taxes()) {
54
+        $rate = wpinv_get_tax_rate($country, false, $item->get_id());
55 55
 
56
-        if ( wpinv_prices_include_tax() ) {
57
-            $pre_tax  = ( $amount - $amount * $rate * 0.01 );
56
+        if (wpinv_prices_include_tax()) {
57
+            $pre_tax  = ($amount - $amount * $rate * 0.01);
58 58
             $item_tax = $amount - $pre_tax;
59 59
         } else {
60 60
             $pre_tax  = $amount;
@@ -66,41 +66,41 @@  discard block
 block discarded – undo
66 66
         $total     = $sub_total + $tax;
67 67
 
68 68
     } else {
69
-        $total  = $total + $amount;
69
+        $total = $total + $amount;
70 70
     }
71 71
 
72 72
 }
73 73
 
74 74
 ?>
75 75
 <div class='border-top getpaid-payment-form-items-cart-totals'>
76
-    <?php foreach ( $totals as $key => $label ) : ?>
77
-        <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr( $key ); ?>">
76
+    <?php foreach ($totals as $key => $label) : ?>
77
+        <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr($key); ?>">
78 78
             <div class="row">
79 79
                 <div class="col-12 offset-sm-5 col-sm-4">
80
-                    <?php echo sanitize_text_field( $label ); ?>
80
+                    <?php echo sanitize_text_field($label); ?>
81 81
                 </div>
82
-                <div class="col-12 col-sm-3 getpaid-form-cart-totals-total-<?php echo esc_attr( $key ); ?>">
82
+                <div class="col-12 col-sm-3 getpaid-form-cart-totals-total-<?php echo esc_attr($key); ?>">
83 83
                     <?php
84
-                        do_action( "getpaid_payment_form_cart_totals_$key", $form );
84
+                        do_action("getpaid_payment_form_cart_totals_$key", $form);
85 85
 
86 86
                         // Total tax.
87
-                        if ( 'tax' == $key ) {
88
-                            echo wpinv_price( wpinv_format_amount( $tax ), $currency );
87
+                        if ('tax' == $key) {
88
+                            echo wpinv_price(wpinv_format_amount($tax), $currency);
89 89
                         }
90 90
 
91 91
                         // Total discount.
92
-                        if ( 'discount' == $key ) {
93
-                            echo wpinv_price( wpinv_format_amount( $discount ), $currency );
92
+                        if ('discount' == $key) {
93
+                            echo wpinv_price(wpinv_format_amount($discount), $currency);
94 94
                         }
95 95
 
96 96
                         // Sub total.
97
-                        if ( 'subtotal' == $key ) {
98
-                            echo wpinv_price( wpinv_format_amount( $sub_total ), $currency );
97
+                        if ('subtotal' == $key) {
98
+                            echo wpinv_price(wpinv_format_amount($sub_total), $currency);
99 99
                         }
100 100
 
101 101
                         // Total.
102
-                        if ( 'total' == $key ) {
103
-                            echo wpinv_price( wpinv_format_amount( $total ), $currency );
102
+                        if ('total' == $key) {
103
+                            echo wpinv_price(wpinv_format_amount($total), $currency);
104 104
                         }
105 105
                     ?>
106 106
                 </div>
@@ -110,4 +110,4 @@  discard block
 block discarded – undo
110 110
 </div>
111 111
 
112 112
 <?php
113
-do_action(  'getpaid_payment_form_cart_totals', $form, $totals );
113
+do_action('getpaid_payment_form_cart_totals', $form, $totals);
Please login to merge, or discard this patch.
templates/payment-forms/cart-item.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -7,80 +7,80 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-do_action( 'getpaid_before_payment_form_cart_item', $form, $item );
12
+do_action('getpaid_before_payment_form_cart_item', $form, $item);
13 13
 
14 14
 $currency = $form->get_currency();
15 15
 
16 16
 ?>
17
-<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required'  : 'selectable'; ?> item-<?php echo $item->get_id(); ?>'>
17
+<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?>'>
18 18
     <div class="form-row">
19
-        <?php foreach ( $columns as $key => $label ) : ?>
20
-            <div class="<?php echo 'name' == $key ? 'col-12 col-sm-5' : 'col-12 col-sm' ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>-<?php echo $item->get_id(); ?>">
19
+        <?php foreach ($columns as $key => $label) : ?>
20
+            <div class="<?php echo 'name' == $key ? 'col-12 col-sm-5' : 'col-12 col-sm' ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>-<?php echo $item->get_id(); ?>">
21 21
                 <?php
22
-                    do_action( "getpaid_payment_form_cart_item_$key", $form, $item );
22
+                    do_action("getpaid_payment_form_cart_item_$key", $form, $item);
23 23
 
24 24
                     // Item name.
25
-                    if ( 'name' == $key ) {
26
-                        echo sanitize_text_field( $item->get_name() );
25
+                    if ('name' == $key) {
26
+                        echo sanitize_text_field($item->get_name());
27 27
                         $description = $item->get_description();
28 28
 
29
-                        if ( ! empty( $description ) ) {
30
-                            $description = wp_kses_post( $description );
29
+                        if (!empty($description)) {
30
+                            $description = wp_kses_post($description);
31 31
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
32 32
                         }
33 33
 
34
-                        $description = getpaid_item_recurring_price_help_text( $item, $currency );
34
+                        $description = getpaid_item_recurring_price_help_text($item, $currency);
35 35
 
36
-                        if ( $description ) {
36
+                        if ($description) {
37 37
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
38 38
                         }
39 39
                     }
40 40
 
41 41
                     // Item price.
42
-                    if ( 'price' == $key ) {
42
+                    if ('price' == $key) {
43 43
 
44 44
                         // Set the currency position.
45 45
                         $position = wpinv_currency_position();
46 46
 
47
-                        if ( $position == 'left_space' ) {
47
+                        if ($position == 'left_space') {
48 48
                             $position = 'left';
49 49
                         }
50 50
 
51
-                        if ( $position == 'right_space' ) {
51
+                        if ($position == 'right_space') {
52 52
                             $position = 'right';
53 53
                         }
54 54
 
55
-                        if ( $item->user_can_set_their_price() ) {
55
+                        if ($item->user_can_set_their_price()) {
56 56
                             ?>
57 57
                                 <div class="input-group input-group-sm">
58
-                                    <?php if( 'left' == $position ) : ?>
58
+                                    <?php if ('left' == $position) : ?>
59 59
                                         <div class="input-group-prepend">
60
-                                            <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
60
+                                            <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
61 61
                                         </div>
62 62
                                     <?php endif; ?>
63
-                                    <input type="text" name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr( $item->get_price() ); ?>" placeholder="<?php echo esc_attr( $item->get_minimum_price() ); ?>" class="getpaid-item-price-input">
63
+                                    <input type="text" name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr($item->get_price()); ?>" placeholder="<?php echo esc_attr($item->get_minimum_price()); ?>" class="getpaid-item-price-input">
64 64
 
65
-                                    <?php if( 'left' != $position ) : ?>
65
+                                    <?php if ('left' != $position) : ?>
66 66
                                         <div class="input-group-append">
67
-                                            <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
67
+                                            <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
68 68
                                         </div>
69 69
                                     <?php endif; ?>
70 70
                                 </div>
71 71
                             <?php
72 72
                         } else {
73
-                            echo wpinv_price( wpinv_format_amount( $item->get_price() ), $currency );
73
+                            echo wpinv_price(wpinv_format_amount($item->get_price()), $currency);
74 74
                             ?>
75
-                                <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
75
+                                <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'>
76 76
                             <?php
77 77
                         }
78 78
                     }
79 79
 
80 80
                     // Item quantity.
81
-                    if ( 'quantity' == $key ) {
81
+                    if ('quantity' == $key) {
82 82
 
83
-                        if ( $item->allows_quantities() ) {
83
+                        if ($item->allows_quantities()) {
84 84
                             ?>
85 85
                                 <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='number' class='getpaid-item-quantity-input pr-1' value='<?php echo (int) $item->get_qantity(); ?>' min='1' required>
86 86
                             <?php
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
                     }
95 95
 
96 96
                     // Item sub total.
97
-                    if ( 'subtotal' == $key ) {
98
-                        echo wpinv_price( wpinv_format_amount( $item->get_sub_total() ), $currency );
97
+                    if ('subtotal' == $key) {
98
+                        echo wpinv_price(wpinv_format_amount($item->get_sub_total()), $currency);
99 99
                     }
100 100
                 ?>
101 101
             </div>
@@ -103,4 +103,4 @@  discard block
 block discarded – undo
103 103
     </div>
104 104
 </div>
105 105
 <?php
106
-do_action(  'getpaid_payment_form_cart_item', $form, $item );
106
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.
templates/payment-forms/elements/price_input.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,6 +30,6 @@
 block discarded – undo
30 30
         'label_type'        => 'vertical',
31 31
         'help_text'         => empty( $description ) ? '' : wp_kses_post( $description ),
32 32
         'input_group_right' => $position == 'right' ? wpinv_currency_symbol( $form->get_currency() ) : '',
33
-		'input_group_left'  => $position == 'left' ? wpinv_currency_symbol( $form->get_currency() ) : '',
33
+        'input_group_left'  => $position == 'left' ? wpinv_currency_symbol( $form->get_currency() ) : '',
34 34
     )
35 35
 );
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,29 +7,29 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Set the currency position.
13 13
 $position = wpinv_currency_position();
14 14
 
15
-if ( $position == 'left_space' ) {
15
+if ($position == 'left_space') {
16 16
     $position = 'left';
17 17
 }
18 18
 
19
-if ( $position == 'right_space' ) {
19
+if ($position == 'right_space') {
20 20
     $position = 'right';
21 21
 }
22 22
 
23 23
 echo aui()->input(
24 24
     array(
25
-        'name'              => esc_attr( $id ),
26
-        'id'                => esc_attr( $id ) . uniqid( '_' ),
27
-        'placeholder'       => empty( $placeholder ) ? wpinv_format_amount(0) : wpinv_format_amount( $placeholder ),
28
-        'value'             => empty( $value ) ? wpinv_format_amount(0) : wpinv_format_amount( $value ),
29
-        'label'             => empty( $label ) ? '' : wp_kses_post( $label ),
25
+        'name'              => esc_attr($id),
26
+        'id'                => esc_attr($id) . uniqid('_'),
27
+        'placeholder'       => empty($placeholder) ? wpinv_format_amount(0) : wpinv_format_amount($placeholder),
28
+        'value'             => empty($value) ? wpinv_format_amount(0) : wpinv_format_amount($value),
29
+        'label'             => empty($label) ? '' : wp_kses_post($label),
30 30
         'label_type'        => 'vertical',
31
-        'help_text'         => empty( $description ) ? '' : wp_kses_post( $description ),
32
-        'input_group_right' => $position == 'right' ? wpinv_currency_symbol( $form->get_currency() ) : '',
33
-		'input_group_left'  => $position == 'left' ? wpinv_currency_symbol( $form->get_currency() ) : '',
31
+        'help_text'         => empty($description) ? '' : wp_kses_post($description),
32
+        'input_group_right' => $position == 'right' ? wpinv_currency_symbol($form->get_currency()) : '',
33
+		'input_group_left'  => $position == 'left' ? wpinv_currency_symbol($form->get_currency()) : '',
34 34
     )
35 35
 );
Please login to merge, or discard this patch.
templates/payment-forms/elements/gateway_select.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,27 +7,27 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // The payment methods select title.
13
-if ( empty( $text ) ) {
14
-    $text = __( 'Select Payment Method', 'invoicing' );
13
+if (empty($text)) {
14
+    $text = __('Select Payment Method', 'invoicing');
15 15
 }
16 16
 
17 17
 // An array of active payment methods.
18
-$gateways = wpinv_get_enabled_payment_gateways( true );
18
+$gateways = wpinv_get_enabled_payment_gateways(true);
19 19
 
20 20
 // Make it possible to filter active gateways.
21
-$gateways = apply_filters( 'getpaid_payment_form_gateways', $gateways, $form );
21
+$gateways = apply_filters('getpaid_payment_form_gateways', $gateways, $form);
22 22
 
23 23
 //@deprecated
24
-$gateways = apply_filters( 'wpinv_payment_gateways_on_cart', $gateways );
24
+$gateways = apply_filters('wpinv_payment_gateways_on_cart', $gateways);
25 25
 
26 26
 // The current invoice id.
27 27
 $invoice_id     = 0;
28 28
 $chosen_gateway = wpinv_get_default_gateway();
29 29
 
30
-if ( ! empty( $form->invoice ) ) {
30
+if (!empty($form->invoice)) {
31 31
     $invoice_id = $form->invoice->get_id();
32 32
     $chosen_gateway = $form->invoice->get_gateway();
33 33
 }
@@ -36,36 +36,36 @@  discard block
 block discarded – undo
36 36
 
37 37
     <div class="mt-4 mb-4">
38 38
 
39
-        <?php do_action( 'wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form ); ?>
39
+        <?php do_action('wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form); ?>
40 40
 
41 41
         <div class="getpaid-gateways-select-title-div">
42
-            <h6><?php echo sanitize_text_field( $text ); ?></h6>
42
+            <h6><?php echo sanitize_text_field($text); ?></h6>
43 43
         </div>
44 44
 
45 45
         
46 46
         <div class="getpaid-gateways-select-gateways-div">
47 47
 
48
-            <?php foreach ( array_keys( $gateways ) as $gateway ) : ?>
48
+            <?php foreach (array_keys($gateways) as $gateway) : ?>
49 49
 
50
-                <div class="pt-2 pb-2 getpaid-gateways-select-gateway getpaid-gateways-select-gateway-<?php echo sanitize_html_class( $gateway ) ;?>" data-checkout-label='<?php echo esc_attr( apply_filters( "getpaid_gateway_{$gateway}_checkout_button_label", '' ) ); ?>'>
50
+                <div class="pt-2 pb-2 getpaid-gateways-select-gateway getpaid-gateways-select-gateway-<?php echo sanitize_html_class($gateway); ?>" data-checkout-label='<?php echo esc_attr(apply_filters("getpaid_gateway_{$gateway}_checkout_button_label", '')); ?>'>
51 51
 
52 52
                     <div class="getpaid-gateway-radio-div">
53 53
                         <label>
54
-                            <input type="radio" value="<?php echo esc_attr( $gateway ) ;?>" <?php checked( $gateway, $chosen_gateway ) ;?> name="wpi-gateway">
55
-                            <span><?php echo sanitize_text_field( wpinv_get_gateway_checkout_label( $gateway ) ); ?></span>
54
+                            <input type="radio" value="<?php echo esc_attr($gateway); ?>" <?php checked($gateway, $chosen_gateway); ?> name="wpi-gateway">
55
+                            <span><?php echo sanitize_text_field(wpinv_get_gateway_checkout_label($gateway)); ?></span>
56 56
                         </label>
57 57
                     </div>
58 58
 
59 59
                     <div class="getpaid-gateway-description-div" style="display: none;">
60
-                        <?php do_action( 'wpinv_' . $gateway . '_checkout_fields', $invoice_id ) ;?>
61
-                        <?php if ( wpinv_get_gateway_description( $gateway ) ) : ?>
60
+                        <?php do_action('wpinv_' . $gateway . '_checkout_fields', $invoice_id); ?>
61
+                        <?php if (wpinv_get_gateway_description($gateway)) : ?>
62 62
                             <div class="getpaid-gateway-description">
63
-                                <?php echo wpinv_get_gateway_description( $gateway ); ?>
63
+                                <?php echo wpinv_get_gateway_description($gateway); ?>
64 64
                             </div>
65 65
                         <?php endif; ?>
66 66
 
67
-                        <?php do_action( 'getpaid_after_gateway_description', $invoice_id, $gateway, $form ) ;?>
68
-                        <?php do_action( 'wpinv_' . $gateway . '_cc_form', $invoice_id, $form ) ;?>
67
+                        <?php do_action('getpaid_after_gateway_description', $invoice_id, $gateway, $form); ?>
68
+                        <?php do_action('wpinv_' . $gateway . '_cc_form', $invoice_id, $form); ?>
69 69
 
70 70
                     </div>
71 71
 
@@ -76,16 +76,16 @@  discard block
 block discarded – undo
76 76
             <?php
77 77
 
78 78
 
79
-                if ( empty( $gateways ) ) {
79
+                if (empty($gateways)) {
80 80
 
81
-                    $enabled_gateways = wpinv_get_enabled_payment_gateways( true );
81
+                    $enabled_gateways = wpinv_get_enabled_payment_gateways(true);
82 82
 
83
-                    if ( ! empty( $enabled_gateways ) && $form->is_recurring() ) {
83
+                    if (!empty($enabled_gateways) && $form->is_recurring()) {
84 84
 
85 85
 
86 86
                         echo aui()->alert(
87 87
                             array(
88
-                                'content'     => __( 'Non of the available payment gateways support subscriptions.', 'invoicing' ),
88
+                                'content'     => __('Non of the available payment gateways support subscriptions.', 'invoicing'),
89 89
                                 'type'        => 'danger',
90 90
                             )
91 91
                         );
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
                         echo aui()->alert(
97 97
                             array(
98
-                                'content'     => __( 'No active payment gateway available.', 'invoicing' ),
98
+                                'content'     => __('No active payment gateway available.', 'invoicing'),
99 99
                                 'type'        => 'danger',
100 100
                             )
101 101
                         );
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         </div>
112 112
 
113
-        <?php do_action( 'wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form ); ?>
113
+        <?php do_action('wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form); ?>
114 114
 
115 115
     </div>
116 116
 
Please login to merge, or discard this patch.