Passed
Push — master ( 3b63ca...c463fc )
by Brian
04:48
created
includes/admin/meta-boxes/class-getpaid-meta-box-item-details.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit; // Exit if accessed directly
11
+    exit; // Exit if accessed directly
12 12
 }
13 13
 
14 14
 /**
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 class GetPaid_Meta_Box_Item_Details {
18 18
 
19 19
     /**
20
-	 * Output the metabox.
21
-	 *
22
-	 * @param WP_Post $post
23
-	 */
20
+     * Output the metabox.
21
+     *
22
+     * @param WP_Post $post
23
+     */
24 24
     public static function output( $post ) {
25 25
 
26 26
         // Prepare the item.
@@ -289,35 +289,35 @@  discard block
 block discarded – undo
289 289
     }
290 290
 
291 291
     /**
292
-	 * Save meta box data.
293
-	 *
294
-	 * @param int $post_id
295
-	 */
296
-	public static function save( $post_id ) {
292
+     * Save meta box data.
293
+     *
294
+     * @param int $post_id
295
+     */
296
+    public static function save( $post_id ) {
297 297
 
298 298
         // Prepare the item.
299 299
         $item = new WPInv_Item( $post_id );
300 300
 
301 301
         // Load new data.
302 302
         $item->set_props(
303
-			array(
304
-				'price'                => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null,
305
-				'vat_rule'             => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null,
306
-				'vat_class'            => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null,
307
-				'type'                 => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null,
308
-				'is_dynamic_pricing'   => isset( $_POST['wpinv_name_your_price'] ),
303
+            array(
304
+                'price'                => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null,
305
+                'vat_rule'             => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null,
306
+                'vat_class'            => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null,
307
+                'type'                 => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null,
308
+                'is_dynamic_pricing'   => isset( $_POST['wpinv_name_your_price'] ),
309 309
                 'minimum_price'        => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null,
310
-				'is_recurring'         => isset( $_POST['wpinv_is_recurring'] ),
311
-				'recurring_period'     => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null,
312
-				'recurring_interval'   => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null,
313
-				'recurring_limit'      => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null,
314
-				'is_free_trial'        => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null,
315
-				'trial_period'         => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null,
316
-				'trial_interval'       => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null,
317
-			)
310
+                'is_recurring'         => isset( $_POST['wpinv_is_recurring'] ),
311
+                'recurring_period'     => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null,
312
+                'recurring_interval'   => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null,
313
+                'recurring_limit'      => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null,
314
+                'is_free_trial'        => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null,
315
+                'trial_period'         => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null,
316
+                'trial_interval'       => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null,
317
+            )
318 318
         );
319 319
 
320
-		$item->save();
321
-		do_action( 'getpaid_item_metabox_save', $post_id, $item );
322
-	}
320
+        $item->save();
321
+        do_action( 'getpaid_item_metabox_save', $post_id, $item );
322
+    }
323 323
 }
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,27 +21,27 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the item.
27
-        $item = new WPInv_Item( $post );
27
+        $item = new WPInv_Item($post);
28 28
 
29 29
         // Nonce field.
30
-        wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' );
30
+        wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce');
31 31
 
32 32
         // Set the currency position.
33 33
         $position = wpinv_currency_position();
34 34
 
35
-        if ( $position == 'left_space' ) {
35
+        if ($position == 'left_space') {
36 36
             $position = 'left';
37 37
         }
38 38
 
39
-        if ( $position == 'right_space' ) {
39
+        if ($position == 'right_space') {
40 40
             $position = 'right';
41 41
         }
42 42
 
43 43
         ?>
44
-        <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr( $item->get_type( 'edit' ) ); ?>" />
44
+        <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr($item->get_type('edit')); ?>" />
45 45
         <input type="hidden" id="_wpi_is_editable" value="<?php echo (int) $item->is_editable(); ?>" />
46 46
         <style>
47 47
             #poststuff .input-group-text,
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
         </style>
52 52
         <div class='bsui' style='max-width: 600px;padding-top: 10px; max-width: 820px;'>
53 53
 
54
-            <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?>
54
+            <?php do_action('wpinv_item_details_metabox_before_price', $item); ?>
55 55
             <div class="form-group row">
56
-                <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e( 'Item Price', 'invoicing' )?></span></label>
56
+                <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e('Item Price', 'invoicing')?></span></label>
57 57
                 <div class="col-sm-8">
58 58
                     <div class="row">
59 59
                         <div class="col-sm-4 getpaid-price-input">
60 60
                             <div class="input-group input-group-sm">
61
-                                <?php if( 'left' == $position ) : ?>
61
+                                <?php if ('left' == $position) : ?>
62 62
                                 <div class="input-group-prepend">
63 63
                                     <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span>
64 64
                                 </div>
65 65
                                 <?php endif; ?>
66
-                                <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr( $item->get_price( 'edit' ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control">
66
+                                <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr($item->get_price('edit')); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control">
67 67
 
68
-                                <?php if( 'left' != $position ) : ?>
68
+                                <?php if ('left' != $position) : ?>
69 69
                                 <div class="input-group-append">
70 70
                                     <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span>
71 71
                                 </div>
@@ -79,25 +79,25 @@  discard block
 block discarded – undo
79 79
                                     array(
80 80
                                         'id'               => 'wpinv_recurring_interval',
81 81
                                         'name'             => 'wpinv_recurring_interval',
82
-                                        'label'            => __( 'Interval', 'invoicing' ),
83
-                                        'placeholder'      => __( 'Select Interval', 'invoicing' ),
84
-                                        'value'            => $item->get_recurring_interval( 'edit' ),
82
+                                        'label'            => __('Interval', 'invoicing'),
83
+                                        'placeholder'      => __('Select Interval', 'invoicing'),
84
+                                        'value'            => $item->get_recurring_interval('edit'),
85 85
                                         'select2'          => true,
86 86
                                         'data-allow-clear' => 'false',
87 87
                                         'options'          => array(
88
-                                            '1'  => __( 'every', 'invoicing' ),
89
-                                            '2'  => __( 'every 2nd', 'invoicing' ),
90
-                                            '3'  => __( 'every 3rd', 'invoicing' ),
91
-                                            '4'  => __( 'every 4th', 'invoicing' ),
92
-                                            '5'  => __( 'every 5th', 'invoicing' ),
93
-                                            '6'  => __( 'every 6th', 'invoicing' ),
94
-                                            '8'  => __( 'every 8th', 'invoicing' ),
95
-                                            '9'  => __( 'every 9th', 'invoicing' ),
96
-                                            '10' => __( 'every 10th', 'invoicing' ),
97
-                                            '11' => __( 'every 11th', 'invoicing' ),
98
-                                            '12' => __( 'every 12th', 'invoicing' ),
99
-                                            '13' => __( 'every 13th', 'invoicing' ),
100
-                                            '14' => __( 'every 14th', 'invoicing' ),
88
+                                            '1'  => __('every', 'invoicing'),
89
+                                            '2'  => __('every 2nd', 'invoicing'),
90
+                                            '3'  => __('every 3rd', 'invoicing'),
91
+                                            '4'  => __('every 4th', 'invoicing'),
92
+                                            '5'  => __('every 5th', 'invoicing'),
93
+                                            '6'  => __('every 6th', 'invoicing'),
94
+                                            '8'  => __('every 8th', 'invoicing'),
95
+                                            '9'  => __('every 9th', 'invoicing'),
96
+                                            '10' => __('every 10th', 'invoicing'),
97
+                                            '11' => __('every 11th', 'invoicing'),
98
+                                            '12' => __('every 12th', 'invoicing'),
99
+                                            '13' => __('every 13th', 'invoicing'),
100
+                                            '14' => __('every 14th', 'invoicing'),
101 101
                                         )
102 102
                                     )
103 103
                                 );
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
                                     array(
110 110
                                         'id'               => 'wpinv_recurring_period',
111 111
                                         'name'             => 'wpinv_recurring_period',
112
-                                        'label'            => __( 'Period', 'invoicing' ),
113
-                                        'placeholder'      => __( 'Select Period', 'invoicing' ),
114
-                                        'value'            => $item->get_recurring_period( 'edit' ),
112
+                                        'label'            => __('Period', 'invoicing'),
113
+                                        'placeholder'      => __('Select Period', 'invoicing'),
114
+                                        'value'            => $item->get_recurring_period('edit'),
115 115
                                         'select2'          => true,
116 116
                                         'data-allow-clear' => 'false',
117 117
                                         'options'     => array(
118
-                                            'D'  => __( 'day', 'invoicing' ),
119
-                                            'W'  => __( 'week', 'invoicing' ),
120
-                                            'M'  => __( 'month', 'invoicing' ),
121
-                                            'Y'  => __( 'year', 'invoicing' ),
118
+                                            'D'  => __('day', 'invoicing'),
119
+                                            'W'  => __('week', 'invoicing'),
120
+                                            'M'  => __('month', 'invoicing'),
121
+                                            'Y'  => __('year', 'invoicing'),
122 122
                                         )
123 123
                                     )
124 124
                                 );
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
                             <?php
131 131
 
132 132
                                 // Dynamic pricing.
133
-                                if( $item->supports_dynamic_pricing() ) {
133
+                                if ($item->supports_dynamic_pricing()) {
134 134
 
135
-                                    do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item );
135
+                                    do_action('wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item);
136 136
 
137 137
                                     // NYP toggle.
138 138
                                     echo aui()->input(
@@ -140,31 +140,31 @@  discard block
 block discarded – undo
140 140
                                             'id'          => 'wpinv_name_your_price',
141 141
                                             'name'        => 'wpinv_name_your_price',
142 142
                                             'type'        => 'checkbox',
143
-                                            'label'       => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ),
143
+                                            'label'       => apply_filters('wpinv_name_your_price_toggle_text', __('Let customers name their price', 'invoicing')),
144 144
                                             'value'       => '1',
145 145
                                             'checked'     => $item->user_can_set_their_price(),
146 146
                                             'no_wrap'     => true,
147 147
                                         )
148 148
                                     );
149 149
 
150
-                                    do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item );
150
+                                    do_action('wpinv_item_details_metabox_dynamic_pricing_checkbox', $item);
151 151
 
152 152
                                 }
