Passed
Push — master ( 23c074...2114e2 )
by Brian
05:15
created
templates/payment-forms-admin/previews/items.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 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
 
14 14
 <div v-if='!is_default'>
15
-    <div class='alert alert-info' role='alert'><?php _e( 'Item totals will appear here. Click to set items.', 'invoicing' ) ?></div>
15
+    <div class='alert alert-info' role='alert'><?php _e('Item totals will appear here. Click to set items.', 'invoicing') ?></div>
16 16
 </div>
17 17
 
18 18
 <div v-if='is_default'>
19
-    <div class='alert alert-info' role='alert'><?php _e( 'Item totals will appear here.', 'invoicing' ) ?></div>
19
+    <div class='alert alert-info' role='alert'><?php _e('Item totals will appear here.', 'invoicing') ?></div>
20 20
 </div>
Please login to merge, or discard this patch.
includes/payments/class-getpaid-form-item.php 2 patches
Indentation   +349 added lines, -349 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,227 +81,227 @@  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( $required = null ) {
234
-
235
-		$required = is_null( $required ) ? $this->is_required() : $required;
236
-		return array(
237
-			'title'            => strip_tags( $this->get_name() ),
238
-			'id'               => $this->get_id(),
239
-			'price'            => $this->get_price(),
240
-			'recurring'        => $this->is_recurring(),
241
-			'description'      => $this->get_description(),
242
-			'allow_quantities' => $this->allows_quantities(),
243
-			'required'         => $required,
244
-		);
245
-
246
-	}
247
-
248
-	/**
249
-	 * Prepares form data for ajax use.
250
-	 *
251
-	 * @since 1.0.19
252
-	 * @return array
253
-	 */
254
-	public function prepare_data_for_invoice_edit_ajax( $currency = '' ) {
255
-
256
-		$description = getpaid_item_recurring_price_help_text( $this, $currency );
257
-
258
-		if ( $description ) {
259
-			$description = "<div class='getpaid-subscription-help-text'>$description</div>";
260
-		}
261
-
262
-		return array(
263
-			'id'     => $this->get_id(),
264
-			'texts'  => array(
265
-				'item-name'        => sanitize_text_field( $this->get_name() ),
266
-				'item-description' => wp_kses_post( $this->get_description() ) . $description,
267
-				'item-quantity'    => absint( $this->get_quantity() ),
268
-				'item-price'       => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ),
269
-				'item-total'       => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ),
270
-			),
271
-			'inputs' => array(
272
-				'item-id'          => $this->get_id(),
273
-				'item-name'        => sanitize_text_field( $this->get_name() ),
274
-				'item-description' => wp_kses_post( $this->get_description() ),
275
-				'item-quantity'    => absint( $this->get_quantity() ),
276
-				'item-price'       => $this->get_price(),
277
-			)
278
-		);
279
-
280
-	}
281
-
282
-	/**
283
-	 * Prepares form data for saving (cart_details).
284
-	 *
285
-	 * @since 1.0.19
286
-	 * @return array
287
-	 */
288
-	public function prepare_data_for_saving() {
289
-
290
-		return array(
291
-			'post_id'           => $this->invoice_id,
292
-			'item_id'           => $this->get_id(),
293
-			'item_name'         => sanitize_text_field( $this->get_raw_name() ),
294
-			'item_description'  => $this->get_description(),
295
-			'tax'               => $this->item_tax,
296
-			'item_price'        => $this->get_price(),
297
-			'quantity'          => (int) $this->get_quantity(),
298
-			'discount'          => $this->item_discount,
299
-			'subtotal'          => $this->get_sub_total(),
300
-			'price'             => $this->get_sub_total() + $this->item_tax + $this->item_discount,
301
-			'meta'              => $this->get_item_meta(),
302
-		);
303
-
304
-	}
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( $required = null ) {
234
+
235
+        $required = is_null( $required ) ? $this->is_required() : $required;
236
+        return array(
237
+            'title'            => strip_tags( $this->get_name() ),
238
+            'id'               => $this->get_id(),
239
+            'price'            => $this->get_price(),
240
+            'recurring'        => $this->is_recurring(),
241
+            'description'      => $this->get_description(),
242
+            'allow_quantities' => $this->allows_quantities(),
243
+            'required'         => $required,
244
+        );
245
+
246
+    }
247
+
248
+    /**
249
+     * Prepares form data for ajax use.
250
+     *
251
+     * @since 1.0.19
252
+     * @return array
253
+     */
254
+    public function prepare_data_for_invoice_edit_ajax( $currency = '' ) {
255
+
256
+        $description = getpaid_item_recurring_price_help_text( $this, $currency );
257
+
258
+        if ( $description ) {
259
+            $description = "<div class='getpaid-subscription-help-text'>$description</div>";
260
+        }
261
+
262
+        return array(
263
+            'id'     => $this->get_id(),
264
+            'texts'  => array(
265
+                'item-name'        => sanitize_text_field( $this->get_name() ),
266
+                'item-description' => wp_kses_post( $this->get_description() ) . $description,
267
+                'item-quantity'    => absint( $this->get_quantity() ),
268
+                'item-price'       => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ),
269
+                'item-total'       => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ),
270
+            ),
271
+            'inputs' => array(
272
+                'item-id'          => $this->get_id(),
273
+                'item-name'        => sanitize_text_field( $this->get_name() ),
274
+                'item-description' => wp_kses_post( $this->get_description() ),
275
+                'item-quantity'    => absint( $this->get_quantity() ),
276
+                'item-price'       => $this->get_price(),
277
+            )
278
+        );
279
+
280
+    }
281
+
282
+    /**
283
+     * Prepares form data for saving (cart_details).
284
+     *
285
+     * @since 1.0.19
286
+     * @return array
287
+     */
288
+    public function prepare_data_for_saving() {
289
+
290
+        return array(
291
+            'post_id'           => $this->invoice_id,
292
+            'item_id'           => $this->get_id(),
293
+            'item_name'         => sanitize_text_field( $this->get_raw_name() ),
294
+            'item_description'  => $this->get_description(),
295
+            'tax'               => $this->item_tax,
296
+            'item_price'        => $this->get_price(),
297
+            'quantity'          => (int) $this->get_quantity(),
298
+            'discount'          => $this->item_discount,
299
+            'subtotal'          => $this->get_sub_total(),
300
+            'price'             => $this->get_sub_total() + $this->item_tax + $this->item_discount,
301
+            'meta'              => $this->get_item_meta(),
302
+        );
303
+
304
+    }
305 305
 
