Passed
Push — master ( d61518...77758e )
by Brian
04:26
created
includes/data-stores/class-getpaid-invoice-data-store.php 1 patch
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * GetPaid_Invoice_Data_Store class file.
5 5
  *
6 6
  */
7
-if ( ! defined( 'ABSPATH' ) ) {
7
+if (!defined('ABSPATH')) {
8 8
 	exit;
9 9
 }
10 10
 
@@ -108,61 +108,61 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param WPInv_Invoice $invoice Invoice object.
110 110
 	 */
111
-	public function create( &$invoice ) {
112
-		$invoice->set_version( WPINV_VERSION );
113
-		$invoice->set_date_created( current_time('mysql') );
111
+	public function create(&$invoice) {
112
+		$invoice->set_version(WPINV_VERSION);
113
+		$invoice->set_date_created(current_time('mysql'));
114 114
 
115 115
 		// Create a new post.
116 116
 		$id = wp_insert_post(
117 117
 			apply_filters(
118 118
 				'getpaid_new_invoice_data',
119 119
 				array(
120
-					'post_date'     => $invoice->get_date_created( 'edit' ),
121
-					'post_type'     => $invoice->get_post_type( 'edit' ),
122
-					'post_status'   => $this->get_post_status( $invoice ),
120
+					'post_date'     => $invoice->get_date_created('edit'),
121
+					'post_type'     => $invoice->get_post_type('edit'),
122
+					'post_status'   => $this->get_post_status($invoice),
123 123
 					'ping_status'   => 'closed',
124
-					'post_author'   => $invoice->get_user_id( 'edit' ),
125
-					'post_title'    => $invoice->get_title( 'edit' ),
126
-					'post_excerpt'  => $invoice->get_description( 'edit' ),
127
-					'post_parent'   => $invoice->get_parent_id( 'edit' ),
124
+					'post_author'   => $invoice->get_user_id('edit'),
125
+					'post_title'    => $invoice->get_title('edit'),
126
+					'post_excerpt'  => $invoice->get_description('edit'),
127
+					'post_parent'   => $invoice->get_parent_id('edit'),
128 128
 				)
129 129
 			),
130 130
 			true
131 131
 		);
132 132
 
133
-		if ( $id && ! is_wp_error( $id ) ) {
133
+		if ($id && !is_wp_error($id)) {
134 134
 
135 135
 			// Update the new id and regenerate a title.
136
-			$invoice->set_id( $id );
136
+			$invoice->set_id($id);
137 137
 
138 138
 			$invoice->maybe_set_number();
139 139
 
140 140
 			wp_update_post(
141 141
 				array(
142 142
 					'ID'         => $invoice->get_id(),
143
-					'post_title' => $invoice->get_number( 'edit' ),
144
-					'post_name'  => $invoice->get_path( 'edit' )
143
+					'post_title' => $invoice->get_number('edit'),
144
+					'post_name'  => $invoice->get_path('edit')
145 145
 				)
146 146
 			);
147 147
 
148 148
 			// Save special fields and items.
149
-			$this->save_special_fields( $invoice );
150
-			$this->save_items( $invoice );
149
+			$this->save_special_fields($invoice);
150
+			$this->save_items($invoice);
151 151
 
152 152
 			// Update meta data.
153
-			$this->update_post_meta( $invoice );
153
+			$this->update_post_meta($invoice);
154 154
 			$invoice->save_meta_data();
155 155
 
156 156
 			// Apply changes.
157 157
 			$invoice->apply_changes();
158
-			$this->clear_caches( $invoice );
158
+			$this->clear_caches($invoice);
159 159
 
160 160
 			// Fires after a new invoice is created.
161
-			do_action( 'getpaid_new_invoice', $invoice );
161
+			do_action('getpaid_new_invoice', $invoice);
162 162
 			return true;
163 163
 		}
164 164
 
165
-		if ( is_wp_error( $id ) ) {
165
+		if (is_wp_error($id)) {
166 166
 			$invoice->last_error = $id->get_error_message();
167 167
 		}
168 168
 
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
 	 * @param WPInv_Invoice $invoice Invoice object.
176 176
 	 *
177 177
 	 */
178
-	public function read( &$invoice ) {
178
+	public function read(&$invoice) {
179 179
 
180 180
 		$invoice->set_defaults();
181
-		$invoice_object = get_post( $invoice->get_id() );
181
+		$invoice_object = get_post($invoice->get_id());
182 182
 
183
-		if ( ! $invoice->get_id() || ! $invoice_object || ! getpaid_is_invoice_post_type( $invoice_object->post_type ) ) {
184
-			$invoice->last_error = __( 'Invalid invoice.', 'invoicing' );
185
-			$invoice->set_id( 0 );
183
+		if (!$invoice->get_id() || !$invoice_object || !getpaid_is_invoice_post_type($invoice_object->post_type)) {
184
+			$invoice->last_error = __('Invalid invoice.', 'invoicing');
185
+			$invoice->set_id(0);
186 186
 			return false;
187 187
 		}
188 188
 
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 			)
201 201
 		);
202 202
 
203
-		$invoice->set_type( $invoice_object->post_type );
203
+		$invoice->set_type($invoice_object->post_type);
204 204
 
205
-		$this->read_object_data( $invoice, $invoice_object );
206
-		$this->add_special_fields( $invoice );
207
-		$this->add_items( $invoice );
205
+		$this->read_object_data($invoice, $invoice_object);
206
+		$this->add_special_fields($invoice);
207
+		$this->add_items($invoice);
208 208
 		$invoice->read_meta_data();
209
-		$invoice->set_object_read( true );
210
-		do_action( 'getpaid_read_invoice', $invoice );
209
+		$invoice->set_object_read(true);
210
+		do_action('getpaid_read_invoice', $invoice);
211 211
 
212 212
 	}
213 213
 
@@ -216,35 +216,35 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @param WPInv_Invoice $invoice Invoice object.
218 218
 	 */
219
-	public function update( &$invoice ) {
219
+	public function update(&$invoice) {
220 220
 		$invoice->save_meta_data();
221
-		$invoice->set_version( WPINV_VERSION );
221
+		$invoice->set_version(WPINV_VERSION);
222 222
 
223
-		if ( null === $invoice->get_date_created( 'edit' ) ) {
224
-			$invoice->set_date_created(  current_time('mysql') );
223
+		if (null === $invoice->get_date_created('edit')) {
224
+			$invoice->set_date_created(current_time('mysql'));
225 225
 		}
226 226
 
227 227
 		// Ensure both the key and number are set.
228 228
 		$invoice->get_path();
229 229
 
230 230
 		// Grab the current status so we can compare.
231
-		$previous_status = get_post_status( $invoice->get_id() );
231
+		$previous_status = get_post_status($invoice->get_id());
232 232
 
233 233
 		$changes = $invoice->get_changes();
234 234
 
235 235
 		// Only update the post when the post data changes.
236
-		if ( array_intersect( array( 'date_created', 'date_modified', 'status', 'name', 'author', 'description', 'parent_id', 'post_excerpt', 'path' ), array_keys( $changes ) ) ) {
236
+		if (array_intersect(array('date_created', 'date_modified', 'status', 'name', 'author', 'description', 'parent_id', 'post_excerpt', 'path'), array_keys($changes))) {
237 237
 			$post_data = array(
238
-				'post_date'         => $invoice->get_date_created( 'edit' ),
239
-				'post_date_gmt'     => $invoice->get_date_created_gmt( 'edit' ),
240
-				'post_status'       => $invoice->get_status( 'edit' ),
241
-				'post_title'        => $invoice->get_name( 'edit' ),
242
-				'post_author'       => $invoice->get_user_id( 'edit' ),
243
-				'post_modified'     => $invoice->get_date_modified( 'edit' ),
244
-				'post_excerpt'      => $invoice->get_description( 'edit' ),
245
-				'post_parent'       => $invoice->get_parent_id( 'edit' ),
246
-				'post_name'         => $invoice->get_path( 'edit' ),
247
-				'post_type'         => $invoice->get_post_type( 'edit' ),
238
+				'post_date'         => $invoice->get_date_created('edit'),
239
+				'post_date_gmt'     => $invoice->get_date_created_gmt('edit'),
240
+				'post_status'       => $invoice->get_status('edit'),
241
+				'post_title'        => $invoice->get_name('edit'),
242
+				'post_author'       => $invoice->get_user_id('edit'),
243
+				'post_modified'     => $invoice->get_date_modified('edit'),
244
+				'post_excerpt'      => $invoice->get_description('edit'),
245
+				'post_parent'       => $invoice->get_parent_id('edit'),
246
+				'post_name'         => $invoice->get_path('edit'),
247
+				'post_type'         => $invoice->get_post_type('edit'),
248 248
 			);
249 249
 
250 250
 			/**
@@ -255,35 +255,35 @@  discard block
 block discarded – undo
255 255
 			 * This ensures hooks are fired by either WP itself (admin screen save),
256 256
 			 * or an update purely from CRUD.
257 257
 			 */
258
-			if ( doing_action( 'save_post' ) ) {
259
-				$GLOBALS['wpdb']->update( $GLOBALS['wpdb']->posts, $post_data, array( 'ID' => $invoice->get_id() ) );
260
-				clean_post_cache( $invoice->get_id() );
258
+			if (doing_action('save_post')) {
259
+				$GLOBALS['wpdb']->update($GLOBALS['wpdb']->posts, $post_data, array('ID' => $invoice->get_id()));
260
+				clean_post_cache($invoice->get_id());
261 261
 			} else {
262
-				wp_update_post( array_merge( array( 'ID' => $invoice->get_id() ), $post_data ) );
262
+				wp_update_post(array_merge(array('ID' => $invoice->get_id()), $post_data));
263 263
 			}
264
-			$invoice->read_meta_data( true ); // Refresh internal meta data, in case things were hooked into `save_post` or another WP hook.
264
+			$invoice->read_meta_data(true); // Refresh internal meta data, in case things were hooked into `save_post` or another WP hook.
265 265
 		}
266 266
 
267 267
 		// Update meta data.
268
-		$this->update_post_meta( $invoice );
268
+		$this->update_post_meta($invoice);
269 269
 
270 270
 		// Save special fields and items.
271
-		$this->save_special_fields( $invoice );
272
-		$this->save_items( $invoice );
271
+		$this->save_special_fields($invoice);
272
+		$this->save_items($invoice);
273 273
 
274 274
 		// Apply the changes.
275 275
 		$invoice->apply_changes();
276 276
 
277 277
 		// Clear caches.
278
-		$this->clear_caches( $invoice );
278
+		$this->clear_caches($invoice);
279 279
 
280 280
 		// Fire a hook depending on the status - this should be considered a creation if it was previously draft status.
281
-		$new_status = $invoice->get_status( 'edit' );
281
+		$new_status = $invoice->get_status('edit');
282 282
 
283
-		if ( $new_status !== $previous_status && in_array( $previous_status, array( 'new', 'auto-draft', 'draft' ), true ) ) {
284
-			do_action( 'getpaid_new_invoice', $invoice );
283
+		if ($new_status !== $previous_status && in_array($previous_status, array('new', 'auto-draft', 'draft'), true)) {
284
+			do_action('getpaid_new_invoice', $invoice);
285 285
 		} else {
286
-			do_action( 'getpaid_update_invoice', $invoice );
286
+			do_action('getpaid_update_invoice', $invoice);
287 287
 		}
288 288
 
289 289
 	}
@@ -299,45 +299,45 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @param WPInv_Invoice $invoice Invoice object.
301 301
      */
302
-    public function add_special_fields( &$invoice ) {
302
+    public function add_special_fields(&$invoice) {
303 303
 		global $wpdb;
304 304
 
305 305
 		// Maybe retrieve from the cache.
306
-		$data   = wp_cache_get( $invoice->get_id(), 'getpaid_invoice_special_fields' );
306
+		$data = wp_cache_get($invoice->get_id(), 'getpaid_invoice_special_fields');
307 307
 
308 308
 		// If not found, retrieve from the db.
309
-		if ( false === $data ) {
310
-			$table =  $wpdb->prefix . 'getpaid_invoices';
309
+		if (false === $data) {
310
+			$table = $wpdb->prefix . 'getpaid_invoices';
311 311
 
312 312
 			$data  = $wpdb->get_row(
313
-				$wpdb->prepare( "SELECT * FROM $table WHERE `post_id`=%d LIMIT 1", $invoice->get_id() ),
313
+				$wpdb->prepare("SELECT * FROM $table WHERE `post_id`=%d LIMIT 1", $invoice->get_id()),
314 314
 				ARRAY_A
315 315
 			);
316 316
 
317 317
 			// Update the cache with our data
318
-			wp_cache_set( $invoice->get_id(), $data, 'getpaid_invoice_special_fields' );
318
+			wp_cache_set($invoice->get_id(), $data, 'getpaid_invoice_special_fields');
319 319
 
320 320
 		}
321 321
 
322 322
 		// Abort if the data does not exist.
323
-		if ( empty( $data ) ) {
324
-			$invoice->set_object_read( true );
325
-			$invoice->set_props( wpinv_get_user_address( $invoice->get_user_id() ) );
323
+		if (empty($data)) {
324
+			$invoice->set_object_read(true);
325
+			$invoice->set_props(wpinv_get_user_address($invoice->get_user_id()));
326 326
 			return;
327 327
 		}
328 328
 
329 329
 		$props = array();
330 330
 
331
-		foreach ( $this->database_fields_to_props as $db_field => $prop ) {
331
+		foreach ($this->database_fields_to_props as $db_field => $prop) {
332 332
 			
333
-			if ( $db_field == 'post_id' ) {
333
+			if ($db_field == 'post_id') {
334 334
 				continue;
335 335
 			}
336 336
 
337
-			$props[ $prop ] = $data[ $db_field ];
337
+			$props[$prop] = $data[$db_field];
338 338
 		}
339 339
 
340
-		$invoice->set_props( $props );
340
+		$invoice->set_props($props);
341 341
 
342 342
 	}
343 343
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 * @param  WPInv_Invoice $invoice       The Invoice object.
349 349
 	 * @return array                        A mapping of field keys => prop names, filtered by ones that should be updated.
350 350
 	 */
351
-	protected function get_special_fields_to_update( $invoice ) {
351
+	protected function get_special_fields_to_update($invoice) {
352 352
 		$fields_to_update = array();
353
-		$changed_props   = $invoice->get_changes();
353
+		$changed_props = $invoice->get_changes();
354 354
 
355 355
 		// Props should be updated if they are a part of the $changed array or don't exist yet.
356
-		foreach ( $this->database_fields_to_props as $database_field => $prop ) {
357
-			if ( array_key_exists( $prop, $changed_props ) ) {
358
-				$fields_to_update[ $database_field ] = $prop;
356
+		foreach ($this->database_fields_to_props as $database_field => $prop) {
357
+			if (array_key_exists($prop, $changed_props)) {
358
+				$fields_to_update[$database_field] = $prop;
359 359
 			}
360 360
 		}
361 361
 
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
 	 * @param WPInv_Invoice $invoice WPInv_Invoice object.
369 369
 	 * @since 1.0.19
370 370
 	 */
371
-	protected function update_special_fields( &$invoice ) {
371
+	protected function update_special_fields(&$invoice) {
372 372
 		global $wpdb;
373 373
 
374 374
 		$updated_props    = array();
375
-		$fields_to_update = $this->get_special_fields_to_update( $invoice );
375
+		$fields_to_update = $this->get_special_fields_to_update($invoice);
376 376
 
377
-		foreach ( $fields_to_update as $database_field => $prop ) {
378
-			$value = $invoice->{"get_$prop"}( 'edit' );
379
-			$value = is_string( $value ) ? wp_slash( $value ) : $value;
380
-			$value = is_bool( $value ) ? ( int ) $value : $value;
381
-			$updated_props[ $database_field ] = maybe_serialize( $value );
377
+		foreach ($fields_to_update as $database_field => $prop) {
378
+			$value = $invoice->{"get_$prop"}('edit');
379
+			$value = is_string($value) ? wp_slash($value) : $value;
380
+			$value = is_bool($value) ? (int) $value : $value;
381
+			$updated_props[$database_field] = maybe_serialize($value);
382 382
 		}
383 383
 
384
-		if ( ! empty( $updated_props ) ) {
384
+		if (!empty($updated_props)) {
385 385
 
386 386
 			$table = $wpdb->prefix . 'getpaid_invoices';
387
-			$wpdb->update( $table, $updated_props, array( 'post_id' => $invoice->get_id() ) );
388
-			wp_cache_delete( $invoice->get_id(), 'getpaid_invoice_special_fields' );
389
-			do_action( "getpaid_invoice_update_database_fields", $invoice, $updated_props );
387
+			$wpdb->update($table, $updated_props, array('post_id' => $invoice->get_id()));
388
+			wp_cache_delete($invoice->get_id(), 'getpaid_invoice_special_fields');
389
+			do_action("getpaid_invoice_update_database_fields", $invoice, $updated_props);
390 390
 
391 391
 		}
392 392
 
@@ -398,22 +398,22 @@  discard block
 block discarded – undo
398 398
 	 * @param WPInv_Invoice $invoice WPInv_Invoice object.
399 399
 	 * @since 1.0.19
400 400
 	 */
401
-	protected function insert_special_fields( &$invoice ) {
401
+	protected function insert_special_fields(&$invoice) {
402 402
 		global $wpdb;
403 403
 
404
-		$updated_props   = array();
404
+		$updated_props = array();
405 405
 
406
-		foreach ( $this->database_fields_to_props as $database_field => $prop ) {
407
-			$value = $invoice->{"get_$prop"}( 'edit' );
408
-			$value = is_string( $value ) ? wp_slash( $value ) : $value;
409
-			$value = is_bool( $value ) ? ( int ) $value : $value;
410
-			$updated_props[ $database_field ] = maybe_serialize( $value );
406
+		foreach ($this->database_fields_to_props as $database_field => $prop) {
407
+			$value = $invoice->{"get_$prop"}('edit');
408
+			$value = is_string($value) ? wp_slash($value) : $value;
409
+			$value = is_bool($value) ? (int) $value : $value;
410
+			$updated_props[$database_field] = maybe_serialize($value);
411 411
 		}
412 412
 
413 413
 		$table = $wpdb->prefix . 'getpaid_invoices';
414
-		$wpdb->insert( $table, $updated_props );
415
-		wp_cache_delete( $invoice->get_id(), 'getpaid_invoice_special_fields' );
416
-		do_action( "getpaid_invoice_insert_database_fields", $invoice, $updated_props );
414
+		$wpdb->insert($table, $updated_props);
415
+		wp_cache_delete($invoice->get_id(), 'getpaid_invoice_special_fields');
416
+		do_action("getpaid_invoice_insert_database_fields", $invoice, $updated_props);
417 417
 
418 418
 	}
419 419
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 *
423 423
 	 * @param WPInv_Invoice $invoice Invoice object.
424 424
      */
425
-    public function save_special_fields( & $invoice ) {
425
+    public function save_special_fields(& $invoice) {
426 426
 		global $wpdb;
427 427
 
428 428
 		// The invoices table.
@@ -430,13 +430,13 @@  discard block
 block discarded – undo
430 430
 		$id    = (int) $invoice->get_id();
431 431
 		$invoice->maybe_set_key();
432 432
 
433
-		if ( $wpdb->get_var( "SELECT `post_id` FROM $table WHERE `post_id`= $id" ) ) {
433
+		if ($wpdb->get_var("SELECT `post_id` FROM $table WHERE `post_id`= $id")) {
434 434
 
435
-			$this->update_special_fields( $invoice );
435
+			$this->update_special_fields($invoice);
436 436
 
437 437
 		} else {
438 438
 
439
-			$this->insert_special_fields( $invoice );
439
+			$this->insert_special_fields($invoice);
440 440
 
441 441
 		}
442 442
 
@@ -447,43 +447,43 @@  discard block
 block discarded – undo
447 447
 	 *
448 448
 	 * @param WPInv_Invoice $invoice Invoice object.
449 449
      */
450
-    public function add_items( &$invoice ) {
450
+    public function add_items(&$invoice) {
451 451
 		global $wpdb;
452 452
 
453 453
 		// Maybe retrieve from the cache.
454
-		$items = wp_cache_get( $invoice->get_id(), 'getpaid_invoice_cart_details' );
454
+		$items = wp_cache_get($invoice->get_id(), 'getpaid_invoice_cart_details');
455 455
 
456 456
 		// If not found, retrieve from the db.
457
-		if ( false === $items ) {
458
-			$table =  $wpdb->prefix . 'getpaid_invoice_items';
457
+		if (false === $items) {
458
+			$table = $wpdb->prefix . 'getpaid_invoice_items';
459 459
 
460 460
 			$items = $wpdb->get_results(
461
-				$wpdb->prepare( "SELECT * FROM $table WHERE `post_id`=%d", $invoice->get_id() )
461
+				$wpdb->prepare("SELECT * FROM $table WHERE `post_id`=%d", $invoice->get_id())
462 462
 			);
463 463
 
464 464
 			// Update the cache with our data
465
-			wp_cache_set( $invoice->get_id(), $items, 'getpaid_invoice_cart_details' );
465
+			wp_cache_set($invoice->get_id(), $items, 'getpaid_invoice_cart_details');
466 466
 
467 467
 		}
468 468
 
469 469
 		// Abort if no items found.
470
-        if ( empty( $items ) ) {
470
+        if (empty($items)) {
471 471
             return;
472 472
 		}
473 473
 
474
-		foreach ( $items as $item_data ) {
475
-			$item = new GetPaid_Form_Item( $item_data->item_id );
474
+		foreach ($items as $item_data) {
475
+			$item = new GetPaid_Form_Item($item_data->item_id);
476 476
 
477 477
 			// Set item data.
478
-			$item->item_tax      = wpinv_sanitize_amount( $item_data->tax );
479
-			$item->item_discount = wpinv_sanitize_amount( $item_data->discount );
480
-			$item->set_name( $item_data->item_name );
481
-			$item->set_description( $item_data->item_description );
482
-			$item->set_price( $item_data->item_price );
483
-			$item->set_quantity( $item_data->quantity );
484
-			$item->set_item_meta( $item_data->meta );
485
-
486
-			$invoice->add_item( $item );
478
+			$item->item_tax      = wpinv_sanitize_amount($item_data->tax);
479
+			$item->item_discount = wpinv_sanitize_amount($item_data->discount);
480
+			$item->set_name($item_data->item_name);
481
+			$item->set_description($item_data->item_description);
482
+			$item->set_price($item_data->item_price);
483
+			$item->set_quantity($item_data->quantity);
484
+			$item->set_item_meta($item_data->meta);
485
+
486
+			$invoice->add_item($item);
487 487
 		}
488 488
 
489 489
 	}
@@ -493,20 +493,20 @@  discard block
 block discarded – undo
493 493
 	 *
494 494
 	 * @param WPInv_Invoice $invoice Invoice object.
495 495
      */
496
-    public function save_items( $invoice ) {
496
+    public function save_items($invoice) {
497 497
 
498 498
 		// Delete previously existing items.
499
-		$this->delete_items( $invoice );
499
+		$this->delete_items($invoice);
500 500
 
501
-		$table   =  $GLOBALS['wpdb']->prefix . 'getpaid_invoice_items';
501
+		$table = $GLOBALS['wpdb']->prefix . 'getpaid_invoice_items';
502 502
 
503
-		foreach ( $invoice->get_cart_details() as $item_data ) {
504
-			$item_data = array_map( 'maybe_serialize', $item_data );
505
-			$GLOBALS['wpdb']->insert( $table, $item_data );
503
+		foreach ($invoice->get_cart_details() as $item_data) {
504
+			$item_data = array_map('maybe_serialize', $item_data);
505
+			$GLOBALS['wpdb']->insert($table, $item_data);
506 506
 		}
507 507
 
508
-		wp_cache_delete( $invoice->get_id(), 'getpaid_invoice_cart_details' );
509
-		do_action( "getpaid_invoice_save_items", $invoice );
508
+		wp_cache_delete($invoice->get_id(), 'getpaid_invoice_cart_details');
509
+		do_action("getpaid_invoice_save_items", $invoice);
510 510
 
511 511
 	}
512 512
 
@@ -515,9 +515,9 @@  discard block
 block discarded – undo
515 515
 	 *
516 516
 	 * @param WPInv_Invoice $invoice Invoice object.
517 517
      */
518
-    public function delete_items( $invoice ) {
519
-		$table =  $GLOBALS['wpdb']->prefix . 'getpaid_invoice_items';
520
-		return $GLOBALS['wpdb']->delete( $table, array( 'post_id' => $invoice->get_id() ) );
518
+    public function delete_items($invoice) {
519
+		$table = $GLOBALS['wpdb']->prefix . 'getpaid_invoice_items';
520
+		return $GLOBALS['wpdb']->delete($table, array('post_id' => $invoice->get_id()));
521 521
 	}
522 522
 
523 523
 	/**
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
 	 *
526 526
 	 * @param WPInv_Invoice $invoice Invoice object.
527 527
      */
528
-    public function delete_special_fields( $invoice ) {
529
-		$table =  $GLOBALS['wpdb']->prefix . 'getpaid_invoices';
530
-		return $GLOBALS['wpdb']->delete( $table, array( 'post_id' => $invoice->get_id() ) );
528
+    public function delete_special_fields($invoice) {
529
+		$table = $GLOBALS['wpdb']->prefix . 'getpaid_invoices';
530
+		return $GLOBALS['wpdb']->delete($table, array('post_id' => $invoice->get_id()));
531 531
 	}
532 532
 	
533 533
 	/**
@@ -538,10 +538,10 @@  discard block
 block discarded – undo
538 538
 	 * @param  WPInv_Invoice $object GetPaid_Data object.
539 539
 	 * @return string
540 540
 	 */
541
-	protected function get_post_status( $object ) {
542
-		$object_status = $object->get_status( 'edit' );
541
+	protected function get_post_status($object) {
542
+		$object_status = $object->get_status('edit');
543 543
 
544
-		if ( ! $object_status ) {
544
+		if (!$object_status) {
545 545
 			$object_status = $object->get_default_status();
546 546
 		}
547 547
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/pay_button.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,44 +7,44 @@
 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 class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Button Text', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Button Text', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18
-        <small class="form-text text-muted"><?php _e( '%price% will be replaced by the total payable amount', 'invoicing' ); ?></small>
18
+        <small class="form-text text-muted"><?php _e('%price% will be replaced by the total payable amount', 'invoicing'); ?></small>
19 19
     </label>
20 20
 </div>
21 21
 
22 22
 <div class='form-group'>
23 23
     <label class="d-block">
24
-        <span><?php esc_html_e( 'Free Checkout Text', 'invoicing' ); ?></span>
24
+        <span><?php esc_html_e('Free Checkout Text', 'invoicing'); ?></span>
25 25
         <input v-model='active_form_element.free' class='form-control' type="text"/>
26
-        <small class="form-text text-muted"><?php _e( 'The text to display if the total payable amount is zero', 'invoicing' ); ?></small>
26
+        <small class="form-text text-muted"><?php _e('The text to display if the total payable amount is zero', 'invoicing'); ?></small>
27 27
     </label>
28 28
 </div>
29 29
 
30 30
 <div class='form-group'>
31 31
     <label class="d-block">
32
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
33
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
33
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
34 34
     </label>
35 35
 </div>
36 36
 
37 37
 <div class='form-group'>
38
-    <label :for="active_form_element.id + '_edit_type'"><?php esc_html_e( 'Button Type', 'invoicing' ) ?></label>
38
+    <label :for="active_form_element.id + '_edit_type'"><?php esc_html_e('Button Type', 'invoicing') ?></label>
39 39
     <select class='form-control custom-select' :id="active_form_element.id + '_edit_type'" v-model='active_form_element.class'>
40
-        <option value='btn-primary'><?php esc_html_e( 'Primary', 'invoicing' ); ?></option>
41
-        <option value='btn-secondary'><?php esc_html_e( 'Secondary', 'invoicing' ); ?></option>
42
-        <option value='btn-success'><?php esc_html_e( 'Success', 'invoicing' ); ?></option>
43
-        <option value='btn-danger'><?php esc_html_e( 'Danger', 'invoicing' ); ?></option>
44
-        <option value='btn-warning'><?php esc_html_e( 'Warning', 'invoicing' ); ?></option>
45
-        <option value='btn-info'><?php esc_html_e( 'Info', 'invoicing' ); ?></option>
46
-        <option value='btn-light'><?php esc_html_e( 'Light', 'invoicing' ); ?></option>
47
-        <option value='btn-dark'><?php esc_html_e( 'Dark', 'invoicing' ); ?></option>
48
-        <option value='btn-link'><?php esc_html_e( 'Link', 'invoicing' ); ?></option>
40
+        <option value='btn-primary'><?php esc_html_e('Primary', 'invoicing'); ?></option>
41
+        <option value='btn-secondary'><?php esc_html_e('Secondary', 'invoicing'); ?></option>
42
+        <option value='btn-success'><?php esc_html_e('Success', 'invoicing'); ?></option>
43
+        <option value='btn-danger'><?php esc_html_e('Danger', 'invoicing'); ?></option>
44
+        <option value='btn-warning'><?php esc_html_e('Warning', 'invoicing'); ?></option>
45
+        <option value='btn-info'><?php esc_html_e('Info', 'invoicing'); ?></option>
46
+        <option value='btn-light'><?php esc_html_e('Light', 'invoicing'); ?></option>
47
+        <option value='btn-dark'><?php esc_html_e('Dark', 'invoicing'); ?></option>
48
+        <option value='btn-link'><?php esc_html_e('Link', 'invoicing'); ?></option>
49 49
     </select>
50 50
 </div>
Please login to merge, or discard this patch.
includes/wpinv-discount-functions.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
  
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Returns an array of discount type.
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
     return apply_filters(
18 18
         'wpinv_discount_types',
19 19
         array(
20
-            'percent'   => __( 'Percentage', 'invoicing' ),
21
-            'flat'     => __( 'Flat Amount', 'invoicing' ),
20
+            'percent'   => __('Percentage', 'invoicing'),
21
+            'flat'     => __('Flat Amount', 'invoicing'),
22 22
         )
23 23
     );
24 24
 }
@@ -28,46 +28,46 @@  discard block
 block discarded – undo
28 28
  * 
29 29
  * @return string
30 30
  */
31
-function wpinv_get_discount_type_name( $type = '' ) {
31
+function wpinv_get_discount_type_name($type = '') {
32 32
     $types = wpinv_get_discount_types();
33
-    return isset( $types[ $type ] ) ? $types[ $type ] : $type;
33
+    return isset($types[$type]) ? $types[$type] : $type;
34 34
 }
35 35
 
36 36
 /**
37 37
  * Deletes a discount via the admin page.
38 38
  * 
39 39
  */
40
-function wpinv_delete_discount( $data ) {
40
+function wpinv_delete_discount($data) {
41 41
 
42
-    $discount = new WPInv_Discount( absint( $data['discount'] ) );
43
-    $discount->delete( true );
42
+    $discount = new WPInv_Discount(absint($data['discount']));
43
+    $discount->delete(true);
44 44
 
45 45
 }
46
-add_action( 'getpaid_authenticated_admin_action_delete_discount', 'wpinv_delete_discount' );
46
+add_action('getpaid_authenticated_admin_action_delete_discount', 'wpinv_delete_discount');
47 47
 
48 48
 /**
49 49
  * Deactivates a discount via the admin page.
50 50
  */
51
-function wpinv_activate_discount( $data ) {
51
+function wpinv_activate_discount($data) {
52 52
 
53
-    $discount = new WPInv_Discount( absint( $data['discount'] ) );
54
-    $discount->set_status( 'publish' );
53
+    $discount = new WPInv_Discount(absint($data['discount']));
54
+    $discount->set_status('publish');
55 55
     $discount->save();
56 56
 
57 57
 }
58
-add_action( 'getpaid_authenticated_admin_action_activate_discount', 'wpinv_activate_discount' );
58
+add_action('getpaid_authenticated_admin_action_activate_discount', 'wpinv_activate_discount');
59 59
 
60 60
 /**
61 61
  * Activates a discount via the admin page.
62 62
  */
63
-function wpinv_deactivate_discount( $data ) {
63
+function wpinv_deactivate_discount($data) {
64 64
 
65
-    $discount = new WPInv_Discount( absint( $data['discount'] ) );
66
-    $discount->set_status( 'pending' );
65
+    $discount = new WPInv_Discount(absint($data['discount']));
66
+    $discount->set_status('pending');
67 67
     $discount->save();
68 68
 
69 69
 }
70
-add_action( 'getpaid_authenticated_admin_action_deactivate_discount', 'wpinv_deactivate_discount' );
70
+add_action('getpaid_authenticated_admin_action_deactivate_discount', 'wpinv_deactivate_discount');
71 71
 
72 72
 /**
73 73
  * Fetches a discount object.
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
  * @since 1.0.15
77 77
  * @return WPInv_Discount
78 78
  */
79
-function wpinv_get_discount( $discount ) {
80
-    return new WPInv_Discount( $discount );
79
+function wpinv_get_discount($discount) {
80
+    return new WPInv_Discount($discount);
81 81
 }
82 82
 
83 83
 /**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
  * @since 1.0.15
88 88
  * @return WPInv_Discount
89 89
  */
90
-function wpinv_get_discount_obj( $discount = 0 ) {
91
-    return new WPInv_Discount( $discount );
90
+function wpinv_get_discount_obj($discount = 0) {
91
+    return new WPInv_Discount($discount);
92 92
 }
93 93
 
94 94
 /**
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
  * @param string|int $value The field value
99 99
  * @return bool|WPInv_Discount
100 100
  */
101
-function wpinv_get_discount_by( $deprecated = null, $value = '' ) {
102
-    $discount = new WPInv_Discount( $value );
101
+function wpinv_get_discount_by($deprecated = null, $value = '') {
102
+    $discount = new WPInv_Discount($value);
103 103
 
104
-    if ( $discount->get_id() != 0 ) {
104
+    if ($discount->get_id() != 0) {
105 105
         return $discount;
106 106
     }
107 107
 
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 function wpinv_get_discount_statuses() {
117 117
 
118 118
     return array(
119
-        'expired'  => __( 'Expired', 'invoicing' ),
120
-        'publish'  => __( 'Active', 'invoicing' ),
121
-        'inactive' => __( 'Inactive', 'invoicing' ),
119
+        'expired'  => __('Expired', 'invoicing'),
120
+        'publish'  => __('Active', 'invoicing'),
121
+        'inactive' => __('Inactive', 'invoicing'),
122 122
     );
123 123
 
124 124
 }
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 /**
127 127
  * Retrieves an invoice status label.
128 128
  */
129
-function wpinv_discount_status( $status ) {
129
+function wpinv_discount_status($status) {
130 130
     $statuses = wpinv_get_discount_statuses();
131
-    return isset( $statuses[ $status ] ) ? $statuses[ $status ] : __( 'Inactive', 'invoicing' );
131
+    return isset($statuses[$status]) ? $statuses[$status] : __('Inactive', 'invoicing');
132 132
 }
133 133
 
134 134
 /**
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
  * @param int|array|string|WPInv_Discount $code discount data, object, ID or code.
139 139
  * @return bool
140 140
  */
141
-function wpinv_discount_is_recurring( $discount = 0, $code = 0 ) {
141
+function wpinv_discount_is_recurring($discount = 0, $code = 0) {
142 142
 
143
-    if( ! empty( $discount ) ) {
144
-        $discount    = wpinv_get_discount_obj( $discount );
143
+    if (!empty($discount)) {
144
+        $discount    = wpinv_get_discount_obj($discount);
145 145
     } else {
146
-        $discount    = wpinv_get_discount_obj( $code );
146
+        $discount    = wpinv_get_discount_obj($code);
147 147
     }
148 148
 
149 149
     return $discount->get_is_recurring();
Please login to merge, or discard this patch.
includes/class-getpaid-daily-maintenance.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Daily maintenance class.
@@ -15,19 +15,19 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * Class constructor.
17 17
 	 */
18
-	public function __construct(){
18
+	public function __construct() {
19 19
 
20 20
 		// Clear deprecated events.
21
-		add_action( 'wp', array( $this, 'maybe_clear_deprecated_events' ) );
21
+		add_action('wp', array($this, 'maybe_clear_deprecated_events'));
22 22
 
23 23
 		// (Maybe) schedule a cron that runs daily.
24
-		add_action( 'wp', array( $this, 'maybe_create_scheduled_event' ) );
24
+		add_action('wp', array($this, 'maybe_create_scheduled_event'));
25 25
 
26 26
 		// Fired everyday at 7 a.m (this might vary for sites with few visitors)
27
-		add_action( 'getpaid_daily_maintenance', array( $this, 'log_cron_run' ) );
28
-		add_action( 'getpaid_daily_maintenance', array( $this, 'backwards_compat' ) );
29
-		add_action( 'getpaid_daily_maintenance', array( $this, 'maybe_expire_subscriptions' ) );
30
-		add_action( 'getpaid_daily_maintenance', array( $this, 'maybe_update_geoip_databases' ) );
27
+		add_action('getpaid_daily_maintenance', array($this, 'log_cron_run'));
28
+		add_action('getpaid_daily_maintenance', array($this, 'backwards_compat'));
29
+		add_action('getpaid_daily_maintenance', array($this, 'maybe_expire_subscriptions'));
30
+		add_action('getpaid_daily_maintenance', array($this, 'maybe_update_geoip_databases'));
31 31
 
32 32
 	}
33 33
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function maybe_create_scheduled_event() {
39 39
 
40
-		if ( ! wp_next_scheduled( 'getpaid_daily_maintenance' ) ) {
41
-			$timestamp = strtotime( 'tomorrow 07:00:00', current_time( 'timestamp' ) );
42
-			wp_schedule_event( $timestamp, 'daily', 'getpaid_daily_maintenance' );
40
+		if (!wp_next_scheduled('getpaid_daily_maintenance')) {
41
+			$timestamp = strtotime('tomorrow 07:00:00', current_time('timestamp'));
42
+			wp_schedule_event($timestamp, 'daily', 'getpaid_daily_maintenance');
43 43
 		}
44 44
 
45 45
 	}
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function maybe_clear_deprecated_events() {
52 52
 
53
-		if ( ! get_option( 'wpinv_cleared_old_events' ) ) {
54
-			wp_clear_scheduled_hook( 'wpinv_register_schedule_event_twicedaily' );
55
-			wp_clear_scheduled_hook( 'wpinv_register_schedule_event_daily' );
56
-			update_option( 'wpinv_cleared_old_events', 1 );
53
+		if (!get_option('wpinv_cleared_old_events')) {
54
+			wp_clear_scheduled_hook('wpinv_register_schedule_event_twicedaily');
55
+			wp_clear_scheduled_hook('wpinv_register_schedule_event_daily');
56
+			update_option('wpinv_cleared_old_events', 1);
57 57
 		}
58 58
 
59 59
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 */
65 65
 	public function backwards_compat() {
66
-		do_action( 'wpinv_register_schedule_event_daily' );
66
+		do_action('wpinv_register_schedule_event_daily');
67 67
 	}
68 68
 
69 69
 	/**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	public function maybe_expire_subscriptions() {
74 74
 
75 75
 		// Fetch expired subscriptions (skips those that expire today).
76
-		$args  = array(
76
+		$args = array(
77 77
 			'number'             => -1,
78 78
 			'count_total'        => false,
79 79
 			'status'             => 'trialling active failing cancelled',
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 			),
84 84
 		);
85 85
 
86
-		$subscriptions = new GetPaid_Subscriptions_Query( $args );
86
+		$subscriptions = new GetPaid_Subscriptions_Query($args);
87 87
 
88
-		foreach ( $subscriptions->get_results() as $subscription ) {
89
-			if ( apply_filters( 'getpaid_daily_maintenance_should_expire_subscription', true, $subscription ) ) {
90
-				$subscription->set_status( 'expired' );
88
+		foreach ($subscriptions->get_results() as $subscription) {
89
+			if (apply_filters('getpaid_daily_maintenance_should_expire_subscription', true, $subscription)) {
90
+				$subscription->set_status('expired');
91 91
 				$subscription->save();
92 92
 			}
93 93
 		}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 */
101 101
 	public function log_cron_run() {
102
-		wpinv_error_log( 'GetPaid Daily Cron' );
102
+		wpinv_error_log('GetPaid Daily Cron');
103 103
 	}
104 104
 
105 105
 	/**
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 */
109 109
 	public function maybe_update_geoip_databases() {
110
-		$updated = get_transient( 'getpaid_updated_geoip_databases' );
110
+		$updated = get_transient('getpaid_updated_geoip_databases');
111 111
 
112
-		if ( false === $updated ) {
113
-			set_transient( 'getpaid_updated_geoip_databases', 1, 15 * DAY_IN_SECONDS );
114
-			do_action( 'getpaid_update_geoip_databases' );
112
+		if (false === $updated) {
113
+			set_transient('getpaid_updated_geoip_databases', 1, 15 * DAY_IN_SECONDS);
114
+			do_action('getpaid_update_geoip_databases');
115 115
 		}
116 116
 
117 117
 	}
Please login to merge, or discard this patch.
templates/payment-forms/elements/ip_address.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@
 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() );
16
+$ip_address = sanitize_text_field(wpinv_get_ip());
17 17
 
18 18
 ?>
19 19
 <div class="form-group getpaid-ip-info">
20
-    <span><?php echo wp_kses_post( $text ); ?></span>
20
+    <span><?php echo wp_kses_post($text); ?></span>
21 21
     <strong><?php echo $ip_address; ?></strong>
22 22
 </div>
Please login to merge, or discard this patch.
vendor/composer/platform_check.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 $issues = array();
6 6
 
7 7
 if (!(PHP_VERSION_ID >= 50600)) {
8
-    $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION  .  '.';
8
+    $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
9 9
 }
10 10
 
11 11
 if ($issues) {
Please login to merge, or discard this patch.
includes/wpinv-address-functions.php 1 patch
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 
15 15
 function wpinv_get_default_country() {
16
-	$country = wpinv_get_option( 'default_country', 'UK' );
16
+	$country = wpinv_get_option('default_country', 'UK');
17 17
 
18
-	return apply_filters( 'wpinv_default_country', $country );
18
+	return apply_filters('wpinv_default_country', $country);
19 19
 }
20 20
 
21 21
 /**
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string
25 25
  */
26
-function getpaid_get_ip_country( $ip_address = '' ) {
27
-    $country = GetPaid_Geolocation::geolocate_ip( $ip_address, true );
26
+function getpaid_get_ip_country($ip_address = '') {
27
+    $country = GetPaid_Geolocation::geolocate_ip($ip_address, true);
28 28
     return $country['country'];
29 29
 }
30 30
 
@@ -34,59 +34,59 @@  discard block
 block discarded – undo
34 34
  * @param string $country The country code to sanitize
35 35
  * @return array
36 36
  */
37
-function wpinv_sanitize_country( $country ) {
37
+function wpinv_sanitize_country($country) {
38 38
 
39 39
 	// Enure the country is specified
40
-    if ( empty( $country ) ) {
40
+    if (empty($country)) {
41 41
         $country = wpinv_get_default_country();
42 42
     }
43
-    return trim( wpinv_utf8_strtoupper( $country ) );
43
+    return trim(wpinv_utf8_strtoupper($country));
44 44
 
45 45
 }
46 46
 
47
-function wpinv_is_base_country( $country ) {
47
+function wpinv_is_base_country($country) {
48 48
     $base_country = wpinv_get_default_country();
49 49
     
50
-    if ( $base_country === 'UK' ) {
50
+    if ($base_country === 'UK') {
51 51
         $base_country = 'GB';
52 52
     }
53
-    if ( $country == 'UK' ) {
53
+    if ($country == 'UK') {
54 54
         $country = 'GB';
55 55
     }
56 56
 
57
-    return ( $country && $country === $base_country ) ? true : false;
57
+    return ($country && $country === $base_country) ? true : false;
58 58
 }
59 59
 
60
-function wpinv_country_name( $country_code = '' ) { 
60
+function wpinv_country_name($country_code = '') { 
61 61
     $countries = wpinv_get_country_list();
62 62
     $country_code = $country_code == 'UK' ? 'GB' : $country_code;
63
-    $country = isset( $countries[$country_code] ) ? $countries[$country_code] : $country_code;
63
+    $country = isset($countries[$country_code]) ? $countries[$country_code] : $country_code;
64 64
 
65
-    return apply_filters( 'wpinv_country_name', $country, $country_code );
65
+    return apply_filters('wpinv_country_name', $country, $country_code);
66 66
 }
67 67
 
68 68
 function wpinv_get_default_state() {
69
-	$state = wpinv_get_option( 'default_state', '' );
69
+	$state = wpinv_get_option('default_state', '');
70 70
 
71
-	return apply_filters( 'wpinv_default_state', $state );
71
+	return apply_filters('wpinv_default_state', $state);
72 72
 }
73 73
 
74
-function wpinv_state_name( $state_code = '', $country_code = '' ) {
74
+function wpinv_state_name($state_code = '', $country_code = '') {
75 75
     $state = $state_code;
76 76
     
77
-    if ( !empty( $country_code ) ) {
78
-        $states = wpinv_get_country_states( $country_code );
77
+    if (!empty($country_code)) {
78
+        $states = wpinv_get_country_states($country_code);
79 79
         
80
-        $state = !empty( $states ) && isset( $states[$state_code] ) ? $states[$state_code] : $state;
80
+        $state = !empty($states) && isset($states[$state_code]) ? $states[$state_code] : $state;
81 81
     }
82 82
 
83
-    return apply_filters( 'wpinv_state_name', $state, $state_code, $country_code );
83
+    return apply_filters('wpinv_state_name', $state, $state_code, $country_code);
84 84
 }
85 85
 
86 86
 function wpinv_store_address() {
87
-    $address = wpinv_get_option( 'store_address', '' );
87
+    $address = wpinv_get_option('store_address', '');
88 88
 
89
-    return apply_filters( 'wpinv_store_address', $address );
89
+    return apply_filters('wpinv_store_address', $address);
90 90
 }
91 91
 
92 92
 /**
@@ -94,24 +94,24 @@  discard block
 block discarded – undo
94 94
  *
95 95
  * @param WPInv_Invoice $invoice
96 96
  */
97
-function getpaid_maybe_add_default_address( &$invoice ) {
97
+function getpaid_maybe_add_default_address(&$invoice) {
98 98
 
99 99
     $user_id = $invoice->get_user_id();
100 100
 
101 101
     // Abort if the invoice belongs to no one.
102
-    if ( empty( $user_id ) ) {
102
+    if (empty($user_id)) {
103 103
         return;
104 104
     }
105 105
 
106 106
     // Fill in defaults whenever necessary.
107
-    foreach ( wpinv_get_user_address( $user_id ) as $key => $value ) {
107
+    foreach (wpinv_get_user_address($user_id) as $key => $value) {
108 108
 
109
-        if ( is_callable( $invoice, "get_$key" ) ) {
110
-            $current = call_user_func( array( $invoice, "get_$key" ) );
109
+        if (is_callable($invoice, "get_$key")) {
110
+            $current = call_user_func(array($invoice, "get_$key"));
111 111
 
112
-            if ( empty( $current ) ) {
112
+            if (empty($current)) {
113 113
                 $method = "set_$key";
114
-                $invoice->$method( $value );
114
+                $invoice->$method($value);
115 115
             }
116 116
 
117 117
         }
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
     return apply_filters(
131 131
         'getpaid_user_address_fields',
132 132
         array(
133
-            'first_name' => __( 'First Name', 'invoicing' ),
134
-            'last_name'  => __( 'Last Name', 'invoicing' ),
135
-            'country'    => __( 'Country', 'invoicing' ),
136
-            'state'      => __( 'State', 'invoicing' ),
137
-            'city'       => __( 'City', 'invoicing' ),
138
-            'zip'        => __( 'Zip/Postal Code', 'invoicing' ),
139
-            'address'    => __( 'Address', 'invoicing' ),
140
-            'phone'      => __( 'Phone Number', 'invoicing' ),
141
-            'company'    => __( 'Company', 'invoicing' ),
142
-            'vat_number' => __( 'VAT Number', 'invoicing' ),
133
+            'first_name' => __('First Name', 'invoicing'),
134
+            'last_name'  => __('Last Name', 'invoicing'),
135
+            'country'    => __('Country', 'invoicing'),
136
+            'state'      => __('State', 'invoicing'),
137
+            'city'       => __('City', 'invoicing'),
138
+            'zip'        => __('Zip/Postal Code', 'invoicing'),
139
+            'address'    => __('Address', 'invoicing'),
140
+            'phone'      => __('Phone Number', 'invoicing'),
141
+            'company'    => __('Company', 'invoicing'),
142
+            'vat_number' => __('VAT Number', 'invoicing'),
143 143
         )
144 144
     );
145 145
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
  * 
151 151
  * @return bool
152 152
  */
153
-function getpaid_is_address_field_whitelisted( $key ) {
154
-    return array_key_exists( $key, getpaid_user_address_fields() );
153
+function getpaid_is_address_field_whitelisted($key) {
154
+    return array_key_exists($key, getpaid_user_address_fields());
155 155
 }
156 156
 
157 157
 /**
@@ -161,24 +161,24 @@  discard block
 block discarded – undo
161 161
  *
162 162
  * @param WPInv_Invoice $invoice
163 163
  */
164
-function getpaid_save_invoice_user_address( $invoice ) {
164
+function getpaid_save_invoice_user_address($invoice) {
165 165
 
166 166
     // Retrieve the invoice.
167
-    $invoice = wpinv_get_invoice( $invoice );
167
+    $invoice = wpinv_get_invoice($invoice);
168 168
 
169 169
     // Abort if it does not exist.
170
-    if ( empty( $invoice ) ) {
170
+    if (empty($invoice)) {
171 171
         return;
172 172
     }
173 173
 
174
-    foreach ( array_keys( getpaid_user_address_fields() ) as $field ) {
174
+    foreach (array_keys(getpaid_user_address_fields()) as $field) {
175 175
 
176
-        if ( is_callable( array( $invoice, "get_$field" ) ) ) {
177
-            $value = call_user_func( array( $invoice, "get_$field" ) );
176
+        if (is_callable(array($invoice, "get_$field"))) {
177
+            $value = call_user_func(array($invoice, "get_$field"));
178 178
 
179 179
             // Only save if it is not empty.
180
-            if ( ! empty( $value ) ) {
181
-                update_user_meta( $invoice->get_user_id(), '_wpinv_' . $field, $value );
180
+            if (!empty($value)) {
181
+                update_user_meta($invoice->get_user_id(), '_wpinv_' . $field, $value);
182 182
             }
183 183
 
184 184
         }
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
     }
187 187
 
188 188
 }
189
-add_action( 'getpaid_new_invoice', 'getpaid_save_invoice_user_address' );
190
-add_action( 'getpaid_update_invoice', 'getpaid_save_invoice_user_address' );
189
+add_action('getpaid_new_invoice', 'getpaid_save_invoice_user_address');
190
+add_action('getpaid_update_invoice', 'getpaid_save_invoice_user_address');
191 191
 
192 192
 /**
193 193
  * Retrieves a saved user address.
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
  * @param bool $with_default Whether or not we should use the default country and state.
197 197
  * @return array
198 198
  */
199
-function wpinv_get_user_address( $user_id = 0, $with_default = true ) {
199
+function wpinv_get_user_address($user_id = 0, $with_default = true) {
200 200
 
201 201
     // Prepare the user id.
202
-    $user_id   = empty( $user_id ) ? get_current_user_id() : $user_id;
203
-    $user_info = get_userdata( $user_id );
202
+    $user_id   = empty($user_id) ? get_current_user_id() : $user_id;
203
+    $user_info = get_userdata($user_id);
204 204
 
205 205
     // Abort if non exists.
206
-    if ( empty( $user_info ) ) {
206
+    if (empty($user_info)) {
207 207
         return array();
208 208
     }
209 209
 
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
         'email'   => $user_info->user_email,
214 214
     );
215 215
 
216
-    foreach ( array_keys( getpaid_user_address_fields() ) as $field ) {
217
-        $address[$field] = getpaid_get_user_address_field( $user_id, $field );
216
+    foreach (array_keys(getpaid_user_address_fields()) as $field) {
217
+        $address[$field] = getpaid_get_user_address_field($user_id, $field);
218 218
     }
219 219
 
220
-    if ( ! $with_default ) {
220
+    if (!$with_default) {
221 221
         return $address;
222 222
     }
223 223
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         'state'      => wpinv_get_default_country(),
229 229
     );
230 230
 
231
-    return getpaid_array_merge_if_empty( $address, $defaults );
231
+    return getpaid_array_merge_if_empty($address, $defaults);
232 232
 
233 233
 }
234 234
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
  * @param string $field The field to use.
240 240
  * @return string|null
241 241
  */
242
-function getpaid_get_user_address_field( $user_id, $field ) {
242
+function getpaid_get_user_address_field($user_id, $field) {
243 243
 
244 244
     $prefixes = array(
245 245
         '_wpinv_',
@@ -247,15 +247,15 @@  discard block
 block discarded – undo
247 247
         ''
248 248
     );
249 249
 
250
-    foreach ( $prefixes as $prefix ) {
250
+    foreach ($prefixes as $prefix) {
251 251
 
252 252
         // Meta table.
253
-        $value = get_user_meta( $user_id, $prefix . $field, true );
253
+        $value = get_user_meta($user_id, $prefix . $field, true);
254 254
         
255 255
         // UWP table.
256
-        $value = ( empty( $value ) && function_exists( 'uwp_get_usermeta' ) ) ? uwp_get_usermeta( $user_id, $prefix . $field ) : $value;
256
+        $value = (empty($value) && function_exists('uwp_get_usermeta')) ? uwp_get_usermeta($user_id, $prefix . $field) : $value;
257 257
 
258
-        if ( ! empty( $value ) ) {
258
+        if (!empty($value)) {
259 259
             return $value;
260 260
         }
261 261
 
@@ -272,16 +272,16 @@  discard block
 block discarded – undo
272 272
  * @param string $return What to return.
273 273
  * @return array
274 274
  */
275
-function wpinv_get_continents( $return = 'all' ) {
275
+function wpinv_get_continents($return = 'all') {
276 276
 
277
-    $continents = wpinv_get_data( 'continents' );
277
+    $continents = wpinv_get_data('continents');
278 278
 
279
-    switch( $return ) {
279
+    switch ($return) {
280 280
         case 'name' :
281
-            return wp_list_pluck( $continents, 'name' );
281
+            return wp_list_pluck($continents, 'name');
282 282
             break;
283 283
         case 'countries' :
284
-            return wp_list_pluck( $continents, 'countries' );
284
+            return wp_list_pluck($continents, 'countries');
285 285
             break;
286 286
         default :
287 287
             return $continents;
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
  * @param string $country Country code. If no code is specified, defaults to the default country.
298 298
  * @return string
299 299
  */
300
-function wpinv_get_continent_code_for_country( $country = false ) {
300
+function wpinv_get_continent_code_for_country($country = false) {
301 301
 
302
-    $country = wpinv_sanitize_country( $country );
302
+    $country = wpinv_sanitize_country($country);
303 303
     
304
-	foreach ( wpinv_get_continents( 'countries' ) as $continent_code => $countries ) {
305
-		if ( false !== array_search( $country, $countries, true ) ) {
304
+	foreach (wpinv_get_continents('countries') as $continent_code => $countries) {
305
+		if (false !== array_search($country, $countries, true)) {
306 306
 			return $continent_code;
307 307
 		}
308 308
 	}
@@ -318,13 +318,13 @@  discard block
 block discarded – undo
318 318
  * @param string $country Country code. If no code is specified, defaults to the default country.
319 319
  * @return array
320 320
  */
321
-function wpinv_get_country_calling_code( $country = null) {
321
+function wpinv_get_country_calling_code($country = null) {
322 322
 
323
-    $country = wpinv_sanitize_country( $country );
324
-    $codes   = wpinv_get_data( 'phone-codes' );
325
-    $code    = isset( $codes[ $country ] ) ? $codes[ $country ] : '';
323
+    $country = wpinv_sanitize_country($country);
324
+    $codes   = wpinv_get_data('phone-codes');
325
+    $code    = isset($codes[$country]) ? $codes[$country] : '';
326 326
 
327
-    if ( is_array( $code ) ) {
327
+    if (is_array($code)) {
328 328
         return $code[0];
329 329
     }
330 330
     return $code;
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
  * @param bool $first_empty Whether or not the first item in the list should be empty
338 338
  * @return array
339 339
  */
340
-function wpinv_get_country_list( $first_empty = false ) {
341
-    return wpinv_maybe_add_empty_option( apply_filters( 'wpinv_countries', wpinv_get_data( 'countries' ) ), $first_empty );
340
+function wpinv_get_country_list($first_empty = false) {
341
+    return wpinv_maybe_add_empty_option(apply_filters('wpinv_countries', wpinv_get_data('countries')), $first_empty);
342 342
 }
343 343
 
344 344
 /**
@@ -348,22 +348,22 @@  discard block
 block discarded – undo
348 348
  * @param bool $first_empty Whether or not the first item in the list should be empty
349 349
  * @return array
350 350
  */
351
-function wpinv_get_country_states( $country = null, $first_empty = false ) {
351
+function wpinv_get_country_states($country = null, $first_empty = false) {
352 352
     
353 353
     // Prepare the country.
354
-    $country = wpinv_sanitize_country( $country );
354
+    $country = wpinv_sanitize_country($country);
355 355
 
356 356
     // Fetch all states.
357
-    $all_states = wpinv_get_data( 'states' );
357
+    $all_states = wpinv_get_data('states');
358 358
 
359 359
     // Fetch the specified country's states.
360
-    $states     = isset( $all_states[ $country ] ) ? $all_states[ $country ] : array() ;
361
-    $states     = apply_filters( "wpinv_{$country}_states", $states );
362
-    $states     = apply_filters( 'wpinv_country_states', $states, $country );
360
+    $states     = isset($all_states[$country]) ? $all_states[$country] : array();
361
+    $states     = apply_filters("wpinv_{$country}_states", $states);
362
+    $states     = apply_filters('wpinv_country_states', $states, $country);
363 363
 
364
-    asort( $states );
364
+    asort($states);
365 365
      
366
-    return wpinv_maybe_add_empty_option( $states, $first_empty );
366
+    return wpinv_maybe_add_empty_option($states, $first_empty);
367 367
 }
368 368
 
369 369
 /**
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
  * @return array
374 374
  */
375 375
 function wpinv_get_us_states_list() {
376
-    return apply_filters( 'wpinv_usa_states', wpinv_get_country_states( 'US' ) );
376
+    return apply_filters('wpinv_usa_states', wpinv_get_country_states('US'));
377 377
 }
378 378
 
379 379
 /**
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
  * @return array
384 384
  */
385 385
 function wpinv_get_canada_states_list() {
386
-    return apply_filters( 'wpinv_canada_provinces', wpinv_get_country_states( 'CA' ) );
386
+    return apply_filters('wpinv_canada_provinces', wpinv_get_country_states('CA'));
387 387
 }
388 388
 
389 389
 /**
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
  * @return array
394 394
  */
395 395
 function wpinv_get_australia_states_list() {
396
-    return apply_filters( 'wpinv_australia_states', wpinv_get_country_states( 'AU' ) );
396
+    return apply_filters('wpinv_australia_states', wpinv_get_country_states('AU'));
397 397
 }
398 398
 
399 399
 /**
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
  * @return array
404 404
  */
405 405
 function wpinv_get_bangladesh_states_list() {
406
-    return apply_filters( 'wpinv_bangladesh_states', wpinv_get_country_states( 'BD' ) );
406
+    return apply_filters('wpinv_bangladesh_states', wpinv_get_country_states('BD'));
407 407
 }
408 408
 
409 409
 /**
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
  * @return array
414 414
  */
415 415
 function wpinv_get_brazil_states_list() {
416
-    return apply_filters( 'wpinv_brazil_states', wpinv_get_country_states( 'BR' ) );
416
+    return apply_filters('wpinv_brazil_states', wpinv_get_country_states('BR'));
417 417
 }
418 418
 
419 419
 /**
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
  * @return array
424 424
  */
425 425
 function wpinv_get_bulgaria_states_list() {
426
-    return apply_filters( 'wpinv_bulgaria_states', wpinv_get_country_states( 'BG' ) );
426
+    return apply_filters('wpinv_bulgaria_states', wpinv_get_country_states('BG'));
427 427
 }
428 428
 
429 429
 /**
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
  * @return array
434 434
  */
435 435
 function wpinv_get_hong_kong_states_list() {
436
-    return apply_filters( 'wpinv_hong_kong_states', wpinv_get_country_states( 'HK' ) );
436
+    return apply_filters('wpinv_hong_kong_states', wpinv_get_country_states('HK'));
437 437
 }
438 438
 
439 439
 /**
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
  * @return array
444 444
  */
445 445
 function wpinv_get_hungary_states_list() {
446
-    return apply_filters( 'wpinv_hungary_states', wpinv_get_country_states( 'HU' ) );
446
+    return apply_filters('wpinv_hungary_states', wpinv_get_country_states('HU'));
447 447
 }
448 448
 
449 449
 /**
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
  * @return array
454 454
  */
455 455
 function wpinv_get_japan_states_list() {
456
-    return apply_filters( 'wpinv_japan_states', wpinv_get_country_states( 'JP' ) );
456
+    return apply_filters('wpinv_japan_states', wpinv_get_country_states('JP'));
457 457
 }
458 458
 
459 459
 /**
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
  * @return array
464 464
  */
465 465
 function wpinv_get_china_states_list() {
466
-    return apply_filters( 'wpinv_china_states', wpinv_get_country_states( 'CN' ) );
466
+    return apply_filters('wpinv_china_states', wpinv_get_country_states('CN'));
467 467
 }
468 468
 
469 469
 /**
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
  * @return array
474 474
  */
475 475
 function wpinv_get_new_zealand_states_list() {
476
-    return apply_filters( 'wpinv_new_zealand_states', wpinv_get_country_states( 'NZ' ) );
476
+    return apply_filters('wpinv_new_zealand_states', wpinv_get_country_states('NZ'));
477 477
 }
478 478
 
479 479
 /**
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
  * @return array
484 484
  */
485 485
 function wpinv_get_peru_states_list() {
486
-    return apply_filters( 'wpinv_peru_states', wpinv_get_country_states( 'PE' ) );
486
+    return apply_filters('wpinv_peru_states', wpinv_get_country_states('PE'));
487 487
 }
488 488
 
489 489
 /**
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
  * @return array
494 494
  */
495 495
 function wpinv_get_indonesia_states_list() {
496
-    return apply_filters( 'wpinv_indonesia_states', wpinv_get_country_states( 'ID' ) );
496
+    return apply_filters('wpinv_indonesia_states', wpinv_get_country_states('ID'));
497 497
 }
498 498
 
499 499
 /**
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
  * @return array
504 504
  */
505 505
 function wpinv_get_india_states_list() {
506
-    return apply_filters( 'wpinv_india_states', wpinv_get_country_states( 'IN' ) );
506
+    return apply_filters('wpinv_india_states', wpinv_get_country_states('IN'));
507 507
 }
508 508
 
509 509
 /**
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
  * @return array
514 514
  */
515 515
 function wpinv_get_iran_states_list() {
516
-    return apply_filters( 'wpinv_iran_states', wpinv_get_country_states( 'IR' ) );
516
+    return apply_filters('wpinv_iran_states', wpinv_get_country_states('IR'));
517 517
 }
518 518
 
519 519
 /**
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
  * @return array
524 524
  */
525 525
 function wpinv_get_italy_states_list() {
526
-    return apply_filters( 'wpinv_italy_states', wpinv_get_country_states( 'IT' ) );
526
+    return apply_filters('wpinv_italy_states', wpinv_get_country_states('IT'));
527 527
 }
528 528
 
529 529
 /**
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
  * @return array
534 534
  */
535 535
 function wpinv_get_malaysia_states_list() {
536
-    return apply_filters( 'wpinv_malaysia_states', wpinv_get_country_states( 'MY' ) );
536
+    return apply_filters('wpinv_malaysia_states', wpinv_get_country_states('MY'));
537 537
 }
538 538
 
539 539
 /**
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
  * @return array
544 544
  */
545 545
 function wpinv_get_mexico_states_list() {
546
-    return apply_filters( 'wpinv_mexico_states', wpinv_get_country_states( 'MX' ) );
546
+    return apply_filters('wpinv_mexico_states', wpinv_get_country_states('MX'));
547 547
 }
548 548
 
549 549
 /**
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
  * @return array
554 554
  */
555 555
 function wpinv_get_nepal_states_list() {
556
-    return apply_filters( 'wpinv_nepal_states', wpinv_get_country_states( 'NP' ) );
556
+    return apply_filters('wpinv_nepal_states', wpinv_get_country_states('NP'));
557 557
 }
558 558
 
559 559
 /**
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
  * @return array
564 564
  */
565 565
 function wpinv_get_south_africa_states_list() {
566
-    return apply_filters( 'wpinv_south_africa_states', wpinv_get_country_states( 'ZA' ) );
566
+    return apply_filters('wpinv_south_africa_states', wpinv_get_country_states('ZA'));
567 567
 }
568 568
 
569 569
 /**
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
  * @return array
574 574
  */
575 575
 function wpinv_get_thailand_states_list() {
576
-    return apply_filters( 'wpinv_thailand_states', wpinv_get_country_states( 'TH' ) );
576
+    return apply_filters('wpinv_thailand_states', wpinv_get_country_states('TH'));
577 577
 }
578 578
 
579 579
 /**
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
  * @return array
584 584
  */
585 585
 function wpinv_get_turkey_states_list() {
586
-    return apply_filters( 'wpinv_turkey_states', wpinv_get_country_states( 'TR' ) );
586
+    return apply_filters('wpinv_turkey_states', wpinv_get_country_states('TR'));
587 587
 }
588 588
 
589 589
 /**
@@ -593,28 +593,28 @@  discard block
 block discarded – undo
593 593
  * @return array
594 594
  */
595 595
 function wpinv_get_spain_states_list() {
596
-    return apply_filters( 'wpinv_spain_states', wpinv_get_country_states( 'ES' ) );
596
+    return apply_filters('wpinv_spain_states', wpinv_get_country_states('ES'));
597 597
 }
598 598
 
599 599
 function wpinv_get_states_field() {
600
-	if( empty( $_POST['country'] ) ) {
600
+	if (empty($_POST['country'])) {
601 601
 		$_POST['country'] = wpinv_get_default_country();
602 602
 	}
603
-	$states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) );
603
+	$states = wpinv_get_country_states(sanitize_text_field($_POST['country']));
604 604
 
605
-	if( !empty( $states ) ) {
606
-		$sanitized_field_name = sanitize_text_field( $_POST['field_name'] );
605
+	if (!empty($states)) {
606
+		$sanitized_field_name = sanitize_text_field($_POST['field_name']);
607 607
         
608 608
         $args = array(
609 609
 			'name'    => $sanitized_field_name,
610 610
 			'id'      => $sanitized_field_name,
611 611
 			'class'   => $sanitized_field_name . 'custom-select wpinv-select wpi_select2',
612
-			'options' => array_merge( array( '' => '' ), $states ),
612
+			'options' => array_merge(array('' => ''), $states),
613 613
 			'show_option_all'  => false,
614 614
 			'show_option_none' => false
615 615
 		);
616 616
 
617
-		$response = wpinv_html_select( $args );
617
+		$response = wpinv_html_select($args);
618 618
 
619 619
 	} else {
620 620
 		$response = 'nostates';
@@ -623,10 +623,10 @@  discard block
 block discarded – undo
623 623
 	return $response;
624 624
 }
625 625
 
626
-function wpinv_default_billing_country( $country = '', $user_id = 0 ) {
627
-    $country = !empty( $country ) ? $country : wpinv_get_default_country();
626
+function wpinv_default_billing_country($country = '', $user_id = 0) {
627
+    $country = !empty($country) ? $country : wpinv_get_default_country();
628 628
     
629
-    return apply_filters( 'wpinv_default_billing_country', $country, $user_id );
629
+    return apply_filters('wpinv_default_billing_country', $country, $user_id);
630 630
 }
631 631
 
632 632
 /**
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
  */
639 639
 function wpinv_get_address_formats() {
640 640
 
641
-		return apply_filters( 'wpinv_localisation_address_formats',
641
+		return apply_filters('wpinv_localisation_address_formats',
642 642
 			array(
643 643
 				'default' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}\n{{zip}}\n{{country}}",
644 644
 				'AU'      => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}} {{zip}}\n{{country}}",
@@ -687,9 +687,9 @@  discard block
 block discarded – undo
687 687
  * @see `wpinv_get_invoice_address_replacements`
688 688
  * @return string
689 689
  */
690
-function wpinv_get_full_address_format( $country = false) {
690
+function wpinv_get_full_address_format($country = false) {
691 691
 
692
-    if( empty( $country ) ) {
692
+    if (empty($country)) {
693 693
         $country = wpinv_get_default_country();
694 694
     }
695 695
 
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 	$formats = wpinv_get_address_formats();
698 698
 
699 699
 	// Get format for the specified country.
700
-	$format = ( $country && isset( $formats[ $country ] ) ) ? $formats[ $country ] : $formats['default'];
700
+	$format = ($country && isset($formats[$country])) ? $formats[$country] : $formats['default'];
701 701
     
702 702
     /**
703 703
 	 * Filters the address format to use on Invoices.
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 * @param string $format  The address format to use.
710 710
      * @param string $country The country who's address format is being retrieved.
711 711
 	 */
712
-    return apply_filters( 'wpinv_get_full_address_format', $format, $country );
712
+    return apply_filters('wpinv_get_full_address_format', $format, $country);
713 713
 }
714 714
 
715 715
 /**
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
  * @param array $billing_details customer's billing details
721 721
  * @return array
722 722
  */
723
-function wpinv_get_invoice_address_replacements( $billing_details ) {
723
+function wpinv_get_invoice_address_replacements($billing_details) {
724 724
 
725 725
     $default_args = array(
726 726
         'address'           => '',
@@ -733,22 +733,22 @@  discard block
 block discarded – undo
733 733
 		'company'           => '',
734 734
     );
735 735
 
736
-    $args    = map_deep( wp_parse_args( $billing_details, $default_args ), 'trim' );
736
+    $args    = map_deep(wp_parse_args($billing_details, $default_args), 'trim');
737 737
     $state   = $args['state'];
738 738
     $country = $args['country'];
739 739
 
740 740
     // Handle full country name.
741
-    $full_country = empty( $country ) ? $country : wpinv_country_name( $country );
741
+    $full_country = empty($country) ? $country : wpinv_country_name($country);
742 742
 
743 743
     // Handle full state name.
744
-    $full_state   = ( $country && $state ) ?  wpinv_state_name( $state, $country ) : $state;
744
+    $full_state   = ($country && $state) ?  wpinv_state_name($state, $country) : $state;
745 745
 
746 746
     $args['postcode']    = $args['zip'];
747 747
     $args['name']        = $args['first_name'] . ' ' . $args['last_name'];
748 748
     $args['state']       = $full_state;
749 749
     $args['state_code']  = $state;
750 750
     $args['country']     = $full_country;
751
-    $args['country_code']= $country;
751
+    $args['country_code'] = $country;
752 752
 
753 753
     /**
754 754
 	 * Filters the address format replacements to use on Invoices.
@@ -759,14 +759,14 @@  discard block
 block discarded – undo
759 759
 	 * @param array $replacements  The address replacements to use.
760 760
      * @param array $billing_details  The billing details to use.
761 761
 	 */
762
-    $replacements = apply_filters( 'wpinv_get_invoice_address_replacements', $args, $billing_details );
762
+    $replacements = apply_filters('wpinv_get_invoice_address_replacements', $args, $billing_details);
763 763
 
764 764
     $return = array();
765 765
 
766
-    foreach( $replacements as $key => $value ) {
767
-        $value  = is_scalar( $value ) ? trim( sanitize_text_field( $value ) ) : '';
766
+    foreach ($replacements as $key => $value) {
767
+        $value = is_scalar($value) ? trim(sanitize_text_field($value)) : '';
768 768
         $return['{{' . $key . '}}'] = $value;
769
-        $return['{{' . $key . '_upper}}'] = wpinv_utf8_strtoupper( $value );
769
+        $return['{{' . $key . '_upper}}'] = wpinv_utf8_strtoupper($value);
770 770
     }
771 771
 
772 772
     return $return;
@@ -780,6 +780,6 @@  discard block
 block discarded – undo
780 780
  * @since 1.0.14
781 781
  * @return string
782 782
  */
783
-function wpinv_trim_formatted_address_line( $line ) {
784
-	return trim( $line, ', ' );
783
+function wpinv_trim_formatted_address_line($line) {
784
+	return trim($line, ', ');
785 785
 }
786 786
\ No newline at end of file
Please login to merge, or discard this patch.
admin/meta-boxes/class-getpaid-meta-box-invoice-shipping-address.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  *
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit; // Exit if accessed directly
11 11
 }
12 12
 
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @param WP_Post $post
22 22
 	 */
23
-	public static function output( $post ) {
23
+	public static function output($post) {
24 24
 
25 25
 		// Retrieve shipping address.
26
-		$shipping_address = get_post_meta( $post->ID, 'shipping_address', true );
26
+		$shipping_address = get_post_meta($post->ID, 'shipping_address', true);
27 27
 
28 28
 		// Abort if it is invalid.
29
-		if ( ! is_array( $shipping_address ) ) {
29
+		if (!is_array($shipping_address)) {
30 30
 			return;
31 31
 		}
32 32
 
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
 
35 35
 		<div class="bsui">
36 36
 
37
-			<?php foreach ( getpaid_user_address_fields() as $key => $label ) : ?>
37
+			<?php foreach (getpaid_user_address_fields() as $key => $label) : ?>
38 38
 
39
-					<?php if ( ! empty( $shipping_address[ $key ] ) ) : ?>
39
+					<?php if (!empty($shipping_address[$key])) : ?>
40 40
 
41 41
 						<div class="form-group form-row">
42 42
 							<div class="col">
43
-								<span style="font-weight: 600"><?php echo sanitize_text_field( $label ); ?>:</span>
43
+								<span style="font-weight: 600"><?php echo sanitize_text_field($label); ?>:</span>
44 44
 							</div>
45 45
 							<div class="col">
46
-								<?php echo self::prepare_for_display( $shipping_address, $key ); ?>
46
+								<?php echo self::prepare_for_display($shipping_address, $key); ?>
47 47
 							</div>
48 48
 						</div>
49 49
 
@@ -64,21 +64,21 @@  discard block
 block discarded – undo
64 64
 	 * @param string $key
65 65
 	 * @return string
66 66
 	 */
67
-	public static function prepare_for_display( $address, $key ) {
67
+	public static function prepare_for_display($address, $key) {
68 68
 
69 69
 		// Prepare the value.
70
-		$value = $address[ $key ];
70
+		$value = $address[$key];
71 71
 
72
-		if ( $key == 'country' ) {
73
-			$value = wpinv_country_name( $value );
72
+		if ($key == 'country') {
73
+			$value = wpinv_country_name($value);
74 74
 		}
75 75
 
76
-		if ( $key == 'state' ) {
77
-			$country = isset( $address[ 'country' ] ) ? $address[ 'country' ] : wpinv_get_default_country();
78
-			$value = wpinv_state_name( $value, $country );
76
+		if ($key == 'state') {
77
+			$country = isset($address['country']) ? $address['country'] : wpinv_get_default_country();
78
+			$value = wpinv_state_name($value, $country);
79 79
 		}
80 80
 
81
-		return sanitize_text_field( $value );
81
+		return sanitize_text_field($value);
82 82
 
83 83
 	}
84 84
 
Please login to merge, or discard this patch.
includes/data/payment-form-elements.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -9,41 +9,41 @@  discard block
 block discarded – undo
9 9
  * @version 1.0.19
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14 14
 return array(
15 15
 
16 16
     array(
17 17
         'type'     => 'heading',
18
-        'name'     => __( 'Heading', 'invoicing' ),
18
+        'name'     => __('Heading', 'invoicing'),
19 19
         'defaults' => array(
20 20
             'level' => 'h2',
21
-            'text'  => __( 'Heading', 'invoicing' ),
21
+            'text'  => __('Heading', 'invoicing'),
22 22
         )
23 23
     ),
24 24
 
25 25
     array(
26 26
         'type' => 'paragraph',
27
-        'name' => __( 'Paragraph', 'invoicing' ),
27
+        'name' => __('Paragraph', 'invoicing'),
28 28
         'defaults'  => array(
29
-            'text'  => __( 'Paragraph text', 'invoicing' ),
29
+            'text'  => __('Paragraph text', 'invoicing'),
30 30
         )
31 31
     ),
32 32
 
33 33
     array( 
34 34
         'type' => 'alert',
35
-        'name' => __( 'Alert', 'invoicing' ),
35
+        'name' => __('Alert', 'invoicing'),
36 36
         'defaults'  => array(
37 37
             'value'        => '',
38 38
             'class'        => 'alert-warning',
39
-            'text'         => __( 'Alert', 'invoicing' ),
39
+            'text'         => __('Alert', 'invoicing'),
40 40
             'dismissible'  => false,
41 41
         )
42 42
     ),
43 43
 
44 44
     array( 
45 45
         'type' => 'separator',
46
-        'name' => __( 'Separator', 'invoicing' ),
46
+        'name' => __('Separator', 'invoicing'),
47 47
         'defaults'  => array(
48 48
             'value'        => '',
49 49
         ),
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
 
52 52
     array(
53 53
         'type' => 'text',
54
-        'name' => __( 'Text Input', 'invoicing' ),
54
+        'name' => __('Text Input', 'invoicing'),
55 55
         'defaults'  => array(
56
-            'placeholder'  => __( 'Enter some text', 'invoicing' ),
56
+            'placeholder'  => __('Enter some text', 'invoicing'),
57 57
             'value'        => '',
58
-            'label'        => __( 'Field Label', 'invoicing' ),
58
+            'label'        => __('Field Label', 'invoicing'),
59 59
             'description'  => '',
60 60
             'required'     => false,
61 61
         )
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 
64 64
     array(
65 65
         'type' => 'textarea',
66
-        'name' => __( 'Textarea', 'invoicing' ),
66
+        'name' => __('Textarea', 'invoicing'),
67 67
         'defaults'         => array(
68
-            'placeholder'  => __( 'Enter your text hear', 'invoicing' ),
68
+            'placeholder'  => __('Enter your text hear', 'invoicing'),
69 69
             'value'        => '',
70
-            'label'        => __( 'Textarea Label', 'invoicing' ),
70
+            'label'        => __('Textarea Label', 'invoicing'),
71 71
             'description'  => '',
72 72
             'required'     => false,
73 73
         )
@@ -75,27 +75,27 @@  discard block
 block discarded – undo
75 75
 
76 76
     array(
77 77
         'type' => 'select',
78
-        'name' => __( 'Dropdown', 'invoicing' ),
78
+        'name' => __('Dropdown', 'invoicing'),
79 79
         'defaults'         => array(
80
-            'placeholder'  => __( 'Select a value', 'invoicing' ),
80
+            'placeholder'  => __('Select a value', 'invoicing'),
81 81
             'value'        => '',
82
-            'label'        => __( 'Dropdown Label', 'invoicing' ),
82
+            'label'        => __('Dropdown Label', 'invoicing'),
83 83
             'description'  => '',
84 84
             'required'     => false,
85 85
             'options'      => array(
86
-                esc_attr__( 'Option One', 'invoicing' ),
87
-                esc_attr__( 'Option Two', 'invoicing' ),
88
-                esc_attr__( 'Option Three', 'invoicing' )
86
+                esc_attr__('Option One', 'invoicing'),
87
+                esc_attr__('Option Two', 'invoicing'),
88
+                esc_attr__('Option Three', 'invoicing')
89 89
             ),
90 90
         )
91 91
     ),
92 92
 
93 93
     array(
94 94
         'type' => 'checkbox',
95
-        'name' => __( 'Checkbox', 'invoicing' ),
95
+        'name' => __('Checkbox', 'invoicing'),
96 96
         'defaults'         => array(
97 97
             'value'        => '',
98
-            'label'        => __( 'Checkbox Label', 'invoicing' ),
98
+            'label'        => __('Checkbox Label', 'invoicing'),
99 99
             'description'  => '',
100 100
             'required'     => false,
101 101
         )
@@ -103,23 +103,23 @@  discard block
 block discarded – undo
103 103
 
104 104
     array( 
105 105
         'type' => 'radio',
106
-        'name' => __( 'Radio', 'invoicing' ),
106
+        'name' => __('Radio', 'invoicing'),
107 107
         'defaults'     => array(
108
-            'label'    => __( 'Select one choice', 'invoicing' ),
108
+            'label'    => __('Select one choice', 'invoicing'),
109 109
             'options'  => array(
110
-                esc_attr__( 'Choice One', 'invoicing' ),
111
-                esc_attr__( 'Choice Two', 'invoicing' ),
112
-                esc_attr__( 'Choice Three', 'invoicing' )
110
+                esc_attr__('Choice One', 'invoicing'),
111
+                esc_attr__('Choice Two', 'invoicing'),
112
+                esc_attr__('Choice Three', 'invoicing')
113 113
             ),
114 114
         )
115 115
     ),
116 116
 
117 117
     array( 
118 118
         'type' => 'date',
119
-        'name' => __( 'Date', 'invoicing' ),
119
+        'name' => __('Date', 'invoicing'),
120 120
         'defaults' => array(
121 121
             'value'        => '',
122
-            'label'        => __( 'Date', 'invoicing' ),
122
+            'label'        => __('Date', 'invoicing'),
123 123
             'description'  => '',
124 124
             'required'     => false,
125 125
         )
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 
128 128
     array( 
129 129
         'type' => 'time',
130
-        'name' => __( 'Time', 'invoicing' ),
130
+        'name' => __('Time', 'invoicing'),
131 131
         'defaults' => array(
132 132
             'value'        => '',
133
-            'label'        => __( 'Time', 'invoicing' ),
133
+            'label'        => __('Time', 'invoicing'),
134 134
             'description'  => '',
135 135
             'required'     => false,
136 136
         )
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 
139 139
     array( 
140 140
         'type' => 'number',
141
-        'name' => __( 'Number', 'invoicing' ),
141
+        'name' => __('Number', 'invoicing'),
142 142
         'defaults' => array(
143 143
             'placeholder'  => '',
144 144
             'value'        => '',
145
-            'label'        => __( 'Number', 'invoicing' ),
145
+            'label'        => __('Number', 'invoicing'),
146 146
             'description'  => '',
147 147
             'required'     => false,
148 148
         )
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 
151 151
     array( 
152 152
         'type' => 'website',
153
-        'name' => __( 'Website', 'invoicing' ),
153
+        'name' => __('Website', 'invoicing'),
154 154
         'defaults' => array(
155 155
             'placeholder'  => 'http://example.com',
156 156
             'value'        => '',
157
-            'label'        => __( 'Website', 'invoicing' ),
157
+            'label'        => __('Website', 'invoicing'),
158 158
             'description'  => '',
159 159
             'required'     => false,
160 160
         )
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 
163 163
     array( 
164 164
         'type' => 'email',
165
-        'name' => __( 'Email', 'invoicing' ),
165
+        'name' => __('Email', 'invoicing'),
166 166
         'defaults'  => array(
167 167
             'placeholder'  => '[email protected]',
168 168
             'value'        => '',
169
-            'label'        => __( 'Email Address', 'invoicing' ),
169
+            'label'        => __('Email Address', 'invoicing'),
170 170
             'description'  => '',
171 171
             'required'     => false,
172 172
         )
@@ -174,18 +174,18 @@  discard block
 block discarded – undo
174 174
 
175 175
     array( 
176 176
         'type' => 'address',
177
-        'name' => __( 'Address', 'invoicing' ),
177
+        'name' => __('Address', 'invoicing'),
178 178
         'defaults'  => array(
179 179
 
180 180
             'address_type'            => 'billing',
181
-            'billing_address_title'   => __( 'Billing Address', 'invoicing' ),
182
-            'shipping_address_title'  => __( 'Shipping Address', 'invoicing' ),
183
-            'shipping_address_toggle' => __( 'Same billing & shipping address.', 'invoicing' ),
181
+            'billing_address_title'   => __('Billing Address', 'invoicing'),
182
+            'shipping_address_title'  => __('Shipping Address', 'invoicing'),
183
+            'shipping_address_toggle' => __('Same billing & shipping address.', 'invoicing'),
184 184
             'fields'                  => array(
185 185
                 array(
186 186
                     'placeholder'  => 'Jon',
187 187
                     'value'        => '',
188
-                    'label'        => __( 'First Name', 'invoicing' ),
188
+                    'label'        => __('First Name', 'invoicing'),
189 189
                     'description'  => '',
190 190
                     'required'     => false,
191 191
                     'visible'      => true,
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                 array(
197 197
                     'placeholder'  => 'Snow',
198 198
                     'value'        => '',
199
-                    'label'        => __( 'Last Name', 'invoicing' ),
199
+                    'label'        => __('Last Name', 'invoicing'),
200 200
                     'description'  => '',
201 201
                     'required'     => false,
202 202
                     'visible'      => true,
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                 array(
208 208
                     'placeholder'  => '',
209 209
                     'value'        => '',
210
-                    'label'        => __( 'Address', 'invoicing' ),
210
+                    'label'        => __('Address', 'invoicing'),
211 211
                     'description'  => '',
212 212
                     'required'     => false,
213 213
                     'visible'      => true,
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                 array(
219 219
                     'placeholder'  => '',
220 220
                     'value'        => '',
221
-                    'label'        => __( 'City', 'invoicing' ),
221
+                    'label'        => __('City', 'invoicing'),
222 222
                     'description'  => '',
223 223
                     'required'     => false,
224 224
                     'visible'      => true,
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
                 ),
228 228
 
229 229
                 array(
230
-                    'placeholder'  => __( 'Select your country' ),
230
+                    'placeholder'  => __('Select your country'),
231 231
                     'value'        => '',
232
-                    'label'        => __( 'Country', 'invoicing' ),
232
+                    'label'        => __('Country', 'invoicing'),
233 233
                     'description'  => '',
234 234
                     'required'     => false,
235 235
                     'visible'      => true,
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
                 ),
239 239
 
240 240
                 array(
241
-                    'placeholder'  => __( 'Choose a state', 'invoicing' ),
241
+                    'placeholder'  => __('Choose a state', 'invoicing'),
242 242
                     'value'        => '',
243
-                    'label'        => __( 'State / Province', 'invoicing' ),
243
+                    'label'        => __('State / Province', 'invoicing'),
244 244
                     'description'  => '',
245 245
                     'required'     => false,
246 246
                     'visible'      => true,
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                 array(
252 252
                     'placeholder'  => '',
253 253
                     'value'        => '',
254
-                    'label'        => __( 'ZIP / Postcode', 'invoicing' ),
254
+                    'label'        => __('ZIP / Postcode', 'invoicing'),
255 255
                     'description'  => '',
256 256
                     'required'     => false,
257 257
                     'visible'      => true,
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 array(
263 263
                     'placeholder'  => '',
264 264
                     'value'        => '',
265
-                    'label'        => __( 'Phone', 'invoicing' ),
265
+                    'label'        => __('Phone', 'invoicing'),
266 266
                     'description'  => '',
267 267
                     'required'     => false,
268 268
                     'visible'      => true,
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                 array(
274 274
                     'placeholder'  => '',
275 275
                     'value'        => '',
276
-                    'label'        => __( 'Company', 'invoicing' ),
276
+                    'label'        => __('Company', 'invoicing'),
277 277
                     'description'  => '',
278 278
                     'required'     => false,
279 279
                     'visible'      => false,
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                 array(
285 285
                     'placeholder'  => '',
286 286
                     'value'        => '',
287
-                    'label'        => __( 'VAT Number', 'invoicing' ),
287
+                    'label'        => __('VAT Number', 'invoicing'),
288 288
                     'description'  => '',
289 289
                     'required'     => false,
290 290
                     'visible'      => false,
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 
298 298
     array( 
299 299
         'type' => 'billing_email',
300
-        'name' => __( 'Billing Email', 'invoicing' ),
300
+        'name' => __('Billing Email', 'invoicing'),
301 301
         'defaults'  => array(
302 302
             'placeholder'  => '[email protected]',
303 303
             'value'        => '',
304
-            'label'        => __( 'Billing Email', 'invoicing' ),
304
+            'label'        => __('Billing Email', 'invoicing'),
305 305
             'description'  => '',
306 306
             'premade'      => true,
307 307
         )
@@ -309,18 +309,18 @@  discard block
 block discarded – undo
309 309
 
310 310
     array( 
311 311
         'type' => 'discount',
312
-        'name' => __( 'Discount Input', 'invoicing' ),
312
+        'name' => __('Discount Input', 'invoicing'),
313 313
         'defaults'  => array(
314 314
             'value'        => '',
315
-            'input_label'  => __( 'Coupon Code', 'invoicing' ),
316
-            'button_label' => __( 'Apply Coupon', 'invoicing' ),
317
-            'description'  => __( 'Have a discount code? Enter it above.', 'invoicing' ),
315
+            'input_label'  => __('Coupon Code', 'invoicing'),
316
+            'button_label' => __('Apply Coupon', 'invoicing'),
317
+            'description'  => __('Have a discount code? Enter it above.', 'invoicing'),
318 318
         )
319 319
     ),
320 320
 
321 321
     array( 
322 322
         'type' => 'items',
323
-        'name' => __( 'Items', 'invoicing' ),
323
+        'name' => __('Items', 'invoicing'),
324 324
         'defaults'  => array(
325 325
             'value'        => '',
326 326
             'items_type'   => 'total',
@@ -332,22 +332,22 @@  discard block
 block discarded – undo
332 332
 
333 333
     array( 
334 334
         'type' => 'price_input',
335
-        'name' => __( 'Price Input', 'invoicing' ),
335
+        'name' => __('Price Input', 'invoicing'),
336 336
         'defaults'  => array(
337 337
             'placeholder'  => wpinv_format_amount(0),
338 338
             'value'        => wpinv_format_amount(0),
339 339
             'minimum'      => wpinv_format_amount(0),
340
-            'label'        => __( 'Enter Amount', 'invoicing' ),
340
+            'label'        => __('Enter Amount', 'invoicing'),
341 341
             'description'  => '',
342 342
         )
343 343
     ),
344 344
 
345 345
     array( 
346 346
         'type' => 'price_select',
347
-        'name' => __( 'Price Select', 'invoicing' ),
347
+        'name' => __('Price Select', 'invoicing'),
348 348
         'defaults'  => array(
349 349
             'description'  => '',
350
-            'label'        => __( 'Select Amount', 'invoicing' ),
350
+            'label'        => __('Select Amount', 'invoicing'),
351 351
             'options'      => 'Option 1|10, Option 2|20',
352 352
             'placeholder'  => '',
353 353
             'select_type'  => 'select',
@@ -356,39 +356,39 @@  discard block
 block discarded – undo
356 356
 
357 357
     array( 
358 358
         'type'       => 'pay_button',
359
-        'name'       => __( 'Payment Button', 'invoicing' ),
359
+        'name'       => __('Payment Button', 'invoicing'),
360 360
         'defaults'   => array(
361 361
             'value'          => '',
362 362
             'class'          => 'btn-primary',
363
-            'label'          => __( 'Pay %price% »', 'invoicing' ),
364
-            'free'           => __( 'Continue »', 'invoicing' ),
365
-            'description'    => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
363
+            'label'          => __('Pay %price% »', 'invoicing'),
364
+            'free'           => __('Continue »', 'invoicing'),
365
+            'description'    => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
366 366
             'premade'        => true,
367 367
         )
368 368
     ),
369 369
 
370 370
     array(
371 371
         'type'       => 'gateway_select',
372
-        'name'       => __( 'Gateway Select', 'invoicing' ),
372
+        'name'       => __('Gateway Select', 'invoicing'),
373 373
         'defaults'   => array(
374
-            'text'    => __( 'Select Payment Method', 'invoicing' ),
374
+            'text'    => __('Select Payment Method', 'invoicing'),
375 375
             'premade' => true,
376 376
         )
377 377
     ),
378 378
 
379 379
     array( 
380 380
         'type'       => 'total_payable',
381
-        'name'       => __( 'Total Payable', 'invoicing' ),
381
+        'name'       => __('Total Payable', 'invoicing'),
382 382
         'defaults'   => array(
383
-            'text' => __( 'Total to pay:', 'invoicing' ),
383
+            'text' => __('Total to pay:', 'invoicing'),
384 384
         )
385 385
     ),
386 386
 
387 387
     array( 
388 388
         'type'       => 'ip_address',
389
-        'name'       => __( 'IP Address', 'invoicing' ),
389
+        'name'       => __('IP Address', 'invoicing'),
390 390
         'defaults'   => array(
391
-            'text' => __( 'Your IP address is:', 'invoicing' ),
391
+            'text' => __('Your IP address is:', 'invoicing'),
392 392
         )
393 393
     )
394 394
 );
Please login to merge, or discard this patch.