153 153
 
154 154
                                 // Subscriptions.
155
-                                do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item );
155
+                                do_action('wpinv_item_details_metabox_before_subscription_checkbox', $item);
156 156
                                 echo aui()->input(
157 157
                                     array(
158 158
                                         'id'          => 'wpinv_is_recurring',
159 159
                                         'name'        => 'wpinv_is_recurring',
160 160
                                         'type'        => 'checkbox',
161
-                                        'label'       => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ),
161
+                                        'label'       => apply_filters('wpinv_is_recurring_toggle_text', __('Charge customers a recurring amount for this item', 'invoicing')),
162 162
                                         'value'       => '1',
163 163
                                         'checked'     => $item->is_recurring(),
164 164
                                         'no_wrap'     => true,
165 165
                                     )
166 166
                                 );
167
-                                do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item );
167
+                                do_action('wpinv_item_details_metabox_subscription_checkbox', $item);
168 168
 
169 169
                             ?>
170 170
                             <div class="wpinv_show_if_recurring">
@@ -174,30 +174,30 @@  discard block
 block discarded – undo
174 174
                     </div>
175 175
                 </div>
176 176
                 <div class="col-sm-1 pt-2 pl-0">
177
-                    <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e( 'Set the subscription price, billing interval and period.', 'invoicing' ); ?>"></span>
177
+                    <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e('Set the subscription price, billing interval and period.', 'invoicing'); ?>"></span>
178 178
                 </div>
179 179
             </div>
180
-            <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?>
180
+            <?php do_action('wpinv_item_details_metabox_after_price', $item); ?>
181 181
 
182
-            <?php if( $item->supports_dynamic_pricing() ) : ?>
183
-                <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?>
182
+            <?php if ($item->supports_dynamic_pricing()) : ?>
183
+                <?php do_action('wpinv_item_details_metabox_before_minimum_price', $item); ?>
184 184
                 <div class="wpinv_show_if_dynamic wpinv_minimum_price">
185 185
 
186 186
                     <div class="form-group row">
187 187
                         <label for="wpinv_minimum_price" class="col-sm-3 col-form-label">
188
-                            <?php _e( 'Minimum Price', 'invoicing' );?>
188
+                            <?php _e('Minimum Price', 'invoicing'); ?>
189 189
                         </label>
190 190
                         <div class="col-sm-8">
191 191
                             <div class="input-group input-group-sm">
192
-                                <?php if( 'left' == $position ) : ?>
192
+                                <?php if ('left' == $position) : ?>
193 193
                                     <div class="input-group-prepend">
194 194
                                         <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span>
195 195
                                     </div>
196 196
                                 <?php endif; ?>
197 197
 
198
-                                <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr( $item->get_minimum_price( 'edit' ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control">
198
+                                <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr($item->get_minimum_price('edit')); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control">
199 199
 
200
-                                <?php if( 'left' != $position ) : ?>
200
+                                <?php if ('left' != $position) : ?>
201 201
                                     <div class="input-group-append">
202 202
                                         <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span>
203 203
                                     </div>
@@ -206,45 +206,45 @@  discard block
 block discarded – undo
206 206
                         </div>
207 207
 
208 208
                         <div class="col-sm-1 pt-2 pl-0">
209
-                            <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the minimum amount that users are allowed to set', 'invoicing' ); ?>"></span>
209
+                            <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the minimum amount that users are allowed to set', 'invoicing'); ?>"></span>
210 210
                         </div>
211 211
                     </div>
212 212
 
213 213
                 </div>
214
-                <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?>
214
+                <?php do_action('wpinv_item_details_metabox_minimum_price', $item); ?>
215 215
             <?php endif; ?>
216 216
 
217
-            <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?>
217
+            <?php do_action('wpinv_item_details_metabox_before_maximum_renewals', $item); ?>
218 218
             <div class="wpinv_show_if_recurring wpinv_maximum_renewals">
219 219
 
220 220
                 <div class="form-group row">
221 221
                     <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label">
222
-                        <?php _e( 'Maximum Renewals', 'invoicing' );?>
222
+                        <?php _e('Maximum Renewals', 'invoicing'); ?>
223 223
                     </label>
224 224
                     <div class="col-sm-8">
225
-                        <input type="number" value="<?php echo esc_attr( $item->get_recurring_limit( 'edit' ) ); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" />
225
+                        <input type="number" value="<?php echo esc_attr($item->get_recurring_limit('edit')); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" />
226 226
                     </div>
227 227
                     <div class="col-sm-1 pt-2 pl-0">
228
-                        <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing' ); ?>"></span>
228
+                        <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing'); ?>"></span>
229 229
                     </div>
230 230
                 </div>
231 231
 
232 232
             </div>
233
-            <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?>
233
+            <?php do_action('wpinv_item_details_metabox_maximum_renewals', $item); ?>
234 234
 
235
-            <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?>
235
+            <?php do_action('wpinv_item_details_metabox_before_free_trial', $item); ?>
236 236
             <div class="wpinv_show_if_recurring wpinv_free_trial">
237 237
 
238 238
                 <div class="form-group row">
239
-                    <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php _e( 'Free Trial', 'invoicing' )?></label>
239
+                    <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php _e('Free Trial', 'invoicing')?></label>
240 240
 
241 241
                     <div class="col-sm-8">
242 242
                         <div class="row">
243 243
                             <div class="col-sm-6">
244
-                                <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0;?>
244
+                                <?php $value = $item->has_free_trial() ? $item->get_trial_interval('edit') : 0; ?>
245 245
 
246 246
                                 <div>
247
-                                    <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" >
247
+                                    <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr($value); ?>" >
248 248
                                 </div>
249 249
                             </div>
250 250
                             <div class="col-sm-6">
@@ -253,17 +253,17 @@  discard block
 block discarded – undo
253 253
                                         array(
254 254
                                             'id'               => 'wpinv_trial_period',
255 255
                                             'name'             => 'wpinv_trial_period',
256
-                                            'label'            => __( 'Trial Period', 'invoicing' ),
257
-                                            'placeholder'      => __( 'Trial Period', 'invoicing' ),
258
-                                            'value'            => $item->get_recurring_period( 'edit' ),
256
+                                            'label'            => __('Trial Period', 'invoicing'),
257
+                                            'placeholder'      => __('Trial Period', 'invoicing'),
258
+                                            'value'            => $item->get_recurring_period('edit'),
259 259
                                             'select2'          => true,
260 260
                                             'data-allow-clear' => 'false',
261 261
                                             'no_wrap'          => true,
262 262
                                             'options'          => array(
263
-                                                'D'  => __( 'day(s)', 'invoicing' ),
264
-                                                'W'  => __( 'week(s)', 'invoicing' ),
265
-                                                'M'  => __( 'month(s)', 'invoicing' ),
266
-                                                'Y'  => __( 'year(s)', 'invoicing' ),
263
+                                                'D'  => __('day(s)', 'invoicing'),
264
+                                                'W'  => __('week(s)', 'invoicing'),
265
+                                                'M'  => __('month(s)', 'invoicing'),
266
+                                                'Y'  => __('year(s)', 'invoicing'),
267 267
                                             )
268 268
                                         )
269 269
                                     );
@@ -274,15 +274,15 @@  discard block
 block discarded – undo
274 274
                     </div>
275 275
 
276 276
                     <div class="col-sm-1 pt-2 pl-0">
277
-                        <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'An optional period of time to wait before charging the first recurring payment.', 'invoicing' ); ?>"></span>
277
+                        <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('An optional period of time to wait before charging the first recurring payment.', 'invoicing'); ?>"></span>
278 278
                     </div>
