Completed
Push — master ( 9b8253...a465f2 )
by Brian
29s queued 14s
created
includes/admin/wpinv-admin-functions.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -56,69 +56,69 @@
 block discarded – undo
56 56
 }
57 57
 
58 58
 function wpinv_admin_messages() {
59
-	global $wpinv_options, $pagenow, $post;
59
+    global $wpinv_options, $pagenow, $post;
60 60
 
61
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
62
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
63
-	}
61
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
62
+            add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
63
+    }
64 64
 
65
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
66
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
67
-	}
65
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
66
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
67
+    }
68 68
 
69
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
70
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
71
-	}
69
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
70
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
71
+    }
72 72
 
73
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
74
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
75
-	}
73
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
74
+            add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
75
+    }
76 76
 
77
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
78
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
79
-	}
77
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
78
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
79
+    }
80 80
 
81
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
82
-		add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
83
-	}
81
+    if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
82
+        add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
83
+    }
84 84
 
85
-	if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
86
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' );
87
-	}
85
+    if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
86
+        add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' );
87
+    }
88 88
 
89
-	if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
90
-		add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
89
+    if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
90
+        add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
91 91
     }
92 92
     
93 93
     if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
94
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
94
+        add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
95 95
     }
96 96
 
97 97
     if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
98 98
         add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' );
99 99
     }
100 100
 
101
-	if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
102
-		add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
103
-	}
101
+    if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
102
+        add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
103
+    }
104 104
 
105
-	if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
106
-		add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
107
-	}
105
+    if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
106
+        add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
107
+    }
108 108
 
109
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
110
-		add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
111
-	}
109
+    if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
110
+        add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
111
+    }
112 112
     
113
-	if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
114
-		$message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
113
+    if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
114
+        $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
115 115
 
116
-		if ( !empty( $message ) ) {
117
-			add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
118
-		}
119
-	}
116
+        if ( !empty( $message ) ) {
117
+            add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
118
+        }
119
+    }
120 120
 
121
-	settings_errors( 'wpinv-notices' );
121
+    settings_errors( 'wpinv-notices' );
122 122
 }
123 123
 add_action( 'admin_notices', 'wpinv_admin_messages' );
