Passed
Pull Request — master (#284)
by Brian
05:21
created
includes/wpinv-post-types.php 1 patch
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -7,38 +7,38 @@  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
-add_action( 'init', 'wpinv_register_post_types', 1 );
14
+add_action('init', 'wpinv_register_post_types', 1);
15 15
 function wpinv_register_post_types() {
16 16
     
17 17
     $labels = array(
18
-        'name'               => _x( 'Invoices', 'post type general name', 'invoicing' ),
19
-        'singular_name'      => _x( 'Invoice', 'post type singular name', 'invoicing' ),
20
-        'menu_name'          => _x( 'Invoices', 'admin menu', 'invoicing' ),
21
-        'name_admin_bar'     => _x( 'Invoice', 'add new on admin bar', 'invoicing' ),
22
-        'add_new'            => _x( 'Add New', 'book', 'invoicing' ),
23
-        'add_new_item'       => __( 'Add New Invoice', 'invoicing' ),
24
-        'new_item'           => __( 'New Invoice', 'invoicing' ),
25
-        'edit_item'          => __( 'Edit Invoice', 'invoicing' ),
26
-        'view_item'          => __( 'View Invoice', 'invoicing' ),
27
-        'all_items'          => __( 'Invoices', 'invoicing' ),
28
-        'search_items'       => __( 'Search Invoices', 'invoicing' ),
29
-        'parent_item_colon'  => __( 'Parent Invoices:', 'invoicing' ),
30
-        'not_found'          => __( 'No invoices found.', 'invoicing' ),
31
-        'not_found_in_trash' => __( 'No invoices found in trash.', 'invoicing' )
18
+        'name'               => _x('Invoices', 'post type general name', 'invoicing'),
19
+        'singular_name'      => _x('Invoice', 'post type singular name', 'invoicing'),
20
+        'menu_name'          => _x('Invoices', 'admin menu', 'invoicing'),
21
+        'name_admin_bar'     => _x('Invoice', 'add new on admin bar', 'invoicing'),
22
+        'add_new'            => _x('Add New', 'book', 'invoicing'),
23
+        'add_new_item'       => __('Add New Invoice', 'invoicing'),
24
+        'new_item'           => __('New Invoice', 'invoicing'),
25
+        'edit_item'          => __('Edit Invoice', 'invoicing'),
26
+        'view_item'          => __('View Invoice', 'invoicing'),
27
+        'all_items'          => __('Invoices', 'invoicing'),
28
+        'search_items'       => __('Search Invoices', 'invoicing'),
29
+        'parent_item_colon'  => __('Parent Invoices:', 'invoicing'),
30
+        'not_found'          => __('No invoices found.', 'invoicing'),
31
+        'not_found_in_trash' => __('No invoices found in trash.', 'invoicing')
32 32
     );
33
-    $labels = apply_filters( 'wpinv_labels', $labels );
33
+    $labels = apply_filters('wpinv_labels', $labels);
34 34
     
35 35
     $menu_icon = WPINV_PLUGIN_URL . '/assets/images/favicon.ico';
36
-    $menu_icon = apply_filters( 'wpinv_menu_icon_invoice', $menu_icon );
36
+    $menu_icon = apply_filters('wpinv_menu_icon_invoice', $menu_icon);
37 37
 
38 38
     $cap_type = 'wpi_invoice';
39 39
     $args = array(
40 40
         'labels'             => $labels,
41
-        'description'        => __( 'This is where invoices are stored.', 'invoicing' ),
41
+        'description'        => __('This is where invoices are stored.', 'invoicing'),
42 42
         'public'             => true,
43 43
         'can_export'         => true,
44 44
         '_builtin'           => false,
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
         'has_archive'        => false,
72 72
         'hierarchical'       => false,
73 73
         'menu_position'      => null,
74
-        'supports'           => array( 'title', 'author' ),
74
+        'supports'           => array('title', 'author'),
75 75
         'menu_icon'          => 'dashicons-media-spreadsheet',
76 76
     );
77 77
             
78
-    $args = apply_filters( 'wpinv_register_post_type_invoice', $args );
78
+    $args = apply_filters('wpinv_register_post_type_invoice', $args);
79 79
     
80
-    register_post_type( 'wpi_invoice', $args );
80
+    register_post_type('wpi_invoice', $args);
81 81
 
82 82
     $cap_type = 'wpi_payment_form';
83 83
     register_post_type(
@@ -86,22 +86,22 @@  discard block
 block discarded – undo
86 86
             'wpinv_register_post_type_payment_form',
87 87
             array(
88 88
                 'labels'             => array(
89
-                    'name'               => _x( 'Payment Forms', 'post type general name', 'invoicing' ),
90
-                    'singular_name'      => _x( 'Payment Form', 'post type singular name', 'invoicing' ),
91
-                    'menu_name'          => _x( 'Payment Forms', 'admin menu', 'invoicing' ),
92
-                    'name_admin_bar'     => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ),
93
-                    'add_new'            => _x( 'Add New', 'Payment Form', 'invoicing' ),
94
-                    'add_new_item'       => __( 'Add New Payment Form', 'invoicing' ),
95
-                    'new_item'           => __( 'New Payment Form', 'invoicing' ),
96
-                    'edit_item'          => __( 'Edit Payment Form', 'invoicing' ),
97
-                    'view_item'          => __( 'View Payment Form', 'invoicing' ),
98
-                    'all_items'          => __( 'Payment Forms', 'invoicing' ),
99
-                    'search_items'       => __( 'Search Payment Forms', 'invoicing' ),
100
-                    'parent_item_colon'  => __( 'Parent Payment Forms:', 'invoicing' ),
101
-                    'not_found'          => __( 'No payment forms found.', 'invoicing' ),
102
-                    'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' )
89
+                    'name'               => _x('Payment Forms', 'post type general name', 'invoicing'),
90
+                    'singular_name'      => _x('Payment Form', 'post type singular name', 'invoicing'),
91
+                    'menu_name'          => _x('Payment Forms', 'admin menu', 'invoicing'),
92
+                    'name_admin_bar'     => _x('Payment Form', 'add new on admin bar', 'invoicing'),
93
+                    'add_new'            => _x('Add New', 'Payment Form', 'invoicing'),
94
+                    'add_new_item'       => __('Add New Payment Form', 'invoicing'),
95
+                    'new_item'           => __('New Payment Form', 'invoicing'),
96
+                    'edit_item'          => __('Edit Payment Form', 'invoicing'),
97
+                    'view_item'          => __('View Payment Form', 'invoicing'),
98
+                    'all_items'          => __('Payment Forms', 'invoicing'),
99
+                    'search_items'       => __('Search Payment Forms', 'invoicing'),
100
+                    'parent_item_colon'  => __('Parent Payment Forms:', 'invoicing'),
101
+                    'not_found'          => __('No payment forms found.', 'invoicing'),
102
+                    'not_found_in_trash' => __('No payment forms found in trash.', 'invoicing')
103 103
                 ),
104
-                'description'        => __( 'Stores payment forms.', 'invoicing' ),
104
+                'description'        => __('Stores payment forms.', 'invoicing'),
105 105
                 'public'             => false,
106 106
                 'show_ui'            => true,
107 107
                 'show_in_menu'       => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : true,
@@ -112,40 +112,40 @@  discard block
 block discarded – undo
112 112
                 'has_archive'        => false,
113 113
                 'hierarchical'       => false,
114 114
                 'menu_position'      => null,
115
-                'supports'           => array( 'title' ),
115
+                'supports'           => array('title'),
116 116
                 'menu_icon'          => 'dashicons-media-form',
117 117
             )
118 118
         )
119 119
     );
120 120
     
121 121
     $items_labels = array(
122
-        'name'               => _x( 'Items', 'post type general name', 'invoicing' ),
123
-        'singular_name'      => _x( 'Item', 'post type singular name', 'invoicing' ),
124
-        'menu_name'          => _x( 'Items', 'admin menu', 'invoicing' ),
125
-        'add_new'            => _x( 'Add New', 'wpi_item', 'invoicing' ),
126
-        'add_new_item'       => __( 'Add New Item', 'invoicing' ),
127
-        'new_item'           => __( 'New Item', 'invoicing' ),
128
-        'edit_item'          => __( 'Edit Item', 'invoicing' ),
129
-        'view_item'          => __( 'View Item', 'invoicing' ),
130
-        'all_items'          => __( 'Items', 'invoicing' ),
131
-        'search_items'       => __( 'Search Items', 'invoicing' ),
122
+        'name'               => _x('Items', 'post type general name', 'invoicing'),
123
+        'singular_name'      => _x('Item', 'post type singular name', 'invoicing'),
124
+        'menu_name'          => _x('Items', 'admin menu', 'invoicing'),
125
+        'add_new'            => _x('Add New', 'wpi_item', 'invoicing'),
126
+        'add_new_item'       => __('Add New Item', 'invoicing'),
127
+        'new_item'           => __('New Item', 'invoicing'),
128
+        'edit_item'          => __('Edit Item', 'invoicing'),
129
+        'view_item'          => __('View Item', 'invoicing'),
130
+        'all_items'          => __('Items', 'invoicing'),
131
+        'search_items'       => __('Search Items', 'invoicing'),
132 132
         'parent_item_colon'  => '',
133
-        'not_found'          => __( 'No items found.', 'invoicing' ),
134
-        'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' )
133
+        'not_found'          => __('No items found.', 'invoicing'),
134
+        'not_found_in_trash' => __('No items found in trash.', 'invoicing')
135 135
     );
136
-    $items_labels = apply_filters( 'wpinv_items_labels', $items_labels );
136
+    $items_labels = apply_filters('wpinv_items_labels', $items_labels);
137 137
 
138 138
     $cap_type          = 'wpi_item';
139 139
     $invoice_item_args = array(
140 140
         'labels'                => $items_labels,
141
-        'description'           => __( 'This is where you can add new invoice items.', 'invoicing' ),
141
+        'description'           => __('This is where you can add new invoice items.', 'invoicing'),
142 142
         'public'                => false,
143 143
         'has_archive'           => false,
144 144
         '_builtin'              => false,
145 145
         'show_ui'               => true,
146 146
         'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
147 147
         'show_in_nav_menus'     => false,
148
-        'supports'              => array( 'title', 'excerpt' ),
148
+        'supports'              => array('title', 'excerpt'),
149 149
         'register_meta_box_cb'  => 'wpinv_register_item_meta_boxes',
150 150
         'rewrite'               => false,
151 151
         'query_var'             => false,
@@ -172,33 +172,33 @@  discard block
 block discarded – undo
172 172
         ),
173 173
         'can_export'            => true,
174 174
     );
175
-    $invoice_item_args = apply_filters( 'wpinv_register_post_type_invoice_item', $invoice_item_args );
175
+    $invoice_item_args = apply_filters('wpinv_register_post_type_invoice_item', $invoice_item_args);
176 176
 
177
-    register_post_type( 'wpi_item', $invoice_item_args );
177
+    register_post_type('wpi_item', $invoice_item_args);
178 178
     
179 179
     $labels = array(
180
-        'name'               => _x( 'Discounts', 'post type general name', 'invoicing' ),
181
-        'singular_name'      => _x( 'Discount', 'post type singular name', 'invoicing' ),
182
-        'menu_name'          => _x( 'Discounts', 'admin menu', 'invoicing' ),
183
-        'name_admin_bar'     => _x( 'Discount', 'add new on admin bar', 'invoicing' ),
184
-        'add_new'            => _x( 'Add New', 'book', 'invoicing' ),
185
-        'add_new_item'       => __( 'Add New Discount', 'invoicing' ),
186
-        'new_item'           => __( 'New Discount', 'invoicing' ),
187
-        'edit_item'          => __( 'Edit Discount', 'invoicing' ),
188
-        'view_item'          => __( 'View Discount', 'invoicing' ),
189
-        'all_items'          => __( 'Discounts', 'invoicing' ),
190
-        'search_items'       => __( 'Search Discounts', 'invoicing' ),
191
-        'parent_item_colon'  => __( 'Parent Discounts:', 'invoicing' ),
192
-        'not_found'          => __( 'No discounts found.', 'invoicing' ),
193
-        'not_found_in_trash' => __( 'No discounts found in trash.', 'invoicing' )
180
+        'name'               => _x('Discounts', 'post type general name', 'invoicing'),
181
+        'singular_name'      => _x('Discount', 'post type singular name', 'invoicing'),
182
+        'menu_name'          => _x('Discounts', 'admin menu', 'invoicing'),
183
+        'name_admin_bar'     => _x('Discount', 'add new on admin bar', 'invoicing'),
184
+        'add_new'            => _x('Add New', 'book', 'invoicing'),
185
+        'add_new_item'       => __('Add New Discount', 'invoicing'),
186
+        'new_item'           => __('New Discount', 'invoicing'),
187
+        'edit_item'          => __('Edit Discount', 'invoicing'),
188
+        'view_item'          => __('View Discount', 'invoicing'),
189
+        'all_items'          => __('Discounts', 'invoicing'),
190
+        'search_items'       => __('Search Discounts', 'invoicing'),
191
+        'parent_item_colon'  => __('Parent Discounts:', 'invoicing'),
192
+        'not_found'          => __('No discounts found.', 'invoicing'),
193
+        'not_found_in_trash' => __('No discounts found in trash.', 'invoicing')
194 194
     );
195
-    $labels = apply_filters( 'wpinv_discounts_labels', $labels );
195
+    $labels = apply_filters('wpinv_discounts_labels', $labels);
196 196
 
197 197
     $cap_type = 'wpi_discount';
198 198
     
199 199
     $args = array(
200 200
         'labels'             => $labels,
201
-        'description'        => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ),
201
+        'description'        => __('This is where you can add new discounts that users can use in invoices.', 'invoicing'),
202 202
         'public'             => false,
203 203
         'can_export'         => true,
204 204
         '_builtin'           => false,
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         ),
230 230
         'has_archive'        => false,
231 231
         'hierarchical'       => false,
232
-        'supports'           => array( 'title', 'excerpt' ),
232
+        'supports'           => array('title', 'excerpt'),
233 233
         'register_meta_box_cb'  => 'wpinv_register_discount_meta_boxes',
234 234
         'show_in_nav_menus'  => false,
235 235
         'show_in_admin_bar'  => true,
@@ -237,106 +237,106 @@  discard block
 block discarded – undo
237 237
         'menu_position'      => null,
238 238
     );
239 239
             
240
-    $args = apply_filters( 'wpinv_register_post_type_discount', $args );
240
+    $args = apply_filters('wpinv_register_post_type_discount', $args);
241 241
     
242
-    register_post_type( 'wpi_discount', $args );
242
+    register_post_type('wpi_discount', $args);
243 243
 }
244 244
 
245 245
 function wpinv_get_default_labels() {
246 246
     $defaults = array(
247
-       'singular' => __( 'Invoice', 'invoicing' ),
248
-       'plural'   => __( 'Invoices', 'invoicing' )
247
+       'singular' => __('Invoice', 'invoicing'),
248
+       'plural'   => __('Invoices', 'invoicing')
249 249
     );
250 250
     
251
-    return apply_filters( 'wpinv_default_invoices_name', $defaults );
251
+    return apply_filters('wpinv_default_invoices_name', $defaults);
252 252
 }
253 253
 
254
-function wpinv_get_label_singular( $lowercase = false ) {
254
+function wpinv_get_label_singular($lowercase = false) {
255 255
     $defaults = wpinv_get_default_labels();
256 256
     
257
-    return ($lowercase) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
257
+    return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
258 258
 }
259 259
 
260
-function wpinv_get_label_plural( $lowercase = false ) {
260
+function wpinv_get_label_plural($lowercase = false) {
261 261
     $defaults = wpinv_get_default_labels();
262 262
     
263
-    return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
263
+    return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
264 264
 }
265 265
 
266
-function wpinv_change_default_title( $title ) {
267
-     if ( !is_admin() ) {
266
+function wpinv_change_default_title($title) {
267
+     if (!is_admin()) {
268 268
         $label = wpinv_get_label_singular();
269
-        $title = sprintf( __( 'Enter %s name here', 'invoicing' ), $label );
269
+        $title = sprintf(__('Enter %s name here', 'invoicing'), $label);
270 270
         return $title;
271 271
      }
272 272
 
273 273
      $screen = get_current_screen();
274 274
 
275
-     if ( 'wpi_invoice' == $screen->post_type ) {
275
+     if ('wpi_invoice' == $screen->post_type) {
276 276
         $label = wpinv_get_label_singular();
277
-        $title = sprintf( __( 'Enter %s name here', 'invoicing' ), $label );
277
+        $title = sprintf(__('Enter %s name here', 'invoicing'), $label);
278 278
      }
279 279
 
280 280
      return $title;
281 281
 }
282
-add_filter( 'enter_title_here', 'wpinv_change_default_title' );
282
+add_filter('enter_title_here', 'wpinv_change_default_title');
283 283
 
284 284
 function wpinv_register_post_status() {
285
-    register_post_status( 'wpi-pending', array(
286
-        'label'                     => _x( 'Pending', 'Invoice status', 'invoicing' ),
285
+    register_post_status('wpi-pending', array(
286
+        'label'                     => _x('Pending', 'Invoice status', 'invoicing'),
287 287
         'public'                    => true,
288 288
         'exclude_from_search'       => true,
289 289
         'show_in_admin_all_list'    => true,
290 290
         'show_in_admin_status_list' => true,
291
-        'label_count'               => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', 'invoicing' )
292
-    ) );
293
-    register_post_status( 'wpi-processing', array(
294
-        'label'                     => _x( 'Processing', 'Invoice status', 'invoicing' ),
291
+        'label_count'               => _n_noop('Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', 'invoicing')
292
+    ));
293
+    register_post_status('wpi-processing', array(
294
+        'label'                     => _x('Processing', 'Invoice status', 'invoicing'),
295 295
         'public'                    => true,
296 296
         'exclude_from_search'       => true,
297 297
         'show_in_admin_all_list'    => true,
298 298
         'show_in_admin_status_list' => true,
299
-        'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' )
300
-    ) );
301
-    register_post_status( 'wpi-onhold', array(
302
-        'label'                     => _x( 'On Hold', 'Invoice status', 'invoicing' ),
299
+        'label_count'               => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing')
300
+    ));
301
+    register_post_status('wpi-onhold', array(
302
+        'label'                     => _x('On Hold', 'Invoice status', 'invoicing'),
303 303
         'public'                    => true,
304 304
         'exclude_from_search'       => true,
305 305
         'show_in_admin_all_list'    => true,
306 306
         'show_in_admin_status_list' => true,
307
-        'label_count'               => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' )
308
-    ) );
309
-    register_post_status( 'wpi-cancelled', array(
310
-        'label'                     => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
307
+        'label_count'               => _n_noop('On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing')
308
+    ));
309
+    register_post_status('wpi-cancelled', array(
310
+        'label'                     => _x('Cancelled', 'Invoice status', 'invoicing'),
311 311
         'public'                    => true,
312 312
         'exclude_from_search'       => true,
313 313
         'show_in_admin_all_list'    => true,
314 314
         'show_in_admin_status_list' => true,
315
-        'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' )
316
-    ) );
317
-    register_post_status( 'wpi-refunded', array(
318
-        'label'                     => _x( 'Refunded', 'Invoice status', 'invoicing' ),
315
+        'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing')
316
+    ));
317
+    register_post_status('wpi-refunded', array(
318
+        'label'                     => _x('Refunded', 'Invoice status', 'invoicing'),
319 319
         'public'                    => true,
320 320
         'exclude_from_search'       => true,
321 321
         'show_in_admin_all_list'    => true,
322 322
         'show_in_admin_status_list' => true,
323
-        'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' )
324
-    ) );
325
-    register_post_status( 'wpi-failed', array(
326
-        'label'                     => _x( 'Failed', 'Invoice status', 'invoicing' ),
323
+        'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing')
324
+    ));
325
+    register_post_status('wpi-failed', array(
326
+        'label'                     => _x('Failed', 'Invoice status', 'invoicing'),
327 327
         'public'                    => true,
328 328
         'exclude_from_search'       => true,
329 329
         'show_in_admin_all_list'    => true,
330 330
         'show_in_admin_status_list' => true,
331
-        'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' )
332
-    ) );
333
-    register_post_status( 'wpi-renewal', array(
334
-        'label'                     => _x( 'Renewal', 'Invoice status', 'invoicing' ),
331
+        'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing')
332
+    ));
333
+    register_post_status('wpi-renewal', array(
334
+        'label'                     => _x('Renewal', 'Invoice status', 'invoicing'),
335 335
         'public'                    => true,
336 336
         'exclude_from_search'       => true,
337 337
         'show_in_admin_all_list'    => true,
338 338
         'show_in_admin_status_list' => true,
339
-        'label_count'               => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' )
340
-    ) );
339
+        'label_count'               => _n_noop('Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing')
340
+    ));
341 341
 }
342
-add_action( 'init', 'wpinv_register_post_status', 10 );
342
+add_action('init', 'wpinv_register_post_status', 10);
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-invoice-details.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( !defined( 'WPINC' ) ) {
4
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
3
+if (!defined('WPINC')) {
4
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
5 5
 }
6 6
 
7 7
 class WPInv_Meta_Box_Details {
8
-    public static function output( $post ) {
8
+    public static function output($post) {
9 9
         $currency_symbol    = wpinv_currency_symbol();
10
-        $statuses           = wpinv_get_invoice_statuses( true );
10
+        $statuses           = wpinv_get_invoice_statuses(true);
11 11
         
12
-        $post_id            = !empty( $post->ID ) ? $post->ID : 0;
13
-        $invoice            = new WPInv_Invoice( $post_id );
12
+        $post_id            = !empty($post->ID) ? $post->ID : 0;
13
+        $invoice            = new WPInv_Invoice($post_id);
14 14
         
15
-        $status             = $invoice->get_status( false ); // Current status    
15
+        $status             = $invoice->get_status(false); // Current status    
16 16
         $discount           = $invoice->get_discount();
17 17
         $discount_code      = $discount > 0 ? $invoice->get_discount_code() : '';
18 18
         $invoice_number     = $invoice->get_number();
19 19
         
20 20
         $date_created       = $invoice->get_created_date();
21
-        $datetime_created   = strtotime( $date_created );
22
-        $date_created       = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $datetime_created ) : '';
21
+        $datetime_created   = strtotime($date_created);
22
+        $date_created       = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $datetime_created) : '';
23 23
         $date_completed     = $invoice->get_completed_date();
24
-        $date_completed     = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $date_completed ) ) : 'n/a';
25
-        $title['status'] = __( 'Invoice Status:', 'invoicing' );
26
-        $title['number'] = __( 'Invoice Number:', 'invoicing' );
27
-        $mail_notice = esc_attr__( 'After saving invoice, this will send a copy of the invoice to the user&#8217;s email address.', 'invoicing' );
24
+        $date_completed     = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($date_completed)) : 'n/a';
25
+        $title['status'] = __('Invoice Status:', 'invoicing');
26
+        $title['number'] = __('Invoice Number:', 'invoicing');
27
+        $mail_notice = esc_attr__('After saving invoice, this will send a copy of the invoice to the user&#8217;s email address.', 'invoicing');
28 28
         
29 29
         $title = apply_filters('wpinv_details_metabox_titles', $title, $invoice);
30 30
         $statuses = apply_filters('wpinv_invoice_statuses', $statuses, $invoice);
@@ -34,36 +34,36 @@  discard block
 block discarded – undo
34 34
 <div class="gdmbx2-wrap form-table">
35 35
     <div class="gdmbx2-metabox gdmbx-field-list" id="gdmbx2-metabox-wpinv_details">
36 36
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-created">
37
-            <div class="gdmbx-th"><label><?php _e( 'Date Created:', 'invoicing' );?></label></div>
38
-            <div class="gdmbx-td"><?php echo $date_created;?></div>
37
+            <div class="gdmbx-th"><label><?php _e('Date Created:', 'invoicing'); ?></label></div>
38
+            <div class="gdmbx-td"><?php echo $date_created; ?></div>
39 39
         </div>
40
-        <?php if ( $invoice->post_type == 'wpi_invoice' && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->has_status( array( 'auto-draft', 'draft' ) ) ) ) { ?>
40
+        <?php if ($invoice->post_type == 'wpi_invoice' && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->has_status(array('auto-draft', 'draft')))) { ?>
41 41
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-overdue">
42
-            <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e( 'Due Date:', 'invoicing' );?></label></div>
42
+            <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e('Due Date:', 'invoicing'); ?></label></div>
43 43
             <div class="gdmbx-td">
44
-                <input type="text" placeholder="<?php esc_attr_e( 'Y-m-d', 'invoicing' );?>" value="<?php echo esc_attr( $invoice->get_due_date() );?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr( date_i18n( 'Y-m-d', $datetime_created ) );?>" data-dateFormat="yy-mm-dd">
45
-                <p class="wpi-meta-row wpi-meta-desc"><?php _e( 'Leave blank to disable sending auto reminder for this invoice.', 'invoicing' );?></p>
44
+                <input type="text" placeholder="<?php esc_attr_e('Y-m-d', 'invoicing'); ?>" value="<?php echo esc_attr($invoice->get_due_date()); ?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr(date_i18n('Y-m-d', $datetime_created)); ?>" data-dateFormat="yy-mm-dd">
45
+                <p class="wpi-meta-row wpi-meta-desc"><?php _e('Leave blank to disable sending auto reminder for this invoice.', 'invoicing'); ?></p>
46 46
             </div>
47 47
         </div>
48 48
         <?php } ?>
49
-        <?php do_action( 'wpinv_meta_box_details_after_due_date', $post_id ); ?>
50
-        <?php if ( $date_completed && $date_completed != 'n/a' ) { ?>
49
+        <?php do_action('wpinv_meta_box_details_after_due_date', $post_id); ?>
50
+        <?php if ($date_completed && $date_completed != 'n/a') { ?>
51 51
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-completed">
52
-            <div class="gdmbx-th"><label><?php _e( 'Payment Date:', 'invoicing' );?></label></div>
53
-            <div class="gdmbx-td"><?php echo $date_completed;?></div>
52
+            <div class="gdmbx-th"><label><?php _e('Payment Date:', 'invoicing'); ?></label></div>
53
+            <div class="gdmbx-td"><?php echo $date_completed; ?></div>
54 54
         </div>
55 55
         <?php } ?>
56
-        <?php $is_viewed = wpinv_is_invoice_viewed( $post_id ); ?>
56
+        <?php $is_viewed = wpinv_is_invoice_viewed($post_id); ?>
57 57
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-customer-viewed">
58
-            <div class="gdmbx-th"><label><?php _e( 'Viewed by Customer:', 'invoicing' );?></label></div>
59
-            <div class="gdmbx-td"><?php ( 1 == $is_viewed ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?></div>
58
+            <div class="gdmbx-th"><label><?php _e('Viewed by Customer:', 'invoicing'); ?></label></div>
59
+            <div class="gdmbx-td"><?php (1 == $is_viewed) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?></div>
60 60
         </div>
61 61
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-status">
62 62
             <div class="gdmbx-th"><label for="wpinv_status"><?php echo $title['status']; ?></label></div>
63 63
             <div class="gdmbx-td">
64 64
                 <select required="required" id="wpinv_status" name="wpinv_status" class="gdmbx2_select wpi_select2">
65
-                    <?php foreach ( $statuses as $value => $label ) { ?>
66
-                    <option value="<?php echo $value;?>" <?php selected( $status, $value );?>><?php echo $label;?></option>
65
+                    <?php foreach ($statuses as $value => $label) { ?>
66
+                    <option value="<?php echo $value; ?>" <?php selected($status, $value); ?>><?php echo $label; ?></option>
67 67
                     <?php } ?>
68 68
                 </select>
69 69
             </div>
@@ -71,117 +71,117 @@  discard block
 block discarded – undo
71 71
         <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-number table-layout">
72 72
             <div class="gdmbx-th"><label for="wpinv_number"><?php echo $title['number']; ?></label></div>
73 73
             <div class="gdmbx-td">
74
-                <input type="text" value="<?php echo esc_attr( $invoice_number );?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly>
74
+                <input type="text" value="<?php echo esc_attr($invoice_number); ?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly>
75 75
             </div>
76 76
         </div>
77
-        <?php do_action( 'wpinv_meta_box_details_inner', $post_id );
77
+        <?php do_action('wpinv_meta_box_details_inner', $post_id);
78 78
         $disable_discount = apply_filters('wpinv_disable_apply_discount', false, $invoice, $post_id);
79 79
         ?>
80
-        <?php if ( !( $is_paid = ( $invoice->is_paid() || $invoice->is_refunded() ) ) && !$disable_discount || $discount_code ) { ?>
80
+        <?php if (!($is_paid = ($invoice->is_paid() || $invoice->is_refunded())) && !$disable_discount || $discount_code) { ?>
81 81
         <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-discount-code table-layout">
82
-            <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e( 'Discount Code:', 'invoicing' );?></label></div>
82
+            <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e('Discount Code:', 'invoicing'); ?></label></div>
83 83
             <div class="gdmbx-td">
84
-                <input type="text" value="<?php echo esc_attr( $discount_code ); ?>" id="wpinv_discount" class="medium-text" <?php echo ( $discount_code ? 'readonly' : '' ); ?> /><?php if ( !$is_paid && !$disable_discount ) { ?><input value="<?php echo esc_attr_e( 'Apply', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-hide' : 'wpi-inlineb' ); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e( 'Remove', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-inlineb' : 'wpi-hide' ); ?>" id="wpinv-remove-code" type="button" /><?php } ?>
84
+                <input type="text" value="<?php echo esc_attr($discount_code); ?>" id="wpinv_discount" class="medium-text" <?php echo ($discount_code ? 'readonly' : ''); ?> /><?php if (!$is_paid && !$disable_discount) { ?><input value="<?php echo esc_attr_e('Apply', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-hide' : 'wpi-inlineb'); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e('Remove', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-inlineb' : 'wpi-hide'); ?>" id="wpinv-remove-code" type="button" /><?php } ?>
85 85
             </div>
86 86
         </div>
87 87
         <?php } ?>
88 88
     </div>
89 89
 </div>
90 90
 <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-save-send table-layout">
91
-    <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__( 'Send %s:', 'invoicing' ),$post_obj->labels->singular_name) ; ?></label>
91
+    <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__('Send %s:', 'invoicing'), $post_obj->labels->singular_name); ?></label>
92 92
         <select id="wpi_save_send" name="wpi_save_send" class="wpi_select2">
93
-            <option value="1"><?php _e( 'Yes', 'invoicing' ); ?></option>
94
-            <option value="" selected="selected"><?php _e( 'No', 'invoicing' ); ?></option>
93
+            <option value="1"><?php _e('Yes', 'invoicing'); ?></option>
94
+            <option value="" selected="selected"><?php _e('No', 'invoicing'); ?></option>
95 95
         </select>
96 96
     </p>
97 97
     <p class="wpi-meta-row wpi-send-info"><?php echo $mail_notice; ?></p>
98 98
 </div>
99
-<?php wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ;?>
99
+<?php wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); ?>
100 100
         <?php
101 101
     }
102 102
     
103
-    public static function resend_invoice( $post ) {
103
+    public static function resend_invoice($post) {
104 104
         global $wpi_mb_invoice;
105 105
         
106
-        if ( empty( $wpi_mb_invoice ) ) {
106
+        if (empty($wpi_mb_invoice)) {
107 107
             return;
108 108
         }
109 109
         
110 110
         $text = array(
111
-            'message'       => esc_attr__( 'This will send a copy of the invoice to the customer&#8217;s email address.', 'invoicing' ),
112
-            'button_text'   =>  __( 'Resend Invoice', 'invoicing' ),
111
+            'message'       => esc_attr__('This will send a copy of the invoice to the customer&#8217;s email address.', 'invoicing'),
112
+            'button_text'   =>  __('Resend Invoice', 'invoicing'),
113 113
         );
114 114
             
115 115
         $text = apply_filters('wpinv_resend_invoice_metabox_text', $text);
116
-        do_action( 'wpinv_metabox_resend_invoice_before', $wpi_mb_invoice );
116
+        do_action('wpinv_metabox_resend_invoice_before', $wpi_mb_invoice);
117 117
         
118
-        if ( $email = $wpi_mb_invoice->get_email() ) {
118
+        if ($email = $wpi_mb_invoice->get_email()) {
119 119
             $email_actions = array();
120
-            $email_actions['email_url']      = remove_query_arg( 'wpinv-message', add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) ) );
121
-            $email_actions['reminder_url']   = add_query_arg( array( 'wpi_action' => 'send_reminder', 'invoice_id' => $post->ID ) );
120
+            $email_actions['email_url']      = remove_query_arg('wpinv-message', add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID)));
121
+            $email_actions['reminder_url']   = add_query_arg(array('wpi_action' => 'send_reminder', 'invoice_id' => $post->ID));
122 122
             
123
-            $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions );
123
+            $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions);
124 124
         ?>
125 125
         <p class="wpi-meta-row wpi-resend-info"><?php echo $text['message']; ?></p>
126
-        <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url( $email_actions['email_url'] ); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p>
127
-        <?php if ( wpinv_get_option( 'overdue_active' ) && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ( $due_date = $wpi_mb_invoice->get_due_date() ) ) { ?>
128
-        <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e( 'Send overdue reminder notification to customer', 'invoicing' ); ?>" href="<?php echo esc_url( $email_actions['reminder_url'] ); ?>" class="button button-secondary"><?php esc_attr_e( 'Send Reminder', 'invoicing' ); ?></a></p>
126
+        <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url($email_actions['email_url']); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p>
127
+        <?php if (wpinv_get_option('overdue_active') && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ($due_date = $wpi_mb_invoice->get_due_date())) { ?>
128
+        <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e('Send overdue reminder notification to customer', 'invoicing'); ?>" href="<?php echo esc_url($email_actions['reminder_url']); ?>" class="button button-secondary"><?php esc_attr_e('Send Reminder', 'invoicing'); ?></a></p>
129 129
         <?php } ?>
130 130
         <?php
131 131
         }
132 132
         
133
-        do_action( 'wpinv_metabox_resend_invoice_after', $wpi_mb_invoice );
133
+        do_action('wpinv_metabox_resend_invoice_after', $wpi_mb_invoice);
134 134
     }
135 135
     
136
-    public static function subscriptions( $post ) {
137
-        $invoice = wpinv_get_invoice( $post->ID );
136
+    public static function subscriptions($post) {
137
+        $invoice = wpinv_get_invoice($post->ID);
138 138
 
139
-        if ( ! empty( $invoice ) && $invoice->is_recurring() && $invoice->is_parent() ) {
140
-            $subscription = wpinv_get_subscription( $invoice );
139
+        if (!empty($invoice) && $invoice->is_recurring() && $invoice->is_parent()) {
140
+            $subscription = wpinv_get_subscription($invoice);
141 141
 
142
-            if ( empty( $subscription ) ) {
142
+            if (empty($subscription)) {
143 143
                 ?>
144
-                <p class="wpi-meta-row"><?php echo wp_sprintf( __( 'New Subscription will be created when customer will checkout and pay the invoice. Go to: %sSubscriptions%s', 'invoicing' ), '<a href="' . admin_url( 'admin.php?page=wpinv-subscriptions' ).'">', '</a>' ); ?></p>
144
+                <p class="wpi-meta-row"><?php echo wp_sprintf(__('New Subscription will be created when customer will checkout and pay the invoice. Go to: %sSubscriptions%s', 'invoicing'), '<a href="' . admin_url('admin.php?page=wpinv-subscriptions') . '">', '</a>'); ?></p>
145 145
                 <?php
146 146
                 return;
147 147
             }
148
-            $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $subscription->period, $subscription->frequency );
149
-            $billing = wpinv_price(wpinv_format_amount( $subscription->recurring_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ) . ' / ' . $frequency;
150
-            $initial = wpinv_price(wpinv_format_amount( $subscription->initial_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) );
148
+            $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency($subscription->period, $subscription->frequency);
149
+            $billing = wpinv_price(wpinv_format_amount($subscription->recurring_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)) . ' / ' . $frequency;
150
+            $initial = wpinv_price(wpinv_format_amount($subscription->initial_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id));
151 151
             $payments = $subscription->get_child_payments();
152 152
             ?>
153 153
             <p class="wpi-meta-row wpi-sub-label <?php echo 'status-' . $subscription->status; ?>"><?php _e('Recurring Payment', 'invoicing'); ?></p>
154
-            <?php if ( ! empty( $subscription ) && ! empty( $subscription->id ) ) { ?>
154
+            <?php if (!empty($subscription) && !empty($subscription->id)) { ?>
155 155
                 <p class="wpi-meta-row wpi-sub-id">
156
-                    <label><?php _e( 'Subscription ID:', 'invoicing' ); ?> </label><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $subscription->id ) ); ?>" title="<?php esc_attr_e( 'View or edit subscription', 'invoicing' ); ?>" target="_blank"><?php echo $subscription->id; ?></a></p>
156
+                    <label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . $subscription->id)); ?>" title="<?php esc_attr_e('View or edit subscription', 'invoicing'); ?>" target="_blank"><?php echo $subscription->id; ?></a></p>
157 157
             <?php } ?>
158 158
             <p class="wpi-meta-row wpi-bill-cycle">
159
-                <label><?php _e( 'Billing Cycle:', 'invoicing'); ?> </label><?php printf( _x( '%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing' ), $initial, $billing ); ?>
159
+                <label><?php _e('Billing Cycle:', 'invoicing'); ?> </label><?php printf(_x('%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing'), $initial, $billing); ?>
160 160
             </p>
161 161
             <p class="wpi-meta-row wpi-billed-times">
162
-                <label><?php _e( 'Times Billed:', 'invoicing' ); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . ( ( $subscription->bill_times == 0 ) ? 'Until Cancelled' : $subscription->bill_times ); ?>
162
+                <label><?php _e('Times Billed:', 'invoicing'); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . (($subscription->bill_times == 0) ? 'Until Cancelled' : $subscription->bill_times); ?>
163 163
             </p>
164 164
             <p class="wpi-meta-row wpi-start-date">
165
-                <label><?php _e( 'Start Date:', 'invoicing' ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->created, current_time( 'timestamp' ) ) ); ?>
165
+                <label><?php _e('Start Date:', 'invoicing'); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->created, current_time('timestamp'))); ?>
166 166
             </p>
167 167
             <p class="wpi-meta-row wpi-end-date">
168
-                <label><?php echo ( 'trialling' == $subscription->status ? __( 'Trialling Until:', 'invoicing' ) : __( 'Expiration Date:', 'invoicing' ) ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->expiration, current_time( 'timestamp' ) ) ); ?>
168
+                <label><?php echo ('trialling' == $subscription->status ? __('Trialling Until:', 'invoicing') : __('Expiration Date:', 'invoicing')); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->expiration, current_time('timestamp'))); ?>
169 169
             </p>
170
-            <?php if ( $subscription->status ) { ?>
170
+            <?php if ($subscription->status) { ?>
171 171
                 <p class="wpi-meta-row wpi-sub-status">
172
-                    <label><?php _e( 'Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?>
172
+                    <label><?php _e('Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?>
173 173
                 </p>
174 174
             <?php } ?>
175
-            <?php if ( !empty( $payments ) ) { ?>
176
-                <p><strong><?php _e( 'Renewal Payments:', 'invoicing' ); ?></strong></p>
175
+            <?php if (!empty($payments)) { ?>
176
+                <p><strong><?php _e('Renewal Payments:', 'invoicing'); ?></strong></p>
177 177
                 <ul id="wpi-sub-payments">
178
-                <?php foreach ( $payments as $payment ) {
178
+                <?php foreach ($payments as $payment) {
179 179
                     $invoice_id = $payment->ID;
180 180
                     ?>
181 181
                     <li>
182
-                        <a href="<?php echo esc_url( get_edit_post_link( $invoice_id ) ); ?>"><?php echo wpinv_get_invoice_number( $invoice_id ); ?></a>&nbsp;&ndash;&nbsp;
183
-                        <span><?php echo wpinv_get_invoice_date( $invoice_id ); ?>&nbsp;&ndash;&nbsp;</span>
184
-                        <span><?php echo wpinv_payment_total( $invoice_id, true ); ?></span>
182
+                        <a href="<?php echo esc_url(get_edit_post_link($invoice_id)); ?>"><?php echo wpinv_get_invoice_number($invoice_id); ?></a>&nbsp;&ndash;&nbsp;
183
+                        <span><?php echo wpinv_get_invoice_date($invoice_id); ?>&nbsp;&ndash;&nbsp;</span>
184
+                        <span><?php echo wpinv_payment_total($invoice_id, true); ?></span>
185 185
                     </li>
186 186
                 <?php } ?>
187 187
                 </ul>
@@ -189,16 +189,16 @@  discard block
 block discarded – undo
189 189
         }
190 190
     }
191 191
     
192
-    public static function renewals( $post ) {
193
-        $invoice = wpinv_get_invoice( $post->ID );
192
+    public static function renewals($post) {
193
+        $invoice = wpinv_get_invoice($post->ID);
194 194
         
195
-        if ( wpinv_is_subscription_payment( $invoice ) ) {
196
-            $parent_url = get_edit_post_link( $invoice->parent_invoice );
197
-            $parent_id  = wpinv_get_invoice_number( $invoice->parent_invoice );
198
-            $subscription = wpinv_get_subscription( $invoice );
195
+        if (wpinv_is_subscription_payment($invoice)) {
196
+            $parent_url = get_edit_post_link($invoice->parent_invoice);
197
+            $parent_id  = wpinv_get_invoice_number($invoice->parent_invoice);
198
+            $subscription = wpinv_get_subscription($invoice);
199 199
         ?>
200
-        <?php if ( ! empty( $subscription ) ) { ?><p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $subscription->id ) ); ?>" title="<?php esc_attr_e( 'View or edit subscription', 'invoicing' ); ?>" target="_blank"><?php echo $subscription->id; ?></a></p><?php } ?>
201
-        <p class="wpi-meta-row wpi-parent-id"><label><?php _e( 'Parent Invoice:', 'invoicing' );?> </label><a href="<?php echo esc_url( $parent_url ); ?>"><?php echo $parent_id; ?></a></p>
200
+        <?php if (!empty($subscription)) { ?><p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . $subscription->id)); ?>" title="<?php esc_attr_e('View or edit subscription', 'invoicing'); ?>" target="_blank"><?php echo $subscription->id; ?></a></p><?php } ?>
201
+        <p class="wpi-meta-row wpi-parent-id"><label><?php _e('Parent Invoice:', 'invoicing'); ?> </label><a href="<?php echo esc_url($parent_url); ?>"><?php echo $parent_id; ?></a></p>
202 202
         <?php
203 203
         }
204 204
     }
@@ -206,47 +206,47 @@  discard block
 block discarded – undo
206 206
     /**
207 207
      * Renders a metabox to edit a payment form.
208 208
      */
209
-    public static function payment_form( $post ) {
210
-        WPInv_Meta_Box_Form_Items::output_options( $post );
209
+    public static function payment_form($post) {
210
+        WPInv_Meta_Box_Form_Items::output_options($post);
211 211
     }
212 212
 
213 213
     /**
214 214
      * Renders a metabox to select items.
215 215
      */
216
-    public static function payment_form_items( $post ) {
217
-        WPInv_Meta_Box_Form_Items::output( $post );
216
+    public static function payment_form_items($post) {
217
+        WPInv_Meta_Box_Form_Items::output($post);
218 218
     }
219 219
     
220
-    public static function payment_meta( $post ) {
220
+    public static function payment_meta($post) {
221 221
         global $wpi_mb_invoice;
222 222
 
223
-        $set_dateway = empty( $wpi_mb_invoice->gateway ) ? true : false;
224
-        if ( !$set_dateway && !$wpi_mb_invoice->get_meta( '_wpinv_checkout', true ) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded() ) {
223
+        $set_dateway = empty($wpi_mb_invoice->gateway) ? true : false;
224
+        if (!$set_dateway && !$wpi_mb_invoice->get_meta('_wpinv_checkout', true) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded()) {
225 225
             $set_dateway = true;
226 226
         }
227 227
         
228 228
         ?>
229 229
         <p class="wpi-meta-row">
230
-        <?php if ( $set_dateway ) { $gateways = wpinv_get_enabled_payment_gateways( true ); ?>
231
-            <label for="wpinv_gateway"><?php _e( 'Gateway:', 'invoicing' ) ; ?></label>
230
+        <?php if ($set_dateway) { $gateways = wpinv_get_enabled_payment_gateways(true); ?>
231
+            <label for="wpinv_gateway"><?php _e('Gateway:', 'invoicing'); ?></label>
232 232
             <select required="required" id="wpinv_gateway" class="wpi_select2" name="wpinv_gateway">
233
-                <?php foreach ( $gateways as $name => $gateway ) {
234
-                    if ( $wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription( $name ) ) {
233
+                <?php foreach ($gateways as $name => $gateway) {
234
+                    if ($wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription($name)) {
235 235
                         continue;
236 236
                     }
237 237
                     ?>
238
-                <option value="<?php echo $name;?>" <?php selected( $wpi_mb_invoice->gateway, $name );?>><?php echo !empty( $gateway['admin_label'] ) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option>
238
+                <option value="<?php echo $name; ?>" <?php selected($wpi_mb_invoice->gateway, $name); ?>><?php echo !empty($gateway['admin_label']) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option>
239 239
                 <?php } ?>
240 240
             </select>
241 241
         <?php } else { 
242
-            echo wp_sprintf( __( '<label>Gateway:</label> %s', 'invoicing' ), wpinv_get_gateway_admin_label( $wpi_mb_invoice->gateway ) );
242
+            echo wp_sprintf(__('<label>Gateway:</label> %s', 'invoicing'), wpinv_get_gateway_admin_label($wpi_mb_invoice->gateway));
243 243
         } ?>
244 244
         </p>
245
-        <?php if ( $key = $wpi_mb_invoice->get_key() ) { ?>
246
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $key ); ?></p>
245
+        <?php if ($key = $wpi_mb_invoice->get_key()) { ?>
246
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $key); ?></p>
247 247
         <?php } ?>
248
-        <?php if ( $wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded() ) { ?>
249
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Transaction ID:</label> %s', 'invoicing' ), wpinv_payment_link_transaction_id( $wpi_mb_invoice ) ); ?></p>
248
+        <?php if ($wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded()) { ?>
249
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p>
250 250
         <?php } ?>
251 251
         <?php
252 252
     }
Please login to merge, or discard this patch.
includes/wpinv-template-functions.php 1 patch
Spacing   +743 added lines, -743 removed lines patch added patch discarded remove patch
@@ -7,91 +7,91 @@  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
-if ( !is_admin() ) {
15
-    add_filter( 'template_include', 'wpinv_template', 10, 1 );
16
-    add_action( 'wpinv_invoice_print_body_start', 'wpinv_display_invoice_top_bar' );
17
-    add_action( 'wpinv_invoice_top_bar_left', 'wpinv_invoice_display_left_actions' );
18
-    add_action( 'wpinv_invoice_top_bar_right', 'wpinv_invoice_display_right_actions' );
14
+if (!is_admin()) {
15
+    add_filter('template_include', 'wpinv_template', 10, 1);
16
+    add_action('wpinv_invoice_print_body_start', 'wpinv_display_invoice_top_bar');
17
+    add_action('wpinv_invoice_top_bar_left', 'wpinv_invoice_display_left_actions');
18
+    add_action('wpinv_invoice_top_bar_right', 'wpinv_invoice_display_right_actions');
19 19
 }
20 20
 
21 21
 function wpinv_template_path() {
22
-    return apply_filters( 'wpinv_template_path', wpinv_get_theme_template_dir_name() );
22
+    return apply_filters('wpinv_template_path', wpinv_get_theme_template_dir_name());
23 23
 }
24 24
 
25
-function wpinv_display_invoice_top_bar( $invoice ) {
26
-    if ( empty( $invoice ) ) {
25
+function wpinv_display_invoice_top_bar($invoice) {
26
+    if (empty($invoice)) {
27 27
         return;
28 28
     }
29 29
     ?>
30 30
     <div class="row wpinv-top-bar no-print">
31 31
         <div class="container">
32 32
             <div class="col-xs-6">
33
-                <?php do_action( 'wpinv_invoice_top_bar_left', $invoice );?>
33
+                <?php do_action('wpinv_invoice_top_bar_left', $invoice); ?>
34 34
             </div>
35 35
             <div class="col-xs-6 text-right">
36
-                <?php do_action( 'wpinv_invoice_top_bar_right', $invoice );?>
36
+                <?php do_action('wpinv_invoice_top_bar_right', $invoice); ?>
37 37
             </div>
38 38
         </div>
39 39
     </div>
40 40
     <?php
41 41
 }
42 42
 
43
-function wpinv_invoice_display_left_actions( $invoice ) {
44
-    if ( empty( $invoice ) ) {
43
+function wpinv_invoice_display_left_actions($invoice) {
44
+    if (empty($invoice)) {
45 45
         return; // Exit if invoice is not set.
46 46
     }
47 47
     
48
-    if ( $invoice->post_type == 'wpi_invoice' ) {
49
-        if ( $invoice->needs_payment() ) {
50
-            ?> <a class="btn btn-success btn-sm" title="<?php esc_attr_e( 'Pay This Invoice', 'invoicing' ); ?>" href="<?php echo esc_url( $invoice->get_checkout_payment_url() ); ?>"><?php _e( 'Pay For Invoice', 'invoicing' ); ?></a><?php
48
+    if ($invoice->post_type == 'wpi_invoice') {
49
+        if ($invoice->needs_payment()) {
50
+            ?> <a class="btn btn-success btn-sm" title="<?php esc_attr_e('Pay This Invoice', 'invoicing'); ?>" href="<?php echo esc_url($invoice->get_checkout_payment_url()); ?>"><?php _e('Pay For Invoice', 'invoicing'); ?></a><?php
51 51
         }
52 52
     }
53 53
     do_action('wpinv_invoice_display_left_actions', $invoice);
54 54
 }
55 55
 
56
-function wpinv_invoice_display_right_actions( $invoice ) {
57
-    if ( empty( $invoice ) ) {
56
+function wpinv_invoice_display_right_actions($invoice) {
57
+    if (empty($invoice)) {
58 58
         return; // Exit if invoice is not set.
59 59
     }
60 60
 
61
-    if ( $invoice->post_type == 'wpi_invoice' ) { ?>
62
-        <a class="btn btn-primary btn-sm btn-print-invoice" onclick="window.print();" href="javascript:void(0)"><?php _e( 'Print Invoice', 'invoicing' ); ?></a>
63
-        <?php if ( is_user_logged_in() ) { ?>
64
-        &nbsp;&nbsp;<a class="btn btn-warning btn-sm btn-invoice-history" href="<?php echo esc_url( wpinv_get_history_page_uri() ); ?>"><?php _e( 'Invoice History', 'invoicing' ); ?></a>
61
+    if ($invoice->post_type == 'wpi_invoice') { ?>
62
+        <a class="btn btn-primary btn-sm btn-print-invoice" onclick="window.print();" href="javascript:void(0)"><?php _e('Print Invoice', 'invoicing'); ?></a>
63
+        <?php if (is_user_logged_in()) { ?>
64
+        &nbsp;&nbsp;<a class="btn btn-warning btn-sm btn-invoice-history" href="<?php echo esc_url(wpinv_get_history_page_uri()); ?>"><?php _e('Invoice History', 'invoicing'); ?></a>
65 65
         <?php }
66 66
     }
67 67
     do_action('wpinv_invoice_display_right_actions', $invoice);
68 68
 }
69 69
 
70
-function wpinv_before_invoice_content( $content ) {
70
+function wpinv_before_invoice_content($content) {
71 71
     global $post;
72 72
 
73
-    if ( !empty( $post ) && $post->post_type == 'wpi_invoice' && is_singular( 'wpi_invoice' ) && is_main_query() ) {
73
+    if (!empty($post) && $post->post_type == 'wpi_invoice' && is_singular('wpi_invoice') && is_main_query()) {
74 74
         ob_start();
75
-        do_action( 'wpinv_before_invoice_content', $post->ID );
75
+        do_action('wpinv_before_invoice_content', $post->ID);
76 76
         $content = ob_get_clean() . $content;
77 77
     }
78 78
 
79 79
     return $content;
80 80
 }
81
-add_filter( 'the_content', 'wpinv_before_invoice_content' );
81
+add_filter('the_content', 'wpinv_before_invoice_content');
82 82
 
83
-function wpinv_after_invoice_content( $content ) {
83
+function wpinv_after_invoice_content($content) {
84 84
     global $post;
85 85
 
86
-    if ( !empty( $post ) && $post->post_type == 'wpi_invoice' && is_singular( 'wpi_invoice' ) && is_main_query() ) {
86
+    if (!empty($post) && $post->post_type == 'wpi_invoice' && is_singular('wpi_invoice') && is_main_query()) {
87 87
         ob_start();
88
-        do_action( 'wpinv_after_invoice_content', $post->ID );
88
+        do_action('wpinv_after_invoice_content', $post->ID);
89 89
         $content .= ob_get_clean();
90 90
     }
91 91
 
92 92
     return $content;
93 93
 }
94
-add_filter( 'the_content', 'wpinv_after_invoice_content' );
94
+add_filter('the_content', 'wpinv_after_invoice_content');
95 95
 
96 96
 function wpinv_get_templates_dir() {
97 97
     return WPINV_PLUGIN_DIR . 'templates';
@@ -101,105 +101,105 @@  discard block
 block discarded – undo
101 101
     return WPINV_PLUGIN_URL . 'templates';
102 102
 }
103 103
 
104
-function wpinv_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
105
-    if ( ! empty( $args ) && is_array( $args ) ) {
106
-		extract( $args );
104
+function wpinv_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
105
+    if (!empty($args) && is_array($args)) {
106
+		extract($args);
107 107
 	}
108 108
 
109
-	$located = wpinv_locate_template( $template_name, $template_path, $default_path );
109
+	$located = wpinv_locate_template($template_name, $template_path, $default_path);
110 110
 	// Allow 3rd party plugin filter template file from their plugin.
111
-	$located = apply_filters( 'wpinv_get_template', $located, $template_name, $args, $template_path, $default_path );
111
+	$located = apply_filters('wpinv_get_template', $located, $template_name, $args, $template_path, $default_path);
112 112
 
113
-	if ( ! file_exists( $located ) ) {
114
-        _doing_it_wrong( __FUNCTION__, sprintf( '<code>%s</code> does not exist.', $located ), '2.1' );
113
+	if (!file_exists($located)) {
114
+        _doing_it_wrong(__FUNCTION__, sprintf('<code>%s</code> does not exist.', $located), '2.1');
115 115
 		return;
116 116
 	}
117 117
 
118
-	do_action( 'wpinv_before_template_part', $template_name, $template_path, $located, $args );
118
+	do_action('wpinv_before_template_part', $template_name, $template_path, $located, $args);
119 119
 
120
-	include( $located );
120
+	include($located);
121 121
 
122
-	do_action( 'wpinv_after_template_part', $template_name, $template_path, $located, $args );
122
+	do_action('wpinv_after_template_part', $template_name, $template_path, $located, $args);
123 123
 }
124 124
 
125
-function wpinv_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
125
+function wpinv_get_template_html($template_name, $args = array(), $template_path = '', $default_path = '') {
126 126
 	ob_start();
127
-	wpinv_get_template( $template_name, $args, $template_path, $default_path );
127
+	wpinv_get_template($template_name, $args, $template_path, $default_path);
128 128
 	return ob_get_clean();
129 129
 }
130 130
 
131
-function wpinv_locate_template( $template_name, $template_path = '', $default_path = '' ) {
132
-    if ( ! $template_path ) {
131
+function wpinv_locate_template($template_name, $template_path = '', $default_path = '') {
132
+    if (!$template_path) {
133 133
         $template_path = wpinv_template_path();
134 134
     }
135 135
 
136
-    if ( ! $default_path ) {
136
+    if (!$default_path) {
137 137
         $default_path = WPINV_PLUGIN_DIR . 'templates/';
138 138
     }
139 139
 
140 140
     // Look within passed path within the theme - this is priority.
141 141
     $template = locate_template(
142 142
         array(
143
-            trailingslashit( $template_path ) . $template_name,
143
+            trailingslashit($template_path) . $template_name,
144 144
             $template_name
145 145
         )
146 146
     );
147 147
 
148 148
     // Get default templates/
149
-    if ( !$template && $default_path ) {
150
-        $template = trailingslashit( $default_path ) . $template_name;
149
+    if (!$template && $default_path) {
150
+        $template = trailingslashit($default_path) . $template_name;
151 151
     }
152 152
 
153 153
     // Return what we found.
154
-    return apply_filters( 'wpinv_locate_template', $template, $template_name, $template_path );
154
+    return apply_filters('wpinv_locate_template', $template, $template_name, $template_path);
155 155
 }
156 156
 
157
-function wpinv_get_template_part( $slug, $name = null, $load = true ) {
158
-	do_action( 'get_template_part_' . $slug, $slug, $name );
157
+function wpinv_get_template_part($slug, $name = null, $load = true) {
158
+	do_action('get_template_part_' . $slug, $slug, $name);
159 159
 
160 160
 	// Setup possible parts
161 161
 	$templates = array();
162
-	if ( isset( $name ) )
162
+	if (isset($name))
163 163
 		$templates[] = $slug . '-' . $name . '.php';
164 164
 	$templates[] = $slug . '.php';
165 165
 
166 166
 	// Allow template parts to be filtered
167
-	$templates = apply_filters( 'wpinv_get_template_part', $templates, $slug, $name );
167
+	$templates = apply_filters('wpinv_get_template_part', $templates, $slug, $name);
168 168
 
169 169
 	// Return the part that is found
170
-	return wpinv_locate_tmpl( $templates, $load, false );
170
+	return wpinv_locate_tmpl($templates, $load, false);
171 171
 }
172 172
 
173
-function wpinv_locate_tmpl( $template_names, $load = false, $require_once = true ) {
173
+function wpinv_locate_tmpl($template_names, $load = false, $require_once = true) {
174 174
 	// No file found yet
175 175
 	$located = false;
176 176
 
177 177
 	// Try to find a template file
178
-	foreach ( (array)$template_names as $template_name ) {
178
+	foreach ((array) $template_names as $template_name) {
179 179
 
180 180
 		// Continue if template is empty
181
-		if ( empty( $template_name ) )
181
+		if (empty($template_name))
182 182
 			continue;
183 183
 
184 184
 		// Trim off any slashes from the template name
185
-		$template_name = ltrim( $template_name, '/' );
185
+		$template_name = ltrim($template_name, '/');
186 186
 
187 187
 		// try locating this template file by looping through the template paths
188
-		foreach( wpinv_get_theme_template_paths() as $template_path ) {
188
+		foreach (wpinv_get_theme_template_paths() as $template_path) {
189 189
 
190
-			if( file_exists( $template_path . $template_name ) ) {
190
+			if (file_exists($template_path . $template_name)) {
191 191
 				$located = $template_path . $template_name;
192 192
 				break;
193 193
 			}
194 194
 		}
195 195
 
196
-		if( !empty( $located ) ) {
196
+		if (!empty($located)) {
197 197
 			break;
198 198
 		}
199 199
 	}
200 200
 
201
-	if ( ( true == $load ) && ! empty( $located ) )
202
-		load_template( $located, $require_once );
201
+	if ((true == $load) && !empty($located))
202
+		load_template($located, $require_once);
203 203
 
204 204
 	return $located;
205 205
 }
@@ -208,159 +208,159 @@  discard block
 block discarded – undo
208 208
 	$template_dir = wpinv_get_theme_template_dir_name();
209 209
 
210 210
 	$file_paths = array(
211
-		1 => trailingslashit( get_stylesheet_directory() ) . $template_dir,
212
-		10 => trailingslashit( get_template_directory() ) . $template_dir,
211
+		1 => trailingslashit(get_stylesheet_directory()) . $template_dir,
212
+		10 => trailingslashit(get_template_directory()) . $template_dir,
213 213
 		100 => wpinv_get_templates_dir()
214 214
 	);
215 215
 
216
-	$file_paths = apply_filters( 'wpinv_template_paths', $file_paths );
216
+	$file_paths = apply_filters('wpinv_template_paths', $file_paths);
217 217
 
218 218
 	// sort the file paths based on priority
219
-	ksort( $file_paths, SORT_NUMERIC );
219
+	ksort($file_paths, SORT_NUMERIC);
220 220
 
221
-	return array_map( 'trailingslashit', $file_paths );
221
+	return array_map('trailingslashit', $file_paths);
222 222
 }
223 223
 
224 224
 function wpinv_get_theme_template_dir_name() {
225
-	return trailingslashit( apply_filters( 'wpinv_templates_dir', 'invoicing' ) );
225
+	return trailingslashit(apply_filters('wpinv_templates_dir', 'invoicing'));
226 226
 }
227 227
 
228 228
 function wpinv_checkout_meta_tags() {
229 229
 
230 230
 	$pages   = array();
231
-	$pages[] = wpinv_get_option( 'success_page' );
232
-	$pages[] = wpinv_get_option( 'failure_page' );
233
-	$pages[] = wpinv_get_option( 'invoice_history_page' );
234
-	$pages[] = wpinv_get_option( 'invoice_subscription_page' );
231
+	$pages[] = wpinv_get_option('success_page');
232
+	$pages[] = wpinv_get_option('failure_page');
233
+	$pages[] = wpinv_get_option('invoice_history_page');
234
+	$pages[] = wpinv_get_option('invoice_subscription_page');
235 235
 
236
-	if( !wpinv_is_checkout() && !is_page( $pages ) ) {
236
+	if (!wpinv_is_checkout() && !is_page($pages)) {
237 237
 		return;
238 238
 	}
239 239
 
240 240
 	echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
241 241
 }
242
-add_action( 'wp_head', 'wpinv_checkout_meta_tags' );
242
+add_action('wp_head', 'wpinv_checkout_meta_tags');
243 243
 
244
-function wpinv_add_body_classes( $class ) {
245
-	$classes = (array)$class;
244
+function wpinv_add_body_classes($class) {
245
+	$classes = (array) $class;
246 246
 
247
-	if( wpinv_is_checkout() ) {
247
+	if (wpinv_is_checkout()) {
248 248
 		$classes[] = 'wpinv-checkout';
249 249
 		$classes[] = 'wpinv-page';
250 250
 	}
251 251
 
252
-	if( wpinv_is_success_page() ) {
252
+	if (wpinv_is_success_page()) {
253 253
 		$classes[] = 'wpinv-success';
254 254
 		$classes[] = 'wpinv-page';
255 255
 	}
256 256
 
257
-	if( wpinv_is_failed_transaction_page() ) {
257
+	if (wpinv_is_failed_transaction_page()) {
258 258
 		$classes[] = 'wpinv-failed-transaction';
259 259
 		$classes[] = 'wpinv-page';
260 260
 	}
261 261
 
262
-	if( wpinv_is_invoice_history_page() ) {
262
+	if (wpinv_is_invoice_history_page()) {
263 263
 		$classes[] = 'wpinv-history';
264 264
 		$classes[] = 'wpinv-page';
265 265
 	}
266 266
 
267
-	if( wpinv_is_subscriptions_history_page() ) {
267
+	if (wpinv_is_subscriptions_history_page()) {
268 268
 		$classes[] = 'wpinv-subscription';
269 269
 		$classes[] = 'wpinv-page';
270 270
 	}
271 271
 
272
-	if( wpinv_is_test_mode() ) {
272
+	if (wpinv_is_test_mode()) {
273 273
 		$classes[] = 'wpinv-test-mode';
274 274
 		$classes[] = 'wpinv-page';
275 275
 	}
276 276
 
277
-	return array_unique( $classes );
277
+	return array_unique($classes);
278 278
 }
279
-add_filter( 'body_class', 'wpinv_add_body_classes' );
279
+add_filter('body_class', 'wpinv_add_body_classes');
280 280
 
281
-function wpinv_html_dropdown( $name = 'wpinv_discounts', $selected = 0, $status = '' ) {
282
-    $args = array( 'nopaging' => true );
281
+function wpinv_html_dropdown($name = 'wpinv_discounts', $selected = 0, $status = '') {
282
+    $args = array('nopaging' => true);
283 283
 
284
-    if ( ! empty( $status ) )
284
+    if (!empty($status))
285 285
         $args['post_status'] = $status;
286 286
 
287
-    $discounts = wpinv_get_discounts( $args );
287
+    $discounts = wpinv_get_discounts($args);
288 288
     $options   = array();
289 289
 
290
-    if ( $discounts ) {
291
-        foreach ( $discounts as $discount ) {
292
-            $options[ absint( $discount->ID ) ] = esc_html( get_the_title( $discount->ID ) );
290
+    if ($discounts) {
291
+        foreach ($discounts as $discount) {
292
+            $options[absint($discount->ID)] = esc_html(get_the_title($discount->ID));
293 293
         }
294 294
     } else {
295
-        $options[0] = __( 'No discounts found', 'invoicing' );
295
+        $options[0] = __('No discounts found', 'invoicing');
296 296
     }
297 297
 
298
-    $output = wpinv_html_select( array(
298
+    $output = wpinv_html_select(array(
299 299
         'name'             => $name,
300 300
         'selected'         => $selected,
301 301
         'options'          => $options,
302 302
         'show_option_all'  => false,
303 303
         'show_option_none' => false,
304
-    ) );
304
+    ));
305 305
 
306 306
     return $output;
307 307
 }
308 308
 
309
-function wpinv_html_year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
310
-    $current     = date( 'Y' );
311
-    $start_year  = $current - absint( $years_before );
312
-    $end_year    = $current + absint( $years_after );
313
-    $selected    = empty( $selected ) ? date( 'Y' ) : $selected;
309
+function wpinv_html_year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
310
+    $current     = date('Y');
311
+    $start_year  = $current - absint($years_before);
312
+    $end_year    = $current + absint($years_after);
313
+    $selected    = empty($selected) ? date('Y') : $selected;
314 314
     $options     = array();
315 315
 
316
-    while ( $start_year <= $end_year ) {
317
-        $options[ absint( $start_year ) ] = $start_year;
316
+    while ($start_year <= $end_year) {
317
+        $options[absint($start_year)] = $start_year;
318 318
         $start_year++;
319 319
     }
320 320
 
321
-    $output = wpinv_html_select( array(
321
+    $output = wpinv_html_select(array(
322 322
         'name'             => $name,
323 323
         'selected'         => $selected,
324 324
         'options'          => $options,
325 325
         'show_option_all'  => false,
326 326
         'show_option_none' => false
327
-    ) );
327
+    ));
328 328
 
329 329
     return $output;
330 330
 }
331 331
 
332
-function wpinv_html_month_dropdown( $name = 'month', $selected = 0 ) {
332
+function wpinv_html_month_dropdown($name = 'month', $selected = 0) {
333 333
 
334 334
     $options = array(
335
-        '1'  => __( 'January', 'invoicing' ),
336
-        '2'  => __( 'February', 'invoicing' ),
337
-        '3'  => __( 'March', 'invoicing' ),
338
-        '4'  => __( 'April', 'invoicing' ),
339
-        '5'  => __( 'May', 'invoicing' ),
340
-        '6'  => __( 'June', 'invoicing' ),
341
-        '7'  => __( 'July', 'invoicing' ),
342
-        '8'  => __( 'August', 'invoicing' ),
343
-        '9'  => __( 'September', 'invoicing' ),
344
-        '10' => __( 'October', 'invoicing' ),
345
-        '11' => __( 'November', 'invoicing' ),
346
-        '12' => __( 'December', 'invoicing' ),
335
+        '1'  => __('January', 'invoicing'),
336
+        '2'  => __('February', 'invoicing'),
337
+        '3'  => __('March', 'invoicing'),
338
+        '4'  => __('April', 'invoicing'),
339
+        '5'  => __('May', 'invoicing'),
340
+        '6'  => __('June', 'invoicing'),
341
+        '7'  => __('July', 'invoicing'),
342
+        '8'  => __('August', 'invoicing'),
343
+        '9'  => __('September', 'invoicing'),
344
+        '10' => __('October', 'invoicing'),
345
+        '11' => __('November', 'invoicing'),
346
+        '12' => __('December', 'invoicing'),
347 347
     );
348 348
 
349 349
     // If no month is selected, default to the current month
350
-    $selected = empty( $selected ) ? date( 'n' ) : $selected;
350
+    $selected = empty($selected) ? date('n') : $selected;
351 351
 
352
-    $output = wpinv_html_select( array(
352
+    $output = wpinv_html_select(array(
353 353
         'name'             => $name,
354 354
         'selected'         => $selected,
355 355
         'options'          => $options,
356 356
         'show_option_all'  => false,
357 357
         'show_option_none' => false
358
-    ) );
358
+    ));
359 359
 
360 360
     return $output;
361 361
 }
362 362
 
363
-function wpinv_html_select( $args = array() ) {
363
+function wpinv_html_select($args = array()) {
364 364
     $defaults = array(
365 365
         'options'          => array(),
366 366
         'name'             => null,
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
         'selected'         => 0,
370 370
         'placeholder'      => null,
371 371
         'multiple'         => false,
372
-        'show_option_all'  => _x( 'All', 'all dropdown items', 'invoicing' ),
373
-        'show_option_none' => _x( 'None', 'no dropdown items', 'invoicing' ),
372
+        'show_option_all'  => _x('All', 'all dropdown items', 'invoicing'),
373
+        'show_option_none' => _x('None', 'no dropdown items', 'invoicing'),
374 374
         'data'             => array(),
375 375
         'onchange'         => null,
376 376
         'required'         => false,
@@ -378,74 +378,74 @@  discard block
 block discarded – undo
378 378
         'readonly'         => false,
379 379
     );
380 380
 
381
-    $args = wp_parse_args( $args, $defaults );
381
+    $args = wp_parse_args($args, $defaults);
382 382
 
383 383
     $data_elements = '';
384
-    foreach ( $args['data'] as $key => $value ) {
385
-        $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
384
+    foreach ($args['data'] as $key => $value) {
385
+        $data_elements .= ' data-' . esc_attr($key) . '="' . esc_attr($value) . '"';
386 386
     }
387 387
 
388
-    if( $args['multiple'] ) {
388
+    if ($args['multiple']) {
389 389
         $multiple = ' MULTIPLE';
390 390
     } else {
391 391
         $multiple = '';
392 392
     }
393 393
 
394
-    if( $args['placeholder'] ) {
394
+    if ($args['placeholder']) {
395 395
         $placeholder = $args['placeholder'];
396 396
     } else {
397 397
         $placeholder = '';
398 398
     }
399 399
     
400 400
     $options = '';
401
-    if( !empty( $args['onchange'] ) ) {
402
-        $options .= ' onchange="' . esc_attr( $args['onchange'] ) . '"';
401
+    if (!empty($args['onchange'])) {
402
+        $options .= ' onchange="' . esc_attr($args['onchange']) . '"';
403 403
     }
404 404
     
405
-    if( !empty( $args['required'] ) ) {
405
+    if (!empty($args['required'])) {
406 406
         $options .= ' required="required"';
407 407
     }
408 408
     
409
-    if( !empty( $args['disabled'] ) ) {
409
+    if (!empty($args['disabled'])) {
410 410
         $options .= ' disabled';
411 411
     }
412 412
     
413
-    if( !empty( $args['readonly'] ) ) {
413
+    if (!empty($args['readonly'])) {
414 414
         $options .= ' readonly';
415 415
     }
416 416
 
417
-    $class  = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
418
-    $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] ) . '" class="wpinv-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '" ' . trim( $options ) . $data_elements . '>';
417
+    $class  = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
418
+    $output = '<select name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['id']) . '" class="wpinv-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '" ' . trim($options) . $data_elements . '>';
419 419
 
420
-    if ( $args['show_option_all'] ) {
421
-        if( $args['multiple'] ) {
422
-            $selected = selected( true, in_array( 0, $args['selected'] ), false );
420
+    if ($args['show_option_all']) {
421
+        if ($args['multiple']) {
422
+            $selected = selected(true, in_array(0, $args['selected']), false);
423 423
         } else {
424
-            $selected = selected( $args['selected'], 0, false );
424
+            $selected = selected($args['selected'], 0, false);
425 425
         }
426
-        $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
426
+        $output .= '<option value="all"' . $selected . '>' . esc_html($args['show_option_all']) . '</option>';
427 427
     }
428 428
 
429
-    if ( !empty( $args['options'] ) ) {
429
+    if (!empty($args['options'])) {
430 430
 
431
-        if ( $args['show_option_none'] ) {
432
-            if( $args['multiple'] ) {
433
-                $selected = selected( true, in_array( "", $args['selected'] ), false );
431
+        if ($args['show_option_none']) {
432
+            if ($args['multiple']) {
433
+                $selected = selected(true, in_array("", $args['selected']), false);
434 434
             } else {
435
-                $selected = selected( $args['selected'] === "", true, false );
435
+                $selected = selected($args['selected'] === "", true, false);
436 436
             }
437
-            $output .= '<option value=""' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
437
+            $output .= '<option value=""' . $selected . '>' . esc_html($args['show_option_none']) . '</option>';
438 438
         }
439 439
 
440
-        foreach( $args['options'] as $key => $option ) {
440
+        foreach ($args['options'] as $key => $option) {
441 441
 
442
-            if( $args['multiple'] && is_array( $args['selected'] ) ) {
443
-                $selected = selected( true, (bool)in_array( $key, $args['selected'] ), false );
442
+            if ($args['multiple'] && is_array($args['selected'])) {
443
+                $selected = selected(true, (bool) in_array($key, $args['selected']), false);
444 444
             } else {
445
-                $selected = selected( $args['selected'], $key, false );
445
+                $selected = selected($args['selected'], $key, false);
446 446
             }
447 447
 
448
-            $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
448
+            $output .= '<option value="' . esc_attr($key) . '"' . $selected . '>' . esc_html($option) . '</option>';
449 449
         }
450 450
     }
451 451
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
     return $output;
455 455
 }
456 456
 
457
-function wpinv_item_dropdown( $args = array() ) {
457
+function wpinv_item_dropdown($args = array()) {
458 458
     $defaults = array(
459 459
         'name'              => 'wpi_item',
460 460
         'id'                => 'wpi_item',
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
         'multiple'          => false,
463 463
         'selected'          => 0,
464 464
         'number'            => 100,
465
-        'placeholder'       => __( 'Choose a item', 'invoicing' ),
466
-        'data'              => array( 'search-type' => 'item' ),
465
+        'placeholder'       => __('Choose a item', 'invoicing'),
466
+        'data'              => array('search-type' => 'item'),
467 467
         'show_option_all'   => false,
468 468
         'show_option_none'  => false,
469 469
         'show_recurring'    => false,
470 470
     );
471 471
 
472
-    $args = wp_parse_args( $args, $defaults );
472
+    $args = wp_parse_args($args, $defaults);
473 473
 
474 474
     $item_args = array(
475 475
         'post_type'      => 'wpi_item',
@@ -478,44 +478,44 @@  discard block
 block discarded – undo
478 478
         'posts_per_page' => $args['number']
479 479
     );
480 480
     
481
-    $item_args  = apply_filters( 'wpinv_item_dropdown_query_args', $item_args, $args, $defaults );
481
+    $item_args  = apply_filters('wpinv_item_dropdown_query_args', $item_args, $args, $defaults);
482 482
 
483
-    $items      = get_posts( $item_args );
483
+    $items      = get_posts($item_args);
484 484
     $options    = array();
485
-    if ( $items ) {
486
-        foreach ( $items as $item ) {
487
-            $title = esc_html( $item->post_title );
485
+    if ($items) {
486
+        foreach ($items as $item) {
487
+            $title = esc_html($item->post_title);
488 488
             
489
-            if ( !empty( $args['show_recurring'] ) ) {
490
-                $title .= wpinv_get_item_suffix( $item->ID, false );
489
+            if (!empty($args['show_recurring'])) {
490
+                $title .= wpinv_get_item_suffix($item->ID, false);
491 491
             }
492 492
             
493
-            $options[ absint( $item->ID ) ] = $title;
493
+            $options[absint($item->ID)] = $title;
494 494
         }
495 495
     }
496 496
 
497 497
     // This ensures that any selected items are included in the drop down
498
-    if( is_array( $args['selected'] ) ) {
499
-        foreach( $args['selected'] as $item ) {
500
-            if( ! in_array( $item, $options ) ) {
501
-                $title = get_the_title( $item );
502
-                if ( !empty( $args['show_recurring'] ) ) {
503
-                    $title .= wpinv_get_item_suffix( $item, false );
498
+    if (is_array($args['selected'])) {
499
+        foreach ($args['selected'] as $item) {
500
+            if (!in_array($item, $options)) {
501
+                $title = get_the_title($item);
502
+                if (!empty($args['show_recurring'])) {
503
+                    $title .= wpinv_get_item_suffix($item, false);
504 504
                 }
505 505
                 $options[$item] = $title;
506 506
             }
507 507
         }
508
-    } elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
509
-        if ( ! in_array( $args['selected'], $options ) ) {
510
-            $title = get_the_title( $args['selected'] );
511
-            if ( !empty( $args['show_recurring'] ) ) {
512
-                $title .= wpinv_get_item_suffix( $args['selected'], false );
508
+    } elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
509
+        if (!in_array($args['selected'], $options)) {
510
+            $title = get_the_title($args['selected']);
511
+            if (!empty($args['show_recurring'])) {
512
+                $title .= wpinv_get_item_suffix($args['selected'], false);
513 513
             }
514
-            $options[$args['selected']] = get_the_title( $args['selected'] );
514
+            $options[$args['selected']] = get_the_title($args['selected']);
515 515
         }
516 516
     }
517 517
 
518
-    $output = wpinv_html_select( array(
518
+    $output = wpinv_html_select(array(
519 519
         'name'             => $args['name'],
520 520
         'selected'         => $args['selected'],
521 521
         'id'               => $args['id'],
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
         'show_option_all'  => $args['show_option_all'],
527 527
         'show_option_none' => $args['show_option_none'],
528 528
         'data'             => $args['data'],
529
-    ) );
529
+    ));
530 530
 
531 531
     return $output;
532 532
 }
533 533
 
534
-function wpinv_html_checkbox( $args = array() ) {
534
+function wpinv_html_checkbox($args = array()) {
535 535
     $defaults = array(
536 536
         'name'     => null,
537 537
         'current'  => null,
@@ -542,38 +542,38 @@  discard block
 block discarded – undo
542 542
         )
543 543
     );
544 544
 
545
-    $args = wp_parse_args( $args, $defaults );
545
+    $args = wp_parse_args($args, $defaults);
546 546
 
547
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
547
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
548 548
     $options = '';
549
-    if ( ! empty( $args['options']['disabled'] ) ) {
549
+    if (!empty($args['options']['disabled'])) {
550 550
         $options .= ' disabled="disabled"';
551
-    } elseif ( ! empty( $args['options']['readonly'] ) ) {
551
+    } elseif (!empty($args['options']['readonly'])) {
552 552
         $options .= ' readonly';
553 553
     }
554 554
 
555
-    $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $class . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
555
+    $output = '<input type="checkbox"' . $options . ' name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['name']) . '" class="' . $class . ' ' . esc_attr($args['name']) . '" ' . checked(1, $args['current'], false) . ' />';
556 556
 
557 557
     return $output;
558 558
 }
559 559
 
560
-function wpinv_html_text( $args = array() ) {
560
+function wpinv_html_text($args = array()) {
561 561
     // Backwards compatibility
562
-    if ( func_num_args() > 1 ) {
562
+    if (func_num_args() > 1) {
563 563
         $args = func_get_args();
564 564
 
565 565
         $name  = $args[0];
566
-        $value = isset( $args[1] ) ? $args[1] : '';
567
-        $label = isset( $args[2] ) ? $args[2] : '';
568
-        $desc  = isset( $args[3] ) ? $args[3] : '';
566
+        $value = isset($args[1]) ? $args[1] : '';
567
+        $label = isset($args[2]) ? $args[2] : '';
568
+        $desc  = isset($args[3]) ? $args[3] : '';
569 569
     }
570 570
 
571 571
     $defaults = array(
572 572
         'id'           => '',
573
-        'name'         => isset( $name )  ? $name  : 'text',
574
-        'value'        => isset( $value ) ? $value : null,
575
-        'label'        => isset( $label ) ? $label : null,
576
-        'desc'         => isset( $desc )  ? $desc  : null,
573
+        'name'         => isset($name) ? $name : 'text',
574
+        'value'        => isset($value) ? $value : null,
575
+        'label'        => isset($label) ? $label : null,
576
+        'desc'         => isset($desc) ? $desc : null,
577 577
         'placeholder'  => '',
578 578
         'class'        => 'regular-text',
579 579
         'disabled'     => false,
@@ -583,51 +583,51 @@  discard block
 block discarded – undo
583 583
         'data'         => false
584 584
     );
585 585
 
586
-    $args = wp_parse_args( $args, $defaults );
586
+    $args = wp_parse_args($args, $defaults);
587 587
 
588
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
588
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
589 589
     $options = '';
590
-    if( $args['required'] ) {
590
+    if ($args['required']) {
591 591
         $options .= ' required="required"';
592 592
     }
593
-    if( $args['readonly'] ) {
593
+    if ($args['readonly']) {
594 594
         $options .= ' readonly';
595 595
     }
596
-    if( $args['readonly'] ) {
596
+    if ($args['readonly']) {
597 597
         $options .= ' readonly';
598 598
     }
599 599
 
600 600
     $data = '';
601
-    if ( !empty( $args['data'] ) ) {
602
-        foreach ( $args['data'] as $key => $value ) {
603
-            $data .= 'data-' . wpinv_sanitize_key( $key ) . '="' . esc_attr( $value ) . '" ';
601
+    if (!empty($args['data'])) {
602
+        foreach ($args['data'] as $key => $value) {
603
+            $data .= 'data-' . wpinv_sanitize_key($key) . '="' . esc_attr($value) . '" ';
604 604
         }
605 605
     }
606 606
 
607
-    $output = '<span id="wpinv-' . wpinv_sanitize_key( $args['name'] ) . '-wrap">';
608
-    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key( $args['id'] ) . '">' . esc_html( $args['label'] ) . '</label>';
609
-    if ( ! empty( $args['desc'] ) ) {
610
-        $output .= '<span class="wpinv-description">' . esc_html( $args['desc'] ) . '</span>';
607
+    $output = '<span id="wpinv-' . wpinv_sanitize_key($args['name']) . '-wrap">';
608
+    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key($args['id']) . '">' . esc_html($args['label']) . '</label>';
609
+    if (!empty($args['desc'])) {
610
+        $output .= '<span class="wpinv-description">' . esc_html($args['desc']) . '</span>';
611 611
     }
612 612
 
613
-    $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] )  . '" autocomplete="' . esc_attr( $args['autocomplete'] )  . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $class . '" ' . $data . ' ' . trim( $options ) . '/>';
613
+    $output .= '<input type="text" name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['id']) . '" autocomplete="' . esc_attr($args['autocomplete']) . '" value="' . esc_attr($args['value']) . '" placeholder="' . esc_attr($args['placeholder']) . '" class="' . $class . '" ' . $data . ' ' . trim($options) . '/>';
614 614
 
615 615
     $output .= '</span>';
616 616
 
617 617
     return $output;
618 618
 }
619 619
 
620
-function wpinv_html_date_field( $args = array() ) {
621
-    if( empty( $args['class'] ) ) {
620
+function wpinv_html_date_field($args = array()) {
621
+    if (empty($args['class'])) {
622 622
         $args['class'] = 'wpiDatepicker';
623
-    } elseif( ! strpos( $args['class'], 'wpiDatepicker' ) ) {
623
+    } elseif (!strpos($args['class'], 'wpiDatepicker')) {
624 624
         $args['class'] .= ' wpiDatepicker';
625 625
     }
626 626
 
627
-    return wpinv_html_text( $args );
627
+    return wpinv_html_text($args);
628 628
 }
629 629
 
630
-function wpinv_html_textarea( $args = array() ) {
630
+function wpinv_html_textarea($args = array()) {
631 631
     $defaults = array(
632 632
         'name'        => 'textarea',
633 633
         'value'       => null,
@@ -638,31 +638,31 @@  discard block
 block discarded – undo
638 638
         'placeholder' => '',
639 639
     );
640 640
 
641
-    $args = wp_parse_args( $args, $defaults );
641
+    $args = wp_parse_args($args, $defaults);
642 642
 
643
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
643
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
644 644
     $disabled = '';
645
-    if( $args['disabled'] ) {
645
+    if ($args['disabled']) {
646 646
         $disabled = ' disabled="disabled"';
647 647
     }
648 648
 
649
-    $output = '<span id="wpinv-' . wpinv_sanitize_key( $args['name'] ) . '-wrap">';
650
-    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
651
-    $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" id="' . wpinv_sanitize_key( $args['name'] ) . '" class="' . $class . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
649
+    $output = '<span id="wpinv-' . wpinv_sanitize_key($args['name']) . '-wrap">';
650
+    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key($args['name']) . '">' . esc_html($args['label']) . '</label>';
651
+    $output .= '<textarea name="' . esc_attr($args['name']) . '" placeholder="' . esc_attr($args['placeholder']) . '" id="' . wpinv_sanitize_key($args['name']) . '" class="' . $class . '"' . $disabled . '>' . esc_attr($args['value']) . '</textarea>';
652 652
 
653
-    if ( ! empty( $args['desc'] ) ) {
654
-        $output .= '<span class="wpinv-description">' . esc_html( $args['desc'] ) . '</span>';
653
+    if (!empty($args['desc'])) {
654
+        $output .= '<span class="wpinv-description">' . esc_html($args['desc']) . '</span>';
655 655
     }
656 656
     $output .= '</span>';
657 657
 
658 658
     return $output;
659 659
 }
660 660
 
661
-function wpinv_html_ajax_user_search( $args = array() ) {
661
+function wpinv_html_ajax_user_search($args = array()) {
662 662
     $defaults = array(
663 663
         'name'        => 'user_id',
664 664
         'value'       => null,
665
-        'placeholder' => __( 'Enter username', 'invoicing' ),
665
+        'placeholder' => __('Enter username', 'invoicing'),
666 666
         'label'       => null,
667 667
         'desc'        => null,
668 668
         'class'       => '',
@@ -671,13 +671,13 @@  discard block
 block discarded – undo
671 671
         'data'        => false
672 672
     );
673 673
 
674
-    $args = wp_parse_args( $args, $defaults );
674
+    $args = wp_parse_args($args, $defaults);
675 675
 
676 676
     $args['class'] = 'wpinv-ajax-user-search ' . $args['class'];
677 677
 
678 678
     $output  = '<span class="wpinv_user_search_wrap">';
679
-        $output .= wpinv_html_text( $args );
680
-        $output .= '<span class="wpinv_user_search_results hidden"><a class="wpinv-ajax-user-cancel" title="' . __( 'Cancel', 'invoicing' ) . '" aria-label="' . __( 'Cancel', 'invoicing' ) . '" href="#">x</a><span></span></span>';
679
+        $output .= wpinv_html_text($args);
680
+        $output .= '<span class="wpinv_user_search_results hidden"><a class="wpinv-ajax-user-cancel" title="' . __('Cancel', 'invoicing') . '" aria-label="' . __('Cancel', 'invoicing') . '" href="#">x</a><span></span></span>';
681 681
     $output .= '</span>';
682 682
 
683 683
     return $output;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 function wpinv_ip_geolocation() {
687 687
     global $wpinv_euvat;
688 688
     
689
-    $ip         = !empty( $_GET['ip'] ) ? sanitize_text_field( $_GET['ip'] ) : '';    
689
+    $ip         = !empty($_GET['ip']) ? sanitize_text_field($_GET['ip']) : '';    
690 690
     $content    = '';
691 691
     $iso        = '';
692 692
     $country    = '';
@@ -697,69 +697,69 @@  discard block
 block discarded – undo
697 697
     $credit     = '';
698 698
     $address    = '';
699 699
     
700
-    if ( wpinv_get_option( 'vat_ip_lookup' ) == 'geoip2' && $geoip2_city = $wpinv_euvat->geoip2_city_record( $ip ) ) {
700
+    if (wpinv_get_option('vat_ip_lookup') == 'geoip2' && $geoip2_city = $wpinv_euvat->geoip2_city_record($ip)) {
701 701
         try {
702 702
             $iso        = $geoip2_city->country->isoCode;
703 703
             $country    = $geoip2_city->country->name;
704
-            $region     = !empty( $geoip2_city->subdivisions ) && !empty( $geoip2_city->subdivisions[0]->name ) ? $geoip2_city->subdivisions[0]->name : '';
704
+            $region     = !empty($geoip2_city->subdivisions) && !empty($geoip2_city->subdivisions[0]->name) ? $geoip2_city->subdivisions[0]->name : '';
705 705
             $city       = $geoip2_city->city->name;
706 706
             $longitude  = $geoip2_city->location->longitude;
707 707
             $latitude   = $geoip2_city->location->latitude;
708
-            $credit     = __( 'Geolocated using the information by MaxMind, available from <a href="http://www.maxmind.com" target="_blank">www.maxmind.com</a>', 'invoicing' );
709
-        } catch( Exception $e ) { }
708
+            $credit     = __('Geolocated using the information by MaxMind, available from <a href="http://www.maxmind.com" target="_blank">www.maxmind.com</a>', 'invoicing');
709
+        } catch (Exception $e) { }
710 710
     }
711 711
     
712
-    if ( !( $iso && $longitude && $latitude ) && function_exists( 'simplexml_load_file' ) ) {
712
+    if (!($iso && $longitude && $latitude) && function_exists('simplexml_load_file')) {
713 713
         try {
714
-            $load_xml = simplexml_load_file( 'http://www.geoplugin.net/xml.gp?ip=' . $ip );
714
+            $load_xml = simplexml_load_file('http://www.geoplugin.net/xml.gp?ip=' . $ip);
715 715
             
716
-            if ( !empty( $load_xml ) && isset( $load_xml->geoplugin_countryCode ) && !empty( $load_xml->geoplugin_latitude ) && !empty( $load_xml->geoplugin_longitude ) ) {
716
+            if (!empty($load_xml) && isset($load_xml->geoplugin_countryCode) && !empty($load_xml->geoplugin_latitude) && !empty($load_xml->geoplugin_longitude)) {
717 717
                 $iso        = $load_xml->geoplugin_countryCode;
718 718
                 $country    = $load_xml->geoplugin_countryName;
719
-                $region     = !empty( $load_xml->geoplugin_regionName ) ? $load_xml->geoplugin_regionName : '';
720
-                $city       = !empty( $load_xml->geoplugin_city ) ? $load_xml->geoplugin_city : '';
719
+                $region     = !empty($load_xml->geoplugin_regionName) ? $load_xml->geoplugin_regionName : '';
720
+                $city       = !empty($load_xml->geoplugin_city) ? $load_xml->geoplugin_city : '';
721 721
                 $longitude  = $load_xml->geoplugin_longitude;
722 722
                 $latitude   = $load_xml->geoplugin_latitude;
723 723
                 $credit     = $load_xml->geoplugin_credit;
724
-                $credit     = __( 'Geolocated using the information by geoPlugin, available from <a href="http://www.geoplugin.com" target="_blank">www.geoplugin.com</a>', 'invoicing' ) . '<br>' . $load_xml->geoplugin_credit;
724
+                $credit     = __('Geolocated using the information by geoPlugin, available from <a href="http://www.geoplugin.com" target="_blank">www.geoplugin.com</a>', 'invoicing') . '<br>' . $load_xml->geoplugin_credit;
725 725
             }
726
-        } catch( Exception $e ) { }
726
+        } catch (Exception $e) { }
727 727
     }
728 728
     
729
-    if ( $iso && $longitude && $latitude ) {
730
-        if ( $city ) {
729
+    if ($iso && $longitude && $latitude) {
730
+        if ($city) {
731 731
             $address .= $city . ', ';
732 732
         }
733 733
         
734
-        if ( $region ) {
734
+        if ($region) {
735 735
             $address .= $region . ', ';
736 736
         }
737 737
         
738 738
         $address .= $country . ' (' . $iso . ')';
739
-        $content = '<p>'. sprintf( __( '<b>Address:</b> %s', 'invoicing' ), $address ) . '</p>';
740
-        $content .= '<p>'. $credit . '</p>';
739
+        $content = '<p>' . sprintf(__('<b>Address:</b> %s', 'invoicing'), $address) . '</p>';
740
+        $content .= '<p>' . $credit . '</p>';
741 741
     } else {
742
-        $content = '<p>'. sprintf( __( 'Unable to find geolocation for the IP address: %s', 'invoicing' ), $ip ) . '</p>';
742
+        $content = '<p>' . sprintf(__('Unable to find geolocation for the IP address: %s', 'invoicing'), $ip) . '</p>';
743 743
     }
744 744
     ?>
745 745
 <!DOCTYPE html>
746
-<html><head><title><?php echo sprintf( __( 'IP: %s', 'invoicing' ), $ip );?></title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.1/leaflet.css" /><style>html,body{height:100%;margin:0;padding:0;width:100%}body{text-align:center;background:#fff;color:#222;font-size:small;}body,p{font-family: arial,sans-serif}#map{margin:auto;width:100%;height:calc(100% - 120px);min-height:240px}</style></head>
746
+<html><head><title><?php echo sprintf(__('IP: %s', 'invoicing'), $ip); ?></title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.1/leaflet.css" /><style>html,body{height:100%;margin:0;padding:0;width:100%}body{text-align:center;background:#fff;color:#222;font-size:small;}body,p{font-family: arial,sans-serif}#map{margin:auto;width:100%;height:calc(100% - 120px);min-height:240px}</style></head>
747 747
 <body>
748
-    <?php if ( $latitude && $latitude ) { ?>
748
+    <?php if ($latitude && $latitude) { ?>
749 749
     <div id="map"></div>
750 750
         <script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.1/leaflet.js"></script>
751 751
         <script type="text/javascript">
752 752
         var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
753 753
             osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
754 754
             osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
755
-            latlng = new L.LatLng(<?php echo $latitude;?>, <?php echo $longitude;?>);
755
+            latlng = new L.LatLng(<?php echo $latitude; ?>, <?php echo $longitude; ?>);
756 756
 
757 757
         var map = new L.Map('map', {center: latlng, zoom: 12, layers: [osm]});
758 758
 
759 759
         var marker = new L.Marker(latlng);
760 760
         map.addLayer(marker);
761 761
 
762
-        marker.bindPopup("<p><?php esc_attr_e( $address );?></p>");
762
+        marker.bindPopup("<p><?php esc_attr_e($address); ?></p>");
763 763
     </script>
764 764
     <?php } ?>
765 765
     <div style="height:100px"><?php echo $content; ?></div>
@@ -767,18 +767,18 @@  discard block
 block discarded – undo
767 767
 <?php
768 768
     exit;
769 769
 }
770
-add_action( 'wp_ajax_wpinv_ip_geolocation', 'wpinv_ip_geolocation' );
771
-add_action( 'wp_ajax_nopriv_wpinv_ip_geolocation', 'wpinv_ip_geolocation' );
770
+add_action('wp_ajax_wpinv_ip_geolocation', 'wpinv_ip_geolocation');
771
+add_action('wp_ajax_nopriv_wpinv_ip_geolocation', 'wpinv_ip_geolocation');
772 772
 
773 773
 // Set up the template for the invoice.
774
-function wpinv_template( $template ) {
774
+function wpinv_template($template) {
775 775
     global $post, $wp_query;
776 776
     
777
-    if ( ( is_single() || is_404() ) && !empty( $post->ID ) && (get_post_type( $post->ID ) == 'wpi_invoice' or get_post_type( $post->ID ) == 'wpi_quote')) {
778
-        if ( wpinv_user_can_view_invoice( $post->ID ) ) {
779
-            $template = wpinv_get_template_part( 'wpinv-invoice-print', false, false );
777
+    if ((is_single() || is_404()) && !empty($post->ID) && (get_post_type($post->ID) == 'wpi_invoice' or get_post_type($post->ID) == 'wpi_quote')) {
778
+        if (wpinv_user_can_view_invoice($post->ID)) {
779
+            $template = wpinv_get_template_part('wpinv-invoice-print', false, false);
780 780
         } else {
781
-            $template = wpinv_get_template_part( 'wpinv-invalid-access', false, false );
781
+            $template = wpinv_get_template_part('wpinv-invalid-access', false, false);
782 782
         }
783 783
     }
784 784
 
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 
788 788
 function wpinv_get_business_address() {
789 789
     $business_address   = wpinv_store_address();
790
-    $business_address   = !empty( $business_address ) ? wpautop( wp_kses_post( $business_address ) ) : '';
790
+    $business_address   = !empty($business_address) ? wpautop(wp_kses_post($business_address)) : '';
791 791
     
792 792
     /*
793 793
     $default_country    = wpinv_get_default_country();
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
     
812 812
     $business_address = $business_address ? '<div class="address">' . $business_address . '</div>' : '';
813 813
     
814
-    return apply_filters( 'wpinv_get_business_address', $business_address );
814
+    return apply_filters('wpinv_get_business_address', $business_address);
815 815
 }
816 816
 
817 817
 function wpinv_display_from_address() {
@@ -821,107 +821,107 @@  discard block
 block discarded – undo
821 821
     if (empty($from_name)) {
822 822
         $from_name = wpinv_get_business_name();
823 823
     }
824
-    ?><div class="from col-xs-2"><strong><?php _e( 'From:', 'invoicing' ) ?></strong></div>
824
+    ?><div class="from col-xs-2"><strong><?php _e('From:', 'invoicing') ?></strong></div>
825 825
     <div class="wrapper col-xs-10">
826
-        <div class="name"><?php echo esc_html( $from_name ); ?></div>
827
-        <?php if ( $address = wpinv_get_business_address() ) { ?>
828
-        <div class="address"><?php echo wpautop( wp_kses_post( $address ) );?></div>
826
+        <div class="name"><?php echo esc_html($from_name); ?></div>
827
+        <?php if ($address = wpinv_get_business_address()) { ?>
828
+        <div class="address"><?php echo wpautop(wp_kses_post($address)); ?></div>
829 829
         <?php } ?>
830
-        <?php if ( $email_from = wpinv_mail_get_from_address() ) { ?>
831
-        <div class="email_from"><?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), $email_from );?></div>
830
+        <?php if ($email_from = wpinv_mail_get_from_address()) { ?>
831
+        <div class="email_from"><?php echo wp_sprintf(__('Email: %s', 'invoicing'), $email_from); ?></div>
832 832
         <?php } ?>
833 833
     </div>
834 834
     <?php
835 835
 }
836 836
 
837
-function wpinv_watermark( $id = 0 ) {
838
-    $output = wpinv_get_watermark( $id );
837
+function wpinv_watermark($id = 0) {
838
+    $output = wpinv_get_watermark($id);
839 839
     
840
-    return apply_filters( 'wpinv_get_watermark', $output, $id );
840
+    return apply_filters('wpinv_get_watermark', $output, $id);
841 841
 }
842 842
 
843
-function wpinv_get_watermark( $id ) {
844
-    if ( !$id > 0 ) {
843
+function wpinv_get_watermark($id) {
844
+    if (!$id > 0) {
845 845
         return NULL;
846 846
     }
847
-    $invoice = wpinv_get_invoice( $id );
847
+    $invoice = wpinv_get_invoice($id);
848 848
     
849
-    if ( !empty( $invoice ) && "wpi_invoice" === $invoice->post_type ) {
850
-        if ( $invoice->is_paid() ) {
851
-            return __( 'Paid', 'invoicing' );
849
+    if (!empty($invoice) && "wpi_invoice" === $invoice->post_type) {
850
+        if ($invoice->is_paid()) {
851
+            return __('Paid', 'invoicing');
852 852
         }
853
-        if ( $invoice->is_refunded() ) {
854
-            return __( 'Refunded', 'invoicing' );
853
+        if ($invoice->is_refunded()) {
854
+            return __('Refunded', 'invoicing');
855 855
         }
856
-        if ( $invoice->has_status( array( 'wpi-cancelled' ) ) ) {
857
-            return __( 'Cancelled', 'invoicing' );
856
+        if ($invoice->has_status(array('wpi-cancelled'))) {
857
+            return __('Cancelled', 'invoicing');
858 858
         }
859 859
     }
860 860
     
861 861
     return NULL;
862 862
 }
863 863
 
864
-function wpinv_display_invoice_details( $invoice ) {
864
+function wpinv_display_invoice_details($invoice) {
865 865
     global $wpinv_euvat;
866 866
     
867 867
     $invoice_id = $invoice->ID;
868 868
     $vat_name   = $wpinv_euvat->get_vat_name();
869 869
     $use_taxes  = wpinv_use_taxes();
870 870
     
871
-    $invoice_status = wpinv_get_invoice_status( $invoice_id );
871
+    $invoice_status = wpinv_get_invoice_status($invoice_id);
872 872
     ?>
873 873
     <table class="table table-bordered table-sm">
874
-        <?php if ( $invoice_number = wpinv_get_invoice_number( $invoice_id ) ) { ?>
874
+        <?php if ($invoice_number = wpinv_get_invoice_number($invoice_id)) { ?>
875 875
             <tr class="wpi-row-number">
876
-                <th><?php echo apply_filters( 'wpinv_invoice_number_label', __( 'Invoice Number', 'invoicing' ), $invoice ); ?></th>
877
-                <td><?php echo esc_html( $invoice_number ); ?></td>
876
+                <th><?php echo apply_filters('wpinv_invoice_number_label', __('Invoice Number', 'invoicing'), $invoice); ?></th>
877
+                <td><?php echo esc_html($invoice_number); ?></td>
878 878
             </tr>
879 879
         <?php } ?>
880 880
         <tr class="wpi-row-status">
881
-            <th><?php echo apply_filters( 'wpinv_invoice_status_label', __( 'Invoice Status', 'invoicing' ), $invoice ); ?></th>
882
-            <td><?php echo wpinv_invoice_status_label( $invoice_status, wpinv_get_invoice_status( $invoice_id, true ) ); ?></td>
881
+            <th><?php echo apply_filters('wpinv_invoice_status_label', __('Invoice Status', 'invoicing'), $invoice); ?></th>
882
+            <td><?php echo wpinv_invoice_status_label($invoice_status, wpinv_get_invoice_status($invoice_id, true)); ?></td>
883 883
         </tr>
884
-        <?php if ( $invoice->is_renewal() ) { ?>
884
+        <?php if ($invoice->is_renewal()) { ?>
885 885
         <tr class="wpi-row-parent">
886
-            <th><?php echo apply_filters( 'wpinv_invoice_parent_invoice_label', __( 'Parent Invoice', 'invoicing' ), $invoice ); ?></th>
887
-            <td><?php echo wpinv_invoice_link( $invoice->parent_invoice ); ?></td>
886
+            <th><?php echo apply_filters('wpinv_invoice_parent_invoice_label', __('Parent Invoice', 'invoicing'), $invoice); ?></th>
887
+            <td><?php echo wpinv_invoice_link($invoice->parent_invoice); ?></td>
888 888
         </tr>
889 889
         <?php } ?>
890
-        <?php if ( ( $gateway_name = wpinv_get_payment_gateway_name( $invoice_id ) ) && ( $invoice->is_paid() || $invoice->is_refunded() ) ) { ?>
890
+        <?php if (($gateway_name = wpinv_get_payment_gateway_name($invoice_id)) && ($invoice->is_paid() || $invoice->is_refunded())) { ?>
891 891
             <tr class="wpi-row-gateway">
892
-                <th><?php echo apply_filters( 'wpinv_invoice_payment_method_label', __( 'Payment Method', 'invoicing' ), $invoice ); ?></th>
892
+                <th><?php echo apply_filters('wpinv_invoice_payment_method_label', __('Payment Method', 'invoicing'), $invoice); ?></th>
893 893
                 <td><?php echo $gateway_name; ?></td>
894 894
             </tr>
895 895
         <?php } ?>
896
-        <?php if ( $invoice_date = wpinv_get_invoice_date( $invoice_id ) ) { ?>
896
+        <?php if ($invoice_date = wpinv_get_invoice_date($invoice_id)) { ?>
897 897
             <tr class="wpi-row-date">
898
-                <th><?php echo apply_filters( 'wpinv_invoice_date_label', __( 'Invoice Date', 'invoicing' ), $invoice ); ?></th>
898
+                <th><?php echo apply_filters('wpinv_invoice_date_label', __('Invoice Date', 'invoicing'), $invoice); ?></th>
899 899
                 <td><?php echo $invoice_date; ?></td>
900 900
             </tr>
901 901
         <?php } ?>
902
-        <?php do_action( 'wpinv_display_details_before_due_date', $invoice_id ); ?>
903
-        <?php if ( wpinv_get_option( 'overdue_active' ) && $invoice->needs_payment() && ( $due_date = $invoice->get_due_date( true ) ) ) { ?>
902
+        <?php do_action('wpinv_display_details_before_due_date', $invoice_id); ?>
903
+        <?php if (wpinv_get_option('overdue_active') && $invoice->needs_payment() && ($due_date = $invoice->get_due_date(true))) { ?>
904 904
             <tr class="wpi-row-date">
905
-                <th><?php echo apply_filters( 'wpinv_invoice_due_date_label', __( 'Due Date', 'invoicing' ), $invoice ); ?></th>
905
+                <th><?php echo apply_filters('wpinv_invoice_due_date_label', __('Due Date', 'invoicing'), $invoice); ?></th>
906 906
                 <td><?php echo $due_date; ?></td>
907 907
             </tr>
908 908
         <?php } ?>
909
-        <?php do_action( 'wpinv_display_details_after_due_date', $invoice_id ); ?>
910
-        <?php if ( $owner_vat_number = $wpinv_euvat->get_vat_number() ) { ?>
909
+        <?php do_action('wpinv_display_details_after_due_date', $invoice_id); ?>
910
+        <?php if ($owner_vat_number = $wpinv_euvat->get_vat_number()) { ?>
911 911
             <tr class="wpi-row-ovatno">
912
-                <th><?php echo apply_filters( 'wpinv_invoice_owner_vat_number_label', wp_sprintf( __( 'Owner %s Number', 'invoicing' ), $vat_name ), $invoice, $vat_name ); ?></th>
912
+                <th><?php echo apply_filters('wpinv_invoice_owner_vat_number_label', wp_sprintf(__('Owner %s Number', 'invoicing'), $vat_name), $invoice, $vat_name); ?></th>
913 913
                 <td><?php echo $owner_vat_number; ?></td>
914 914
             </tr>
915 915
         <?php } ?>
916
-        <?php if ( $use_taxes && ( $user_vat_number = wpinv_get_invoice_vat_number( $invoice_id ) ) ) { ?>
916
+        <?php if ($use_taxes && ($user_vat_number = wpinv_get_invoice_vat_number($invoice_id))) { ?>
917 917
             <tr class="wpi-row-uvatno">
918
-                <th><?php echo apply_filters( 'wpinv_invoice_user_vat_number_label', wp_sprintf( __( 'Invoice %s Number', 'invoicing' ), $vat_name ), $invoice, $vat_name ); ?></th>
918
+                <th><?php echo apply_filters('wpinv_invoice_user_vat_number_label', wp_sprintf(__('Invoice %s Number', 'invoicing'), $vat_name), $invoice, $vat_name); ?></th>
919 919
                 <td><?php echo $user_vat_number; ?></td>
920 920
             </tr>
921 921
         <?php } ?>
922 922
         <tr class="table-active tr-total wpi-row-total">
923
-            <th><strong><?php _e( 'Total Amount', 'invoicing' ) ?></strong></th>
924
-            <td><strong><?php echo wpinv_payment_total( $invoice_id, true ); ?></strong></td>
923
+            <th><strong><?php _e('Total Amount', 'invoicing') ?></strong></th>
924
+            <td><strong><?php echo wpinv_payment_total($invoice_id, true); ?></strong></td>
925 925
         </tr>
926 926
     </table>
927 927
 <?php
@@ -937,84 +937,84 @@  discard block
 block discarded – undo
937 937
  * @param  string $separator How to separate address lines.
938 938
  * @return string
939 939
  */
940
-function wpinv_get_invoice_address_markup( $billing_details, $separator = '<br/>' ) {
940
+function wpinv_get_invoice_address_markup($billing_details, $separator = '<br/>') {
941 941
 
942 942
     // Retrieve the address markup...
943
-    $country= empty( $billing_details['country'] ) ? '' : $billing_details['country'];
944
-    $format = wpinv_get_full_address_format( $country );
943
+    $country = empty($billing_details['country']) ? '' : $billing_details['country'];
944
+    $format = wpinv_get_full_address_format($country);
945 945
 
946 946
     // ... and the replacements.
947
-    $replacements = wpinv_get_invoice_address_replacements( $billing_details );
947
+    $replacements = wpinv_get_invoice_address_replacements($billing_details);
948 948
 
949
-    $formatted_address = str_ireplace( array_keys( $replacements ), $replacements, $format );
949
+    $formatted_address = str_ireplace(array_keys($replacements), $replacements, $format);
950 950
     
951 951
 	// Remove unavailable tags.
952
-    $formatted_address = preg_replace( "/\{\{\w+\}\}/", '', $formatted_address );
952
+    $formatted_address = preg_replace("/\{\{\w+\}\}/", '', $formatted_address);
953 953
 
954 954
     // Clean up white space.
955
-	$formatted_address = preg_replace( '/  +/', ' ', trim( $formatted_address ) );
956
-    $formatted_address = preg_replace( '/\n\n+/', "\n", $formatted_address );
955
+	$formatted_address = preg_replace('/  +/', ' ', trim($formatted_address));
956
+    $formatted_address = preg_replace('/\n\n+/', "\n", $formatted_address);
957 957
     
958 958
     // Break newlines apart and remove empty lines/trim commas and white space.
959
-	$formatted_address = array_filter( array_map( 'wpinv_trim_formatted_address_line', explode( "\n", $formatted_address ) ) );
959
+	$formatted_address = array_filter(array_map('wpinv_trim_formatted_address_line', explode("\n", $formatted_address)));
960 960
 
961 961
     // Add html breaks.
962
-	$formatted_address = implode( $separator, $formatted_address );
962
+	$formatted_address = implode($separator, $formatted_address);
963 963
 
964 964
 	// We're done!
965 965
 	return $formatted_address;
966 966
     
967 967
 }
968 968
 
969
-function wpinv_display_to_address( $invoice_id = 0 ) {
970
-    $invoice = wpinv_get_invoice( $invoice_id );
969
+function wpinv_display_to_address($invoice_id = 0) {
970
+    $invoice = wpinv_get_invoice($invoice_id);
971 971
     
972
-    if ( empty( $invoice ) ) {
972
+    if (empty($invoice)) {
973 973
         return NULL;
974 974
     }
975 975
     
976 976
     $billing_details = $invoice->get_user_info();
977
-    $output = '<div class="to col-xs-2"><strong>' . __( 'To:', 'invoicing' ) . '</strong></div>';
977
+    $output = '<div class="to col-xs-2"><strong>' . __('To:', 'invoicing') . '</strong></div>';
978 978
     $output .= '<div class="wrapper col-xs-10">';
979 979
     
980 980
     ob_start();
981
-    do_action( 'wpinv_display_to_address_top', $invoice );
981
+    do_action('wpinv_display_to_address_top', $invoice);
982 982
     $output .= ob_get_clean();
983 983
     
984
-    $address_row = wpinv_get_invoice_address_markup( $billing_details );
984
+    $address_row = wpinv_get_invoice_address_markup($billing_details);
985 985
 
986
-    if ( $address_row ) {
986
+    if ($address_row) {
987 987
         $output .= '<div class="address">' . $address_row . '</div>';
988 988
     }
989 989
 
990
-    if ( $phone = $invoice->get_phone() ) {
991
-        $output .= '<div class="phone">' . wp_sprintf( __( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ) . '</div>';
990
+    if ($phone = $invoice->get_phone()) {
991
+        $output .= '<div class="phone">' . wp_sprintf(__('Phone: %s', 'invoicing'), esc_html($phone)) . '</div>';
992 992
     }
993
-    if ( $email = $invoice->get_email() ) {
994
-        $output .= '<div class="email">' . wp_sprintf( __( 'Email: %s' , 'invoicing'), esc_html( $email ) ) . '</div>';
993
+    if ($email = $invoice->get_email()) {
994
+        $output .= '<div class="email">' . wp_sprintf(__('Email: %s', 'invoicing'), esc_html($email)) . '</div>';
995 995
     }
996 996
 
997 997
     ob_start();
998
-    do_action( 'wpinv_display_to_address_bottom', $invoice );
998
+    do_action('wpinv_display_to_address_bottom', $invoice);
999 999
     $output .= ob_get_clean();
1000 1000
     
1001 1001
     $output .= '</div>';
1002
-    $output = apply_filters( 'wpinv_display_to_address', $output, $invoice );
1002
+    $output = apply_filters('wpinv_display_to_address', $output, $invoice);
1003 1003
 
1004 1004
     echo $output;
1005 1005
 }
1006 1006
 
1007
-function wpinv_display_line_items( $invoice_id = 0 ) {
1007
+function wpinv_display_line_items($invoice_id = 0) {
1008 1008
     global $wpinv_euvat, $ajax_cart_details;
1009
-    $invoice            = wpinv_get_invoice( $invoice_id );
1009
+    $invoice            = wpinv_get_invoice($invoice_id);
1010 1010
     $quantities_enabled = wpinv_item_quantities_enabled();
1011 1011
     $use_taxes          = wpinv_use_taxes();
1012
-    if ( !$use_taxes && (float)$invoice->get_tax() > 0 ) {
1012
+    if (!$use_taxes && (float) $invoice->get_tax() > 0) {
1013 1013
         $use_taxes = true;
1014 1014
     }
1015
-    $zero_tax           = !(float)$invoice->get_tax() > 0 ? true : false;
1016
-    $tax_label           = $use_taxes && $invoice->has_vat() ? $wpinv_euvat->get_vat_name() : __( 'Tax', 'invoicing' );
1017
-    $tax_title          = !$zero_tax && $use_taxes ? ( wpinv_prices_include_tax() ? wp_sprintf( __( '(%s Incl.)', 'invoicing' ), $tax_label ) : wp_sprintf( __( '(%s Excl.)', 'invoicing' ), $tax_label ) ) : '';
1015
+    $zero_tax           = !(float) $invoice->get_tax() > 0 ? true : false;
1016
+    $tax_label = $use_taxes && $invoice->has_vat() ? $wpinv_euvat->get_vat_name() : __('Tax', 'invoicing');
1017
+    $tax_title          = !$zero_tax && $use_taxes ? (wpinv_prices_include_tax() ? wp_sprintf(__('(%s Incl.)', 'invoicing'), $tax_label) : wp_sprintf(__('(%s Excl.)', 'invoicing'), $tax_label)) : '';
1018 1018
 
1019 1019
     $cart_details       = $invoice->get_cart_details();
1020 1020
     $ajax_cart_details  = $cart_details;
@@ -1023,67 +1023,67 @@  discard block
 block discarded – undo
1023 1023
     <table class="table table-sm table-bordered table-responsive">
1024 1024
         <thead>
1025 1025
             <tr>
1026
-                <th class="name"><strong><?php _e( "Item Name", "invoicing" );?></strong></th>
1027
-                <th class="rate"><strong><?php _e( "Price", "invoicing" );?></strong></th>
1026
+                <th class="name"><strong><?php _e("Item Name", "invoicing"); ?></strong></th>
1027
+                <th class="rate"><strong><?php _e("Price", "invoicing"); ?></strong></th>
1028 1028
                 <?php if ($quantities_enabled) { ?>
1029
-                    <th class="qty"><strong><?php _e( "Qty", "invoicing" );?></strong></th>
1029
+                    <th class="qty"><strong><?php _e("Qty", "invoicing"); ?></strong></th>
1030 1030
                 <?php } ?>
1031 1031
                 <?php if ($use_taxes && !$zero_tax) { ?>
1032 1032
                     <th class="tax"><strong><?php echo $tax_label . ' <span class="normal small">(%)</span>'; ?></strong></th>
1033 1033
                 <?php } ?>
1034
-                <th class="total"><strong><?php echo __( "Item Total", "invoicing" ) . ' <span class="normal small">' . $tax_title . '<span>';?></strong></th>
1034
+                <th class="total"><strong><?php echo __("Item Total", "invoicing") . ' <span class="normal small">' . $tax_title . '<span>'; ?></strong></th>
1035 1035
             </tr>
1036 1036
         </thead>
1037 1037
         <tbody>
1038 1038
         <?php 
1039
-            if ( !empty( $cart_details ) ) {
1040
-                do_action( 'wpinv_display_line_items_start', $invoice );
1039
+            if (!empty($cart_details)) {
1040
+                do_action('wpinv_display_line_items_start', $invoice);
1041 1041
 
1042 1042
                 $count = 0;
1043 1043
                 $cols  = 3;
1044
-                foreach ( $cart_details as $key => $cart_item ) {
1045
-                    $item_id    = !empty($cart_item['id']) ? absint( $cart_item['id'] ) : '';
1046
-                    $item_price = isset($cart_item["item_price"]) ? wpinv_round_amount( $cart_item["item_price"] ) : 0;
1047
-                    $line_total = isset($cart_item["subtotal"]) ? wpinv_round_amount( $cart_item["subtotal"] ) : 0;
1048
-                    $quantity   = !empty($cart_item['quantity']) && (int)$cart_item['quantity'] > 0 ? absint( $cart_item['quantity'] ) : 1;
1044
+                foreach ($cart_details as $key => $cart_item) {
1045
+                    $item_id    = !empty($cart_item['id']) ? absint($cart_item['id']) : '';
1046
+                    $item_price = isset($cart_item["item_price"]) ? wpinv_round_amount($cart_item["item_price"]) : 0;
1047
+                    $line_total = isset($cart_item["subtotal"]) ? wpinv_round_amount($cart_item["subtotal"]) : 0;
1048
+                    $quantity   = !empty($cart_item['quantity']) && (int) $cart_item['quantity'] > 0 ? absint($cart_item['quantity']) : 1;
1049 1049
 
1050
-                    $item       = $item_id ? new WPInv_Item( $item_id ) : NULL;
1050
+                    $item       = $item_id ? new WPInv_Item($item_id) : NULL;
1051 1051
                     $summary    = '';
1052
-	                $item_name    = '';
1052
+	                $item_name = '';
1053 1053
                     $cols       = 3;
1054
-                    if ( !empty($item) ) {
1054
+                    if (!empty($item)) {
1055 1055
                         $item_name  = $item->get_name();
1056 1056
                         $summary    = $item->get_summary();
1057 1057
                     }
1058
-                    $item_name  = !empty($cart_item['name']) ? $cart_item['name'] : $item_name;
1058
+                    $item_name = !empty($cart_item['name']) ? $cart_item['name'] : $item_name;
1059 1059
 
1060
-                    $summary = apply_filters( 'wpinv_print_invoice_line_item_summary', $summary, $cart_item, $item, $invoice );
1060
+                    $summary = apply_filters('wpinv_print_invoice_line_item_summary', $summary, $cart_item, $item, $invoice);
1061 1061
 
1062 1062
                     $item_tax       = '';
1063 1063
                     $tax_rate       = '';
1064
-                    if ( $use_taxes && $cart_item['tax'] > 0 && $cart_item['subtotal'] > 0 ) {
1065
-                        $item_tax = wpinv_price( wpinv_format_amount( $cart_item['tax'] ), $invoice->get_currency() );
1066
-                        $tax_rate = !empty( $cart_item['vat_rate'] ) ? $cart_item['vat_rate'] : ( $cart_item['tax'] / $cart_item['subtotal'] ) * 100;
1067
-                        $tax_rate = $tax_rate > 0 ? (float)wpinv_round_amount( $tax_rate, 4 ) : '';
1064
+                    if ($use_taxes && $cart_item['tax'] > 0 && $cart_item['subtotal'] > 0) {
1065
+                        $item_tax = wpinv_price(wpinv_format_amount($cart_item['tax']), $invoice->get_currency());
1066
+                        $tax_rate = !empty($cart_item['vat_rate']) ? $cart_item['vat_rate'] : ($cart_item['tax'] / $cart_item['subtotal']) * 100;
1067
+                        $tax_rate = $tax_rate > 0 ? (float) wpinv_round_amount($tax_rate, 4) : '';
1068 1068
                         $tax_rate = $tax_rate != '' ? ' <small class="tax-rate">(' . $tax_rate . '%)</small>' : '';
1069 1069
                     }
1070 1070
 
1071 1071
                     $line_item_tax = $item_tax . $tax_rate;
1072 1072
 
1073
-                    if ( $line_item_tax === '' ) {
1073
+                    if ($line_item_tax === '') {
1074 1074
                         $line_item_tax = 0; // Zero tax
1075 1075
                     }
1076 1076
 
1077
-                    $action = apply_filters( 'wpinv_display_line_item_action', '', $cart_item, $invoice, $cols );
1077
+                    $action = apply_filters('wpinv_display_line_item_action', '', $cart_item, $invoice, $cols);
1078 1078
 
1079
-                    $line_item = '<tr class="row-' . ( ($count % 2 == 0) ? 'even' : 'odd' ) . ' wpinv-item">';
1080
-                        $line_item .= '<td class="name">' . $action. esc_html__( $item_name, 'invoicing' ) . wpinv_get_item_suffix( $item );
1081
-                        if ( $summary !== '' ) {
1082
-                            $line_item .= '<br/><small class="meta">' . wpautop( wp_kses_post( $summary ) ) . '</small>';
1079
+                    $line_item = '<tr class="row-' . (($count % 2 == 0) ? 'even' : 'odd') . ' wpinv-item">';
1080
+                        $line_item .= '<td class="name">' . $action . esc_html__($item_name, 'invoicing') . wpinv_get_item_suffix($item);
1081
+                        if ($summary !== '') {
1082
+                            $line_item .= '<br/><small class="meta">' . wpautop(wp_kses_post($summary)) . '</small>';
1083 1083
                         }
1084 1084
                         $line_item .= '</td>';
1085 1085
 
1086
-                        $line_item .= '<td class="rate">' . esc_html__( wpinv_price( wpinv_format_amount( $item_price ), $invoice->get_currency() ) ) . '</td>';
1086
+                        $line_item .= '<td class="rate">' . esc_html__(wpinv_price(wpinv_format_amount($item_price), $invoice->get_currency())) . '</td>';
1087 1087
                         if ($quantities_enabled) {
1088 1088
                             $cols++;
1089 1089
                             $line_item .= '<td class="qty">' . $quantity . '</td>';
@@ -1092,55 +1092,55 @@  discard block
 block discarded – undo
1092 1092
                             $cols++;
1093 1093
                             $line_item .= '<td class="tax">' . $line_item_tax . '</td>';
1094 1094
                         }
1095
-                        $line_item .= '<td class="total">' . esc_html__( wpinv_price( wpinv_format_amount( $line_total ), $invoice->get_currency() ) ) . '</td>';
1095
+                        $line_item .= '<td class="total">' . esc_html__(wpinv_price(wpinv_format_amount($line_total), $invoice->get_currency())) . '</td>';
1096 1096
                     $line_item .= '</tr>';
1097 1097
 
1098
-                    echo apply_filters( 'wpinv_display_line_item', $line_item, $cart_item, $invoice, $cols );
1098
+                    echo apply_filters('wpinv_display_line_item', $line_item, $cart_item, $invoice, $cols);
1099 1099
 
1100 1100
                     $count++;
1101 1101
                 }
1102 1102
 
1103
-                do_action( 'wpinv_display_before_subtotal', $invoice, $cols );
1103
+                do_action('wpinv_display_before_subtotal', $invoice, $cols);
1104 1104
                 ?>
1105 1105
                 <tr class="row-sub-total row_odd">
1106
-                    <td class="rate" colspan="<?php echo ( $cols - 1 ); ?>"><?php echo apply_filters( 'wpinv_print_cart_subtotal_label', '<strong>' . __( 'Sub Total', 'invoicing' ) . ':</strong>', $invoice ); ?></td>
1107
-                    <td class="total"><strong><?php _e( wpinv_subtotal( $invoice_id, true ) ) ?></strong></td>
1106
+                    <td class="rate" colspan="<?php echo ($cols - 1); ?>"><?php echo apply_filters('wpinv_print_cart_subtotal_label', '<strong>' . __('Sub Total', 'invoicing') . ':</strong>', $invoice); ?></td>
1107
+                    <td class="total"><strong><?php _e(wpinv_subtotal($invoice_id, true)) ?></strong></td>
1108 1108
                 </tr>
1109 1109
                 <?php
1110
-                do_action( 'wpinv_display_after_subtotal', $invoice, $cols );
1110
+                do_action('wpinv_display_after_subtotal', $invoice, $cols);
1111 1111
                 
1112
-                if ( wpinv_discount( $invoice_id, false ) > 0 ) {
1113
-                    do_action( 'wpinv_display_before_discount', $invoice, $cols );
1112
+                if (wpinv_discount($invoice_id, false) > 0) {
1113
+                    do_action('wpinv_display_before_discount', $invoice, $cols);
1114 1114
                     ?>
1115 1115
                         <tr class="row-discount">
1116
-                            <td class="rate" colspan="<?php echo ( $cols - 1 ); ?>"><?php wpinv_get_discount_label( wpinv_discount_code( $invoice_id ) ); ?>:</td>
1117
-                            <td class="total"><?php echo wpinv_discount( $invoice_id, true, true ); ?></td>
1116
+                            <td class="rate" colspan="<?php echo ($cols - 1); ?>"><?php wpinv_get_discount_label(wpinv_discount_code($invoice_id)); ?>:</td>
1117
+                            <td class="total"><?php echo wpinv_discount($invoice_id, true, true); ?></td>
1118 1118
                         </tr>
1119 1119
                     <?php
1120
-                    do_action( 'wpinv_display_after_discount', $invoice, $cols );
1120
+                    do_action('wpinv_display_after_discount', $invoice, $cols);
1121 1121
                 }
1122 1122
 
1123
-                if ( $use_taxes ) {
1124
-                    do_action( 'wpinv_display_before_tax', $invoice, $cols );
1123
+                if ($use_taxes) {
1124
+                    do_action('wpinv_display_before_tax', $invoice, $cols);
1125 1125
                     ?>
1126 1126
                     <tr class="row-tax">
1127
-                        <td class="rate" colspan="<?php echo ( $cols - 1 ); ?>"><?php echo apply_filters( 'wpinv_print_cart_tax_label', '<strong>' . $tax_label . ':</strong>', $invoice ); ?></td>
1128
-                        <td class="total"><?php _e( wpinv_tax( $invoice_id, true ) ) ?></td>
1127
+                        <td class="rate" colspan="<?php echo ($cols - 1); ?>"><?php echo apply_filters('wpinv_print_cart_tax_label', '<strong>' . $tax_label . ':</strong>', $invoice); ?></td>
1128
+                        <td class="total"><?php _e(wpinv_tax($invoice_id, true)) ?></td>
1129 1129
                     </tr>
1130 1130
                     <?php
1131
-                    do_action( 'wpinv_display_after_tax', $invoice, $cols );
1131
+                    do_action('wpinv_display_after_tax', $invoice, $cols);
1132 1132
                 }
1133 1133
 
1134
-                do_action( 'wpinv_display_before_total', $invoice, $cols );
1134
+                do_action('wpinv_display_before_total', $invoice, $cols);
1135 1135
                 ?>
1136 1136
                 <tr class="table-active row-total">
1137
-                    <td class="rate" colspan="<?php echo ( $cols - 1 ); ?>"><?php echo apply_filters( 'wpinv_print_cart_total_label', '<strong>' . __( 'Total', 'invoicing' ) . ':</strong>', $invoice ); ?></td>
1138
-                    <td class="total"><strong><?php _e( wpinv_payment_total( $invoice_id, true ) ) ?></strong></td>
1137
+                    <td class="rate" colspan="<?php echo ($cols - 1); ?>"><?php echo apply_filters('wpinv_print_cart_total_label', '<strong>' . __('Total', 'invoicing') . ':</strong>', $invoice); ?></td>
1138
+                    <td class="total"><strong><?php _e(wpinv_payment_total($invoice_id, true)) ?></strong></td>
1139 1139
                 </tr>
1140 1140
                 <?php
1141
-                do_action( 'wpinv_display_after_total', $invoice, $cols );
1141
+                do_action('wpinv_display_after_total', $invoice, $cols);
1142 1142
 
1143
-                do_action( 'wpinv_display_line_end', $invoice, $cols );
1143
+                do_action('wpinv_display_line_end', $invoice, $cols);
1144 1144
             }
1145 1145
         ?>
1146 1146
         </tbody>
@@ -1152,56 +1152,56 @@  discard block
 block discarded – undo
1152 1152
 /**
1153 1153
  * @param WPInv_Invoice $invoice
1154 1154
  */
1155
-function wpinv_display_invoice_notes( $invoice ) {
1155
+function wpinv_display_invoice_notes($invoice) {
1156 1156
 
1157
-    $notes = wpinv_get_invoice_notes( $invoice->ID, 'customer' );
1157
+    $notes = wpinv_get_invoice_notes($invoice->ID, 'customer');
1158 1158
 
1159
-    if ( empty( $notes ) ) {
1159
+    if (empty($notes)) {
1160 1160
         return;
1161 1161
     }
1162 1162
 
1163 1163
     echo '<div class="wpi_invoice_notes_container">';
1164
-    echo '<h2>' . __( 'Invoice Notes', 'invoicing' ) .'</h2>';
1164
+    echo '<h2>' . __('Invoice Notes', 'invoicing') . '</h2>';
1165 1165
     echo '<ul class="wpi_invoice_notes">';
1166 1166
 
1167
-    foreach( $notes as $note ) {
1168
-        wpinv_get_invoice_note_line_item( $note );
1167
+    foreach ($notes as $note) {
1168
+        wpinv_get_invoice_note_line_item($note);
1169 1169
     }
1170 1170
 
1171 1171
     echo '</ul>';
1172 1172
     echo '</div>';
1173 1173
 }
1174
-add_action( 'wpinv_invoice_print_after_line_items', 'wpinv_display_invoice_notes' );
1174
+add_action('wpinv_invoice_print_after_line_items', 'wpinv_display_invoice_notes');
1175 1175
 
1176
-function wpinv_display_invoice_totals( $invoice_id = 0 ) {
1176
+function wpinv_display_invoice_totals($invoice_id = 0) {
1177 1177
     $use_taxes = wpinv_use_taxes();
1178 1178
 
1179
-    do_action( 'wpinv_before_display_totals_table', $invoice_id ); 
1179
+    do_action('wpinv_before_display_totals_table', $invoice_id); 
1180 1180
     ?>
1181 1181
     <table class="table table-sm table-bordered table-responsive">
1182 1182
         <tbody>
1183
-            <?php do_action( 'wpinv_before_display_totals' ); ?>
1183
+            <?php do_action('wpinv_before_display_totals'); ?>
1184 1184
             <tr class="row-sub-total">
1185
-                <td class="rate"><strong><?php _e( 'Sub Total', 'invoicing' ); ?></strong></td>
1186
-                <td class="total"><strong><?php _e( wpinv_subtotal( $invoice_id, true ) ) ?></strong></td>
1185
+                <td class="rate"><strong><?php _e('Sub Total', 'invoicing'); ?></strong></td>
1186
+                <td class="total"><strong><?php _e(wpinv_subtotal($invoice_id, true)) ?></strong></td>
1187 1187
             </tr>
1188
-            <?php do_action( 'wpinv_after_display_totals' ); ?>
1189
-            <?php if ( wpinv_discount( $invoice_id, false ) > 0 ) { ?>
1188
+            <?php do_action('wpinv_after_display_totals'); ?>
1189
+            <?php if (wpinv_discount($invoice_id, false) > 0) { ?>
1190 1190
                 <tr class="row-discount">
1191
-                    <td class="rate"><?php wpinv_get_discount_label( wpinv_discount_code( $invoice_id ) ); ?></td>
1192
-                    <td class="total"><?php echo wpinv_discount( $invoice_id, true, true ); ?></td>
1191
+                    <td class="rate"><?php wpinv_get_discount_label(wpinv_discount_code($invoice_id)); ?></td>
1192
+                    <td class="total"><?php echo wpinv_discount($invoice_id, true, true); ?></td>
1193 1193
                 </tr>
1194
-            <?php do_action( 'wpinv_after_display_discount' ); ?>
1194
+            <?php do_action('wpinv_after_display_discount'); ?>
1195 1195
             <?php } ?>
1196
-            <?php if ( $use_taxes ) { ?>
1196
+            <?php if ($use_taxes) { ?>
1197 1197
             <tr class="row-tax">
1198
-                <td class="rate"><?php _e( 'Tax', 'invoicing' ); ?></td>
1199
-                <td class="total"><?php _e( wpinv_tax( $invoice_id, true ) ) ?></td>
1198
+                <td class="rate"><?php _e('Tax', 'invoicing'); ?></td>
1199
+                <td class="total"><?php _e(wpinv_tax($invoice_id, true)) ?></td>
1200 1200
             </tr>
1201
-            <?php do_action( 'wpinv_after_display_tax' ); ?>
1201
+            <?php do_action('wpinv_after_display_tax'); ?>
1202 1202
             <?php } ?>
1203
-            <?php if ( $fees = wpinv_get_fees( $invoice_id ) ) { ?>
1204
-                <?php foreach ( $fees as $fee ) { ?>
1203
+            <?php if ($fees = wpinv_get_fees($invoice_id)) { ?>
1204
+                <?php foreach ($fees as $fee) { ?>
1205 1205
                     <tr class="row-fee">
1206 1206
                         <td class="rate"><?php echo $fee['label']; ?></td>
1207 1207
                         <td class="total"><?php echo $fee['amount_display']; ?></td>
@@ -1209,82 +1209,82 @@  discard block
 block discarded – undo
1209 1209
                 <?php } ?>
1210 1210
             <?php } ?>
1211 1211
             <tr class="table-active row-total">
1212
-                <td class="rate"><strong><?php _e( 'Total', 'invoicing' ) ?></strong></td>
1213
-                <td class="total"><strong><?php _e( wpinv_payment_total( $invoice_id, true ) ) ?></strong></td>
1212
+                <td class="rate"><strong><?php _e('Total', 'invoicing') ?></strong></td>
1213
+                <td class="total"><strong><?php _e(wpinv_payment_total($invoice_id, true)) ?></strong></td>
1214 1214
             </tr>
1215
-            <?php do_action( 'wpinv_after_totals' ); ?>
1215
+            <?php do_action('wpinv_after_totals'); ?>
1216 1216
         </tbody>
1217 1217
 
1218 1218
     </table>
1219 1219
 
1220
-    <?php do_action( 'wpinv_after_totals_table' );
1220
+    <?php do_action('wpinv_after_totals_table');
1221 1221
 }
1222 1222
 
1223
-function wpinv_display_payments_info( $invoice_id = 0, $echo = true ) {
1224
-    $invoice = wpinv_get_invoice( $invoice_id );
1223
+function wpinv_display_payments_info($invoice_id = 0, $echo = true) {
1224
+    $invoice = wpinv_get_invoice($invoice_id);
1225 1225
 
1226 1226
     ob_start();
1227
-    do_action( 'wpinv_before_display_payments_info', $invoice_id );
1228
-    if ( ( $gateway_title = $invoice->get_gateway_title() ) || $invoice->is_paid() || $invoice->is_refunded() ) {
1227
+    do_action('wpinv_before_display_payments_info', $invoice_id);
1228
+    if (($gateway_title = $invoice->get_gateway_title()) || $invoice->is_paid() || $invoice->is_refunded()) {
1229 1229
         ?>
1230 1230
         <div class="wpi-payment-info">
1231
-            <p class="wpi-payment-gateway"><?php echo wp_sprintf( __( 'Payment via %s', 'invoicing' ), $gateway_title ? $gateway_title : __( 'Manually', 'invoicing' ) ); ?></p>
1232
-            <?php if ( $gateway_title ) { ?>
1233
-            <p class="wpi-payment-transid"><?php echo wp_sprintf( __( 'Transaction ID: %s', 'invoicing' ), $invoice->get_transaction_id() ); ?></p>
1231
+            <p class="wpi-payment-gateway"><?php echo wp_sprintf(__('Payment via %s', 'invoicing'), $gateway_title ? $gateway_title : __('Manually', 'invoicing')); ?></p>
1232
+            <?php if ($gateway_title) { ?>
1233
+            <p class="wpi-payment-transid"><?php echo wp_sprintf(__('Transaction ID: %s', 'invoicing'), $invoice->get_transaction_id()); ?></p>
1234 1234
             <?php } ?>
1235 1235
         </div>
1236 1236
         <?php
1237 1237
     }
1238
-    do_action( 'wpinv_after_display_payments_info', $invoice_id );
1238
+    do_action('wpinv_after_display_payments_info', $invoice_id);
1239 1239
     $outout = ob_get_clean();
1240 1240
 
1241
-    if ( $echo ) {
1241
+    if ($echo) {
1242 1242
         echo $outout;
1243 1243
     } else {
1244 1244
         return $outout;
1245 1245
     }
1246 1246
 }
1247 1247
 
1248
-function wpinv_display_style( $invoice ) {
1249
-    wp_register_style( 'wpinv-single-style', WPINV_PLUGIN_URL . 'assets/css/invoice.css', array(), WPINV_VERSION );
1248
+function wpinv_display_style($invoice) {
1249
+    wp_register_style('wpinv-single-style', WPINV_PLUGIN_URL . 'assets/css/invoice.css', array(), WPINV_VERSION);
1250 1250
 
1251
-    wp_print_styles( 'open-sans' );
1252
-    wp_print_styles( 'wpinv-single-style' );
1251
+    wp_print_styles('open-sans');
1252
+    wp_print_styles('wpinv-single-style');
1253 1253
 
1254 1254
     $custom_css = wpinv_get_option('template_custom_css');
1255
-    if(isset($custom_css) && !empty($custom_css)){
1256
-        $custom_css     = wp_kses( $custom_css, array( '\'', '\"' ) );
1257
-        $custom_css     = str_replace( '&gt;', '>', $custom_css );
1255
+    if (isset($custom_css) && !empty($custom_css)) {
1256
+        $custom_css     = wp_kses($custom_css, array('\'', '\"'));
1257
+        $custom_css     = str_replace('&gt;', '>', $custom_css);
1258 1258
         echo '<style type="text/css">';
1259 1259
         echo $custom_css;
1260 1260
         echo '</style>';
1261 1261
     }
1262 1262
 }
1263
-add_action( 'wpinv_invoice_print_head', 'wpinv_display_style' );
1264
-add_action( 'wpinv_invalid_invoice_head', 'wpinv_display_style' );
1263
+add_action('wpinv_invoice_print_head', 'wpinv_display_style');
1264
+add_action('wpinv_invalid_invoice_head', 'wpinv_display_style');
1265 1265
 
1266 1266
 function wpinv_checkout_billing_details() {
1267
-    $invoice_id = (int)wpinv_get_invoice_cart_id();
1267
+    $invoice_id = (int) wpinv_get_invoice_cart_id();
1268 1268
     if (empty($invoice_id)) {
1269
-        wpinv_error_log( 'Invoice id not found', 'ERROR', __FILE__, __LINE__ );
1269
+        wpinv_error_log('Invoice id not found', 'ERROR', __FILE__, __LINE__);
1270 1270
         return null;
1271 1271
     }
1272 1272
 
1273
-    $invoice = wpinv_get_invoice_cart( $invoice_id );
1273
+    $invoice = wpinv_get_invoice_cart($invoice_id);
1274 1274
     if (empty($invoice)) {
1275
-        wpinv_error_log( 'Invoice not found', 'ERROR', __FILE__, __LINE__ );
1275
+        wpinv_error_log('Invoice not found', 'ERROR', __FILE__, __LINE__);
1276 1276
         return null;
1277 1277
     }
1278 1278
     $user_id        = $invoice->get_user_id();
1279 1279
     $user_info      = $invoice->get_user_info();
1280
-    $address_info   = wpinv_get_user_address( $user_id );
1280
+    $address_info   = wpinv_get_user_address($user_id);
1281 1281
 
1282
-    if ( empty( $user_info['first_name'] ) && !empty( $user_info['first_name'] ) ) {
1282
+    if (empty($user_info['first_name']) && !empty($user_info['first_name'])) {
1283 1283
         $user_info['first_name'] = $user_info['first_name'];
1284 1284
         $user_info['last_name'] = $user_info['last_name'];
1285 1285
     }
1286 1286
 
1287
-    if ( ( ( empty( $user_info['country'] ) && !empty( $address_info['country'] ) ) || ( empty( $user_info['state'] ) && !empty( $address_info['state'] ) && $user_info['country'] == $address_info['country'] ) ) ) {
1287
+    if (((empty($user_info['country']) && !empty($address_info['country'])) || (empty($user_info['state']) && !empty($address_info['state']) && $user_info['country'] == $address_info['country']))) {
1288 1288
         $user_info['country']   = $address_info['country'];
1289 1289
         $user_info['state']     = $address_info['state'];
1290 1290
         $user_info['city']      = $address_info['city'];
@@ -1300,98 +1300,98 @@  discard block
 block discarded – undo
1300 1300
         'address'
1301 1301
     );
1302 1302
 
1303
-    foreach ( $address_fields as $field ) {
1304
-        if ( empty( $user_info[$field] ) ) {
1303
+    foreach ($address_fields as $field) {
1304
+        if (empty($user_info[$field])) {
1305 1305
             $user_info[$field] = $address_info[$field];
1306 1306
         }
1307 1307
     }
1308 1308
 
1309
-    return apply_filters( 'wpinv_checkout_billing_details', $user_info, $invoice );
1309
+    return apply_filters('wpinv_checkout_billing_details', $user_info, $invoice);
1310 1310
 }
1311 1311
 
1312 1312
 function wpinv_admin_get_line_items($invoice = array()) {
1313 1313
     $item_quantities    = wpinv_item_quantities_enabled();
1314 1314
     $use_taxes          = wpinv_use_taxes();
1315 1315
 
1316
-    if ( empty( $invoice ) ) {
1316
+    if (empty($invoice)) {
1317 1317
         return NULL;
1318 1318
     }
1319 1319
 
1320 1320
     $cart_items = $invoice->get_cart_details();
1321
-    if ( empty( $cart_items ) ) {
1321
+    if (empty($cart_items)) {
1322 1322
         return NULL;
1323 1323
     }
1324 1324
     ob_start();
1325 1325
 
1326
-    do_action( 'wpinv_admin_before_line_items', $cart_items, $invoice );
1326
+    do_action('wpinv_admin_before_line_items', $cart_items, $invoice);
1327 1327
 
1328 1328
     $count = 0;
1329
-    foreach ( $cart_items as $key => $cart_item ) {
1329
+    foreach ($cart_items as $key => $cart_item) {
1330 1330
         $item_id    = $cart_item['id'];
1331
-        $wpi_item   = $item_id > 0 ? new WPInv_Item( $item_id ) : NULL;
1331
+        $wpi_item   = $item_id > 0 ? new WPInv_Item($item_id) : NULL;
1332 1332
 
1333 1333
         if (empty($wpi_item)) {
1334 1334
             continue;
1335 1335
         }
1336 1336
 
1337
-        $item_price     = wpinv_price( wpinv_format_amount( $cart_item['item_price'] ), $invoice->get_currency() );
1338
-        $quantity       = !empty( $cart_item['quantity'] ) && $cart_item['quantity'] > 0 ? $cart_item['quantity'] : 1;
1339
-        $item_subtotal  = wpinv_price( wpinv_format_amount( $cart_item['subtotal'] ), $invoice->get_currency() );
1337
+        $item_price     = wpinv_price(wpinv_format_amount($cart_item['item_price']), $invoice->get_currency());
1338
+        $quantity       = !empty($cart_item['quantity']) && $cart_item['quantity'] > 0 ? $cart_item['quantity'] : 1;
1339
+        $item_subtotal  = wpinv_price(wpinv_format_amount($cart_item['subtotal']), $invoice->get_currency());
1340 1340
         $can_remove     = true;
1341 1341
 
1342
-        $summary = apply_filters( 'wpinv_admin_invoice_line_item_summary', '', $cart_item, $wpi_item, $invoice );
1342
+        $summary = apply_filters('wpinv_admin_invoice_line_item_summary', '', $cart_item, $wpi_item, $invoice);
1343 1343
 
1344 1344
         $item_tax       = '';
1345 1345
         $tax_rate       = '';
1346
-        if ( $cart_item['tax'] > 0 && $cart_item['subtotal'] > 0 ) {
1347
-            $item_tax = wpinv_price( wpinv_format_amount( $cart_item['tax'] ), $invoice->get_currency() );
1348
-            $tax_rate = !empty( $cart_item['vat_rate'] ) ? $cart_item['vat_rate'] : ( $cart_item['tax'] / $cart_item['subtotal'] ) * 100;
1349
-            $tax_rate = $tax_rate > 0 ? (float)wpinv_round_amount( $tax_rate, 4 ) : '';
1346
+        if ($cart_item['tax'] > 0 && $cart_item['subtotal'] > 0) {
1347
+            $item_tax = wpinv_price(wpinv_format_amount($cart_item['tax']), $invoice->get_currency());
1348
+            $tax_rate = !empty($cart_item['vat_rate']) ? $cart_item['vat_rate'] : ($cart_item['tax'] / $cart_item['subtotal']) * 100;
1349
+            $tax_rate = $tax_rate > 0 ? (float) wpinv_round_amount($tax_rate, 4) : '';
1350 1350
             $tax_rate = $tax_rate != '' ? ' <span class="tax-rate">(' . $tax_rate . '%)</span>' : '';
1351 1351
         }
1352 1352
         $line_item_tax = $item_tax . $tax_rate;
1353 1353
 
1354
-        if ( $line_item_tax === '' ) {
1354
+        if ($line_item_tax === '') {
1355 1355
             $line_item_tax = 0; // Zero tax
1356 1356
         }
1357 1357
 
1358
-        $line_item = '<tr class="item item-' . ( ($count % 2 == 0) ? 'even' : 'odd' ) . '" data-item-id="' . $item_id . '">';
1358
+        $line_item = '<tr class="item item-' . (($count % 2 == 0) ? 'even' : 'odd') . '" data-item-id="' . $item_id . '">';
1359 1359
             $line_item .= '<td class="id">' . $item_id . '</td>';
1360
-            $line_item .= '<td class="title"><a href="' . get_edit_post_link( $item_id ) . '" target="_blank">' . $cart_item['name'] . '</a>' . wpinv_get_item_suffix( $wpi_item );
1361
-            if ( $summary !== '' ) {
1362
-                $line_item .= '<span class="meta">' . wpautop( wp_kses_post( $summary ) ) . '</span>';
1360
+            $line_item .= '<td class="title"><a href="' . get_edit_post_link($item_id) . '" target="_blank">' . $cart_item['name'] . '</a>' . wpinv_get_item_suffix($wpi_item);
1361
+            if ($summary !== '') {
1362
+                $line_item .= '<span class="meta">' . wpautop(wp_kses_post($summary)) . '</span>';
1363 1363
             }
1364 1364
             $line_item .= '</td>';
1365 1365
             $line_item .= '<td class="price">' . $item_price . '</td>';
1366 1366
             
1367
-            if ( $item_quantities ) {
1368
-                if ( count( $cart_items ) == 1 && $quantity <= 1 ) {
1367
+            if ($item_quantities) {
1368
+                if (count($cart_items) == 1 && $quantity <= 1) {
1369 1369
                     $can_remove = false;
1370 1370
                 }
1371 1371
                 $line_item .= '<td class="qty" data-quantity="' . $quantity . '">&nbsp;&times;&nbsp;' . $quantity . '</td>';
1372 1372
             } else {
1373
-                if ( count( $cart_items ) == 1 ) {
1373
+                if (count($cart_items) == 1) {
1374 1374
                     $can_remove = false;
1375 1375
                 }
1376 1376
             }
1377 1377
             $line_item .= '<td class="total">' . $item_subtotal . '</td>';
1378 1378
             
1379
-            if ( $use_taxes ) {
1379
+            if ($use_taxes) {
1380 1380
                 $line_item .= '<td class="tax">' . $line_item_tax . '</td>';
1381 1381
             }
1382 1382
             $line_item .= '<td class="action">';
1383
-            if ( !$invoice->is_paid() && !$invoice->is_refunded() ) {
1383
+            if (!$invoice->is_paid() && !$invoice->is_refunded()) {
1384 1384
                 $line_item .= '<i class="fa fa-remove wpinv-item-remove"></i>';
1385 1385
             }
1386 1386
             $line_item .= '</td>';
1387 1387
         $line_item .= '</tr>';
1388 1388
 
1389
-        echo apply_filters( 'wpinv_admin_line_item', $line_item, $cart_item, $invoice );
1389
+        echo apply_filters('wpinv_admin_line_item', $line_item, $cart_item, $invoice);
1390 1390
 
1391 1391
         $count++;
1392 1392
     } 
1393 1393
 
1394
-    do_action( 'wpinv_admin_after_line_items', $cart_items, $invoice );
1394
+    do_action('wpinv_admin_after_line_items', $cart_items, $invoice);
1395 1395
 
1396 1396
     return ob_get_clean();
1397 1397
 }
@@ -1403,32 +1403,32 @@  discard block
 block discarded – undo
1403 1403
     $wpi_checkout_id = wpinv_get_invoice_cart_id();
1404 1404
 
1405 1405
     //Maybe update the prices
1406
-    if(! empty( $_GET['wpi_dynamic_item'] ) && ! empty( $_GET['wpi_dynamic_price'] ) ) {
1406
+    if (!empty($_GET['wpi_dynamic_item']) && !empty($_GET['wpi_dynamic_price'])) {
1407 1407
 
1408 1408
         //If the invoice exists, update it with new pricing details
1409
-        if (! empty( $wpi_checkout_id ) ) {
1409
+        if (!empty($wpi_checkout_id)) {
1410 1410
 
1411 1411
             $_invoice       = wpinv_get_invoice_cart();
1412 1412
             $_cart_details  = $_invoice->get_cart_details();
1413
-            $_dynamic_item  = sanitize_text_field( $_GET['wpi_dynamic_item'] );
1413
+            $_dynamic_item  = sanitize_text_field($_GET['wpi_dynamic_item']);
1414 1414
 
1415 1415
             //First, fetch the item
1416
-            $item    = new WPInv_Item( $_dynamic_item );
1416
+            $item = new WPInv_Item($_dynamic_item);
1417 1417
     
1418 1418
             //Next, ensure it supports dynamic pricing...
1419
-            if( $item->supports_dynamic_pricing() && $item->get_is_dynamic_pricing() ) {
1419
+            if ($item->supports_dynamic_pricing() && $item->get_is_dynamic_pricing()) {
1420 1420
                 
1421 1421
                 //... and that the new price is not lower than the minimum price
1422
-                $_dynamic_price = (float) wpinv_sanitize_amount( sanitize_text_field( $_GET['wpi_dynamic_price'] ) );
1423
-                if( $_dynamic_price < $item->get_minimum_price() ) {
1422
+                $_dynamic_price = (float) wpinv_sanitize_amount(sanitize_text_field($_GET['wpi_dynamic_price']));
1423
+                if ($_dynamic_price < $item->get_minimum_price()) {
1424 1424
                     $_dynamic_price = $item->get_minimum_price();
1425 1425
                 }
1426 1426
 
1427 1427
                 //Finally, update our invoice with the new price
1428
-                if ( !empty( $_cart_details ) ) {
1428
+                if (!empty($_cart_details)) {
1429 1429
 
1430
-                    foreach ( $_cart_details as $key => $item ) {
1431
-                        if ( !empty( $item['id'] ) && $_dynamic_item == $item['id'] ) {
1430
+                    foreach ($_cart_details as $key => $item) {
1431
+                        if (!empty($item['id']) && $_dynamic_item == $item['id']) {
1432 1432
                             $_cart_details[$key]['custom_price'] = $_dynamic_price;
1433 1433
                             $_cart_details[$key]['item_price']   = $_dynamic_price;
1434 1434
                         }
@@ -1436,8 +1436,8 @@  discard block
 block discarded – undo
1436 1436
 
1437 1437
                     $_meta = $_invoice->get_meta();
1438 1438
                     $_meta['cart_details'] = $_cart_details;
1439
-                    $_invoice->set( 'payment_meta', $_meta );
1440
-                    $_invoice->set( 'cart_details', $_cart_details );
1439
+                    $_invoice->set('payment_meta', $_meta);
1440
+                    $_invoice->set('cart_details', $_cart_details);
1441 1441
                     $_invoice->recalculate_totals();
1442 1442
 
1443 1443
                 }
@@ -1448,60 +1448,60 @@  discard block
 block discarded – undo
1448 1448
 
1449 1449
     }
1450 1450
 
1451
-    $form_action  = esc_url( wpinv_get_checkout_uri() );
1451
+    $form_action = esc_url(wpinv_get_checkout_uri());
1452 1452
 
1453 1453
     ob_start();
1454
-	    do_action( 'wpinv_checkout_content_before' );
1454
+	    do_action('wpinv_checkout_content_before');
1455 1455
         echo '<div id="wpinv_checkout_wrap">';
1456 1456
 
1457
-        if ( wpinv_get_cart_contents() || wpinv_cart_has_fees() ) {
1457
+        if (wpinv_get_cart_contents() || wpinv_cart_has_fees()) {
1458 1458
             ?>
1459 1459
             <div id="wpinv_checkout_form_wrap" class="wpinv_clearfix table-responsive">
1460
-                <?php do_action( 'wpinv_before_checkout_form' ); ?>
1460
+                <?php do_action('wpinv_before_checkout_form'); ?>
1461 1461
                 <form id="wpinv_checkout_form" class="wpi-form" action="<?php echo $form_action; ?>" method="POST">
1462 1462
                     <?php
1463
-                    do_action( 'wpinv_checkout_form_top' );
1464
-                    do_action( 'wpinv_checkout_billing_info' );
1465
-                    do_action( 'wpinv_checkout_cart' );
1466
-                    do_action( 'wpinv_payment_mode_select'  );
1467
-                    do_action( 'wpinv_checkout_form_bottom' )
1463
+                    do_action('wpinv_checkout_form_top');
1464
+                    do_action('wpinv_checkout_billing_info');
1465
+                    do_action('wpinv_checkout_cart');
1466
+                    do_action('wpinv_payment_mode_select');
1467
+                    do_action('wpinv_checkout_form_bottom')
1468 1468
                     ?>
1469 1469
                 </form>
1470
-                <?php do_action( 'wpinv_after_purchase_form' ); ?>
1470
+                <?php do_action('wpinv_after_purchase_form'); ?>
1471 1471
             </div><!--end #wpinv_checkout_form_wrap-->
1472 1472
         <?php
1473 1473
         } else {
1474
-            do_action( 'wpinv_cart_empty' );
1474
+            do_action('wpinv_cart_empty');
1475 1475
         }
1476 1476
         echo '</div><!--end #wpinv_checkout_wrap-->';
1477
-	    do_action( 'wpinv_checkout_content_after' );
1477
+	    do_action('wpinv_checkout_content_after');
1478 1478
     return ob_get_clean();
1479 1479
 }
1480 1480
 
1481
-function wpinv_checkout_cart( $cart_details = array(), $echo = true ) {
1481
+function wpinv_checkout_cart($cart_details = array(), $echo = true) {
1482 1482
     global $ajax_cart_details;
1483 1483
     $ajax_cart_details = $cart_details;
1484 1484
 
1485 1485
     ob_start();
1486
-    do_action( 'wpinv_before_checkout_cart' );
1486
+    do_action('wpinv_before_checkout_cart');
1487 1487
     echo '<div id="wpinv_checkout_cart_form" method="post">';
1488 1488
         echo '<div id="wpinv_checkout_cart_wrap">';
1489
-            wpinv_get_template_part( 'wpinv-checkout-cart' );
1489
+            wpinv_get_template_part('wpinv-checkout-cart');
1490 1490
         echo '</div>';
1491 1491
     echo '</div>';
1492
-    do_action( 'wpinv_after_checkout_cart' );
1492
+    do_action('wpinv_after_checkout_cart');
1493 1493
     $content = ob_get_clean();
1494 1494
 
1495
-    if ( $echo ) {
1495
+    if ($echo) {
1496 1496
         echo $content;
1497 1497
     } else {
1498 1498
         return $content;
1499 1499
     }
1500 1500
 }
1501
-add_action( 'wpinv_checkout_cart', 'wpinv_checkout_cart', 10 );
1501
+add_action('wpinv_checkout_cart', 'wpinv_checkout_cart', 10);
1502 1502
 
1503 1503
 function wpinv_empty_cart_message() {
1504
-	return apply_filters( 'wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __( 'Your cart is empty.', 'invoicing' ) . '</span>' );
1504
+	return apply_filters('wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __('Your cart is empty.', 'invoicing') . '</span>');
1505 1505
 }
1506 1506
 
1507 1507
 /**
@@ -1513,83 +1513,83 @@  discard block
 block discarded – undo
1513 1513
 function wpinv_empty_checkout_cart() {
1514 1514
 	echo wpinv_empty_cart_message();
1515 1515
 }
1516
-add_action( 'wpinv_cart_empty', 'wpinv_empty_checkout_cart' );
1516
+add_action('wpinv_cart_empty', 'wpinv_empty_checkout_cart');
1517 1517
 
1518 1518
 function wpinv_update_cart_button() {
1519
-    if ( !wpinv_item_quantities_enabled() )
1519
+    if (!wpinv_item_quantities_enabled())
1520 1520
         return;
1521 1521
 ?>
1522
-    <input type="submit" name="wpinv_update_cart_submit" class="wpinv-submit wpinv-no-js button" value="<?php _e( 'Update Cart', 'invoicing' ); ?>"/>
1522
+    <input type="submit" name="wpinv_update_cart_submit" class="wpinv-submit wpinv-no-js button" value="<?php _e('Update Cart', 'invoicing'); ?>"/>
1523 1523
     <input type="hidden" name="wpi_action" value="update_cart"/>
1524 1524
 <?php
1525 1525
 }
1526 1526
 
1527 1527
 function wpinv_checkout_cart_columns() {
1528 1528
     $default = 3;
1529
-    if ( wpinv_item_quantities_enabled() ) {
1529
+    if (wpinv_item_quantities_enabled()) {
1530 1530
         $default++;
1531 1531
     }
1532 1532
     
1533
-    if ( wpinv_use_taxes() ) {
1533
+    if (wpinv_use_taxes()) {
1534 1534
         $default++;
1535 1535
     }
1536 1536
 
1537
-    return apply_filters( 'wpinv_checkout_cart_columns', $default );
1537
+    return apply_filters('wpinv_checkout_cart_columns', $default);
1538 1538
 }
1539 1539
 
1540 1540
 function wpinv_display_cart_messages() {
1541 1541
     global $wpi_session;
1542 1542
 
1543
-    $messages = $wpi_session->get( 'wpinv_cart_messages' );
1543
+    $messages = $wpi_session->get('wpinv_cart_messages');
1544 1544
 
1545
-    if ( $messages ) {
1546
-        foreach ( $messages as $message_id => $message ) {
1545
+    if ($messages) {
1546
+        foreach ($messages as $message_id => $message) {
1547 1547
             // Try and detect what type of message this is
1548
-            if ( strpos( strtolower( $message ), 'error' ) ) {
1548
+            if (strpos(strtolower($message), 'error')) {
1549 1549
                 $type = 'error';
1550
-            } elseif ( strpos( strtolower( $message ), 'success' ) ) {
1550
+            } elseif (strpos(strtolower($message), 'success')) {
1551 1551
                 $type = 'success';
1552 1552
             } else {
1553 1553
                 $type = 'info';
1554 1554
             }
1555 1555
 
1556
-            $classes = apply_filters( 'wpinv_' . $type . '_class', array( 'wpinv_errors', 'wpinv-alert', 'wpinv-alert-' . $type ) );
1556
+            $classes = apply_filters('wpinv_' . $type . '_class', array('wpinv_errors', 'wpinv-alert', 'wpinv-alert-' . $type));
1557 1557
 
1558
-            echo '<div class="' . implode( ' ', $classes ) . '">';
1558
+            echo '<div class="' . implode(' ', $classes) . '">';
1559 1559
                 // Loop message codes and display messages
1560 1560
                     echo '<p class="wpinv_error" id="wpinv_msg_' . $message_id . '">' . $message . '</p>';
1561 1561
             echo '</div>';
1562 1562
         }
1563 1563
 
1564 1564
         // Remove all of the cart saving messages
1565
-        $wpi_session->set( 'wpinv_cart_messages', null );
1565
+        $wpi_session->set('wpinv_cart_messages', null);
1566 1566
     }
1567 1567
 }
1568
-add_action( 'wpinv_before_checkout_cart', 'wpinv_display_cart_messages' );
1568
+add_action('wpinv_before_checkout_cart', 'wpinv_display_cart_messages');
1569 1569
 
1570 1570
 function wpinv_discount_field() {
1571
-    if ( isset( $_GET['wpi-gateway'] ) && wpinv_is_ajax_disabled() ) {
1571
+    if (isset($_GET['wpi-gateway']) && wpinv_is_ajax_disabled()) {
1572 1572
         return; // Only show before a payment method has been selected if ajax is disabled
1573 1573
     }
1574 1574
 
1575
-    if ( !wpinv_is_checkout() ) {
1575
+    if (!wpinv_is_checkout()) {
1576 1576
         return;
1577 1577
     }
1578 1578
 
1579
-    if ( wpinv_has_active_discounts() && wpinv_get_cart_total() ) {
1579
+    if (wpinv_has_active_discounts() && wpinv_get_cart_total()) {
1580 1580
     ?>
1581 1581
     <div id="wpinv-discount-field" class="panel panel-default">
1582 1582
         <div class="panel-body">
1583 1583
             <p>
1584
-                <label class="wpinv-label" for="wpinv_discount_code"><strong><?php _e( 'Discount', 'invoicing' ); ?></strong></label>
1585
-                <span class="wpinv-description"><?php _e( 'Enter a discount code if you have one.', 'invoicing' ); ?></span>
1584
+                <label class="wpinv-label" for="wpinv_discount_code"><strong><?php _e('Discount', 'invoicing'); ?></strong></label>
1585
+                <span class="wpinv-description"><?php _e('Enter a discount code if you have one.', 'invoicing'); ?></span>
1586 1586
             </p>
1587 1587
             <div class="form-group row">
1588 1588
                 <div class="col-sm-4">
1589
-                    <input class="wpinv-input form-control" type="text" id="wpinv_discount_code" name="wpinv_discount_code" placeholder="<?php _e( 'Enter discount code', 'invoicing' ); ?>"/>
1589
+                    <input class="wpinv-input form-control" type="text" id="wpinv_discount_code" name="wpinv_discount_code" placeholder="<?php _e('Enter discount code', 'invoicing'); ?>"/>
1590 1590
                 </div>
1591 1591
                 <div class="col-sm-3">
1592
-                    <button id="wpi-apply-discount" type="button" class="btn btn-success btn-sm"><?php _e( 'Apply Discount', 'invoicing' ); ?></button>
1592
+                    <button id="wpi-apply-discount" type="button" class="btn btn-success btn-sm"><?php _e('Apply Discount', 'invoicing'); ?></button>
1593 1593
                 </div>
1594 1594
                 <div style="clear:both"></div>
1595 1595
                 <div class="col-sm-12 wpinv-discount-msg">
@@ -1602,10 +1602,10 @@  discard block
 block discarded – undo
1602 1602
 <?php
1603 1603
     }
1604 1604
 }
1605
-add_action( 'wpinv_after_checkout_cart', 'wpinv_discount_field', -10 );
1605
+add_action('wpinv_after_checkout_cart', 'wpinv_discount_field', -10);
1606 1606
 
1607 1607
 function wpinv_agree_to_terms_js() {
1608
-    if ( wpinv_get_option( 'show_agree_to_terms', false ) ) {
1608
+    if (wpinv_get_option('show_agree_to_terms', false)) {
1609 1609
 ?>
1610 1610
 <script type="text/javascript">
1611 1611
     jQuery(document).ready(function($){
@@ -1620,125 +1620,125 @@  discard block
 block discarded – undo
1620 1620
 <?php
1621 1621
     }
1622 1622
 }
1623
-add_action( 'wpinv_checkout_form_top', 'wpinv_agree_to_terms_js' );
1623
+add_action('wpinv_checkout_form_top', 'wpinv_agree_to_terms_js');
1624 1624
 
1625 1625
 function wpinv_payment_mode_select() {
1626
-    $gateways = wpinv_get_enabled_payment_gateways( true );
1627
-    $gateways = apply_filters( 'wpinv_payment_gateways_on_cart', $gateways );
1628
-    $invoice = wpinv_get_invoice( 0, true );
1626
+    $gateways = wpinv_get_enabled_payment_gateways(true);
1627
+    $gateways = apply_filters('wpinv_payment_gateways_on_cart', $gateways);
1628
+    $invoice = wpinv_get_invoice(0, true);
1629 1629
 
1630 1630
     do_action('wpinv_payment_mode_top');
1631
-    $invoice_id = (int)$invoice->ID;
1632
-    $chosen_gateway = wpinv_get_chosen_gateway( $invoice_id );
1631
+    $invoice_id = (int) $invoice->ID;
1632
+    $chosen_gateway = wpinv_get_chosen_gateway($invoice_id);
1633 1633
     ?>
1634
-    <div id="wpinv_payment_mode_select" data-gateway="<?php echo $chosen_gateway; ?>" <?php echo ( $invoice->is_free() ? 'style="display:none;" data-free="1"' : '' ); ?>>
1635
-            <?php do_action( 'wpinv_payment_mode_before_gateways_wrap' ); ?>
1634
+    <div id="wpinv_payment_mode_select" data-gateway="<?php echo $chosen_gateway; ?>" <?php echo ($invoice->is_free() ? 'style="display:none;" data-free="1"' : ''); ?>>
1635
+            <?php do_action('wpinv_payment_mode_before_gateways_wrap'); ?>
1636 1636
             <div id="wpinv-payment-mode-wrap" class="panel panel-default">
1637
-                <div class="panel-heading"><h3 class="panel-title"><?php _e( 'Select Payment Method', 'invoicing' ); ?></h3></div>
1637
+                <div class="panel-heading"><h3 class="panel-title"><?php _e('Select Payment Method', 'invoicing'); ?></h3></div>
1638 1638
                 <div class="panel-body list-group wpi-payment_methods">
1639 1639
                     <?php
1640
-                    do_action( 'wpinv_payment_mode_before_gateways' );
1641
-
1642
-                    if ( !empty( $gateways ) ) {
1643
-                        foreach ( $gateways as $gateway_id => $gateway ) {
1644
-                            $checked       = checked( $gateway_id, $chosen_gateway, false );
1645
-                            $button_label  = wpinv_get_gateway_button_label( $gateway_id );
1646
-                            $gateway_label = wpinv_get_gateway_checkout_label( $gateway_id );
1647
-                            $description   = wpinv_get_gateway_description( $gateway_id );
1640
+                    do_action('wpinv_payment_mode_before_gateways');
1641
+
1642
+                    if (!empty($gateways)) {
1643
+                        foreach ($gateways as $gateway_id => $gateway) {
1644
+                            $checked       = checked($gateway_id, $chosen_gateway, false);
1645
+                            $button_label  = wpinv_get_gateway_button_label($gateway_id);
1646
+                            $gateway_label = wpinv_get_gateway_checkout_label($gateway_id);
1647
+                            $description   = wpinv_get_gateway_description($gateway_id);
1648 1648
                             ?>
1649 1649
                             <div class="list-group-item">
1650 1650
                                 <div class="radio">
1651
-                                    <label><input type="radio" data-button-text="<?php echo esc_attr( $button_label );?>" value="<?php echo esc_attr( $gateway_id ) ;?>" <?php echo $checked ;?> id="wpi_gateway_<?php echo esc_attr( $gateway_id );?>" name="wpi-gateway" class="wpi-pmethod"><?php echo esc_html( $gateway_label ); ?></label>
1651
+                                    <label><input type="radio" data-button-text="<?php echo esc_attr($button_label); ?>" value="<?php echo esc_attr($gateway_id); ?>" <?php echo $checked; ?> id="wpi_gateway_<?php echo esc_attr($gateway_id); ?>" name="wpi-gateway" class="wpi-pmethod"><?php echo esc_html($gateway_label); ?></label>
1652 1652
                                 </div>
1653
-                                <div style="display:none;" class="payment_box wpi_gateway_<?php echo esc_attr( $gateway_id );?>" role="alert">
1654
-                                    <?php if ( !empty( $description ) ) { ?>
1655
-                                        <div class="wpi-gateway-desc alert alert-info"><?php _e( $description, 'invoicing' ); ?></div>
1653
+                                <div style="display:none;" class="payment_box wpi_gateway_<?php echo esc_attr($gateway_id); ?>" role="alert">
1654
+                                    <?php if (!empty($description)) { ?>
1655
+                                        <div class="wpi-gateway-desc alert alert-info"><?php _e($description, 'invoicing'); ?></div>
1656 1656
                                     <?php } ?>
1657
-                                    <?php do_action( 'wpinv_' . $gateway_id . '_cc_form', $invoice_id ) ;?>
1657
+                                    <?php do_action('wpinv_' . $gateway_id . '_cc_form', $invoice_id); ?>
1658 1658
                                 </div>
1659 1659
                             </div>
1660 1660
                             <?php
1661 1661
                         }
1662 1662
                     } else {
1663
-                        echo '<div class="alert alert-warning">'. __( 'No payment gateway active', 'invoicing' ) .'</div>';
1663
+                        echo '<div class="alert alert-warning">' . __('No payment gateway active', 'invoicing') . '</div>';
1664 1664
                     }
1665 1665
 
1666
-                    do_action( 'wpinv_payment_mode_after_gateways' );
1666
+                    do_action('wpinv_payment_mode_after_gateways');
1667 1667
                     ?>
1668 1668
                 </div>
1669 1669
             </div>
1670
-            <?php do_action( 'wpinv_payment_mode_after_gateways_wrap' ); ?>
1670
+            <?php do_action('wpinv_payment_mode_after_gateways_wrap'); ?>
1671 1671
     </div>
1672 1672
     <?php
1673 1673
     do_action('wpinv_payment_mode_bottom');
1674 1674
 }
1675
-add_action( 'wpinv_payment_mode_select', 'wpinv_payment_mode_select' );
1675
+add_action('wpinv_payment_mode_select', 'wpinv_payment_mode_select');
1676 1676
 
1677 1677
 function wpinv_checkout_billing_info() {
1678
-    if ( wpinv_is_checkout() ) {
1678
+    if (wpinv_is_checkout()) {
1679 1679
         $billing_details    = wpinv_checkout_billing_details();
1680
-        $selected_country   = !empty( $billing_details['country'] ) ? $billing_details['country'] : wpinv_default_billing_country();
1680
+        $selected_country   = !empty($billing_details['country']) ? $billing_details['country'] : wpinv_default_billing_country();
1681 1681
         ?>
1682 1682
         <div id="wpinv-fields" class="clearfix">
1683 1683
             <div id="wpi-billing" class="wpi-billing clearfix panel panel-default">
1684
-                <div class="panel-heading"><h3 class="panel-title"><?php _e( 'Billing Details', 'invoicing' );?></h3></div>
1684
+                <div class="panel-heading"><h3 class="panel-title"><?php _e('Billing Details', 'invoicing'); ?></h3></div>
1685 1685
                 <div id="wpinv-fields-box" class="panel-body">
1686
-                    <?php do_action( 'wpinv_checkout_billing_fields_first', $billing_details ); ?>
1686
+                    <?php do_action('wpinv_checkout_billing_fields_first', $billing_details); ?>
1687 1687
                     <p class="wpi-cart-field wpi-col2 wpi-colf">
1688
-                        <label for="wpinv_first_name" class="wpi-label"><?php _e( 'First Name', 'invoicing' );?><?php if ( wpinv_get_option( 'fname_mandatory' ) ) { echo '<span class="wpi-required">*</span>'; } ?></label>
1688
+                        <label for="wpinv_first_name" class="wpi-label"><?php _e('First Name', 'invoicing'); ?><?php if (wpinv_get_option('fname_mandatory')) { echo '<span class="wpi-required">*</span>'; } ?></label>
1689 1689
                         <?php
1690
-                        echo wpinv_html_text( array(
1690
+                        echo wpinv_html_text(array(
1691 1691
                                 'id'            => 'wpinv_first_name',
1692 1692
                                 'name'          => 'wpinv_first_name',
1693 1693
                                 'value'         => $billing_details['first_name'],
1694 1694
                                 'class'         => 'wpi-input form-control',
1695
-                                'placeholder'   => __( 'First name', 'invoicing' ),
1696
-                                'required'      => (bool)wpinv_get_option( 'fname_mandatory' ),
1697
-                            ) );
1695
+                                'placeholder'   => __('First name', 'invoicing'),
1696
+                                'required'      => (bool) wpinv_get_option('fname_mandatory'),
1697
+                            ));
1698 1698
                         ?>
1699 1699
                     </p>
1700 1700
                     <p class="wpi-cart-field wpi-col2 wpi-coll">
1701
-                        <label for="wpinv_last_name" class="wpi-label"><?php _e( 'Last Name', 'invoicing' );?><?php if ( wpinv_get_option( 'lname_mandatory' ) ) { echo '<span class="wpi-required">*</span>'; } ?></label>
1701
+                        <label for="wpinv_last_name" class="wpi-label"><?php _e('Last Name', 'invoicing'); ?><?php if (wpinv_get_option('lname_mandatory')) { echo '<span class="wpi-required">*</span>'; } ?></label>
1702 1702
                         <?php
1703
-                        echo wpinv_html_text( array(
1703
+                        echo wpinv_html_text(array(
1704 1704
                                 'id'            => 'wpinv_last_name',
1705 1705
                                 'name'          => 'wpinv_last_name',
1706 1706
                                 'value'         => $billing_details['last_name'],
1707 1707
                                 'class'         => 'wpi-input form-control',
1708
-                                'placeholder'   => __( 'Last name', 'invoicing' ),
1709
-                                'required'      => (bool)wpinv_get_option( 'lname_mandatory' ),
1710
-                            ) );
1708
+                                'placeholder'   => __('Last name', 'invoicing'),
1709
+                                'required'      => (bool) wpinv_get_option('lname_mandatory'),
1710
+                            ));
1711 1711
                         ?>
1712 1712
                     </p>
1713 1713
                     <p class="wpi-cart-field wpi-col2 wpi-colf">
1714
-                        <label for="wpinv_address" class="wpi-label"><?php _e( 'Address', 'invoicing' );?><?php if ( wpinv_get_option( 'address_mandatory' ) ) { echo '<span class="wpi-required">*</span>'; } ?></label>
1714
+                        <label for="wpinv_address" class="wpi-label"><?php _e('Address', 'invoicing'); ?><?php if (wpinv_get_option('address_mandatory')) { echo '<span class="wpi-required">*</span>'; } ?></label>
1715 1715
                         <?php
1716
-                        echo wpinv_html_text( array(
1716
+                        echo wpinv_html_text(array(
1717 1717
                                 'id'            => 'wpinv_address',
1718 1718
                                 'name'          => 'wpinv_address',
1719 1719
                                 'value'         => $billing_details['address'],
1720 1720
                                 'class'         => 'wpi-input form-control',
1721
-                                'placeholder'   => __( 'Address', 'invoicing' ),
1722
-                                'required'      => (bool)wpinv_get_option( 'address_mandatory' ),
1723
-                            ) );
1721
+                                'placeholder'   => __('Address', 'invoicing'),
1722
+                                'required'      => (bool) wpinv_get_option('address_mandatory'),
1723
+                            ));
1724 1724
                         ?>
1725 1725
                     </p>
1726 1726
                     <p class="wpi-cart-field wpi-col2 wpi-coll">
1727
-                        <label for="wpinv_city" class="wpi-label"><?php _e( 'City', 'invoicing' );?><?php if ( wpinv_get_option( 'city_mandatory' ) ) { echo '<span class="wpi-required">*</span>'; } ?></label>
1727
+                        <label for="wpinv_city" class="wpi-label"><?php _e('City', 'invoicing'); ?><?php if (wpinv_get_option('city_mandatory')) { echo '<span class="wpi-required">*</span>'; } ?></label>
1728 1728
                         <?php
1729
-                        echo wpinv_html_text( array(
1729
+                        echo wpinv_html_text(array(
1730 1730
                                 'id'            => 'wpinv_city',
1731 1731
                                 'name'          => 'wpinv_city',
1732 1732
                                 'value'         => $billing_details['city'],
1733 1733
                                 'class'         => 'wpi-input form-control',
1734
-                                'placeholder'   => __( 'City', 'invoicing' ),
1735
-                                'required'      => (bool)wpinv_get_option( 'city_mandatory' ),
1736
-                            ) );
1734
+                                'placeholder'   => __('City', 'invoicing'),
1735
+                                'required'      => (bool) wpinv_get_option('city_mandatory'),
1736
+                            ));
1737 1737
                         ?>
1738 1738
                     </p>
1739 1739
                     <p id="wpinv_country_box" class="wpi-cart-field wpi-col2 wpi-colf">
1740
-                        <label for="wpinv_country" class="wpi-label"><?php _e( 'Country', 'invoicing' );?><?php if ( wpinv_get_option( 'country_mandatory' ) ) { echo '<span class="wpi-required">*</span>'; } ?></label>
1741
-                        <?php echo wpinv_html_select( array(
1740
+                        <label for="wpinv_country" class="wpi-label"><?php _e('Country', 'invoicing'); ?><?php if (wpinv_get_option('country_mandatory')) { echo '<span class="wpi-required">*</span>'; } ?></label>
1741
+                        <?php echo wpinv_html_select(array(
1742 1742
                             'options'          => wpinv_get_country_list(),
1743 1743
                             'name'             => 'wpinv_country',
1744 1744
                             'id'               => 'wpinv_country',
@@ -1746,16 +1746,16 @@  discard block
 block discarded – undo
1746 1746
                             'show_option_all'  => false,
1747 1747
                             'show_option_none' => false,
1748 1748
                             'class'            => 'wpi-input form-control wpi_select2',
1749
-                            'placeholder'      => __( 'Choose a country', 'invoicing' ),
1750
-                            'required'         => (bool)wpinv_get_option( 'country_mandatory' ),
1751
-                        ) ); ?>
1749
+                            'placeholder'      => __('Choose a country', 'invoicing'),
1750
+                            'required'         => (bool) wpinv_get_option('country_mandatory'),
1751
+                        )); ?>
1752 1752
                     </p>
1753 1753
                     <p id="wpinv_state_box" class="wpi-cart-field wpi-col2 wpi-coll">
1754
-                        <label for="wpinv_state" class="wpi-label"><?php _e( 'State / Province', 'invoicing' );?><?php if ( wpinv_get_option( 'state_mandatory' ) ) { echo '<span class="wpi-required">*</span>'; } ?></label>
1754
+                        <label for="wpinv_state" class="wpi-label"><?php _e('State / Province', 'invoicing'); ?><?php if (wpinv_get_option('state_mandatory')) { echo '<span class="wpi-required">*</span>'; } ?></label>
1755 1755
                         <?php
1756
-                        $states = wpinv_get_country_states( $selected_country );
1757
-                        if( !empty( $states ) ) {
1758
-                            echo wpinv_html_select( array(
1756
+                        $states = wpinv_get_country_states($selected_country);
1757
+                        if (!empty($states)) {
1758
+                            echo wpinv_html_select(array(
1759 1759
                                 'options'          => $states,
1760 1760
                                 'name'             => 'wpinv_state',
1761 1761
                                 'id'               => 'wpinv_state',
@@ -1763,61 +1763,61 @@  discard block
 block discarded – undo
1763 1763
                                 'show_option_all'  => false,
1764 1764
                                 'show_option_none' => false,
1765 1765
                                 'class'            => 'wpi-input form-control wpi_select2',
1766
-                                'placeholder'      => __( 'Choose a state', 'invoicing' ),
1767
-                                'required'         => (bool)wpinv_get_option( 'state_mandatory' ),
1768
-                            ) );
1766
+                                'placeholder'      => __('Choose a state', 'invoicing'),
1767
+                                'required'         => (bool) wpinv_get_option('state_mandatory'),
1768
+                            ));
1769 1769
                         } else {
1770
-                            echo wpinv_html_text( array(
1770
+                            echo wpinv_html_text(array(
1771 1771
                                 'name'          => 'wpinv_state',
1772 1772
                                 'value'         => $billing_details['state'],
1773 1773
                                 'id'            => 'wpinv_state',
1774 1774
                                 'class'         => 'wpi-input form-control',
1775
-                                'placeholder'   => __( 'State / Province', 'invoicing' ),
1776
-                                'required'      => (bool)wpinv_get_option( 'state_mandatory' ),
1777
-                            ) );
1775
+                                'placeholder'   => __('State / Province', 'invoicing'),
1776
+                                'required'      => (bool) wpinv_get_option('state_mandatory'),
1777
+                            ));
1778 1778
                         }
1779 1779
                         ?>
1780 1780
                     </p>
1781 1781
                     <p class="wpi-cart-field wpi-col2 wpi-colf">
1782
-                        <label for="wpinv_zip" class="wpi-label"><?php _e( 'ZIP / Postcode', 'invoicing' );?><?php if ( wpinv_get_option( 'zip_mandatory' ) ) { echo '<span class="wpi-required">*</span>'; } ?></label>
1782
+                        <label for="wpinv_zip" class="wpi-label"><?php _e('ZIP / Postcode', 'invoicing'); ?><?php if (wpinv_get_option('zip_mandatory')) { echo '<span class="wpi-required">*</span>'; } ?></label>
1783 1783
                         <?php
1784
-                        echo wpinv_html_text( array(
1784
+                        echo wpinv_html_text(array(
1785 1785
                                 'name'          => 'wpinv_zip',
1786 1786
                                 'value'         => $billing_details['zip'],
1787 1787
                                 'id'            => 'wpinv_zip',
1788 1788
                                 'class'         => 'wpi-input form-control',
1789
-                                'placeholder'   => __( 'ZIP / Postcode', 'invoicing' ),
1790
-                                'required'      => (bool)wpinv_get_option( 'zip_mandatory' ),
1791
-                            ) );
1789
+                                'placeholder'   => __('ZIP / Postcode', 'invoicing'),
1790
+                                'required'      => (bool) wpinv_get_option('zip_mandatory'),
1791
+                            ));
1792 1792
                         ?>
1793 1793
                     </p>
1794 1794
                     <p class="wpi-cart-field wpi-col2 wpi-coll">
1795
-                        <label for="wpinv_phone" class="wpi-label"><?php _e( 'Phone', 'invoicing' );?><?php if ( wpinv_get_option( 'phone_mandatory' ) ) { echo '<span class="wpi-required">*</span>'; } ?></label>
1795
+                        <label for="wpinv_phone" class="wpi-label"><?php _e('Phone', 'invoicing'); ?><?php if (wpinv_get_option('phone_mandatory')) { echo '<span class="wpi-required">*</span>'; } ?></label>
1796 1796
                         <?php
1797
-                        echo wpinv_html_text( array(
1797
+                        echo wpinv_html_text(array(
1798 1798
                                 'id'            => 'wpinv_phone',
1799 1799
                                 'name'          => 'wpinv_phone',
1800 1800
                                 'value'         => $billing_details['phone'],
1801 1801
                                 'class'         => 'wpi-input form-control',
1802
-                                'placeholder'   => __( 'Phone', 'invoicing' ),
1803
-                                'required'      => (bool)wpinv_get_option( 'phone_mandatory' ),
1804
-                            ) );
1802
+                                'placeholder'   => __('Phone', 'invoicing'),
1803
+                                'required'      => (bool) wpinv_get_option('phone_mandatory'),
1804
+                            ));
1805 1805
                         ?>
1806 1806
                     </p>
1807
-                    <?php do_action( 'wpinv_checkout_billing_fields_last', $billing_details ); ?>
1807
+                    <?php do_action('wpinv_checkout_billing_fields_last', $billing_details); ?>
1808 1808
                     <div class="clearfix"></div>
1809 1809
                 </div>
1810 1810
             </div>
1811
-            <?php do_action( 'wpinv_after_billing_fields', $billing_details ); ?>
1811
+            <?php do_action('wpinv_after_billing_fields', $billing_details); ?>
1812 1812
         </div>
1813 1813
         <?php
1814 1814
     }
1815 1815
 }
1816
-add_action( 'wpinv_checkout_billing_info', 'wpinv_checkout_billing_info' );
1816
+add_action('wpinv_checkout_billing_info', 'wpinv_checkout_billing_info');
1817 1817
 
1818 1818
 function wpinv_checkout_hidden_fields() {
1819 1819
 ?>
1820
-    <?php if ( is_user_logged_in() ) { ?>
1820
+    <?php if (is_user_logged_in()) { ?>
1821 1821
     <input type="hidden" name="wpinv_user_id" value="<?php echo get_current_user_id(); ?>"/>
1822 1822
     <?php } ?>
1823 1823
     <input type="hidden" name="wpi_action" value="payment" />
@@ -1827,9 +1827,9 @@  discard block
 block discarded – undo
1827 1827
 function wpinv_checkout_button_purchase() {
1828 1828
     ob_start();
1829 1829
 ?>
1830
-    <input type="submit" class="btn btn-success wpinv-submit" id="wpinv-payment-button" data-value="<?php esc_attr_e( 'Proceed to Pay', 'invoicing' ) ?>" name="wpinv_payment" value="<?php esc_attr_e( 'Proceed to Pay', 'invoicing' ) ?>"/>
1830
+    <input type="submit" class="btn btn-success wpinv-submit" id="wpinv-payment-button" data-value="<?php esc_attr_e('Proceed to Pay', 'invoicing') ?>" name="wpinv_payment" value="<?php esc_attr_e('Proceed to Pay', 'invoicing') ?>"/>
1831 1831
 <?php
1832
-    return apply_filters( 'wpinv_checkout_button_purchase', ob_get_clean() );
1832
+    return apply_filters('wpinv_checkout_button_purchase', ob_get_clean());
1833 1833
 }
1834 1834
 
1835 1835
 function wpinv_checkout_total() {
@@ -1838,84 +1838,84 @@  discard block
 block discarded – undo
1838 1838
 <div id="wpinv_checkout_total" class="panel panel-info">
1839 1839
     <div class="panel-body">
1840 1840
     <?php
1841
-    do_action( 'wpinv_purchase_form_before_checkout_total' );
1841
+    do_action('wpinv_purchase_form_before_checkout_total');
1842 1842
     ?>
1843
-    <strong><?php _e( 'Invoice Total:', 'invoicing' ) ?></strong> <span class="wpinv-chdeckout-total"><?php echo $cart_total;?></span>
1843
+    <strong><?php _e('Invoice Total:', 'invoicing') ?></strong> <span class="wpinv-chdeckout-total"><?php echo $cart_total; ?></span>
1844 1844
     <?php
1845
-    do_action( 'wpinv_purchase_form_after_checkout_total' );
1845
+    do_action('wpinv_purchase_form_after_checkout_total');
1846 1846
     ?>
1847 1847
     </div>
1848 1848
 </div>
1849 1849
 <?php
1850 1850
 }
1851
-add_action( 'wpinv_checkout_form_bottom', 'wpinv_checkout_total', 9998 );
1851
+add_action('wpinv_checkout_form_bottom', 'wpinv_checkout_total', 9998);
1852 1852
 
1853 1853
 function wpinv_checkout_accept_tandc() {
1854
-    $page = wpinv_get_option( 'tandc_page' );
1854
+    $page = wpinv_get_option('tandc_page');
1855 1855
     ?>
1856 1856
     <div id="wpinv_checkout_tandc" class="panel panel-success">
1857 1857
         <div class="panel-body">
1858 1858
             <?php echo wpinv_get_policy_text(); ?>
1859 1859
             <?php
1860
-            if(isset($page) && (int)$page > 0 && apply_filters( 'wpinv_checkout_show_terms', true )){
1861
-                $terms_link = esc_url( get_permalink( $page ) );
1860
+            if (isset($page) && (int) $page > 0 && apply_filters('wpinv_checkout_show_terms', true)) {
1861
+                $terms_link = esc_url(get_permalink($page));
1862 1862
                 ?>
1863 1863
                 <label class="">
1864
-                    <input type="checkbox" class="wpi-terms-checkbox" name="wpi_terms" id="wpi-terms" <?php checked( apply_filters( 'wpinv_terms_is_checked_default', isset( $_POST['wpi_terms'] ) ), true ); ?>> <span><?php printf( __( 'I&rsquo;ve read and accept the <a href="%s" target="_blank" class="wpi-terms-and-conditions-link">terms &amp; conditions</a>', 'invoicing' ), $terms_link ); ?></span> <span class="wpi-required">*</span>
1864
+                    <input type="checkbox" class="wpi-terms-checkbox" name="wpi_terms" id="wpi-terms" <?php checked(apply_filters('wpinv_terms_is_checked_default', isset($_POST['wpi_terms'])), true); ?>> <span><?php printf(__('I&rsquo;ve read and accept the <a href="%s" target="_blank" class="wpi-terms-and-conditions-link">terms &amp; conditions</a>', 'invoicing'), $terms_link); ?></span> <span class="wpi-required">*</span>
1865 1865
                 </label>
1866 1866
             <?php } ?>
1867 1867
         </div>
1868 1868
     </div>
1869 1869
     <?php
1870 1870
 }
1871
-add_action( 'wpinv_checkout_form_bottom', 'wpinv_checkout_accept_tandc', 9995 );
1871
+add_action('wpinv_checkout_form_bottom', 'wpinv_checkout_accept_tandc', 9995);
1872 1872
 
1873 1873
 function wpinv_checkout_submit() {
1874 1874
 ?>
1875 1875
 <div id="wpinv_purchase_submit" class="panel panel-success">
1876 1876
     <div class="panel-body text-center">
1877 1877
     <?php
1878
-    do_action( 'wpinv_purchase_form_before_submit' );
1878
+    do_action('wpinv_purchase_form_before_submit');
1879 1879
     wpinv_checkout_hidden_fields();
1880 1880
     echo wpinv_checkout_button_purchase();
1881
-    do_action( 'wpinv_purchase_form_after_submit' );
1881
+    do_action('wpinv_purchase_form_after_submit');
1882 1882
     ?>
1883 1883
     </div>
1884 1884
 </div>
1885 1885
 <?php
1886 1886
 }
1887
-add_action( 'wpinv_checkout_form_bottom', 'wpinv_checkout_submit', 9999 );
1887
+add_action('wpinv_checkout_form_bottom', 'wpinv_checkout_submit', 9999);
1888 1888
 
1889
-function wpinv_receipt_billing_address( $invoice_id = 0 ) {
1890
-    $invoice = wpinv_get_invoice( $invoice_id );
1889
+function wpinv_receipt_billing_address($invoice_id = 0) {
1890
+    $invoice = wpinv_get_invoice($invoice_id);
1891 1891
 
1892
-    if ( empty( $invoice ) ) {
1892
+    if (empty($invoice)) {
1893 1893
         return NULL;
1894 1894
     }
1895 1895
 
1896 1896
     $billing_details = $invoice->get_user_info();
1897
-    $address_row = wpinv_get_invoice_address_markup( $billing_details );
1897
+    $address_row = wpinv_get_invoice_address_markup($billing_details);
1898 1898
 
1899 1899
     ob_start();
1900 1900
     ?>
1901 1901
     <table class="table table-bordered table-sm wpi-billing-details">
1902 1902
         <tbody>
1903 1903
             <tr class="wpi-receipt-name">
1904
-                <th class="text-left"><?php _e( 'Name', 'invoicing' ); ?></th>
1905
-                <td><?php echo esc_html( trim( $billing_details['first_name'] . ' ' . $billing_details['last_name'] ) ) ;?></td>
1904
+                <th class="text-left"><?php _e('Name', 'invoicing'); ?></th>
1905
+                <td><?php echo esc_html(trim($billing_details['first_name'] . ' ' . $billing_details['last_name'])); ?></td>
1906 1906
             </tr>
1907 1907
             <tr class="wpi-receipt-email">
1908
-                <th class="text-left"><?php _e( 'Email', 'invoicing' ); ?></th>
1909
-                <td><?php echo $billing_details['email'] ;?></td>
1908
+                <th class="text-left"><?php _e('Email', 'invoicing'); ?></th>
1909
+                <td><?php echo $billing_details['email']; ?></td>
1910 1910
             </tr>
1911 1911
             <tr class="wpi-receipt-address">
1912
-                <th class="text-left"><?php _e( 'Address', 'invoicing' ); ?></th>
1913
-                <td><?php echo $address_row ;?></td>
1912
+                <th class="text-left"><?php _e('Address', 'invoicing'); ?></th>
1913
+                <td><?php echo $address_row; ?></td>
1914 1914
             </tr>
1915
-            <?php if ( $billing_details['phone'] ) { ?>
1915
+            <?php if ($billing_details['phone']) { ?>
1916 1916
             <tr class="wpi-receipt-phone">
1917
-                <th class="text-left"><?php _e( 'Phone', 'invoicing' ); ?></th>
1918
-                <td><?php echo esc_html( $billing_details['phone'] ) ;?></td>
1917
+                <th class="text-left"><?php _e('Phone', 'invoicing'); ?></th>
1918
+                <td><?php echo esc_html($billing_details['phone']); ?></td>
1919 1919
             </tr>
1920 1920
             <?php } ?>
1921 1921
         </tbody>
@@ -1923,74 +1923,74 @@  discard block
 block discarded – undo
1923 1923
     <?php
1924 1924
     $output = ob_get_clean();
1925 1925
     
1926
-    $output = apply_filters( 'wpinv_receipt_billing_address', $output, $invoice_id );
1926
+    $output = apply_filters('wpinv_receipt_billing_address', $output, $invoice_id);
1927 1927
 
1928 1928
     echo $output;
1929 1929
 }
1930 1930
 
1931
-function wpinv_filter_success_page_content( $content ) {
1932
-    if ( isset( $_GET['payment-confirm'] ) && wpinv_is_success_page() ) {
1933
-        if ( has_filter( 'wpinv_payment_confirm_' . sanitize_text_field( $_GET['payment-confirm'] ) ) ) {
1934
-            $content = apply_filters( 'wpinv_payment_confirm_' . sanitize_text_field( $_GET['payment-confirm'] ), $content );
1931
+function wpinv_filter_success_page_content($content) {
1932
+    if (isset($_GET['payment-confirm']) && wpinv_is_success_page()) {
1933
+        if (has_filter('wpinv_payment_confirm_' . sanitize_text_field($_GET['payment-confirm']))) {
1934
+            $content = apply_filters('wpinv_payment_confirm_' . sanitize_text_field($_GET['payment-confirm']), $content);
1935 1935
         }
1936 1936
     }
1937 1937
 
1938 1938
     return $content;
1939 1939
 }
1940
-add_filter( 'the_content', 'wpinv_filter_success_page_content', 99999 );
1940
+add_filter('the_content', 'wpinv_filter_success_page_content', 99999);
1941 1941
 
1942
-function wpinv_receipt_actions( $invoice ) {
1943
-    if ( !empty( $invoice ) ) {
1942
+function wpinv_receipt_actions($invoice) {
1943
+    if (!empty($invoice)) {
1944 1944
         $actions = array();
1945 1945
 
1946
-        if ( wpinv_user_can_view_invoice( $invoice->ID ) ) {
1947
-            $actions['print']   = array(
1948
-                'url'  => $invoice->get_view_url( true ),
1949
-                'name' => __( 'Print Invoice', 'invoicing' ),
1946
+        if (wpinv_user_can_view_invoice($invoice->ID)) {
1947
+            $actions['print'] = array(
1948
+                'url'  => $invoice->get_view_url(true),
1949
+                'name' => __('Print Invoice', 'invoicing'),
1950 1950
                 'class' => 'btn-primary',
1951 1951
             );
1952 1952
         }
1953 1953
 
1954
-        if ( is_user_logged_in() ) {
1954
+        if (is_user_logged_in()) {
1955 1955
             $actions['history'] = array(
1956 1956
                 'url'  => wpinv_get_history_page_uri(),
1957
-                'name' => __( 'Invoice History', 'invoicing' ),
1957
+                'name' => __('Invoice History', 'invoicing'),
1958 1958
                 'class' => 'btn-warning',
1959 1959
             );
1960 1960
         }
1961 1961
 
1962
-        $actions = apply_filters( 'wpinv_invoice_receipt_actions', $actions, $invoice );
1962
+        $actions = apply_filters('wpinv_invoice_receipt_actions', $actions, $invoice);
1963 1963
 
1964
-        if ( !empty( $actions ) ) {
1964
+        if (!empty($actions)) {
1965 1965
         ?>
1966 1966
         <div class="wpinv-receipt-actions text-right">
1967
-            <?php foreach ( $actions as $key => $action ) { $class = !empty($action['class']) ? sanitize_html_class( $action['class'] ) : ''; ?>
1968
-            <a href="<?php echo esc_url( $action['url'] );?>" class="btn btn-sm <?php echo $class . ' ' . sanitize_html_class( $key );?>" <?php echo ( !empty($action['attrs']) ? $action['attrs'] : '' ) ;?>><?php echo esc_html( $action['name'] );?></a>
1967
+            <?php foreach ($actions as $key => $action) { $class = !empty($action['class']) ? sanitize_html_class($action['class']) : ''; ?>
1968
+            <a href="<?php echo esc_url($action['url']); ?>" class="btn btn-sm <?php echo $class . ' ' . sanitize_html_class($key); ?>" <?php echo (!empty($action['attrs']) ? $action['attrs'] : ''); ?>><?php echo esc_html($action['name']); ?></a>
1969 1969
             <?php } ?>
1970 1970
         </div>
1971 1971
         <?php
1972 1972
         }
1973 1973
     }
1974 1974
 }
1975
-add_action( 'wpinv_receipt_start', 'wpinv_receipt_actions', -10, 1 );
1975
+add_action('wpinv_receipt_start', 'wpinv_receipt_actions', -10, 1);
1976 1976
 
1977
-function wpinv_invoice_link( $invoice_id ) {
1978
-    $invoice = wpinv_get_invoice( $invoice_id );
1977
+function wpinv_invoice_link($invoice_id) {
1978
+    $invoice = wpinv_get_invoice($invoice_id);
1979 1979
 
1980
-    if ( empty( $invoice ) ) {
1980
+    if (empty($invoice)) {
1981 1981
         return NULL;
1982 1982
     }
1983 1983
 
1984
-    $invoice_link = '<a href="' . esc_url( $invoice->get_view_url() ) . '">' . $invoice->get_number() . '</a>';
1984
+    $invoice_link = '<a href="' . esc_url($invoice->get_view_url()) . '">' . $invoice->get_number() . '</a>';
1985 1985
 
1986
-    return apply_filters( 'wpinv_get_invoice_link', $invoice_link, $invoice );
1986
+    return apply_filters('wpinv_get_invoice_link', $invoice_link, $invoice);
1987 1987
 }
1988 1988
 
1989
-function wpinv_invoice_subscription_details( $invoice ) {
1990
-    if ( !empty( $invoice ) && $invoice->is_recurring() && ! wpinv_is_subscription_payment( $invoice ) ) {
1991
-        $subscription = wpinv_get_subscription( $invoice, true );
1989
+function wpinv_invoice_subscription_details($invoice) {
1990
+    if (!empty($invoice) && $invoice->is_recurring() && !wpinv_is_subscription_payment($invoice)) {
1991
+        $subscription = wpinv_get_subscription($invoice, true);
1992 1992
 
1993
-        if ( empty( $subscription ) ) {
1993
+        if (empty($subscription)) {
1994 1994
             return;
1995 1995
         }
1996 1996
 
@@ -2001,15 +2001,15 @@  discard block
 block discarded – undo
2001 2001
         $payments = $subscription->get_child_payments();
2002 2002
         ?>
2003 2003
         <div class="wpinv-subscriptions-details">
2004
-            <h3 class="wpinv-subscriptions-t"><?php echo apply_filters( 'wpinv_subscription_details_title', __( 'Subscription Details', 'invoicing' ) ); ?></h3>
2004
+            <h3 class="wpinv-subscriptions-t"><?php echo apply_filters('wpinv_subscription_details_title', __('Subscription Details', 'invoicing')); ?></h3>
2005 2005
             <table class="table">
2006 2006
                 <thead>
2007 2007
                     <tr>
2008
-                        <th><?php _e( 'Billing Cycle', 'invoicing' ) ;?></th>
2009
-                        <th><?php _e( 'Start Date', 'invoicing' ) ;?></th>
2010
-                        <th><?php _e( 'Expiration Date', 'invoicing' ) ;?></th>
2011
-                        <th class="text-center"><?php _e( 'Times Billed', 'invoicing' ) ;?></th>
2012
-                        <th class="text-center"><?php _e( 'Status', 'invoicing' ) ;?></th>
2008
+                        <th><?php _e('Billing Cycle', 'invoicing'); ?></th>
2009
+                        <th><?php _e('Start Date', 'invoicing'); ?></th>
2010
+                        <th><?php _e('Expiration Date', 'invoicing'); ?></th>
2011
+                        <th class="text-center"><?php _e('Times Billed', 'invoicing'); ?></th>
2012
+                        <th class="text-center"><?php _e('Status', 'invoicing'); ?></th>
2013 2013
                     </tr>
2014 2014
                 </thead>
2015 2015
                 <tbody>
@@ -2023,29 +2023,29 @@  discard block
 block discarded – undo
2023 2023
                 </tbody>
2024 2024
             </table>
2025 2025
         </div>
2026
-        <?php if ( !empty( $payments ) ) { ?>
2026
+        <?php if (!empty($payments)) { ?>
2027 2027
         <div class="wpinv-renewal-payments">
2028
-            <h3 class="wpinv-renewals-t"><?php echo apply_filters( 'wpinv_renewal_payments_title', __( 'Renewal Payments', 'invoicing' ) ); ?></h3>
2028
+            <h3 class="wpinv-renewals-t"><?php echo apply_filters('wpinv_renewal_payments_title', __('Renewal Payments', 'invoicing')); ?></h3>
2029 2029
             <table class="table">
2030 2030
                 <thead>
2031 2031
                     <tr>
2032 2032
                         <th>#</th>
2033
-                        <th><?php _e( 'Invoice', 'invoicing' ) ;?></th>
2034
-                        <th><?php _e( 'Date', 'invoicing' ) ;?></th>
2035
-                        <th class="text-right"><?php _e( 'Amount', 'invoicing' ) ;?></th>
2033
+                        <th><?php _e('Invoice', 'invoicing'); ?></th>
2034
+                        <th><?php _e('Date', 'invoicing'); ?></th>
2035
+                        <th class="text-right"><?php _e('Amount', 'invoicing'); ?></th>
2036 2036
                     </tr>
2037 2037
                 </thead>
2038 2038
                 <tbody>
2039 2039
                     <?php
2040 2040
                         $i = 1;
2041
-                        foreach ( $payments as $payment ) {
2041
+                        foreach ($payments as $payment) {
2042 2042
                             $invoice_id = $payment->ID;
2043 2043
                     ?>
2044 2044
                     <tr>
2045
-                        <th scope="row"><?php echo $i;?></th>
2046
-                        <td><?php echo wpinv_invoice_link( $invoice_id ) ;?></td>
2047
-                        <td><?php echo wpinv_get_invoice_date( $invoice_id ); ?></td>
2048
-                        <td class="text-right"><?php echo wpinv_payment_total( $invoice_id, true ); ?></td>
2045
+                        <th scope="row"><?php echo $i; ?></th>
2046
+                        <td><?php echo wpinv_invoice_link($invoice_id); ?></td>
2047
+                        <td><?php echo wpinv_get_invoice_date($invoice_id); ?></td>
2048
+                        <td class="text-right"><?php echo wpinv_payment_total($invoice_id, true); ?></td>
2049 2049
                     </tr>
2050 2050
                     <?php $i++; } ?>
2051 2051
                 </tbody>
@@ -2056,52 +2056,52 @@  discard block
 block discarded – undo
2056 2056
     }
2057 2057
 }
2058 2058
 
2059
-function wpinv_cart_total_label( $label, $invoice ) {
2060
-    if ( empty( $invoice ) ) {
2059
+function wpinv_cart_total_label($label, $invoice) {
2060
+    if (empty($invoice)) {
2061 2061
         return $label;
2062 2062
     }
2063 2063
 
2064 2064
     $prefix_label = '';
2065
-    if ( $invoice->is_parent() && $item_id = $invoice->get_recurring() ) {
2066
-        $prefix_label   = '<span class="label label-primary label-recurring">' . __( 'Recurring Payment', 'invoicing' ) . '</span> ' . wpinv_subscription_payment_desc( $invoice );
2067
-    } else if ( $invoice->is_renewal() ) {
2068
-        $prefix_label   = '<span class="label label-primary label-renewal">' . __( 'Renewal Payment', 'invoicing' ) . '</span> ';        
2065
+    if ($invoice->is_parent() && $item_id = $invoice->get_recurring()) {
2066
+        $prefix_label   = '<span class="label label-primary label-recurring">' . __('Recurring Payment', 'invoicing') . '</span> ' . wpinv_subscription_payment_desc($invoice);
2067
+    } else if ($invoice->is_renewal()) {
2068
+        $prefix_label   = '<span class="label label-primary label-renewal">' . __('Renewal Payment', 'invoicing') . '</span> ';        
2069 2069
     }
2070 2070
 
2071
-    if ( $prefix_label != '' ) {
2072
-        $label  = '<span class="wpinv-cart-sub-desc">' . $prefix_label . '</span> ' . $label;
2071
+    if ($prefix_label != '') {
2072
+        $label = '<span class="wpinv-cart-sub-desc">' . $prefix_label . '</span> ' . $label;
2073 2073
     }
2074 2074
 
2075 2075
     return $label;
2076 2076
 }
2077
-add_filter( 'wpinv_cart_total_label', 'wpinv_cart_total_label', 10, 2 );
2078
-add_filter( 'wpinv_email_cart_total_label', 'wpinv_cart_total_label', 10, 2 );
2079
-add_filter( 'wpinv_print_cart_total_label', 'wpinv_cart_total_label', 10, 2 );
2077
+add_filter('wpinv_cart_total_label', 'wpinv_cart_total_label', 10, 2);
2078
+add_filter('wpinv_email_cart_total_label', 'wpinv_cart_total_label', 10, 2);
2079
+add_filter('wpinv_print_cart_total_label', 'wpinv_cart_total_label', 10, 2);
2080 2080
 
2081
-add_action( 'wpinv_invoice_print_middle', 'wpinv_invoice_subscription_details', 10, 1 );
2081
+add_action('wpinv_invoice_print_middle', 'wpinv_invoice_subscription_details', 10, 1);
2082 2082
 
2083
-function wpinv_invoice_print_description( $invoice ) {
2084
-    if ( empty( $invoice ) ) {
2083
+function wpinv_invoice_print_description($invoice) {
2084
+    if (empty($invoice)) {
2085 2085
         return NULL;
2086 2086
     }
2087
-    if ( $description = wpinv_get_invoice_description( $invoice->ID ) ) {
2087
+    if ($description = wpinv_get_invoice_description($invoice->ID)) {
2088 2088
         ?>
2089 2089
         <div class="row wpinv-lower">
2090 2090
             <div class="col-sm-12 wpinv-description">
2091
-                <?php echo wpautop( $description ); ?>
2091
+                <?php echo wpautop($description); ?>
2092 2092
             </div>
2093 2093
         </div>
2094 2094
         <?php
2095 2095
     }
2096 2096
 }
2097
-add_action( 'wpinv_invoice_print_middle', 'wpinv_invoice_print_description', 10.1, 1 );
2097
+add_action('wpinv_invoice_print_middle', 'wpinv_invoice_print_description', 10.1, 1);
2098 2098
 
2099
-function wpinv_invoice_print_payment_info( $invoice ) {
2100
-    if ( empty( $invoice ) ) {
2099
+function wpinv_invoice_print_payment_info($invoice) {
2100
+    if (empty($invoice)) {
2101 2101
         return NULL;
2102 2102
     }
2103 2103
 
2104
-    if ( $payments_info = wpinv_display_payments_info( $invoice->ID, false ) ) {
2104
+    if ($payments_info = wpinv_display_payments_info($invoice->ID, false)) {
2105 2105
         ?>
2106 2106
         <div class="row wpinv-payments">
2107 2107
             <div class="col-sm-12">
@@ -2113,43 +2113,43 @@  discard block
 block discarded – undo
2113 2113
 }
2114 2114
 // add_action( 'wpinv_invoice_print_after_line_items', 'wpinv_invoice_print_payment_info', 10, 1 );
2115 2115
 
2116
-function wpinv_get_invoice_note_line_item( $note, $echo = true ) {
2117
-    if ( empty( $note ) ) {
2116
+function wpinv_get_invoice_note_line_item($note, $echo = true) {
2117
+    if (empty($note)) {
2118 2118
         return NULL;
2119 2119
     }
2120 2120
 
2121
-    if ( is_int( $note ) ) {
2122
-        $note = get_comment( $note );
2121
+    if (is_int($note)) {
2122
+        $note = get_comment($note);
2123 2123
     }
2124 2124
 
2125
-    if ( !( is_object( $note ) && is_a( $note, 'WP_Comment' ) ) ) {
2125
+    if (!(is_object($note) && is_a($note, 'WP_Comment'))) {
2126 2126
         return NULL;
2127 2127
     }
2128 2128
 
2129
-    $note_classes   = array( 'note' );
2130
-    $note_classes[] = get_comment_meta( $note->comment_ID, '_wpi_customer_note', true ) ? 'customer-note' : '';
2129
+    $note_classes   = array('note');
2130
+    $note_classes[] = get_comment_meta($note->comment_ID, '_wpi_customer_note', true) ? 'customer-note' : '';
2131 2131
     $note_classes[] = $note->comment_author === 'System' ? 'system-note' : '';
2132
-    $note_classes   = apply_filters( 'wpinv_invoice_note_class', array_filter( $note_classes ), $note );
2133
-    $note_classes   = !empty( $note_classes ) ? implode( ' ', $note_classes ) : '';
2132
+    $note_classes   = apply_filters('wpinv_invoice_note_class', array_filter($note_classes), $note);
2133
+    $note_classes   = !empty($note_classes) ? implode(' ', $note_classes) : '';
2134 2134
 
2135 2135
     ob_start();
2136 2136
     ?>
2137
-    <li rel="<?php echo absint( $note->comment_ID ) ; ?>" class="<?php echo esc_attr( $note_classes ); ?>">
2137
+    <li rel="<?php echo absint($note->comment_ID); ?>" class="<?php echo esc_attr($note_classes); ?>">
2138 2138
         <div class="note_content">
2139
-            <?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?>
2139
+            <?php echo wpautop(wptexturize(wp_kses_post($note->comment_content))); ?>
2140 2140
         </div>
2141 2141
         <p class="meta">
2142
-            <abbr class="exact-date" title="<?php echo $note->comment_date; ?>"><?php printf( __( '%1$s - %2$s at %3$s', 'invoicing' ), $note->comment_author, date_i18n( get_option( 'date_format' ), strtotime( $note->comment_date ) ), date_i18n( get_option( 'time_format' ), strtotime( $note->comment_date ) ) ); ?></abbr>&nbsp;&nbsp;
2143
-            <?php if ( is_admin() && ( $note->comment_author !== 'System' || wpinv_current_user_can_manage_invoicing() ) ) { ?>
2144
-                <a href="#" class="delete_note"><?php _e( 'Delete note', 'invoicing' ); ?></a>
2142
+            <abbr class="exact-date" title="<?php echo $note->comment_date; ?>"><?php printf(__('%1$s - %2$s at %3$s', 'invoicing'), $note->comment_author, date_i18n(get_option('date_format'), strtotime($note->comment_date)), date_i18n(get_option('time_format'), strtotime($note->comment_date))); ?></abbr>&nbsp;&nbsp;
2143
+            <?php if (is_admin() && ($note->comment_author !== 'System' || wpinv_current_user_can_manage_invoicing())) { ?>
2144
+                <a href="#" class="delete_note"><?php _e('Delete note', 'invoicing'); ?></a>
2145 2145
             <?php } ?>
2146 2146
         </p>
2147 2147
     </li>
2148 2148
     <?php
2149 2149
     $note_content = ob_get_clean();
2150
-    $note_content = apply_filters( 'wpinv_get_invoice_note_line_item', $note_content, $note, $echo );
2150
+    $note_content = apply_filters('wpinv_get_invoice_note_line_item', $note_content, $note, $echo);
2151 2151
 
2152
-    if ( $echo ) {
2152
+    if ($echo) {
2153 2153
         echo $note_content;
2154 2154
     } else {
2155 2155
         return $note_content;
@@ -2159,43 +2159,43 @@  discard block
 block discarded – undo
2159 2159
 function wpinv_invalid_invoice_content() {
2160 2160
     global $post;
2161 2161
 
2162
-    $invoice = wpinv_get_invoice( $post->ID );
2162
+    $invoice = wpinv_get_invoice($post->ID);
2163 2163
 
2164
-    $error = __( 'This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing' );
2165
-    if ( !empty( $invoice->ID ) && $invoice->has_status( array_keys( wpinv_get_invoice_statuses() ) ) ) {
2166
-        if ( is_user_logged_in() ) {
2167
-            if ( wpinv_require_login_to_checkout() ) {
2168
-                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
2169
-                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
2164
+    $error = __('This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing');
2165
+    if (!empty($invoice->ID) && $invoice->has_status(array_keys(wpinv_get_invoice_statuses()))) {
2166
+        if (is_user_logged_in()) {
2167
+            if (wpinv_require_login_to_checkout()) {
2168
+                if (isset($_GET['invoice_key']) && $_GET['invoice_key'] === $invoice->get_key()) {
2169
+                    $error = __('You are not allowed to view this invoice.', 'invoicing');
2170 2170
                 }
2171 2171
             }
2172 2172
         } else {
2173
-            if ( wpinv_require_login_to_checkout() ) {
2174
-                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
2175
-                    $error = __( 'You must be logged in to view this invoice.', 'invoicing' );
2173
+            if (wpinv_require_login_to_checkout()) {
2174
+                if (isset($_GET['invoice_key']) && $_GET['invoice_key'] === $invoice->get_key()) {
2175
+                    $error = __('You must be logged in to view this invoice.', 'invoicing');
2176 2176
                 }
2177 2177
             }
2178 2178
         }
2179 2179
     } else {
2180
-        $error = __( 'This invoice is deleted or does not exist.', 'invoicing' );
2180
+        $error = __('This invoice is deleted or does not exist.', 'invoicing');
2181 2181
     }
2182 2182
     ?>
2183 2183
     <div class="row wpinv-row-invalid">
2184 2184
         <div class="col-md-6 col-md-offset-3 wpinv-message error">
2185
-            <h3><?php _e( 'Access Denied', 'invoicing' ); ?></h3>
2185
+            <h3><?php _e('Access Denied', 'invoicing'); ?></h3>
2186 2186
             <p class="wpinv-msg-text"><?php echo $error; ?></p>
2187 2187
         </div>
2188 2188
     </div>
2189 2189
     <?php
2190 2190
 }
2191
-add_action( 'wpinv_invalid_invoice_content', 'wpinv_invalid_invoice_content' );
2191
+add_action('wpinv_invalid_invoice_content', 'wpinv_invalid_invoice_content');
2192 2192
 
2193
-add_action( 'wpinv_checkout_billing_fields_last', 'wpinv_force_company_name_field');
2194
-function wpinv_force_company_name_field(){
2193
+add_action('wpinv_checkout_billing_fields_last', 'wpinv_force_company_name_field');
2194
+function wpinv_force_company_name_field() {
2195 2195
     $invoice = wpinv_get_invoice_cart();
2196
-    $user_id = wpinv_get_user_id( $invoice->ID );
2197
-    $company = empty( $user_id ) ? "" : get_user_meta( $user_id, '_wpinv_company', true );
2198
-    if ( 1 == wpinv_get_option( 'force_show_company' ) && !wpinv_use_taxes() ) {
2196
+    $user_id = wpinv_get_user_id($invoice->ID);
2197
+    $company = empty($user_id) ? "" : get_user_meta($user_id, '_wpinv_company', true);
2198
+    if (1 == wpinv_get_option('force_show_company') && !wpinv_use_taxes()) {
2199 2199
         ?>
2200 2200
         <p class="wpi-cart-field wpi-col2 wpi-colf">
2201 2201
             <label for="wpinv_company" class="wpi-label"><?php _e('Company Name', 'invoicing'); ?></label>
@@ -2220,21 +2220,21 @@  discard block
 block discarded – undo
2220 2220
  * @return string
2221 2221
  */
2222 2222
 function wpinv_get_policy_text() {
2223
-    $privacy_page_id = get_option( 'wp_page_for_privacy_policy', 0 );
2223
+    $privacy_page_id = get_option('wp_page_for_privacy_policy', 0);
2224 2224
 
2225
-    $text = wpinv_get_option('invoicing_privacy_checkout_message', sprintf( __( 'Your personal data will be used to process your invoice, payment and for other purposes described in our %s.', 'invoicing' ), '[wpinv_privacy_policy]' ));
2225
+    $text = wpinv_get_option('invoicing_privacy_checkout_message', sprintf(__('Your personal data will be used to process your invoice, payment and for other purposes described in our %s.', 'invoicing'), '[wpinv_privacy_policy]'));
2226 2226
 
2227
-    if(!$privacy_page_id){
2228
-        $privacy_page_id = wpinv_get_option( 'privacy_page', 0 );
2227
+    if (!$privacy_page_id) {
2228
+        $privacy_page_id = wpinv_get_option('privacy_page', 0);
2229 2229
     }
2230 2230
 
2231
-    $privacy_link    = $privacy_page_id ? '<a href="' . esc_url( get_permalink( $privacy_page_id ) ) . '" class="wpinv-privacy-policy-link" target="_blank">' . __( 'privacy policy', 'invoicing' ) . '</a>' : __( 'privacy policy', 'invoicing' );
2231
+    $privacy_link = $privacy_page_id ? '<a href="' . esc_url(get_permalink($privacy_page_id)) . '" class="wpinv-privacy-policy-link" target="_blank">' . __('privacy policy', 'invoicing') . '</a>' : __('privacy policy', 'invoicing');
2232 2232
 
2233 2233
     $find_replace = array(
2234 2234
         '[wpinv_privacy_policy]' => $privacy_link,
2235 2235
     );
2236 2236
 
2237
-    $privacy_text = str_replace( array_keys( $find_replace ), array_values( $find_replace ), $text );
2237
+    $privacy_text = str_replace(array_keys($find_replace), array_values($find_replace), $text);
2238 2238
 
2239 2239
     return wp_kses_post(wpautop($privacy_text));
2240 2240
 }
@@ -2243,25 +2243,25 @@  discard block
 block discarded – undo
2243 2243
 /**
2244 2244
  * Allows the user to set their own price for an invoice item
2245 2245
  */
2246
-function wpinv_checkout_cart_item_name_your_price( $cart_item, $key ) {
2246
+function wpinv_checkout_cart_item_name_your_price($cart_item, $key) {
2247 2247
     
2248 2248
     //Ensure we have an item id
2249
-    if(! is_array( $cart_item ) || empty( $cart_item['id'] ) ) {
2249
+    if (!is_array($cart_item) || empty($cart_item['id'])) {
2250 2250
         return;
2251 2251
     }
2252 2252
 
2253 2253
     //Fetch the item
2254 2254
     $item_id = $cart_item['id'];
2255
-    $item    = new WPInv_Item( $item_id );
2255
+    $item    = new WPInv_Item($item_id);
2256 2256
     
2257
-    if(! $item->supports_dynamic_pricing() || !$item->get_is_dynamic_pricing() ) {
2257
+    if (!$item->supports_dynamic_pricing() || !$item->get_is_dynamic_pricing()) {
2258 2258
         return;
2259 2259
     }
2260 2260
 
2261 2261
     //Fetch the dynamic pricing "strings"
2262
-    $suggested_price_text = esc_html( wpinv_get_option( 'suggested_price_text', __( 'Suggested Price:', 'invoicing' ) ) );
2263
-    $minimum_price_text   = esc_html( wpinv_get_option( 'minimum_price_text', __( 'Minimum Price:', 'invoicing' ) ) );
2264
-    $name_your_price_text = esc_html( wpinv_get_option( 'name_your_price_text', __( 'Name Your Price', 'invoicing' ) ) );
2262
+    $suggested_price_text = esc_html(wpinv_get_option('suggested_price_text', __('Suggested Price:', 'invoicing')));
2263
+    $minimum_price_text   = esc_html(wpinv_get_option('minimum_price_text', __('Minimum Price:', 'invoicing')));
2264
+    $name_your_price_text = esc_html(wpinv_get_option('name_your_price_text', __('Name Your Price', 'invoicing')));
2265 2265
 
2266 2266
     //Display a "name_your_price" button
2267 2267
     echo " &mdash; <a href='#' class='wpinv-name-your-price-frontend small'>$name_your_price_text</a></div>";
@@ -2270,7 +2270,7 @@  discard block
 block discarded – undo
2270 2270
     echo '<div class="name-your-price-miniform">';
2271 2271
     
2272 2272
     //Maybe display the recommended price
2273
-    if( $item->get_price() > 0 && !empty( $suggested_price_text ) ) {
2273
+    if ($item->get_price() > 0 && !empty($suggested_price_text)) {
2274 2274
         $suggested_price = $item->get_the_price();
2275 2275
         echo "<div>$suggested_price_text &mdash; $suggested_price</div>";
2276 2276
     }
@@ -2278,50 +2278,50 @@  discard block
 block discarded – undo
2278 2278
     //Display the update price form
2279 2279
     $symbol         = wpinv_currency_symbol();
2280 2280
     $position       = wpinv_currency_position();
2281
-    $minimum        = esc_attr( $item->get_minimum_price() );
2282
-    $price          = esc_attr( $cart_item['item_price'] );
2283
-    $update         = esc_attr__( "Update", 'invoicing' );
2281
+    $minimum        = esc_attr($item->get_minimum_price());
2282
+    $price          = esc_attr($cart_item['item_price']);
2283
+    $update         = esc_attr__("Update", 'invoicing');
2284 2284
 
2285 2285
     //Ensure it supports dynamic prici
2286
-    if( $price < $minimum ) {
2286
+    if ($price < $minimum) {
2287 2287
         $price = $minimum;
2288 2288
     }
2289 2289
 
2290 2290
     echo '<label>';
2291 2291
     echo $position != 'right' ? $symbol . '&nbsp;' : '';
2292 2292
     echo "<input type='number' min='$minimum' placeholder='$price' value='$price' class='wpi-field-price' />";
2293
-    echo $position == 'right' ? '&nbsp;' . $symbol : '' ;
2293
+    echo $position == 'right' ? '&nbsp;' . $symbol : '';
2294 2294
     echo "</label>";
2295 2295
     echo "<input type='hidden' value='$item_id' class='wpi-field-item' />";
2296 2296
     echo "<a class='btn btn-success wpinv-submit wpinv-update-dynamic-price-frontend'>$update</a>";
2297 2297
 
2298 2298
     //Maybe display the minimum price
2299
-    if( $item->get_minimum_price() > 0 && !empty( $minimum_price_text ) ) {
2300
-        $minimum_price = wpinv_price( wpinv_format_amount( $item->get_minimum_price() ) );
2299
+    if ($item->get_minimum_price() > 0 && !empty($minimum_price_text)) {
2300
+        $minimum_price = wpinv_price(wpinv_format_amount($item->get_minimum_price()));
2301 2301
         echo "<div>$minimum_price_text &mdash; $minimum_price</div>";
2302 2302
     }
2303 2303
 
2304 2304
     echo "</div>";
2305 2305
 
2306 2306
 }
2307
-add_action( 'wpinv_checkout_cart_item_price_after', 'wpinv_checkout_cart_item_name_your_price', 10, 2 );
2307
+add_action('wpinv_checkout_cart_item_price_after', 'wpinv_checkout_cart_item_name_your_price', 10, 2);
2308 2308
 
2309 2309
 function wpinv_oxygen_fix_conflict() {
2310 2310
     global $ct_ignore_post_types;
2311 2311
 
2312
-    if ( ! is_array( $ct_ignore_post_types ) ) {
2312
+    if (!is_array($ct_ignore_post_types)) {
2313 2313
         $ct_ignore_post_types = array();
2314 2314
     }
2315 2315
 
2316
-    $post_types = array( 'wpi_discount', 'wpi_invoice', 'wpi_item' );
2316
+    $post_types = array('wpi_discount', 'wpi_invoice', 'wpi_item');
2317 2317
 
2318
-    foreach ( $post_types as $post_type ) {
2318
+    foreach ($post_types as $post_type) {
2319 2319
         $ct_ignore_post_types[] = $post_type;
2320 2320
 
2321 2321
         // Ignore post type
2322
-        add_filter( 'pre_option_oxygen_vsb_ignore_post_type_' . $post_type, '__return_true', 999 );
2322
+        add_filter('pre_option_oxygen_vsb_ignore_post_type_' . $post_type, '__return_true', 999);
2323 2323
     }
2324 2324
 
2325
-    remove_filter( 'template_include', 'wpinv_template', 10, 1 );
2326
-    add_filter( 'template_include', 'wpinv_template', 999, 1 );
2325
+    remove_filter('template_include', 'wpinv_template', 10, 1);
2326
+    add_filter('template_include', 'wpinv_template', 999, 1);
2327 2327
 }
2328 2328
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/composer/autoload_static.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,33 +6,33 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5
8 8
 {
9
-    public static $files = array (
9
+    public static $files = array(
10 10
         'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php',
11 11
         '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php',
12 12
     );
13 13
 
14
-    public static $prefixLengthsPsr4 = array (
14
+    public static $prefixLengthsPsr4 = array(
15 15
         'C' => 
16
-        array (
16
+        array(
17 17
             'Composer\\Installers\\' => 20,
18 18
         ),
19 19
     );
20 20
 
21
-    public static $prefixDirsPsr4 = array (
21
+    public static $prefixDirsPsr4 = array(
22 22
         'Composer\\Installers\\' => 
23
-        array (
23
+        array(
24 24
             0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
25 25
         ),
26 26
     );
27 27
 
28
-    public static $classMap = array (
28
+    public static $classMap = array(
29 29
         'AyeCode_Connect_Helper' => __DIR__ . '/..' . '/ayecode/ayecode-connect-helper/ayecode-connect-helper.php',
30 30
         'WP_Super_Duper' => __DIR__ . '/..' . '/ayecode/wp-super-duper/wp-super-duper.php',
31 31
     );
32 32
 
33 33
     public static function getInitializer(ClassLoader $loader)
34 34
     {
35
-        return \Closure::bind(function () use ($loader) {
35
+        return \Closure::bind(function() use ($loader) {
36 36
             $loader->prefixLengthsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixLengthsPsr4;
37 37
             $loader->prefixDirsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixDirsPsr4;
38 38
             $loader->classMap = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$classMap;
Please login to merge, or discard this patch.
widgets/payment-form.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function __construct() {
18 18
 
19
-		$forms = get_posts(
20
-			array(
21
-				'post_type'      => 'wpi_payment_form',
22
-				'orderby'        => 'title',
23
-				'order'          => 'ASC',
24
-				'posts_per_page' => -1,
25
-				'post_status'    => array( 'publish' ),
26
-			)
27
-		);
28
-
29
-		$options = array(
30
-			'' => __('Select a Form','invoicing')
31
-		);
32
-
33
-		foreach( $forms as $form ) {
34
-			$options[ $form->ID ] = $form->post_title;
35
-		}
19
+        $forms = get_posts(
20
+            array(
21
+                'post_type'      => 'wpi_payment_form',
22
+                'orderby'        => 'title',
23
+                'order'          => 'ASC',
24
+                'posts_per_page' => -1,
25
+                'post_status'    => array( 'publish' ),
26
+            )
27
+        );
28
+
29
+        $options = array(
30
+            '' => __('Select a Form','invoicing')
31
+        );
32
+
33
+        foreach( $forms as $form ) {
34
+            $options[ $form->ID ] = $form->post_title;
35
+        }
36 36
 
37 37
         $options = array(
38 38
             'textdomain'    => 'invoicing',
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
                 'form'            => array(
51 51
                     'title'       => __( 'Payment Form', 'invoicing' ),
52 52
                     'desc'        => __( 'Select your payment form.', 'invoicing' ),
53
-					'type'        => 'select',
54
-					'options'     =>  $options,
53
+                    'type'        => 'select',
54
+                    'options'     =>  $options,
55 55
                     'desc_tip'    => true,
56 56
                     'default'     => '',
57 57
                     'advanced'    => false
@@ -64,56 +64,56 @@  discard block
 block discarded – undo
64 64
         parent::__construct( $options );
65 65
     }
66 66
 
67
-	/**
68
-	 * The Super block output function.
69
-	 *
70
-	 * @param array $args
71
-	 * @param array $widget_args
72
-	 * @param string $content
73
-	 *
74
-	 * @return string
75
-	 */
67
+    /**
68
+     * The Super block output function.
69
+     *
70
+     * @param array $args
71
+     * @param array $widget_args
72
+     * @param string $content
73
+     *
74
+     * @return string
75
+     */
76 76
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
77
-		global $invoicing;
78
-
79
-		// Do we have a payment form?
80
-		if ( empty( $args['form'] ) ) {
81
-			return aui()->alert(
82
-				array(
83
-					'type'    => 'warning',
84
-					'content' => __( 'No payment form selected', 'invoicing' ),
85
-				)
86
-			);
87
-
88
-		}
89
-
90
-		// If yes, ensure that it is published.
91
-		if ( 'publish' != get_post_status( $args['form'] ) ) {
92
-			return aui()->alert(
93
-				array(
94
-					'type'    => 'warning',
95
-					'content' => __( 'This payment form is no longer active', 'invoicing' ),
96
-				)
97
-			);
98
-		}
99
-
100
-		// Get the form elements and items.
101
-		$elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
-		$items    = $invoicing->form_elements->get_form_items( $args['form'] );
103
-
104
-		ob_start();
105
-
106
-		echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
-		echo wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
108
-
109
-		foreach ( $elements as $element ) {
110
-			do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
111
-			do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
112
-		}
113
-
114
-		$content = ob_get_clean();
77
+        global $invoicing;
78
+
79
+        // Do we have a payment form?
80
+        if ( empty( $args['form'] ) ) {
81
+            return aui()->alert(
82
+                array(
83
+                    'type'    => 'warning',
84
+                    'content' => __( 'No payment form selected', 'invoicing' ),
85
+                )
86
+            );
87
+
88
+        }
89
+
90
+        // If yes, ensure that it is published.
91
+        if ( 'publish' != get_post_status( $args['form'] ) ) {
92
+            return aui()->alert(
93
+                array(
94
+                    'type'    => 'warning',
95
+                    'content' => __( 'This payment form is no longer active', 'invoicing' ),
96
+                )
97
+            );
98
+        }
99
+
100
+        // Get the form elements and items.
101
+        $elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
+        $items    = $invoicing->form_elements->get_form_items( $args['form'] );
103
+
104
+        ob_start();
105
+
106
+        echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
+        echo wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
108
+
109
+        foreach ( $elements as $element ) {
110
+            do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
111
+            do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
112
+        }
113
+
114
+        $content = ob_get_clean();
115 115
 		
116
-		return str_replace( 'sr-only', '', $content );
116
+        return str_replace( 'sr-only', '', $content );
117 117
 
118 118
     }
119 119
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
     exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 				'orderby'        => 'title',
23 23
 				'order'          => 'ASC',
24 24
 				'posts_per_page' => -1,
25
-				'post_status'    => array( 'publish' ),
25
+				'post_status'    => array('publish'),
26 26
 			)
27 27
 		);
28 28
 
29 29
 		$options = array(
30
-			'' => __('Select a Form','invoicing')
30
+			'' => __('Select a Form', 'invoicing')
31 31
 		);
32 32
 
33
-		foreach( $forms as $form ) {
34
-			$options[ $form->ID ] = $form->post_title;
33
+		foreach ($forms as $form) {
34
+			$options[$form->ID] = $form->post_title;
35 35
 		}
36 36
 
37 37
         $options = array(
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
             'block-keywords'=> "['invoicing','buy', 'buy item', 'pay', 'payment form']",
42 42
             'class_name'     => __CLASS__,
43 43
             'base_id'       => 'wpinv_payment_form',
44
-            'name'          => __('Invoicing > Payment Form','invoicing'),
44
+            'name'          => __('Invoicing > Payment Form', 'invoicing'),
45 45
             'widget_ops'    => array(
46 46
                 'classname'   => 'wpinv-payment-form-class bsui',
47
-                'description' => esc_html__('Displays a payment form.','invoicing'),
47
+                'description' => esc_html__('Displays a payment form.', 'invoicing'),
48 48
             ),
49 49
             'arguments'           => array(
50 50
                 'form'            => array(
51
-                    'title'       => __( 'Payment Form', 'invoicing' ),
52
-                    'desc'        => __( 'Select your payment form.', 'invoicing' ),
51
+                    'title'       => __('Payment Form', 'invoicing'),
52
+                    'desc'        => __('Select your payment form.', 'invoicing'),
53 53
 					'type'        => 'select',
54 54
 					'options'     =>  $options,
55 55
                     'desc_tip'    => true,
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         );
62 62
 
63 63
 
64
-        parent::__construct( $options );
64
+        parent::__construct($options);
65 65
     }
66 66
 
67 67
 	/**
@@ -73,47 +73,47 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string
75 75
 	 */
76
-    public function output( $args = array(), $widget_args = array(), $content = '' ) {
76
+    public function output($args = array(), $widget_args = array(), $content = '') {
77 77
 		global $invoicing;
78 78
 
79 79
 		// Do we have a payment form?
80
-		if ( empty( $args['form'] ) ) {
80
+		if (empty($args['form'])) {
81 81
 			return aui()->alert(
82 82
 				array(
83 83
 					'type'    => 'warning',
84
-					'content' => __( 'No payment form selected', 'invoicing' ),
84
+					'content' => __('No payment form selected', 'invoicing'),
85 85
 				)
86 86
 			);
87 87
 
88 88
 		}
89 89
 
90 90
 		// If yes, ensure that it is published.
91
-		if ( 'publish' != get_post_status( $args['form'] ) ) {
91
+		if ('publish' != get_post_status($args['form'])) {
92 92
 			return aui()->alert(
93 93
 				array(
94 94
 					'type'    => 'warning',
95
-					'content' => __( 'This payment form is no longer active', 'invoicing' ),
95
+					'content' => __('This payment form is no longer active', 'invoicing'),
96 96
 				)
97 97
 			);
98 98
 		}
99 99
 
100 100
 		// Get the form elements and items.
101
-		$elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
-		$items    = $invoicing->form_elements->get_form_items( $args['form'] );
101
+		$elements = $invoicing->form_elements->get_form_elements($args['form']);
102
+		$items    = $invoicing->form_elements->get_form_items($args['form']);
103 103
 
104 104
 		ob_start();
105 105
 
106 106
 		echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
-		echo wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
107
+		echo wp_nonce_field('wpinv_payment_form', 'wpinv_payment_form');
108 108
 
109
-		foreach ( $elements as $element ) {
110
-			do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
111
-			do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
109
+		foreach ($elements as $element) {
110
+			do_action('wpinv_frontend_render_payment_form_element', $element, $items, $args['form']);
111
+			do_action("wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form']);
112 112
 		}
113 113
 
114 114
 		$content = ob_get_clean();
115 115
 		
116
-		return str_replace( 'sr-only', '', $content );
116
+		return str_replace('sr-only', '', $content);
117 117
 
118 118
     }
119 119
 
Please login to merge, or discard this patch.
includes/class-wpinv.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
171 171
         require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
172 172
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
173
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
174
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
175
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
176
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
177
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
173
+        require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
174
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
175
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
176
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
177
+        require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
178 178
         require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
179 179
         require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' );
180 180
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
@@ -487,17 +487,17 @@  discard block
 block discarded – undo
487 487
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
488 488
     }
489 489
 
490
-	/**
491
-	 * Register widgets
492
-	 *
493
-	 */
494
-	public function register_widgets() {
495
-		register_widget( "WPInv_Checkout_Widget" );
496
-		register_widget( "WPInv_History_Widget" );
497
-		register_widget( "WPInv_Receipt_Widget" );
498
-		register_widget( "WPInv_Subscriptions_Widget" );
499
-		register_widget( "WPInv_Buy_Item_Widget" );
490
+    /**
491
+     * Register widgets
492
+     *
493
+     */
494
+    public function register_widgets() {
495
+        register_widget( "WPInv_Checkout_Widget" );
496
+        register_widget( "WPInv_History_Widget" );
497
+        register_widget( "WPInv_Receipt_Widget" );
498
+        register_widget( "WPInv_Subscriptions_Widget" );
499
+        register_widget( "WPInv_Buy_Item_Widget" );
500 500
         register_widget( "WPInv_Messages_Widget" );
501 501
         register_widget( 'WPInv_Payment_Form_Widget' );
502
-	}
502
+    }
503 503
 }
504 504
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +232 added lines, -232 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
 class WPInv_Plugin {
15 15
     private static $instance;
16 16
     
17 17
     public static function run() {
18
-        if ( !isset( self::$instance ) && !( self::$instance instanceof WPInv_Plugin ) ) {
18
+        if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Plugin)) {
19 19
             self::$instance = new WPInv_Plugin;
20 20
             self::$instance->includes();
21 21
             self::$instance->actions();
@@ -33,33 +33,33 @@  discard block
 block discarded – undo
33 33
     }
34 34
     
35 35
     public function define_constants() {
36
-        define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
37
-        define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
36
+        define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE));
37
+        define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE));
38 38
     }
39 39
     
40 40
     private function actions() {
41 41
         /* Internationalize the text strings used. */
42
-        add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
42
+        add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
43 43
         
44 44
         /* Perform actions on admin initialization. */
45
-        add_action( 'admin_init', array( &$this, 'admin_init') );
46
-        add_action( 'init', array( &$this, 'init' ), 3 );
47
-        add_action( 'init', array( &$this, 'wpinv_actions' ) );
45
+        add_action('admin_init', array(&$this, 'admin_init'));
46
+        add_action('init', array(&$this, 'init'), 3);
47
+        add_action('init', array(&$this, 'wpinv_actions'));
48 48
         
49
-        if ( class_exists( 'BuddyPress' ) ) {
50
-            add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) );
49
+        if (class_exists('BuddyPress')) {
50
+            add_action('bp_include', array(&$this, 'bp_invoicing_init'));
51 51
         }
52 52
 
53
-        add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
54
-        add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
53
+        add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
54
+        add_action('widgets_init', array(&$this, 'register_widgets'));
55 55
 
56
-        if ( is_admin() ) {
57
-            add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
58
-            add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ) );
59
-            add_action( 'admin_init', array( &$this, 'init_ayecode_connect_helper' ) );
56
+        if (is_admin()) {
57
+            add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
58
+            add_filter('admin_body_class', array(&$this, 'admin_body_class'));
59
+            add_action('admin_init', array(&$this, 'init_ayecode_connect_helper'));
60 60
 
61 61
         } else {
62
-            add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
62
+            add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
63 63
         }
64 64
         
65 65
         /**
@@ -69,28 +69,28 @@  discard block
 block discarded – undo
69 69
          *
70 70
          * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference.
71 71
          */
72
-        do_action_ref_array( 'wpinv_actions', array( &$this ) );
72
+        do_action_ref_array('wpinv_actions', array(&$this));
73 73
 
74
-        add_action( 'admin_init', array( &$this, 'activation_redirect') );
74
+        add_action('admin_init', array(&$this, 'activation_redirect'));
75 75
     }
76 76
 
77 77
     /**
78 78
      * Maybe show the AyeCode Connect Notice.
79 79
      */
80
-    public function init_ayecode_connect_helper(){
80
+    public function init_ayecode_connect_helper() {
81 81
         // AyeCode Connect notice
82
-        if ( is_admin() ){
82
+        if (is_admin()) {
83 83
             // set the strings so they can be translated
84 84
             $strings = array(
85
-                'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
86
-                'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
87
-                'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
88
-                'connect_button'    => __("Connect Site","invoicing"),
89
-                'connecting_button'    => __("Connecting...","invoicing"),
90
-                'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
91
-                'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
85
+                'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
86
+                'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
87
+                'connect'           => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"),
88
+                'connect_button'    => __("Connect Site", "invoicing"),
89
+                'connecting_button'    => __("Connecting...", "invoicing"),
90
+                'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
91
+                'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
92 92
             );
93
-            new AyeCode_Connect_Helper($strings,array('wpi-addons'));
93
+            new AyeCode_Connect_Helper($strings, array('wpi-addons'));
94 94
         }
95 95
     }
96 96
     
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
         /* Internationalize the text strings used. */
99 99
         $this->load_textdomain();
100 100
 
101
-        do_action( 'wpinv_loaded' );
101
+        do_action('wpinv_loaded');
102 102
 
103 103
         // Fix oxygen page builder conflict
104
-        if ( function_exists( 'ct_css_output' ) ) {
104
+        if (function_exists('ct_css_output')) {
105 105
             wpinv_oxygen_fix_conflict();
106 106
         }
107 107
     }
@@ -111,234 +111,234 @@  discard block
 block discarded – undo
111 111
      *
112 112
      * @since 1.0
113 113
      */
114
-    public function load_textdomain( $locale = NULL ) {
115
-        if ( empty( $locale ) ) {
116
-            $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
114
+    public function load_textdomain($locale = NULL) {
115
+        if (empty($locale)) {
116
+            $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
117 117
         }
118 118
 
119
-        $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
119
+        $locale = apply_filters('plugin_locale', $locale, 'invoicing');
120 120
         
121
-        unload_textdomain( 'invoicing' );
122
-        load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
123
-        load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
121
+        unload_textdomain('invoicing');
122
+        load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo');
123
+        load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages');
124 124
         
125 125
         /**
126 126
          * Define language constants.
127 127
          */
128
-        require_once( WPINV_PLUGIN_DIR . 'language.php' );
128
+        require_once(WPINV_PLUGIN_DIR . 'language.php');
129 129
     }
130 130
         
131 131
     public function includes() {
132 132
         global $wpinv_options;
133 133
         
134
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
134
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php');
135 135
         $wpinv_options = wpinv_get_settings();
136 136
         
137
-        require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
138
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php' );
139
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
140
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
141
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
142
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
143
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
144
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
145
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' );
146
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
147
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
148
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
149
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
150
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' );
151
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' );
152
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' );
153
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' );
154
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php' );
155
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' );
156
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' );
157
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
158
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
159
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
160
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
161
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' );
162
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
163
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
164
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
165
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
166
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php' );
167
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
168
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php' );
169
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
170
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
171
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
172
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
173
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
174
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
175
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
176
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
177
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
178
-        require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
179
-        require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' );
180
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
181
-
182
-        if ( !class_exists( 'WPInv_EUVat' ) ) {
183
-            require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' );
137
+        require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php');
138
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php');
139
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php');
140
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php');
141
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php');
142
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php');
143
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php');
144
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php');
145
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php');
146
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php');
147
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php');
148
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php');
149
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php');
150
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php');
151
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php');
152
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php');
153
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php');
154
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php');
155
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php');
156
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php');
157
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php');
158
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php');
159
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php');
160
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php');
161
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php');
162
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php');
163
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php');
164
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php');
165
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php');
166
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php');
167
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php');
168
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php');
169
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php');
170
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php');
171
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php');
172
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php');
173
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php');
174
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php');
175
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php');
176
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php');
177
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php');
178
+        require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php');
179
+        require_once(WPINV_PLUGIN_DIR . 'widgets/payment-form.php');
180
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php');
181
+
182
+        if (!class_exists('WPInv_EUVat')) {
183
+            require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php');
184 184
         }
185 185
         
186
-        $gateways = array_keys( wpinv_get_enabled_payment_gateways() );
187
-        if ( !empty( $gateways ) ) {
188
-            foreach ( $gateways as $gateway ) {
189
-                if ( $gateway == 'manual' ) {
186
+        $gateways = array_keys(wpinv_get_enabled_payment_gateways());
187
+        if (!empty($gateways)) {
188
+            foreach ($gateways as $gateway) {
189
+                if ($gateway == 'manual') {
190 190
                     continue;
191 191
                 }
192 192
                 
193 193
                 $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php';
194 194
                 
195
-                if ( file_exists( $gateway_file ) ) {
196
-                    require_once( $gateway_file );
195
+                if (file_exists($gateway_file)) {
196
+                    require_once($gateway_file);
197 197
                 }
198 198
             }
199 199
         }
200
-        require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' );
200
+        require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php');
201 201
         
202
-        if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
203
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' );
204
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
205
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' );
202
+        if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
203
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php');
204
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php');
205
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php');
206 206
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' );
207
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' );
208
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' );
209
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
210
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
211
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' );
212
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
213
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
214
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
207
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php');
208
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php');
209
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php');
210
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php');
211
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php');
212
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php');
213
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php');
214
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php');
215 215
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
216 216
             // load the user class only on the users.php page
217 217
             global $pagenow;
218
-            if($pagenow=='users.php'){
218
+            if ($pagenow == 'users.php') {
219 219
                 new WPInv_Admin_Users();
220 220
             }
221 221
         }
222 222
 
223 223
         // Register cli commands
224
-        if ( defined( 'WP_CLI' ) && WP_CLI ) {
225
-            require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
226
-            WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
224
+        if (defined('WP_CLI') && WP_CLI) {
225
+            require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php');
226
+            WP_CLI::add_command('invoicing', 'WPInv_CLI');
227 227
         }
228 228
         
229 229
         // include css inliner
230
-        if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) {
231
-            include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' );
230
+        if (!class_exists('Emogrifier') && class_exists('DOMDocument')) {
231
+            include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php');
232 232
         }
233 233
         
234
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' );
234
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php');
235 235
     }
236 236
     
237 237
     public function init() {
238 238
     }
239 239
     
240 240
     public function admin_init() {
241
-        add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) );
241
+        add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php'));
242 242
     }
243 243
 
244 244
     public function activation_redirect() {
245 245
         // Bail if no activation redirect
246
-        if ( !get_transient( '_wpinv_activation_redirect' ) ) {
246
+        if (!get_transient('_wpinv_activation_redirect')) {
247 247
             return;
248 248
         }
249 249
 
250 250
         // Delete the redirect transient
251
-        delete_transient( '_wpinv_activation_redirect' );
251
+        delete_transient('_wpinv_activation_redirect');
252 252
 
253 253
         // Bail if activating from network, or bulk
254
-        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
254
+        if (is_network_admin() || isset($_GET['activate-multi'])) {
255 255
             return;
256 256
         }
257 257
 
258
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
258
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
259 259
         exit;
260 260
     }
261 261
     
262 262
     public function enqueue_scripts() {
263
-        $suffix       = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
263
+        $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
264 264
         
265
-        wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION );
266
-        wp_enqueue_style( 'wpinv_front_style' );
265
+        wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION);
266
+        wp_enqueue_style('wpinv_front_style');
267 267
                
268 268
         // Register scripts
269
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
270
-        wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ),  WPINV_VERSION );
269
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
270
+        wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array('jquery'), WPINV_VERSION);
271 271
 
272 272
         $localize                         = array();
273
-        $localize['ajax_url']             = admin_url( 'admin-ajax.php' );
274
-        $localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
273
+        $localize['ajax_url']             = admin_url('admin-ajax.php');
274
+        $localize['nonce']                = wp_create_nonce('wpinv-nonce');
275 275
         $localize['currency_symbol']      = wpinv_currency_symbol();
276 276
         $localize['currency_pos']         = wpinv_currency_position();
277 277
         $localize['thousand_sep']         = wpinv_thousands_separator();
278 278
         $localize['decimal_sep']          = wpinv_decimal_separator();
279 279
         $localize['decimals']             = wpinv_decimals();
280
-        $localize['txtComplete']          = __( 'Complete', 'invoicing' );
280
+        $localize['txtComplete']          = __('Complete', 'invoicing');
281 281
         $localize['UseTaxes']             = wpinv_use_taxes();
282
-        $localize['checkoutNonce']        = wp_create_nonce( 'wpinv_checkout_nonce' );
282
+        $localize['checkoutNonce']        = wp_create_nonce('wpinv_checkout_nonce');
283 283
 
284
-        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
284
+        $localize = apply_filters('wpinv_front_js_localize', $localize);
285 285
         
286
-        wp_enqueue_script( 'jquery-blockui' );
286
+        wp_enqueue_script('jquery-blockui');
287 287
         $autofill_api = wpinv_get_option('address_autofill_api');
288 288
         $autofill_active = wpinv_get_option('address_autofill_active');
289
-        if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) {
290
-            if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) {
291
-                wp_dequeue_script( 'google-maps-api' );
289
+        if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) {
290
+            if (wp_script_is('google-maps-api', 'enqueued')) {
291
+                wp_dequeue_script('google-maps-api');
292 292
             }
293
-            wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false );
294
-            wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true );
293
+            wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false);
294
+            wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true);
295 295
         }
296 296
 
297
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
298
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
297
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
298
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
299 299
 
300
-        wp_enqueue_script( 'wpinv-front-script' );
301
-        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
300
+        wp_enqueue_script('wpinv-front-script');
301
+        wp_localize_script('wpinv-front-script', 'WPInv', $localize);
302 302
     }
303 303
 
304
-    public function admin_enqueue_scripts( $hook ) {
304
+    public function admin_enqueue_scripts($hook) {
305 305
         global $post, $pagenow;
306 306
         
307 307
         $post_type  = wpinv_admin_post_type();
308
-        $suffix     = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
309
-        $page       = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : '';
308
+        $suffix     = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
309
+        $page       = isset($_GET['page']) ? strtolower($_GET['page']) : '';
310 310
 
311 311
         $jquery_ui_css = false;
312
-        if ( ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount' ) && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
312
+        if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
313 313
             $jquery_ui_css = true;
314
-        } else if ( $page == 'wpinv-settings' || $page == 'wpinv-reports' ) {
314
+        } else if ($page == 'wpinv-settings' || $page == 'wpinv-reports') {
315 315
             $jquery_ui_css = true;
316 316
         }
317
-        if ( $jquery_ui_css ) {
318
-            wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' );
319
-            wp_enqueue_style( 'jquery-ui-css' );
317
+        if ($jquery_ui_css) {
318
+            wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16');
319
+            wp_enqueue_style('jquery-ui-css');
320 320
         }
321 321
 
322
-        wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
323
-        wp_enqueue_style( 'wpinv_meta_box_style' );
322
+        wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION);
323
+        wp_enqueue_style('wpinv_meta_box_style');
324 324
         
325
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
326
-        wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version );
327
-        wp_enqueue_style( 'wpinv_admin_style' );
325
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
326
+        wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version);
327
+        wp_enqueue_style('wpinv_admin_style');
328 328
 
329
-        $enqueue = ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) );
330
-        if ( $page == 'wpinv-subscriptions' ) {
331
-            wp_enqueue_script( 'jquery-ui-datepicker' );
329
+        $enqueue = ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php'));
330
+        if ($page == 'wpinv-subscriptions') {
331
+            wp_enqueue_script('jquery-ui-datepicker');
332 332
         }
333 333
         
334
-        if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) {
335
-            wp_enqueue_script( 'jquery-ui-datepicker' );
334
+        if ($enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue)) {
335
+            wp_enqueue_script('jquery-ui-datepicker');
336 336
         }
337 337
 
338
-        wp_enqueue_style( 'wp-color-picker' );
339
-        wp_enqueue_script( 'wp-color-picker' );
338
+        wp_enqueue_style('wp-color-picker');
339
+        wp_enqueue_script('wp-color-picker');
340 340
         
341
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
341
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
342 342
 
343 343
         if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
344 344
             $autofill_api = wpinv_get_option('address_autofill_api');
@@ -349,20 +349,20 @@  discard block
 block discarded – undo
349 349
             }
350 350
         }
351 351
 
352
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
353
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
352
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
353
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
354 354
 
355
-        wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ),  WPINV_VERSION );
356
-        wp_enqueue_script( 'wpinv-admin-script' );
355
+        wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), WPINV_VERSION);
356
+        wp_enqueue_script('wpinv-admin-script');
357 357
         
358 358
         $localize                               = array();
359
-        $localize['ajax_url']                   = admin_url( 'admin-ajax.php' );
360
-        $localize['post_ID']                    = isset( $post->ID ) ? $post->ID : '';
361
-        $localize['wpinv_nonce']                = wp_create_nonce( 'wpinv-nonce' );
362
-        $localize['add_invoice_note_nonce']     = wp_create_nonce( 'add-invoice-note' );
363
-        $localize['delete_invoice_note_nonce']  = wp_create_nonce( 'delete-invoice-note' );
364
-        $localize['invoice_item_nonce']         = wp_create_nonce( 'invoice-item' );
365
-        $localize['billing_details_nonce']      = wp_create_nonce( 'get-billing-details' );
359
+        $localize['ajax_url']                   = admin_url('admin-ajax.php');
360
+        $localize['post_ID']                    = isset($post->ID) ? $post->ID : '';
361
+        $localize['wpinv_nonce']                = wp_create_nonce('wpinv-nonce');
362
+        $localize['add_invoice_note_nonce']     = wp_create_nonce('add-invoice-note');
363
+        $localize['delete_invoice_note_nonce']  = wp_create_nonce('delete-invoice-note');
364
+        $localize['invoice_item_nonce']         = wp_create_nonce('invoice-item');
365
+        $localize['billing_details_nonce']      = wp_create_nonce('get-billing-details');
366 366
         $localize['tax']                        = wpinv_tax_amount();
367 367
         $localize['discount']                   = wpinv_discount_amount();
368 368
         $localize['currency_symbol']            = wpinv_currency_symbol();
@@ -370,95 +370,95 @@  discard block
 block discarded – undo
370 370
         $localize['thousand_sep']               = wpinv_thousands_separator();
371 371
         $localize['decimal_sep']                = wpinv_decimal_separator();
372 372
         $localize['decimals']                   = wpinv_decimals();
373
-        $localize['save_invoice']               = __( 'Save Invoice', 'invoicing' );
374
-        $localize['status_publish']             = wpinv_status_nicename( 'publish' );
375
-        $localize['status_pending']             = wpinv_status_nicename( 'wpi-pending' );
376
-        $localize['delete_tax_rate']            = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' );
377
-        $localize['OneItemMin']                 = __( 'Invoice must contain at least one item', 'invoicing' );
378
-        $localize['DeleteInvoiceItem']          = __( 'Are you sure you wish to delete this item?', 'invoicing' );
379
-        $localize['FillBillingDetails']         = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' );
380
-        $localize['confirmCalcTotals']          = __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' );
381
-        $localize['AreYouSure']                 = __( 'Are you sure?', 'invoicing' );
382
-        $localize['emptyInvoice']               = __( 'Add at least one item to save invoice!', 'invoicing' );
383
-        $localize['errDeleteItem']              = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' );
384
-        $localize['delete_subscription']        = __( 'Are you sure you want to delete this subscription?', 'invoicing' );
385
-        $localize['action_edit']                = __( 'Edit', 'invoicing' );
386
-        $localize['action_cancel']              = __( 'Cancel', 'invoicing' );
387
-
388
-        $localize = apply_filters( 'wpinv_admin_js_localize', $localize );
389
-
390
-        wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize );
373
+        $localize['save_invoice']               = __('Save Invoice', 'invoicing');
374
+        $localize['status_publish']             = wpinv_status_nicename('publish');
375
+        $localize['status_pending']             = wpinv_status_nicename('wpi-pending');
376
+        $localize['delete_tax_rate']            = __('Are you sure you wish to delete this tax rate?', 'invoicing');
377
+        $localize['OneItemMin']                 = __('Invoice must contain at least one item', 'invoicing');
378
+        $localize['DeleteInvoiceItem']          = __('Are you sure you wish to delete this item?', 'invoicing');
379
+        $localize['FillBillingDetails']         = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing');
380
+        $localize['confirmCalcTotals']          = __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing');
381
+        $localize['AreYouSure']                 = __('Are you sure?', 'invoicing');
382
+        $localize['emptyInvoice']               = __('Add at least one item to save invoice!', 'invoicing');
383
+        $localize['errDeleteItem']              = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing');
384
+        $localize['delete_subscription']        = __('Are you sure you want to delete this subscription?', 'invoicing');
385
+        $localize['action_edit']                = __('Edit', 'invoicing');
386
+        $localize['action_cancel']              = __('Cancel', 'invoicing');
387
+
388
+        $localize = apply_filters('wpinv_admin_js_localize', $localize);
389
+
390
+        wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize);
391 391
 
392 392
         // Load payment form scripts on our admin pages only.
393
-        if ( ( $hook == 'post-new.php' || $hook == 'post.php' ) && 'wpi_payment_form' === $post->post_type ) {
393
+        if (($hook == 'post-new.php' || $hook == 'post.php') && 'wpi_payment_form' === $post->post_type) {
394 394
 
395
-            wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
396
-            wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
397
-            wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
395
+            wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION);
396
+            wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
397
+            wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
398 398
 
399
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
400
-            wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
399
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
400
+            wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version);
401 401
         
402
-            wp_localize_script( 'wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
402
+            wp_localize_script('wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
403 403
                 'elements'      => $this->form_elements->get_elements(),
404
-                'form_elements' => $this->form_elements->get_form_elements( $post->ID ),
404
+                'form_elements' => $this->form_elements->get_form_elements($post->ID),
405 405
                 'all_items'     => $this->form_elements->get_published_items(),
406 406
                 'currency'      => wpinv_currency_symbol(),
407 407
                 'position'      => wpinv_currency_position(),
408 408
                 'decimals'      => (int) wpinv_decimals(),
409 409
                 'thousands_sep' => wpinv_thousands_separator(),
410 410
                 'decimals_sep'  => wpinv_decimal_separator(),
411
-                'form_items'    => $this->form_elements->get_form_items( $post->ID ),
412
-            ) );
411
+                'form_items'    => $this->form_elements->get_form_items($post->ID),
412
+            ));
413 413
 
414
-            wp_enqueue_script( 'wpinv-admin-payment-form-script' );
414
+            wp_enqueue_script('wpinv-admin-payment-form-script');
415 415
         }
416 416
 
417
-        if ( $page == 'wpinv-subscriptions' ) {
418
-            wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ),  WPINV_VERSION );
419
-            wp_enqueue_script( 'wpinv-sub-admin-script' );
417
+        if ($page == 'wpinv-subscriptions') {
418
+            wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array('wpinv-admin-script'), WPINV_VERSION);
419
+            wp_enqueue_script('wpinv-sub-admin-script');
420 420
         }
421 421
 
422 422
     }
423 423
     
424
-    public function admin_body_class( $classes ) {
424
+    public function admin_body_class($classes) {
425 425
         global $pagenow, $post, $current_screen;
426 426
         
427
-        if ( !empty( $current_screen->post_type ) && ( $current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_payment_form' || $current_screen->post_type == 'wpi_quote' ) ) {
427
+        if (!empty($current_screen->post_type) && ($current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_payment_form' || $current_screen->post_type == 'wpi_quote')) {
428 428
             $classes .= ' wpinv-cpt';
429 429
         }
430 430
         
431
-        $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
431
+        $page = isset($_GET['page']) ? strtolower($_GET['page']) : false;
432 432
 
433
-        $add_class = $page && $pagenow == 'admin.php' && strpos( $page, 'wpinv-' ) === 0 ? true : false;
434
-        if ( $add_class ) {
435
-            $classes .= ' wpi-' . wpinv_sanitize_key( $page );
433
+        $add_class = $page && $pagenow == 'admin.php' && strpos($page, 'wpinv-') === 0 ? true : false;
434
+        if ($add_class) {
435
+            $classes .= ' wpi-' . wpinv_sanitize_key($page);
436 436
         }
437 437
         
438 438
         $settings_class = array();
439
-        if ( $page == 'wpinv-settings' ) {
440
-            if ( !empty( $_REQUEST['tab'] ) ) {
441
-                $settings_class[] = sanitize_text_field( $_REQUEST['tab'] );
439
+        if ($page == 'wpinv-settings') {
440
+            if (!empty($_REQUEST['tab'])) {
441
+                $settings_class[] = sanitize_text_field($_REQUEST['tab']);
442 442
             }
443 443
             
444
-            if ( !empty( $_REQUEST['section'] ) ) {
445
-                $settings_class[] = sanitize_text_field( $_REQUEST['section'] );
444
+            if (!empty($_REQUEST['section'])) {
445
+                $settings_class[] = sanitize_text_field($_REQUEST['section']);
446 446
             }
447 447
             
448
-            $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main';
448
+            $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main';
449 449
         }
450 450
         
451
-        if ( !empty( $settings_class ) ) {
452
-            $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) );
451
+        if (!empty($settings_class)) {
452
+            $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-'));
453 453
         }
454 454
         
455 455
         $post_type = wpinv_admin_post_type();
456 456
 
457
-        if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) {
457
+        if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) {
458 458
             return $classes .= ' wpinv';
459 459
         }
460 460
         
461
-        if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) {
461
+        if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) {
462 462
             $classes .= ' wpi-editable-n';
463 463
         }
464 464
 
@@ -470,21 +470,21 @@  discard block
 block discarded – undo
470 470
     }
471 471
     
472 472
     public function wpinv_actions() {
473
-        if ( isset( $_REQUEST['wpi_action'] ) ) {
474
-            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
473
+        if (isset($_REQUEST['wpi_action'])) {
474
+            do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
475 475
         }
476 476
     }
477 477
     
478
-    public function pre_get_posts( $wp_query ) {
479
-        if ( !empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) {
480
-            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() );
478
+    public function pre_get_posts($wp_query) {
479
+        if (!empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query()) {
480
+            $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses());
481 481
         }
482 482
         
483 483
         return $wp_query;
484 484
     }
485 485
     
486 486
     public function bp_invoicing_init() {
487
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
487
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
488 488
     }
489 489
 
490 490
 	/**
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 	 *
493 493
 	 */
494 494
 	public function register_widgets() {
495
-		register_widget( "WPInv_Checkout_Widget" );
496
-		register_widget( "WPInv_History_Widget" );
497
-		register_widget( "WPInv_Receipt_Widget" );
498
-		register_widget( "WPInv_Subscriptions_Widget" );
499
-		register_widget( "WPInv_Buy_Item_Widget" );
500
-        register_widget( "WPInv_Messages_Widget" );
501
-        register_widget( 'WPInv_Payment_Form_Widget' );
495
+		register_widget("WPInv_Checkout_Widget");
496
+		register_widget("WPInv_History_Widget");
497
+		register_widget("WPInv_Receipt_Widget");
498
+		register_widget("WPInv_Subscriptions_Widget");
499
+		register_widget("WPInv_Buy_Item_Widget");
500
+        register_widget("WPInv_Messages_Widget");
501
+        register_widget('WPInv_Payment_Form_Widget');
502 502
 	}
503 503
 }
504 504
\ No newline at end of file
Please login to merge, or discard this patch.
includes/data/sample-payment-form-items.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 return array(
14 14
 
15 15
     array(
16 16
 
17
-        'title'       => __( 'My Cool Item', 'invoicing' ),
17
+        'title'       => __('My Cool Item', 'invoicing'),
18 18
         'id'          => 'fxhnagzi',
19 19
         'price'       => '999.00',
20 20
         'recurring'   => false,
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     array(
26 26
 
27
-        'title'       => __( 'Shipping Fee', 'invoicing' ),
27
+        'title'       => __('Shipping Fee', 'invoicing'),
28 28
         'id'          => 'rxnymibri',
29 29
         'price'       => '19.99',
30 30
         'recurring'   => false,
Please login to merge, or discard this patch.
includes/data/sample-payment-form.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 return array(
14 14
 
15 15
     array(
16 16
 
17 17
         'level' => 'h2',
18
-        'text'  => __( 'Payment Form', 'invoicing' ),
18
+        'text'  => __('Payment Form', 'invoicing'),
19 19
         'id'    => 'uiylyczw',
20 20
         'name'  => 'uiylyczw',
21 21
         'type'  => 'heading'
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
     array(
25 25
 
26
-        'text' => __( 'Fill the form below to place an order for my cool item', 'invoicing' ),
26
+        'text' => __('Fill the form below to place an order for my cool item', 'invoicing'),
27 27
         'id'   => 'pcvqjj',
28 28
         'name' => 'pcvqjj',
29 29
         'type' => 'paragraph'
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
         'placeholder' => 'Jon',
36 36
         'value'       => '',
37
-        'label'       => __( 'First Name', 'invoicing' ),
37
+        'label'       => __('First Name', 'invoicing'),
38 38
         'description' => '',
39 39
         'required'    => false,
40 40
         'id'          => 'ynkzkjyc',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
         'placeholder' => 'Snow',
49 49
         'value'       => '',
50
-        'label'       => __( 'Last Name', 'invoicing' ),
50
+        'label'       => __('Last Name', 'invoicing'),
51 51
         'description' => '',
52 52
         'required'    => false,
53 53
         'id'          => 'wfjcdmzox',
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         'placeholder' => '[email protected]',
62 62
         'value'       => '',
63
-        'label'       => __( 'Billing Email', 'invoicing' ),
63
+        'label'       => __('Billing Email', 'invoicing'),
64 64
         'description' => '',
65 65
         'required'    => true,
66 66
         'id'          => 'mmdwqzpox',
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 
86 86
         'value'       =>'',
87 87
         'class'       => 'btn-primary',
88
-        'label'       => __( 'Pay Now »', 'invoicing' ),
89
-        'description' => __( 'By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
88
+        'label'       => __('Pay Now »', 'invoicing'),
89
+        'description' => __('By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
90 90
         'id'          => 'rtqljyy',
91 91
         'name'        => 'rtqljyy',
92 92
         'type'        => 'pay_button',
Please login to merge, or discard this patch.
includes/class-wpinv-payment-form-elements.php 1 patch
Spacing   +372 added lines, -372 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
     exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function __construct() {
15 15
 
16
-        foreach( $this->get_elements() as $element ) {
16
+        foreach ($this->get_elements() as $element) {
17 17
             $element = $element['type'];
18 18
 
19
-            if ( method_exists( $this, "render_{$element}_template" ) ) {
20
-                add_action( 'wpinv_payment_form_render_element_template', array( $this, "render_{$element}_template" ), 10, 2 );
19
+            if (method_exists($this, "render_{$element}_template")) {
20
+                add_action('wpinv_payment_form_render_element_template', array($this, "render_{$element}_template"), 10, 2);
21 21
             }
22 22
 
23
-            if ( method_exists( $this, "edit_{$element}_template" ) ) {
24
-                add_action( 'wpinv_payment_form_edit_element_template', array( $this, "edit_{$element}_template" ), 10, 2 );
23
+            if (method_exists($this, "edit_{$element}_template")) {
24
+                add_action('wpinv_payment_form_edit_element_template', array($this, "edit_{$element}_template"), 10, 2);
25 25
             }
26 26
 
27
-            if ( method_exists( $this, "frontend_render_{$element}_template" ) ) {
28
-                add_action( "wpinv_frontend_render_payment_form_$element", array( $this, "frontend_render_{$element}_template" ), 10, 3 );
27
+            if (method_exists($this, "frontend_render_{$element}_template")) {
28
+                add_action("wpinv_frontend_render_payment_form_$element", array($this, "frontend_render_{$element}_template"), 10, 3);
29 29
             }
30 30
 
31 31
         }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function get_elements() {
39 39
 
40
-        if ( ! empty( $this->elements ) ) {
40
+        if (!empty($this->elements)) {
41 41
             return $this->elements;
42 42
         }
43 43
 
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
 
46 46
             array(
47 47
                 'type'     => 'heading',
48
-                'name'     => __( 'Heading', 'invoicing' ),
48
+                'name'     => __('Heading', 'invoicing'),
49 49
                 'defaults' => array(
50 50
                     'level' => 'h2',
51
-                    'text'  => __( 'Heading', 'invoicing' ),
51
+                    'text'  => __('Heading', 'invoicing'),
52 52
                 )
53 53
             ),
54 54
 
55 55
             array(
56 56
                 'type' => 'paragraph',
57
-                'name' => __( 'Paragraph', 'invoicing' ),
57
+                'name' => __('Paragraph', 'invoicing'),
58 58
                 'defaults'  => array(
59
-                    'text'  => __( 'Paragraph text', 'invoicing' ),
59
+                    'text'  => __('Paragraph text', 'invoicing'),
60 60
                 )
61 61
             ),
62 62
 
63 63
             array( 
64 64
                 'type' => 'alert',
65
-                'name' => __( 'Alert', 'invoicing' ),
65
+                'name' => __('Alert', 'invoicing'),
66 66
                 'defaults'  => array(
67 67
                     'value'        => '',
68 68
                     'class'        => 'alert-warning',
69
-                    'text'         => __( 'Alert', 'invoicing' ),
69
+                    'text'         => __('Alert', 'invoicing'),
70 70
                     'dismissible'  => false,
71 71
                 )
72 72
             ),
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 
83 83
             array(
84 84
                 'type' => 'text',
85
-                'name' => __( 'Text Input', 'invoicing' ),
85
+                'name' => __('Text Input', 'invoicing'),
86 86
                 'defaults'  => array(
87
-                    'placeholder'  => __( 'Enter some text', 'invoicing' ),
87
+                    'placeholder'  => __('Enter some text', 'invoicing'),
88 88
                     'value'        => '',
89
-                    'label'        => __( 'Field Label', 'invoicing' ),
89
+                    'label'        => __('Field Label', 'invoicing'),
90 90
                     'description'  => '',
91 91
                     'required'     => false,
92 92
                 )
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 
95 95
             array(
96 96
                 'type' => 'textarea',
97
-                'name' => __( 'Textarea', 'invoicing' ),
97
+                'name' => __('Textarea', 'invoicing'),
98 98
                 'defaults'         => array(
99
-                    'placeholder'  => __( 'Enter your text hear', 'invoicing' ),
99
+                    'placeholder'  => __('Enter your text hear', 'invoicing'),
100 100
                     'value'        => '',
101
-                    'label'        => __( 'Textarea Label', 'invoicing' ),
101
+                    'label'        => __('Textarea Label', 'invoicing'),
102 102
                     'description'  => '',
103 103
                     'required'     => false,
104 104
                 )
@@ -106,27 +106,27 @@  discard block
 block discarded – undo
106 106
 
107 107
             array(
108 108
                 'type' => 'select',
109
-                'name' => __( 'Dropdown', 'invoicing' ),
109
+                'name' => __('Dropdown', 'invoicing'),
110 110
                 'defaults'         => array(
111
-                    'placeholder'  => __( 'Select a value', 'invoicing' ),
111
+                    'placeholder'  => __('Select a value', 'invoicing'),
112 112
                     'value'        => '',
113
-                    'label'        => __( 'Dropdown Label', 'invoicing' ),
113
+                    'label'        => __('Dropdown Label', 'invoicing'),
114 114
                     'description'  => '',
115 115
                     'required'     => false,
116 116
                     'options'      => array(
117
-                        esc_attr__( 'Option One', 'invoicing' ),
118
-                        esc_attr__( 'Option Two', 'invoicing' ),
119
-                        esc_attr__( 'Option Three', 'invoicing' )
117
+                        esc_attr__('Option One', 'invoicing'),
118
+                        esc_attr__('Option Two', 'invoicing'),
119
+                        esc_attr__('Option Three', 'invoicing')
120 120
                     ),
121 121
                 )
122 122
             ),
123 123
 
124 124
             array(
125 125
                 'type' => 'checkbox',
126
-                'name' => __( 'Checkbox', 'invoicing' ),
126
+                'name' => __('Checkbox', 'invoicing'),
127 127
                 'defaults'         => array(
128 128
                     'value'        => '',
129
-                    'label'        => __( 'Checkbox Label', 'invoicing' ),
129
+                    'label'        => __('Checkbox Label', 'invoicing'),
130 130
                     'description'  => '',
131 131
                     'required'     => false,
132 132
                 )
@@ -134,24 +134,24 @@  discard block
 block discarded – undo
134 134
 
135 135
             array( 
136 136
                 'type' => 'radio',
137
-                'name' => __( 'Multiple Choice', 'invoicing' ),
137
+                'name' => __('Multiple Choice', 'invoicing'),
138 138
                 'defaults'     => array(
139
-                    'label'    => __( 'Select one choice', 'invoicing' ),
139
+                    'label'    => __('Select one choice', 'invoicing'),
140 140
                     'options'  => array(
141
-                        esc_attr__( 'Choice One', 'invoicing' ),
142
-                        esc_attr__( 'Choice Two', 'invoicing' ),
143
-                        esc_attr__( 'Choice Three', 'invoicing' )
141
+                        esc_attr__('Choice One', 'invoicing'),
142
+                        esc_attr__('Choice Two', 'invoicing'),
143
+                        esc_attr__('Choice Three', 'invoicing')
144 144
                     ),
145 145
                 )
146 146
             ),
147 147
 
148 148
             array( 
149 149
                 'type' => 'date',
150
-                'name' => __( 'Date', 'invoicing' ),
150
+                'name' => __('Date', 'invoicing'),
151 151
                 'defaults' => array(
152 152
                     'placeholder'  => '',
153 153
                     'value'        => '',
154
-                    'label'        => __( 'Date', 'invoicing' ),
154
+                    'label'        => __('Date', 'invoicing'),
155 155
                     'description'  => '',
156 156
                     'required'     => false,
157 157
                 )
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 
160 160
             array( 
161 161
                 'type' => 'time',
162
-                'name' => __( 'Time', 'invoicing' ),
162
+                'name' => __('Time', 'invoicing'),
163 163
                 'defaults' => array(
164 164
                     'placeholder'  => '',
165 165
                     'value'        => '',
166
-                    'label'        => __( 'Time', 'invoicing' ),
166
+                    'label'        => __('Time', 'invoicing'),
167 167
                     'description'  => '',
168 168
                     'required'     => false,
169 169
                 )
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 
172 172
             array( 
173 173
                 'type' => 'number',
174
-                'name' => __( 'Number', 'invoicing' ),
174
+                'name' => __('Number', 'invoicing'),
175 175
                 'defaults' => array(
176 176
                     'placeholder'  => '',
177 177
                     'value'        => '',
178
-                    'label'        => __( 'Number', 'invoicing' ),
178
+                    'label'        => __('Number', 'invoicing'),
179 179
                     'description'  => '',
180 180
                     'required'     => false,
181 181
                 )
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 
184 184
             array( 
185 185
                 'type' => 'website',
186
-                'name' => __( 'Website', 'invoicing' ),
186
+                'name' => __('Website', 'invoicing'),
187 187
                 'defaults' => array(
188 188
                     'placeholder'  => 'http://example.com',
189 189
                     'value'        => '',
190
-                    'label'        => __( 'Website', 'invoicing' ),
190
+                    'label'        => __('Website', 'invoicing'),
191 191
                     'description'  => '',
192 192
                     'required'     => false,
193 193
                 )
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 
196 196
             array( 
197 197
                 'type' => 'email',
198
-                'name' => __( 'Email', 'invoicing' ),
198
+                'name' => __('Email', 'invoicing'),
199 199
                 'defaults'  => array(
200 200
                     'placeholder'  => '[email protected]',
201 201
                     'value'        => '',
202
-                    'label'        => __( 'Email Address', 'invoicing' ),
202
+                    'label'        => __('Email Address', 'invoicing'),
203 203
                     'description'  => '',
204 204
                     'required'     => false,
205 205
                 )
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 
208 208
             array( 
209 209
                 'type' => 'billing_email',
210
-                'name' => __( 'Billing Email', 'invoicing' ),
210
+                'name' => __('Billing Email', 'invoicing'),
211 211
                 'defaults'  => array(
212 212
                     'placeholder'  => '[email protected]',
213 213
                     'value'        => '',
214
-                    'label'        => __( 'Billing Email', 'invoicing' ),
214
+                    'label'        => __('Billing Email', 'invoicing'),
215 215
                     'description'  => '',
216 216
                     'premade'      => true,
217 217
                 )
@@ -219,18 +219,18 @@  discard block
 block discarded – undo
219 219
 
220 220
             array( 
221 221
                 'type' => 'discount',
222
-                'name' => __( 'Discount Input', 'invoicing' ),
222
+                'name' => __('Discount Input', 'invoicing'),
223 223
                 'defaults'  => array(
224 224
                     'value'        => '',
225
-                    'input_label'  => __( 'Coupon Code', 'invoicing' ),
226
-                    'button_label' => __( 'Apply Coupon', 'invoicing' ),
227
-                    'description'  => __( 'Have a discount code? Enter it above.', 'invoicing' ),
225
+                    'input_label'  => __('Coupon Code', 'invoicing'),
226
+                    'button_label' => __('Apply Coupon', 'invoicing'),
227
+                    'description'  => __('Have a discount code? Enter it above.', 'invoicing'),
228 228
                 )
229 229
             ),
230 230
 
231 231
             array( 
232 232
                 'type' => 'items',
233
-                'name' => __( 'Items', 'invoicing' ),
233
+                'name' => __('Items', 'invoicing'),
234 234
                 'defaults'  => array(
235 235
                     'value'        => '',
236 236
                     'items_type'   => 'total',
@@ -241,25 +241,25 @@  discard block
 block discarded – undo
241 241
 
242 242
             array( 
243 243
                 'type'       => 'pay_button',
244
-                'name'       => __( 'Payment Button', 'invoicing' ),
244
+                'name'       => __('Payment Button', 'invoicing'),
245 245
                 'defaults'   => array(
246 246
                     'value'        => '',
247 247
                     'class'        => 'btn-primary',
248
-                    'label'        => __( 'Pay Now »', 'invoicing' ),
249
-                    'description'  => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
248
+                    'label'        => __('Pay Now »', 'invoicing'),
249
+                    'description'  => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
250 250
                     'premade'      => true,
251 251
                 )
252 252
             )
253 253
         );
254 254
 
255
-        $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements );
255
+        $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements);
256 256
         return $this->elements;
257 257
     }
258 258
 
259 259
     /**
260 260
      * Returns the restrict markup.
261 261
      */
262
-    public function get_restrict_markup( $field, $field_type ) {
262
+    public function get_restrict_markup($field, $field_type) {
263 263
         $restrict = "$field.type=='$field_type'";
264 264
         return "v-if=\"$restrict\"";
265 265
     }
@@ -267,15 +267,15 @@  discard block
 block discarded – undo
267 267
     /**
268 268
      * Renders the title element template.
269 269
      */
270
-    public function render_heading_template( $field ) {
271
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
270
+    public function render_heading_template($field) {
271
+        $restrict = $this->get_restrict_markup($field, 'heading');
272 272
         echo "<component :is='$field.level' $restrict v-html='$field.text'></component>";
273 273
     }
274 274
 
275 275
     /**
276 276
      * Renders the title element on the frontend.
277 277
      */
278
-    public function frontend_render_heading_template( $field ) {
278
+    public function frontend_render_heading_template($field) {
279 279
         $tag = $field['level'];
280 280
         echo "<$tag>{$field['text']}</$tag>";
281 281
     }
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
     /**
284 284
      * Renders the edit title element template.
285 285
      */
286
-    public function edit_heading_template( $field ) {
287
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
288
-        $label    = __( 'Heading', 'invoicing' );
289
-        $label2   = __( 'Select Heading Level', 'invoicing' );
286
+    public function edit_heading_template($field) {
287
+        $restrict = $this->get_restrict_markup($field, 'heading');
288
+        $label    = __('Heading', 'invoicing');
289
+        $label2   = __('Select Heading Level', 'invoicing');
290 290
         $id       = $field . '.id + "_edit"';
291 291
         $id2      = $field . '.id + "_edit2"';
292 292
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
     /**
319 319
      * Renders a paragraph element template.
320 320
      */
321
-    public function render_paragraph_template( $field ) {
322
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
321
+    public function render_paragraph_template($field) {
322
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
323 323
         $label    = "$field.text";
324 324
         echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>";
325 325
     }
@@ -327,16 +327,16 @@  discard block
 block discarded – undo
327 327
     /**
328 328
      * Renders the paragraph element on the frontend.
329 329
      */
330
-    public function frontend_render_paragraph_template( $field ) {
330
+    public function frontend_render_paragraph_template($field) {
331 331
         echo "<p>{$field['text']}</p>";
332 332
     }
333 333
 
334 334
     /**
335 335
      * Renders the edit paragraph element template.
336 336
      */
337
-    public function edit_paragraph_template( $field ) {
338
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
339
-        $label    = __( 'Enter your text', 'invoicing' );
337
+    public function edit_paragraph_template($field) {
338
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
339
+        $label    = __('Enter your text', 'invoicing');
340 340
         $id       = $field . '.id + "_edit"';
341 341
         echo "
342 342
             <div $restrict>
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
     /**
353 353
      * Renders the text element template.
354 354
      */
355
-    public function render_text_template( $field ) {
356
-        $restrict = $this->get_restrict_markup( $field, 'text' );
355
+    public function render_text_template($field) {
356
+        $restrict = $this->get_restrict_markup($field, 'text');
357 357
         $label    = "$field.label";
358 358
         echo "
359 359
             <div $restrict>
@@ -367,23 +367,23 @@  discard block
 block discarded – undo
367 367
     /**
368 368
      * Renders the text element on the frontend.
369 369
      */
370
-    public function frontend_render_text_template( $field ) {
370
+    public function frontend_render_text_template($field) {
371 371
         
372 372
         echo "<div class='form-group'>";
373 373
 
374 374
         echo aui()->input(
375 375
             array(
376
-                'name'       => esc_attr( $field['id'] ),
377
-                'id'         => esc_attr( $field['id'] ),
378
-                'placeholder'=> esc_attr( $field['placeholder'] ),
376
+                'name'       => esc_attr($field['id']),
377
+                'id'         => esc_attr($field['id']),
378
+                'placeholder'=> esc_attr($field['placeholder']),
379 379
                 'required'   => (bool) $field['required'],
380
-                'label'      => wp_kses_post( $field['label'] ),
380
+                'label'      => wp_kses_post($field['label']),
381 381
                 'no_wrap'    => true,
382 382
             )
383 383
         );
384 384
 
385
-        if ( ! empty( $field['description'] ) ) {
386
-            $description = wp_kses_post( $field['description'] );
385
+        if (!empty($field['description'])) {
386
+            $description = wp_kses_post($field['description']);
387 387
             echo "<small class='form-text text-muted'>$description</small>";
388 388
         }
389 389
 
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
     /**
395 395
      * Renders the edit text element template.
396 396
      */
397
-    public function edit_text_template( $field ) {
398
-        $restrict = $this->get_restrict_markup( $field, 'text' );
399
-        $label    = __( 'Field Label', 'invoicing' );
397
+    public function edit_text_template($field) {
398
+        $restrict = $this->get_restrict_markup($field, 'text');
399
+        $label    = __('Field Label', 'invoicing');
400 400
         $id       = $field . '.id + "_edit"';
401
-        $label2   = __( 'Placeholder text', 'invoicing' );
401
+        $label2   = __('Placeholder text', 'invoicing');
402 402
         $id2      = $field . '.id + "_edit2"';
403
-        $label3   = __( 'Help text', 'invoicing' );
404
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
403
+        $label3   = __('Help text', 'invoicing');
404
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
405 405
         $id3      = $field . '.id + "_edit3"';
406
-        $label5   = __( 'Is this field required?', 'invoicing' );
406
+        $label5   = __('Is this field required?', 'invoicing');
407 407
         $id4      = $field . '.id + "_edit4"';
408 408
         echo "
409 409
             <div $restrict>
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
     /**
432 432
      * Renders the textarea element template.
433 433
      */
434
-    public function render_textarea_template( $field ) {
435
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
434
+    public function render_textarea_template($field) {
435
+        $restrict = $this->get_restrict_markup($field, 'textarea');
436 436
         $label    = "$field.label";
437 437
         echo "
438 438
             <div $restrict>
@@ -446,24 +446,24 @@  discard block
 block discarded – undo
446 446
     /**
447 447
      * Renders the textarea element on the frontend.
448 448
      */
449
-    public function frontend_render_textarea_template( $field ) {
449
+    public function frontend_render_textarea_template($field) {
450 450
         
451 451
         echo "<div class='form-group'>";
452 452
 
453 453
         echo aui()->textarea(
454 454
             array(
455
-                'name'       => esc_attr( $field['id'] ),
456
-                'id'         => esc_attr( $field['id'] ),
457
-                'placeholder'=> esc_attr( $field['placeholder'] ),
455
+                'name'       => esc_attr($field['id']),
456
+                'id'         => esc_attr($field['id']),
457
+                'placeholder'=> esc_attr($field['placeholder']),
458 458
                 'required'   => (bool) $field['required'],
459
-                'label'      => wp_kses_post( $field['label'] ),
459
+                'label'      => wp_kses_post($field['label']),
460 460
                 'no_wrap'    => true,
461 461
                 'rows'       => 3,
462 462
             )
463 463
         );
464 464
 
465
-        if ( ! empty( $field['description'] ) ) {
466
-            $description = wp_kses_post( $field['description'] );
465
+        if (!empty($field['description'])) {
466
+            $description = wp_kses_post($field['description']);
467 467
             echo "<small class='form-text text-muted'>$description</small>";
468 468
         }
469 469
 
@@ -474,16 +474,16 @@  discard block
 block discarded – undo
474 474
     /**
475 475
      * Renders the edit textarea element template.
476 476
      */
477
-    public function edit_textarea_template( $field ) {
478
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
479
-        $label    = __( 'Field Label', 'invoicing' );
477
+    public function edit_textarea_template($field) {
478
+        $restrict = $this->get_restrict_markup($field, 'textarea');
479
+        $label    = __('Field Label', 'invoicing');
480 480
         $id       = $field . '.id + "_edit"';
481
-        $label2   = __( 'Placeholder text', 'invoicing' );
481
+        $label2   = __('Placeholder text', 'invoicing');
482 482
         $id2      = $field . '.id + "_edit2"';
483
-        $label3   = __( 'Help text', 'invoicing' );
484
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
483
+        $label3   = __('Help text', 'invoicing');
484
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
485 485
         $id3      = $field . '.id + "_edit3"';
486
-        $label5   = __( 'Is this field required?', 'invoicing' );
486
+        $label5   = __('Is this field required?', 'invoicing');
487 487
         $id4      = $field . '.id + "_edit4"';
488 488
         echo "
489 489
             <div $restrict>
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
     /**
512 512
      * Renders the select element template.
513 513
      */
514
-    public function render_select_template( $field ) {
515
-        $restrict    = $this->get_restrict_markup( $field, 'select' );
514
+    public function render_select_template($field) {
515
+        $restrict    = $this->get_restrict_markup($field, 'select');
516 516
         $label       = "$field.label";
517 517
         $placeholder = "$field.placeholder";
518 518
         $id          = $field . '.id';
@@ -531,24 +531,24 @@  discard block
 block discarded – undo
531 531
     /**
532 532
      * Renders the select element on the frontend.
533 533
      */
534
-    public function frontend_render_select_template( $field ) {
534
+    public function frontend_render_select_template($field) {
535 535
         
536 536
         echo "<div class='form-group'>";
537 537
 
538 538
         echo aui()->select(
539 539
             array(
540
-                'name'       => esc_attr( $field['id'] ),
541
-                'id'         => esc_attr( $field['id'] ),
542
-                'placeholder'=> esc_attr( $field['placeholder'] ),
540
+                'name'       => esc_attr($field['id']),
541
+                'id'         => esc_attr($field['id']),
542
+                'placeholder'=> esc_attr($field['placeholder']),
543 543
                 'required'   => (bool) $field['required'],
544
-                'label'      => wp_kses_post( $field['label'] ),
544
+                'label'      => wp_kses_post($field['label']),
545 545
                 'no_wrap'    => true,
546 546
                 'options'    => $field['options'],
547 547
             )
548 548
         );
549 549
 
550
-        if ( ! empty( $field['description'] ) ) {
551
-            $description = wp_kses_post( $field['description'] );
550
+        if (!empty($field['description'])) {
551
+            $description = wp_kses_post($field['description']);
552 552
             echo "<small class='form-text text-muted'>$description</small>";
553 553
         }
554 554
 
@@ -559,18 +559,18 @@  discard block
 block discarded – undo
559 559
     /**
560 560
      * Renders the edit select element template.
561 561
      */
562
-    public function edit_select_template( $field ) {
563
-        $restrict = $this->get_restrict_markup( $field, 'select' );
564
-        $label    = __( 'Field Label', 'invoicing' );
562
+    public function edit_select_template($field) {
563
+        $restrict = $this->get_restrict_markup($field, 'select');
564
+        $label    = __('Field Label', 'invoicing');
565 565
         $id       = $field . '.id + "_edit"';
566
-        $label2   = __( 'Placeholder text', 'invoicing' );
566
+        $label2   = __('Placeholder text', 'invoicing');
567 567
         $id2      = $field . '.id + "_edit2"';
568
-        $label3   = __( 'Help text', 'invoicing' );
569
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
568
+        $label3   = __('Help text', 'invoicing');
569
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
570 570
         $id3      = $field . '.id + "_edit3"';
571
-        $label5   = __( 'Is this field required?', 'invoicing' );
571
+        $label5   = __('Is this field required?', 'invoicing');
572 572
         $id4      = $field . '.id + "_edit4"';
573
-        $label6   = __( 'Available Options', 'invoicing' );
573
+        $label6   = __('Available Options', 'invoicing');
574 574
         echo "
575 575
             <div $restrict>
576 576
                 <div class='form-group'>
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
     /**
609 609
      * Renders the checkbox element template.
610 610
      */
611
-    public function render_checkbox_template( $field ) {
612
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
611
+    public function render_checkbox_template($field) {
612
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
613 613
         $label    = "$field.label";
614 614
         echo "
615 615
             <div class='form-check' $restrict>
@@ -623,23 +623,23 @@  discard block
 block discarded – undo
623 623
     /**
624 624
      * Renders the checkbox element on the frontend.
625 625
      */
626
-    public function frontend_render_checkbox_template( $field ) {
626
+    public function frontend_render_checkbox_template($field) {
627 627
         
628 628
         echo "<div class='form-group'>";
629 629
 
630 630
         echo aui()->input(
631 631
             array(
632
-                'name'       => esc_attr( $field['id'] ),
633
-                'id'         => esc_attr( $field['id'] ),
632
+                'name'       => esc_attr($field['id']),
633
+                'id'         => esc_attr($field['id']),
634 634
                 'required'   => (bool) $field['required'],
635
-                'label'      => wp_kses_post( $field['label'] ),
635
+                'label'      => wp_kses_post($field['label']),
636 636
                 'no_wrap'    => true,
637 637
                 'type'       => 'checkbox',
638 638
             )
639 639
         );
640 640
 
641
-        if ( ! empty( $field['description'] ) ) {
642
-            $description = wp_kses_post( $field['description'] );
641
+        if (!empty($field['description'])) {
642
+            $description = wp_kses_post($field['description']);
643 643
             echo "<small class='form-text text-muted'>$description</small>";
644 644
         }
645 645
 
@@ -650,14 +650,14 @@  discard block
 block discarded – undo
650 650
     /**
651 651
      * Renders the edit checkbox element template.
652 652
      */
653
-    public function edit_checkbox_template( $field ) {
654
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
655
-        $label    = __( 'Field Label', 'invoicing' );
653
+    public function edit_checkbox_template($field) {
654
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
655
+        $label    = __('Field Label', 'invoicing');
656 656
         $id       = $field . '.id + "_edit"';
657
-        $label2   = __( 'Help text', 'invoicing' );
658
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
657
+        $label2   = __('Help text', 'invoicing');
658
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
659 659
         $id2      = $field . '.id + "_edit2"';
660
-        $label4   = __( 'Is this field required?', 'invoicing' );
660
+        $label4   = __('Is this field required?', 'invoicing');
661 661
         $id3      = $field . '.id + "_edit3"';
662 662
         echo "
663 663
             <div $restrict>
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
     /**
682 682
      * Renders the radio element template.
683 683
      */
684
-    public function render_radio_template( $field ) {
685
-        $restrict    = $this->get_restrict_markup( $field, 'radio' );
684
+    public function render_radio_template($field) {
685
+        $restrict    = $this->get_restrict_markup($field, 'radio');
686 686
         $label       = "$field.label";
687 687
         $id          = $field . '.id';
688 688
         echo "
@@ -700,19 +700,19 @@  discard block
 block discarded – undo
700 700
     /**
701 701
      * Renders the radio element on the frontend.
702 702
      */
703
-    public function frontend_render_radio_template( $field ) {
703
+    public function frontend_render_radio_template($field) {
704 704
         
705 705
         echo "<div class='form-group'>";
706 706
 
707
-        if ( ! empty( $field['label'] ) ) {
708
-            $label = wp_kses_post( $field['label'] );
707
+        if (!empty($field['label'])) {
708
+            $label = wp_kses_post($field['label']);
709 709
             echo "<legend class='col-form-label'>$label</legend>";
710 710
         }
711 711
 
712
-        foreach( $field['options'] as $index => $option ) {
712
+        foreach ($field['options'] as $index => $option) {
713 713
             $id    = $field['id'] . $index;
714
-            $value = esc_attr( $option );
715
-            $label = wp_kses_post( $option );
714
+            $value = esc_attr($option);
715
+            $label = wp_kses_post($option);
716 716
 
717 717
             echo "
718 718
                 <div class='form-check'>
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
             ";
723 723
         }
724 724
 
725
-        if ( ! empty( $field['description'] ) ) {
726
-            $description = wp_kses_post( $field['description'] );
725
+        if (!empty($field['description'])) {
726
+            $description = wp_kses_post($field['description']);
727 727
             echo "<small class='form-text text-muted'>$description</small>";
728 728
         }
729 729
 
@@ -734,16 +734,16 @@  discard block
 block discarded – undo
734 734
     /**
735 735
      * Renders the edit radio element template.
736 736
      */
737
-    public function edit_radio_template( $field ) {
738
-        $restrict = $this->get_restrict_markup( $field, 'radio' );
739
-        $label    = __( 'Field Label', 'invoicing' );
737
+    public function edit_radio_template($field) {
738
+        $restrict = $this->get_restrict_markup($field, 'radio');
739
+        $label    = __('Field Label', 'invoicing');
740 740
         $id       = $field . '.id + "_edit"';
741
-        $label2   = __( 'Help text', 'invoicing' );
742
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
741
+        $label2   = __('Help text', 'invoicing');
742
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
743 743
         $id2      = $field . '.id + "_edit3"';
744
-        $label4   = __( 'Is this field required?', 'invoicing' );
744
+        $label4   = __('Is this field required?', 'invoicing');
745 745
         $id3      = $field . '.id + "_edit4"';
746
-        $label5   = __( 'Available Options', 'invoicing' );
746
+        $label5   = __('Available Options', 'invoicing');
747 747
         echo "
748 748
             <div $restrict>
749 749
                 <div class='form-group'>
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
     /**
778 778
      * Renders the email element template.
779 779
      */
780
-    public function render_email_template( $field ) {
781
-        $restrict = $this->get_restrict_markup( $field, 'email' );
780
+    public function render_email_template($field) {
781
+        $restrict = $this->get_restrict_markup($field, 'email');
782 782
         $label    = "$field.label";
783 783
         echo "
784 784
             <div $restrict>
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
     /**
793 793
      * Renders the billing_email element template.
794 794
      */
795
-    public function render_billing_email_template( $field ) {
796
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
795
+    public function render_billing_email_template($field) {
796
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
797 797
         $label    = "$field.label";
798 798
         echo "
799 799
             <div $restrict>
@@ -807,24 +807,24 @@  discard block
 block discarded – undo
807 807
     /**
808 808
      * Renders the email element on the frontend.
809 809
      */
810
-    public function frontend_render_email_template( $field ) {
810
+    public function frontend_render_email_template($field) {
811 811
         
812 812
         echo "<div class='form-group'>";
813 813
 
814 814
         echo aui()->input(
815 815
             array(
816
-                'name'       => esc_attr( $field['id'] ),
817
-                'id'         => esc_attr( $field['id'] ),
816
+                'name'       => esc_attr($field['id']),
817
+                'id'         => esc_attr($field['id']),
818 818
                 'required'   => (bool) $field['required'],
819
-                'label'      => wp_kses_post( $field['label'] ),
819
+                'label'      => wp_kses_post($field['label']),
820 820
                 'no_wrap'    => true,
821
-                'placeholder' => esc_attr( $field['placeholder'] ),
821
+                'placeholder' => esc_attr($field['placeholder']),
822 822
                 'type'       => 'email',
823 823
             )
824 824
         );
825 825
 
826
-        if ( ! empty( $field['description'] ) ) {
827
-            $description = wp_kses_post( $field['description'] );
826
+        if (!empty($field['description'])) {
827
+            $description = wp_kses_post($field['description']);
828 828
             echo "<small class='form-text text-muted'>$description</small>";
829 829
         }
830 830
 
@@ -835,24 +835,24 @@  discard block
 block discarded – undo
835 835
     /**
836 836
      * Renders the billing email element on the frontend.
837 837
      */
838
-    public function frontend_render_billing_email_template( $field ) {
838
+    public function frontend_render_billing_email_template($field) {
839 839
         
840 840
         echo "<div class='form-group'>";
841 841
 
842 842
         echo aui()->input(
843 843
             array(
844 844
                 'name'       => 'billing_email',
845
-                'id'         => esc_attr( $field['id'] ),
845
+                'id'         => esc_attr($field['id']),
846 846
                 'required'   => true,
847
-                'label'      => wp_kses_post( $field['label'] ),
847
+                'label'      => wp_kses_post($field['label']),
848 848
                 'no_wrap'    => true,
849
-                'placeholder' => esc_attr( $field['placeholder'] ),
849
+                'placeholder' => esc_attr($field['placeholder']),
850 850
                 'type'       => 'email',
851 851
             )
852 852
         );
853 853
 
854
-        if ( ! empty( $field['description'] ) ) {
855
-            $description = wp_kses_post( $field['description'] );
854
+        if (!empty($field['description'])) {
855
+            $description = wp_kses_post($field['description']);
856 856
             echo "<small class='form-text text-muted'>$description</small>";
857 857
         }
858 858
 
@@ -863,16 +863,16 @@  discard block
 block discarded – undo
863 863
     /**
864 864
      * Renders the edit email element template.
865 865
      */
866
-    public function edit_email_template( $field ) {
867
-        $restrict = $this->get_restrict_markup( $field, 'email' );
868
-        $label    = __( 'Field Label', 'invoicing' );
866
+    public function edit_email_template($field) {
867
+        $restrict = $this->get_restrict_markup($field, 'email');
868
+        $label    = __('Field Label', 'invoicing');
869 869
         $id       = $field . '.id + "_edit"';
870
-        $label2   = __( 'Placeholder text', 'invoicing' );
870
+        $label2   = __('Placeholder text', 'invoicing');
871 871
         $id2      = $field . '.id + "_edit2"';
872
-        $label3   = __( 'Help text', 'invoicing' );
873
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
872
+        $label3   = __('Help text', 'invoicing');
873
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
874 874
         $id3      = $field . '.id + "_edit3"';
875
-        $label5   = __( 'Is this field required?', 'invoicing' );
875
+        $label5   = __('Is this field required?', 'invoicing');
876 876
         $id4      = $field . '.id + "_edit4"';
877 877
         echo "
878 878
             <div $restrict>
@@ -900,16 +900,16 @@  discard block
 block discarded – undo
900 900
     /**
901 901
      * Renders the edit billing_email element template.
902 902
      */
903
-    public function edit_billing_email_template( $field ) {
904
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
905
-        $label    = __( 'Field Label', 'invoicing' );
903
+    public function edit_billing_email_template($field) {
904
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
905
+        $label    = __('Field Label', 'invoicing');
906 906
         $id       = $field . '.id + "_edit"';
907
-        $label2   = __( 'Placeholder text', 'invoicing' );
907
+        $label2   = __('Placeholder text', 'invoicing');
908 908
         $id2      = $field . '.id + "_edit2"';
909
-        $label3   = __( 'Help text', 'invoicing' );
910
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
909
+        $label3   = __('Help text', 'invoicing');
910
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
911 911
         $id3      = $field . '.id + "_edit3"';
912
-        $label5   = __( 'Is this field required?', 'invoicing' );
912
+        $label5   = __('Is this field required?', 'invoicing');
913 913
         $id4      = $field . '.id + "_edit4"';
914 914
         echo "
915 915
             <div $restrict>
@@ -933,8 +933,8 @@  discard block
 block discarded – undo
933 933
     /**
934 934
      * Renders the website element template.
935 935
      */
936
-    public function render_website_template( $field ) {
937
-        $restrict = $this->get_restrict_markup( $field, 'website' );
936
+    public function render_website_template($field) {
937
+        $restrict = $this->get_restrict_markup($field, 'website');
938 938
         $label    = "$field.label";
939 939
         echo "
940 940
             <div $restrict>
@@ -948,24 +948,24 @@  discard block
 block discarded – undo
948 948
     /**
949 949
      * Renders the website element on the frontend.
950 950
      */
951
-    public function frontend_render_website_template( $field ) {
951
+    public function frontend_render_website_template($field) {
952 952
         
953 953
         echo "<div class='form-group'>";
954 954
 
955 955
         echo aui()->input(
956 956
             array(
957
-                'name'       => esc_attr( $field['id'] ),
958
-                'id'         => esc_attr( $field['id'] ),
957
+                'name'       => esc_attr($field['id']),
958
+                'id'         => esc_attr($field['id']),
959 959
                 'required'   => (bool) $field['required'],
960
-                'label'      => wp_kses_post( $field['label'] ),
960
+                'label'      => wp_kses_post($field['label']),
961 961
                 'no_wrap'    => true,
962
-                'placeholder' => esc_attr( $field['placeholder'] ),
962
+                'placeholder' => esc_attr($field['placeholder']),
963 963
                 'type'       => 'url',
964 964
             )
965 965
         );
966 966
 
967
-        if ( ! empty( $field['description'] ) ) {
968
-            $description = wp_kses_post( $field['description'] );
967
+        if (!empty($field['description'])) {
968
+            $description = wp_kses_post($field['description']);
969 969
             echo "<small class='form-text text-muted'>$description</small>";
970 970
         }
971 971
 
@@ -976,16 +976,16 @@  discard block
 block discarded – undo
976 976
     /**
977 977
      * Renders the edit website element template.
978 978
      */
979
-    public function edit_website_template( $field ) {
980
-        $restrict = $this->get_restrict_markup( $field, 'website' );
981
-        $label    = __( 'Field Label', 'invoicing' );
979
+    public function edit_website_template($field) {
980
+        $restrict = $this->get_restrict_markup($field, 'website');
981
+        $label    = __('Field Label', 'invoicing');
982 982
         $id       = $field . '.id + "_edit"';
983
-        $label2   = __( 'Placeholder text', 'invoicing' );
983
+        $label2   = __('Placeholder text', 'invoicing');
984 984
         $id2      = $field . '.id + "_edit2"';
985
-        $label3   = __( 'Help text', 'invoicing' );
986
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
985
+        $label3   = __('Help text', 'invoicing');
986
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
987 987
         $id3      = $field . '.id + "_edit3"';
988
-        $label5   = __( 'Is this field required?', 'invoicing' );
988
+        $label5   = __('Is this field required?', 'invoicing');
989 989
         $id4      = $field . '.id + "_edit4"';
990 990
         echo "
991 991
             <div $restrict>
@@ -1013,8 +1013,8 @@  discard block
 block discarded – undo
1013 1013
     /**
1014 1014
      * Renders the date element template.
1015 1015
      */
1016
-    public function render_date_template( $field ) {
1017
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1016
+    public function render_date_template($field) {
1017
+        $restrict = $this->get_restrict_markup($field, 'date');
1018 1018
         $label    = "$field.label";
1019 1019
         echo "
1020 1020
             <div $restrict>
@@ -1028,24 +1028,24 @@  discard block
 block discarded – undo
1028 1028
     /**
1029 1029
      * Renders the date element on the frontend.
1030 1030
      */
1031
-    public function frontend_render_date_template( $field ) {
1031
+    public function frontend_render_date_template($field) {
1032 1032
         
1033 1033
         echo "<div class='form-group'>";
1034 1034
 
1035 1035
         echo aui()->input(
1036 1036
             array(
1037
-                'name'       => esc_attr( $field['id'] ),
1038
-                'id'         => esc_attr( $field['id'] ),
1037
+                'name'       => esc_attr($field['id']),
1038
+                'id'         => esc_attr($field['id']),
1039 1039
                 'required'   => (bool) $field['required'],
1040
-                'label'      => wp_kses_post( $field['label'] ),
1041
-                'placeholder' => esc_attr( $field['placeholder'] ),
1040
+                'label'      => wp_kses_post($field['label']),
1041
+                'placeholder' => esc_attr($field['placeholder']),
1042 1042
                 'no_wrap'    => true,
1043 1043
                 'type'       => 'date',
1044 1044
             )
1045 1045
         );
1046 1046
 
1047
-        if ( ! empty( $field['description'] ) ) {
1048
-            $description = wp_kses_post( $field['description'] );
1047
+        if (!empty($field['description'])) {
1048
+            $description = wp_kses_post($field['description']);
1049 1049
             echo "<small class='form-text text-muted'>$description</small>";
1050 1050
         }
1051 1051
 
@@ -1056,16 +1056,16 @@  discard block
 block discarded – undo
1056 1056
     /**
1057 1057
      * Renders the edit date element template.
1058 1058
      */
1059
-    public function edit_date_template( $field ) {
1060
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1061
-        $label    = __( 'Field Label', 'invoicing' );
1059
+    public function edit_date_template($field) {
1060
+        $restrict = $this->get_restrict_markup($field, 'date');
1061
+        $label    = __('Field Label', 'invoicing');
1062 1062
         $id       = $field . '.id + "_edit"';
1063
-        $label2   = __( 'Placeholder text', 'invoicing' );
1063
+        $label2   = __('Placeholder text', 'invoicing');
1064 1064
         $id2      = $field . '.id + "_edit2"';
1065
-        $label3   = __( 'Help text', 'invoicing' );
1066
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1065
+        $label3   = __('Help text', 'invoicing');
1066
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1067 1067
         $id3      = $field . '.id + "_edit3"';
1068
-        $label5   = __( 'Is this field required?', 'invoicing' );
1068
+        $label5   = __('Is this field required?', 'invoicing');
1069 1069
         $id4      = $field . '.id + "_edit4"';
1070 1070
         echo "
1071 1071
             <div $restrict>
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
     /**
1094 1094
      * Renders the time element template.
1095 1095
      */
1096
-    public function render_time_template( $field ) {
1097
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1096
+    public function render_time_template($field) {
1097
+        $restrict = $this->get_restrict_markup($field, 'time');
1098 1098
         $label    = "$field.label";
1099 1099
         echo "
1100 1100
             <div $restrict>
@@ -1108,24 +1108,24 @@  discard block
 block discarded – undo
1108 1108
     /**
1109 1109
      * Renders the time element on the frontend.
1110 1110
      */
1111
-    public function frontend_render_time_template( $field ) {
1111
+    public function frontend_render_time_template($field) {
1112 1112
         
1113 1113
         echo "<div class='form-group'>";
1114 1114
 
1115 1115
         echo aui()->input(
1116 1116
             array(
1117
-                'name'       => esc_attr( $field['id'] ),
1118
-                'id'         => esc_attr( $field['id'] ),
1117
+                'name'       => esc_attr($field['id']),
1118
+                'id'         => esc_attr($field['id']),
1119 1119
                 'required'   => (bool) $field['required'],
1120
-                'label'      => wp_kses_post( $field['label'] ),
1120
+                'label'      => wp_kses_post($field['label']),
1121 1121
                 'no_wrap'    => true,
1122
-                'placeholder' => esc_attr( $field['placeholder'] ),
1122
+                'placeholder' => esc_attr($field['placeholder']),
1123 1123
                 'type'       => 'time',
1124 1124
             )
1125 1125
         );
1126 1126
 
1127
-        if ( ! empty( $field['description'] ) ) {
1128
-            $description = wp_kses_post( $field['description'] );
1127
+        if (!empty($field['description'])) {
1128
+            $description = wp_kses_post($field['description']);
1129 1129
             echo "<small class='form-text text-muted'>$description</small>";
1130 1130
         }
1131 1131
 
@@ -1136,16 +1136,16 @@  discard block
 block discarded – undo
1136 1136
     /**
1137 1137
      * Renders the edit time element template.
1138 1138
      */
1139
-    public function edit_time_template( $field ) {
1140
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1141
-        $label    = __( 'Field Label', 'invoicing' );
1139
+    public function edit_time_template($field) {
1140
+        $restrict = $this->get_restrict_markup($field, 'time');
1141
+        $label    = __('Field Label', 'invoicing');
1142 1142
         $id       = $field . '.id + "_edit"';
1143
-        $label2   = __( 'Placeholder text', 'invoicing' );
1143
+        $label2   = __('Placeholder text', 'invoicing');
1144 1144
         $id2      = $field . '.id + "_edit2"';
1145
-        $label3   = __( 'Help text', 'invoicing' );
1146
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1145
+        $label3   = __('Help text', 'invoicing');
1146
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1147 1147
         $id3      = $field . '.id + "_edit3"';
1148
-        $label5   = __( 'Is this field required?', 'invoicing' );
1148
+        $label5   = __('Is this field required?', 'invoicing');
1149 1149
         $id4      = $field . '.id + "_edit4"';
1150 1150
         echo "
1151 1151
             <div $restrict>
@@ -1173,8 +1173,8 @@  discard block
 block discarded – undo
1173 1173
     /**
1174 1174
      * Renders the number element template.
1175 1175
      */
1176
-    public function render_number_template( $field ) {
1177
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1176
+    public function render_number_template($field) {
1177
+        $restrict = $this->get_restrict_markup($field, 'number');
1178 1178
         $label    = "$field.label";
1179 1179
         echo "
1180 1180
             <div $restrict>
@@ -1188,24 +1188,24 @@  discard block
 block discarded – undo
1188 1188
     /**
1189 1189
      * Renders the number element on the frontend.
1190 1190
      */
1191
-    public function frontend_render_number_template( $field ) {
1191
+    public function frontend_render_number_template($field) {
1192 1192
         
1193 1193
         echo "<div class='form-group'>";
1194 1194
 
1195 1195
         echo aui()->input(
1196 1196
             array(
1197
-                'name'       => esc_attr( $field['id'] ),
1198
-                'id'         => esc_attr( $field['id'] ),
1197
+                'name'       => esc_attr($field['id']),
1198
+                'id'         => esc_attr($field['id']),
1199 1199
                 'required'   => (bool) $field['required'],
1200
-                'label'      => wp_kses_post( $field['label'] ),
1201
-                'placeholder' => esc_attr( $field['placeholder'] ),
1200
+                'label'      => wp_kses_post($field['label']),
1201
+                'placeholder' => esc_attr($field['placeholder']),
1202 1202
                 'no_wrap'    => true,
1203 1203
                 'type'       => 'number',
1204 1204
             )
1205 1205
         );
1206 1206
 
1207
-        if ( ! empty( $field['description'] ) ) {
1208
-            $description = wp_kses_post( $field['description'] );
1207
+        if (!empty($field['description'])) {
1208
+            $description = wp_kses_post($field['description']);
1209 1209
             echo "<small class='form-text text-muted'>$description</small>";
1210 1210
         }
1211 1211
 
@@ -1216,16 +1216,16 @@  discard block
 block discarded – undo
1216 1216
     /**
1217 1217
      * Renders the edit number element template.
1218 1218
      */
1219
-    public function edit_number_template( $field ) {
1220
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1221
-        $label    = __( 'Field Label', 'invoicing' );
1219
+    public function edit_number_template($field) {
1220
+        $restrict = $this->get_restrict_markup($field, 'number');
1221
+        $label    = __('Field Label', 'invoicing');
1222 1222
         $id       = $field . '.id + "_edit"';
1223
-        $label2   = __( 'Placeholder text', 'invoicing' );
1223
+        $label2   = __('Placeholder text', 'invoicing');
1224 1224
         $id2      = $field . '.id + "_edit2"';
1225
-        $label3   = __( 'Help text', 'invoicing' );
1226
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1225
+        $label3   = __('Help text', 'invoicing');
1226
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1227 1227
         $id3      = $field . '.id + "_edit3"';
1228
-        $label5   = __( 'Is this field required?', 'invoicing' );
1228
+        $label5   = __('Is this field required?', 'invoicing');
1229 1229
         $id4      = $field . '.id + "_edit4"';
1230 1230
         echo "
1231 1231
             <div $restrict>
@@ -1253,23 +1253,23 @@  discard block
 block discarded – undo
1253 1253
     /**
1254 1254
      * Renders the separator element template.
1255 1255
      */
1256
-    public function render_separator_template( $field ) {
1257
-        $restrict = $this->get_restrict_markup( $field, 'separator' );
1256
+    public function render_separator_template($field) {
1257
+        $restrict = $this->get_restrict_markup($field, 'separator');
1258 1258
         echo "<hr class='featurette-divider mt-0 mb-2' $restrict>";
1259 1259
     }
1260 1260
 
1261 1261
     /**
1262 1262
      * Renders the separator element on the frontend.
1263 1263
      */
1264
-    public function frontend_render_separator_template( $field ) {
1264
+    public function frontend_render_separator_template($field) {
1265 1265
         echo '<hr class="featurette-divider mt-0 mb-2" />';
1266 1266
     }
1267 1267
 
1268 1268
     /**
1269 1269
      * Renders the pay button element template.
1270 1270
      */
1271
-    public function render_pay_button_template( $field ) {
1272
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1271
+    public function render_pay_button_template($field) {
1272
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1273 1273
         $label    = "$field.label";
1274 1274
         echo "
1275 1275
             <div $restrict>
@@ -1282,24 +1282,24 @@  discard block
 block discarded – undo
1282 1282
     /**
1283 1283
      * Renders the pay_button element on the frontend.
1284 1284
      */
1285
-    public function frontend_render_pay_button_template( $field ) {
1285
+    public function frontend_render_pay_button_template($field) {
1286 1286
         
1287 1287
         echo "<div class='form-group'>";
1288 1288
 
1289
-        $class = 'btn btn-block submit-button ' . sanitize_html_class( $field['class'] );
1289
+        $class = 'btn btn-block submit-button ' . sanitize_html_class($field['class']);
1290 1290
         echo aui()->button(
1291 1291
             array(
1292
-                'name'       => esc_attr( $field['id'] ),
1293
-                'id'         => esc_attr( $field['id'] ),
1294
-                'content'    => wp_kses_post( $field['label'] ),
1292
+                'name'       => esc_attr($field['id']),
1293
+                'id'         => esc_attr($field['id']),
1294
+                'content'    => wp_kses_post($field['label']),
1295 1295
                 'no_wrap'    => true,
1296 1296
                 'type'       => 'button',
1297 1297
                 'class'      => $class,
1298 1298
             )
1299 1299
         );
1300 1300
 
1301
-        if ( ! empty( $field['description'] ) ) {
1302
-            $description = wp_kses_post( $field['description'] );
1301
+        if (!empty($field['description'])) {
1302
+            $description = wp_kses_post($field['description']);
1303 1303
             echo "<small class='form-text text-muted'>$description</small>";
1304 1304
         }
1305 1305
 
@@ -1310,14 +1310,14 @@  discard block
 block discarded – undo
1310 1310
     /**
1311 1311
      * Renders the pay button element template.
1312 1312
      */
1313
-    public function edit_pay_button_template( $field ) {
1314
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1315
-        $label    = __( 'Button Text', 'invoicing' );
1313
+    public function edit_pay_button_template($field) {
1314
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1315
+        $label    = __('Button Text', 'invoicing');
1316 1316
         $id       = $field . '.id + "_edit"';
1317
-        $label2   = __( 'Help text', 'invoicing' );
1318
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1317
+        $label2   = __('Help text', 'invoicing');
1318
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1319 1319
         $id2      = $field . '.id + "_edit2"';
1320
-        $label4   = esc_attr__( 'Button Type', 'invoicing' );
1320
+        $label4   = esc_attr__('Button Type', 'invoicing');
1321 1321
         $id3      = $field . '.id + "_edit3"';
1322 1322
         echo "
1323 1323
             <div $restrict>
@@ -1333,15 +1333,15 @@  discard block
 block discarded – undo
1333 1333
                     <label :for='$id3'>$label4</label>
1334 1334
 
1335 1335
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1336
-                        <option value='btn-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1337
-                        <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1338
-                        <option value='btn-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1339
-                        <option value='btn-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1340
-                        <option value='btn-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1341
-                        <option value='btn-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1342
-                        <option value='btn-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1343
-                        <option value='btn-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1344
-                        <option value='btn-link'>"      . __( 'Link', 'invoicing' ) ."</option>
1336
+                        <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option>
1337
+                        <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option>
1338
+                        <option value='btn-success'>"   . __('Success', 'invoicing') . "</option>
1339
+                        <option value='btn-danger'>"    . __('Danger', 'invoicing') . "</option>
1340
+                        <option value='btn-warning'>"   . __('Warning', 'invoicing') . "</option>
1341
+                        <option value='btn-info'>"      . __('Info', 'invoicing') . "</option>
1342
+                        <option value='btn-light'>"     . __('Light', 'invoicing') . "</option>
1343
+                        <option value='btn-dark'>"      . __('Dark', 'invoicing') . "</option>
1344
+                        <option value='btn-link'>"      . __('Link', 'invoicing') . "</option>
1345 1345
                     </select>
1346 1346
                 </div>
1347 1347
             </div>
@@ -1352,8 +1352,8 @@  discard block
 block discarded – undo
1352 1352
     /**
1353 1353
      * Renders the alert element template.
1354 1354
      */
1355
-    public function render_alert_template( $field ) {
1356
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1355
+    public function render_alert_template($field) {
1356
+        $restrict = $this->get_restrict_markup($field, 'alert');
1357 1357
         $text     = "$field.text";
1358 1358
         echo "
1359 1359
             <div $restrict class='alert' :class='$field.class' role='alert'>
@@ -1368,15 +1368,15 @@  discard block
 block discarded – undo
1368 1368
     /**
1369 1369
      * Renders the alert element on the frontend.
1370 1370
      */
1371
-    public function frontend_render_alert_template( $field ) {
1371
+    public function frontend_render_alert_template($field) {
1372 1372
         
1373 1373
         echo "<div class='form-group'>";
1374 1374
 
1375 1375
         echo aui()->alert(
1376 1376
             array(
1377
-                'content'     => wp_kses_post( $field['text'] ),
1377
+                'content'     => wp_kses_post($field['text']),
1378 1378
                 'dismissible' => $field['dismissible'],
1379
-                'type'        => str_replace( 'alert-', '', $field['class'] ),
1379
+                'type'        => str_replace('alert-', '', $field['class']),
1380 1380
             )
1381 1381
         );
1382 1382
 
@@ -1387,14 +1387,14 @@  discard block
 block discarded – undo
1387 1387
     /**
1388 1388
      * Renders the alert element template.
1389 1389
      */
1390
-    public function edit_alert_template( $field ) {
1391
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1392
-        $label    = __( 'Alert Text', 'invoicing' );
1393
-        $label2   = esc_attr__( 'Enter your alert text here', 'invoicing' );
1390
+    public function edit_alert_template($field) {
1391
+        $restrict = $this->get_restrict_markup($field, 'alert');
1392
+        $label    = __('Alert Text', 'invoicing');
1393
+        $label2   = esc_attr__('Enter your alert text here', 'invoicing');
1394 1394
         $id       = $field . '.id + "_edit"';
1395
-        $label3   = __( 'Is Dismissible?', 'invoicing' );
1395
+        $label3   = __('Is Dismissible?', 'invoicing');
1396 1396
         $id2      = $field . '.id + "_edit2"';
1397
-        $label4   = esc_attr__( 'Alert Type', 'invoicing' );
1397
+        $label4   = esc_attr__('Alert Type', 'invoicing');
1398 1398
         $id3      = $field . '.id + "_edit3"';
1399 1399
         echo "
1400 1400
             <div $restrict>
@@ -1410,14 +1410,14 @@  discard block
 block discarded – undo
1410 1410
                     <label :for='$id3'>$label4</label>
1411 1411
 
1412 1412
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1413
-                        <option value='alert-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1414
-                        <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1415
-                        <option value='alert-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1416
-                        <option value='alert-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1417
-                        <option value='alert-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1418
-                        <option value='alert-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1419
-                        <option value='alert-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1420
-                        <option value='alert-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1413
+                        <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option>
1414
+                        <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option>
1415
+                        <option value='alert-success'>"   . __('Success', 'invoicing') . "</option>
1416
+                        <option value='alert-danger'>"    . __('Danger', 'invoicing') . "</option>
1417
+                        <option value='alert-warning'>"   . __('Warning', 'invoicing') . "</option>
1418
+                        <option value='alert-info'>"      . __('Info', 'invoicing') . "</option>
1419
+                        <option value='alert-light'>"     . __('Light', 'invoicing') . "</option>
1420
+                        <option value='alert-dark'>"      . __('Dark', 'invoicing') . "</option>
1421 1421
                     </select>
1422 1422
                 </div>
1423 1423
             </div>
@@ -1428,8 +1428,8 @@  discard block
 block discarded – undo
1428 1428
     /**
1429 1429
      * Renders the discount element template.
1430 1430
      */
1431
-    public function render_discount_template( $field ) {
1432
-        $restrict  = $this->get_restrict_markup( $field, 'discount' );
1431
+    public function render_discount_template($field) {
1432
+        $restrict = $this->get_restrict_markup($field, 'discount');
1433 1433
         ?>
1434 1434
 
1435 1435
             <div <?php echo $restrict; ?> class="discount_field  border rounded p-3">
@@ -1446,13 +1446,13 @@  discard block
 block discarded – undo
1446 1446
     /**
1447 1447
      * Renders the discount element on the frontend.
1448 1448
      */
1449
-    public function frontend_render_discount_template( $field ) {
1449
+    public function frontend_render_discount_template($field) {
1450 1450
         
1451
-        $placeholder = esc_attr( $field['input_label'] );
1452
-        $label       = sanitize_text_field( $field['button_label'] );
1451
+        $placeholder = esc_attr($field['input_label']);
1452
+        $label       = sanitize_text_field($field['button_label']);
1453 1453
         $description = '';
1454 1454
 
1455
-        if ( ! empty( $field['description'] ) ) {
1455
+        if (!empty($field['description'])) {
1456 1456
             $description = "<small class='form-text text-muted'>{$field['description']}</small>";
1457 1457
         }
1458 1458
 ?>
@@ -1473,12 +1473,12 @@  discard block
 block discarded – undo
1473 1473
     /**
1474 1474
      * Renders the discount element template.
1475 1475
      */
1476
-    public function edit_discount_template( $field ) {
1477
-        $restrict = $this->get_restrict_markup( $field, 'discount' );
1478
-        $label    = __( 'Discount Input Placeholder', 'invoicing' );
1479
-        $label2   = __( 'Help Text', 'invoicing' );
1480
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1481
-        $label4   = __( 'Button Text', 'invoicing' );
1476
+    public function edit_discount_template($field) {
1477
+        $restrict = $this->get_restrict_markup($field, 'discount');
1478
+        $label    = __('Discount Input Placeholder', 'invoicing');
1479
+        $label2   = __('Help Text', 'invoicing');
1480
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1481
+        $label4   = __('Button Text', 'invoicing');
1482 1482
         $id       = $field . '.id + "_edit"';
1483 1483
         $id2      = $field . '.id + "_edit2"';
1484 1484
         $id3      = $field . '.id + "_edit3"';
@@ -1507,8 +1507,8 @@  discard block
 block discarded – undo
1507 1507
     /**
1508 1508
      * Renders the items element template.
1509 1509
      */
1510
-    public function render_items_template( $field ) {
1511
-        $restrict  = $this->get_restrict_markup( $field, 'items' );
1510
+    public function render_items_template($field) {
1511
+        $restrict = $this->get_restrict_markup($field, 'items');
1512 1512
         echo "
1513 1513
             <div $restrict class='item_totals'>
1514 1514
 
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
                 <div v-if='$field.items_type == \"select\"'>
1554 1554
 
1555 1555
                     <select class='form-control custom-select'>
1556
-                        <option value='' disabled selected='selected'>"        . __( 'Select an option', 'invoicing' ) ."</option>
1556
+                        <option value='' disabled selected='selected'>" . __('Select an option', 'invoicing') . "</option>
1557 1557
                         <option v-for='(item, index) in form_items' :value='index'>{{item.title}} &nbsp;{{formatPrice(item.price)}}</option>
1558 1558
                     </select>
1559 1559
                 </div>
@@ -1574,66 +1574,66 @@  discard block
 block discarded – undo
1574 1574
     /**
1575 1575
      * Renders the items element on the frontend.
1576 1576
      */
1577
-    public function frontend_render_items_template( $field, $items ) {
1577
+    public function frontend_render_items_template($field, $items) {
1578 1578
         
1579 1579
         echo "<div class='form-group item_totals'>";
1580 1580
         
1581
-        $id = esc_attr( $field['id'] );
1582
-        if ( 'total' == $field[ 'items_type' ] ) {
1581
+        $id = esc_attr($field['id']);
1582
+        if ('total' == $field['items_type']) {
1583 1583
             $total = 0;
1584 1584
 
1585 1585
             ?>
1586 1586
             <div class="border item_totals_type_total">
1587 1587
 
1588 1588
                 <?php
1589
-                    foreach( $items as $item ) {
1590
-                        $total = $total + floatval( $item['price'] );
1589
+                    foreach ($items as $item) {
1590
+                        $total = $total + floatval($item['price']);
1591 1591
                 ?>
1592 1592
                     <div  class="item_totals_item">
1593 1593
                         <div class='row pl-2 pr-2 pt-2'>
1594
-                            <div class='col-8'><?php echo esc_html( $item['title'] ) ?></div>
1595
-                            <div class='col-4'><?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?></div>
1594
+                            <div class='col-8'><?php echo esc_html($item['title']) ?></div>
1595
+                            <div class='col-4'><?php echo wpinv_price(wpinv_format_amount($item['price'])) ?></div>
1596 1596
                         </div>
1597
-                        <?php if ( ! empty( $item['description'] )) { ?>
1598
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1597
+                        <?php if (!empty($item['description'])) { ?>
1598
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1599 1599
                         <?php } ?>
1600 1600
                     </div>
1601 1601
                 <?php } ?>
1602 1602
 
1603 1603
                 <div class='mt-4 border-top item_totals_total'>
1604 1604
                     <div class='row p-2'>
1605
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1606
-                        <div class='col-4'><strong><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
1605
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1606
+                        <div class='col-4'><strong><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
1607 1607
                     </div>
1608 1608
                 </div>
1609 1609
 
1610 1610
             </div>
1611 1611
         <?php } ?>
1612 1612
 
1613
-        <?php if ( 'radio' == $field[ 'items_type' ] ) { ?>
1613
+        <?php if ('radio' == $field['items_type']) { ?>
1614 1614
             <div class="item_totals_type_radio">
1615 1615
 
1616
-                <?php foreach( $items as $index => $item ) { ?>
1616
+                <?php foreach ($items as $index => $item) { ?>
1617 1617
                     <div  class="form-check">
1618 1618
                         <input class='form-check-input' type='radio' name='<?php echo $id; ?>' id='<?php echo $id . $index; ?>'>
1619
-                        <label class='form-check-label' for=<?php echo $id . $index; ?>'><?php echo sanitize_text_field( $item['title'] ); ?>&nbsp;<strong><?php echo wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) ); ?></strong></label>
1619
+                        <label class='form-check-label' for=<?php echo $id . $index; ?>'><?php echo sanitize_text_field($item['title']); ?>&nbsp;<strong><?php echo wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); ?></strong></label>
1620 1620
                     </div>
1621
-                    <?php if ( ! empty( $item['description'] )) { ?>
1622
-                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1621
+                    <?php if (!empty($item['description'])) { ?>
1622
+                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1623 1623
                     <?php } ?>
1624 1624
                 <?php } ?>
1625 1625
 
1626 1626
             </div>
1627 1627
         <?php } ?>
1628 1628
 
1629
-        <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?>
1629
+        <?php if ('checkbox' == $field['items_type']) { ?>
1630 1630
 
1631 1631
             <div class="item_totals_type_checkbox">
1632 1632
 
1633 1633
                 <?php
1634
-                    foreach ( $items as $index => $item ) {
1635
-                        $title = sanitize_text_field(  $item['title'] );
1636
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1634
+                    foreach ($items as $index => $item) {
1635
+                        $title = sanitize_text_field($item['title']);
1636
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1637 1637
                         echo aui()->input(
1638 1638
                             array(
1639 1639
                                 'name'       => $id,
@@ -1644,7 +1644,7 @@  discard block
 block discarded – undo
1644 1644
                             )
1645 1645
                         );
1646 1646
 
1647
-                        if ( ! empty( $item['description'] ) ) {
1647
+                        if (!empty($item['description'])) {
1648 1648
                             echo "<small class='form-text text-muted'>{$item['description']}</small>";
1649 1649
                         }
1650 1650
                     }
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
             </div>
1654 1654
         <?php } ?>
1655 1655
 
1656
-        <?php if ( 'select' == $field[ 'items_type' ] ) { ?>
1656
+        <?php if ('select' == $field['items_type']) { ?>
1657 1657
 
1658 1658
             <div class="item_totals_type_select">
1659 1659
 
@@ -1661,17 +1661,17 @@  discard block
 block discarded – undo
1661 1661
 
1662 1662
                     $options = array();
1663 1663
 
1664
-                    foreach ( $items as $index => $item ) {
1665
-                        $title = sanitize_text_field(  $item['title'] );
1666
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1667
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
1664
+                    foreach ($items as $index => $item) {
1665
+                        $title = sanitize_text_field($item['title']);
1666
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1667
+                        $options[$item['id']] = "$title &nbsp; ($price)";
1668 1668
                     }
1669 1669
 
1670 1670
                     echo aui()->select(
1671 1671
                         array(
1672 1672
                                 'name'        => $id,
1673 1673
                                 'id'          => $id,
1674
-                                'placeholder' => __( 'Select an item', 'invoicing' ),
1674
+                                'placeholder' => __('Select an item', 'invoicing'),
1675 1675
                                 'no_wrap'     => true,
1676 1676
                                 'options'     => $options,
1677 1677
                         )
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
             </div>
1682 1682
         <?php } ?>
1683 1683
 
1684
-        <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?>
1684
+        <?php if ('multi_select' == $field['items_type']) { ?>
1685 1685
 
1686 1686
             <div class="item_totals_type_multi_select">
1687 1687
 
@@ -1689,17 +1689,17 @@  discard block
 block discarded – undo
1689 1689
 
1690 1690
                     $options = array();
1691 1691
 
1692
-                    foreach ( $items as $index => $item ) {
1693
-                        $title = sanitize_text_field(  $item['title'] );
1694
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1695
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
1692
+                    foreach ($items as $index => $item) {
1693
+                        $title = sanitize_text_field($item['title']);
1694
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1695
+                        $options[$item['id']] = "$title &nbsp; ($price)";
1696 1696
                     }
1697 1697
 
1698 1698
                     echo aui()->select(
1699 1699
                         array(
1700 1700
                                 'name'        => $id,
1701 1701
                                 'id'          => $id,
1702
-                                'placeholder' => __( 'Select one or more items', 'invoicing' ),
1702
+                                'placeholder' => __('Select one or more items', 'invoicing'),
1703 1703
                                 'no_wrap'     => true,
1704 1704
                                 'options'     => $options,
1705 1705
                                 'multiple'    => true,
@@ -1717,11 +1717,11 @@  discard block
 block discarded – undo
1717 1717
     /**
1718 1718
      * Renders the items element template.
1719 1719
      */
1720
-    public function edit_items_template( $field ) {
1721
-        $restrict = $this->get_restrict_markup( $field, 'items' );
1722
-        $label    = __( 'Let customers...', 'invoicing' );
1723
-        $label2   = __( 'Available Items', 'invoicing' );
1724
-        $label3   = esc_attr__( 'Add some help text for this element', 'invoicing' );
1720
+    public function edit_items_template($field) {
1721
+        $restrict = $this->get_restrict_markup($field, 'items');
1722
+        $label    = __('Let customers...', 'invoicing');
1723
+        $label2   = __('Available Items', 'invoicing');
1724
+        $label3   = esc_attr__('Add some help text for this element', 'invoicing');
1725 1725
         $id       = $field . '.id + "_edit"';
1726 1726
         $id2      = $field . '.id + "_edit2"';
1727 1727
         $id3      = $field . '.id + "_edit3"';
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
                 <div class='form-group mt-2'>
1772 1772
 
1773 1773
                     <select class='form-control custom-select' v-model='selected_item'>
1774
-                        <option value=''>"        . __( 'Add an item to the form', 'invoicing' ) ."</option>
1774
+                        <option value=''>" . __('Add an item to the form', 'invoicing') . "</option>
1775 1775
                         <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option>
1776 1776
                     </select>
1777 1777
 
@@ -1786,11 +1786,11 @@  discard block
 block discarded – undo
1786 1786
                     <label :for='$id2'>$label</label>
1787 1787
 
1788 1788
                     <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'>
1789
-                        <option value='total'>"        . __( 'Buy all items on the list', 'invoicing' ) ."</option>
1790
-                        <option value='radio'>"        . __( 'Select a single item from the list', 'invoicing' ) ."</option>
1791
-                        <option value='checkbox'>"     . __( 'Select one or more items on the list', 'invoicing' ) ."</option>
1792
-                        <option value='select'>"       . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option>
1793
-                        <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option>
1789
+                        <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option>
1790
+                        <option value='radio'>"        . __('Select a single item from the list', 'invoicing') . "</option>
1791
+                        <option value='checkbox'>"     . __('Select one or more items on the list', 'invoicing') . "</option>
1792
+                        <option value='select'>"       . __('Select a single item from a dropdown', 'invoicing') . "</option>
1793
+                        <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option>
1794 1794
                     </select>
1795 1795
 
1796 1796
                 </div>
@@ -1815,24 +1815,24 @@  discard block
 block discarded – undo
1815 1815
             'orderby'        => 'title',
1816 1816
             'order'          => 'ASC',
1817 1817
             'posts_per_page' => -1,
1818
-            'post_status'    => array( 'publish' ),
1818
+            'post_status'    => array('publish'),
1819 1819
         );
1820 1820
     
1821
-        $items      = get_posts( apply_filters( 'wpinv_item_dropdown_query_args', $item_args ) );
1821
+        $items = get_posts(apply_filters('wpinv_item_dropdown_query_args', $item_args));
1822 1822
 
1823
-        if ( empty( $items ) ) {
1823
+        if (empty($items)) {
1824 1824
             return array();
1825 1825
         }
1826 1826
 
1827
-        $options    = array();
1828
-        foreach ( $items as $item ) {
1829
-            $title       = esc_html( $item->post_title );
1830
-            $title      .= wpinv_get_item_suffix( $item->ID, false );
1831
-            $id          = absint( $item->ID );
1832
-            $price       = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) );
1833
-            $recurring   = (bool) get_post_meta( $id, '_wpinv_is_recurring', true );
1827
+        $options = array();
1828
+        foreach ($items as $item) {
1829
+            $title       = esc_html($item->post_title);
1830
+            $title      .= wpinv_get_item_suffix($item->ID, false);
1831
+            $id          = absint($item->ID);
1832
+            $price       = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true));
1833
+            $recurring   = (bool) get_post_meta($id, '_wpinv_is_recurring', true);
1834 1834
             $description = $item->post_excerpt;
1835
-            $options[] = compact( 'title', 'id', 'price', 'recurring', 'description' );
1835
+            $options[] = compact('title', 'id', 'price', 'recurring', 'description');
1836 1836
 
1837 1837
         }
1838 1838
         return $options;
@@ -1842,38 +1842,38 @@  discard block
 block discarded – undo
1842 1842
     /**
1843 1843
      * Returns an array of items for the currently being edited form.
1844 1844
      */
1845
-    public function get_form_items( $id = false ) {
1845
+    public function get_form_items($id = false) {
1846 1846
         
1847
-        if ( empty( $id ) ) {
1848
-            return wpinv_get_data( 'sample-payment-form-items' );
1847
+        if (empty($id)) {
1848
+            return wpinv_get_data('sample-payment-form-items');
1849 1849
         }
1850 1850
         
1851
-        $form_elements = get_post_meta( $id, 'wpinv_form_items', true );
1851
+        $form_elements = get_post_meta($id, 'wpinv_form_items', true);
1852 1852
 
1853
-        if ( is_array( $form_elements ) ) {
1853
+        if (is_array($form_elements)) {
1854 1854
             return $form_elements;
1855 1855
         }
1856 1856
 
1857
-        return wpinv_get_data( 'sample-payment-form-items' );
1857
+        return wpinv_get_data('sample-payment-form-items');
1858 1858
 
1859 1859
     }
1860 1860
 
1861 1861
     /**
1862 1862
      * Returns an array of elements for the currently being edited form.
1863 1863
      */
1864
-    public function get_form_elements( $id = false ) {
1864
+    public function get_form_elements($id = false) {
1865 1865
 
1866
-        if ( empty( $id ) ) {
1867
-            return wpinv_get_data( 'sample-payment-form' );
1866
+        if (empty($id)) {
1867
+            return wpinv_get_data('sample-payment-form');
1868 1868
         }
1869 1869
         
1870
-        $form_elements = get_post_meta( $id, 'wpinv_form_elements', true );
1870
+        $form_elements = get_post_meta($id, 'wpinv_form_elements', true);
1871 1871
 
1872
-        if ( is_array( $form_elements ) ) {
1872
+        if (is_array($form_elements)) {
1873 1873
             return $form_elements;
1874 1874
         }
1875 1875
 
1876
-        return wpinv_get_data( 'sample-payment-form' );
1876
+        return wpinv_get_data('sample-payment-form');
1877 1877
     }
1878 1878
 
1879 1879
 }
Please login to merge, or discard this patch.