279 279
 
280 280
                 </div>
281 281
 
282 282
             </div>
283
-            <?php do_action( 'wpinv_item_details_metabox__free_trial', $item ); ?>
283
+            <?php do_action('wpinv_item_details_metabox__free_trial', $item); ?>
284 284
 
285
-            <?php do_action( 'wpinv_item_details_metabox_item_details', $item ); ?>
285
+            <?php do_action('wpinv_item_details_metabox_item_details', $item); ?>
286 286
         </div>
287 287
         <?php
288 288
 
@@ -293,31 +293,31 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @param int $post_id
295 295
 	 */
296
-	public static function save( $post_id ) {
296
+	public static function save($post_id) {
297 297
 
298 298
         // Prepare the item.
299
-        $item = new WPInv_Item( $post_id );
299
+        $item = new WPInv_Item($post_id);
300 300
 
301 301
         // Load new data.
302 302
         $item->set_props(
303 303
 			array(
304
-				'price'                => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null,
305
-				'vat_rule'             => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null,
306
-				'vat_class'            => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null,
307
-				'type'                 => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null,
308
-				'is_dynamic_pricing'   => isset( $_POST['wpinv_name_your_price'] ),
309
-                'minimum_price'        => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null,
310
-				'is_recurring'         => isset( $_POST['wpinv_is_recurring'] ),
311
-				'recurring_period'     => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null,
312
-				'recurring_interval'   => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null,
313
-				'recurring_limit'      => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null,
314
-				'is_free_trial'        => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null,
315
-				'trial_period'         => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null,
316
-				'trial_interval'       => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null,
304
+				'price'                => isset($_POST['wpinv_item_price']) ? (float) $_POST['wpinv_item_price'] : null,
305
+				'vat_rule'             => isset($_POST['wpinv_vat_rules']) ? wpinv_clean($_POST['wpinv_vat_rules']) : null,
306
+				'vat_class'            => isset($_POST['wpinv_vat_class']) ? wpinv_clean($_POST['wpinv_vat_class']) : null,
307
+				'type'                 => isset($_POST['wpinv_item_type']) ? wpinv_clean($_POST['wpinv_item_type']) : null,
308
+				'is_dynamic_pricing'   => isset($_POST['wpinv_name_your_price']),
309
+                'minimum_price'        => isset($_POST['wpinv_minimum_price']) ? (float) $_POST['wpinv_minimum_price'] : null,
310
+				'is_recurring'         => isset($_POST['wpinv_is_recurring']),
311
+				'recurring_period'     => isset($_POST['wpinv_recurring_period']) ? wpinv_clean($_POST['wpinv_recurring_period']) : null,
312
+				'recurring_interval'   => isset($_POST['wpinv_recurring_interval']) ? (int) $_POST['wpinv_recurring_interval'] : null,
313
+				'recurring_limit'      => isset($_POST['wpinv_recurring_limit']) ? (int) $_POST['wpinv_recurring_limit'] : null,
314
+				'is_free_trial'        => isset($_POST['wpinv_trial_interval']) ? (0 != (int) $_POST['wpinv_trial_interval']) : null,
315
+				'trial_period'         => isset($_POST['wpinv_trial_period']) ? wpinv_clean($_POST['wpinv_trial_period']) : null,
316
+				'trial_interval'       => isset($_POST['wpinv_trial_interval']) ? (int) $_POST['wpinv_trial_interval'] : null,
317 317
 			)
318 318
         );
319 319
 
320 320
 		$item->save();
321
-		do_action( 'getpaid_item_metabox_save', $post_id, $item );
321
+		do_action('getpaid_item_metabox_save', $post_id, $item);
322 322
 	}
323 323
 }
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-address.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit; // Exit if accessed directly
11
+    exit; // Exit if accessed directly
12 12
 }
13 13
 
14 14
 /**
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 class GetPaid_Meta_Box_Invoice_Address {
18 18
 
19 19
     /**
20
-	 * Output the metabox.
21
-	 *
22
-	 * @param WP_Post $post
23
-	 */
20
+     * Output the metabox.
21
+     *
22
+     * @param WP_Post $post
23
+     */
24 24
     public static function output( $post ) {
25 25
 
26 26
         // Prepare the invoice.
@@ -300,18 +300,18 @@  discard block
 block discarded – undo
300 300
     }
301 301
 
302 302
     /**
303
-	 * Save meta box data.
304
-	 *
305
-	 * @param int $post_id
306
-	 */
307
-	public static function save( $post_id ) {
303
+     * Save meta box data.
304
+     *
305
+     * @param int $post_id
306
+     */
307
+    public static function save( $post_id ) {
308 308
 
309 309
         // Prepare the invoice.
310 310
         $invoice = new WPInv_Invoice( $post_id );
311 311
 
312 312
         // Load new data.
313 313
         $invoice->set_props(
314
-			array(
314
+            array(
315 315
                 'template'             => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null,
316 316
                 'email_cc'             => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null,
317 317
                 'disable_taxes'        => isset( $_POST['disable_taxes'] ),
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
                 'due_date'             => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null,
333 333
                 'number'               => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null,
334 334
                 'status'               => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null,
335
-			)
335
+            )
336 336
         );
337 337
 
338 338
         // Recalculate totals.
@@ -362,6 +362,6 @@  discard block
 block discarded – undo
362 362
         }
363 363
 
364 364
         // Fires after an invoice is saved.
365
-		do_action( 'wpinv_invoice_metabox_saved', $invoice );
366
-	}
365
+        do_action( 'wpinv_invoice_metabox_saved', $invoice );
366
+    }
367 367
 }
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the invoice.
27
-        $invoice = new WPInv_Invoice( $post );
27
+        $invoice = new WPInv_Invoice($post);
28 28
 
29
-        wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' );
29
+        wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce');
30 30
 
31 31
         ?>
32 32
 
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
                         <div class="col-12 col-sm-6">
43 43
                             <div id="getpaid-invoice-user-id-wrapper" class="form-group">