306 306
     /*
307 307
 	|--------------------------------------------------------------------------
@@ -313,70 +313,70 @@  discard block
 block discarded – undo
313 313
 	| object.
314 314
     */
315 315
 
316
-	/**
317
-	 * Set the item qantity.
318
-	 *
319
-	 * @since 1.0.19
320
-	 * @param  int $quantity The item quantity.
321
-	 */
322
-	public function set_quantity( $quantity ) {
323
-
324
-		if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
325
-			$quantity = 1;
326
-		}
327
-
328
-		$this->quantity = (int) $quantity;
329
-
330
-	}
331
-
332
-	/**
333
-	 * Set the item meta data.
334
-	 *
335
-	 * @since 1.0.19
336
-	 * @param  array $meta The item meta data.
337
-	 */
338
-	public function set_item_meta( $meta ) {
339
-		$this->meta = maybe_unserialize( $meta );
340
-	}
341
-
342
-	/**
343
-	 * Set whether or not the quantities are allowed.
344
-	 *
345
-	 * @since 1.0.19
346
-	 * @param  bool $allow_quantities
347
-	 */
348
-	public function set_allow_quantities( $allow_quantities ) {
349
-		$this->allow_quantities = (bool) $allow_quantities;
350
-	}
351
-
352
-	/**
353
-	 * Set whether or not the item is required.
354
-	 *
355
-	 * @since 1.0.19
356
-	 * @param  bool $is_required
357
-	 */
358
-	public function set_is_required( $is_required ) {
359
-		$this->is_required = (bool) $is_required;
360
-	}
361
-
362
-	/**
363
-	 * Sets the custom item description.
364
-	 *
365
-	 * @since 1.0.19
366
-	 * @param  string $description
367
-	 */
368
-	public function set_custom_description( $description ) {
369
-		$this->custom_description = $description;
370
-	}
316
+    /**
317
+     * Set the item qantity.
318
+     *
319
+     * @since 1.0.19
320
+     * @param  int $quantity The item quantity.
321
+     */
322
+    public function set_quantity( $quantity ) {
323
+
324
+        if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
325
+            $quantity = 1;
326
+        }
327
+
328
+        $this->quantity = (int) $quantity;
329
+
330
+    }
331
+
332
+    /**
333
+     * Set the item meta data.
334
+     *
335
+     * @since 1.0.19
336
+     * @param  array $meta The item meta data.
337
+     */
338
+    public function set_item_meta( $meta ) {
339
+        $this->meta = maybe_unserialize( $meta );
340
+    }
341
+
342
+    /**
343
+     * Set whether or not the quantities are allowed.
344
+     *
345
+     * @since 1.0.19
346
+     * @param  bool $allow_quantities
347
+     */
348
+    public function set_allow_quantities( $allow_quantities ) {
349
+        $this->allow_quantities = (bool) $allow_quantities;
350
+    }
351
+
352
+    /**
353
+     * Set whether or not the item is required.
354
+     *
355
+     * @since 1.0.19
356
+     * @param  bool $is_required
357
+     */
358
+    public function set_is_required( $is_required ) {
359
+        $this->is_required = (bool) $is_required;
360
+    }
361
+
362
+    /**
363
+     * Sets the custom item description.
364
+     *
365
+     * @since 1.0.19
366
+     * @param  string $description
367
+     */
368
+    public function set_custom_description( $description ) {
369
+        $this->custom_description = $description;
370
+    }
371 371
 
