Passed
Branch master (50908e)
by Stiofan
07:01
created
vendor/composer/installers/src/Composer/Installers/AglInstaller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      */
13 13
     public function inflectPackageVars($vars)
14 14
     {
15
-        $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) {
15
+        $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function($matches) {
16 16
             return strtoupper($matches[1]);
17 17
         }, $vars['name']);
18 18
 
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/Installer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@
 block discarded – undo
215 215
             $pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
216 216
         }
217 217
 
218
-        return $pattern ? : '(\w+)';
218
+        return $pattern ?: '(\w+)';
219 219
     }
220 220
 
221 221
     /**
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 class BitrixInstaller extends BaseInstaller
27 27
 {
28 28
     protected $locations = array(
29
-        'module'    => '{$bitrix_dir}/modules/{$name}/',    // deprecated, remove on the major release (Backward compatibility will be broken)
29
+        'module'    => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
30 30
         'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
31
-        'theme'     => '{$bitrix_dir}/templates/{$name}/',  // deprecated, remove on the major release (Backward compatibility will be broken)
31
+        'theme'     => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
32 32
         'd7-module'    => '{$bitrix_dir}/modules/{$vendor}.{$name}/',
33 33
         'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/',
34 34
         'd7-template'     => '{$bitrix_dir}/templates/{$vendor}_{$name}/',
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      */
18 18
     public function inflectPackageVars($vars)
19 19
     {
20
-        $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
20
+        $vars['name'] = preg_replace_callback('/(-[a-z])/', function($matches) {
21 21
             return strtoupper($matches[0][1]);
22 22
         }, $vars['name']);
23 23
 
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
      */
36 36
     protected function inflectModuleVars($vars)
37 37
     {
38
-        $vars['name'] = str_replace('pxcms-', '', $vars['name']);       // strip out pxcms- just incase (legacy)
39
-        $vars['name'] = str_replace('module-', '', $vars['name']);      // strip out module-
40
-        $vars['name'] = preg_replace('/-module$/', '', $vars['name']);  // strip out -module
41
-        $vars['name'] = str_replace('-', '_', $vars['name']);           // make -'s be _'s
42
-        $vars['name'] = ucwords($vars['name']);                         // make module name camelcased
38
+        $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
39
+        $vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
40
+        $vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
41
+        $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
42
+        $vars['name'] = ucwords($vars['name']); // make module name camelcased
43 43
 
44 44
         return $vars;
45 45
     }
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
      */
53 53
     protected function inflectThemeVars($vars)
54 54
     {
55
-        $vars['name'] = str_replace('pxcms-', '', $vars['name']);       // strip out pxcms- just incase (legacy)
56
-        $vars['name'] = str_replace('theme-', '', $vars['name']);       // strip out theme-
57
-        $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);   // strip out -theme
58
-        $vars['name'] = str_replace('-', '_', $vars['name']);           // make -'s be _'s
59
-        $vars['name'] = ucwords($vars['name']);                         // make module name camelcased
55
+        $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
56
+        $vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
57
+        $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
58
+        $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
59
+        $vars['name'] = ucwords($vars['name']); // make module name camelcased
60 60
 
61 61
         return $vars;
62 62
     }
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      */
38 38
     private function correctPluginName($vars)
39 39
     {
40
-        $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
40
+        $camelCasedName = preg_replace_callback('/(-[a-z])/', function($matches) {
41 41
             return strtoupper($matches[0][1]);
42 42
         }, $vars['name']);
43 43
 
Please login to merge, or discard this patch.
vendor/composer/installers/src/bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
     }
7 7
 }
8 8
 if ((!$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__ . '/../../../autoload.php'))) {
9
-    die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
10
-        'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
11
-        'php composer.phar install'.PHP_EOL);
9
+    die('You must set up the project dependencies, run the following commands:' . PHP_EOL .
10
+        'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
11
+        'php composer.phar install' . PHP_EOL);
12 12
 }
13 13
 return $loader;
Please login to merge, or discard this patch.
includes/wpinv-item-functions.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -799,7 +799,7 @@
 block discarded – undo
799 799
                 case 'trial_interval':
800 800
                     $value = absint( $value );
801 801
                 break;
802
-				case 'editable':
802
+                case 'editable':
803 803
                     $value = (int) $value;
804 804
                 break;
805 805
             }
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly
3
-if ( ! defined( 'ABSPATH' ) ) exit;
3
+if ( ! defined( 'ABSPATH' ) ) {
4
+    exit;
5
+}
4 6
 