44 44
                                 <div>
45
-                                    <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label>
45
+                                    <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label>
46 46
                                 </div>
47 47
                                 <?php 
48 48
                                     wpinv_dropdown_users(
49 49
                                         array(
50 50
                                             'name'             => 'post_author_override',
51
-                                            'selected'         => $invoice->get_id() ? $invoice->get_user_id( 'edit' ) : get_current_user_id(),
51
+                                            'selected'         => $invoice->get_id() ? $invoice->get_user_id('edit') : get_current_user_id(),
52 52
                                             'include_selected' => true,
53 53
                                             'show'             => 'display_name_with_email',
54 54
                                             'orderby'          => 'user_email',
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                                             'type'        => 'text',
67 67
                                             'id'          => 'getpaid-invoice-new-user-email',
68 68
                                             'name'        => 'wpinv_email',
69
-                                            'label'       => __( 'Email', 'invoicing' ) . '<span class="required">*</span>',
69
+                                            'label'       => __('Email', 'invoicing') . '<span class="required">*</span>',
70 70
                                             'label_type'  => 'vertical',
71 71
                                             'placeholder' => '[email protected]',
72 72
                                             'class'       => 'form-control-sm',
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
                             </div>
77 77
                         </div>
78 78
                         <div class="col-12 col-sm-6 form-group mt-sm-4">
79
-                            <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?>
79
+                            <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?>
80 80
                                 <a id="getpaid-invoice-fill-user-details" class="button button-small button-secondary" href="javascript:void(0)">
81 81
                                     <i aria-hidden="true" class="fa fa-refresh"></i>
82
-                                    <?php _e( 'Fill User Details', 'invoicing' );?>
82
+                                    <?php _e('Fill User Details', 'invoicing'); ?>
83 83
                                 </a>
84 84
                                 <a id="getpaid-invoice-create-new-user-button" class="button button-small button-secondary" href="javascript:void(0)">
85 85
                                     <i aria-hidden="true" class="fa fa-plus"></i>
86
-                                    <?php _e( 'Add New User', 'invoicing' );?>
86
+                                    <?php _e('Add New User', 'invoicing'); ?>
87 87
                                 </a>
88 88
                                 <a id="getpaid-invoice-cancel-create-new-user" class="button button-small button-secondary d-none" href="javascript:void(0)">
89 89
                                     <i aria-hidden="true" class="fa fa-close"></i>
90
-                                    <?php _e( 'Cancel', 'invoicing' );?>
90
+                                    <?php _e('Cancel', 'invoicing'); ?>
91 91
                                 </a>
92 92
                             <?php endif; ?>
93 93
                         </div>
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
                                         'type'        => 'text',
101 101
                                         'id'          => 'wpinv_first_name',
102 102
                                         'name'        => 'wpinv_first_name',
103
-                                        'label'       => __( 'First Name', 'invoicing' ),
103
+                                        'label'       => __('First Name', 'invoicing'),
104 104
                                         'label_type'  => 'vertical',
105 105
                                         'placeholder' => 'Jane',
106 106
                                         'class'       => 'form-control-sm',
107
-                                        'value'       => $invoice->get_first_name( 'edit' ),
107
+                                        'value'       => $invoice->get_first_name('edit'),
108 108
                                     )
109 109
                                 );
110 110
                             ?>
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
                                         'type'        => 'text',
117 117
                                         'id'          => 'wpinv_last_name',
118 118
                                         'name'        => 'wpinv_last_name',
119
-                                        'label'       => __( 'Last Name', 'invoicing' ),
119
+                                        'label'       => __('Last Name', 'invoicing'),
120 120
                                         'label_type'  => 'vertical',
121 121
                                         'placeholder' => 'Doe',
122 122
                                         'class'       => 'form-control-sm',
123
-                                        'value'       => $invoice->get_last_name( 'edit' ),
123
+                                        'value'       => $invoice->get_last_name('edit'),
124 124
                                     )
125 125
                                 );
126 126
                             ?>
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
                                         'type'        => 'text',
136 136
                                         'id'          => 'wpinv_company',
137 137
                                         'name'        => 'wpinv_company',
138
-                                        'label'       => __( 'Company', 'invoicing' ),
138
+                                        'label'       => __('Company', 'invoicing'),
139 139
                                         'label_type'  => 'vertical',
140 140
                                         'placeholder' => 'Acme Corporation',
141 141
                                         'class'       => 'form-control-sm',
142
-                                        'value'       => $invoice->get_company( 'edit' ),
142
+                                        'value'       => $invoice->get_company('edit'),
143 143
                                     )
144 144
                                 );
145 145
                             ?>
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
                                         'type'        => 'text',
152 152
                                         'id'          => 'wpinv_vat_number',
153 153
                                         'name'        => 'wpinv_vat_number',
154
-                                        'label'       => __( 'Vat Number', 'invoicing' ),
154
+                                        'label'       => __('Vat Number', 'invoicing'),
155 155
                                         'label_type'  => 'vertical',
156 156
                                         'placeholder' => '1234567890',
157 157
                                         'class'       => 'form-control-sm',
158
-                                        'value'       => $invoice->get_vat_number( 'edit' ),
158
+                                        'value'       => $invoice->get_vat_number('edit'),
159 159
                                     )
160 160
                                 );
161 161
                             ?>
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
                                         'type'        => 'text',
171 171
                                         'id'          => 'wpinv_address',
172 172
                                         'name'        => 'wpinv_address',
173
-                                        'label'       => __( 'Address', 'invoicing' ),
173
+                                        'label'       => __('Address', 'invoicing'),
174 174
                                         'label_type'  => 'vertical',
175 175
                                         'placeholder' => 'Blekersdijk 295',
176 176
                                         'class'       => 'form-control-sm',
177
-                                        'value'       => $invoice->get_address( 'edit' ),
177
+                                        'value'       => $invoice->get_address('edit'),
178 178
                                     )
179 179
                                 );
180 180
                             ?>
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
                                         'type'        => 'text',
187 187
                                         'id'          => 'wpinv_city',
188 188
                                         'name'        => 'wpinv_city',
189
-                                        'label'       => __( 'City', 'invoicing' ),
189
+                                        'label'       => __('City', 'invoicing'),
190 190
                                         'label_type'  => 'vertical',
191 191
                                         'placeholder' => 'Dolembreux',
192 192
                                         'class'       => 'form-control-sm',
193
-                                        'value'       => $invoice->get_vat_number( 'edit' ),
193
+                                        'value'       => $invoice->get_vat_number('edit'),
194 194
                                     )
195 195
                                 );
