Passed
Push — master ( ee569f...d98642 )
by Brian
05:03
created
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-items.php 1 patch
Spacing   +155 added lines, -155 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
 
@@ -16,82 +16,82 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class GetPaid_Meta_Box_Invoice_Items {
18 18
 
19
-    public static function get_columns( $invoice ) {
19
+    public static function get_columns($invoice) {
20 20
         $use_taxes          = $invoice->is_taxable() && wpinv_use_taxes();
21 21
         $columns            = array(
22
-            'id'     => __( 'ID', 'invoicing' ),
23
-            'title'  => __( 'Item', 'invoicing' ),
22
+            'id'     => __('ID', 'invoicing'),
23
+            'title'  => __('Item', 'invoicing'),
24 24
             'price'  => sprintf(
25 25
                 '<span class="getpaid-hide-if-hours getpaid-hide-if-quantity">%s</span>
26 26
                 <span class="getpaid-hide-if-hours hide-if-amount">%s</span>
27 27
                 <span class="getpaid-hide-if-quantity hide-if-amount">%s</span>',
28
-                __( 'Amount', 'invoicing' ),
29
-                __( 'Price', 'invoicing' ),
30
-                __( 'Rate', 'invoicing' )
28
+                __('Amount', 'invoicing'),
29
+                __('Price', 'invoicing'),
30
+                __('Rate', 'invoicing')
31 31
             ),
32 32
             'qty'    => sprintf(
33 33
                 '<span class="getpaid-hide-if-hours">%s</span><span class="getpaid-hide-if-quantity">%s</span>',
34
-                __( 'Quantity', 'invoicing' ),
35
-                __( 'Hours', 'invoicing' )
34
+                __('Quantity', 'invoicing'),
35
+                __('Hours', 'invoicing')
36 36
             ),
37
-            'total'  => __( 'Total', 'invoicing' ),
38
-            'tax'    => __( 'Tax (%)', 'invoicing' ),
37
+            'total'  => __('Total', 'invoicing'),
38
+            'tax'    => __('Tax (%)', 'invoicing'),
39 39
             'action' => '',
40 40
         );
41 41
 
42
-        if ( ! $use_taxes ) {
43
-            unset( $columns['tax'] );
42
+        if (!$use_taxes) {
43
+            unset($columns['tax']);
44 44
         }
45 45
 
46 46
         return $columns;
47 47
     }
48 48
 
49
-    public static function output( $post, $invoice = false ) {
49
+    public static function output($post, $invoice = false) {
50 50
 
51
-        if ( apply_filters( 'getpaid_use_new_invoice_items_metabox', false ) ) {
52
-            return self::output2( $post );
51
+        if (apply_filters('getpaid_use_new_invoice_items_metabox', false)) {
52
+            return self::output2($post);
53 53
         }
54 54
 
55
-        $post_id            = !empty( $post->ID ) ? $post->ID : 0;
56
-        $invoice            = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice( $post_id );
55
+        $post_id            = !empty($post->ID) ? $post->ID : 0;
56
+        $invoice            = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice($post_id);
57 57
         $use_taxes          = $invoice->is_taxable() && wpinv_use_taxes();
58
-        $item_types         = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post );
59
-        $columns            = self::get_columns( $invoice );
60
-        $cols               = count( $columns );
58
+        $item_types         = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post);
59
+        $columns            = self::get_columns($invoice);
60
+        $cols               = count($columns);
61 61
         $class              = '';
62 62
 
63
-        unset( $item_types['adv'] );
64
-        unset( $item_types['package'] );
63
+        unset($item_types['adv']);
64
+        unset($item_types['package']);
65 65
 
66
-        if ( $invoice->is_paid() ) {
66
+        if ($invoice->is_paid()) {
67 67
             $class .= ' wpinv-paid';
68 68
         }
69 69
 
70
-        if ( $invoice->is_refunded() ) {
70
+        if ($invoice->is_refunded()) {
71 71
             $class .= ' wpinv-refunded';
72 72
         }
73 73
 
74
-        if ( $invoice->is_recurring() ) {
74
+        if ($invoice->is_recurring()) {
75 75
             $class .= ' wpi-recurring';
76 76
         }
77 77
 
78 78
     ?>
79 79
 
80
-        <div class="wpinv-items-wrap<?php echo esc_attr( $class ); ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr( $invoice->get_status() ); ?>">
80
+        <div class="wpinv-items-wrap<?php echo esc_attr($class); ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr($invoice->get_status()); ?>">
81 81
             <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0">
82 82
 
83 83
                 <thead>
84 84
                     <tr>
85
-                        <?php foreach ( $columns as $key => $label ) : ?>
86
-                            <th class="<?php echo esc_attr( $key ); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post( $label ); ?></th>
85
+                        <?php foreach ($columns as $key => $label) : ?>
86
+                            <th class="<?php echo esc_attr($key); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post($label); ?></th>
87 87
                         <?php endforeach; ?>
88 88
                     </tr>
89 89
                 </thead>
90 90
 
91 91
                 <tbody class="wpinv-line-items">
92 92
                     <?php
93
-                        foreach ( $invoice->get_items() as $int => $item ) {
94
-                            self::output_row( $columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd' );
93
+                        foreach ($invoice->get_items() as $int => $item) {
94
+                            self::output_row($columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd');
95 95
                         }
96 96
                     ?>
97 97
                 </tbody>
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                                             <div class="wp-clearfix">
109 109
                                                 <label class="wpi-item-name">
110 110
                                                     <span class="input-text-wrap">
111
-                                                        <input type="text" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' );?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]">
111
+                                                        <input type="text" style="width: 100%" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]">
112 112
                                                     </span>
113 113
                                                 </label>
114 114
                                             </div>
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
                                             <div class="wp-clearfix">
117 117
                                                 <label class="wpi-item-price">
118 118
                                                     <span class="input-text-wrap">
119
-                                                    <input type="text" style="width: 200px" placeholder="<?php esc_attr_e( 'Item Price', 'invoicing' );?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]">
120
-                                                        &times; <input type="text" style="width: 140px" placeholder="<?php esc_attr_e( 'Item Quantity', 'invoicing' );?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]">
119
+                                                    <input type="text" style="width: 200px" placeholder="<?php esc_attr_e('Item Price', 'invoicing'); ?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]">
120
+                                                        &times; <input type="text" style="width: 140px" placeholder="<?php esc_attr_e('Item Quantity', 'invoicing'); ?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]">
121 121
                                                     </span>
122 122
                                                 </label>
123 123
                                             </div>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                                             <div class="wp-clearfix">
126 126
                                                 <label class="wpi-item-name">
127 127
                                                     <span class="input-text-wrap">
128
-                                                        <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Description', 'invoicing' );?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea>
128
+                                                        <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e('Item Description', 'invoicing'); ?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea>
129 129
                                                     </span>
130 130
                                                 </label>
131 131
                                             </div>
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                                             <div class="wp-clearfix">
134 134
                                                 <label class="wpi-item-type">
135 135
                                                     <span class="input-text-wrap">
136
-                                                        <?php wpinv_html_select( array(
136
+                                                        <?php wpinv_html_select(array(
137 137
                                                             'options'          => $item_types,
138 138
                                                             'name'             => '_wpinv_quick[type]',
139 139
                                                             'id'               => '_wpinv_quick_type',
@@ -141,19 +141,19 @@  discard block
 block discarded – undo
141 141
                                                             'show_option_all'  => false,
142 142
                                                             'show_option_none' => false,
143 143
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-type',
144
-                                                        ) ); ?>
144
+                                                        )); ?>
145 145
                                                     </span>
146 146
                                                 </label>
147 147
                                             </div>
148 148
 
149
-                                            <?php if ( $use_taxes ) : ?>
149
+                                            <?php if ($use_taxes) : ?>
150 150
                                                 <div class="wp-clearfix">
151 151
                                                     <label class="wpi-vat-rule">
152 152
                                                         <span class="input-text-wrap">
153 153
                                                             <?php
154
-                                                                wpinv_html_select( array(
154
+                                                                wpinv_html_select(array(
155 155
                                                                     'options'          => array_merge(
156
-                                                                        array( '' => __( 'Select VAT Rule', 'invoicing' ) ),
156
+                                                                        array('' => __('Select VAT Rule', 'invoicing')),
157 157
                                                                         getpaid_get_tax_rules()
158 158
                                                                     ),
159 159
                                                                     'name'             => '_wpinv_quick[vat_rule]',
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                                                                     'show_option_none' => false,
163 163
                                                                     'class'            => 'gdmbx2-text-medium wpinv-quick-vat-rule',
164 164
                                                                     'selected'         => 'digital',
165
-                                                                ) );
165
+                                                                ));
166 166
                                                             ?>
167 167
                                                         </span>
168 168
                                                     </label>
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
                                                     <label class="wpi-vat-class">
172 172
                                                         <span class="input-text-wrap">
173 173
                                                             <?php
174
-                                                                wpinv_html_select( array(
174
+                                                                wpinv_html_select(array(
175 175
                                                                     'options'          => array_merge(
176
-                                                                        array( '' => __( 'Select VAT Class', 'invoicing' ) ),
176
+                                                                        array('' => __('Select VAT Class', 'invoicing')),
177 177
                                                                         getpaid_get_tax_classes()
178 178
                                                                     ),
179 179
                                                                     'name'             => '_wpinv_quick[vat_class]',
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
                                                                     'show_option_none' => false,
183 183
                                                                     'class'            => 'gdmbx2-text-medium wpinv-quick-vat-class',
184 184
                                                                     'selected'         => '_standard',
185
-                                                                ) );
185
+                                                                ));
186 186
                                                             ?>
187 187
                                                         </span>
188 188
                                                     </label>
@@ -203,29 +203,29 @@  discard block
 block discarded – undo
203 203
                         </td>
204 204
                     </tr>
205 205
                     <tr class="totals">
206
-                        <td colspan="<?php echo ( (int) $cols - 4 ); ?>"></td>
206
+                        <td colspan="<?php echo ((int) $cols - 4); ?>"></td>
207 207
                         <td colspan="4">
208 208
                             <table cellspacing="0" cellpadding="0">
209 209
                                 <tr class="subtotal">
210
-                                    <td class="name"><?php esc_html_e( 'Sub Total:', 'invoicing' );?></td>
211
-                                    <td class="total"><?php wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() );?></td>
210
+                                    <td class="name"><?php esc_html_e('Sub Total:', 'invoicing'); ?></td>
211
+                                    <td class="total"><?php wpinv_the_price($invoice->get_subtotal(), $invoice->get_currency()); ?></td>
212 212
                                     <td class="action"></td>
213 213
                                 </tr>
214 214
                                 <tr class="discount">
215
-                                    <td class="name"><?php esc_html_e( 'Discount:', 'invoicing' ) ; ?></td>
216
-                                    <td class="total"><?php wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() );?></td>
215
+                                    <td class="name"><?php esc_html_e('Discount:', 'invoicing'); ?></td>
216
+                                    <td class="total"><?php wpinv_the_price($invoice->get_total_discount(), $invoice->get_currency()); ?></td>
217 217
                                     <td class="action"></td>
218 218
                                 </tr>
219
-                                <?php if ( $use_taxes ) : ?>
219
+                                <?php if ($use_taxes) : ?>
220 220
                                 <tr class="tax">
221
-                                    <td class="name"><?php esc_html_e( 'Tax:', 'invoicing' );?></td>
222
-                                    <td class="total"><?php wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() );?></td>
221
+                                    <td class="name"><?php esc_html_e('Tax:', 'invoicing'); ?></td>
222
+                                    <td class="total"><?php wpinv_the_price($invoice->get_total_tax(), $invoice->get_currency()); ?></td>
223 223
                                     <td class="action"></td>
224 224
                                 </tr>
225 225
                                 <?php endif; ?>
226 226
                                 <tr class="total">
227
-                                    <td class="name"><?php esc_html_e( 'Total:', 'invoicing' );?></td>
228
-                                    <td class="total"><?php wpinv_the_price( $invoice->get_total(), $invoice->get_currency() );?></td>
227
+                                    <td class="name"><?php esc_html_e('Total:', 'invoicing'); ?></td>
228
+                                    <td class="total"><?php wpinv_the_price($invoice->get_total(), $invoice->get_currency()); ?></td>
229 229
                                     <td class="action"></td>
230 230
                                 </tr>
231 231
                             </table>
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             </table>
237 237
             <div class="wpinv-actions">
238 238
                 <?php
239
-                    if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
239
+                    if (!$invoice->is_paid() && !$invoice->is_refunded()) {
240 240
                         wpinv_item_dropdown(
241 241
                             array(
242 242
                                 'name'             => 'wpinv_invoice_item',
@@ -246,61 +246,61 @@  discard block
 block discarded – undo
246 246
                             )
247 247
                         );
248 248
 
249
-                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-add-item">' . sprintf( esc_html__( 'Add item to %s', 'invoicing' ), esc_html( $invoice->get_label() ) ) . '</button>';
250
-                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__( 'Create new item', 'invoicing' ) . '</button>';
251
-                        echo "&nbsp;" . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__( 'Recalculate Totals', 'invoicing' ) . '</button>';
249
+                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-add-item">' . sprintf(esc_html__('Add item to %s', 'invoicing'), esc_html($invoice->get_label())) . '</button>';
250
+                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__('Create new item', 'invoicing') . '</button>';
251
+                        echo "&nbsp;" . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__('Recalculate Totals', 'invoicing') . '</button>';
252 252
 
253 253
                     }
254 254
                 ?>
255
-                <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?>
255
+                <?php do_action('wpinv_invoice_items_actions', $invoice); ?>
256 256
             </div>
257 257
         </div>
258 258
         <?php
259 259
     }
260 260
 
261
-    public static function output_row( $columns, $item, $invoice, $class='even' ) {
261
+    public static function output_row($columns, $item, $invoice, $class = 'even') {
262 262
 
263 263
     ?>
264
-        <tr class="item item-<?php echo esc_attr( $class ); ?>" data-item-id="<?php echo esc_attr( $item->get_id() ); ?>">
265
-            <?php foreach ( array_keys( $columns ) as $column ) : ?>
266
-                <td class="<?php echo esc_attr( $column ); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>">
264
+        <tr class="item item-<?php echo esc_attr($class); ?>" data-item-id="<?php echo esc_attr($item->get_id()); ?>">
265
+            <?php foreach (array_keys($columns) as $column) : ?>
266
+                <td class="<?php echo esc_attr($column); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>">
267 267
                     <?php
268
-                        switch ( $column ) {
268
+                        switch ($column) {
269 269
                             case 'id':
270 270
                                 echo (int) $item->get_id();
271 271
                                 break;
272 272
                             case 'title':
273 273
                                 printf(
274 274
                                     '<a href="%s" target="_blank">%s</a>',
275
-                                    esc_url( get_edit_post_link( $item->get_id() ) ),
276
-                                    esc_html( $item->get_raw_name() )
275
+                                    esc_url(get_edit_post_link($item->get_id())),
276
+                                    esc_html($item->get_raw_name())
277 277
                                 );
278 278
 
279
-                                $summary = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice );
280
-                                if ( $summary !== '' ) {
279
+                                $summary = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice);
280
+                                if ($summary !== '') {
281 281
                                     printf(
282 282
                                         '<span class="meta">%s</span>',
283
-                                        wp_kses_post( wpautop( $summary ) )
283
+                                        wp_kses_post(wpautop($summary))
284 284
                                     );
285 285
                                 }
286 286
 
287 287
                                 printf(
288 288
                                     '<input type="hidden" value="%s" name="getpaid_items[%s][name]" class="getpaid-recalculate-prices-on-change" />',
289
-                                    esc_attr( $item->get_raw_name() ),
289
+                                    esc_attr($item->get_raw_name()),
290 290
                                     (int) $item->get_id()
291 291
                                 );
292 292
 
293 293
                                 printf(
294 294
                                     '<textarea style="display: none;" name="getpaid_items[%s][description]" class="getpaid-recalculate-prices-on-change">%s</textarea>',
295 295
                                     (int) $item->get_id(),
296
-                                    esc_attr( $item->get_description() )
296
+                                    esc_attr($item->get_description())
297 297
                                 );
298 298
 
299 299
                                 break;
300 300
                             case 'price':
301 301
                                 printf(
302 302
                                     '<input type="text" value="%s" name="getpaid_items[%s][price]" style="width: 100px;" class="getpaid-admin-invoice-item-price getpaid-recalculate-prices-on-change" />',
303
-                                    esc_attr( getpaid_unstandardize_amount( $item->get_price() ) ),
303
+                                    esc_attr(getpaid_unstandardize_amount($item->get_price())),
304 304
                                     (int) $item->get_id()
305 305
                                 );
306 306
 
@@ -308,26 +308,26 @@  discard block
 block discarded – undo
308 308
                             case 'qty':
309 309
                                 printf(
310 310
                                     '<input type="text" style="width: 100px;" value="%s" name="getpaid_items[%s][quantity]" class="getpaid-admin-invoice-item-quantity getpaid-recalculate-prices-on-change" />',
311
-                                    floatval( $item->get_quantity() ),
311
+                                    floatval($item->get_quantity()),
312 312
                                     (int) $item->get_id()
313 313
                                 );
314 314
 
315 315
                                 break;
316 316
                             case 'total':
317
-                                wpinv_the_price( $item->get_sub_total(), $invoice->get_currency() );
317
+                                wpinv_the_price($item->get_sub_total(), $invoice->get_currency());
318 318
 
319 319
                                 break;
320 320
                             case 'tax':
321
-                                echo floatval( wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
321
+                                echo floatval(wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%';
322 322
 
323 323
                                 break;
324 324
                             case 'action':
325
-                                if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
325
+                                if (!$invoice->is_paid() && !$invoice->is_refunded()) {
326 326
                                     echo '<i class="fa fa-trash wpinv-item-remove"></i>';
327 327
                                 }
328 328
                                 break;
329 329
                         }
330
-                        do_action( 'getpaid_admin_edit_invoice_item_' . $column, $item, $invoice );
330
+                        do_action('getpaid_admin_edit_invoice_item_' . $column, $item, $invoice);
331 331
                     ?>
332 332
                 </td>
333 333
             <?php endforeach; ?>
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @param WP_Post $post
342 342
 	 */
343
-    public static function output2( $post ) {
343
+    public static function output2($post) {
344 344
 
345 345
         // Prepare the invoice.
346
-        $invoice = new WPInv_Invoice( $post );
346
+        $invoice = new WPInv_Invoice($post);
347 347
 
348 348
         // Invoice items.
349 349
         $items = $invoice->get_items();
@@ -351,28 +351,28 @@  discard block
 block discarded – undo
351 351
         $totals = array(
352 352
 
353 353
             'subtotal'  => array(
354
-                'label' => __( 'Items Subtotal', 'invoicing' ),
355
-                'value' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ),
354
+                'label' => __('Items Subtotal', 'invoicing'),
355
+                'value' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()),
356 356
             ),
357 357
 
358 358
             'discount'  => array(
359
-                'label' => __( 'Total Discount', 'invoicing' ),
360
-                'value' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ),
359
+                'label' => __('Total Discount', 'invoicing'),
360
+                'value' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()),
361 361
             ),
362 362
 
363 363
             'tax'       => array(
364
-                'label' => __( 'Total Tax', 'invoicing' ),
365
-                'value' => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ),
364
+                'label' => __('Total Tax', 'invoicing'),
365
+                'value' => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()),
366 366
             ),
367 367
 
368 368
             'total'     => array(
369
-                'label' => __( 'Invoice Total', 'invoicing' ),
370
-                'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ),
369
+                'label' => __('Invoice Total', 'invoicing'),
370
+                'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()),
371 371
             )
372 372
         );
373 373
 
374
-        if ( ! wpinv_use_taxes() ) {
375
-            unset( $totals['tax'] );
374
+        if (!wpinv_use_taxes()) {
375
+            unset($totals['tax']);
376 376
         }
377 377
 
378 378
         $item_args = array(
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             'orderby'        => 'title',
381 381
             'order'          => 'ASC',
382 382
             'posts_per_page' => -1,
383
-            'post_status'    => array( 'publish' ),
383
+            'post_status'    => array('publish'),
384 384
             'meta_query'     => array(
385 385
                 array(
386 386
                     'key'       => '_wpinv_type',
@@ -404,10 +404,10 @@  discard block
 block discarded – undo
404 404
             }
405 405
         </style>
406 406
 
407
-                <div class="bsui getpaid-invoice-items-inner <?php echo empty( $items ) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem; padding: 0 12px 12px;">
407
+                <div class="bsui getpaid-invoice-items-inner <?php echo empty($items) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem; padding: 0 12px 12px;">
408 408
 
409
-                    <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?>
410
-                        <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?>
409
+                    <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?>
410
+                        <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?>
411 411
 
412 412
                         <div class="row">
413 413
                             <div class="col-12 col-sm-6">
@@ -416,15 +416,15 @@  discard block
 block discarded – undo
416 416
                                         array(
417 417
                                             'id'          => 'wpinv_template',
418 418
                                             'name'        => 'wpinv_template',
419
-                                            'label'       => __( 'Template', 'invoicing' ),
419
+                                            'label'       => __('Template', 'invoicing'),
420 420
                                             'label_type'  => 'vertical',
421
-                                            'placeholder' => __( 'Choose a template', 'invoicing' ),
421
+                                            'placeholder' => __('Choose a template', 'invoicing'),
422 422
                                             'class'       => 'form-control-sm',
423
-                                            'value'       => $invoice->get_template( 'edit' ),
423
+                                            'value'       => $invoice->get_template('edit'),
424 424
                                             'options'     => array(
425
-                                                'quantity' => __( 'Quantity', 'invoicing' ),
426
-                                                'hours'    => __( 'Hours', 'invoicing' ),
427
-                                                'amount'   => __( 'Amount Only', 'invoicing' ),
425
+                                                'quantity' => __('Quantity', 'invoicing'),
426
+                                                'hours'    => __('Hours', 'invoicing'),
427
+                                                'amount'   => __('Amount Only', 'invoicing'),
428 428
                                             ),
429 429
                                             'data-allow-clear' => 'false',
430 430
                                             'select2'          => true,
@@ -441,11 +441,11 @@  discard block
 block discarded – undo
441 441
                                         array(
442 442
                                             'id'          => 'wpinv_currency',
443 443
                                             'name'        => 'wpinv_currency',
444
-                                            'label'       => __( 'Currency', 'invoicing' ),
444
+                                            'label'       => __('Currency', 'invoicing'),
445 445
                                             'label_type'  => 'vertical',
446
-                                            'placeholder' => __( 'Select Invoice Currency', 'invoicing' ),
446
+                                            'placeholder' => __('Select Invoice Currency', 'invoicing'),
447 447
                                             'class'       => 'form-control-sm',
448
-                                            'value'       => $invoice->get_currency( 'edit' ),
448
+                                            'value'       => $invoice->get_currency('edit'),
449 449
                                             'required'    => false,
450 450
                                             'data-allow-clear' => 'false',
451 451
                                             'select2'          => true,
@@ -458,24 +458,24 @@  discard block
 block discarded – undo
458 458
                             </div>
459 459
                         </div>
460 460
 
461
-                        <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?>
461
+                        <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?>
462 462
                     <?php endif; ?>
463 463
 
464 464
                     <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items">
465 465
                         <thead>
466 466
                             <tr>
467
-                                <th class="getpaid-item" colspan="2"><?php esc_html_e( 'Item', 'invoicing' ) ?></th>
467
+                                <th class="getpaid-item" colspan="2"><?php esc_html_e('Item', 'invoicing') ?></th>
468 468
                                 <th class="getpaid-quantity hide-if-amount text-right">
469
-                                    <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Quantity', 'invoicing' ) ?></span>
470
-                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Hours', 'invoicing' ) ?></span>
469
+                                    <span class="getpaid-hide-if-hours"><?php esc_html_e('Quantity', 'invoicing') ?></span>
470
+                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e('Hours', 'invoicing') ?></span>
471 471
                                 </th>
472 472
                                 <th class="getpaid-price hide-if-amount text-right">
473
-                                    <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Price', 'invoicing' ) ?></span>
474
-                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Rate', 'invoicing' ) ?></span>
473
+                                    <span class="getpaid-hide-if-hours"><?php esc_html_e('Price', 'invoicing') ?></span>
474
+                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e('Rate', 'invoicing') ?></span>
475 475
                                 </th>
476 476
                                 <th class="getpaid-item-subtotal text-right">
477
-                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php esc_html_e( 'Amount', 'invoicing' ) ?></span>
478
-                                    <span class="hide-if-amount"><?php esc_html_e( 'Total', 'invoicing' ) ?></span>
477
+                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php esc_html_e('Amount', 'invoicing') ?></span>
478
+                                    <span class="hide-if-amount"><?php esc_html_e('Total', 'invoicing') ?></span>
479 479
                                 </th>
480 480
                                 <th class="getpaid-item-actions hide-if-not-editable" width="70px">&nbsp;</th>
481 481
                             </tr>
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
 		                <tbody class="getpaid_invoice_line_items">
484 484
                             <tr class="hide-if-has-items hide-if-not-editable">
485 485
                                 <td colspan="2" class="pt-4 pb-4">
486
-                                    <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e( 'Add Existing Items', 'invoicing' ) ?></button>
487
-                                    <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e( 'Create New Item', 'invoicing' ) ?></button>
486
+                                    <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e('Add Existing Items', 'invoicing') ?></button>
487
+                                    <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e('Create New Item', 'invoicing') ?></button>
488 488
                                 </td>
489 489
                                 <td class="hide-if-amount">&nbsp;</th>
490 490
                                 <td class="hide-if-amount">&nbsp;</th>
@@ -516,11 +516,11 @@  discard block
 block discarded – undo
516 516
                             <div class="col-12 col-sm-6 offset-sm-6">
517 517
                                 <table class="getpaid-invoice-totals text-right w-100">
518 518
                                     <tbody>
519
-                                        <?php foreach ( apply_filters( 'getpaid_invoice_subtotal_rows', $totals, $invoice ) as $key => $data ) : ?>
520
-                                            <tr class="getpaid-totals-<?php echo esc_attr( $key ); ?>">
521
-                                                <td class="label"><?php echo esc_html( $data['label'] ) ?>:</td>
519
+                                        <?php foreach (apply_filters('getpaid_invoice_subtotal_rows', $totals, $invoice) as $key => $data) : ?>
520
+                                            <tr class="getpaid-totals-<?php echo esc_attr($key); ?>">
521
+                                                <td class="label"><?php echo esc_html($data['label']) ?>:</td>
522 522
                                                 <td width="1%"></td>
523
-                                                <td class="value"><?php echo wp_kses_post( $data['value'] ) ?></td>
523
+                                                <td class="value"><?php echo wp_kses_post($data['value']) ?></td>
524 524
                                             </tr>
525 525
                                         <?php endforeach; ?>
526 526
                                     </tbody>
@@ -533,18 +533,18 @@  discard block
 block discarded – undo
533 533
                     <div class="getpaid-invoice-item-actions hide-if-no-items hide-if-not-editable">
534 534
                         <div class="row">
535 535
                             <div class="text-left col-12 col-sm-8">
536
-                                <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e( 'Add Existing Item', 'invoicing' ) ?></button>
537
-                                <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e( 'Create New Item', 'invoicing' ) ?></button>
538
-                                <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?>
536
+                                <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e('Add Existing Item', 'invoicing') ?></button>
537
+                                <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e('Create New Item', 'invoicing') ?></button>
538
+                                <?php do_action('getpaid-invoice-items-actions', $invoice); ?>
539 539
                             </div>
540 540
                             <div class="text-right col-12 col-sm-4">
541
-                                <button type="button" class="button button-primary recalculate-totals-button"><?php esc_html_e( 'Recalculate Totals', 'invoicing' ) ?></button>
541
+                                <button type="button" class="button button-primary recalculate-totals-button"><?php esc_html_e('Recalculate Totals', 'invoicing') ?></button>
542 542
                             </div>
543 543
                         </div>
544 544
                     </div>
545 545
 
546 546
                     <div class="getpaid-invoice-item-actions hide-if-editable">
547
-                        <p class="description m-2 text-right text-muted"><?php esc_html_e( 'This invoice is no longer editable', 'invoicing' ); ?></p>
547
+                        <p class="description m-2 text-right text-muted"><?php esc_html_e('This invoice is no longer editable', 'invoicing'); ?></p>
548 548
                     </div>
549 549
 
550 550
                     <!-- Add items to an invoice -->
@@ -552,8 +552,8 @@  discard block
 block discarded – undo
552 552
                         <div class="modal-dialog modal-dialog-centered" role="document">
553 553
                             <div class="modal-content">
554 554
                                 <div class="modal-header">
555
-                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php esc_html_e( "Add Item(s)", 'invoicing' ); ?></h5>
556
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>">
555
+                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php esc_html_e("Add Item(s)", 'invoicing'); ?></h5>
556
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>">
557 557
                                         <span aria-hidden="true">&times;</span>
558 558
                                     </button>
559 559
                                 </div>
@@ -561,10 +561,10 @@  discard block
 block discarded – undo
561 561
                                     <table class="widefat">
562 562
                                         <thead>
563 563
                                             <tr>
564
-                                                <th class="pl-0 text-left"><?php esc_html_e( 'Item', 'invoicing' ) ?></th>
564
+                                                <th class="pl-0 text-left"><?php esc_html_e('Item', 'invoicing') ?></th>
565 565
                                                 <th class="pr-0 text-right hide-if-amount">
566
-                                                    <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Quantity', 'invoicing' ) ?></span>
567
-                                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Hours', 'invoicing' ) ?></span>
566
+                                                    <span class="getpaid-hide-if-hours"><?php esc_html_e('Quantity', 'invoicing') ?></span>
567
+                                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e('Hours', 'invoicing') ?></span>
568 568
                                                 </th>
569 569
                                             </tr>
570 570
                                         </thead>
@@ -572,9 +572,9 @@  discard block
 block discarded – undo
572 572
 								            <tr>
573 573
 									            <td class="pl-0 text-left">
574 574
                                                     <select class="regular-text getpaid-add-invoice-item-select">
575
-                                                        <option value="" selected="selected" disabled><?php esc_html_e( 'Select an item…', 'invoicing' ); ?></option>
576
-                                                        <?php foreach ( get_posts( $item_args ) as $item ) : ?>
577
-                                                        <option value="<?php echo (int) $item->ID; ?>"><?php echo esc_html( $item->post_title ); ?></option>
575
+                                                        <option value="" selected="selected" disabled><?php esc_html_e('Select an item…', 'invoicing'); ?></option>
576
+                                                        <?php foreach (get_posts($item_args) as $item) : ?>
577
+                                                        <option value="<?php echo (int) $item->ID; ?>"><?php echo esc_html($item->post_title); ?></option>
578 578
                                                         <?php endforeach; ?>
579 579
                                                     </select>
580 580
                                                 </td>
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 						            </table>
587 587
                                 </div>
588 588
                                 <div class="modal-footer">
589
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button>
590
-                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php esc_html_e( 'Add', 'invoicing' ); ?></button>
589
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button>
590
+                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php esc_html_e('Add', 'invoicing'); ?></button>
591 591
                                 </div>
592 592
                             </div>
593 593
                         </div>
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
                         <div class="modal-dialog modal-dialog-centered" role="document">
599 599
                             <div class="modal-content">
600 600
                                 <div class="modal-header">
601
-                                    <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php esc_html_e( "Create Item", 'invoicing' ); ?></h5>
602
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>">
601
+                                    <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php esc_html_e("Create Item", 'invoicing'); ?></h5>
602
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>">
603 603
                                         <span aria-hidden="true">&times;</span>
604 604
                                     </button>
605 605
                                 </div>
@@ -607,27 +607,27 @@  discard block
 block discarded – undo
607 607
                                     <div class="getpaid-create-item-div">
608 608
                                         <input type="hidden" name="id" value="new" class="form-control form-control-sm item-id">
609 609
                                         <label class="form-group mb-3 w-100">
610
-                                            <span><?php esc_html_e( 'Name', 'invoicing' ); ?></span>
611
-                                            <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">
610
+                                            <span><?php esc_html_e('Name', 'invoicing'); ?></span>
611
+                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name">
612 612
                                         </label>
613 613
                                         <label class="form-group mb-3 w-100">
614
-                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span>
615
-                                            <span class="hide-if-amount"><?php esc_html_e( 'Price', 'invoicing' ); ?></span>
616
-                                            <input type="text" name="price" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control form-control-sm item-price">
614
+                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e('Amount', 'invoicing'); ?></span>
615
+                                            <span class="hide-if-amount"><?php esc_html_e('Price', 'invoicing'); ?></span>
616
+                                            <input type="text" name="price" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control form-control-sm item-price">
617 617
                                         </label>
618 618
                                         <label class="form-group mb-3 w-100 hide-if-amount">
619
-                                            <span><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span>
619
+                                            <span><?php esc_html_e('Quantity', 'invoicing'); ?></span>
620 620
                                             <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">
621 621
                                         </label>
622 622
                                         <label class="form-group mb-3 w-100">
623
-                                            <span><?php esc_html_e( 'Item Description', 'invoicing' ); ?></span>
624
-                                            <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>
623
+                                            <span><?php esc_html_e('Item Description', 'invoicing'); ?></span>
624
+                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea>
625 625
                                         </label>
626 626
                                     </div>
627 627
                                 </div>
628 628
                                 <div class="modal-footer">
629
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button>
630
-                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e( 'Create', 'invoicing' ); ?></button>
629
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button>
630
+                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e('Create', 'invoicing'); ?></button>
631 631
                                 </div>
632 632
                             </div>
633 633
                         </div>
@@ -638,8 +638,8 @@  discard block
 block discarded – undo
638 638
                         <div class="modal-dialog modal-dialog-centered" role="document">
639 639
                             <div class="modal-content">
640 640
                                 <div class="modal-header">
641
-                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php esc_html_e( "Edit Item", 'invoicing' ); ?></h5>
642
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>">
641
+                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php esc_html_e("Edit Item", 'invoicing'); ?></h5>
642
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>">
643 643
                                         <span aria-hidden="true">&times;</span>
644 644
                                     </button>
645 645
                                 </div>
@@ -647,27 +647,27 @@  discard block
 block discarded – undo
647 647
                                     <div class="getpaid-edit-item-div">
648 648
                                         <input type="hidden" name="id" class="form-control form-control-sm item-id">
649 649
                                         <label class="form-group mb-3 w-100">
650
-                                            <span><?php esc_html_e( 'Name', 'invoicing' ); ?></span>
651
-                                            <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">
650
+                                            <span><?php esc_html_e('Name', 'invoicing'); ?></span>
651
+                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name">
652 652
                                         </label>
653 653
                                         <label class="form-group mb-3 w-100">
654
-                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span>
655
-                                            <span class="hide-if-amount"><?php esc_html_e( 'Price', 'invoicing' ); ?></span>
656
-                                            <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price">
654
+                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e('Amount', 'invoicing'); ?></span>
655
+                                            <span class="hide-if-amount"><?php esc_html_e('Price', 'invoicing'); ?></span>
656
+                                            <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price">
657 657
                                         </label>
658 658
                                         <label class="form-group mb-3 w-100 hide-if-amount">
659
-                                            <span><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span>
659
+                                            <span><?php esc_html_e('Quantity', 'invoicing'); ?></span>
660 660
                                             <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">
661 661
                                         </label>
662 662
                                         <label class="form-group mb-3 w-100">
663
-                                            <span><?php esc_html_e( 'Item Description', 'invoicing' ); ?></span>
664
-                                            <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>
663
+                                            <span><?php esc_html_e('Item Description', 'invoicing'); ?></span>
664
+                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea>
665 665
                                         </label>
666 666
                                     </div>
667 667
                                 </div>
668 668
                                 <div class="modal-footer">
669
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button>
670
-                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e( 'Save', 'invoicing' ); ?></button>
669
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button>
670
+                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e('Save', 'invoicing'); ?></button>
671 671
                                 </div>
672 672
                             </div>
673 673
                         </div>
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-item-details.php 1 patch
Spacing   +78 added lines, -78 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
         <style>
46 46
             #poststuff .input-group-text,
47 47
             #poststuff .form-control {
@@ -55,23 +55,23 @@  discard block
 block discarded – undo
55 55
         </style>
56 56
         <div class='bsui' style='max-width: 600px;padding-top: 10px;'>
57 57
 
58
-            <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?>
58
+            <?php do_action('wpinv_item_details_metabox_before_price', $item); ?>
59 59
             <div class="form-group mb-3 row">
60
-                <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php esc_html_e( 'Item Price', 'invoicing' ); ?></span></label>
60
+                <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php esc_html_e('Item Price', 'invoicing'); ?></span></label>
61 61
                 <div class="col-sm-8">
62 62
                     <div class="row">
63 63
                         <div class="col-sm-4 getpaid-price-input">
64 64
                             <div class="input-group input-group-sm">
65
-                                <?php if ( 'left' == $position ) : ?>
65
+                                <?php if ('left' == $position) : ?>
66 66
                                 <div class="input-group-prepend">
67
-                                    <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
67
+                                    <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
68 68
                                 </div>
69 69
                                 <?php endif; ?>
70
-                                <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control">
70
+                                <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_price('edit'))); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control">
71 71
 
72
-                                <?php if ( 'left' != $position ) : ?>
72
+                                <?php if ('left' != $position) : ?>
73 73
                                 <div class="input-group-append">
74
-                                    <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
74
+                                    <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
75 75
                                 </div>
76 76
                                 <?php endif; ?>
77 77
                             </div>
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
                         </div>
80 80
                         <div class="col-sm-4 wpinv_show_if_recurring">
81 81
                             <?php
82
-                                esc_html_e( 'every' );
82
+                                esc_html_e('every');
83 83
                                 echo '&nbsp;';
84 84
                             ?>
85
-                            <input type="number" style="max-width: 60px;" value="<?php echo esc_attr( $item->get_recurring_interval( 'edit' ) ); ?>" placeholder="1" name="wpinv_recurring_interval" id="wpinv_recurring_interval" />
85
+                            <input type="number" style="max-width: 60px;" value="<?php echo esc_attr($item->get_recurring_interval('edit')); ?>" placeholder="1" name="wpinv_recurring_interval" id="wpinv_recurring_interval" />
86 86
                         </div>
87 87
                         <div class="col-sm-4 wpinv_show_if_recurring">
88 88
                             <?php
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
                                     array(
91 91
                                         'id'               => 'wpinv_recurring_period',
92 92
                                         'name'             => 'wpinv_recurring_period',
93
-                                        'label'            => __( 'Period', 'invoicing' ),
94
-                                        'placeholder'      => __( 'Select Period', 'invoicing' ),
95
-                                        'value'            => $item->get_recurring_period( 'edit' ),
93
+                                        'label'            => __('Period', 'invoicing'),
94
+                                        'placeholder'      => __('Select Period', 'invoicing'),
95
+                                        'value'            => $item->get_recurring_period('edit'),
96 96
                                         'select2'          => true,
97 97
                                         'data-allow-clear' => 'false',
98 98
                                         'options'          => array(
99
-                                            'D' => __( 'day(s)', 'invoicing' ),
100
-                                            'W' => __( 'week(s)', 'invoicing' ),
101
-                                            'M' => __( 'month(s)', 'invoicing' ),
102
-                                            'Y' => __( 'year(s)', 'invoicing' ),
99
+                                            'D' => __('day(s)', 'invoicing'),
100
+                                            'W' => __('week(s)', 'invoicing'),
101
+                                            'M' => __('month(s)', 'invoicing'),
102
+                                            'Y' => __('year(s)', 'invoicing'),
103 103
                                         ),
104 104
                                     ),
105 105
                                     true
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
                             <?php
113 113
 
114 114
                                 // Dynamic pricing.
115
-                                if ( $item->supports_dynamic_pricing() ) {
115
+                                if ($item->supports_dynamic_pricing()) {
116 116
 
117
-								do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item );
117
+								do_action('wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item);
118 118
 
119 119
 								// NYP toggle.
120 120
 								aui()->input(
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 								'id'      => 'wpinv_name_your_price',
123 123
 								'name'    => 'wpinv_name_your_price',
124 124
 								'type'    => 'checkbox',
125
-								'label'   => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ),
125
+								'label'   => apply_filters('wpinv_name_your_price_toggle_text', __('Let customers name their price', 'invoicing')),
126 126
 								'value'   => '1',
127 127
 								'checked' => $item->user_can_set_their_price(),
128 128
 								'no_wrap' => true,
@@ -130,105 +130,105 @@  discard block
 block discarded – undo
130 130
                                     true
131 131
                                 );
132 132
 
133
-							do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item );
133
+							do_action('wpinv_item_details_metabox_dynamic_pricing_checkbox', $item);
134 134
 
135 135
                                 }
136 136
 
137 137
                                 // Subscriptions.
138
-                                do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item );
138
+                                do_action('wpinv_item_details_metabox_before_subscription_checkbox', $item);
139 139
                                 aui()->input(
140 140
                                     array(
141 141
                                         'id'      => 'wpinv_is_recurring',
142 142
                                         'name'    => 'wpinv_is_recurring',
143 143
                                         'type'    => 'checkbox',
144
-                                        'label'   => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ),
144
+                                        'label'   => apply_filters('wpinv_is_recurring_toggle_text', __('Charge customers a recurring amount for this item', 'invoicing')),
145 145
                                         'value'   => '1',
146 146
                                         'checked' => $item->is_recurring(),
147 147
                                         'no_wrap' => true,
148 148
                                     ),
149 149
                                     true
150 150
                                 );
151
-                                do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item );
151
+                                do_action('wpinv_item_details_metabox_subscription_checkbox', $item);
152 152
 
153 153
                             ?>
154 154
                             <div class="wpinv_show_if_recurring">
155
-                                <em><?php echo wp_kses_post( wpinv_get_recurring_gateways_text() ); ?></em>
155
+                                <em><?php echo wp_kses_post(wpinv_get_recurring_gateways_text()); ?></em>
156 156
                             </div>
157 157
                         </div>
158 158
                     </div>
159 159
                 </div>
160 160
                 <div class="col-sm-1 pt-2 pl-0">
161
-                    <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>
161
+                    <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>
162 162
                 </div>
163 163
             </div>
164
-            <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?>
164
+            <?php do_action('wpinv_item_details_metabox_after_price', $item); ?>
165 165
 
166
-            <?php if ( $item->supports_dynamic_pricing() ) : ?>
167
-                <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?>
166
+            <?php if ($item->supports_dynamic_pricing()) : ?>
167
+                <?php do_action('wpinv_item_details_metabox_before_minimum_price', $item); ?>
168 168
                 <div class="wpinv_show_if_dynamic wpinv_minimum_price">
169 169
 
170 170
                     <div class="form-group mb-3 row">
171 171
                         <label for="wpinv_minimum_price" class="col-sm-3 col-form-label">
172
-                            <?php esc_html_e( 'Minimum Price', 'invoicing' ); ?>
172
+                            <?php esc_html_e('Minimum Price', 'invoicing'); ?>
173 173
                         </label>
174 174
                         <div class="col-sm-8">
175 175
                             <div class="input-group input-group-sm">
176
-                                <?php if ( 'left' == $position ) : ?>
176
+                                <?php if ('left' == $position) : ?>
177 177
                                     <div class="input-group-prepend">
178
-                                        <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
178
+                                        <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
179 179
                                     </div>
180 180
                                 <?php endif; ?>
181 181
 
182
-                                <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control">
182
+                                <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price('edit'))); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control">
183 183
 
184
-                                <?php if ( 'left' != $position ) : ?>
184
+                                <?php if ('left' != $position) : ?>
185 185
                                     <div class="input-group-append">
186
-                                        <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
186
+                                        <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
187 187
                                     </div>
188 188
                                 <?php endif; ?>
189 189
                             </div>
190 190
                         </div>
191 191
 
192 192
                         <div class="col-sm-1 pt-2 pl-0">
193
-                            <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>
193
+                            <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>
194 194
                         </div>
195 195
                     </div>
196 196
 
197 197
                 </div>
198
-                <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?>
198
+                <?php do_action('wpinv_item_details_metabox_minimum_price', $item); ?>
199 199
             <?php endif; ?>
200 200
 
201
-            <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?>
201
+            <?php do_action('wpinv_item_details_metabox_before_maximum_renewals', $item); ?>
202 202
             <div class="wpinv_show_if_recurring wpinv_maximum_renewals">
203 203
 
204 204
                 <div class="form-group mb-3 row">
205 205
                     <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label">
206
-                        <?php esc_html_e( 'Maximum Renewals', 'invoicing' ); ?>
206
+                        <?php esc_html_e('Maximum Renewals', 'invoicing'); ?>
207 207
                     </label>
208 208
                     <div class="col-sm-8">
209
-                        <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%;" />
209
+                        <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%;" />
210 210
                     </div>
211 211
                     <div class="col-sm-1 pt-2 pl-0">
212
-                        <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>
212
+                        <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>
213 213
                     </div>
214 214
                 </div>
215 215
 
216 216
             </div>
217
-            <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?>
217
+            <?php do_action('wpinv_item_details_metabox_maximum_renewals', $item); ?>
218 218
 
219
-            <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?>
219
+            <?php do_action('wpinv_item_details_metabox_before_free_trial', $item); ?>
220 220
             <div class="wpinv_show_if_recurring wpinv_free_trial">
221 221
 
222 222
                 <div class="form-group mb-3 row">
223
-                    <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined( 'GETPAID_PAID_TRIALS_VERSION' ) ? esc_html_e( 'Free/Paid Trial', 'invoicing' ) : esc_html_e( 'Free Trial', 'invoicing' ); ?></label>
223
+                    <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined('GETPAID_PAID_TRIALS_VERSION') ? esc_html_e('Free/Paid Trial', 'invoicing') : esc_html_e('Free Trial', 'invoicing'); ?></label>
224 224
 
225 225
                     <div class="col-sm-8">
226 226
                         <div class="row">
227 227
                             <div class="col-sm-6">
228
-                                <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0; ?>
228
+                                <?php $value = $item->has_free_trial() ? $item->get_trial_interval('edit') : 0; ?>
229 229
 
230 230
                                 <div>
231
-                                    <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" >
231
+                                    <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr($value); ?>" >
232 232
                                 </div>
233 233
                             </div>
234 234
                             <div class="col-sm-6">
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
                                         array(
238 238
                                             'id'          => 'wpinv_trial_period',
239 239
                                             'name'        => 'wpinv_trial_period',
240
-                                            'label'       => __( 'Trial Period', 'invoicing' ),
241
-                                            'placeholder' => __( 'Trial Period', 'invoicing' ),
242
-                                            'value'       => $item->get_trial_period( 'edit' ),
240
+                                            'label'       => __('Trial Period', 'invoicing'),
241
+                                            'placeholder' => __('Trial Period', 'invoicing'),
242
+                                            'value'       => $item->get_trial_period('edit'),
243 243
                                             'select2'     => true,
244 244
                                             'data-allow-clear' => 'false',
245 245
                                             'no_wrap'     => true,
246 246
                                             'options'     => array(
247
-                                                'D' => __( 'day(s)', 'invoicing' ),
248
-                                                'W' => __( 'week(s)', 'invoicing' ),
249
-                                                'M' => __( 'month(s)', 'invoicing' ),
250
-                                                'Y' => __( 'year(s)', 'invoicing' ),
247
+                                                'D' => __('day(s)', 'invoicing'),
248
+                                                'W' => __('week(s)', 'invoicing'),
249
+                                                'M' => __('month(s)', 'invoicing'),
250
+                                                'Y' => __('year(s)', 'invoicing'),
251 251
                                             ),
252 252
                                         ),
253 253
                                         true
@@ -259,15 +259,15 @@  discard block
 block discarded – undo
259 259
                     </div>
260 260
 
261 261
                     <div class="col-sm-1 pt-2 pl-0">
262
-                        <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>
262
+                        <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>
263 263
                     </div>
264 264
 
265 265
                 </div>
266 266
 
267 267
             </div>
268
-            <?php do_action( 'wpinv_item_details_metabox__free_trial', $item ); ?>
268
+            <?php do_action('wpinv_item_details_metabox__free_trial', $item); ?>
269 269
 
270
-            <?php do_action( 'wpinv_item_details_metabox_item_details', $item ); ?>
270
+            <?php do_action('wpinv_item_details_metabox_item_details', $item); ?>
271 271
         </div>
272 272
         <?php
273 273
 
@@ -278,31 +278,31 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @param int $post_id
280 280
 	 */
281
-	public static function save( $post_id ) {
281
+	public static function save($post_id) {
282 282
 
283 283
         // Prepare the item.
284
-        $item = new WPInv_Item( $post_id );
284
+        $item = new WPInv_Item($post_id);
285 285
 
286 286
         // Load new data.
287 287
         $item->set_props(
288 288
 			array(
289
-				'price'              => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null,
290
-				'vat_rule'           => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null,
291
-				'vat_class'          => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null,
292
-				'type'               => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null,
293
-				'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ),
294
-                'minimum_price'      => isset( $_POST['wpinv_minimum_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_minimum_price'] ) : null,
295
-				'is_recurring'       => ! empty( $_POST['wpinv_is_recurring'] ),
296
-				'recurring_period'   => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null,
297
-				'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1,
298
-				'recurring_limit'    => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null,
299
-				'is_free_trial'      => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null,
300
-				'trial_period'       => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null,
301
-				'trial_interval'     => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null,
289
+				'price'              => isset($_POST['wpinv_item_price']) ? getpaid_standardize_amount($_POST['wpinv_item_price']) : null,
290
+				'vat_rule'           => isset($_POST['wpinv_vat_rules']) ? wpinv_clean($_POST['wpinv_vat_rules']) : null,
291
+				'vat_class'          => isset($_POST['wpinv_vat_class']) ? wpinv_clean($_POST['wpinv_vat_class']) : null,
292
+				'type'               => isset($_POST['wpinv_item_type']) ? wpinv_clean($_POST['wpinv_item_type']) : null,
293
+				'is_dynamic_pricing' => !empty($_POST['wpinv_name_your_price']),
294
+                'minimum_price'      => isset($_POST['wpinv_minimum_price']) ? getpaid_standardize_amount($_POST['wpinv_minimum_price']) : null,
295
+				'is_recurring'       => !empty($_POST['wpinv_is_recurring']),
296
+				'recurring_period'   => isset($_POST['wpinv_recurring_period']) ? wpinv_clean($_POST['wpinv_recurring_period']) : null,
297
+				'recurring_interval' => isset($_POST['wpinv_recurring_interval']) ? (int) $_POST['wpinv_recurring_interval'] : 1,
298
+				'recurring_limit'    => isset($_POST['wpinv_recurring_limit']) ? (int) $_POST['wpinv_recurring_limit'] : null,
299
+				'is_free_trial'      => isset($_POST['wpinv_trial_interval']) ? (0 != (int) $_POST['wpinv_trial_interval']) : null,
300
+				'trial_period'       => isset($_POST['wpinv_trial_period']) ? wpinv_clean($_POST['wpinv_trial_period']) : null,
301
+				'trial_interval'     => isset($_POST['wpinv_trial_interval']) ? (int) $_POST['wpinv_trial_interval'] : null,
302 302
 			)
303 303
         );
304 304
 
305 305
 		$item->save();
306
-		do_action( 'getpaid_item_metabox_save', $post_id, $item );
306
+		do_action('getpaid_item_metabox_save', $post_id, $item);
307 307
 	}
308 308
 }
Please login to merge, or discard this patch.
templates/payment-forms/elements/address-fields.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -12,75 +12,75 @@  discard block
 block discarded – undo
12 12
  * @var GetPaid_Payment_Form $form
13 13
  */
14 14
 
15
-defined( 'ABSPATH' ) || exit;
15
+defined('ABSPATH') || exit;
16 16
 
17
-$field_type = sanitize_key( $field_type );
17
+$field_type = sanitize_key($field_type);
18 18
 
19
-echo "<div class='row " . esc_attr( $field_type ) . "'>";
19
+echo "<div class='row " . esc_attr($field_type) . "'>";
20 20
 
21 21
 // Prepare current user.
22
-if ( ! empty( $form->invoice ) ) {
22
+if (!empty($form->invoice)) {
23 23
     $user_id = $form->invoice->get_user_id();
24 24
 }
25 25
 
26
-if ( empty( $user_id ) && is_user_logged_in() ) {
26
+if (empty($user_id) && is_user_logged_in()) {
27 27
     $user_id = get_current_user_id();
28 28
 }
29 29
 
30
-if ( ! empty( $user_id ) ) {
31
-    $user  = wp_get_current_user();
30
+if (!empty($user_id)) {
31
+    $user = wp_get_current_user();
32 32
 }
33 33
 
34
-foreach ( $fields as $address_field ) {
34
+foreach ($fields as $address_field) {
35 35
 
36 36
     // Skip if it is hidden.
37
-    if ( empty( $address_field['visible'] ) ) {
37
+    if (empty($address_field['visible'])) {
38 38
         continue;
39 39
     }
40 40
 
41
-    do_action( 'getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field );
41
+    do_action('getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field);
42 42
 
43 43
     // Prepare variables.
44 44
     $field_name  = $address_field['name'];
45 45
     $field_name  = "{$field_type}[$field_name]";
46
-    $wrap_class  = getpaid_get_form_element_grid_class( $address_field );
47
-    $wrap_class  = esc_attr( "$wrap_class getpaid-address-field-wrapper" );
48
-    $placeholder = empty( $address_field['placeholder'] ) ? '' : esc_attr( $address_field['placeholder'] );
49
-    $description = empty( $address_field['description'] ) ? '' : wp_kses_post( $address_field['description'] );
50
-    $value       = ! empty( $user_id ) ? get_user_meta( $user_id, '_' . $address_field['name'], true ) : '';
51
-    $label       = empty( $address_field['label'] ) ? '' : wp_kses_post( $address_field['label'] );
52
-
53
-    $method_name = 'get_' . str_replace( 'wpinv_', '', $address_field['name'] );
54
-    if ( ! empty( $form->invoice ) && is_callable( array( $form->invoice, $method_name ) ) ) {
55
-        $value = call_user_func( array( $form->invoice, $method_name ) );
46
+    $wrap_class  = getpaid_get_form_element_grid_class($address_field);
47
+    $wrap_class  = esc_attr("$wrap_class getpaid-address-field-wrapper");
48
+    $placeholder = empty($address_field['placeholder']) ? '' : esc_attr($address_field['placeholder']);
49
+    $description = empty($address_field['description']) ? '' : wp_kses_post($address_field['description']);
50
+    $value       = !empty($user_id) ? get_user_meta($user_id, '_' . $address_field['name'], true) : '';
51
+    $label       = empty($address_field['label']) ? '' : wp_kses_post($address_field['label']);
52
+
53
+    $method_name = 'get_' . str_replace('wpinv_', '', $address_field['name']);
54
+    if (!empty($form->invoice) && is_callable(array($form->invoice, $method_name))) {
55
+        $value = call_user_func(array($form->invoice, $method_name));
56 56
     }
57 57
 
58
-    if ( empty( $value ) && 'wpinv_first_name' == $address_field['name'] && ! empty( $user ) ) {
58
+    if (empty($value) && 'wpinv_first_name' == $address_field['name'] && !empty($user)) {
59 59
         $value = $user->first_name;
60 60
     }
61 61
 
62
-    if ( empty( $value ) && 'wpinv_last_name' == $address_field['name'] && ! empty( $user ) ) {
62
+    if (empty($value) && 'wpinv_last_name' == $address_field['name'] && !empty($user)) {
63 63
         $value = $user->last_name;
64 64
     }
65 65
 
66
-    if ( ! empty( $address_field['required'] ) ) {
66
+    if (!empty($address_field['required'])) {
67 67
         $label .= "<span class='text-danger'> *</span>";
68 68
     }
69 69
 
70 70
     // Display the country.
71
-    if ( 'wpinv_country' == $address_field['name'] ) {
71
+    if ('wpinv_country' == $address_field['name']) {
72 72
 
73
-        echo "<div class='form-group mb-3 " . esc_attr( $wrap_class ) . " getpaid-address-field-wrapper__country'";
73
+        echo "<div class='form-group mb-3 " . esc_attr($wrap_class) . " getpaid-address-field-wrapper__country'";
74 74
 
75 75
         aui()->select(
76 76
             array(
77 77
                 'options'          => wpinv_get_country_list(),
78
-                'name'             => esc_attr( $field_name ),
79
-                'id'               => sanitize_html_class( $field_name ) . $uniqid,
80
-                'value'            => esc_attr( $country ),
78
+                'name'             => esc_attr($field_name),
79
+                'id'               => sanitize_html_class($field_name) . $uniqid,
80
+                'value'            => esc_attr($country),
81 81
                 'placeholder'      => $placeholder,
82
-                'required'         => ! empty( $address_field['required'] ),
83
-                'label'            => wp_kses_post( $label ),
82
+                'required'         => !empty($address_field['required']),
83
+                'label'            => wp_kses_post($label),
84 84
                 'label_type'       => 'vertical',
85 85
                 'help_text'        => $description,
86 86
                 'class'            => 'getpaid-address-field wpinv_country',
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             true
95 95
         );
96 96
 
97
-        if ( wpinv_should_validate_vat_number() ) {
97
+        if (wpinv_should_validate_vat_number()) {
98 98
 
99 99
             aui()->input(
100 100
                 array(
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                     'id'         => "shipping-toggle$uniqid",
104 104
                     'wrap_class' => 'getpaid-address-field-wrapper__address-confirm mt-1 d-none',
105 105
                     'required'   => false,
106
-                    'label'      => __( 'I certify that I live in the country selected above', 'invoicing' ) . "<span class='text-danger'> *</span>",
106
+                    'label'      => __('I certify that I live in the country selected above', 'invoicing') . "<span class='text-danger'> *</span>",
107 107
                     'value'      => 1,
108 108
                     'checked'    => true,
109 109
                     'class'      => 'w-auto',
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
     }
119 119
 
120 120
     // Display the state.
121
-    elseif ( 'wpinv_state' == $address_field['name'] ) {
121
+    elseif ('wpinv_state' == $address_field['name']) {
122 122
 
123
-        if ( empty( $value ) ) {
123
+        if (empty($value)) {
124 124
             $value = wpinv_get_default_state();
125 125
         }
126 126
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             $placeholder,
131 131
             $label,
132 132
             $description,
133
-            ! empty( $address_field['required'] ),
133
+            !empty($address_field['required']),
134 134
             $wrap_class,
135 135
             $field_name,
136 136
             true
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 
139 139
     } else {
140 140
 
141
-        $key      = str_replace( 'wpinv_', '', $address_field['name'] );
142
-        $key      = esc_attr( str_replace( '_', '-', $key ) );
141
+        $key      = str_replace('wpinv_', '', $address_field['name']);
142
+        $key      = esc_attr(str_replace('_', '-', $key));
143 143
         $autocomplete = '';
144 144
         $replacements = array(
145 145
             'zip'        => 'postal-code',
@@ -152,37 +152,37 @@  discard block
 block discarded – undo
152 152
         );
153 153
 
154 154
 
155
-        if ( isset( $replacements[ $key ] ) ) {
155
+        if (isset($replacements[$key])) {
156 156
             $autocomplete = array(
157
-                'autocomplete' => "$field_type {$replacements[ $key ]}",
157
+                'autocomplete' => "$field_type {$replacements[$key]}",
158 158
             );
159 159
         }
160 160
 
161 161
         $append = '';
162 162
 
163
-        if ( 'billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key ) {
164
-            $valid    = esc_attr__( 'Valid', 'invoicing' );
165
-            $invalid  = esc_attr__( 'Invalid', 'invoicing' );
166
-            $validate = esc_attr__( 'Validate', 'invoicing' );
163
+        if ('billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key) {
164
+            $valid    = esc_attr__('Valid', 'invoicing');
165
+            $invalid  = esc_attr__('Invalid', 'invoicing');
166
+            $validate = esc_attr__('Validate', 'invoicing');
167 167
             $append   = "<span class='btn btn-primary getpaid-vat-number-validate' data-valid='$valid' data-invalid='$invalid' data-validate='$validate'>$validate</span>";
168 168
         }
169 169
 
170
-        if ( 'billing' === $field_type ) {
171
-            $description .= '<div class="getpaid-error-' . esc_attr( $field_name ) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>';
170
+        if ('billing' === $field_type) {
171
+            $description .= '<div class="getpaid-error-' . esc_attr($field_name) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>';
172 172
         }
173 173
 
174 174
         aui()->input(
175 175
             array(
176
-                'name'              => esc_attr( $field_name ),
177
-                'id'                => sanitize_html_class( $field_name ) . $uniqid,
178
-                'required'          => ! empty( $address_field['required'] ),
176
+                'name'              => esc_attr($field_name),
177
+                'id'                => sanitize_html_class($field_name) . $uniqid,
178
+                'required'          => !empty($address_field['required']),
179 179
                 'placeholder'       => $placeholder,
180
-                'label'             => wp_kses_post( $label ),
180
+                'label'             => wp_kses_post($label),
181 181
                 'label_type'        => 'vertical',
182 182
                 'help_text'         => $description,
183 183
                 'type'              => 'text',
184
-                'value'             => esc_attr( $value ),
185
-                'class'             => 'getpaid-address-field ' . esc_attr( $address_field['name'] ),
184
+                'value'             => esc_attr($value),
185
+                'class'             => 'getpaid-address-field ' . esc_attr($address_field['name']),
186 186
                 'wrap_class'        => "$wrap_class getpaid-address-field-wrapper__$key",
187 187
                 'label_class'       => 'getpaid-address-field-label getpaid-address-field-label__' . $key,
188 188
                 'extra_attributes'  => $autocomplete,
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
     }
195 195
 
196
-    do_action( 'getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field );
196
+    do_action('getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field);
197 197
 }
198 198
 
199 199
 echo '</div>';
Please login to merge, or discard this patch.
templates/payment-forms/elements/ip_address.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-if ( empty( $text ) ) {
13
-    $text = __( 'Your IP address is:', 'invoicing' );
12
+if (empty($text)) {
13
+    $text = __('Your IP address is:', 'invoicing');
14 14
 }
15 15
 
16 16
 ?>
17 17
 <div class="form-group mb-3 getpaid-ip-info">
18
-    <span><?php echo wp_kses_post( $text ); ?></span>
19
-    <strong><?php echo esc_html( wpinv_get_ip() ); ?></strong>
18
+    <span><?php echo wp_kses_post($text); ?></span>
19
+    <strong><?php echo esc_html(wpinv_get_ip()); ?></strong>
20 20
 </div>
Please login to merge, or discard this patch.
templates/payment-forms/elements/discount.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@  discard block
 block discarded – undo
8 8
  * @var GetPaid_Payment_Form $form The current payment form
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13
-if ( ! getpaid_has_published_discount() ) {
13
+if (!getpaid_has_published_discount()) {
14 14
     return;
15 15
 }
16 16
 
17
-if ( ! empty( $description ) ) {
17
+if (!empty($description)) {
18 18
     $description = "<small class='form-text text-muted'>$description</small>";
19 19
 } else {
20 20
     $description = '';
21 21
 }
22 22
 
23 23
 $discount_code = '';
24
-if ( ! empty( $form->invoice ) ) {
24
+if (!empty($form->invoice)) {
25 25
     $discount_code = $form->invoice->get_discount_code();
26 26
 }
27 27
 
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 <div class="form-group mb-3">
31 31
     <div class="getpaid-discount-field  border rounded p-3">
32 32
         <div class="getpaid-discount-field-inner d-flex flex-column flex-md-row">
33
-            <input name="discount" placeholder="<?php echo esc_attr( $input_label ); ?>" value="<?php echo esc_attr( $discount_code ); ?>" class="form-control mr-2 mb-2 getpaid-discount-field-input" style="flex: 1;" type="text">
34
-            <a href="#" class="btn btn-secondary submit-button mb-2 getpaid-discount-button"><?php echo esc_html( $button_label ); ?></a>
33
+            <input name="discount" placeholder="<?php echo esc_attr($input_label); ?>" value="<?php echo esc_attr($discount_code); ?>" class="form-control mr-2 mb-2 getpaid-discount-field-input" style="flex: 1;" type="text">
34
+            <a href="#" class="btn btn-secondary submit-button mb-2 getpaid-discount-button"><?php echo esc_html($button_label); ?></a>
35 35
         </div>
36
-        <?php echo wp_kses_post( $description ); ?>
36
+        <?php echo wp_kses_post($description); ?>
37 37
         <div class="getpaid-custom-payment-form-errors alert alert-danger d-none"></div>
38
-        <div class="getpaid-custom-payment-form-success alert alert-success d-none"><?php esc_html_e( 'Discount code applied!', 'invoicing' ); ?></div>
38
+        <div class="getpaid-custom-payment-form-success alert alert-success d-none"><?php esc_html_e('Discount code applied!', 'invoicing'); ?></div>
39 39
     </div>
40 40
 </div>
41 41
 
Please login to merge, or discard this patch.
templates/payment-forms/elements/file_upload.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
11
-
12
-$label        = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class  = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
14
-$id           = esc_attr( $id );
15
-$_id          = $id . uniqid( '_' );
16
-$max_file_num = empty( $max_file_num ) ? 1 : absint( $max_file_num );
17
-$file_types   = empty( $file_types ) ? array( 'jpg|jpeg|jpe', 'gif', 'png' ) : $file_types;
10
+defined('ABSPATH') || exit;
11
+
12
+$label        = empty($label) ? '' : wp_kses_post($label);
13
+$label_class  = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14
+$id           = esc_attr($id);
15
+$_id          = $id . uniqid('_');
16
+$max_file_num = empty($max_file_num) ? 1 : absint($max_file_num);
17
+$file_types   = empty($file_types) ? array('jpg|jpeg|jpe', 'gif', 'png') : $file_types;
18 18
 $all_types    = getpaid_get_allowed_mime_types();
19 19
 $types        = array();
20 20
 $_types       = array();
21 21
 
22
-foreach ( $file_types as $file_type ) {
22
+foreach ($file_types as $file_type) {
23 23
 
24
-	if ( isset( $all_types[ $file_type ] ) ) {
25
-		$types[]   = $all_types[ $file_type ];
26
-		$file_type = explode( '|', $file_type );
24
+	if (isset($all_types[$file_type])) {
25
+		$types[]   = $all_types[$file_type];
26
+		$file_type = explode('|', $file_type);
27 27
 
28
-		foreach ( $file_type as $type ) {
29
-			$type     = trim( $type );
28
+		foreach ($file_type as $type) {
29
+			$type     = trim($type);
30 30
 			$types[]  = ".$type";
31 31
 			$_types[] = $type;
32 32
 		}
33 33
 }
34 34
 }
35 35
 
36
-if ( ! empty( $required ) ) {
36
+if (!empty($required)) {
37 37
 	$label .= "<span class='text-danger'> *</span>";
38 38
 }
39 39
 
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 
42 42
 <label><span v-html="form_element.label"></span></label>
43 43
 
44
-<div class="form-group mb-3 <?php echo esc_attr( $label_class ); ?>" data-name="<?php echo esc_attr( $id ); ?>" data-max="<?php echo esc_attr( $max_file_num ); ?>">
45
-	<label for="<?php echo esc_attr( $id ); ?>"><?php echo wp_kses_post( $label ); ?></label>
46
-	<input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr( $id ); ?>" accept="<?php echo esc_attr( implode( ', ', $types ) ); ?>" data-extensions="<?php echo esc_attr( wp_json_encode( $_types ) ); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>>
44
+<div class="form-group mb-3 <?php echo esc_attr($label_class); ?>" data-name="<?php echo esc_attr($id); ?>" data-max="<?php echo esc_attr($max_file_num); ?>">
45
+	<label for="<?php echo esc_attr($id); ?>"><?php echo wp_kses_post($label); ?></label>
46
+	<input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr($id); ?>" accept="<?php echo esc_attr(implode(', ', $types)); ?>" data-extensions="<?php echo esc_attr(wp_json_encode($_types)); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>>
47 47
 
48
-	<label for="<?php echo esc_attr( $id ); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2">
48
+	<label for="<?php echo esc_attr($id); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2">
49 49
 		<div class="h5 text-dark">
50
-			<?php echo esc_html( _n( 'Drag your file to this area or click to upload', 'Drag files to this area or click to upload', $max_file_num, 'invoicing' ) ); ?>
50
+			<?php echo esc_html(_n('Drag your file to this area or click to upload', 'Drag files to this area or click to upload', $max_file_num, 'invoicing')); ?>
51 51
 		</div>
52
-		<?php if ( ! empty( $description ) ) : ?>
53
-			<small class="form-text text-muted"><?php echo wp_kses_post( $description ); ?></small>
52
+		<?php if (!empty($description)) : ?>
53
+			<small class="form-text text-muted"><?php echo wp_kses_post($description); ?></small>
54 54
 		<?php endif; ?>
55 55
 	</label>
56 56
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	<div class="form-row row mb-3 d-none getpaid-progress-template">
60 60
 
61 61
 		<div class="overflow-hidden text-nowrap col-7 col-sm-4">
62
-			<a href="" class="close float-none" title="<?php esc_attr_e( 'Remove File', 'invoicing' ); ?>">&times;<span class="sr-only"><?php esc_html_e( 'Close', 'invoicing' ); ?></span></a>&nbsp;
62
+			<a href="" class="close float-none" title="<?php esc_attr_e('Remove File', 'invoicing'); ?>">&times;<span class="sr-only"><?php esc_html_e('Close', 'invoicing'); ?></span></a>&nbsp;
63 63
 			<i class="fa fa-file" aria-hidden="true"></i>&nbsp; <span class="getpaid-progress-file-name"></span>&nbsp;
64 64
 		</div>
65 65
 
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 mb-3 mt-4">
17
-    <strong><?php echo esc_html( $text ); ?></strong>
17
+    <strong><?php echo esc_html($text); ?></strong>
18 18
     <span class="getpaid-checkout-total-payable"></span>
19 19
 </div>
Please login to merge, or discard this patch.
templates/payment-forms/elements/price_select.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -7,36 +7,36 @@  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
 // Ensure that we have options.
13
-if ( empty( $options ) ) {
13
+if (empty($options)) {
14 14
     return;
15 15
 }
16 16
 
17 17
 // Prepare price options.
18
-$options = getpaid_convert_price_string_to_options( $options );
19
-$keys    = array_keys( $options );
20
-$value   = empty( $options ) ? '' : $keys[0];
18
+$options = getpaid_convert_price_string_to_options($options);
19
+$keys    = array_keys($options);
20
+$value   = empty($options) ? '' : $keys[0];
21 21
 
22
-if ( ! empty( $query_value ) ) {
22
+if (!empty($query_value)) {
23 23
     $value = $query_value;
24 24
 }
25 25
 
26
-$select_type = empty( $select_type ) ? 'select' : $select_type;
26
+$select_type = empty($select_type) ? 'select' : $select_type;
27 27
 
28 28
 // Item select;
29
-if ( $select_type == 'select' ) {
29
+if ($select_type == 'select') {
30 30
     aui()->select(
31 31
         array(
32 32
             'name'        => $id,
33
-            'id'          => esc_attr( $element_id ),
34
-            'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
33
+            'id'          => esc_attr($element_id),
34
+            'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder),
35 35
             'value'       => $value,
36
-            'label'       => empty( $label ) ? '' : esc_html( $label ),
36
+            'label'       => empty($label) ? '' : esc_html($label),
37 37
             'label_type'  => 'vertical',
38 38
             'class'       => 'getpaid-price-select-dropdown getpaid-refresh-on-change',
39
-            'help_text'   => empty( $description ) ? '' : wp_kses_post( $description ),
39
+            'help_text'   => empty($description) ? '' : wp_kses_post($description),
40 40
             'options'     => $options,
41 41
         ),
42 42
         true
@@ -45,18 +45,18 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 // Item radios;
48
-if ( $select_type == 'radios' ) {
48
+if ($select_type == 'radios') {
49 49
     aui()->radio(
50 50
         array(
51
-            'name'       => esc_attr( $id ),
52
-            'id'         => esc_attr( $id ) . uniqid( '_' ),
53
-            'label'      => empty( $label ) ? '' : esc_html( $label ),
51
+            'name'       => esc_attr($id),
52
+            'id'         => esc_attr($id) . uniqid('_'),
53
+            'label'      => empty($label) ? '' : esc_html($label),
54 54
             'label_type' => 'vertical',
55 55
             'class'      => 'getpaid-price-select-radio getpaid-refresh-on-change w-100',
56 56
             'value'      => $value,
57 57
             'inline'     => false,
58 58
             'options'    => $options,
59
-            'help_text'  => empty( $description ) ? '' : wp_kses_post( $description ),
59
+            'help_text'  => empty($description) ? '' : wp_kses_post($description),
60 60
         ),
61 61
         true
62 62
     );
@@ -65,32 +65,32 @@  discard block
 block discarded – undo
65 65
 
66 66
 
67 67
 // Display the label.
68
-if ( ! empty( $label ) ) {
69
-    echo '<label>' . esc_html( $label ) . '</label>';
68
+if (!empty($label)) {
69
+    echo '<label>' . esc_html($label) . '</label>';
70 70
 }
71 71
 
72 72
 // Item buttons;
73
-if ( $select_type == 'buttons' || $select_type == 'circles' ) {
73
+if ($select_type == 'buttons' || $select_type == 'circles') {
74 74
 
75 75
     $class = 'getpaid-price-buttons';
76 76
 
77
-    if ( $select_type == 'circles' ) {
77
+    if ($select_type == 'circles') {
78 78
         $class .= ' getpaid-price-circles';
79 79
     }
80
-    echo "<div class='" . esc_attr( $class ) . "'>";
80
+    echo "<div class='" . esc_attr($class) . "'>";
81 81
 
82
-    foreach ( $options as $price => $label ) {
83
-        $_id = $id . uniqid( '_' );
82
+    foreach ($options as $price => $label) {
83
+        $_id = $id . uniqid('_');
84 84
 
85 85
         $class = 'rounded';
86 86
 
87
-        if ( $select_type == 'circles' ) {
87
+        if ($select_type == 'circles') {
88 88
             $class = '';
89 89
         }
90 90
         echo "
91 91
             <span class='d-inline-block'>
92
-                <input type='radio' class='getpaid-price-select-button getpaid-refresh-on-change w-auto' id='" . esc_attr( $_id ) . "' value='" . esc_attr( $price ) . "' name='" . esc_attr( $id ) . "' " . checked( $price, $value, false ) . " />
93
-                <label for='" . esc_attr( $_id ) . "' class='" . esc_attr( $class ) . "'><span>" . esc_html( $label ) . '</span></label>
92
+                <input type='radio' class='getpaid-price-select-button getpaid-refresh-on-change w-auto' id='" . esc_attr($_id) . "' value='" . esc_attr($price) . "' name='" . esc_attr($id) . "' " . checked($price, $value, false) . " />
93
+                <label for='" . esc_attr($_id) . "' class='" . esc_attr($class) . "'><span>" . esc_html($label) . '</span></label>
94 94
             </span>
95 95
             ';
96 96
     }
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 }
101 101
 
102 102
 // Item checkboxes;
103
-if ( $select_type == 'checkboxes' ) {
103
+if ($select_type == 'checkboxes') {
104 104
     echo '<div class="form-group mb-3">';
105 105
 
106
-    foreach ( $options as $price => $label ) {
106
+    foreach ($options as $price => $label) {
107 107
         echo "
108 108
             <label class='d-block'>
109
-                <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='" . esc_attr( $id ) . "[]' value='" . esc_attr( $price ) . "' " . checked( $price, $value, false ) . ' />
110
-                <span>' . esc_html( $label ) . '</span>
109
+                <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='" . esc_attr($id) . "[]' value='" . esc_attr($price) . "' " . checked($price, $value, false) . ' />
110
+                <span>' . esc_html($label) . '</span>
111 111
             </label>
112 112
             ';
113 113
     }
@@ -116,6 +116,6 @@  discard block
 block discarded – undo
116 116
 
117 117
 }
118 118
 
119
-if ( ! empty( $description ) ) {
120
-    echo "<small class='form-text text-muted'>" . wp_kses_post( $description ) . '</small>';
119
+if (!empty($description)) {
120
+    echo "<small class='form-text text-muted'>" . wp_kses_post($description) . '</small>';
121 121
 }
Please login to merge, or discard this patch.
templates/payment-forms/cart.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,34 +7,34 @@  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
 // Cart table columns.
13 13
 $columns = array(
14
-    'name'     => __( 'Item', 'invoicing' ),
15
-    'price'    => __( 'Price', 'invoicing' ),
16
-    'quantity' => __( 'Qty', 'invoicing' ),
17
-    'subtotal' => __( 'Subtotal', 'invoicing' ),
14
+    'name'     => __('Item', 'invoicing'),
15
+    'price'    => __('Price', 'invoicing'),
16
+    'quantity' => __('Qty', 'invoicing'),
17
+    'subtotal' => __('Subtotal', 'invoicing'),
18 18
 );
19 19
 
20
-if ( ! empty( $form->invoice ) ) {
21
-    $columns = getpaid_invoice_item_columns( $form->invoice );
20
+if (!empty($form->invoice)) {
21
+    $columns = getpaid_invoice_item_columns($form->invoice);
22 22
 }
23 23
 
24
-if ( isset( $columns['tax_rate'] ) ) {
25
-    unset( $columns['tax_rate'] );
24
+if (isset($columns['tax_rate'])) {
25
+    unset($columns['tax_rate']);
26 26
 }
27 27
 
28
-$columns = apply_filters( 'getpaid_payment_form_cart_table_columns', $columns, $form );
28
+$columns = apply_filters('getpaid_payment_form_cart_table_columns', $columns, $form);
29 29
 
30 30
 ?>
31 31
     <div class="getpaid-payment-form-items-cart border form-group mb-3">
32 32
 
33 33
         <div class="getpaid-payment-form-items-cart-header font-weight-bold bg-light border-bottom py-2 px-3">
34 34
             <div class="form-row row">
35
-                <?php foreach ( $columns as $key => $label ) : ?>
36
-                    <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : ''; ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>">
37
-                        <span><?php echo esc_html( $label ); ?></span>
35
+                <?php foreach ($columns as $key => $label) : ?>
36
+                    <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'))) ? 'd-none d-sm-block' : ''; ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>">
37
+                        <span><?php echo esc_html($label); ?></span>
38 38
                     </div>
39 39
                 <?php endforeach; ?>
40 40
             </div>
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
         <?php
44 44
 
45 45
             // Display the item totals.
46
-            foreach ( $form->get_items() as $item ) {
47
-			wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'columns' ) );
46
+            foreach ($form->get_items() as $item) {
47
+			wpinv_get_template('payment-forms/cart-item.php', compact('form', 'item', 'columns'));
48 48
             }
49 49
 
50 50
             // Display the cart totals.
51
-            wpinv_get_template( 'payment-forms/cart-totals.php', compact( 'form' ) );
51
+            wpinv_get_template('payment-forms/cart-totals.php', compact('form'));
52 52
 
53 53
         ?>
54 54
     </div>
55 55
 
56 56
 <?php
57 57
 
58
-do_action( 'getpaid_after_payment_form_cart', $form );
58
+do_action('getpaid_after_payment_form_cart', $form);
Please login to merge, or discard this patch.