5 7
 function wpinv_get_item_by_id( $id ) {
6 8
     return wpinv_get_item_by( 'id', $id );
@@ -80,8 +82,9 @@  discard block
 block discarded – undo
80 82
 function wpinv_get_item( $item = 0 ) {
81 83
     if ( is_numeric( $item ) ) {
82 84
         $item = get_post( $item );
83
-        if ( ! $item || 'wpi_item' !== $item->post_type )
84
-            return null;
85
+        if ( ! $item || 'wpi_item' !== $item->post_type ) {
86
+                    return null;
87
+        }
85 88
         return $item;
86 89
     }
87 90
 
@@ -331,8 +334,9 @@  discard block
 block discarded – undo
331 334
 }
332 335
 
333 336
 function wpinv_remove_item_logs_on_delete( $item_id = 0 ) {
334
-    if ( 'wpi_item' !== get_post_type( $item_id ) )
335
-        return;
337
+    if ( 'wpi_item' !== get_post_type( $item_id ) ) {
338
+            return;
339
+    }
336 340
 
337 341
     global $wpinv_logs;
338 342
     
Please login to merge, or discard this patch.
Spacing   +302 added lines, -302 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly
3
-if ( ! defined( 'ABSPATH' ) ) exit;
3
+if (!defined('ABSPATH')) exit;
4 4
 
5
-function wpinv_get_item_by_id( $id ) {
6
-    return wpinv_get_item_by( 'id', $id );
5
+function wpinv_get_item_by_id($id) {
6
+    return wpinv_get_item_by('id', $id);
7 7
 }
8 8
 
9
-function wpinv_get_item_by( $field = '', $value = '', $type = '' ) {
10
-    if( empty( $field ) || empty( $value ) ) {
9
+function wpinv_get_item_by($field = '', $value = '', $type = '') {
10
+    if (empty($field) || empty($value)) {
11 11
         return false;
12 12
     }
13 13
     
14 14
     $posts = array();
15 15
 
16
-    switch( strtolower( $field ) ) {
16
+    switch (strtolower($field)) {
17 17
         case 'id':
18
-            $item = new WPInv_Item( $value );
18
+            $item = new WPInv_Item($value);
19 19
 
20
-            if ( !empty( $item ) && $item->post_type == 'wpi_item' ) {
20
+            if (!empty($item) && $item->post_type == 'wpi_item') {
21 21
                 return $item;
22 22
             }
23 23
             return false;
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 
27 27
         case 'slug':
28 28
         case 'name':
29
-            $posts = get_posts( array(
29
+            $posts = get_posts(array(
30 30
                 'post_type'      => 'wpi_item',
31 31
                 'name'           => $value,
32 32
                 'posts_per_page' => 1,
33 33
                 'post_status'    => 'any'
34
-            ) );
34
+            ));
35 35
 
36 36
             break;
37 37
         case 'custom_id':
38
-            if ( empty( $value ) || empty( $type ) ) {
38
+            if (empty($value) || empty($type)) {
39 39
                 return false;
40 40
             }
41 41
             
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
                 'post_status'    => 'any',
56 56
                 'orderby'        => 'ID',
57 57
                 'order'          => 'ASC',
58
-                'meta_query'     => array( $meta_query )
58
+                'meta_query'     => array($meta_query)
59 59
             );
60 60
             
61
-            $posts = get_posts( $args );
61
+            $posts = get_posts($args);
62 62
 
63 63
             break;
64 64
 
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
             return false;
67 67
     }
68 68
     
69
-    if ( !empty( $posts[0] ) ) {
70
-        $item = new WPInv_Item( $posts[0]->ID );
69
+    if (!empty($posts[0])) {
70
+        $item = new WPInv_Item($posts[0]->ID);
71 71
 
72
-        if ( !empty( $item ) && $item->post_type == 'wpi_item' ) {
72
+        if (!empty($item) && $item->post_type == 'wpi_item') {
73 73
             return $item;
74 74
         }
75 75
     }
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
     return false;
78 78
 }
79 79
 
80
-function wpinv_get_item( $item = 0 ) {
81
-    if ( is_numeric( $item ) ) {
82
-        $item = get_post( $item );
83
-        if ( ! $item || 'wpi_item' !== $item->post_type )
80
+function wpinv_get_item($item = 0) {
81
+    if (is_numeric($item)) {
82
+        $item = get_post($item);
83
+        if (!$item || 'wpi_item' !== $item->post_type)
84 84
             return null;
85 85
         return $item;
86 86
     }
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
 
94 94
     $item = get_posts($args);
95 95
 
96
-    if ( $item ) {
96
+    if ($item) {
97 97
         return $item[0];
98 98
     }
99 99
 
100 100
     return null;
101 101
 }
102 102
 
103
-function wpinv_get_all_items( $args = array() ) {
103
+function wpinv_get_all_items($args = array()) {
104 104
 
105
-    $args = wp_parse_args( $args, array(
106
-        'status'         => array( 'publish' ),
107
-        'limit'          => get_option( 'posts_per_page' ),
105
+    $args = wp_parse_args($args, array(
106
+        'status'         => array('publish'),
107
+        'limit'          => get_option('posts_per_page'),
108 108
         'page'           => 1,
109 109
         'exclude'        => array(),
110 110
         'orderby'        => 'date',
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         'meta_query'     => array(),
114 114
         'return'         => 'objects',
115 115
         'paginate'       => false,
116
-    ) );
116
+    ));
117 117
 
118 118
     $wp_query_args = array(
119 119
         'post_type'      => 'wpi_item',
@@ -123,26 +123,26 @@  discard block
 block discarded – undo
123 123
         'fields'         => 'ids',
124 124
         'orderby'        => $args['orderby'],
125 125
         'order'          => $args['order'],
126
-        'paged'          => absint( $args['page'] ),
126
+        'paged'          => absint($args['page']),
127 127
     );
128 128
 
129
-    if ( ! empty( $args['exclude'] ) ) {
130
-        $wp_query_args['post__not_in'] = array_map( 'absint', $args['exclude'] );
129
+    if (!empty($args['exclude'])) {
130
+        $wp_query_args['post__not_in'] = array_map('absint', $args['exclude']);
131 131
     }
132 132
 
133
-    if ( ! $args['paginate' ] ) {
133
+    if (!$args['paginate']) {
134 134
         $wp_query_args['no_found_rows'] = true;
135 135
     }
136 136
 
137
-    if ( ! empty( $args['search'] ) ) {
137
+    if (!empty($args['search'])) {
138 138
         $wp_query_args['s'] = $args['search'];
139 139
     }
140 140
 
141
-    if ( ! empty( $args['type'] ) && $args['type'] !== wpinv_item_types() ) {
142
-        $types = wpinv_parse_list( $args['type'] );
141
+    if (!empty($args['type']) && $args['type'] !== wpinv_item_types()) {
142
+        $types = wpinv_parse_list($args['type']);
143 143
         $wp_query_args['meta_query'][] = array(
144 144
             'key'     => '_wpinv_type',
145
-            'value'   => implode( ',', $types ),
145
+            'value'   => implode(',', $types),
146 146
             'compare' => 'IN',
147 147
         );
148 148
     }
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
     $wp_query_args = apply_filters('wpinv_get_items_args', $wp_query_args, $args);
151 151
 
152 152
     // Get results.
153
-    $items = new WP_Query( $wp_query_args );
153
+    $items = new WP_Query($wp_query_args);
154 154
 
155
-    if ( 'objects' === $args['return'] ) {
156
-        $return = array_map( 'wpinv_get_item_by_id', $items->posts );
157
-    } elseif ( 'self' === $args['return'] ) {
155
+    if ('objects' === $args['return']) {
156
+        $return = array_map('wpinv_get_item_by_id', $items->posts);
157
+    } elseif ('self' === $args['return']) {
158 158
         return $items;
159 159
     } else {
160 160
         $return = $items->posts;
161 161
     }
162 162
 
163
-    if ( $args['paginate' ] ) {
163
+    if ($args['paginate']) {
164 164
         return (object) array(
165 165
             'items'      => $return,
166 166
             'total'         => $items->found_posts,
@@ -172,143 +172,143 @@  discard block
 block discarded – undo
172 172
 
173 173
 }
174 174
 
175
-function wpinv_is_free_item( $item_id = 0 ) {
176
-    if( empty( $item_id ) ) {
175
+function wpinv_is_free_item($item_id = 0) {
176
+    if (empty($item_id)) {
177 177
         return false;
178 178
     }
179 179
 
180
-    $item = new WPInv_Item( $item_id );
180
+    $item = new WPInv_Item($item_id);
181 181
     
182 182
     return $item->is_free();
183 183
 }
184 184
 
185
-function wpinv_item_is_editable( $item = 0 ) {
186
-    if ( !empty( $item ) && is_a( $item, 'WP_Post' ) ) {
185
+function wpinv_item_is_editable($item = 0) {
186
+    if (!empty($item) && is_a($item, 'WP_Post')) {
187 187
         $item = $item->ID;
188 188
     }
189 189
         
190
-    if ( empty( $item ) ) {
190
+    if (empty($item)) {
191 191
         return true;
192 192
     }
193 193
 
194
-    $item = new WPInv_Item( $item );
194
+    $item = new WPInv_Item($item);
195 195
     
196 196
     return (bool) $item->is_editable();
197 197
 }
198 198
 
199
-function wpinv_get_item_price( $item_id = 0 ) {
200
-    if( empty( $item_id ) ) {
199
+function wpinv_get_item_price($item_id = 0) {
200
+    if (empty($item_id)) {
201 201
         return false;
202 202
     }
203 203
 
204
-    $item = new WPInv_Item( $item_id );
204
+    $item = new WPInv_Item($item_id);
205 205
     
206 206
     return $item->get_price();
207 207
 }
208 208
 
209
-function wpinv_is_recurring_item( $item_id = 0 ) {
210
-    if( empty( $item_id ) ) {
209
+function wpinv_is_recurring_item($item_id = 0) {
210
+    if (empty($item_id)) {
211 211
         return false;
212 212
     }
213 213
 
214
-    $item = new WPInv_Item( $item_id );
214
+    $item = new WPInv_Item($item_id);
215 215
     
216 216
     return $item->is_recurring();
217 217
 }
218 218
 
219
-function wpinv_item_price( $item_id = 0 ) {
220
-    if( empty( $item_id ) ) {
219
+function wpinv_item_price($item_id = 0) {
220
+    if (empty($item_id)) {
221 221
         return false;
222 222
     }
223 223
 
224
-    $price = wpinv_get_item_price( $item_id );
225
-    $price = wpinv_price( wpinv_format_amount( $price ) );
224
+    $price = wpinv_get_item_price($item_id);
225
+    $price = wpinv_price(wpinv_format_amount($price));
226 226
     
227
-    return apply_filters( 'wpinv_item_price', $price, $item_id );
227
+    return apply_filters('wpinv_item_price', $price, $item_id);
228 228
 }
229 229
 
230
-function wpinv_item_show_price( $item_id = 0, $echo = true ) {
231
-    if ( empty( $item_id ) ) {
230
+function wpinv_item_show_price($item_id = 0, $echo = true) {
231
+    if (empty($item_id)) {
232 232
         $item_id = get_the_ID();
233 233
     }
234 234
 
235
-    $price = wpinv_item_price( $item_id );
235
+    $price = wpinv_item_price($item_id);
236 236
 
237
-    $price           = apply_filters( 'wpinv_item_price', wpinv_sanitize_amount( $price ), $item_id );
237
+    $price           = apply_filters('wpinv_item_price', wpinv_sanitize_amount($price), $item_id);
238 238
     $formatted_price = '<span class="wpinv_price" id="wpinv_item_' . $item_id . '">' . $price . '</span>';
239
-    $formatted_price = apply_filters( 'wpinv_item_price_after_html', $formatted_price, $item_id, $price );
239
+    $formatted_price = apply_filters('wpinv_item_price_after_html', $formatted_price, $item_id, $price);
240 240
 
241
-    if ( $echo ) {
241
+    if ($echo) {
242 242
         echo $formatted_price;
243 243
     } else {
244 244
         return $formatted_price;
245 245
     }
246 246
 }
247 247
 
248
-function wpinv_get_item_final_price( $item_id = 0, $amount_override = null ) {
249
-    if ( is_null( $amount_override ) ) {
250
-        $original_price = get_post_meta( $item_id, '_wpinv_price', true );
248
+function wpinv_get_item_final_price($item_id = 0, $amount_override = null) {
249
+    if (is_null($amount_override)) {
250
+        $original_price = get_post_meta($item_id, '_wpinv_price', true);
251 251
     } else {
252 252
         $original_price = $amount_override;
253 253
     }
254 254
     
255 255
     $price = $original_price;
256 256
 
257
-    return apply_filters( 'wpinv_get_item_final_price', $price, $item_id );
257
+    return apply_filters('wpinv_get_item_final_price', $price, $item_id);
258 258
 }
259 259
 
260
-function wpinv_item_custom_singular_name( $item_id ) {
261
-    if( empty( $item_id ) ) {
260
+function wpinv_item_custom_singular_name($item_id) {
261
+    if (empty($item_id)) {
262 262
         return false;
263 263
     }
264 264
 
265
-    $item = new WPInv_Item( $item_id );
265
+    $item = new WPInv_Item($item_id);
266 266
     
267 267
     return $item->get_custom_singular_name();
268 268
 }
269 269
 
270 270
 function wpinv_get_item_types() {
271 271
     $item_types = array(
272
-            'custom'    => __( 'Standard', 'invoicing' ),
273
-            'fee'       => __( 'Fee', 'invoicing' ),
272
+            'custom'    => __('Standard', 'invoicing'),
273
+            'fee'       => __('Fee', 'invoicing'),
274 274
         );
275
-    return apply_filters( 'wpinv_get_item_types', $item_types );
275
+    return apply_filters('wpinv_get_item_types', $item_types);
276 276
 }
277 277
 
278 278
 function wpinv_item_types() {
279 279
     $item_types = wpinv_get_item_types();
280 280
     
281
-    return ( !empty( $item_types ) ? array_keys( $item_types ) : array() );
281
+    return (!empty($item_types) ? array_keys($item_types) : array());
282 282
 }
283 283
 
284
-function wpinv_get_item_type( $item_id ) {
285
-    if( empty( $item_id ) ) {
284
+function wpinv_get_item_type($item_id) {
285
+    if (empty($item_id)) {
286 286
         return false;
287 287
     }
288 288
 
289
-    $item = new WPInv_Item( $item_id );
289
+    $item = new WPInv_Item($item_id);
290 290
     
291 291
     return $item->get_type();
292 292
 }
293 293
 
294
-function wpinv_item_type( $item_id ) {
294
+function wpinv_item_type($item_id) {
295 295
     $item_types = wpinv_get_item_types();
296 296
     
297
-    $item_type = wpinv_get_item_type( $item_id );
297
+    $item_type = wpinv_get_item_type($item_id);
298 298
     
299
-    if ( empty( $item_type ) ) {
299
+    if (empty($item_type)) {
300 300
         $item_type = '-';
301 301
     }
302 302
     
303
-    $item_type = isset( $item_types[$item_type] ) ? $item_types[$item_type] : __( $item_type, 'invoicing' );
303
+    $item_type = isset($item_types[$item_type]) ? $item_types[$item_type] : __($item_type, 'invoicing');
304 304
 
305
-    return apply_filters( 'wpinv_item_type', $item_type, $item_id );
305
+    return apply_filters('wpinv_item_type', $item_type, $item_id);
306 306
 }
307 307
 
308
-function wpinv_record_item_in_log( $item_id = 0, $file_id, $user_info, $ip, $invoice_id ) {
308
+function wpinv_record_item_in_log($item_id = 0, $file_id, $user_info, $ip, $invoice_id) {
309 309
     global $wpinv_logs;
310 310
     
311
-    if ( empty( $wpinv_logs ) ) {
311
+    if (empty($wpinv_logs)) {
312 312
         return false;
313 313
     }
314 314
 
@@ -317,264 +317,264 @@  discard block
 block discarded – undo
317 317
         'log_type'		=> 'wpi_item'
318 318
     );
319 319
 
320
-    $user_id = isset( $user_info['user_id'] ) ? $user_info['user_id'] : (int) -1;
320
+    $user_id = isset($user_info['user_id']) ? $user_info['user_id'] : (int) -1;
321 321
 
322 322
     $log_meta = array(
323 323
         'user_info'	=> $user_info,
324 324
         'user_id'	=> $user_id,
325
-        'file_id'	=> (int)$file_id,
325
+        'file_id'	=> (int) $file_id,
326 326
         'ip'		=> $ip,
327 327
         'invoice_id'=> $invoice_id,
328 328
     );
329 329
 
330
-    $wpinv_logs->insert_log( $log_data, $log_meta );
330
+    $wpinv_logs->insert_log($log_data, $log_meta);
331 331
 }
332 332
 
333
-function wpinv_remove_item_logs_on_delete( $item_id = 0 ) {
334
-    if ( 'wpi_item' !== get_post_type( $item_id ) )
333
+function wpinv_remove_item_logs_on_delete($item_id = 0) {
334
+    if ('wpi_item' !== get_post_type($item_id))
335 335
         return;
336 336
 
337 337
     global $wpinv_logs;
338 338
     
339
-    if ( empty( $wpinv_logs ) ) {
339
+    if (empty($wpinv_logs)) {
340 340
         return false;
341 341
     }
342 342
 
343 343
     // Remove all log entries related to this item
344
-    $wpinv_logs->delete_logs( $item_id );
344
+    $wpinv_logs->delete_logs($item_id);
345 345
 }
346
-add_action( 'delete_post', 'wpinv_remove_item_logs_on_delete' );
346
+add_action('delete_post', 'wpinv_remove_item_logs_on_delete');
347 347
 
348
-function wpinv_get_random_item( $post_ids = true ) {
349
-    wpinv_get_random_items( 1, $post_ids );
348
+function wpinv_get_random_item($post_ids = true) {
349
+    wpinv_get_random_items(1, $post_ids);
350 350
 }
351 351
 
352
-function wpinv_get_random_items( $num = 3, $post_ids = true ) {
353
-    if ( $post_ids ) {
354
-        $args = array( 'post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num, 'fields' => 'ids' );
352
+function wpinv_get_random_items($num = 3, $post_ids = true) {
353
+    if ($post_ids) {
354
+        $args = array('post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num, 'fields' => 'ids');
355 355
     } else {
356
-        $args = array( 'post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num );
356
+        $args = array('post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num);
357 357
     }
358 358
     
359
-    $args  = apply_filters( 'wpinv_get_random_items', $args );
359
+    $args = apply_filters('wpinv_get_random_items', $args);
360 360
     
361
-    return get_posts( $args );
361
+    return get_posts($args);
362 362
 }
363 363
 
364
-function wpinv_get_item_token( $url = '' ) {
364
+function wpinv_get_item_token($url = '') {
365 365
     $args    = array();
366
-    $hash    = apply_filters( 'wpinv_get_url_token_algorithm', 'sha256' );
367
-    $secret  = apply_filters( 'wpinv_get_url_token_secret', hash( $hash, wp_salt() ) );
366
+    $hash    = apply_filters('wpinv_get_url_token_algorithm', 'sha256');
367
+    $secret  = apply_filters('wpinv_get_url_token_secret', hash($hash, wp_salt()));
368 368
 
369
-    $parts   = parse_url( $url );
369
+    $parts   = parse_url($url);
370 370
     $options = array();
371 371
 
372
-    if ( isset( $parts['query'] ) ) {
373
-        wp_parse_str( $parts['query'], $query_args );
372
+    if (isset($parts['query'])) {
373
+        wp_parse_str($parts['query'], $query_args);
374 374
 
375
-        if ( ! empty( $query_args['o'] ) ) {
376
-            $options = explode( ':', rawurldecode( $query_args['o'] ) );
375
+        if (!empty($query_args['o'])) {
376
+            $options = explode(':', rawurldecode($query_args['o']));
377 377
 
378
-            if ( in_array( 'ip', $options ) ) {
378
+            if (in_array('ip', $options)) {
379 379
                 $args['ip'] = wpinv_get_ip();
380 380
             }
381 381
 
382
-            if ( in_array( 'ua', $options ) ) {
382
+            if (in_array('ua', $options)) {
383 383
                 $ua = wpinv_get_user_agent();
384
-                $args['user_agent'] = rawurlencode( $ua );
384
+                $args['user_agent'] = rawurlencode($ua);
385 385
             }
386 386
         }
387 387
     }
388 388
 
389
-    $args = apply_filters( 'wpinv_get_url_token_args', $args, $url, $options );
389
+    $args = apply_filters('wpinv_get_url_token_args', $args, $url, $options);
390 390
 
391 391
     $args['secret'] = $secret;
392 392
     $args['token']  = false;
393 393
 
394
-    $url   = add_query_arg( $args, $url );
395
-    $parts = parse_url( $url );
394
+    $url   = add_query_arg($args, $url);
395
+    $parts = parse_url($url);
396 396
 
397
-    if ( ! isset( $parts['path'] ) ) {
397
+    if (!isset($parts['path'])) {
398 398
         $parts['path'] = '';
399 399
     }
400 400
 
401
-    $token = md5( $parts['path'] . '?' . $parts['query'] );
401
+    $token = md5($parts['path'] . '?' . $parts['query']);
402 402
 
403 403
     return $token;
404 404
 }
405 405
 
406
-function wpinv_validate_url_token( $url = '' ) {
406
+function wpinv_validate_url_token($url = '') {
407 407
     $ret   = false;
408
-    $parts = parse_url( $url );
408
+    $parts = parse_url($url);
409 409
 
410
-    if ( isset( $parts['query'] ) ) {
411
-        wp_parse_str( $parts['query'], $query_args );
410
+    if (isset($parts['query'])) {
411
+        wp_parse_str($parts['query'], $query_args);
412 412
 
413
-        $allowed = apply_filters( 'wpinv_url_token_allowed_params', array(
413
+        $allowed = apply_filters('wpinv_url_token_allowed_params', array(
414 414
             'item',
415 415
             'ttl',
416 416
             'token'
417
-        ) );
417
+        ));
418 418
 
419 419
         $remove = array();
420 420
 
421
-        foreach( $query_args as $key => $value ) {
422
-            if( false === in_array( $key, $allowed ) ) {
421
+        foreach ($query_args as $key => $value) {
422
+            if (false === in_array($key, $allowed)) {
423 423
                 $remove[] = $key;
424 424
             }
425 425
         }
426 426
 
427
-        if( ! empty( $remove ) ) {
428
-            $url = remove_query_arg( $remove, $url );
427
+        if (!empty($remove)) {
428
+            $url = remove_query_arg($remove, $url);
429 429
         }
430 430
 
431
-        if ( isset( $query_args['ttl'] ) && current_time( 'timestamp' ) > $query_args['ttl'] ) {
432
-            wp_die( apply_filters( 'wpinv_item_link_expired_text', __( 'Sorry but your item link has expired.', 'invoicing' ) ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
431
+        if (isset($query_args['ttl']) && current_time('timestamp') > $query_args['ttl']) {
432
+            wp_die(apply_filters('wpinv_item_link_expired_text', __('Sorry but your item link has expired.', 'invoicing')), __('Error', 'invoicing'), array('response' => 403));
433 433
         }
434 434
 
435
-        if ( isset( $query_args['token'] ) && $query_args['token'] == wpinv_get_item_token( $url ) ) {
435
+        if (isset($query_args['token']) && $query_args['token'] == wpinv_get_item_token($url)) {
436 436
             $ret = true;
437 437
         }
438 438
 
439 439
     }
440 440
 
441
-    return apply_filters( 'wpinv_validate_url_token', $ret, $url, $query_args );
441
+    return apply_filters('wpinv_validate_url_token', $ret, $url, $query_args);
442 442
 }
443 443
 
444
-function wpinv_item_in_cart( $item_id = 0, $options = array() ) {
444
+function wpinv_item_in_cart($item_id = 0, $options = array()) {
445 445
     $cart_items = wpinv_get_cart_contents();
446 446
 
447 447
     $ret = false;
448 448
 
449
-    if ( is_array( $cart_items ) ) {
450
-        foreach ( $cart_items as $item ) {
451
-            if ( $item['id'] == $item_id ) {
449
+    if (is_array($cart_items)) {
450
+        foreach ($cart_items as $item) {
451
+            if ($item['id'] == $item_id) {
452 452
                 $ret = true;
453 453
                 break;
454 454
             }
455 455
         }
456 456
     }
457 457
 
458
-    return (bool) apply_filters( 'wpinv_item_in_cart', $ret, $item_id, $options );
458
+    return (bool) apply_filters('wpinv_item_in_cart', $ret, $item_id, $options);
459 459
 }
460 460
 
461
-function wpinv_get_cart_item_tax( $item_id = 0, $subtotal = '', $options = array() ) {
461
+function wpinv_get_cart_item_tax($item_id = 0, $subtotal = '', $options = array()) {
462 462
     $tax = 0;
463
-    if ( ! wpinv_item_is_tax_exclusive( $item_id ) ) {
464
-        $country = !empty( $_POST['country'] ) ? $_POST['country'] : false;
465
-        $state   = isset( $_POST['state'] ) ? $_POST['state'] : '';
463
+    if (!wpinv_item_is_tax_exclusive($item_id)) {
464
+        $country = !empty($_POST['country']) ? $_POST['country'] : false;
465
+        $state   = isset($_POST['state']) ? $_POST['state'] : '';
466 466
 
467
-        $tax = wpinv_calculate_tax( $subtotal, $country, $state, $item_id );
467
+        $tax = wpinv_calculate_tax($subtotal, $country, $state, $item_id);
468 468
     }
469 469
 
470
-    return apply_filters( 'wpinv_get_cart_item_tax', $tax, $item_id, $subtotal, $options );
470
+    return apply_filters('wpinv_get_cart_item_tax', $tax, $item_id, $subtotal, $options);
471 471
 }
472 472
 
473
-function wpinv_cart_item_price( $item ) {
474
-    $item_id    = isset( $item['id'] ) ? $item['id'] : 0;
475
-    $price      = isset( $item['item_price'] ) ? wpinv_round_amount( $item['item_price'] ) : 0;
476
-    $tax        = wpinv_price( wpinv_format_amount( $item['tax'] ) );
473
+function wpinv_cart_item_price($item) {
474
+    $item_id    = isset($item['id']) ? $item['id'] : 0;
475
+    $price      = isset($item['item_price']) ? wpinv_round_amount($item['item_price']) : 0;
476
+    $tax        = wpinv_price(wpinv_format_amount($item['tax']));
477 477
     
478
-    if ( !wpinv_is_free_item( $item_id ) && !wpinv_item_is_tax_exclusive( $item_id ) ) {
479
-        if ( wpinv_prices_show_tax_on_checkout() && !wpinv_prices_include_tax() ) {
478
+    if (!wpinv_is_free_item($item_id) && !wpinv_item_is_tax_exclusive($item_id)) {
479
+        if (wpinv_prices_show_tax_on_checkout() && !wpinv_prices_include_tax()) {
480 480
             $price += $tax;
481 481
         }
482 482
         
483
-        if( !wpinv_prices_show_tax_on_checkout() && wpinv_prices_include_tax() ) {
483
+        if (!wpinv_prices_show_tax_on_checkout() && wpinv_prices_include_tax()) {
484 484
             $price -= $tax;
485 485
         }        
486 486
     }
487 487
 
488
-    $price = wpinv_price( wpinv_format_amount( $price ) );
488
+    $price = wpinv_price(wpinv_format_amount($price));
489 489
 
490
-    return apply_filters( 'wpinv_cart_item_price_label', $price, $item );
490
+    return apply_filters('wpinv_cart_item_price_label', $price, $item);
491 491
 }
492 492
 
493
-function wpinv_cart_item_subtotal( $item ) {
494
-    $subtotal   = isset( $item['subtotal'] ) ? $item['subtotal'] : 0;
495
-    $subtotal   = wpinv_price( wpinv_format_amount( $subtotal ) );
493
+function wpinv_cart_item_subtotal($item) {
494
+    $subtotal   = isset($item['subtotal']) ? $item['subtotal'] : 0;
495
+    $subtotal   = wpinv_price(wpinv_format_amount($subtotal));
496 496
 
497
-    return apply_filters( 'wpinv_cart_item_subtotal_label', $subtotal, $item );
497
+    return apply_filters('wpinv_cart_item_subtotal_label', $subtotal, $item);
498 498
 }
499 499
 
500
-function wpinv_cart_item_tax( $item ) {
500
+function wpinv_cart_item_tax($item) {
501 501
     $tax        = '';
502 502
     $tax_rate   = '';
503 503
     
504
-    if ( isset( $item['tax'] ) && $item['tax'] > 0 && $item['subtotal'] > 0 ) {
505
-        $tax      = wpinv_price( wpinv_format_amount( $item['tax'] ) );
506
-        $tax_rate = !empty( $item['vat_rate'] ) ? $item['vat_rate'] : ( $item['tax'] / $item['subtotal'] ) * 100;
507
-        $tax_rate = $tax_rate > 0 ? (float)wpinv_round_amount( $tax_rate, 4 ) : '';
504
+    if (isset($item['tax']) && $item['tax'] > 0 && $item['subtotal'] > 0) {
505
+        $tax      = wpinv_price(wpinv_format_amount($item['tax']));
506
+        $tax_rate = !empty($item['vat_rate']) ? $item['vat_rate'] : ($item['tax'] / $item['subtotal']) * 100;
507
+        $tax_rate = $tax_rate > 0 ? (float) wpinv_round_amount($tax_rate, 4) : '';
508 508
         $tax_rate = $tax_rate != '' ? ' <small class="tax-rate normal small">(' . $tax_rate . '%)</small>' : '';
509 509
     }
510 510
     
511
-    $tax        = $tax . $tax_rate;
511
+    $tax = $tax . $tax_rate;
512 512
     
513
-    if ( $tax === '' ) {
513
+    if ($tax === '') {
514 514
         $tax = 0; // Zero tax
515 515
     }
516 516
 
517
-    return apply_filters( 'wpinv_cart_item_tax_label', $tax, $item );
517
+    return apply_filters('wpinv_cart_item_tax_label', $tax, $item);
518 518
 }
519 519
 
520
-function wpinv_get_cart_item_price( $item_id = 0, $cart_item = array(), $options = array(), $remove_tax_from_inclusive = false ) {
520
+function wpinv_get_cart_item_price($item_id = 0, $cart_item = array(), $options = array(), $remove_tax_from_inclusive = false) {
521 521
     $price = 0;
522 522
     
523 523
     // Set custom price
524
-    if ( isset( $cart_item['custom_price'] ) && $cart_item['custom_price'] !== '' ) {
524
+    if (isset($cart_item['custom_price']) && $cart_item['custom_price'] !== '') {
525 525
         $price = $cart_item['custom_price'];
526 526
     } else {
527
-        $variable_prices = wpinv_has_variable_prices( $item_id );
527
+        $variable_prices = wpinv_has_variable_prices($item_id);
528 528
 
529
-        if ( $variable_prices ) {
530
-            $prices = wpinv_get_variable_prices( $item_id );
529
+        if ($variable_prices) {
530
+            $prices = wpinv_get_variable_prices($item_id);
531 531
 
532
-            if ( $prices ) {
533
-                if( ! empty( $options ) ) {
534
-                    $price = isset( $prices[ $options['price_id'] ] ) ? $prices[ $options['price_id'] ]['amount'] : false;
532
+            if ($prices) {
533
+                if (!empty($options)) {
534
+                    $price = isset($prices[$options['price_id']]) ? $prices[$options['price_id']]['amount'] : false;
535 535
                 } else {
536 536
                     $price = false;
537 537
                 }
538 538
             }
539 539
         }
540 540
 
541
-        if( ! $variable_prices || false === $price ) {
542
-            if($cart_item['item_price'] > 0){
541
+        if (!$variable_prices || false === $price) {
542
+            if ($cart_item['item_price'] > 0) {
543 543
                 $price = $cart_item['item_price'];
544 544
             } else {
545 545
                 // Get the standard Item price if not using variable prices
546
-                $price = wpinv_get_item_price( $item_id );
546
+                $price = wpinv_get_item_price($item_id);
547 547
             }
548 548
         }
549 549
     }
550 550
 
551
-    if ( $remove_tax_from_inclusive && wpinv_prices_include_tax() ) {
552
-        $price -= wpinv_get_cart_item_tax( $item_id, $price, $options );
551
+    if ($remove_tax_from_inclusive && wpinv_prices_include_tax()) {
552
+        $price -= wpinv_get_cart_item_tax($item_id, $price, $options);
553 553
     }
554 554
 
555
-    return apply_filters( 'wpinv_cart_item_price', $price, $item_id, $cart_item, $options, $remove_tax_from_inclusive );
555
+    return apply_filters('wpinv_cart_item_price', $price, $item_id, $cart_item, $options, $remove_tax_from_inclusive);
556 556
 }
557 557
 
558
-function wpinv_get_cart_item_price_id( $item = array() ) {
559
-    if( isset( $item['item_number'] ) ) {
560
-        $price_id = isset( $item['item_number']['options']['price_id'] ) ? $item['item_number']['options']['price_id'] : null;
558
+function wpinv_get_cart_item_price_id($item = array()) {
559
+    if (isset($item['item_number'])) {
560
+        $price_id = isset($item['item_number']['options']['price_id']) ? $item['item_number']['options']['price_id'] : null;
561 561
     } else {
562
-        $price_id = isset( $item['options']['price_id'] ) ? $item['options']['price_id'] : null;
562
+        $price_id = isset($item['options']['price_id']) ? $item['options']['price_id'] : null;
563 563
     }
564 564
     return $price_id;
565 565
 }
566 566
 
567
-function wpinv_get_cart_item_price_name( $item = array() ) {
568
-    $price_id = (int)wpinv_get_cart_item_price_id( $item );
569
-    $prices   = wpinv_get_variable_prices( $item['id'] );
570
-    $name     = ! empty( $prices[ $price_id ] ) ? $prices[ $price_id ]['name'] : '';
571
-    return apply_filters( 'wpinv_get_cart_item_price_name', $name, $item['id'], $price_id, $item );
567
+function wpinv_get_cart_item_price_name($item = array()) {
568
+    $price_id = (int) wpinv_get_cart_item_price_id($item);
569
+    $prices   = wpinv_get_variable_prices($item['id']);
570
+    $name     = !empty($prices[$price_id]) ? $prices[$price_id]['name'] : '';
571
+    return apply_filters('wpinv_get_cart_item_price_name', $name, $item['id'], $price_id, $item);
572 572
 }
573 573
 
574
-function wpinv_get_cart_item_name( $item = array() ) {
575
-    $item_title = !empty( $item['name'] ) ? $item['name'] : get_the_title( $item['id'] );
574
+function wpinv_get_cart_item_name($item = array()) {
575
+    $item_title = !empty($item['name']) ? $item['name'] : get_the_title($item['id']);
576 576
 
577
-    if ( empty( $item_title ) ) {
577
+    if (empty($item_title)) {
578 578
         $item_title = $item['id'];
579 579
     }
580 580
 
@@ -584,23 +584,23 @@  discard block
 block discarded – undo
584 584
     }
585 585
     */
586 586
 
587
-    return apply_filters( 'wpinv_get_cart_item_name', $item_title, $item['id'], $item );
587
+    return apply_filters('wpinv_get_cart_item_name', $item_title, $item['id'], $item);
588 588
 }
589 589
 
590
-function wpinv_has_variable_prices( $item_id = 0 ) {
590
+function wpinv_has_variable_prices($item_id = 0) {
591 591
     return false;
592 592
 }
593 593
 
594
-function wpinv_get_item_position_in_cart( $item_id = 0, $options = array() ) {
594
+function wpinv_get_item_position_in_cart($item_id = 0, $options = array()) {
595 595
     $cart_items = wpinv_get_cart_contents();
596 596
 
597
-    if ( !is_array( $cart_items ) ) {
597
+    if (!is_array($cart_items)) {
598 598
         return false; // Empty cart
599 599
     } else {
600
-        foreach ( $cart_items as $position => $item ) {
601
-            if ( $item['id'] == $item_id ) {
602
-                if ( isset( $options['price_id'] ) && isset( $item['options']['price_id'] ) ) {
603
-                    if ( (int) $options['price_id'] == (int) $item['options']['price_id'] ) {
600
+        foreach ($cart_items as $position => $item) {
601
+            if ($item['id'] == $item_id) {
602
+                if (isset($options['price_id']) && isset($item['options']['price_id'])) {
603
+                    if ((int) $options['price_id'] == (int) $item['options']['price_id']) {
604 604
                         return $position;
605 605
                     }
606 606
                 } else {
@@ -613,80 +613,80 @@  discard block
 block discarded – undo
613 613
     return false; // Not found
614 614
 }
615 615
 
616
-function wpinv_get_cart_item_quantity( $item ) {
617
-    if ( wpinv_item_quantities_enabled() ) {
618
-        $quantity = !empty( $item['quantity'] ) && (int)$item['quantity'] > 0 ? absint( $item['quantity'] ) : 1;
616
+function wpinv_get_cart_item_quantity($item) {
617
+    if (wpinv_item_quantities_enabled()) {
618
+        $quantity = !empty($item['quantity']) && (int) $item['quantity'] > 0 ? absint($item['quantity']) : 1;
619 619
     } else {
620 620
         $quantity = 1;
621 621
     }
622 622
     
623
-    if ( $quantity < 1 ) {
623
+    if ($quantity < 1) {
624 624
         $quantity = 1;
625 625
     }
626 626
     
627
-    return apply_filters( 'wpinv_get_cart_item_quantity', $quantity, $item );
627
+    return apply_filters('wpinv_get_cart_item_quantity', $quantity, $item);
628 628
 }
629 629
 
630
-function wpinv_get_item_suffix( $item, $html = true ) {
631
-    if ( empty( $item ) ) {
630
+function wpinv_get_item_suffix($item, $html = true) {
631
+    if (empty($item)) {
632 632
         return NULL;
633 633
     }
634 634
     
635
-    if ( is_int( $item ) ) {
636
-        $item = new WPInv_Item( $item );
635
+    if (is_int($item)) {
636
+        $item = new WPInv_Item($item);
637 637
     }
638 638
     
639
-    if ( !( is_object( $item ) && is_a( $item, 'WPInv_Item' ) ) ) {
639
+    if (!(is_object($item) && is_a($item, 'WPInv_Item'))) {
640 640
         return NULL;
641 641
     }
642 642
     
643
-    $suffix = $item->is_recurring() ? ' <span class="wpi-suffix">' . __( '(r)', 'invoicing' ) . '</span>' : '';
643
+    $suffix = $item->is_recurring() ? ' <span class="wpi-suffix">' . __('(r)', 'invoicing') . '</span>' : '';
644 644
     
645
-    if ( !$html && $suffix ) {
646
-        $suffix = strip_tags( $suffix );
645
+    if (!$html && $suffix) {
646
+        $suffix = strip_tags($suffix);
647 647
     }
648 648
     
649
-    return apply_filters( 'wpinv_get_item_suffix', $suffix, $item, $html );
649
+    return apply_filters('wpinv_get_item_suffix', $suffix, $item, $html);
650 650
 }
651 651
 
652
-function wpinv_remove_item( $item = 0, $force_delete = false ) {
653
-    if ( empty( $item ) ) {
652
+function wpinv_remove_item($item = 0, $force_delete = false) {
653
+    if (empty($item)) {
654 654
         return NULL;
655 655
     }
656 656
     
657
-    if ( is_int( $item ) ) {
658
-        $item = new WPInv_Item( $item );
657
+    if (is_int($item)) {
658
+        $item = new WPInv_Item($item);
659 659
     }
660 660
     
661
-    if ( !( is_object( $item ) && is_a( $item, 'WPInv_Item' ) ) ) {
661
+    if (!(is_object($item) && is_a($item, 'WPInv_Item'))) {
662 662
         return NULL;
663 663
     }
664 664
     
665
-    do_action( 'wpinv_pre_delete_item', $item );
665
+    do_action('wpinv_pre_delete_item', $item);
666 666
 
667
-    wp_delete_post( $item->ID, $force_delete );
667
+    wp_delete_post($item->ID, $force_delete);
668 668
 
669
-    do_action( 'wpinv_post_delete_item', $item );
669
+    do_action('wpinv_post_delete_item', $item);
670 670
 }
671 671
 
672
-function wpinv_can_delete_item( $post_id ) {
672
+function wpinv_can_delete_item($post_id) {
673 673
     $return = wpinv_current_user_can_manage_invoicing() ? true : false;
674 674
     
675
-    if ( $return && wpinv_item_in_use( $post_id ) ) {
675
+    if ($return && wpinv_item_in_use($post_id)) {
676 676
         $return = false; // Don't delete item already use in invoices.
677 677
     }
678 678
     
679
-    return apply_filters( 'wpinv_can_delete_item', $return, $post_id );
679
+    return apply_filters('wpinv_can_delete_item', $return, $post_id);
680 680
 }
681 681
 
682 682
 function wpinv_admin_action_delete() {
683 683
     $screen = get_current_screen();
684 684
     
685
-    if ( !empty( $screen->post_type ) && $screen->post_type == 'wpi_item' && !empty( $_REQUEST['post'] ) && is_array( $_REQUEST['post'] ) ) {
685
+    if (!empty($screen->post_type) && $screen->post_type == 'wpi_item' && !empty($_REQUEST['post']) && is_array($_REQUEST['post'])) {
686 686
         $post_ids = array();
687 687
         
688
-        foreach ( $_REQUEST['post'] as $post_id ) {
689
-            if ( !wpinv_can_delete_item( $post_id ) ) {
688
+        foreach ($_REQUEST['post'] as $post_id) {
689
+            if (!wpinv_can_delete_item($post_id)) {
690 690
                 continue;
691 691
             }
692 692
             
@@ -696,88 +696,88 @@  discard block
 block discarded – undo
696 696
         $_REQUEST['post'] = $post_ids;
697 697
     }
698 698
 }
699
-add_action( 'admin_action_trash', 'wpinv_admin_action_delete', -10 );
700
-add_action( 'admin_action_delete', 'wpinv_admin_action_delete', -10 );
699
+add_action('admin_action_trash', 'wpinv_admin_action_delete', -10);
700
+add_action('admin_action_delete', 'wpinv_admin_action_delete', -10);
701 701
 
702
-function wpinv_check_delete_item( $check, $post, $force_delete ) {
703
-    if ( $post->post_type == 'wpi_item' ) {
704
-        if ( $force_delete && !wpinv_can_delete_item( $post->ID ) ) {
702
+function wpinv_check_delete_item($check, $post, $force_delete) {
703
+    if ($post->post_type == 'wpi_item') {
704
+        if ($force_delete && !wpinv_can_delete_item($post->ID)) {
705 705
             return true;
706 706
         }
707 707
     }
708 708
     
709 709
     return $check;
710 710
 }
711
-add_filter( 'pre_delete_post', 'wpinv_check_delete_item', 10, 3 );
711
+add_filter('pre_delete_post', 'wpinv_check_delete_item', 10, 3);
712 712
 
713
-function wpinv_item_in_use( $item_id ) {
713
+function wpinv_item_in_use($item_id) {
714 714
     global $wpdb, $wpi_items_in_use;
715 715
     
716
-    if ( !$item_id > 0 ) {
716
+    if (!$item_id > 0) {
717 717
         return false;
718 718
     }
719 719
     
720
-    if ( !empty( $wpi_items_in_use ) ) {
721
-        if ( isset( $wpi_items_in_use[$item_id] ) ) {
720
+    if (!empty($wpi_items_in_use)) {
721
+        if (isset($wpi_items_in_use[$item_id])) {
722 722
             return $wpi_items_in_use[$item_id];
723 723
         }
724 724
     } else {
725 725
         $wpi_items_in_use = array();
726 726
     }
727 727
     
728
-    $statuses   = array_keys( wpinv_get_invoice_statuses( true, true ) );
728
+    $statuses = array_keys(wpinv_get_invoice_statuses(true, true));
729 729
     
730
-    $query  = "SELECT p.ID FROM " . $wpdb->posts . " AS p INNER JOIN " . $wpdb->postmeta . " AS pm ON p.ID = pm.post_id WHERE p.post_type = 'wpi_invoice' AND p.post_status IN( '" . implode( "','", $statuses ) . "' ) AND pm.meta_key = '_wpinv_item_ids' AND FIND_IN_SET( '" . (int)$item_id . "', pm.meta_value )";
731
-    $in_use = $wpdb->get_var( $query ) > 0 ? true : false;
730
+    $query  = "SELECT p.ID FROM " . $wpdb->posts . " AS p INNER JOIN " . $wpdb->postmeta . " AS pm ON p.ID = pm.post_id WHERE p.post_type = 'wpi_invoice' AND p.post_status IN( '" . implode("','", $statuses) . "' ) AND pm.meta_key = '_wpinv_item_ids' AND FIND_IN_SET( '" . (int) $item_id . "', pm.meta_value )";
731
+    $in_use = $wpdb->get_var($query) > 0 ? true : false;
732 732
     
733 733
     $wpi_items_in_use[$item_id] = $in_use;
734 734
     
735 735
     return $in_use;
736 736
 }
737 737
 
738
-function wpinv_create_item( $args = array(), $wp_error = false, $force_update = false ) {
738
+function wpinv_create_item($args = array(), $wp_error = false, $force_update = false) {
739 739
     // Set some defaults
740 740
     $defaults = array(
741
-        'type'                 => 'custom',                                                // Optional. Item type. Default 'custom'.
742
-        'title'                => '',                                                      // Required. Item title.
743
-        'custom_id'            => 0,                                                       // Optional. Any integer or non numeric id. Must be unique within item type.
744
-        'price'                => '0.00',                                                  // Optional. Item price. Default '0.00'.
745
-        'status'               => 'pending',                                               // Optional. pending, publish
746
-        'custom_name'          => '',                                                      // Optional. Plural sub title for item.
747
-        'custom_singular_name' => '',                                                      // Optional. Singular sub title for item.
748
-        'vat_rule'             => 'digital',                                               // Optional. digital => Digital item, physical => Physical item
749
-        'editable'             => true,                                                    // Optional. Item editable from Items list page? Default true.
750
-        'excerpt'              => '',                                                      // Optional. Item short description
741
+        'type'                 => 'custom', // Optional. Item type. Default 'custom'.
742
+        'title'                => '', // Required. Item title.
743
+        'custom_id'            => 0, // Optional. Any integer or non numeric id. Must be unique within item type.
744
+        'price'                => '0.00', // Optional. Item price. Default '0.00'.
745
+        'status'               => 'pending', // Optional. pending, publish
746
+        'custom_name'          => '', // Optional. Plural sub title for item.
747
+        'custom_singular_name' => '', // Optional. Singular sub title for item.
748
+        'vat_rule'             => 'digital', // Optional. digital => Digital item, physical => Physical item
749
+        'editable'             => true, // Optional. Item editable from Items list page? Default true.
750
+        'excerpt'              => '', // Optional. Item short description
751 751
         /* Recurring item fields */
752
-        'is_recurring'         => 0,                                                       // Optional. 1 => Allow recurring or 0 => Don't allow recurring
753
-        'recurring_period'     => 'M',                                                     // Optional. D => Daily, W => Weekly, M => Monthly, Y => Yearly
754
-        'recurring_interval'   => 0,                                                       // Optional. Integer value between 1 - 90.
755
-        'recurring_limit'      => 0,                                                       // Optional. Any integer number. 0 for recurring forever until cancelled.
756
-        'free_trial'           => 0,                                                       // Optional. 1 => Allow free trial or 0 => Don't free trial
757
-        'trial_period'         => 'M',                                                     // Optional. D => Daily, W => Weekly, M => Monthly, Y => Yearly
758
-        'trial_interval'       => 0,                                                       // Optional. Any integer number.
759
-        'minimum_price'        => '0.00',                                                  // Optional. Minimum allowed prices for items with dynamic pricing.
760
-        'dynamic_pricing'      => 0,                                                       // Optional. Whether or not the item supports dynamic prices.
752
+        'is_recurring'         => 0, // Optional. 1 => Allow recurring or 0 => Don't allow recurring
753
+        'recurring_period'     => 'M', // Optional. D => Daily, W => Weekly, M => Monthly, Y => Yearly
754
+        'recurring_interval'   => 0, // Optional. Integer value between 1 - 90.
755
+        'recurring_limit'      => 0, // Optional. Any integer number. 0 for recurring forever until cancelled.
756
+        'free_trial'           => 0, // Optional. 1 => Allow free trial or 0 => Don't free trial
757
+        'trial_period'         => 'M', // Optional. D => Daily, W => Weekly, M => Monthly, Y => Yearly
758
+        'trial_interval'       => 0, // Optional. Any integer number.
759
+        'minimum_price'        => '0.00', // Optional. Minimum allowed prices for items with dynamic pricing.
760
+        'dynamic_pricing'      => 0, // Optional. Whether or not the item supports dynamic prices.
761 761
     );
762 762
 
763
-    $data = wp_parse_args( $args, $defaults );
763
+    $data = wp_parse_args($args, $defaults);
764 764
 
765
-    if ( empty( $data['type'] ) ) {
765
+    if (empty($data['type'])) {
766 766
         $data['type'] = 'custom';
767 767
     }
768 768
 
769
-    if ( !empty( $data['custom_id'] ) ) {
770
-        $item = wpinv_get_item_by( 'custom_id', $data['custom_id'], $data['type'] );
769
+    if (!empty($data['custom_id'])) {
770
+        $item = wpinv_get_item_by('custom_id', $data['custom_id'], $data['type']);
771 771
     } else {
772 772
         $item = NULL;
773 773
     }
774 774
 
775
-    if ( !empty( $item ) ) {
776
-        if ( $force_update ) {
777
-            if ( empty( $args['ID'] ) ) {
775
+    if (!empty($item)) {
776
+        if ($force_update) {
777
+            if (empty($args['ID'])) {
778 778
                 $args['ID'] = $item->ID;
779 779
             }
780
-            return wpinv_update_item( $args, $wp_error );
780
+            return wpinv_update_item($args, $wp_error);
781 781
         }
782 782
 
783 783
         return $item;
@@ -788,21 +788,21 @@  discard block
 block discarded – undo
788 788
     $meta['custom_id']              = $data['custom_id'];
789 789
     $meta['custom_singular_name']   = $data['custom_singular_name'];
790 790
     $meta['custom_name']            = $data['custom_name'];
791
-    $meta['price']                  = wpinv_round_amount( $data['price'] );
792
-    $meta['editable']               = (int)$data['editable'];
791
+    $meta['price']                  = wpinv_round_amount($data['price']);
792
+    $meta['editable']               = (int) $data['editable'];
793 793
     $meta['vat_rule']               = $data['vat_rule'];
794 794
     $meta['vat_class']              = '_standard';
795 795
     $meta['dynamic_pricing']        = (int) $data['dynamic_pricing'];
796
-    $meta['minimum_price']          = wpinv_round_amount( $data['minimum_price'] );
796
+    $meta['minimum_price']          = wpinv_round_amount($data['minimum_price']);
797 797
     
798
-    if ( !empty( $data['is_recurring'] ) ) {
798
+    if (!empty($data['is_recurring'])) {
799 799
         $meta['is_recurring']       = $data['is_recurring'];
800 800
         $meta['recurring_period']   = $data['recurring_period'];
801
-        $meta['recurring_interval'] = absint( $data['recurring_interval'] );
802
-        $meta['recurring_limit']    = absint( $data['recurring_limit'] );
801
+        $meta['recurring_interval'] = absint($data['recurring_interval']);
802
+        $meta['recurring_limit']    = absint($data['recurring_limit']);
803 803
         $meta['free_trial']         = $data['free_trial'];
804 804
         $meta['trial_period']       = $data['trial_period'];
805
-        $meta['trial_interval']     = absint( $data['trial_interval'] );
805
+        $meta['trial_interval']     = absint($data['trial_interval']);
806 806
     } else {
807 807
         $meta['is_recurring']       = 0;
808 808
         $meta['recurring_period']   = '';
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
         $meta['trial_interval']     = '';
814 814
     }
815 815
     
816
-    $post_data  = array( 
816
+    $post_data = array( 
817 817
         'post_title'    => $data['title'],
818 818
         'post_excerpt'  => $data['excerpt'],
819 819
         'post_status'   => $data['status'],
@@ -821,34 +821,34 @@  discard block
 block discarded – undo
821 821
     );
822 822
 
823 823
     $item = new WPInv_Item();
824
-    $return = $item->create( $post_data, $wp_error );
824
+    $return = $item->create($post_data, $wp_error);
825 825
 
826
-    if ( $return && !empty( $item ) && !is_wp_error( $return ) ) {
826
+    if ($return && !empty($item) && !is_wp_error($return)) {
827 827
         return $item;
828 828
     }
829 829
 
830
-    if ( $wp_error && is_wp_error( $return ) ) {
830
+    if ($wp_error && is_wp_error($return)) {
831 831
         return $return;
832 832
     }
833 833
     return 0;
834 834
 }
835 835
 
836
-function wpinv_update_item( $args = array(), $wp_error = false ) {
837
-    $item = !empty( $args['ID'] ) ? new WPInv_Item( $args['ID'] ) : NULL;
836
+function wpinv_update_item($args = array(), $wp_error = false) {
837
+    $item = !empty($args['ID']) ? new WPInv_Item($args['ID']) : NULL;
838 838
 
839
-    if ( empty( $item ) || !( !empty( $item->post_type ) && $item->post_type == 'wpi_item' ) ) {
840
-        if ( $wp_error ) {
841
-            return new WP_Error( 'wpinv_invalid_item', __( 'Invalid item.', 'invoicing' ) );
839
+    if (empty($item) || !(!empty($item->post_type) && $item->post_type == 'wpi_item')) {
840
+        if ($wp_error) {
841
+            return new WP_Error('wpinv_invalid_item', __('Invalid item.', 'invoicing'));
842 842
         }
843 843
         return 0;
844 844
     }
845 845
     
846
-    if ( !empty( $args['custom_id'] ) ) {
847
-        $item_exists = wpinv_get_item_by( 'custom_id', $args['custom_id'], ( !empty( $args['type'] ) ? $args['type'] : $item->type ) );
846
+    if (!empty($args['custom_id'])) {
847
+        $item_exists = wpinv_get_item_by('custom_id', $args['custom_id'], (!empty($args['type']) ? $args['type'] : $item->type));
848 848
         
849
-        if ( !empty( $item_exists ) && $item_exists->ID != $args['ID'] ) {
850
-            if ( $wp_error ) {
851
-                return new WP_Error( 'wpinv_invalid_custom_id', __( 'Item with custom id already exists.', 'invoicing' ) );
849
+        if (!empty($item_exists) && $item_exists->ID != $args['ID']) {
850
+            if ($wp_error) {
851
+                return new WP_Error('wpinv_invalid_custom_id', __('Item with custom id already exists.', 'invoicing'));
852 852
             }
853 853
             return 0;
854 854
         }
@@ -875,54 +875,54 @@  discard block
 block discarded – undo
875 875
     );
876 876
 
877 877
     $post_data = array();
878
-    if ( isset( $args['title'] ) ) { 
878
+    if (isset($args['title'])) { 
879 879
         $post_data['post_title'] = $args['title'];
880 880
     }
881
-    if ( isset( $args['excerpt'] ) ) { 
881
+    if (isset($args['excerpt'])) { 
882 882
         $post_data['post_excerpt'] = $args['excerpt'];
883 883
     }
884
-    if ( isset( $args['status'] ) ) { 
884
+    if (isset($args['status'])) { 
885 885
         $post_data['post_status'] = $args['status'];
886 886
     }
887 887
     
888
-    foreach ( $meta_fields as $meta_field ) {
889
-        if ( isset( $args[ $meta_field ] ) ) { 
890
-            $value = $args[ $meta_field ];
888
+    foreach ($meta_fields as $meta_field) {
889
+        if (isset($args[$meta_field])) { 
890
+            $value = $args[$meta_field];
891 891
 
892
-            switch ( $meta_field ) {
892
+            switch ($meta_field) {
893 893
                 case 'price':
894 894
                 case 'minimum_price':
895
-                    $value = wpinv_round_amount( $value );
895
+                    $value = wpinv_round_amount($value);
896 896
                 break;
897 897
                 case 'recurring_interval':
898 898
                 case 'recurring_limit':
899 899
                 case 'trial_interval':
900
-                    $value = absint( $value );
900
+                    $value = absint($value);
901 901
                 break;
902 902
 				case 'editable':
903 903
                     $value = (int) $value;
904 904
                 break;
905 905
             }
906 906
 
907
-            $post_data['meta'][ $meta_field ] = $value;
907
+            $post_data['meta'][$meta_field] = $value;
908 908
         };
909 909
     }
910 910
 
911
-    if ( empty( $post_data ) ) {
912
-        if ( $wp_error ) {
913
-            return new WP_Error( 'wpinv_invalid_item_data', __( 'Invalid item data.', 'invoicing' ) );
911
+    if (empty($post_data)) {
912
+        if ($wp_error) {
913
+            return new WP_Error('wpinv_invalid_item_data', __('Invalid item data.', 'invoicing'));
914 914
         }
915 915
         return 0;
916 916
     }
917 917
     $post_data['ID'] = $args['ID'];
918 918
 
919
-    $return = $item->update( $post_data, $wp_error );
919
+    $return = $item->update($post_data, $wp_error);
920 920
 
921
-    if ( $return && !empty( $item ) && !is_wp_error( $return ) ) {
921
+    if ($return && !empty($item) && !is_wp_error($return)) {
922 922
         return $item;
923 923
     }
924 924
 
925
-    if ( $wp_error && is_wp_error( $return ) ) {
925
+    if ($wp_error && is_wp_error($return)) {
926 926
         return $return;
927 927
     }
928 928
     return 0;
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-invoice-details.php 1 patch
Spacing   +94 added lines, -94 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,50 +189,50 @@  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
     }
205 205
     
206
-    public static function payment_meta( $post ) {
206
+    public static function payment_meta($post) {
207 207
         global $wpi_mb_invoice;
208 208
 
209
-        $set_dateway = empty( $wpi_mb_invoice->gateway ) ? true : false;
210
-        if ( !$set_dateway && !$wpi_mb_invoice->get_meta( '_wpinv_checkout', true ) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded() ) {
209
+        $set_dateway = empty($wpi_mb_invoice->gateway) ? true : false;
210
+        if (!$set_dateway && !$wpi_mb_invoice->get_meta('_wpinv_checkout', true) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded()) {
211 211
             $set_dateway = true;
212 212
         }
213 213
         
214 214
         ?>
215 215
         <p class="wpi-meta-row">
216
-        <?php if ( $set_dateway ) { $gateways = wpinv_get_enabled_payment_gateways( true ); ?>
217
-            <label for="wpinv_gateway"><?php _e( 'Gateway:', 'invoicing' ) ; ?></label>
216
+        <?php if ($set_dateway) { $gateways = wpinv_get_enabled_payment_gateways(true); ?>
217
+            <label for="wpinv_gateway"><?php _e('Gateway:', 'invoicing'); ?></label>
218 218
             <select required="required" id="wpinv_gateway" class="wpi_select2" name="wpinv_gateway">
219
-                <?php foreach ( $gateways as $name => $gateway ) {
220
-                    if ( $wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription( $name ) ) {
219
+                <?php foreach ($gateways as $name => $gateway) {
220
+                    if ($wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription($name)) {
221 221
                         continue;
222 222
                     }
223 223
                     ?>
224
-                <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>
224
+                <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>
225 225
                 <?php } ?>
226 226
             </select>
227 227
         <?php } else { 
228
-            echo wp_sprintf( __( '<label>Gateway:</label> %s', 'invoicing' ), wpinv_get_gateway_admin_label( $wpi_mb_invoice->gateway ) );
228
+            echo wp_sprintf(__('<label>Gateway:</label> %s', 'invoicing'), wpinv_get_gateway_admin_label($wpi_mb_invoice->gateway));
229 229
         } ?>
230 230
         </p>
231
-        <?php if ( $key = $wpi_mb_invoice->get_key() ) { ?>
232
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $key ); ?></p>
231
+        <?php if ($key = $wpi_mb_invoice->get_key()) { ?>
232
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $key); ?></p>
233 233
         <?php } ?>
234
-        <?php if ( $wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded() ) { ?>
235
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Transaction ID:</label> %s', 'invoicing' ), wpinv_payment_link_transaction_id( $wpi_mb_invoice ) ); ?></p>
234
+        <?php if ($wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded()) { ?>
235
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p>
236 236
         <?php } ?>
237 237
         <?php
238 238
     }
Please login to merge, or discard this patch.