196 196
                             ?>
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
                                     array(
205 205
                                         'id'          => 'wpinv_country',
206 206
                                         'name'        => 'wpinv_country',
207
-                                        'label'       => __( 'Country', 'invoicing' ),
207
+                                        'label'       => __('Country', 'invoicing'),
208 208
                                         'label_type'  => 'vertical',
209
-                                        'placeholder' => __( 'Choose a country', 'invoicing' ),
209
+                                        'placeholder' => __('Choose a country', 'invoicing'),
210 210
                                         'class'       => 'form-control-sm',
211
-                                        'value'       => $invoice->get_country( 'edit' ),
211
+                                        'value'       => $invoice->get_country('edit'),
212 212
                                         'options'     => wpinv_get_country_list(),
213 213
                                         'data-allow-clear' => 'false',
214 214
                                         'select2'          => true,
@@ -219,20 +219,20 @@  discard block
 block discarded – undo
219 219
                         <div class="col-12 col-sm-6">
220 220
                             <?php
221 221
 
222
-                                $states = wpinv_get_country_states( $invoice->get_country( 'edit' ) );
222
+                                $states = wpinv_get_country_states($invoice->get_country('edit'));
223 223
 
224
-                                if ( empty( $states ) ) {
224
+                                if (empty($states)) {
225 225
 
226 226
                                     echo aui()->input(
227 227
                                         array(
228 228
                                             'type'        => 'text',
229 229
                                             'id'          => 'wpinv_state',
230 230
                                             'name'        => 'wpinv_state',
231
-                                            'label'       => __( 'State', 'invoicing' ),
231
+                                            'label'       => __('State', 'invoicing'),
232 232
                                             'label_type'  => 'vertical',
233 233
                                             'placeholder' => 'Liège',
234 234
                                             'class'       => 'form-control-sm',
235
-                                            'value'       => $invoice->get_state( 'edit' ),
235
+                                            'value'       => $invoice->get_state('edit'),
236 236
                                         )
237 237
                                     );
238 238
 
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
                                         array(
243 243
                                             'id'          => 'wpinv_state',
244 244
                                             'name'        => 'wpinv_state',
245
-                                            'label'       => __( 'State', 'invoicing' ),
245
+                                            'label'       => __('State', 'invoicing'),
246 246
                                             'label_type'  => 'vertical',
247
-                                            'placeholder' => __( 'Select a state', 'invoicing' ),
247
+                                            'placeholder' => __('Select a state', 'invoicing'),
248 248
                                             'class'       => 'form-control-sm',
249
-                                            'value'       => $invoice->get_state( 'edit' ),
249
+                                            'value'       => $invoice->get_state('edit'),
250 250
                                             'options'     => $states,
251 251
                                             'data-allow-clear' => 'false',
252 252
                                             'select2'          => true,
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
                                         'type'        => 'text',
268 268
                                         'id'          => 'wpinv_zip',
269 269
                                         'name'        => 'wpinv_zip',
270
-                                        'label'       => __( 'Zip / Postal Code', 'invoicing' ),
270
+                                        'label'       => __('Zip / Postal Code', 'invoicing'),
271 271
                                         'label_type'  => 'vertical',
272 272
                                         'placeholder' => '4140',
273 273
                                         'class'       => 'form-control-sm',
274
-                                        'value'       => $invoice->get_zip( 'edit' ),
274
+                                        'value'       => $invoice->get_zip('edit'),
275 275
                                     )
276 276
                                 );
277 277
                             ?>
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
                                         'type'        => 'text',
284 284
                                         'id'          => 'wpinv_phone',
285 285
                                         'name'        => 'wpinv_phone',
286
-                                        'label'       => __( 'Phone', 'invoicing' ),
286
+                                        'label'       => __('Phone', 'invoicing'),
287 287
                                         'label_type'  => 'vertical',
288 288
                                         'placeholder' => '0493 18 45822',
289 289
                                         'class'       => 'form-control-sm',
290
-                                        'value'       => $invoice->get_phone( 'edit' ),
290
+                                        'value'       => $invoice->get_phone('edit'),
291 291
                                     )
292 292
                                 );
293 293
                             ?>
@@ -304,34 +304,34 @@  discard block
 block discarded – undo
304 304
 	 *
305 305
 	 * @param int $post_id
306 306
 	 */
307
-	public static function save( $post_id ) {
307
+	public static function save($post_id) {
308 308
 
309 309
         // Prepare the invoice.
310
-        $invoice = new WPInv_Invoice( $post_id );
310
+        $invoice = new WPInv_Invoice($post_id);
311 311
 
312 312
         // Load new data.
313 313
         $invoice->set_props(
314 314
 			array(
315
-                'template'             => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null,
316
-                'email_cc'             => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null,
317
-                'disable_taxes'        => isset( $_POST['disable_taxes'] ),
318
-                'currency'             => isset( $_POST['wpinv_currency'] ) ? wpinv_clean( $_POST['wpinv_currency'] ) : null,
319
-                'gateway'              => isset( $_POST['wpinv_gateway'] ) ? wpinv_clean( $_POST['wpinv_gateway'] ) : null,
320
-                'address'              => isset( $_POST['wpinv_address'] ) ? wpinv_clean( $_POST['wpinv_address'] ) : null,
321
-                'vat_number'           => isset( $_POST['wpinv_vat_number'] ) ? wpinv_clean( $_POST['wpinv_vat_number'] ) : null,
322
-                'company'              => isset( $_POST['wpinv_company'] ) ? wpinv_clean( $_POST['wpinv_company'] ) : null,
323
-                'zip'                  => isset( $_POST['wpinv_zip'] ) ? wpinv_clean( $_POST['wpinv_zip'] ) : null,
324
-                'state'                => isset( $_POST['wpinv_state'] ) ? wpinv_clean( $_POST['wpinv_state'] ) : null,
325
-                'city'                 => isset( $_POST['wpinv_city'] ) ? wpinv_clean( $_POST['wpinv_city'] ) : null,
326
-                'country'              => isset( $_POST['wpinv_country'] ) ? wpinv_clean( $_POST['wpinv_country'] ) : null,
327
-                'phone'                => isset( $_POST['wpinv_phone'] ) ? wpinv_clean( $_POST['wpinv_phone'] ) : null,
328
-                'first_name'           => isset( $_POST['wpinv_first_name'] ) ? wpinv_clean( $_POST['wpinv_first_name'] ) : null,
329
-                'last_name'            => isset( $_POST['wpinv_last_name'] ) ? wpinv_clean( $_POST['wpinv_last_name'] ) : null,
330
-                'author'               => isset( $_POST['post_author_override'] ) ? wpinv_clean( $_POST['post_author_override'] ) : null,
331
-                'date_created'         => isset( $_POST['date_created'] ) ? wpinv_clean( $_POST['date_created'] ) : null,
332
-                'due_date'             => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null,
333
-                'number'               => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null,
334
-                'status'               => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null,
315
+                'template'             => isset($_POST['wpinv_template']) ? wpinv_clean($_POST['wpinv_template']) : null,
316
+                'email_cc'             => isset($_POST['wpinv_cc']) ? wpinv_clean($_POST['wpinv_cc']) : null,
317
+                'disable_taxes'        => isset($_POST['disable_taxes']),
318
+                'currency'             => isset($_POST['wpinv_currency']) ? wpinv_clean($_POST['wpinv_currency']) : null,
319
+                'gateway'              => isset($_POST['wpinv_gateway']) ? wpinv_clean($_POST['wpinv_gateway']) : null,
320
+                'address'              => isset($_POST['wpinv_address']) ? wpinv_clean($_POST['wpinv_address']) : null,
321
+                'vat_number'           => isset($_POST['wpinv_vat_number']) ? wpinv_clean($_POST['wpinv_vat_number']) : null,
322
+                'company'              => isset($_POST['wpinv_company']) ? wpinv_clean($_POST['wpinv_company']) : null,
323
+                'zip'                  => isset($_POST['wpinv_zip']) ? wpinv_clean($_POST['wpinv_zip']) : null,
324
+                'state'                => isset($_POST['wpinv_state']) ? wpinv_clean($_POST['wpinv_state']) : null,
325
+                'city'                 => isset($_POST['wpinv_city']) ? wpinv_clean($_POST['wpinv_city']) : null,
326
+                'country'              => isset($_POST['wpinv_country']) ? wpinv_clean($_POST['wpinv_country']) : null,
327
+                'phone'                => isset($_POST['wpinv_phone']) ? wpinv_clean($_POST['wpinv_phone']) : null,
328
+                'first_name'           => isset($_POST['wpinv_first_name']) ? wpinv_clean($_POST['wpinv_first_name']) : null,
329
+                'last_name'            => isset($_POST['wpinv_last_name']) ? wpinv_clean($_POST['wpinv_last_name']) : null,
330
+                'author'               => isset($_POST['post_author_override']) ? wpinv_clean($_POST['post_author_override']) : null,
331
+                'date_created'         => isset($_POST['date_created']) ? wpinv_clean($_POST['date_created']) : null,
332
+                'due_date'             => isset($_POST['wpinv_due_date']) ? wpinv_clean($_POST['wpinv_due_date']) : null,
333
+                'number'               => isset($_POST['wpinv_number']) ? wpinv_clean($_POST['wpinv_number']) : null,
334
+                'status'               => isset($_POST['wpinv_status']) ? wpinv_clean($_POST['wpinv_status']) : null,
335 335
 			)
336 336
         );
337 337
 
@@ -339,17 +339,17 @@  discard block
 block discarded – undo
339 339
         $invoice->recalculate_total();
340 340
 
341 341
         // If we're creating a new user...
342
-        if ( ! empty( $_POST['wpinv_new_user'] ) && is_email( $_POST['wpinv_email'] ) ) {
342
+        if (!empty($_POST['wpinv_new_user']) && is_email($_POST['wpinv_email'])) {
343 343
 
344 344
             // Attempt to create the user.
345
-            $user = wpinv_create_user( sanitize_email( $_POST['wpinv_email'] ) );
345
+            $user = wpinv_create_user(sanitize_email($_POST['wpinv_email']));
346 346
 
347 347
 
348 348
             // If successful, update the invoice author.
349
-            if ( is_numeric( $user ) ) {
350
-                $invoice->set_author( $user );
349
+            if (is_numeric($user)) {
350
+                $invoice->set_author($user);
351 351
             } else {
352
-                wpinv_error_log( $user->get_error_message(), __( 'Invoice add new user', 'invoicing' ), __FILE__, __LINE__ );
352
+                wpinv_error_log($user->get_error_message(), __('Invoice add new user', 'invoicing'), __FILE__, __LINE__);
353 353
             }
354 354
         }
355 355
 
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
         $invoice->save();
358 358
 
359 359
         // (Maybe) send new user notification.
360
-        if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', true ) ) {
361
-            wp_send_new_user_notifications( $user, 'user' );
360
+        if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', true)) {
361
+            wp_send_new_user_notifications($user, 'user');
362 362
         }
363 363
 
364 364
         // Fires after an invoice is saved.
365
-		do_action( 'wpinv_invoice_metabox_saved', $invoice );
365
+		do_action('wpinv_invoice_metabox_saved', $invoice);
366 366
 	}
367 367
 }
Please login to merge, or discard this patch.
includes/admin/wpinv-admin-functions.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -56,69 +56,69 @@
 block discarded – undo
56 56
 }