372 372
     /**
373 373
      * We do not want to save items to the database.
374 374
      * 
375
-	 * @return int item id
375
+     * @return int item id
376 376
      */
377 377
     public function save( $data = array() ) {
378 378
         return $this->get_id();
379
-	}
379
+    }
380 380
 
381 381
     /*
382 382
 	|--------------------------------------------------------------------------
@@ -388,23 +388,23 @@  discard block
 block discarded – undo
388 388
 	*/
389 389
 
390 390
     /**
391
-	 * Checks whether the item has enabled dynamic pricing.
392
-	 *
393
-	 * @since 1.0.19
394
-	 * @return bool
395
-	 */
396
-	public function is_required() {
391
+     * Checks whether the item has enabled dynamic pricing.
392
+     *
393
+     * @since 1.0.19
394
+     * @return bool
395
+     */
396
+    public function is_required() {
397 397
         return (bool) $this->get_is_required();
398
-	}
399
-
400
-	/**
401
-	 * Checks whether users can edit the quantities.
402
-	 *
403
-	 * @since 1.0.19
404
-	 * @return bool
405
-	 */
406
-	public function allows_quantities() {
398
+    }
399
+
400
+    /**
401
+     * Checks whether users can edit the quantities.
402
+     *
403
+     * @since 1.0.19
404
+     * @return bool
405
+     */
406
+    public function allows_quantities() {
407 407
         return (bool) $this->get_allow_quantities();
408
-	}
408
+    }
409 409
 
410 410
 }
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 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;
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	 * @since 1.0.19
231 231
 	 * @return array
232 232
 	 */