124 124
 
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -7,127 +7,127 @@  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
-function wpinv_bulk_actions( $actions ) {
15
-    if ( isset( $actions['edit'] ) ) {
16
-        unset( $actions['edit'] );
14
+function wpinv_bulk_actions($actions) {
15
+    if (isset($actions['edit'])) {
16
+        unset($actions['edit']);
17 17
     }
18 18
 
19 19
     return $actions;
20 20
 }
21
-add_filter( 'bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions' );
22
-add_filter( 'bulk_actions-edit-wpi_item', 'wpinv_bulk_actions' );
21
+add_filter('bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions');
22
+add_filter('bulk_actions-edit-wpi_item', 'wpinv_bulk_actions');
23 23
 
24
-function wpinv_admin_post_id( $id = 0 ) {
24
+function wpinv_admin_post_id($id = 0) {
25 25
     global $post;
26 26
 
27
-    if ( isset( $id ) && ! empty( $id ) ) {
28
-        return (int)$id;
29
-    } else if ( get_the_ID() ) {
27
+    if (isset($id) && !empty($id)) {
28
+        return (int) $id;
29
+    } else if (get_the_ID()) {
30 30
         return (int) get_the_ID();
31
-    } else if ( isset( $post->ID ) && !empty( $post->ID ) ) {
31
+    } else if (isset($post->ID) && !empty($post->ID)) {
32 32
         return (int) $post->ID;
33
-    } else if ( isset( $_GET['post'] ) && !empty( $_GET['post'] ) ) {
33
+    } else if (isset($_GET['post']) && !empty($_GET['post'])) {
34 34
         return (int) $_GET['post'];
35
-    } else if ( isset( $_GET['id'] ) && !empty( $_GET['id'] ) ) {
35
+    } else if (isset($_GET['id']) && !empty($_GET['id'])) {
36 36
         return (int) $_GET['id'];
37
-    } else if ( isset( $_POST['id'] ) && !empty( $_POST['id'] ) ) {
37
+    } else if (isset($_POST['id']) && !empty($_POST['id'])) {
38 38
         return (int) $_POST['id'];
39 39
     } 
40 40
 
41 41
     return null;
42 42
 }
43 43
     
44
-function wpinv_admin_post_type( $id = 0 ) {
45
-    if ( !$id ) {
44
+function wpinv_admin_post_type($id = 0) {
45
+    if (!$id) {
46 46
         $id = wpinv_admin_post_id();
47 47
     }
48 48
     
49
-    $type = get_post_type( $id );
49
+    $type = get_post_type($id);
50 50
     
51
-    if ( !$type ) {
52
-        $type = isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) ? $_GET['post_type'] : null;
51
+    if (!$type) {
52
+        $type = isset($_GET['post_type']) && !empty($_GET['post_type']) ? $_GET['post_type'] : null;
53 53
     }
54 54
     
55
-    return apply_filters( 'wpinv_admin_post_type', $type, $id );
55
+    return apply_filters('wpinv_admin_post_type', $type, $id);
56 56
 }
57 57
 
58 58
 function wpinv_admin_messages() {
59 59
 	global $wpinv_options, $pagenow, $post;
60 60
 
61
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
62
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
61
+	if (isset($_GET['wpinv-message']) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
62
+		 add_settings_error('wpinv-notices', 'wpinv-discount-added', __('Discount code added.', 'invoicing'), 'updated');
63 63
 	}
64 64
 
65
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
66
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
65
+	if (isset($_GET['wpinv-message']) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
66
+		add_settings_error('wpinv-notices', 'wpinv-discount-add-fail', __('There was a problem adding your discount code, please try again.', 'invoicing'), 'error');
67 67
 	}
68 68
 
69
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
70
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
69
+	if (isset($_GET['wpinv-message']) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
70
+		add_settings_error('wpinv-notices', 'wpinv-discount-exists', __('A discount with that code already exists, please use a different code.', 'invoicing'), 'error');
71 71
 	}
72 72
 
73
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
74
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
73
+	if (isset($_GET['wpinv-message']) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
74
+		 add_settings_error('wpinv-notices', 'wpinv-discount-updated', __('Discount code updated.', 'invoicing'), 'updated');
75 75
 	}
76 76
 
77
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
78
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
77
+	if (isset($_GET['wpinv-message']) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
78
+		add_settings_error('wpinv-notices', 'wpinv-discount-updated-fail', __('There was a problem updating your discount code, please try again.', 'invoicing'), 'error');
79 79
 	}
80 80
 
81
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
82
-		add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
81
+	if (isset($_GET['wpinv-message']) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
82
+		add_settings_error('wpinv-notices', 'wpinv-deleted', __('The invoice has been deleted.', 'invoicing'), 'updated');
83 83
 	}
84 84
 
85
-	if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
86
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' );
85
+	if (isset($_GET['wpinv-message']) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
86
+		add_settings_error('wpinv-notices', 'wpinv-sent-fail', __('Email notification is disabled. Please check settings.', 'invoicing'), 'error');
87 87
 	}
88 88
 
89
-	if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
90
-		add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
89
+	if (isset($_GET['wpinv-message']) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
90
+		add_settings_error('wpinv-notices', 'wpinv-sent', __('The email has been sent to customer.', 'invoicing'), 'updated');
91 91
     }
92 92
     
93
-    if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
94
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
93
+    if (isset($_GET['wpinv-message']) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
94
+		add_settings_error('wpinv-notices', 'wpinv-sent-fail', __('Fail to send email to the customer.', 'invoicing'), 'error');
95 95
     }
96 96
 
97
-    if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
98
-        add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' );
97
+    if (isset($_GET['wpinv-message']) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
98
+        add_settings_error('wpinv-notices', 'wpinv-note-deleted', __('The invoice note has been deleted.', 'invoicing'), 'updated');
99 99
     }
100 100
 
101
-	if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
102
-		add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
101
+	if (isset($_GET['wpinv-message']) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
102
+		add_settings_error('wpinv-notices', 'wpinv-settings-imported', __('The settings have been imported.', 'invoicing'), 'updated');
103 103
 	}
104 104
 
105
-	if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
106
-		add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
105
+	if (isset($_GET['wpinv-message']) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
106
+		add_settings_error('wpinv-notices', 'wpinv-note-added', __('The invoice note has been added successfully.', 'invoicing'), 'updated');
107 107
 	}
108 108
 
109
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
110
-		add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
109
+	if (isset($_GET['wpinv-message']) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
110
+		add_settings_error('wpinv-notices', 'wpinv-updated', __('The invoice has been successfully updated.', 'invoicing'), 'updated');
111 111
 	}
112 112
     
113
-	if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
114
-		$message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
113
+	if ($pagenow == 'post.php' && !empty($post->post_type) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable($post)) {
114
+		$message = apply_filters('wpinv_item_non_editable_message', __('This item in not editable.', 'invoicing'), $post->ID);
115 115
 
116
-		if ( !empty( $message ) ) {
117
-			add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
116
+		if (!empty($message)) {
117
+			add_settings_error('wpinv-notices', 'wpinv-edit-n', $message, 'updated');
118 118
 		}
119 119
 	}
120 120
 
121
-	settings_errors( 'wpinv-notices' );
121
+	settings_errors('wpinv-notices');
122 122
 }
123
-add_action( 'admin_notices', 'wpinv_admin_messages' );
123
+add_action('admin_notices', 'wpinv_admin_messages');
124 124
 
125
-add_action( 'admin_init', 'wpinv_show_test_payment_gateway_notice' );
126
-function wpinv_show_test_payment_gateway_notice(){
127
-    add_action( 'admin_notices', 'wpinv_test_payment_gateway_messages' );
125
+add_action('admin_init', 'wpinv_show_test_payment_gateway_notice');
126
+function wpinv_show_test_payment_gateway_notice() {
127
+    add_action('admin_notices', 'wpinv_test_payment_gateway_messages');
128 128
 }
129 129
 
130
-function wpinv_test_payment_gateway_messages(){
130
+function wpinv_test_payment_gateway_messages() {
131 131
     $gateways = wpinv_get_enabled_payment_gateways();
132 132
     $name = array(); $test_gateways = '';
133 133
     if ($gateways) {
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
         }
139 139
         $test_gateways = implode(', ', $name);
140 140
     }
141
-    if(isset($test_gateways) && !empty($test_gateways)){
141
+    if (isset($test_gateways) && !empty($test_gateways)) {
142 142
         $link = admin_url('admin.php?page=wpinv-settings&tab=gateways');
143
-        $notice = wp_sprintf( __('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link );
143
+        $notice = wp_sprintf(__('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link);
144 144
         ?>
145 145
         <div class="notice notice-warning is-dismissible">
146 146
             <p><?php echo $notice; ?></p>
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
     }
150 150
 }
151 151
 
152
-function wpinv_send_invoice_after_save( $invoice ) {
153
-    if ( empty( $_POST['wpi_save_send'] ) ) {
152
+function wpinv_send_invoice_after_save($invoice) {
153
+    if (empty($_POST['wpi_save_send'])) {
154 154
         return;
155 155
     }
156 156
     
157
-    if ( !empty( $invoice->ID ) && !empty( $invoice->post_type ) && 'wpi_invoice' == $invoice->post_type ) {
158
-        wpinv_user_invoice_notification( $invoice->ID );
157
+    if (!empty($invoice->ID) && !empty($invoice->post_type) && 'wpi_invoice' == $invoice->post_type) {
158
+        wpinv_user_invoice_notification($invoice->ID);
159 159
     }
160 160
 }
161
-add_action( 'wpinv_invoice_metabox_saved', 'wpinv_send_invoice_after_save', 100, 1 );
161
+add_action('wpinv_invoice_metabox_saved', 'wpinv_send_invoice_after_save', 100, 1);
162 162
 
163 163
 
164 164
 add_action('admin_init', 'admin_init_example_type');
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 function admin_init_example_type() {
170 170
     global $typenow;
171 171
 
172
-    if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote' ) {
172
+    if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote') {
173 173
         add_filter('posts_search', 'posts_search_example_type', 10, 2);
174 174
     }
175 175
 }
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
     global $wpdb;
185 185
 
186 186
     if ($query->is_main_query() && !empty($query->query['s'])) {
187
-        $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql( $query->query['s'] ) . "%' )";
188
-        if ( ! empty( $search ) ) {
189
-            $search = preg_replace( '/^ AND /', '', $search );
187
+        $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql($query->query['s']) . "%' )";
188
+        if (!empty($search)) {
189
+            $search = preg_replace('/^ AND /', '', $search);
190 190
             $search = " AND ( {$search} OR ( {$conditions_str} ) )";
191 191
         } else {
192 192
             $search = " AND ( {$conditions_str} )";
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
     return $search;
197 197
 }
198 198
 
199
-add_action( 'admin_init', 'wpinv_reset_invoice_count' );
200
-function wpinv_reset_invoice_count(){
201
-    if(isset($_GET['reset_invoice_count']) && 1 == $_GET['reset_invoice_count'] && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) {
199
+add_action('admin_init', 'wpinv_reset_invoice_count');
200
+function wpinv_reset_invoice_count() {
201
+    if (isset($_GET['reset_invoice_count']) && 1 == $_GET['reset_invoice_count'] && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) {
202 202
         wpinv_update_option('invoice_sequence_start', 1);
203 203
         delete_option('wpinv_last_invoice_number');
204 204
         $url = add_query_arg(array('reset_invoice_done' => 1));
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 }
210 210
 
211 211
 add_action('admin_notices', 'wpinv_invoice_count_reset_message');
212
-function wpinv_invoice_count_reset_message(){
213
-    if(isset($_GET['reset_invoice_done']) && 1 == $_GET['reset_invoice_done']) {
212
+function wpinv_invoice_count_reset_message() {
213
+    if (isset($_GET['reset_invoice_done']) && 1 == $_GET['reset_invoice_done']) {
214 214
         $notice = __('Invoice number sequence reset successfully.', 'invoicing');
215 215
         ?>
216 216
         <div class="notice notice-success is-dismissible">
Please login to merge, or discard this patch.
templates/invoice/footer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14 14
     <div class="border-top pt-4 bg-white">
15 15
         <div class="container pr-0 pl-0">
16 16
 
17
-            <?php if ( $term_text = wpinv_get_terms_text() ) : ?>
17
+            <?php if ($term_text = wpinv_get_terms_text()) : ?>
18 18
                 <div class="terms-text">
19
-                    <?php echo wpautop( $term_text ); ?>
19
+                    <?php echo wpautop($term_text); ?>
20 20
                 </div>
21 21
             <?php endif; ?>
22 22
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             </div>
26 26
 
27 27
             <div class="print-only">
28
-                <?php _e( 'Page ', 'invoicing' ) ?> {PAGENO}/{nbpg}
28
+                <?php _e('Page ', 'invoicing') ?> {PAGENO}/{nbpg}
29 29
             </div>
30 30
 
31 31
         </div>
Please login to merge, or discard this patch.
templates/invoice/billing-address.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$invoice     = new WPInv_Invoice( $invoice );
13
-$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() );
12
+$invoice     = new WPInv_Invoice($invoice);
13
+$address_row = wpinv_get_invoice_address_markup($invoice->get_user_info());
14 14
 $phone       = $invoice->get_phone();
15 15
 $email       = $invoice->get_email();
16 16
 
@@ -21,36 +21,36 @@  discard block
 block discarded – undo
21 21
 
22 22
 
23 23
             <div class="invoice-billing-address-label col-2">
24
-                <strong><?php _e( 'To:', 'invoicing' ) ?></strong>
24
+                <strong><?php _e('To:', 'invoicing') ?></strong>
25 25
             </div>
26 26
 
27 27
 
28 28
             <div class="invoice-billing-address-value col-10">
29 29
 
30
-                <?php do_action( 'getpaid_billing_address_top' ); ?>
30
+                <?php do_action('getpaid_billing_address_top'); ?>
31 31
 
32
-                <?php if ( ! empty( $address_row ) ) : ?>
32
+                <?php if (!empty($address_row)) : ?>
33 33
                     <div class="billing-address">
34 34
                         <?php echo $address_row; ?>
35 35
                     </div>
36 36
                 <?php endif; ?>
37 37
 
38 38
 
39
-                <?php if ( ! empty( $phone ) ) : ?>
39
+                <?php if (!empty($phone)) : ?>
40 40
                     <div class="billing-phone">
41
-                        <?php echo wp_sprintf( __( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?>
41
+                        <?php echo wp_sprintf(__('Phone: %s', 'invoicing'), esc_html($phone)); ?>
42 42
                     </div>
43 43
                 <?php endif; ?>
44 44
 
45 45
 
46
-                <?php if ( ! empty( $email ) ) : ?>
46
+                <?php if (!empty($email)) : ?>
47 47
                     <div class="billing-email">
48
-                        <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), sanitize_email( $email ) ); ?>
48
+                        <?php echo wp_sprintf(__('Email: %s', 'invoicing'), sanitize_email($email)); ?>
49 49
                     </div>
50 50
                 <?php endif; ?>
51 51
 
52 52
 
53
-                <?php do_action( 'getpaid_billing_address_bottom' ); ?>
53
+                <?php do_action('getpaid_billing_address_bottom'); ?>
54 54
 
55 55
             </div>
56 56
 
Please login to merge, or discard this patch.
templates/invoice/header.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
             <div class="row">
17 17
 
18 18
                 <div class="col-12 col-sm-6 text-left pl-0">
19
-                    <?php do_action( 'getpaid_invoice_header_left', $invoice );?>
19
+                    <?php do_action('getpaid_invoice_header_left', $invoice); ?>
20 20
                 </div>
21 21
 
22 22
                 <div class="col-12 col-sm-6 text-right pr-0">
23
-                    <?php do_action( 'getpaid_invoice_header_right', $invoice );?>
23
+                    <?php do_action('getpaid_invoice_header_right', $invoice); ?>
24 24
                 </div>
25 25
 
26 26
             </div>
Please login to merge, or discard this patch.
templates/invoice/details.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@
 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
-        <?php do_action( 'getpaid_before_invoice_details_main', $invoice ); ?>
14
+        <?php do_action('getpaid_before_invoice_details_main', $invoice); ?>
15 15
 
16 16
         <div class="getpaid-invoice-details mt-3 mb-3">
17 17
             <div class="row">
18 18
 
19 19
                 <div class="col-12 col-sm-6">
20
-                    <?php do_action( 'getpaid_invoice_details_left', $invoice ); ?>
20
+                    <?php do_action('getpaid_invoice_details_left', $invoice); ?>
21 21
                 </div>
22 22
 
23 23
                 <div class="col-12 col-sm-6">
24
-                    <?php do_action( 'getpaid_invoice_details_right', $invoice ); ?>
24
+                    <?php do_action('getpaid_invoice_details_right', $invoice); ?>
25 25
                 </div>
26 26
 
27 27
             </div>
28 28
         </div>
29 29
 
30
-        <?php do_action( 'getpaid_after_invoice_details_main', $invoice ); ?>
30
+        <?php do_action('getpaid_after_invoice_details_main', $invoice); ?>
31 31
 
32 32
 <?php
Please login to merge, or discard this patch.
templates/wpinv-invoice-print.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Fetch the invoice.
13
-$invoice = new WPInv_Invoice( $GLOBALS['post'] );
13
+$invoice = new WPInv_Invoice($GLOBALS['post']);
14 14
 
15 15
 // Abort if it does not exist.
16
-if ( $invoice->get_id() == 0 ) {
16
+if ($invoice->get_id() == 0) {
17 17
     exit;
18 18
 }
19 19
 
20 20
 // Fires before printing an invoice.
21
-do_action( 'wpinv_invoice_print_before_display', $invoice );
21
+do_action('wpinv_invoice_print_before_display', $invoice);
22 22
 
23 23
 ?><!DOCTYPE html>
24 24
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     <head>
29 29
 
30
-		<meta charset="<?php bloginfo( 'charset' ); ?>">
30
+		<meta charset="<?php bloginfo('charset'); ?>">
31 31
         <meta name="viewport" content="width=device-width, initial-scale=1.0" >
32 32
 
33 33
         <meta name="robots" content="noindex,nofollow">
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 
37 37
         <title><?php wp_title() ?></title>
38 38
 
39
-        <?php do_action( 'wpinv_invoice_print_head', $invoice ); ?>
39
+        <?php do_action('wpinv_invoice_print_head', $invoice); ?>
40 40
 
41 41
     </head>
42 42
     
43 43
 
44 44
     <body class="body wpinv wpinv-print">
45 45
 
46
-        <?php do_action( 'getpaid_invoice', $invoice ); ?>
47
-        <?php do_action( 'wpinv_invoice_print_body_end', $invoice ); ?>
46
+        <?php do_action('getpaid_invoice', $invoice); ?>
47
+        <?php do_action('wpinv_invoice_print_body_end', $invoice); ?>
48 48
 
49 49
     </body>
50 50
 
Please login to merge, or discard this patch.
templates/payment-forms/elements/total_payable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 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 = __( 'Total to pay:', 'invoicing' );
12
+if (empty($text)) {
13
+    $text = __('Total to pay:', 'invoicing');
14 14
 }
15 15
 ?>
16 16
 <div class="form-group mt-4">
17
-    <strong><?php echo sanitize_text_field( $text ); ?></strong>
17
+    <strong><?php echo sanitize_text_field($text); ?></strong>
18 18
     <span class="getpaid-checkout-total-payable"></span>
19 19
 </div>
Please login to merge, or discard this patch.
templates/invoice/company-address.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 global $wpinv_euvat;
13 13
 
14 14
 // Prepare the company name.
15 15
 $company_name = $wpinv_euvat->get_company_name();
16 16
 
17
-if ( empty( $company_name ) ) {
17
+if (empty($company_name)) {
18 18
     $company_name = wpinv_get_business_name();
19 19
 }
20 20
 
@@ -24,30 +24,30 @@  discard block
 block discarded – undo
24 24
         <div class="row">
25 25
 
26 26
             <div class="invoice-company-address-label col-2">
27
-                <strong><?php _e( 'From:', 'invoicing' ) ?></strong>
27
+                <strong><?php _e('From:', 'invoicing') ?></strong>
28 28
             </div>
29 29
 
30 30
             <div class="invoice-company-address-value col-10">
31 31
 
32
-                <?php do_action( 'getpaid_company_address_top' ); ?>
32
+                <?php do_action('getpaid_company_address_top'); ?>
33 33
 
34 34
                 <div class="name">
35
-                    <a target="_blank" class="text-dark" href="<?php echo esc_url( wpinv_get_business_website() ); ?>">
36
-                        <?php echo esc_html( wpinv_get_business_name() ); ?>
35
+                    <a target="_blank" class="text-dark" href="<?php echo esc_url(wpinv_get_business_website()); ?>">
36
+                        <?php echo esc_html(wpinv_get_business_name()); ?>
37 37
                     </a>
38 38
                 </div>
39 39
 
40
-                <?php if ( $address = wpinv_get_business_address() ) { ?>
41
-                    <?php echo $address;?>
40
+                <?php if ($address = wpinv_get_business_address()) { ?>
41
+                    <?php echo $address; ?>
42 42
                 <?php } ?>
43 43
 
44
-                <?php if ( $email_from = wpinv_mail_get_from_address() ) { ?>
44
+                <?php if ($email_from = wpinv_mail_get_from_address()) { ?>
45 45
                     <div class="email_from">
46
-                        <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), $email_from );?>
46
+                        <?php echo wp_sprintf(__('Email: %s', 'invoicing'), $email_from); ?>
47 47
                     </div>
48 48
                 <?php } ?>
49 49
 
50
-                <?php do_action( 'getpaid_company_address_bottom' ); ?>
50
+                <?php do_action('getpaid_company_address_bottom'); ?>
51 51
 
52 52
             </div>
53 53
 
Please login to merge, or discard this patch.
includes/deprecated-functions.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
  * @deprecated
247 247
  */
248 248
 function wpinv_get_payment_key( $invoice = 0 ) {
249
-	$invoice = new WPInv_Invoice( $invoice );
249
+    $invoice = new WPInv_Invoice( $invoice );
250 250
     return $invoice->get_key();
251 251
 }
252 252
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
  * @deprecated
425 425
  */
426 426
 function wpinv_get_checkout_session() {
427
-	return false;
427
+    return false;
428 428
 }
429 429
 
430 430
 /**
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 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
  * @deprecated
@@ -19,48 +19,48 @@  discard block
 block discarded – undo
19 19
  * @deprecated
20 20
  */
21 21
 function wpinv_get_invoice_cart() {
22
-    return wpinv_get_invoice( getpaid_get_current_invoice_id() );
22
+    return wpinv_get_invoice(getpaid_get_current_invoice_id());
23 23
 }
24 24
 
25 25
 /**
26 26
  * @deprecated
27 27
  */
28
-function wpinv_get_invoice_description( $invoice ) {
29
-    $invoice = new WPInv_Invoice( $invoice );
28
+function wpinv_get_invoice_description($invoice) {
29
+    $invoice = new WPInv_Invoice($invoice);
30 30
     return $invoice->get_description();
31 31
 }
32 32
 
33 33
 /**
34 34
  * @deprecated
35 35
  */
36
-function wpinv_get_invoice_currency_code( $invoice ) {
37
-    $invoice = new WPInv_Invoice( $invoice );
36
+function wpinv_get_invoice_currency_code($invoice) {
37
+    $invoice = new WPInv_Invoice($invoice);
38 38
     return $invoice->get_currency();
39 39
 }
40 40
 
41 41
 /**
42 42
  * @deprecated
43 43
  */
44
-function wpinv_get_payment_user_email( $invoice ) {
45
-    $invoice = new WPInv_Invoice( $invoice );
44
+function wpinv_get_payment_user_email($invoice) {
45
+    $invoice = new WPInv_Invoice($invoice);
46 46
     return $invoice->get_email();
47 47
 }
48 48
 
49 49
 /**
50 50
  * @deprecated
51 51
  */
52
-function wpinv_get_user_id( $invoice ) {
53
-    $invoice = new WPInv_Invoice( $invoice );
52
+function wpinv_get_user_id($invoice) {
53
+    $invoice = new WPInv_Invoice($invoice);
54 54
     return $invoice->get_user_id();
55 55
 }
56 56
 
57 57
 /**
58 58
  * @deprecated
59 59
  */
60
-function wpinv_get_invoice_status( $invoice, $return_label = false ) {
61
-    $invoice = new WPInv_Invoice( $invoice );
60
+function wpinv_get_invoice_status($invoice, $return_label = false) {
61
+    $invoice = new WPInv_Invoice($invoice);
62 62
     
63
-    if ( $return_label ) {
63
+    if ($return_label) {
64 64
         return $invoice->get_status_nicename();
65 65
     }
66 66
 
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 /**
71 71
  * @deprecated
72 72
  */
73
-function wpinv_get_payment_gateway( $invoice, $return_label = false ) {
74
-    $invoice = new WPInv_Invoice( $invoice );
73
+function wpinv_get_payment_gateway($invoice, $return_label = false) {
74
+    $invoice = new WPInv_Invoice($invoice);
75 75
 
76
-    if ( $return_label ) {
76
+    if ($return_label) {
77 77
         return $invoice->get_gateway_title();
78 78
     }
79 79
 
@@ -83,75 +83,75 @@  discard block
 block discarded – undo
83 83
 /**
84 84
  * @deprecated
85 85
  */
86
-function wpinv_get_payment_gateway_name( $invoice ) {
87
-    return wpinv_get_payment_gateway( $invoice, true );
86
+function wpinv_get_payment_gateway_name($invoice) {
87
+    return wpinv_get_payment_gateway($invoice, true);
88 88
 }
89 89
 
90 90
 /**
91 91
  * @deprecated
92 92
  */
93
-function wpinv_get_payment_transaction_id( $invoice ) {
94
-    $invoice = new WPInv_Invoice( $invoice );
93
+function wpinv_get_payment_transaction_id($invoice) {
94
+    $invoice = new WPInv_Invoice($invoice);
95 95
     return $invoice->get_transaction_id();
96 96
 }
97 97
 
98 98
 /**
99 99
  * @deprecated
100 100
  */
101
-function wpinv_get_invoice_meta( $invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true ) {
102
-    $invoice = new WPInv_Invoice( $invoice_id );
103
-    return $invoice->get_meta( $meta_key, $single );
101
+function wpinv_get_invoice_meta($invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true) {
102
+    $invoice = new WPInv_Invoice($invoice_id);
103
+    return $invoice->get_meta($meta_key, $single);
104 104
 }
105 105
 
106 106
 /**
107 107
  * @deprecated
108 108
  */
109
-function wpinv_update_invoice_meta( $invoice_id = 0, $meta_key = '', $meta_value = '' ) {
110
-    $invoice = new WPInv_Invoice( $invoice_id );
111
-    return $invoice->update_meta_data( $meta_key, $meta_value );
109
+function wpinv_update_invoice_meta($invoice_id = 0, $meta_key = '', $meta_value = '') {
110
+    $invoice = new WPInv_Invoice($invoice_id);
111
+    return $invoice->update_meta_data($meta_key, $meta_value);
112 112
 }
113 113
 
114 114
 /**
115 115
  * @deprecated
116 116
  */
117
-function wpinv_get_items( $invoice = 0 ) {
118
-    $invoice = new WPInv_Invoice( $invoice );
117
+function wpinv_get_items($invoice = 0) {
118
+    $invoice = new WPInv_Invoice($invoice);
119 119
     return $invoice->get_items();
120 120
 }
121 121
 
122 122
 /**
123 123
  * @deprecated
124 124
  */
125
-function wpinv_get_fees( $invoice = 0 ) {
126
-    $invoice = new WPInv_Invoice( $invoice );
125
+function wpinv_get_fees($invoice = 0) {
126
+    $invoice = new WPInv_Invoice($invoice);
127 127
     return $invoice->get_fees();
128 128
 }
129 129
 
130 130
 /**
131 131
  * @deprecated
132 132
  */
133
-function wpinv_get_invoice_ip( $invoice ) {
134
-    $invoice = new WPInv_Invoice( $invoice );
133
+function wpinv_get_invoice_ip($invoice) {
134
+    $invoice = new WPInv_Invoice($invoice);
135 135
     return $invoice->get_ip();
136 136
 }
137 137
 
138 138
 /**
139 139
  * @deprecated
140 140
  */
141
-function wpinv_get_invoice_user_info( $invoice ) {
142
-    $invoice = new WPInv_Invoice( $invoice );
141
+function wpinv_get_invoice_user_info($invoice) {
142
+    $invoice = new WPInv_Invoice($invoice);
143 143
     return $invoice->get_user_info();
144 144
 }
145 145
 
146 146
 /**
147 147
  * @deprecated
148 148
  */
149
-function wpinv_subtotal( $invoice = 0, $currency = false ) {
150
-    $invoice  = new WPInv_Invoice( $invoice );
149
+function wpinv_subtotal($invoice = 0, $currency = false) {
150
+    $invoice  = new WPInv_Invoice($invoice);
151 151
     $subtotal = $invoice->get_subtotal();
152 152
 
153
-    if ( $currency ) {
154
-        return wpinv_price( wpinv_format_amount( $subtotal ), $invoice->get_currency() );
153
+    if ($currency) {
154
+        return wpinv_price(wpinv_format_amount($subtotal), $invoice->get_currency());
155 155
     }
156 156
 
157 157
     return $subtotal;
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 /**
161 161
  * @deprecated
162 162
  */
163
-function wpinv_tax( $invoice = 0, $currency = false ) {
164
-    $invoice  = new WPInv_Invoice( $invoice );
163
+function wpinv_tax($invoice = 0, $currency = false) {
164
+    $invoice  = new WPInv_Invoice($invoice);
165 165
     $tax      = $invoice->get_total_tax();
166 166
 
167
-    if ( $currency ) {
168
-        return wpinv_price( wpinv_format_amount( $tax ), $invoice->get_currency() );
167
+    if ($currency) {
168
+        return wpinv_price(wpinv_format_amount($tax), $invoice->get_currency());
169 169
     }
170 170
 
171 171
     return $tax;
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 /**
175 175
  * @deprecated
176 176
  */
177
-function wpinv_discount( $invoice = 0, $currency = false, $deprecated ) {
178
-    $invoice  = new WPInv_Invoice( $invoice );
177
+function wpinv_discount($invoice = 0, $currency = false, $deprecated) {
178
+    $invoice  = new WPInv_Invoice($invoice);
179 179
     $discount = $invoice->get_total_discount();
180 180
 
181
-    if ( $currency ) {
182
-        return wpinv_price( wpinv_format_amount( $discount ), $invoice->get_currency() );
181
+    if ($currency) {
182
+        return wpinv_price(wpinv_format_amount($discount), $invoice->get_currency());
183 183
     }
184 184
 
185 185
     return $discount;
@@ -188,20 +188,20 @@  discard block
 block discarded – undo
188 188
 /**
189 189
  * @deprecated
190 190
  */
191
-function wpinv_discount_code( $invoice = 0 ) {
192
-    $invoice = new WPInv_Invoice( $invoice );
191
+function wpinv_discount_code($invoice = 0) {
192
+    $invoice = new WPInv_Invoice($invoice);
193 193
     return $invoice->get_discount_code();
194 194
 }
195 195
 
196 196
 /**
197 197
  * @deprecated
198 198
  */
199
-function wpinv_payment_total( $invoice = 0, $currency = false ) {
200
-    $invoice  = new WPInv_Invoice( $invoice );
199
+function wpinv_payment_total($invoice = 0, $currency = false) {
200
+    $invoice = new WPInv_Invoice($invoice);
201 201
     $total = $invoice->get_total();
202 202
 
203
-    if ( $currency ) {
204
-        return wpinv_price( wpinv_format_amount( $total ), $invoice->get_currency() );
203
+    if ($currency) {
204
+        return wpinv_price(wpinv_format_amount($total), $invoice->get_currency());
205 205
     }
206 206
 
207 207
     return $total;
@@ -210,51 +210,51 @@  discard block
 block discarded – undo
210 210
 /**
211 211
  * @deprecated
212 212
  */
213
-function wpinv_get_date_created( $invoice = 0, $format = '' ) {
214
-    $invoice = new WPInv_Invoice( $invoice );
213
+function wpinv_get_date_created($invoice = 0, $format = '') {
214
+    $invoice = new WPInv_Invoice($invoice);
215 215
 
216
-    $format         = ! empty( $format ) ? $format : get_option( 'date_format' );
216
+    $format         = !empty($format) ? $format : get_option('date_format');
217 217
     $date_created   = $invoice->get_created_date();
218 218
 
219
-    return empty( $date_created ) ? date_i18n( $format, strtotime( $date_created ) ) : '';
219
+    return empty($date_created) ? date_i18n($format, strtotime($date_created)) : '';
220 220
 }
221 221
 
222 222
 /**
223 223
  * @deprecated
224 224
  */
225
-function wpinv_get_invoice_date( $invoice = 0, $format = '' ) {
226
-    wpinv_get_date_created( $invoice, $format );
225
+function wpinv_get_invoice_date($invoice = 0, $format = '') {
226
+    wpinv_get_date_created($invoice, $format);
227 227
 }
228 228
 
229 229
 /**
230 230
  * @deprecated
231 231
  */
232
-function wpinv_get_invoice_vat_number( $invoice = 0 ) {
233
-    $invoice = new WPInv_Invoice( $invoice );
232
+function wpinv_get_invoice_vat_number($invoice = 0) {
233
+    $invoice = new WPInv_Invoice($invoice);
234 234
     return $invoice->get_vat_number();
235 235
 }
236 236
 
237 237
 /**
238 238
  * @deprecated
239 239
  */
240
-function wpinv_insert_payment_note( $invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false ) {
241
-    $invoice = new WPInv_Invoice( $invoice );
242
-    return $invoice->add_note( $note, $user_type, $added_by_user, $system );
240
+function wpinv_insert_payment_note($invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false) {
241
+    $invoice = new WPInv_Invoice($invoice);
242
+    return $invoice->add_note($note, $user_type, $added_by_user, $system);
243 243
 }
244 244
 
245 245
 /**
246 246
  * @deprecated
247 247
  */
248
-function wpinv_get_payment_key( $invoice = 0 ) {
249
-	$invoice = new WPInv_Invoice( $invoice );
248
+function wpinv_get_payment_key($invoice = 0) {
249
+	$invoice = new WPInv_Invoice($invoice);
250 250
     return $invoice->get_key();
251 251
 }
252 252
 
253 253
 /**
254 254
  * @deprecated
255 255
  */
256
-function wpinv_get_invoice_number( $invoice = 0 ) {
257
-    $invoice = new WPInv_Invoice( $invoice );
256
+function wpinv_get_invoice_number($invoice = 0) {
257
+    $invoice = new WPInv_Invoice($invoice);
258 258
     return $invoice->get_number();
259 259
 }
260 260
 
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
 /**
402 402
  * @deprecated
403 403
  */
404
-function wpinv_update_payment_status( $invoice, $new_status = 'publish' ) {    
405
-    $invoice = new WPInv_Invoice( $invoice );
406
-    return $invoice->update_status( $new_status );
404
+function wpinv_update_payment_status($invoice, $new_status = 'publish') {    
405
+    $invoice = new WPInv_Invoice($invoice);
406
+    return $invoice->update_status($new_status);
407 407
 }
408 408
 
409 409
 /**
@@ -456,22 +456,22 @@  discard block
 block discarded – undo
456 456
 /**
457 457
  * @deprecated
458 458
  */
459
-function wpinv_set_payment_transaction_id( $invoice_id = 0, $transaction_id = '' ) {
459
+function wpinv_set_payment_transaction_id($invoice_id = 0, $transaction_id = '') {
460 460
 
461 461
     // Fetch the invoice.
462
-    $invoice = new WPInv_Invoice( $invoice_id );
462
+    $invoice = new WPInv_Invoice($invoice_id);
463 463
 
464
-    if ( 0 ==  $invoice->get_id() ) {
464
+    if (0 == $invoice->get_id()) {
465 465
         return false;
466 466
     }
467 467
 
468 468
     // Prepare the transaction id.
469
-    if ( empty( $transaction_id ) ) {
469
+    if (empty($transaction_id)) {
470 470
         $transaction_id = $invoice_id;
471 471
     }
472 472
 
473 473
     // Set the transaction id;
474
-    $invoice->set_transaction_id( apply_filters( 'wpinv_set_payment_transaction_id', $transaction_id, $invoice ) );
474
+    $invoice->set_transaction_id(apply_filters('wpinv_set_payment_transaction_id', $transaction_id, $invoice));
475 475
 
476 476
     // Save the invoice.
477 477
     return $invoice->save();
@@ -484,12 +484,12 @@  discard block
 block discarded – undo
484 484
  * @param WPInv_Invoice $invoice
485 485
  * @param string $gateway
486 486
  */
487
-function wpinv_send_to_gateway( $gateway, $invoice ) {
487
+function wpinv_send_to_gateway($gateway, $invoice) {
488 488
 
489 489
     $payment_data = array(
490 490
         'invoice_id'        => $invoice->get_id(),
491 491
         'items'             => $invoice->get_cart_details(),
492
-        'cart_discounts'    => array( $invoice->get_discount_code() ),
492
+        'cart_discounts'    => array($invoice->get_discount_code()),
493 493
         'fees'              => $invoice->get_total_fees(),
494 494
         'subtotal'          => $invoice->get_subtotal(),
495 495
         'discount'          => $invoice->get_total_discount(),
@@ -497,16 +497,16 @@  discard block
 block discarded – undo
497 497
         'price'             => $invoice->get_total(),
498 498
         'invoice_key'       => $invoice->get_key(),
499 499
         'user_email'        => $invoice->get_email(),
500
-        'date'              => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
500
+        'date'              => date('Y-m-d H:i:s', current_time('timestamp')),
501 501
         'user_info'         => $invoice->get_user_info(),
502
-        'post_data'         => stripslashes_deep( $_POST ),
502
+        'post_data'         => stripslashes_deep($_POST),
503 503
         'cart_details'      => $invoice->get_cart_details(),
504 504
         'gateway'           => $gateway,
505 505
         'card_info'         => array(),
506 506
         'gateway_nonce'     => wp_create_nonce('wpi-gateway'),
507 507
     );
508 508
 
509
-    do_action( 'wpinv_gateway_' . $gateway, $payment_data );
509
+    do_action('wpinv_gateway_' . $gateway, $payment_data);
510 510
 }
511 511
 
512 512
 /**
@@ -519,10 +519,10 @@  discard block
 block discarded – undo
519 519
 /**
520 520
  * @deprecated
521 521
  */
522
-function wpinv_die( $message = '', $title = '', $status = 400 ) {
523
-    add_filter( 'wp_die_ajax_handler', 'wpinv_die_handler', 10, 3 );
524
-    add_filter( 'wp_die_handler', 'wpinv_die_handler', 10, 3 );
525
-    wp_die( $message, $title, array( 'response' => $status ));
522
+function wpinv_die($message = '', $title = '', $status = 400) {
523
+    add_filter('wp_die_ajax_handler', 'wpinv_die_handler', 10, 3);
524
+    add_filter('wp_die_handler', 'wpinv_die_handler', 10, 3);
525
+    wp_die($message, $title, array('response' => $status));
526 526
 }
527 527
 
528 528
 /**
@@ -640,14 +640,14 @@  discard block
 block discarded – undo
640 640
 /**
641 641
  * @deprecated
642 642
  */
643
-function wpinv_invoice_status_label( $status, $status_display = '' ) {
644
-    return empty( $status_display ) ? sanitize_text_field( $status ) : sanitize_text_field( $status_display );
643
+function wpinv_invoice_status_label($status, $status_display = '') {
644
+    return empty($status_display) ? sanitize_text_field($status) : sanitize_text_field($status_display);
645 645
 }
646 646
 
647 647
 /**
648 648
  * @deprecated
649 649
  */
650
-function wpinv_clean_invoice_number( $number ) {
650
+function wpinv_clean_invoice_number($number) {
651 651
     return $number;
652 652
 }
653 653
 
@@ -852,12 +852,12 @@  discard block
 block discarded – undo
852 852
 /**
853 853
  * @deprecated
854 854
  */
855
-function wpinv_item_show_price( $item_id = 0, $echo = true ) {
855
+function wpinv_item_show_price($item_id = 0, $echo = true) {
856 856
 
857
-    if ( $echo ) {
858
-        echo wpinv_item_price( $item_id );
857
+    if ($echo) {
858
+        echo wpinv_item_price($item_id);
859 859
     } else {
860
-        return wpinv_item_price( $item_id );
860
+        return wpinv_item_price($item_id);
861 861
     }
862 862
 
863 863
 }
Please login to merge, or discard this patch.