57 57
 
58 58
 function wpinv_admin_messages() {
59
-	global $wpinv_options, $pagenow, $post;
59
+    global $wpinv_options, $pagenow, $post;
60 60
 
61
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
62
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
63
-	}
61
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
62
+            add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
63
+    }
64 64
 
65
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
66
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
67
-	}
65
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
66
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
67
+    }
68 68
 
69
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
70
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
71
-	}
69
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
70
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
71
+    }
72 72
 
73
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
74
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
75
-	}
73
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
74
+            add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
75
+    }
76 76
 
77
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
78
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
79
-	}
77
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
78
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
79
+    }
80 80
 
81
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
82
-		add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
83
-	}
81
+    if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
82
+        add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
83
+    }
84 84
 
85
-	if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
86
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' );
87
-	}
85
+    if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
86
+        add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' );
87
+    }
88 88
 
89
-	if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
90
-		add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
89
+    if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
90
+        add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
91 91
     }
92 92
     
93 93
     if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
94
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
94
+        add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
95 95
     }
96 96
 
97 97
     if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
98 98
         add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' );
99 99
     }
100 100
 
101
-	if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
102
-		add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
103
-	}
101
+    if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
102
+        add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
103
+    }
104 104
 
105
-	if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
106
-		add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
107
-	}
105
+    if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
106
+        add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
107
+    }
108 108
 
109
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
110
-		add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
111
-	}
109
+    if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
110
+        add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
111
+    }
112 112
     
113
-	if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
114
-		$message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
113
+    if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
114
+        $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
115 115
 
116
-		if ( !empty( $message ) ) {
117
-			add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
118
-		}
119
-	}
116
+        if ( !empty( $message ) ) {
117
+            add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
118
+        }
119
+    }
120 120
 
121
-	settings_errors( 'wpinv-notices' );
121
+    settings_errors( 'wpinv-notices' );
122 122
 }
123 123
 add_action( 'admin_notices', 'wpinv_admin_messages' );