233
-	public function prepare_data_for_use( $required = null ) {
233
+	public function prepare_data_for_use($required = null) {
234 234
 
235
-		$required = is_null( $required ) ? $this->is_required() : $required;
235
+		$required = is_null($required) ? $this->is_required() : $required;
236 236
 		return array(
237
-			'title'            => strip_tags( $this->get_name() ),
237
+			'title'            => strip_tags($this->get_name()),
238 238
 			'id'               => $this->get_id(),
239 239
 			'price'            => $this->get_price(),
240 240
 			'recurring'        => $this->is_recurring(),
@@ -251,28 +251,28 @@  discard block
 block discarded – undo
251 251
 	 * @since 1.0.19
252 252
 	 * @return array
253 253
 	 */
254
-	public function prepare_data_for_invoice_edit_ajax( $currency = '' ) {
254
+	public function prepare_data_for_invoice_edit_ajax($currency = '') {
255 255
 
256
-		$description = getpaid_item_recurring_price_help_text( $this, $currency );
256
+		$description = getpaid_item_recurring_price_help_text($this, $currency);
257 257
 
258
-		if ( $description ) {
258
+		if ($description) {
259 259
 			$description = "<div class='getpaid-subscription-help-text'>$description</div>";
260 260
 		}
261 261
 
262 262
 		return array(
263 263
 			'id'     => $this->get_id(),
264 264
 			'texts'  => array(
265
-				'item-name'        => sanitize_text_field( $this->get_name() ),
266
-				'item-description' => wp_kses_post( $this->get_description() ) . $description,
267
-				'item-quantity'    => absint( $this->get_quantity() ),
268
-				'item-price'       => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ),
269
-				'item-total'       => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ),
265
+				'item-name'        => sanitize_text_field($this->get_name()),
266
+				'item-description' => wp_kses_post($this->get_description()) . $description,
267
+				'item-quantity'    => absint($this->get_quantity()),
268
+				'item-price'       => wpinv_price(wpinv_format_amount($this->get_price()), $currency),
269
+				'item-total'       => wpinv_price(wpinv_format_amount($this->get_sub_total()), $currency),
270 270
 			),
271 271
 			'inputs' => array(
272 272
 				'item-id'          => $this->get_id(),
273
-				'item-name'        => sanitize_text_field( $this->get_name() ),
274
-				'item-description' => wp_kses_post( $this->get_description() ),
275
-				'item-quantity'    => absint( $this->get_quantity() ),
273
+				'item-name'        => sanitize_text_field($this->get_name()),
274
+				'item-description' => wp_kses_post($this->get_description()),
275
+				'item-quantity'    => absint($this->get_quantity()),
276 276
 				'item-price'       => $this->get_price(),
277 277
 			)
278 278
 		);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 		return array(
291 291
 			'post_id'           => $this->invoice_id,
292 292
 			'item_id'           => $this->get_id(),
293
-			'item_name'         => sanitize_text_field( $this->get_raw_name() ),
293
+			'item_name'         => sanitize_text_field($this->get_raw_name()),
294 294
 			'item_description'  => $this->get_description(),
295 295
 			'tax'               => $this->item_tax,
296 296
 			'item_price'        => $this->get_price(),
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 	 * @since 1.0.19
320 320
 	 * @param  int $quantity The item quantity.
321 321
 	 */
322
-	public function set_quantity( $quantity ) {
322
+	public function set_quantity($quantity) {
323 323
 
324
-		if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
324
+		if (empty($quantity) || !is_numeric($quantity)) {
325 325
 			$quantity = 1;
326 326
 		}
327 327
 
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
 	 * @since 1.0.19
336 336
 	 * @param  array $meta The item meta data.
337 337
 	 */
338
-	public function set_item_meta( $meta ) {
339
-		$this->meta = maybe_unserialize( $meta );
338
+	public function set_item_meta($meta) {
339
+		$this->meta = maybe_unserialize($meta);
340 340
 	}
341 341
 
342 342
 	/**
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	 * @since 1.0.19
346 346
 	 * @param  bool $allow_quantities
347 347
 	 */
348
-	public function set_allow_quantities( $allow_quantities ) {
348
+	public function set_allow_quantities($allow_quantities) {
349 349
 		$this->allow_quantities = (bool) $allow_quantities;
350 350
 	}
351 351
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 * @since 1.0.19
356 356
 	 * @param  bool $is_required
357 357
 	 */
358
-	public function set_is_required( $is_required ) {
358
+	public function set_is_required($is_required) {
359 359
 		$this->is_required = (bool) $is_required;
360 360
 	}
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @since 1.0.19
366 366
 	 * @param  string $description
367 367
 	 */
368
-	public function set_custom_description( $description ) {
368
+	public function set_custom_description($description) {
369 369
 		$this->custom_description = $description;
370 370
 	}
371 371
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      * 
375 375
 	 * @return int item id
376 376
      */
377
-    public function save( $data = array() ) {
377
+    public function save($data = array()) {
378 378
         return $this->get_id();
379 379
 	}
380 380
 
Please login to merge, or discard this patch.