124 124
 
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -7,127 +7,127 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14
-function wpinv_bulk_actions( $actions ) {
15
-    if ( isset( $actions['edit'] ) ) {
16
-        unset( $actions['edit'] );
14
+function wpinv_bulk_actions($actions) {
15
+    if (isset($actions['edit'])) {
16
+        unset($actions['edit']);
17 17
     }
18 18
 
19 19
     return $actions;
20 20
 }
21
-add_filter( 'bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions' );
22
-add_filter( 'bulk_actions-edit-wpi_item', 'wpinv_bulk_actions' );
21
+add_filter('bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions');
22
+add_filter('bulk_actions-edit-wpi_item', 'wpinv_bulk_actions');
23 23
 
24
-function wpinv_admin_post_id( $id = 0 ) {
24
+function wpinv_admin_post_id($id = 0) {
25 25
     global $post;
26 26
 
27
-    if ( isset( $id ) && ! empty( $id ) ) {
28
-        return (int)$id;
29
-    } else if ( get_the_ID() ) {
27
+    if (isset($id) && !empty($id)) {
28
+        return (int) $id;
29
+    } else if (get_the_ID()) {
30 30
         return (int) get_the_ID();
31
-    } else if ( isset( $post->ID ) && !empty( $post->ID ) ) {
31
+    } else if (isset($post->ID) && !empty($post->ID)) {
32 32
         return (int) $post->ID;
33
-    } else if ( isset( $_GET['post'] ) && !empty( $_GET['post'] ) ) {
33
+    } else if (isset($_GET['post']) && !empty($_GET['post'])) {
34 34
         return (int) $_GET['post'];
35
-    } else if ( isset( $_GET['id'] ) && !empty( $_GET['id'] ) ) {
35
+    } else if (isset($_GET['id']) && !empty($_GET['id'])) {
36 36
         return (int) $_GET['id'];
37
-    } else if ( isset( $_POST['id'] ) && !empty( $_POST['id'] ) ) {
37
+    } else if (isset($_POST['id']) && !empty($_POST['id'])) {
38 38
         return (int) $_POST['id'];
39 39
     } 
40 40
 
41 41
     return null;
42 42
 }
43 43
     
44
-function wpinv_admin_post_type( $id = 0 ) {
45
-    if ( !$id ) {
44
+function wpinv_admin_post_type($id = 0) {
45
+    if (!$id) {
46 46
         $id = wpinv_admin_post_id();
47 47
     }
48 48
     
49
-    $type = get_post_type( $id );
49
+    $type = get_post_type($id);
50 50
     
51
-    if ( !$type ) {
52
-        $type = isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) ? $_GET['post_type'] : null;
51
+    if (!$type) {
52
+        $type = isset($_GET['post_type']) && !empty($_GET['post_type']) ? $_GET['post_type'] : null;
53 53
     }
54 54
     
55
-    return apply_filters( 'wpinv_admin_post_type', $type, $id );
55
+    return apply_filters('wpinv_admin_post_type', $type, $id);
56 56
 }
57 57
 
58 58
 function wpinv_admin_messages() {
59 59
 	global $wpinv_options, $pagenow, $post;
60 60
 
61
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
62
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
61
+	if (isset($_GET['wpinv-message']) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
62
+		 add_settings_error('wpinv-notices', 'wpinv-discount-added', __('Discount code added.', 'invoicing'), 'updated');
63 63
 	}
64 64
 
65
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
66
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
65
+	if (isset($_GET['wpinv-message']) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
66
+		add_settings_error('wpinv-notices', 'wpinv-discount-add-fail', __('There was a problem adding your discount code, please try again.', 'invoicing'), 'error');
67 67
 	}
68 68
 
69
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
70
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
69
+	if (isset($_GET['wpinv-message']) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
70
+		add_settings_error('wpinv-notices', 'wpinv-discount-exists', __('A discount with that code already exists, please use a different code.', 'invoicing'), 'error');
71 71
 	}
72 72
 
73
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
74
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
73
+	if (isset($_GET['wpinv-message']) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
74
+		 add_settings_error('wpinv-notices', 'wpinv-discount-updated', __('Discount code updated.', 'invoicing'), 'updated');
75 75
 	}
76 76
 
77
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
78
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
77
+	if (isset($_GET['wpinv-message']) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
78
+		add_settings_error('wpinv-notices', 'wpinv-discount-updated-fail', __('There was a problem updating your discount code, please try again.', 'invoicing'), 'error');
79 79
 	}
80 80
 
81
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
82
-		add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
81
+	if (isset($_GET['wpinv-message']) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
82
+		add_settings_error('wpinv-notices', 'wpinv-deleted', __('The invoice has been deleted.', 'invoicing'), 'updated');
83 83
 	}
84 84
 
85
-	if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
86
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' );
85
+	if (isset($_GET['wpinv-message']) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
86
+		add_settings_error('wpinv-notices', 'wpinv-sent-fail', __('Email notification is disabled. Please check settings.', 'invoicing'), 'error');
87 87
 	}
88 88
 
89
-	if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
90
-		add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
89
+	if (isset($_GET['wpinv-message']) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
90
+		add_settings_error('wpinv-notices', 'wpinv-sent', __('The email has been sent to customer.', 'invoicing'), 'updated');
91 91
     }
92 92
     
93
-    if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
94
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
93
+    if (isset($_GET['wpinv-message']) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
94
+		add_settings_error('wpinv-notices', 'wpinv-sent-fail', __('Fail to send email to the customer.', 'invoicing'), 'error');
95 95
     }
96 96
 
97
-    if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
98
-        add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' );
97
+    if (isset($_GET['wpinv-message']) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
98
+        add_settings_error('wpinv-notices', 'wpinv-note-deleted', __('The invoice note has been deleted.', 'invoicing'), 'updated');
99 99
     }
100 100
 
101
-	if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
102
-		add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
101
+	if (isset($_GET['wpinv-message']) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
102
+		add_settings_error('wpinv-notices', 'wpinv-settings-imported', __('The settings have been imported.', 'invoicing'), 'updated');
103 103
 	}
104 104
 
105
-	if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
106
-		add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
105
+	if (isset($_GET['wpinv-message']) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
106
+		add_settings_error('wpinv-notices', 'wpinv-note-added', __('The invoice note has been added successfully.', 'invoicing'), 'updated');
107 107
 	}
108 108
 
109
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) {
110
-		add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
109
+	if (isset($_GET['wpinv-message']) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) {
110
+		add_settings_error('wpinv-notices', 'wpinv-updated', __('The invoice has been successfully updated.', 'invoicing'), 'updated');
111 111
 	}
112 112
     
113
-	if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
114
-		$message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
113
+	if ($pagenow == 'post.php' && !empty($post->post_type) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable($post)) {
114
+		$message = apply_filters('wpinv_item_non_editable_message', __('This item in not editable.', 'invoicing'), $post->ID);
115 115
 
116
-		if ( !empty( $message ) ) {
117
-			add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
116
+		if (!empty($message)) {
117
+			add_settings_error('wpinv-notices', 'wpinv-edit-n', $message, 'updated');
118 118
 		}
119 119
 	}
120 120
 
121
-	settings_errors( 'wpinv-notices' );
121
+	settings_errors('wpinv-notices');
122 122
 }
123
-add_action( 'admin_notices', 'wpinv_admin_messages' );
123
+add_action('admin_notices', 'wpinv_admin_messages');
124 124
 
125
-add_action( 'admin_init', 'wpinv_show_test_payment_gateway_notice' );
126
-function wpinv_show_test_payment_gateway_notice(){
127
-    add_action( 'admin_notices', 'wpinv_test_payment_gateway_messages' );
125
+add_action('admin_init', 'wpinv_show_test_payment_gateway_notice');
126
+function wpinv_show_test_payment_gateway_notice() {
127
+    add_action('admin_notices', 'wpinv_test_payment_gateway_messages');
128 128
 }
129 129
 
130
-function wpinv_test_payment_gateway_messages(){
130
+function wpinv_test_payment_gateway_messages() {
131 131
     $gateways = wpinv_get_enabled_payment_gateways();
132 132
     $name = array(); $test_gateways = '';
133 133
     if ($gateways) {
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
         }
139 139
         $test_gateways = implode(', ', $name);
140 140
     }
141
-    if(isset($test_gateways) && !empty($test_gateways)){
141
+    if (isset($test_gateways) && !empty($test_gateways)) {
142 142
         $link = admin_url('admin.php?page=wpinv-settings&tab=gateways');
143
-        $notice = wp_sprintf( __('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link );
143
+        $notice = wp_sprintf(__('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link);
144 144
         ?>
145 145
         <div class="notice notice-warning is-dismissible">
146 146
             <p><?php echo $notice; ?></p>
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
     }
150 150
 }
151 151
 
152
-function wpinv_send_invoice_after_save( $invoice ) {
153
-    if ( empty( $_POST['wpi_save_send'] ) ) {
152
+function wpinv_send_invoice_after_save($invoice) {
153
+    if (empty($_POST['wpi_save_send'])) {
154 154
         return;
155 155
     }
156 156
     
157
-    if ( !empty( $invoice->ID ) && !empty( $invoice->post_type ) && 'wpi_invoice' == $invoice->post_type ) {
158
-        wpinv_user_invoice_notification( $invoice->ID );
157
+    if (!empty($invoice->ID) && !empty($invoice->post_type) && 'wpi_invoice' == $invoice->post_type) {
158
+        wpinv_user_invoice_notification($invoice->ID);
159 159
     }
160 160
 }
161
-add_action( 'wpinv_invoice_metabox_saved', 'wpinv_send_invoice_after_save', 100, 1 );
161
+add_action('wpinv_invoice_metabox_saved', 'wpinv_send_invoice_after_save', 100, 1);
162 162
 
163 163
 
164 164
 add_action('admin_init', 'admin_init_example_type');
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 function admin_init_example_type() {
170 170
     global $typenow;
171 171
 
172
-    if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote' ) {
172
+    if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote') {
173 173
         add_filter('posts_search', 'posts_search_example_type', 10, 2);
174 174
     }
175 175
 }
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
     global $wpdb;
185 185
 
186 186
     if ($query->is_main_query() && !empty($query->query['s'])) {
187
-        $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql( $query->query['s'] ) . "%' )";
188
-        if ( ! empty( $search ) ) {
189
-            $search = preg_replace( '/^ AND /', '', $search );
187
+        $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql($query->query['s']) . "%' )";
188
+        if (!empty($search)) {
189
+            $search = preg_replace('/^ AND /', '', $search);
190 190
             $search = " AND ( {$search} OR ( {$conditions_str} ) )";
191 191
         } else {
192 192
             $search = " AND ( {$conditions_str} )";
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
     return $search;
197 197
 }
198 198
 
199
-add_action( 'admin_init', 'wpinv_reset_invoice_count' );
200
-function wpinv_reset_invoice_count(){
201
-    if(isset($_GET['reset_invoice_count']) && 1 == $_GET['reset_invoice_count'] && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) {
199
+add_action('admin_init', 'wpinv_reset_invoice_count');
200
+function wpinv_reset_invoice_count() {
201
+    if (isset($_GET['reset_invoice_count']) && 1 == $_GET['reset_invoice_count'] && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) {
202 202
         wpinv_update_option('invoice_sequence_start', 1);
203 203
         delete_option('wpinv_last_invoice_number');
204 204
         $url = add_query_arg(array('reset_invoice_done' => 1));
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 }
210 210
 
211 211
 add_action('admin_notices', 'wpinv_invoice_count_reset_message');
212
-function wpinv_invoice_count_reset_message(){
213
-    if(isset($_GET['reset_invoice_done']) && 1 == $_GET['reset_invoice_done']) {
212
+function wpinv_invoice_count_reset_message() {
213
+    if (isset($_GET['reset_invoice_done']) && 1 == $_GET['reset_invoice_done']) {
214 214
         $notice = __('Invoice number sequence reset successfully.', 'invoicing');
215 215
         ?>
216 216
         <div class="notice notice-success is-dismissible">
Please login to merge, or discard this patch.
templates/invoice/footer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14 14
     <div class="border-top pt-4 bg-white">
15 15
         <div class="container pr-0 pl-0">
16 16
 
17
-            <?php if ( $term_text = wpinv_get_terms_text() ) : ?>
17
+            <?php if ($term_text = wpinv_get_terms_text()) : ?>
18 18
                 <div class="terms-text">
19
-                    <?php echo wpautop( $term_text ); ?>
19
+                    <?php echo wpautop($term_text); ?>
20 20
                 </div>
21 21
             <?php endif; ?>
22 22
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             </div>
26 26
 
27 27
             <div class="print-only">
28
-                <?php _e( 'Page ', 'invoicing' ) ?> {PAGENO}/{nbpg}
28
+                <?php _e('Page ', 'invoicing') ?> {PAGENO}/{nbpg}
29 29
             </div>
30 30
 
31 31
         </div>
Please login to merge, or discard this patch.
templates/invoice/billing-address.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$invoice     = new WPInv_Invoice( $invoice );
13
-$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() );
12
+$invoice     = new WPInv_Invoice($invoice);
13
+$address_row = wpinv_get_invoice_address_markup($invoice->get_user_info());
14 14
 $phone       = $invoice->get_phone();
15 15
 $email       = $invoice->get_email();
16 16
 
@@ -21,36 +21,36 @@  discard block
 block discarded – undo
21 21
 
22 22
 
23 23
             <div class="invoice-billing-address-label col-2">
24
-                <strong><?php _e( 'To:', 'invoicing' ) ?></strong>
24
+                <strong><?php _e('To:', 'invoicing') ?></strong>
25 25
             </div>
26 26
 
27 27
 
28 28
             <div class="invoice-billing-address-value col-10">
29 29
 
30
-                <?php do_action( 'getpaid_billing_address_top' ); ?>
30
+                <?php do_action('getpaid_billing_address_top'); ?>
31 31
 
32
-                <?php if ( ! empty( $address_row ) ) : ?>
32
+                <?php if (!empty($address_row)) : ?>
33 33
                     <div class="billing-address">
34 34
                         <?php echo $address_row; ?>
35 35
                     </div>
36 36
                 <?php endif; ?>
37 37
 
38 38
 
39
-                <?php if ( ! empty( $phone ) ) : ?>
39
+                <?php if (!empty($phone)) : ?>
40 40
                     <div class="billing-phone">
41
-                        <?php echo wp_sprintf( __( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?>
41
+                        <?php echo wp_sprintf(__('Phone: %s', 'invoicing'), esc_html($phone)); ?>
42 42
                     </div>
43 43
                 <?php endif; ?>
44 44
 
45 45
 
46
-                <?php if ( ! empty( $email ) ) : ?>
46
+                <?php if (!empty($email)) : ?>
47 47
                     <div class="billing-email">
48
-                        <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), sanitize_email( $email ) ); ?>
48
+                        <?php echo wp_sprintf(__('Email: %s', 'invoicing'), sanitize_email($email)); ?>
49 49
                     </div>
50 50
                 <?php endif; ?>
51 51
 
52 52
 
53
-                <?php do_action( 'getpaid_billing_address_bottom' ); ?>
53
+                <?php do_action('getpaid_billing_address_bottom'); ?>
54 54
 
55 55
             </div>
56 56
 
Please login to merge, or discard this patch.
templates/invoice/header.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
             <div class="row">
17 17
 
18 18
                 <div class="col-12 col-sm-6 text-left pl-0">
19
-                    <?php do_action( 'getpaid_invoice_header_left', $invoice );?>
19
+                    <?php do_action('getpaid_invoice_header_left', $invoice); ?>
20 20
                 </div>
21 21
 
22 22
                 <div class="col-12 col-sm-6 text-right pr-0">
23
-                    <?php do_action( 'getpaid_invoice_header_right', $invoice );?>
23
+                    <?php do_action('getpaid_invoice_header_right', $invoice); ?>
24 24
                 </div>
25 25
 
26 26
             </div>
Please login to merge, or discard this patch.
templates/invoice/details.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14
-        <?php do_action( 'getpaid_before_invoice_details_main', $invoice ); ?>
14
+        <?php do_action('getpaid_before_invoice_details_main', $invoice); ?>
15 15
 
16 16
         <div class="getpaid-invoice-details mt-3 mb-3">
17 17
             <div class="row">
18 18
 
19 19
                 <div class="col-12 col-sm-6">
20
-                    <?php do_action( 'getpaid_invoice_details_left', $invoice ); ?>
20
+                    <?php do_action('getpaid_invoice_details_left', $invoice); ?>
21 21
                 </div>
22 22
 
23 23
                 <div class="col-12 col-sm-6">
24
-                    <?php do_action( 'getpaid_invoice_details_right', $invoice ); ?>
24
+                    <?php do_action('getpaid_invoice_details_right', $invoice); ?>
25 25
                 </div>
26 26
 
27 27
             </div>
28 28
         </div>
29 29
 
30
-        <?php do_action( 'getpaid_after_invoice_details_main', $invoice ); ?>
30
+        <?php do_action('getpaid_after_invoice_details_main', $invoice); ?>
31 31
 
32 32
 <?php
Please login to merge, or discard this patch.
templates/wpinv-invoice-print.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Fetch the invoice.
13
-$invoice = new WPInv_Invoice( $GLOBALS['post'] );
13
+$invoice = new WPInv_Invoice($GLOBALS['post']);
14 14
 
15 15
 // Abort if it does not exist.
16
-if ( $invoice->get_id() == 0 ) {
16
+if ($invoice->get_id() == 0) {
17 17
     exit;
18 18
 }
19 19
 
20 20
 // Fires before printing an invoice.
21
-do_action( 'wpinv_invoice_print_before_display', $invoice );
21
+do_action('wpinv_invoice_print_before_display', $invoice);
22 22
 
23 23
 ?><!DOCTYPE html>
24 24
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     <head>
29 29
 
30
-		<meta charset="<?php bloginfo( 'charset' ); ?>">
30
+		<meta charset="<?php bloginfo('charset'); ?>">
31 31
         <meta name="viewport" content="width=device-width, initial-scale=1.0" >
32 32
 
33 33
         <meta name="robots" content="noindex,nofollow">
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 
37 37
         <title><?php wp_title() ?></title>
38 38
 
39
-        <?php do_action( 'wpinv_invoice_print_head', $invoice ); ?>
39
+        <?php do_action('wpinv_invoice_print_head', $invoice); ?>
40 40
 
41 41
     </head>
42 42
     
43 43
 
44 44
     <body class="body wpinv wpinv-print">
45 45
 
46
-        <?php do_action( 'getpaid_invoice', $invoice ); ?>
47
-        <?php do_action( 'wpinv_invoice_print_body_end', $invoice ); ?>
46
+        <?php do_action('getpaid_invoice', $invoice); ?>
47
+        <?php do_action('wpinv_invoice_print_body_end', $invoice); ?>
48 48
 
49 49
     </body>
50 50
 
Please login to merge, or discard this patch.
templates/payment-forms/elements/total_payable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-if ( empty( $text ) ) {
13
-    $text = __( 'Total to pay:', 'invoicing' );
12
+if (empty($text)) {
13
+    $text = __('Total to pay:', 'invoicing');
14 14
 }
15 15
 ?>
16 16
 <div class="form-group mt-4">
17
-    <strong><?php echo sanitize_text_field( $text ); ?></strong>
17
+    <strong><?php echo sanitize_text_field($text); ?></strong>
18 18
     <span class="getpaid-checkout-total-payable"></span>
19 19
 </div>
Please login to merge, or discard this patch.