Passed
Push — master ( 06f864...96d120 )
by Brian
06:26
created
templates/payment-forms/cart-item.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -9,49 +9,49 @@  discard block
 block discarded – undo
9 9
  * @var GetPaid_Form_Item $item
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14
-do_action( 'getpaid_before_payment_form_cart_item', $form, $item );
14
+do_action('getpaid_before_payment_form_cart_item', $form, $item);
15 15
 
16 16
 $currency = $form->get_currency();
17
-$max_qty  = wpinv_item_max_buyable_quantity( $item->get_id() );
17
+$max_qty  = wpinv_item_max_buyable_quantity($item->get_id());
18 18
 ?>
19 19
 <div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo (int) $item->get_id(); ?> border-bottom py-2 px-3'>
20 20
 
21 21
 	<div class="form-row needs-validation">
22 22
 
23
-		<?php foreach ( array_keys( $columns ) as $key ) : ?>
23
+		<?php foreach (array_keys($columns) as $key) : ?>
24 24
 
25
-			<div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo esc_attr( $key ); ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>-<?php echo (int) $item->get_id(); ?>">
25
+			<div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'))) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo esc_attr($key); ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>-<?php echo (int) $item->get_id(); ?>">
26 26
 
27 27
 				<?php
28 28
 
29 29
 					// Fires before printing a line item column.
30
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
30
+					do_action("getpaid_form_cart_item_before_$key", $item, $form);
31 31
 
32 32
 					// Item name.
33
-					if ( 'name' == $key ) {
33
+					if ('name' == $key) {
34 34
 
35 35
 					ob_start();
36 36
 					// And an optional description.
37 37
 					$description = $item->get_description();
38 38
 
39
-					if ( ! empty( $description ) ) {
40
-						echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . "</small>";
39
+					if (!empty($description)) {
40
+						echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . "</small>";
41 41
 					}
42 42
 
43 43
 					// Price help text.
44
-					$description = getpaid_item_recurring_price_help_text( $item, $currency );
45
-					if ( $description ) {
46
-						echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . "</small>";
44
+					$description = getpaid_item_recurring_price_help_text($item, $currency);
45
+					if ($description) {
46
+						echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . "</small>";
47 47
 					}
48 48
 
49
-					do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
49
+					do_action('getpaid_payment_form_cart_item_description', $item, $form);
50 50
 
51
-					if ( wpinv_current_user_can_manage_invoicing() ) {
51
+					if (wpinv_current_user_can_manage_invoicing()) {
52 52
 
53 53
 						edit_post_link(
54
-							__( 'Edit this item.', 'invoicing' ),
54
+							__('Edit this item.', 'invoicing'),
55 55
 							'<small class="form-text text-muted">',
56 56
 							'</small>',
57 57
 							$item->get_id(),
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
 					$description = ob_get_clean();
64 64
 
65 65
 					// Display the name.
66
-					$tootip = empty( $description ) ? '' : '&nbsp;' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
67
-					echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>';
66
+					$tootip = empty($description) ? '' : '&nbsp;' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
67
+					echo '<div class="mb-1">' . esc_html($item->get_name()) . wp_kses_post($tootip) . '</div>';
68 68
 
69
-					if ( ! empty( $description ) ) {
70
-						printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) );
69
+					if (!empty($description)) {
70
+						printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post($description));
71 71
 						}
72 72
 
73
-					if ( $item->allows_quantities() ) {
73
+					if ($item->allows_quantities()) {
74 74
 						printf(
75 75
 							'<small class="d-sm-none text-muted form-text">%s</small>',
76 76
 							sprintf(
77
-								esc_html__( 'Qty %s', 'invoicing' ),
77
+								esc_html__('Qty %s', 'invoicing'),
78 78
 								sprintf(
79 79
 									'<input
80 80
 											type="number"
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 											max="%s"
87 87
 											>',
88 88
                                     (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
89
-                                    floatval( null !== $max_qty ? $max_qty : 1000000000000 )
89
+                                    floatval(null !== $max_qty ? $max_qty : 1000000000000)
90 90
 								)
91 91
 							)
92 92
 						);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 						printf(
95 95
 							'<small class="d-sm-none text-muted form-text">%s</small>',
96 96
 							sprintf(
97
-								esc_html__( 'Qty %s', 'invoicing' ),
97
+								esc_html__('Qty %s', 'invoicing'),
98 98
 								(float) $item->get_quantity()
99 99
 							)
100 100
 						);
@@ -102,56 +102,56 @@  discard block
 block discarded – undo
102 102
 }
103 103
 
104 104
 					// Item price.
105
-					if ( 'price' == $key ) {
105
+					if ('price' == $key) {
106 106
 
107 107
 					// Set the currency position.
108 108
 					$position = wpinv_currency_position();
109 109
 
110
-					if ( $position == 'left_space' ) {
110
+					if ($position == 'left_space') {
111 111
 						$position = 'left';
112 112
 						}
113 113
 
114
-					if ( $position == 'right_space' ) {
114
+					if ($position == 'right_space') {
115 115
 						$position = 'right';
116 116
 						}
117 117
 
118
-					if ( $item->user_can_set_their_price() ) {
119
-						$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
118
+					if ($item->user_can_set_their_price()) {
119
+						$price            = max((float) $item->get_price(), (float) $item->get_minimum_price());
120 120
 						$minimum          = (float) $item->get_minimum_price();
121 121
 						$validate_minimum = '';
122 122
 						$class            = '';
123 123
 						$data_minimum     = '';
124 124
 
125
-						if ( $minimum > 0 ) {
125
+						if ($minimum > 0) {
126 126
 							$validate_minimum = sprintf(
127
-								esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
128
-								strip_tags( wpinv_price( $minimum, $currency ) )
127
+								esc_attr__('The minimum allowed amount is %s', 'invoicing'),
128
+								strip_tags(wpinv_price($minimum, $currency))
129 129
 							);
130 130
 
131 131
 							$class = 'getpaid-validate-minimum-amount';
132 132
 
133
-							$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
133
+							$data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'";
134 134
 						}
135 135
 
136 136
 						?>
137 137
 								<div class="input-group input-group-sm">
138
-								<?php if ( 'left' == $position ) : ?>
138
+								<?php if ('left' == $position) : ?>
139 139
 										<div class="input-group-prepend">
140
-											<span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
140
+											<span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
141 141
 										</div>
142 142
 									<?php endif; ?>
143 143
 
144
-									<input type="text" <?php echo wp_kses_post( $data_minimum ); ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr( getpaid_unstandardize_amount( $price ) ); ?>" placeholder="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price() ) ); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo esc_attr( $class ); ?>" style="width: 64px; line-height: 1; min-height: 35px;">
144
+									<input type="text" <?php echo wp_kses_post($data_minimum); ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr(getpaid_unstandardize_amount($price)); ?>" placeholder="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price())); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo esc_attr($class); ?>" style="width: 64px; line-height: 1; min-height: 35px;">
145 145
 
146
-								<?php if ( ! empty( $validate_minimum ) ) : ?>
146
+								<?php if (!empty($validate_minimum)) : ?>
147 147
 										<div class="invalid-tooltip">
148
-											<?php echo wp_kses_post( $validate_minimum ); ?>
148
+											<?php echo wp_kses_post($validate_minimum); ?>
149 149
 										</div>
150 150
 									<?php endif; ?>
151 151
 
152
-								<?php if ( 'left' != $position ) : ?>
152
+								<?php if ('left' != $position) : ?>
153 153
 										<div class="input-group-append">
154
-											<span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
154
+											<span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
155 155
 										</div>
156 156
 									<?php endif; ?>
157 157
 								</div>
@@ -159,23 +159,23 @@  discard block
 block discarded – undo
159 159
 							<?php
160 160
 
161 161
 						} else {
162
-						echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) );
162
+						echo wp_kses_post(wpinv_price($item->get_price(), $currency));
163 163
 
164 164
 						?>
165
-								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
165
+								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'>
166 166
 						<?php
167 167
 						}
168 168
 
169 169
 					printf(
170 170
                         '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
171
-                        sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) )
171
+                        sprintf(esc_html__('Subtotal: %s', 'invoicing'), wp_kses_post(wpinv_price($item->get_sub_total(), $currency)))
172 172
                     );
173 173
 					}
174 174
 
175 175
 					// Item quantity.
176
-					if ( 'quantity' == $key ) {
176
+					if ('quantity' == $key) {
177 177
 
178
-					if ( $item->allows_quantities() ) {
178
+					if ($item->allows_quantities()) {
179 179
 						?>
180 180
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="0.01" style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required>
181 181
 							<?php
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 }
190 190
 
191 191
 					// Item sub total.
192
-					if ( 'subtotal' == $key ) {
193
-					echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) );
192
+					if ('subtotal' == $key) {
193
+					echo wp_kses_post(wpinv_price($item->get_sub_total(), $currency));
194 194
 					}
195 195
 
196
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
196
+					do_action("getpaid_payment_form_cart_item_$key", $item, $form);
197 197
 				?>
198 198
 
199 199
 			</div>
@@ -204,4 +204,4 @@  discard block
 block discarded – undo
204 204
 
205 205
 </div>
206 206
 <?php
207
-do_action( 'getpaid_payment_form_cart_item', $form, $item );
207
+do_action('getpaid_payment_form_cart_item', $form, $item);
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">
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">
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.
templates/emails/invoice-items.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
  * @var WPInv_Invoice $invoice
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13
-$column_count = count( $columns );
13
+$column_count = count($columns);
14 14
 ?>
15 15
 
16
-<?php do_action( 'wpinv_before_email_items', $invoice ); ?>
16
+<?php do_action('wpinv_before_email_items', $invoice); ?>
17 17
 
18 18
 
19 19
 <div id="wpinv-email-items">
20 20
 
21 21
     <h3 class="invoice-items-title">
22
-        <?php echo sprintf( esc_html__( '%s Items', 'invoicing' ), esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) ); ?>
22
+        <?php echo sprintf(esc_html__('%s Items', 'invoicing'), esc_html(ucfirst($invoice->get_invoice_quote_type()))); ?>
23 23
     </h3>
24 24
 
25 25
     <table class="table table-bordered table-hover">
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 
29 29
             <tr class="wpinv_cart_header_row">
30 30
 
31
-                <?php foreach ( $columns as $key => $label ) : ?>
32
-                    <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr( $key ); ?>">
33
-                        <?php echo esc_html( $label ); ?>
31
+                <?php foreach ($columns as $key => $label) : ?>
32
+                    <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr($key); ?>">
33
+                        <?php echo esc_html($label); ?>
34 34
                     </th>
35 35
                 <?php endforeach; ?>
36 36
 
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
             <?php
44 44
 
45 45
                 // Display the item totals.
46
-                foreach ( $invoice->get_items() as $item ) {
47
-				wpinv_get_template( 'emails/invoice-item.php', compact( 'invoice', 'item', 'columns' ) );
46
+                foreach ($invoice->get_items() as $item) {
47
+				wpinv_get_template('emails/invoice-item.php', compact('invoice', 'item', 'columns'));
48 48
                 }
49 49
 
50 50
                 // Display the fee totals.
51
-                foreach ( $invoice->get_fees() as $fee ) {
52
-				wpinv_get_template( 'emails/fee-item.php', compact( 'invoice', 'fee', 'columns' ) );
51
+                foreach ($invoice->get_fees() as $fee) {
52
+				wpinv_get_template('emails/fee-item.php', compact('invoice', 'fee', 'columns'));
53 53
                 }
54 54
 
55 55
             ?>
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         </tbody>
58 58
 
59 59
         <tfoot>
60
-            <?php wpinv_get_template( 'emails/invoice-totals.php', compact( 'invoice', 'column_count' ) ); ?>
60
+            <?php wpinv_get_template('emails/invoice-totals.php', compact('invoice', 'column_count')); ?>
61 61
         </tfoot>
62 62
     
63 63
     </table>
Please login to merge, or discard this patch.
templates/emails/invoice-item.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,64 +10,64 @@  discard block
 block discarded – undo
10 10
  * @var array $columns
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) || exit;
13
+defined('ABSPATH') || exit;
14 14
 
15 15
 ?>
16 16
 
17
-<?php do_action( 'getpaid_before_email_line_item', $invoice, $item ); ?>
17
+<?php do_action('getpaid_before_email_line_item', $invoice, $item); ?>
18 18
 
19
-<tr class="wpinv_cart_item item-type-<?php echo esc_attr( $item->get_type() ); ?>">
19
+<tr class="wpinv_cart_item item-type-<?php echo esc_attr($item->get_type()); ?>">
20 20
 
21
-    <?php foreach ( array_keys( $columns ) as $column ) : ?>
21
+    <?php foreach (array_keys($columns) as $column) : ?>
22 22
 
23
-        <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr( $column ); ?>">
23
+        <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr($column); ?>">
24 24
             
25 25
             <?php
26 26
 
27 27
                 // Fires before printing a line item column.
28
-                do_action( "getpaid_email_line_item_before_$column", $item, $invoice );
28
+                do_action("getpaid_email_line_item_before_$column", $item, $invoice);
29 29
 
30 30
                 // Item name.
31
-                if ( 'name' == $column ) {
31
+                if ('name' == $column) {
32 32
 
33 33
 				// Display the name.
34
-				echo '<div class="wpinv_email_cart_item_title">' . esc_html( $item->get_name() ) . '</div>';
34
+				echo '<div class="wpinv_email_cart_item_title">' . esc_html($item->get_name()) . '</div>';
35 35
 
36 36
 				// And an optional description.
37 37
 				$description = $item->get_description();
38 38
 
39
-				if ( ! empty( $description ) ) {
40
-					echo "<p class='small'>" . wp_kses_post( $description ) . "</p>";
39
+				if (!empty($description)) {
40
+					echo "<p class='small'>" . wp_kses_post($description) . "</p>";
41 41
                     }
42 42
 }
43 43
 
44 44
                 // Item price.
45
-                if ( 'price' == $column ) {
45
+                if ('price' == $column) {
46 46
 
47 47
 				// Display the item price (or recurring price if this is a renewal invoice)
48 48
 				$price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
49
-				wpinv_the_price( $price, $invoice->get_currency() );
49
+				wpinv_the_price($price, $invoice->get_currency());
50 50
 
51 51
                 }
52 52
 
53 53
                 // Item quantity.
54
-                if ( 'quantity' == $column ) {
54
+                if ('quantity' == $column) {
55 55
 				echo (float) $item->get_quantity();
56 56
                 }
57 57
 
58 58
                 // Tax rate.
59
-                if ( 'tax_rate' == $column ) {
60
-				echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
59
+                if ('tax_rate' == $column) {
60
+				echo floatval(round(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%';
61 61
                 }
62 62
 
63 63
                 // Item sub total.
64
-                if ( 'subtotal' == $column ) {
64
+                if ('subtotal' == $column) {
65 65
 				$subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
66
-				wpinv_the_price( $subtotal, $invoice->get_currency() );
66
+				wpinv_the_price($subtotal, $invoice->get_currency());
67 67
                 }
68 68
 
69 69
                 // Fires when printing a line item column.
70
-                do_action( "getpaid_email_line_item_$column", $item, $invoice );
70
+                do_action("getpaid_email_line_item_$column", $item, $invoice);
71 71
 
72 72
             ?>
73 73
 
@@ -77,4 +77,4 @@  discard block
 block discarded – undo
77 77
 
78 78
 </tr>
79 79
 
80
-<?php do_action( 'getpaid_after_email_line_item', $invoice, $item ); ?>
80
+<?php do_action('getpaid_after_email_line_item', $invoice, $item); ?>
Please login to merge, or discard this patch.
templates/emails/invoice-details.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,45 +8,45 @@  discard block
 block discarded – undo
8 8
  * @var WPInv_Invoice $invoice
9 9
  * @var array $columns
10 10
  */
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13
-$meta_data = getpaid_get_invoice_meta( $invoice );
13
+$meta_data = getpaid_get_invoice_meta($invoice);
14 14
 
15
-if ( isset( $meta_data['status'] ) ) {
15
+if (isset($meta_data['status'])) {
16 16
     $meta_data['status']['value'] = $invoice->get_status_nicename();
17 17
 }
18 18
 
19
-do_action( 'wpinv_email_before_invoice_details', $invoice, $sent_to_admin );
19
+do_action('wpinv_email_before_invoice_details', $invoice, $sent_to_admin);
20 20
 
21 21
 ?>
22 22
 
23 23
 <div id="wpinv-email-details">
24 24
 
25 25
     <h3 class="invoice-details-title">
26
-        <?php echo sprintf( esc_html__( '%s Details', 'invoicing' ), esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) ); ?>
26
+        <?php echo sprintf(esc_html__('%s Details', 'invoicing'), esc_html(ucfirst($invoice->get_invoice_quote_type()))); ?>
27 27
     </h3>
28 28
 
29 29
     <table class="table table-bordered table-sm">
30 30
 
31
-        <?php foreach ( $meta_data as $key => $data ) : ?>
31
+        <?php foreach ($meta_data as $key => $data) : ?>
32 32
 
33
-            <?php if ( ! empty( $data['value'] ) ) : ?>
33
+            <?php if (!empty($data['value'])) : ?>
34 34
 
35
-                <?php do_action( "getpaid_before_email_details_$key", $invoice, $data ); ?>
35
+                <?php do_action("getpaid_before_email_details_$key", $invoice, $data); ?>
36 36
 
37
-                <tr class="getpaid-email-details-<?php echo esc_attr( $key ); ?>">
37
+                <tr class="getpaid-email-details-<?php echo esc_attr($key); ?>">
38 38
 
39 39
                     <td class="getpaid-lable-td">
40
-                        <?php echo esc_html( $data['label'] ); ?>
40
+                        <?php echo esc_html($data['label']); ?>
41 41
                     </td>
42 42
 
43 43
                     <td class="getpaid-value-td">
44
-                        <span class="getpaid-invoice-meta-<?php echo esc_attr( $key ); ?>-value"><?php echo wp_kses_post( $data['value'] ); ?></span>
44
+                        <span class="getpaid-invoice-meta-<?php echo esc_attr($key); ?>-value"><?php echo wp_kses_post($data['value']); ?></span>
45 45
                     </td>
46 46
 
47 47
                 </tr>
48 48
 
49
-                <?php do_action( "getpaid_after_email_details_$key", $invoice, $data ); ?>
49
+                <?php do_action("getpaid_after_email_details_$key", $invoice, $data); ?>
50 50
 
51 51
             <?php endif; ?>
52 52
 
@@ -56,4 +56,4 @@  discard block
 block discarded – undo
56 56
 
57 57
 </div>
58 58
 
59
-<?php do_action( 'wpinv_email_after_invoice_details', $invoice, $sent_to_admin ); ?>
59
+<?php do_action('wpinv_email_after_invoice_details', $invoice, $sent_to_admin); ?>
Please login to merge, or discard this patch.
templates/emails/fee-item.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -10,67 +10,67 @@  discard block
 block discarded – undo
10 10
  * @var array $columns
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) || exit;
13
+defined('ABSPATH') || exit;
14 14
 
15 15
 ?>
16 16
 
17
-<?php do_action( 'getpaid_before_email_fee_item', $invoice, $fee ); ?>
17
+<?php do_action('getpaid_before_email_fee_item', $invoice, $fee); ?>
18 18
 
19 19
 <tr class="wpinv_cart_item item-fee">
20 20
 
21
-    <?php foreach ( array_keys( $columns ) as $column ) : ?>
21
+    <?php foreach (array_keys($columns) as $column) : ?>
22 22
 
23
-        <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr( $column ); ?>">
23
+        <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr($column); ?>">
24 24
             
25 25
             <?php
26 26
 
27 27
                 // Fires before printing a fee item column.
28
-                do_action( "getpaid_email_fee_item_before_$column", $fee, $invoice );
28
+                do_action("getpaid_email_fee_item_before_$column", $fee, $invoice);
29 29
 
30 30
                 // Item name.
31
-                if ( 'name' == $column ) {
31
+                if ('name' == $column) {
32 32
 
33 33
 				// Display the name.
34
-				echo '<div class="wpinv_email_cart_item_title">' . esc_html( $fee['name'] ) . '</div>';
34
+				echo '<div class="wpinv_email_cart_item_title">' . esc_html($fee['name']) . '</div>';
35 35
 
36 36
 				// And an optional description.
37
-				$description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] );
38
-				echo wp_kses_post( "<p class='small'>$description</p>" );
37
+				$description = empty($fee['description']) ? esc_html__('Fee', 'invoicing') : esc_html($fee['description']);
38
+				echo wp_kses_post("<p class='small'>$description</p>");
39 39
 
40 40
                 }
41 41
 
42 42
                 // Item price.
43
-                if ( 'price' == $column ) {
43
+                if ('price' == $column) {
44 44
 
45 45
 				// Display the item price (or recurring price if this is a renewal invoice)
46
-				if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
47
-					wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() );
46
+				if ($invoice->is_recurring() && $invoice->is_renewal()) {
47
+					wpinv_the_price($fee['recurring_fee'], $invoice->get_currency());
48 48
                     } else {
49
-                        wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() );
49
+                        wpinv_the_price($fee['initial_fee'], $invoice->get_currency());
50 50
                     }
51 51
 }
52 52
 
53 53
                 // Item quantity.
54
-                if ( 'quantity' == $column ) {
54
+                if ('quantity' == $column) {
55 55
 				echo '&mdash;';
56 56
                 }
57 57
 
58 58
                 // Item tax.
59
-                if ( 'tax_rate' == $column ) {
59
+                if ('tax_rate' == $column) {
60 60
 				echo '&mdash;';
61 61
                 }
62 62
 
63 63
                 // Item sub total.
64
-                if ( 'subtotal' == $column ) {
65
-				if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
66
-					wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() );
64
+                if ('subtotal' == $column) {
65
+				if ($invoice->is_recurring() && $invoice->is_renewal()) {
66
+					wpinv_the_price($fee['recurring_fee'], $invoice->get_currency());
67 67
                 } else {
68
-                    wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() );
68
+                    wpinv_the_price($fee['initial_fee'], $invoice->get_currency());
69 69
                 }
70 70
                 }
71 71
 
72 72
                 // Fires when printing a line item column.
73
-                do_action( "getpaid_email_fee_item_$column", $fee, $invoice );
73
+                do_action("getpaid_email_fee_item_$column", $fee, $invoice);
74 74
 
75 75
             ?>
76 76
 
@@ -80,4 +80,4 @@  discard block
 block discarded – undo
80 80
 
81 81
 </tr>
82 82
 
83
-<?php do_action( 'getpaid_after_email_fee_item', $invoice, $fee ); ?>
83
+<?php do_action('getpaid_after_email_fee_item', $invoice, $fee); ?>
Please login to merge, or discard this patch.
includes/libraries/wp-all-import/rapid-addon.php 1 patch
Indentation   +802 added lines, -802 removed lines patch added patch discarded remove patch
@@ -10,232 +10,232 @@  discard block
 block discarded – undo
10 10
 
11 11
 if (!class_exists('RapidAddon')) {
12 12
 	
13
-	class RapidAddon {
14
-
15
-		public $name;
16
-		public $slug;
17
-		public $fields;
18
-		public $options = array();
19
-		public $accordions = array();
20
-		public $image_sections = array();
21
-		public $import_function;
22
-		public $post_saved_function;
23
-		public $notice_text;
24
-		public $logger = null;
25
-		public $when_to_run = false;
26
-		public $image_options = array(
27
-			'download_images' => 'yes', 
28
-			'download_featured_delim' => ',', 
29
-			'download_featured_image' => '',
30
-			'gallery_featured_image' => '',
31
-			'gallery_featured_delim' => ',',
32
-			'featured_image' => '',
33
-			'featured_delim' => ',', 
34
-			'search_existing_images' => 1,
35
-			'is_featured' => 0,
36
-			'create_draft' => 'no',
37
-			'set_image_meta_title' => 0,
38
-			'image_meta_title_delim' => ',',
39
-			'image_meta_title' => '',
40
-			'set_image_meta_caption' => 0,
41
-			'image_meta_caption_delim' => ',',
42
-			'image_meta_caption' => '',
43
-			'set_image_meta_alt' => 0,
44
-			'image_meta_alt_delim' => ',',
45
-			'image_meta_alt' => '',
46
-			'set_image_meta_description' => 0,
47
-			'image_meta_description_delim' => ',',
48
-			'image_meta_description_delim_logic' => 'separate',
49
-			'image_meta_description' => '',
50
-			'auto_rename_images' => 0,
51
-			'auto_rename_images_suffix' => '',
52
-			'auto_set_extension' => 0,
53
-			'new_extension' => '',
54
-			'do_not_remove_images' => 1,
13
+    class RapidAddon {
14
+
15
+        public $name;
16
+        public $slug;
17
+        public $fields;
18
+        public $options = array();
19
+        public $accordions = array();
20
+        public $image_sections = array();
21
+        public $import_function;
22
+        public $post_saved_function;
23
+        public $notice_text;
24
+        public $logger = null;
25
+        public $when_to_run = false;
26
+        public $image_options = array(
27
+            'download_images' => 'yes', 
28
+            'download_featured_delim' => ',', 
29
+            'download_featured_image' => '',
30
+            'gallery_featured_image' => '',
31
+            'gallery_featured_delim' => ',',
32
+            'featured_image' => '',
33
+            'featured_delim' => ',', 
34
+            'search_existing_images' => 1,
35
+            'is_featured' => 0,
36
+            'create_draft' => 'no',
37
+            'set_image_meta_title' => 0,
38
+            'image_meta_title_delim' => ',',
39
+            'image_meta_title' => '',
40
+            'set_image_meta_caption' => 0,
41
+            'image_meta_caption_delim' => ',',
42
+            'image_meta_caption' => '',
43
+            'set_image_meta_alt' => 0,
44
+            'image_meta_alt_delim' => ',',
45
+            'image_meta_alt' => '',
46
+            'set_image_meta_description' => 0,
47
+            'image_meta_description_delim' => ',',
48
+            'image_meta_description_delim_logic' => 'separate',
49
+            'image_meta_description' => '',
50
+            'auto_rename_images' => 0,
51
+            'auto_rename_images_suffix' => '',
52
+            'auto_set_extension' => 0,
53
+            'new_extension' => '',
54
+            'do_not_remove_images' => 1,
55 55
             'search_existing_images_logic' => 'by_url'
56
-		);
56
+        );
57 57
 
58
-		protected $isWizard = true;
58
+        protected $isWizard = true;
59 59
 
60
-		function __construct($name, $slug) {
61
-			$this->name = $name;
62
-			$this->slug = $slug;
63
-			if (!empty($_GET['id'])){
64
-				$this->isWizard = false;
65
-			}
60
+        function __construct($name, $slug) {
61
+            $this->name = $name;
62
+            $this->slug = $slug;
63
+            if (!empty($_GET['id'])){
64
+                $this->isWizard = false;
65
+            }
66 66
         }
67 67
         
68
-		function set_import_function($name) {
69
-			$this->import_function = $name;
70
-		}
68
+        function set_import_function($name) {
69
+            $this->import_function = $name;
70
+        }
71 71
 
72
-		function set_post_saved_function($name) {
73
-			$this->post_saved_function = $name;
74
-		}
72
+        function set_post_saved_function($name) {
73
+            $this->post_saved_function = $name;
74
+        }
75 75
 
76
-		function is_active_addon($post_type = null) {
76
+        function is_active_addon($post_type = null) {
77 77
 			
78
-			if ( ! class_exists( 'PMXI_Plugin' ) ) {
79
-				return false;
80
-			}
78
+            if ( ! class_exists( 'PMXI_Plugin' ) ) {
79
+                return false;
80
+            }
81 81
 
82
-			$addon_active = false;
82
+            $addon_active = false;
83 83
 
84
-			if ($post_type !== null) {
85
-				if (@in_array($post_type, $this->active_post_types) or empty($this->active_post_types)) {
86
-					$addon_active = true;
87
-				}
88
-			}
84
+            if ($post_type !== null) {
85
+                if (@in_array($post_type, $this->active_post_types) or empty($this->active_post_types)) {
86
+                    $addon_active = true;
87
+                }
88
+            }
89 89
 
90
-			if ($addon_active){
90
+            if ($addon_active){
91 91
 				
92
-				$current_theme = wp_get_theme();
92
+                $current_theme = wp_get_theme();
93 93
 
94
-				$parent_theme = $current_theme->parent();				
94
+                $parent_theme = $current_theme->parent();				
95 95
 
96
-				$theme_name = $current_theme->get('Name');
96
+                $theme_name = $current_theme->get('Name');
97 97
 				
98
-				$addon_active = (@in_array($theme_name, $this->active_themes) or empty($this->active_themes)) ? true : false;
98
+                $addon_active = (@in_array($theme_name, $this->active_themes) or empty($this->active_themes)) ? true : false;
99 99
 
100
-				if ( ! $addon_active and $parent_theme ){
101
-					$parent_theme_name = $parent_theme->get('Name');
102
-					$addon_active = (@in_array($parent_theme_name, $this->active_themes) or empty($this->active_themes)) ? true : false;
100
+                if ( ! $addon_active and $parent_theme ){
101
+                    $parent_theme_name = $parent_theme->get('Name');
102
+                    $addon_active = (@in_array($parent_theme_name, $this->active_themes) or empty($this->active_themes)) ? true : false;
103 103
 
104
-				}
104
+                }
105 105
 				
106
-				if ( $addon_active and ! empty($this->active_plugins) ){
106
+                if ( $addon_active and ! empty($this->active_plugins) ){
107 107
 
108
-					include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
108
+                    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
109 109
 
110
-					foreach ($this->active_plugins as $plugin) {
111
-						if ( ! is_plugin_active($plugin) ) {
112
-							$addon_active = false;
113
-							break;
114
-						}
115
-					}					
116
-				}
110
+                    foreach ($this->active_plugins as $plugin) {
111
+                        if ( ! is_plugin_active($plugin) ) {
112
+                            $addon_active = false;
113
+                            break;
114
+                        }
115
+                    }					
116
+                }
117 117
 
118
-			}
118
+            }
119 119
 
120
-			if ($this->when_to_run == "always") {
121
-				$addon_active = true;
122
-			}
120
+            if ($this->when_to_run == "always") {
121
+                $addon_active = true;
122
+            }
123 123
 
124
-			return apply_filters('rapid_is_active_add_on', $addon_active, $post_type, $this->slug);
125
-		}
124
+            return apply_filters('rapid_is_active_add_on', $addon_active, $post_type, $this->slug);
125
+        }
126 126
 		
127
-		/**
128
-		* 
129
-		* Add-On Initialization
130
-		*
131
-		* @param array $conditions - list of supported themes and post types
132
-		*
133
-		*/
134
-		function run($conditions = array()) {
135
-
136
-			if (empty($conditions)) {
137
-				$this->when_to_run = "always";
138
-			}
127
+        /**
128
+         * 
129
+         * Add-On Initialization
130
+         *
131
+         * @param array $conditions - list of supported themes and post types
132
+         *
133
+         */
134
+        function run($conditions = array()) {
135
+
136
+            if (empty($conditions)) {
137
+                $this->when_to_run = "always";
138
+            }
139 139
 
140
-			@$this->active_post_types = ( ! empty($conditions['post_types'])) ? $conditions['post_types'] : array();
141
-			@$this->active_themes = ( ! empty($conditions['themes'])) ? $conditions['themes'] : array();
142
-			@$this->active_plugins = ( ! empty($conditions['plugins'])) ? $conditions['plugins'] : array();			
140
+            @$this->active_post_types = ( ! empty($conditions['post_types'])) ? $conditions['post_types'] : array();
141
+            @$this->active_themes = ( ! empty($conditions['themes'])) ? $conditions['themes'] : array();
142
+            @$this->active_plugins = ( ! empty($conditions['plugins'])) ? $conditions['plugins'] : array();			
143 143
 
144
-			add_filter('pmxi_addons', array($this, 'wpai_api_register'));
145
-			add_filter('wp_all_import_addon_parse', array($this, 'wpai_api_parse'));
146
-			add_filter('wp_all_import_addon_import', array($this, 'wpai_api_import'));
147
-			add_filter('wp_all_import_addon_saved_post', array($this, 'wpai_api_post_saved'));
148
-			add_filter('pmxi_options_options', array($this, 'wpai_api_options'));
144
+            add_filter('pmxi_addons', array($this, 'wpai_api_register'));
145
+            add_filter('wp_all_import_addon_parse', array($this, 'wpai_api_parse'));
146
+            add_filter('wp_all_import_addon_import', array($this, 'wpai_api_import'));
147
+            add_filter('wp_all_import_addon_saved_post', array($this, 'wpai_api_post_saved'));
148
+            add_filter('pmxi_options_options', array($this, 'wpai_api_options'));
149 149
             add_filter('wp_all_import_image_sections', array($this, 'additional_sections'), 10, 1);
150 150
             add_filter('pmxi_custom_types', array($this, 'filter_post_types'), 10, 2);
151 151
             add_filter('pmxi_post_list_order', array($this,'sort_post_types'), 10, 1);
152 152
             add_filter('wp_all_import_post_type_image', array($this, 'post_type_image'), 10, 1 );
153
-			add_action('pmxi_extend_options_featured',  array($this, 'wpai_api_metabox'), 10, 2);
153
+            add_action('pmxi_extend_options_featured',  array($this, 'wpai_api_metabox'), 10, 2);
154 154
             add_action('admin_init', array($this, 'admin_notice_ignore'));
155 155
         }        
156 156
 
157
-		function parse($data) {
157
+        function parse($data) {
158 158
 			
159
-			if ( ! $this->is_active_addon($data['import']->options['custom_type'])) return false;
159
+            if ( ! $this->is_active_addon($data['import']->options['custom_type'])) return false;
160 160
 
161
-			$parsedData = $this->helper_parse($data, $this->options_array());
162
-			return $parsedData;
161
+            $parsedData = $this->helper_parse($data, $this->options_array());
162
+            return $parsedData;
163 163
 
164
-		}
164
+        }
165 165
 
166 166
 
167
-		function add_field($field_slug, $field_name, $field_type, $enum_values = null, $tooltip = "", $is_html = true, $default_text = '') {
167
+        function add_field($field_slug, $field_name, $field_type, $enum_values = null, $tooltip = "", $is_html = true, $default_text = '') {
168 168
 
169
-			$field =  array("name" => $field_name, "type" => $field_type, "enum_values" => $enum_values, "tooltip" => $tooltip, "is_sub_field" => false, "is_main_field" => false, "slug" => $field_slug, "is_html" => $is_html, 'default_text' => $default_text);
169
+            $field =  array("name" => $field_name, "type" => $field_type, "enum_values" => $enum_values, "tooltip" => $tooltip, "is_sub_field" => false, "is_main_field" => false, "slug" => $field_slug, "is_html" => $is_html, 'default_text' => $default_text);
170 170
 
171
-			$this->fields[$field_slug] = $field;
171
+            $this->fields[$field_slug] = $field;
172 172
 
173
-			if ( ! empty($enum_values) ){
174
-				foreach ($enum_values as $key => $value) {
175
-					if (is_array($value))
176
-					{
177
-						if ($field['type'] == 'accordion')
178
-						{
179
-							$this->fields[$value['slug']]['is_sub_field'] = true;
180
-						}
181
-						else
182
-						{
183
-							foreach ($value as $n => $param) {							
184
-								if (is_array($param) and ! empty($this->fields[$param['slug']])){
185
-									$this->fields[$param['slug']]['is_sub_field'] = true;								
186
-								}
187
-							}
188
-						}
189
-					}
190
-				}
191
-			}
173
+            if ( ! empty($enum_values) ){
174
+                foreach ($enum_values as $key => $value) {
175
+                    if (is_array($value))
176
+                    {
177
+                        if ($field['type'] == 'accordion')
178
+                        {
179
+                            $this->fields[$value['slug']]['is_sub_field'] = true;
180
+                        }
181
+                        else
182
+                        {
183
+                            foreach ($value as $n => $param) {							
184
+                                if (is_array($param) and ! empty($this->fields[$param['slug']])){
185
+                                    $this->fields[$param['slug']]['is_sub_field'] = true;								
186
+                                }
187
+                            }
188
+                        }
189
+                    }
190
+                }
191
+            }
192 192
 
193
-			return $field;
193
+            return $field;
194 194
 
195
-		}
195
+        }
196 196
 
197
-		function add_acf_field($field){
198
-			$this->fields[$field->post_name] = array(
199
-				'type' => 'acf',
200
-				'field_obj' => $field
201
-			);
202
-		}
197
+        function add_acf_field($field){
198
+            $this->fields[$field->post_name] = array(
199
+                'type' => 'acf',
200
+                'field_obj' => $field
201
+            );
202
+        }
203 203
 
204
-		private $acfGroups = array();
204
+        private $acfGroups = array();
205 205
 
206
-		function use_acf_group($acf_group){
207
-			$this->add_text(
208
-				'<div class="postbox acf_postbox default acf_signle_group rad4">
206
+        function use_acf_group($acf_group){
207
+            $this->add_text(
208
+                '<div class="postbox acf_postbox default acf_signle_group rad4">
209 209
     <h3 class="hndle" style="margin-top:0;"><span>'.$acf_group['title'].'</span></h3>
210 210
 	    <div class="inside">');
211
-			$acf_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => $acf_group['ID'], 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC'));
212
-			if (!empty($acf_fields)){
213
-				foreach ($acf_fields as $field) {
214
-					$this->add_acf_field($field);
215
-				}
216
-			}
217
-			$this->add_text('</div></div>');
218
-			$this->acfGroups[] = $acf_group['ID'];
219
-			add_filter('wp_all_import_acf_is_show_group', array($this, 'acf_is_show_group'), 10, 2);
220
-		}
221
-
222
-		function acf_is_show_group($is_show, $acf_group){
223
-			return (in_array($acf_group['ID'], $this->acfGroups)) ? false : true;
224
-		}
225
-
226
-		/**
227
-		* 
228
-		* Add an option to WP All Import options list
229
-		*
230
-		* @param string $slug - option name
231
-		* @param string $default_value - default option value
232
-		*
233
-		*/
234
-		function add_option($slug, $default_value = ''){
235
-			$this->options[$slug] = $default_value;
236
-		}
211
+            $acf_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => $acf_group['ID'], 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC'));
212
+            if (!empty($acf_fields)){
213
+                foreach ($acf_fields as $field) {
214
+                    $this->add_acf_field($field);
215
+                }
216
+            }
217
+            $this->add_text('</div></div>');
218
+            $this->acfGroups[] = $acf_group['ID'];
219
+            add_filter('wp_all_import_acf_is_show_group', array($this, 'acf_is_show_group'), 10, 2);
220
+        }
237 221
 
238
-		function options_array() {
222
+        function acf_is_show_group($is_show, $acf_group){
223
+            return (in_array($acf_group['ID'], $this->acfGroups)) ? false : true;
224
+        }
225
+
226
+        /**
227
+         * 
228
+         * Add an option to WP All Import options list
229
+         *
230
+         * @param string $slug - option name
231
+         * @param string $default_value - default option value
232
+         *
233
+         */
234
+        function add_option($slug, $default_value = ''){
235
+            $this->options[$slug] = $default_value;
236
+        }
237
+
238
+        function options_array() {
239 239
 
240 240
             $options_list = array();
241 241
             
@@ -255,528 +255,528 @@  discard block
 block discarded – undo
255 255
 
256 256
             }			
257 257
 
258
-			if ( ! empty($this->options) ){
259
-				foreach ($this->options as $slug => $value) {
260
-					$options_arr[$slug] = $value;
261
-				}
262
-			}
258
+            if ( ! empty($this->options) ){
259
+                foreach ($this->options as $slug => $value) {
260
+                    $options_arr[$slug] = $value;
261
+                }
262
+            }
263 263
 
264
-			$options_arr[$this->slug]   = $options_list;
265
-			$options_arr['rapid_addon'] = plugin_basename( __FILE__ );
264
+            $options_arr[$this->slug]   = $options_list;
265
+            $options_arr['rapid_addon'] = plugin_basename( __FILE__ );
266 266
 
267
-			return $options_arr;
267
+            return $options_arr;
268 268
 
269
-		}
269
+        }
270 270
 
271
-		function wpai_api_options($all_options) {
271
+        function wpai_api_options($all_options) {
272 272
 
273
-			$all_options = $all_options + $this->options_array();
273
+            $all_options = $all_options + $this->options_array();
274 274
 
275
-			return $all_options;
275
+            return $all_options;
276 276
 
277
-		}
277
+        }
278 278
 
279 279
 
280
-		function wpai_api_register($addons) {
280
+        function wpai_api_register($addons) {
281 281
 
282
-			if (empty($addons[$this->slug])) {
283
-				$addons[$this->slug] = 1;
284
-			}
282
+            if (empty($addons[$this->slug])) {
283
+                $addons[$this->slug] = 1;
284
+            }
285 285
 
286
-			return $addons;
286
+            return $addons;
287 287
 
288
-		}
288
+        }
289 289
 
290 290
 
291
-		function wpai_api_parse($functions) {
291
+        function wpai_api_parse($functions) {
292 292
 
293
-			$functions[$this->slug] = array($this, 'parse');
294
-			return $functions;
293
+            $functions[$this->slug] = array($this, 'parse');
294
+            return $functions;
295 295
 
296
-		}
296
+        }
297 297
 
298
-		function wpai_api_post_saved($functions){
299
-			$functions[$this->slug] = array($this, 'post_saved');
300
-			return $functions;
301
-		}
298
+        function wpai_api_post_saved($functions){
299
+            $functions[$this->slug] = array($this, 'post_saved');
300
+            return $functions;
301
+        }
302 302
 
303 303
 
304
-		function wpai_api_import($functions) {
304
+        function wpai_api_import($functions) {
305 305
 
306
-			$functions[$this->slug] = array($this, 'import');
307
-			return $functions;
306
+            $functions[$this->slug] = array($this, 'import');
307
+            return $functions;
308 308
 
309
-		}
309
+        }
310 310
 
311
-		function post_saved( $importData ){
311
+        function post_saved( $importData ){
312 312
 
313
-			if (is_callable($this->post_saved_function))
314
-				call_user_func($this->post_saved_function, $importData['pid'], $importData['import'], $importData['logger']);
313
+            if (is_callable($this->post_saved_function))
314
+                call_user_func($this->post_saved_function, $importData['pid'], $importData['import'], $importData['logger']);
315 315
 			
316
-		}
316
+        }
317 317
 
318
-		function import($importData, $parsedData) {
318
+        function import($importData, $parsedData) {
319 319
 
320
-			if (!$this->is_active_addon($importData['post_type'])) {
321
-				return;
322
-			}
320
+            if (!$this->is_active_addon($importData['post_type'])) {
321
+                return;
322
+            }
323 323
 
324
-			$import_options = $importData['import']['options'][$this->slug];
324
+            $import_options = $importData['import']['options'][$this->slug];
325 325
 
326
-	//		echo "<pre>";
327
-	//		print_r($import_options);
328
-	//		echo "</pre>";
326
+    //		echo "<pre>";
327
+    //		print_r($import_options);
328
+    //		echo "</pre>";
329 329
 
330
-			if ( ! empty($parsedData) )	{
330
+            if ( ! empty($parsedData) )	{
331 331
 
332
-				$this->logger = $importData['logger'];
332
+                $this->logger = $importData['logger'];
333 333
 
334
-				$post_id = $importData['pid'];
335
-				$index = $importData['i'];
336
-				$data = array();
337
-				if (!empty($this->fields)){
338
-					foreach ($this->fields as $field_slug => $field_params) {
339
-						if (in_array($field_params['type'], array('title', 'plain_text'))) continue;
340
-						switch ($field_params['type']) {
334
+                $post_id = $importData['pid'];
335
+                $index = $importData['i'];
336
+                $data = array();
337
+                if (!empty($this->fields)){
338
+                    foreach ($this->fields as $field_slug => $field_params) {
339
+                        if (in_array($field_params['type'], array('title', 'plain_text'))) continue;
340
+                        switch ($field_params['type']) {
341 341
 
342
-							case 'image':
342
+                            case 'image':
343 343
 								
344
-								// import the specified image, then set the value of the field to the image ID in the media library
344
+                                // import the specified image, then set the value of the field to the image ID in the media library
345 345
 
346
-								$image_url_or_path = $parsedData[$field_slug][$index];
346
+                                $image_url_or_path = $parsedData[$field_slug][$index];
347 347
 
348
-								if ( ! array_key_exists( $field_slug, $import_options['download_image'] ) ) {
349
-									continue 2;
350
-								}
348
+                                if ( ! array_key_exists( $field_slug, $import_options['download_image'] ) ) {
349
+                                    continue 2;
350
+                                }
351 351
 
352
-								$download = $import_options['download_image'][$field_slug];
352
+                                $download = $import_options['download_image'][$field_slug];
353 353
 
354
-								$uploaded_image = PMXI_API::upload_image($post_id, $image_url_or_path, $download, $importData['logger'], true, "", "images", true, $importData['articleData']);
354
+                                $uploaded_image = PMXI_API::upload_image($post_id, $image_url_or_path, $download, $importData['logger'], true, "", "images", true, $importData['articleData']);
355 355
 
356
-								$data[$field_slug] = array(
357
-									"attachment_id" => $uploaded_image,
358
-									"image_url_or_path" => $image_url_or_path,
359
-									"download" => $download
360
-								);
356
+                                $data[$field_slug] = array(
357
+                                    "attachment_id" => $uploaded_image,
358
+                                    "image_url_or_path" => $image_url_or_path,
359
+                                    "download" => $download
360
+                                );
361 361
 
362
-								break;
362
+                                break;
363 363
 
364
-							case 'file':
364
+                            case 'file':
365 365
 
366
-								$image_url_or_path = $parsedData[$field_slug][$index];
366
+                                $image_url_or_path = $parsedData[$field_slug][$index];
367 367
 
368
-								if ( ! array_key_exists( $field_slug, $import_options['download_image'] ) ) {
369
-									continue 2;
370
-								}
368
+                                if ( ! array_key_exists( $field_slug, $import_options['download_image'] ) ) {
369
+                                    continue 2;
370
+                                }
371 371
 
372
-								$download = $import_options['download_image'][$field_slug];
372
+                                $download = $import_options['download_image'][$field_slug];
373 373
 
374
-								$uploaded_file = PMXI_API::upload_image($post_id, $image_url_or_path, $download, $importData['logger'], true, "", "files", true, $importData['articleData']);
374
+                                $uploaded_file = PMXI_API::upload_image($post_id, $image_url_or_path, $download, $importData['logger'], true, "", "files", true, $importData['articleData']);
375 375
 
376
-								$data[$field_slug] = array(
377
-									"attachment_id" => $uploaded_file,
378
-									"image_url_or_path" => $image_url_or_path,
379
-									"download" => $download
380
-								);
376
+                                $data[$field_slug] = array(
377
+                                    "attachment_id" => $uploaded_file,
378
+                                    "image_url_or_path" => $image_url_or_path,
379
+                                    "download" => $download
380
+                                );
381 381
 
382
-								break;
382
+                                break;
383 383
 							
384
-							default:
385
-								// set the field data to the value of the field after it's been parsed
386
-								$data[$field_slug] = $parsedData[$field_slug][$index];
387
-								break;
388
-						}					
384
+                            default:
385
+                                // set the field data to the value of the field after it's been parsed
386
+                                $data[$field_slug] = $parsedData[$field_slug][$index];
387
+                                break;
388
+                        }					
389
+
390
+                        // apply mapping rules if they exist
391
+                        if (!empty($import_options['mapping'][$field_slug])) {
392
+                            $mapping_rules = json_decode($import_options['mapping'][$field_slug], true);
393
+
394
+                            if (!empty($mapping_rules) and is_array($mapping_rules)) {
395
+                                foreach ($mapping_rules as $rule_number => $map_to) {
396
+                                    if (isset($map_to[trim($data[$field_slug])])){
397
+                                        $data[$field_slug] = trim($map_to[trim($data[$field_slug])]);
398
+                                        break;
399
+                                    }
400
+                                }
401
+                            }
402
+                        }
403
+                        // --------------------
404
+                    }
405
+                }				
389 406
 
390
-						// apply mapping rules if they exist
391
-						if (!empty($import_options['mapping'][$field_slug])) {
392
-							$mapping_rules = json_decode($import_options['mapping'][$field_slug], true);
407
+                call_user_func($this->import_function, $post_id, $data, $importData['import'], $importData['articleData'], $importData['logger']);
408
+            }
393 409
 
394
-							if (!empty($mapping_rules) and is_array($mapping_rules)) {
395
-								foreach ($mapping_rules as $rule_number => $map_to) {
396
-									if (isset($map_to[trim($data[$field_slug])])){
397
-										$data[$field_slug] = trim($map_to[trim($data[$field_slug])]);
398
-										break;
399
-									}
400
-								}
401
-							}
402
-						}
403
-						// --------------------
404
-					}
405
-				}				
410
+        }
406 411
 
407
-				call_user_func($this->import_function, $post_id, $data, $importData['import'], $importData['articleData'], $importData['logger']);
408
-			}
409 412
 
410
-		}
413
+        function wpai_api_metabox($post_type, $current_values) {
411 414
 
415
+            if (!$this->is_active_addon($post_type)) {
416
+                return;
417
+            }
412 418
 
413
-		function wpai_api_metabox($post_type, $current_values) {
419
+            echo $this->helper_metabox_top($this->name);
414 420
 
415
-			if (!$this->is_active_addon($post_type)) {
416
-				return;
417
-			}
421
+            $visible_fields = 0;
418 422
 
419
-			echo $this->helper_metabox_top($this->name);
423
+            foreach ($this->fields as $field_slug => $field_params) {
424
+                if ($field_params['is_sub_field']) continue;
425
+                $visible_fields++;
426
+            }
420 427
 
421
-			$visible_fields = 0;
428
+            $counter = 0;
422 429
 
423
-			foreach ($this->fields as $field_slug => $field_params) {
424
-				if ($field_params['is_sub_field']) continue;
425
-				$visible_fields++;
426
-			}
430
+            foreach ($this->fields as $field_slug => $field_params) {				
427 431
 
428
-			$counter = 0;
432
+                // do not render sub fields
433
+                if ($field_params['is_sub_field']) continue;		
429 434
 
430
-			foreach ($this->fields as $field_slug => $field_params) {				
435
+                $counter++;		
431 436
 
432
-				// do not render sub fields
433
-				if ($field_params['is_sub_field']) continue;		
437
+                $this->render_field($field_params, $field_slug, $current_values, $visible_fields == $counter);										
434 438
 
435
-				$counter++;		
439
+                //if ( $field_params['type'] != 'accordion' ) echo "<br />";				
436 440
 
437
-				$this->render_field($field_params, $field_slug, $current_values, $visible_fields == $counter);										
441
+            }
438 442
 
439
-				//if ( $field_params['type'] != 'accordion' ) echo "<br />";				
443
+            echo $this->helper_metabox_bottom();
444
+
445
+            if ( ! empty($this->image_sections) ){				
446
+                $is_images_section_enabled = apply_filters('wp_all_import_is_images_section_enabled', true, $post_type);						
447
+                foreach ($this->image_sections as $k => $section) {
448
+                    $section_options = array();
449
+                    foreach ($this->image_options as $slug => $value) {
450
+                        $section_options[$section['slug'] . $slug] = $value;
451
+                    }										
452
+                    if ( ! $is_images_section_enabled and ! $k ){
453
+                        $section_options[$section['slug'] . 'is_featured'] = 1;
454
+                    }
455
+                    PMXI_API::add_additional_images_section($section['title'], $section['slug'], $current_values, '', true, false, $section['type']);
456
+                }
457
+            }
440 458
 
441
-			}
459
+        }		
442 460
 
443
-			echo $this->helper_metabox_bottom();
461
+        function render_field($field_params, $field_slug, $current_values, $in_the_bottom = false){
444 462
 
445
-			if ( ! empty($this->image_sections) ){				
446
-				$is_images_section_enabled = apply_filters('wp_all_import_is_images_section_enabled', true, $post_type);						
447
-				foreach ($this->image_sections as $k => $section) {
448
-					$section_options = array();
449
-					foreach ($this->image_options as $slug => $value) {
450
-						$section_options[$section['slug'] . $slug] = $value;
451
-					}										
452
-					if ( ! $is_images_section_enabled and ! $k ){
453
-						$section_options[$section['slug'] . 'is_featured'] = 1;
454
-					}
455
-					PMXI_API::add_additional_images_section($section['title'], $section['slug'], $current_values, '', true, false, $section['type']);
456
-				}
457
-			}
458
-
459
-		}		
460
-
461
-		function render_field($field_params, $field_slug, $current_values, $in_the_bottom = false){
462
-
463
-			if (!isset($current_values[$this->slug][$field_slug])) {
464
-				$current_values[$this->slug][$field_slug] = isset($field_params['default_text']) ? $field_params['default_text'] : '';
465
-			}
466
-
467
-			if ($field_params['type'] == 'text') {
468
-
469
-				PMXI_API::add_field(
470
-					'simple',
471
-					$field_params['name'],
472
-					array(
473
-						'tooltip' => $field_params['tooltip'],
474
-						'field_name' => $this->slug."[".$field_slug."]",
475
-						'field_value' => ( $current_values[$this->slug][$field_slug] == '' && $this->isWizard ) ? $field_params['default_text'] : $current_values[$this->slug][$field_slug]
476
-					)
477
-				);
478
-
479
-			} else if ($field_params['type'] == 'textarea') {
480
-
481
-				PMXI_API::add_field(
482
-					'textarea',
483
-					$field_params['name'],
484
-					array(
485
-						'tooltip' => $field_params['tooltip'],
486
-						'field_name' => $this->slug."[".$field_slug."]",
487
-						'field_value' => ( $current_values[$this->slug][$field_slug] == '' && $this->isWizard ) ? $field_params['default_text'] : $current_values[$this->slug][$field_slug]
488
-					)
489
-				);
490
-
491
-			} else if ($field_params['type'] == 'wp_editor') {
492
-
493
-				PMXI_API::add_field(
494
-					'wp_editor',
495
-					$field_params['name'],
496
-					array(
497
-						'tooltip' => $field_params['tooltip'],
498
-						'field_name' => $this->slug."[".$field_slug."]",
499
-						'field_value' => ( $current_values[$this->slug][$field_slug] == '' && $this->isWizard ) ? $field_params['default_text'] : $current_values[$this->slug][$field_slug]
500
-					)
501
-				);
502
-
503
-			} else if ($field_params['type'] == 'image' or $field_params['type'] == 'file') {
463
+            if (!isset($current_values[$this->slug][$field_slug])) {
464
+                $current_values[$this->slug][$field_slug] = isset($field_params['default_text']) ? $field_params['default_text'] : '';
465
+            }
466
+
467
+            if ($field_params['type'] == 'text') {
468
+
469
+                PMXI_API::add_field(
470
+                    'simple',
471
+                    $field_params['name'],
472
+                    array(
473
+                        'tooltip' => $field_params['tooltip'],
474
+                        'field_name' => $this->slug."[".$field_slug."]",
475
+                        'field_value' => ( $current_values[$this->slug][$field_slug] == '' && $this->isWizard ) ? $field_params['default_text'] : $current_values[$this->slug][$field_slug]
476
+                    )
477
+                );
478
+
479
+            } else if ($field_params['type'] == 'textarea') {
480
+
481
+                PMXI_API::add_field(
482
+                    'textarea',
483
+                    $field_params['name'],
484
+                    array(
485
+                        'tooltip' => $field_params['tooltip'],
486
+                        'field_name' => $this->slug."[".$field_slug."]",
487
+                        'field_value' => ( $current_values[$this->slug][$field_slug] == '' && $this->isWizard ) ? $field_params['default_text'] : $current_values[$this->slug][$field_slug]
488
+                    )
489
+                );
490
+
491
+            } else if ($field_params['type'] == 'wp_editor') {
492
+
493
+                PMXI_API::add_field(
494
+                    'wp_editor',
495
+                    $field_params['name'],
496
+                    array(
497
+                        'tooltip' => $field_params['tooltip'],
498
+                        'field_name' => $this->slug."[".$field_slug."]",
499
+                        'field_value' => ( $current_values[$this->slug][$field_slug] == '' && $this->isWizard ) ? $field_params['default_text'] : $current_values[$this->slug][$field_slug]
500
+                    )
501
+                );
502
+
503
+            } else if ($field_params['type'] == 'image' or $field_params['type'] == 'file') {
504 504
 				
505
-				if (!isset($current_values[$this->slug]['download_image'][$field_slug])) { $current_values[$this->slug]['download_image'][$field_slug] = ''; }
506
-
507
-				PMXI_API::add_field(
508
-					$field_params['type'],
509
-					$field_params['name'],
510
-					array(
511
-						'tooltip' => $field_params['tooltip'],
512
-						'field_name' => $this->slug."[".$field_slug."]",
513
-						'field_value' => $current_values[$this->slug][$field_slug],
514
-						'download_image' => $current_values[$this->slug]['download_image'][$field_slug],
515
-						'field_key' => $field_slug,
516
-						'addon_prefix' => $this->slug
517
-
518
-					)
519
-				);
520
-
521
-			} else if ($field_params['type'] == 'radio') {					
505
+                if (!isset($current_values[$this->slug]['download_image'][$field_slug])) { $current_values[$this->slug]['download_image'][$field_slug] = ''; }
506
+
507
+                PMXI_API::add_field(
508
+                    $field_params['type'],
509
+                    $field_params['name'],
510
+                    array(
511
+                        'tooltip' => $field_params['tooltip'],
512
+                        'field_name' => $this->slug."[".$field_slug."]",
513
+                        'field_value' => $current_values[$this->slug][$field_slug],
514
+                        'download_image' => $current_values[$this->slug]['download_image'][$field_slug],
515
+                        'field_key' => $field_slug,
516
+                        'addon_prefix' => $this->slug
517
+
518
+                    )
519
+                );
520
+
521
+            } else if ($field_params['type'] == 'radio') {					
522 522
 				
523
-				if (!isset($current_values[$this->slug]['mapping'][$field_slug])) { $current_values[$this->slug]['mapping'][$field_slug] = array(); }
524
-				if (!isset($current_values[$this->slug]['xpaths'][$field_slug])) { $current_values[$this->slug]['xpaths'][$field_slug] = ''; }
525
-
526
-				PMXI_API::add_field(
527
-					'enum',
528
-					$field_params['name'],
529
-					array(
530
-						'tooltip' => $field_params['tooltip'],
531
-						'field_name' => $this->slug."[".$field_slug."]",
532
-						'field_value' => $current_values[$this->slug][$field_slug],
533
-						'enum_values' => $field_params['enum_values'],
534
-						'mapping' => true,
535
-						'field_key' => $field_slug,
536
-						'mapping_rules' => $current_values[$this->slug]['mapping'][$field_slug],
537
-						'xpath' => $current_values[$this->slug]['xpaths'][$field_slug],
538
-						'addon_prefix' => $this->slug,
539
-						'sub_fields' => $this->get_sub_fields($field_params, $field_slug, $current_values)
540
-					)
541
-				);
542
-
543
-			} else if($field_params['type'] == 'accordion') {
544
-
545
-				PMXI_API::add_field(
546
-					'accordion',
547
-					$field_params['name'],
548
-					array(						
549
-						'tooltip' => $field_params['tooltip'],
550
-						'field_name' => $this->slug."[".$field_slug."]",																
551
-						'field_key' => $field_slug,								
552
-						'addon_prefix' => $this->slug,
553
-						'sub_fields' => $this->get_sub_fields($field_params, $field_slug, $current_values),
554
-						'in_the_bottom' => $in_the_bottom						
555
-					)
556
-				);
557
-
558
-			} else if($field_params['type'] == 'acf') {
559
-				$fieldData = (!empty($field_params['field_obj']->post_content)) ? unserialize($field_params['field_obj']->post_content) : array();
560
-				$fieldData['ID']    = $field_params['field_obj']->ID;
561
-				$fieldData['id']    = $field_params['field_obj']->ID;
562
-				$fieldData['label'] = $field_params['field_obj']->post_title;
563
-				$fieldData['key']   = $field_params['field_obj']->post_name;
564
-				if (empty($fieldData['name'])) $fieldData['name'] = $field_params['field_obj']->post_excerpt;
565
-				if (function_exists('pmai_render_field')) {
566
-					echo pmai_render_field($fieldData, ( ! empty($current_values) ) ? $current_values : array() );
567
-				}
568
-			} else if($field_params['type'] == 'title'){
569
-				?>
523
+                if (!isset($current_values[$this->slug]['mapping'][$field_slug])) { $current_values[$this->slug]['mapping'][$field_slug] = array(); }
524
+                if (!isset($current_values[$this->slug]['xpaths'][$field_slug])) { $current_values[$this->slug]['xpaths'][$field_slug] = ''; }
525
+
526
+                PMXI_API::add_field(
527
+                    'enum',
528
+                    $field_params['name'],
529
+                    array(
530
+                        'tooltip' => $field_params['tooltip'],
531
+                        'field_name' => $this->slug."[".$field_slug."]",
532
+                        'field_value' => $current_values[$this->slug][$field_slug],
533
+                        'enum_values' => $field_params['enum_values'],
534
+                        'mapping' => true,
535
+                        'field_key' => $field_slug,
536
+                        'mapping_rules' => $current_values[$this->slug]['mapping'][$field_slug],
537
+                        'xpath' => $current_values[$this->slug]['xpaths'][$field_slug],
538
+                        'addon_prefix' => $this->slug,
539
+                        'sub_fields' => $this->get_sub_fields($field_params, $field_slug, $current_values)
540
+                    )
541
+                );
542
+
543
+            } else if($field_params['type'] == 'accordion') {
544
+
545
+                PMXI_API::add_field(
546
+                    'accordion',
547
+                    $field_params['name'],
548
+                    array(						
549
+                        'tooltip' => $field_params['tooltip'],
550
+                        'field_name' => $this->slug."[".$field_slug."]",																
551
+                        'field_key' => $field_slug,								
552
+                        'addon_prefix' => $this->slug,
553
+                        'sub_fields' => $this->get_sub_fields($field_params, $field_slug, $current_values),
554
+                        'in_the_bottom' => $in_the_bottom						
555
+                    )
556
+                );
557
+
558
+            } else if($field_params['type'] == 'acf') {
559
+                $fieldData = (!empty($field_params['field_obj']->post_content)) ? unserialize($field_params['field_obj']->post_content) : array();
560
+                $fieldData['ID']    = $field_params['field_obj']->ID;
561
+                $fieldData['id']    = $field_params['field_obj']->ID;
562
+                $fieldData['label'] = $field_params['field_obj']->post_title;
563
+                $fieldData['key']   = $field_params['field_obj']->post_name;
564
+                if (empty($fieldData['name'])) $fieldData['name'] = $field_params['field_obj']->post_excerpt;
565
+                if (function_exists('pmai_render_field')) {
566
+                    echo pmai_render_field($fieldData, ( ! empty($current_values) ) ? $current_values : array() );
567
+                }
568
+            } else if($field_params['type'] == 'title'){
569
+                ?>
570 570
 				<h4 class="wpallimport-add-on-options-title"><?php esc_html_e($field_params['name'], 'wp_all_import_plugin'); ?><?php if ( ! empty($field_params['tooltip'])): ?><a href="#help" class="wpallimport-help" title="<?php echo $field_params['tooltip']; ?>" style="position:relative; top: -1px;">?</a><?php endif; ?></h4>				
571 571
 				<?php
572 572
 
573
-			} else if($field_params['type'] == 'plain_text'){
574
-				if ($field_params['is_html']):					
575
-					echo $field_params['name'];				
576
-				else:
577
-					?>
573
+            } else if($field_params['type'] == 'plain_text'){
574
+                if ($field_params['is_html']):					
575
+                    echo $field_params['name'];				
576
+                else:
577
+                    ?>
578 578
 					<p style="margin: 0 0 12px 0;"><?php echo $field_params['name'];?></p>
579 579
 					<?php
580
-				endif;
581
-			}
580
+                endif;
581
+            }
582 582
 
583 583
 
584
-		}
585
-		/**
586
-		*
587
-		* Helper function for nested radio fields
588
-		*
589
-		*/
590
-		function get_sub_fields($field_params, $field_slug, $current_values){
591
-			$sub_fields = array();	
592
-			if ( ! empty($field_params['enum_values']) ){										
593
-				foreach ($field_params['enum_values'] as $key => $value) {					
594
-					$sub_fields[$key] = array();	
595
-					if (is_array($value)){
596
-						if ($field_params['type'] == 'accordion'){								
597
-							$sub_fields[$key][] = $this->convert_field($value, $current_values);
598
-						}
599
-						else
600
-						{
601
-							foreach ($value as $k => $sub_field) {								
602
-								if (is_array($sub_field) and ! empty($this->fields[$sub_field['slug']]))
603
-								{									
604
-									$sub_fields[$key][] = $this->convert_field($sub_field, $current_values);
605
-								}								
606
-							}
607
-						}
608
-					}
609
-				}
610
-			}
611
-			return $sub_fields;
612
-		}			
613
-
614
-		function convert_field($sub_field, $current_values){
615
-			$field = array();
616
-			if (!isset($current_values[$this->slug][$sub_field['slug']])) {
617
-				$current_values[$this->slug][$sub_field['slug']] = isset($sub_field['default_text']) ? $sub_field['default_text'] : '';
618
-			}
619
-			switch ($this->fields[$sub_field['slug']]['type']) {
620
-				case 'text':
621
-					$field = array(
622
-						'type'   => 'simple',
623
-						'label'  => $this->fields[$sub_field['slug']]['name'],
624
-						'params' => array(
625
-							'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
626
-							'field_name' => $this->slug."[".$sub_field['slug']."]",
627
-							'field_value' => ($current_values[$this->slug][$sub_field['slug']] == '' && $this->isWizard) ? $sub_field['default_text'] : $current_values[$this->slug][$sub_field['slug']],
628
-							'is_main_field' => $sub_field['is_main_field']
629
-						)
630
-					);
631
-					break;
632
-				case 'textarea':
633
-					$field = array(
634
-						'type'   => 'textarea',
635
-						'label'  => $this->fields[$sub_field['slug']]['name'],
636
-						'params' => array(
637
-							'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
638
-							'field_name' => $this->slug."[".$sub_field['slug']."]",
639
-							'field_value' => ($current_values[$this->slug][$sub_field['slug']] == '' && $this->isWizard) ? $sub_field['default_text'] : $current_values[$this->slug][$sub_field['slug']],
640
-							'is_main_field' => $sub_field['is_main_field']
641
-						)
642
-					);
643
-					break;
644
-				case 'wp_editor':
645
-					$field = array(
646
-						'type'   => 'wp_editor',
647
-						'label'  => $this->fields[$sub_field['slug']]['name'],
648
-						'params' => array(
649
-							'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
650
-							'field_name' => $this->slug."[".$sub_field['slug']."]",
651
-							'field_value' => ($current_values[$this->slug][$sub_field['slug']] == '' && $this->isWizard) ? $sub_field['default_text'] : $current_values[$this->slug][$sub_field['slug']],
652
-							'is_main_field' => $sub_field['is_main_field']
653
-						)
654
-					);
655
-					break;
656
-				case 'image':
657
-					$field = array(
658
-						'type'   => 'image',
659
-						'label'  => $this->fields[$sub_field['slug']]['name'],
660
-						'params' => array(
661
-							'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
662
-							'field_name' => $this->slug."[".$sub_field['slug']."]",
663
-							'field_value' => $current_values[$this->slug][$sub_field['slug']],
664
-							'download_image' => null,
665
-							'field_key' => $sub_field['slug'],
666
-							'addon_prefix' => $this->slug,
667
-							'is_main_field' => $sub_field['is_main_field']
668
-						)
669
-					);
670
-
671
-					if ( array_key_exists( 'download_image', $current_values[$this->slug] ) && array_key_exists( $sub_field['slug'], $current_values[$this->slug]['download_image'] ) ) {
672
-						$field['params']['download_image'] = $current_values[$this->slug]['download_image'][$sub_field['slug']];
673
-					}
584
+        }
585
+        /**
586
+         *
587
+         * Helper function for nested radio fields
588
+         *
589
+         */
590
+        function get_sub_fields($field_params, $field_slug, $current_values){
591
+            $sub_fields = array();	
592
+            if ( ! empty($field_params['enum_values']) ){										
593
+                foreach ($field_params['enum_values'] as $key => $value) {					
594
+                    $sub_fields[$key] = array();	
595
+                    if (is_array($value)){
596
+                        if ($field_params['type'] == 'accordion'){								
597
+                            $sub_fields[$key][] = $this->convert_field($value, $current_values);
598
+                        }
599
+                        else
600
+                        {
601
+                            foreach ($value as $k => $sub_field) {								
602
+                                if (is_array($sub_field) and ! empty($this->fields[$sub_field['slug']]))
603
+                                {									
604
+                                    $sub_fields[$key][] = $this->convert_field($sub_field, $current_values);
605
+                                }								
606
+                            }
607
+                        }
608
+                    }
609
+                }
610
+            }
611
+            return $sub_fields;
612
+        }			
613
+
614
+        function convert_field($sub_field, $current_values){
615
+            $field = array();
616
+            if (!isset($current_values[$this->slug][$sub_field['slug']])) {
617
+                $current_values[$this->slug][$sub_field['slug']] = isset($sub_field['default_text']) ? $sub_field['default_text'] : '';
618
+            }
619
+            switch ($this->fields[$sub_field['slug']]['type']) {
620
+                case 'text':
621
+                    $field = array(
622
+                        'type'   => 'simple',
623
+                        'label'  => $this->fields[$sub_field['slug']]['name'],
624
+                        'params' => array(
625
+                            'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
626
+                            'field_name' => $this->slug."[".$sub_field['slug']."]",
627
+                            'field_value' => ($current_values[$this->slug][$sub_field['slug']] == '' && $this->isWizard) ? $sub_field['default_text'] : $current_values[$this->slug][$sub_field['slug']],
628
+                            'is_main_field' => $sub_field['is_main_field']
629
+                        )
630
+                    );
674 631
                     break;
675
-				case 'file':
676
-					$field = array(
677
-						'type'   => 'file',
678
-						'label'  => $this->fields[$sub_field['slug']]['name'],
679
-						'params' => array(
680
-							'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
681
-							'field_name' => $this->slug."[".$sub_field['slug']."]",
682
-							'field_value' => $current_values[$this->slug][$sub_field['slug']],
683
-							'download_image' => null,
684
-							'field_key' => $sub_field['slug'],
685
-							'addon_prefix' => $this->slug,
686
-							'is_main_field' => $sub_field['is_main_field']
687
-						)
688
-					);
689
-
690
-					if ( array_key_exists( 'download_image', $current_values[$this->slug] )  && array_key_exists( $sub_field['slug'], $current_values[$this->slug]['download_image'] ) ) {
691
-						$field['params']['download_image'] = $current_values[$this->slug]['download_image'][$sub_field['slug']];
692
-					}
693
-
694
-					break;
695
-				case 'radio':
696
-					$field = array(
697
-						'type'   => 'enum',
698
-						'label'  => $this->fields[$sub_field['slug']]['name'],
699
-						'params' => array(
700
-							'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
701
-							'field_name' => $this->slug."[".$sub_field['slug']."]",
702
-							'field_value' => $current_values[$this->slug][$sub_field['slug']],
703
-							'enum_values' => $this->fields[$sub_field['slug']]['enum_values'],
704
-							'mapping' => true,
705
-							'field_key' => $sub_field['slug'],
706
-							'mapping_rules' => isset($current_values[$this->slug]['mapping'][$sub_field['slug']]) ? $current_values[$this->slug]['mapping'][$sub_field['slug']] : array(),
707
-							'xpath' => isset($current_values[$this->slug]['xpaths'][$sub_field['slug']]) ? $current_values[$this->slug]['xpaths'][$sub_field['slug']] : '',
708
-							'addon_prefix' => $this->slug,
709
-							'sub_fields' => $this->get_sub_fields($this->fields[$sub_field['slug']], $sub_field['slug'], $current_values),
710
-							'is_main_field' => $sub_field['is_main_field']
711
-						)
712
-					);
713
-					break;
714
-				case 'accordion':
715
-					$field = array(
716
-						'type'   => 'accordion',
717
-						'label'  => $this->fields[$sub_field['slug']]['name'],
718
-						'params' => array(
719
-							'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
720
-							'field_name' => $this->slug."[".$sub_field['slug']."]",																
721
-							'field_key' => $sub_field['slug'],								
722
-							'addon_prefix' => $this->slug,
723
-							'sub_fields' => $this->get_sub_fields($this->fields[$sub_field['slug']], $sub_field['slug'], $current_values),
724
-							'in_the_bottom' => false
725
-						)
726
-					);						
727
-					break;
728
-				default:
729
-					# code...
730
-					break;
731
-			}
732
-			return $field;
733
-		}				
734
-
735
-		/**
736
-		* 
737
-		* Add accordion options
738
-		*
739
-		*
740
-		*/
741
-		function add_options( $main_field = false, $title = '', $fields = array() ){
632
+                case 'textarea':
633
+                    $field = array(
634
+                        'type'   => 'textarea',
635
+                        'label'  => $this->fields[$sub_field['slug']]['name'],
636
+                        'params' => array(
637
+                            'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
638
+                            'field_name' => $this->slug."[".$sub_field['slug']."]",
639
+                            'field_value' => ($current_values[$this->slug][$sub_field['slug']] == '' && $this->isWizard) ? $sub_field['default_text'] : $current_values[$this->slug][$sub_field['slug']],
640
+                            'is_main_field' => $sub_field['is_main_field']
641
+                        )
642
+                    );
643
+                    break;
644
+                case 'wp_editor':
645
+                    $field = array(
646
+                        'type'   => 'wp_editor',
647
+                        'label'  => $this->fields[$sub_field['slug']]['name'],
648
+                        'params' => array(
649
+                            'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
650
+                            'field_name' => $this->slug."[".$sub_field['slug']."]",
651
+                            'field_value' => ($current_values[$this->slug][$sub_field['slug']] == '' && $this->isWizard) ? $sub_field['default_text'] : $current_values[$this->slug][$sub_field['slug']],
652
+                            'is_main_field' => $sub_field['is_main_field']
653
+                        )
654
+                    );
655
+                    break;
656
+                case 'image':
657
+                    $field = array(
658
+                        'type'   => 'image',
659
+                        'label'  => $this->fields[$sub_field['slug']]['name'],
660
+                        'params' => array(
661
+                            'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
662
+                            'field_name' => $this->slug."[".$sub_field['slug']."]",
663
+                            'field_value' => $current_values[$this->slug][$sub_field['slug']],
664
+                            'download_image' => null,
665
+                            'field_key' => $sub_field['slug'],
666
+                            'addon_prefix' => $this->slug,
667
+                            'is_main_field' => $sub_field['is_main_field']
668
+                        )
669
+                    );
670
+
671
+                    if ( array_key_exists( 'download_image', $current_values[$this->slug] ) && array_key_exists( $sub_field['slug'], $current_values[$this->slug]['download_image'] ) ) {
672
+                        $field['params']['download_image'] = $current_values[$this->slug]['download_image'][$sub_field['slug']];
673
+                    }
674
+                    break;
675
+                case 'file':
676
+                    $field = array(
677
+                        'type'   => 'file',
678
+                        'label'  => $this->fields[$sub_field['slug']]['name'],
679
+                        'params' => array(
680
+                            'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
681
+                            'field_name' => $this->slug."[".$sub_field['slug']."]",
682
+                            'field_value' => $current_values[$this->slug][$sub_field['slug']],
683
+                            'download_image' => null,
684
+                            'field_key' => $sub_field['slug'],
685
+                            'addon_prefix' => $this->slug,
686
+                            'is_main_field' => $sub_field['is_main_field']
687
+                        )
688
+                    );
689
+
690
+                    if ( array_key_exists( 'download_image', $current_values[$this->slug] )  && array_key_exists( $sub_field['slug'], $current_values[$this->slug]['download_image'] ) ) {
691
+                        $field['params']['download_image'] = $current_values[$this->slug]['download_image'][$sub_field['slug']];
692
+                    }
693
+
694
+                    break;
695
+                case 'radio':
696
+                    $field = array(
697
+                        'type'   => 'enum',
698
+                        'label'  => $this->fields[$sub_field['slug']]['name'],
699
+                        'params' => array(
700
+                            'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
701
+                            'field_name' => $this->slug."[".$sub_field['slug']."]",
702
+                            'field_value' => $current_values[$this->slug][$sub_field['slug']],
703
+                            'enum_values' => $this->fields[$sub_field['slug']]['enum_values'],
704
+                            'mapping' => true,
705
+                            'field_key' => $sub_field['slug'],
706
+                            'mapping_rules' => isset($current_values[$this->slug]['mapping'][$sub_field['slug']]) ? $current_values[$this->slug]['mapping'][$sub_field['slug']] : array(),
707
+                            'xpath' => isset($current_values[$this->slug]['xpaths'][$sub_field['slug']]) ? $current_values[$this->slug]['xpaths'][$sub_field['slug']] : '',
708
+                            'addon_prefix' => $this->slug,
709
+                            'sub_fields' => $this->get_sub_fields($this->fields[$sub_field['slug']], $sub_field['slug'], $current_values),
710
+                            'is_main_field' => $sub_field['is_main_field']
711
+                        )
712
+                    );
713
+                    break;
714
+                case 'accordion':
715
+                    $field = array(
716
+                        'type'   => 'accordion',
717
+                        'label'  => $this->fields[$sub_field['slug']]['name'],
718
+                        'params' => array(
719
+                            'tooltip' => $this->fields[$sub_field['slug']]['tooltip'],
720
+                            'field_name' => $this->slug."[".$sub_field['slug']."]",																
721
+                            'field_key' => $sub_field['slug'],								
722
+                            'addon_prefix' => $this->slug,
723
+                            'sub_fields' => $this->get_sub_fields($this->fields[$sub_field['slug']], $sub_field['slug'], $current_values),
724
+                            'in_the_bottom' => false
725
+                        )
726
+                    );						
727
+                    break;
728
+                default:
729
+                    # code...
730
+                    break;
731
+            }
732
+            return $field;
733
+        }				
734
+
735
+        /**
736
+         * 
737
+         * Add accordion options
738
+         *
739
+         *
740
+         */
741
+        function add_options( $main_field = false, $title = '', $fields = array() ){
742 742
 			
743
-			if ( ! empty($fields) )
744
-			{				
743
+            if ( ! empty($fields) )
744
+            {				
745 745
 				
746
-				if ($main_field){
746
+                if ($main_field){
747 747
 
748
-					$main_field['is_main_field'] = true;
749
-					$fields[] = $main_field;
748
+                    $main_field['is_main_field'] = true;
749
+                    $fields[] = $main_field;
750 750
 
751
-				}
751
+                }
752 752
 
753
-				return $this->add_field('accordion_' . $fields[0]['slug'], $title, 'accordion', $fields);							
753
+                return $this->add_field('accordion_' . $fields[0]['slug'], $title, 'accordion', $fields);							
754 754
 			
755
-			}
755
+            }
756 756
 
757
-		}			
757
+        }			
758 758
 
759
-		function add_title($title = '', $tooltip = ''){
759
+        function add_title($title = '', $tooltip = ''){
760 760
 
761
-			if (empty($title)) return;
761
+            if (empty($title)) return;
762 762
 
763
-			return $this->add_field(sanitize_key($title) . time(), $title, 'title', null, $tooltip);			
763
+            return $this->add_field(sanitize_key($title) . time(), $title, 'title', null, $tooltip);			
764 764
 
765
-		}		
765
+        }		
766 766
 
767
-		function add_text($text = '', $is_html = false){
767
+        function add_text($text = '', $is_html = false){
768 768
 
769
-			if (empty($text)) return;
769
+            if (empty($text)) return;
770 770
 
771
-			$count = is_array($this->fields) ? count($this->fields) : 0;
771
+            $count = is_array($this->fields) ? count($this->fields) : 0;
772 772
 
773
-			return $this->add_field(sanitize_key($text) . time() . uniqid() . $count, $text, 'plain_text', null, "", $is_html);
773
+            return $this->add_field(sanitize_key($text) . time() . uniqid() . $count, $text, 'plain_text', null, "", $is_html);
774 774
 
775
-		}			
775
+        }			
776 776
 
777
-		function helper_metabox_top($name) {
777
+        function helper_metabox_top($name) {
778 778
 
779
-			return '
779
+            return '
780 780
 			<style type="text/css">
781 781
 				.wpallimport-plugin .wpallimport-addon div.input {
782 782
 					margin-bottom: 15px;
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 							<table class="form-table" style="max-width:none;">
873 873
 								<tr>
874 874
 									<td colspan="3">';
875
-		}
875
+        }
876 876
 
877
-		function helper_metabox_bottom() {
877
+        function helper_metabox_bottom() {
878 878
 
879
-			return '				</td>
879
+            return '				</td>
880 880
 								</tr>
881 881
 							</table>
882 882
 						</div>
@@ -884,298 +884,298 @@  discard block
 block discarded – undo
884 884
 				</div>
885 885
 			</div>';
886 886
 
887
-		}
887
+        }
888 888
 
889
-		/**
890
-		*
891
-		* simply add an additional section for attachments
892
-		*
893
-		*/
894
-		function import_files( $slug, $title, $callback = NULL ){
895
-			$this->import_images( $slug, $title, 'files', $callback);
896
-		}
889
+        /**
890
+         *
891
+         * simply add an additional section for attachments
892
+         *
893
+         */
894
+        function import_files( $slug, $title, $callback = NULL ){
895
+            $this->import_images( $slug, $title, 'files', $callback);
896
+        }
897 897
 
898
-		/**
899
-		*
900
-		* simply add an additional section 
901
-		*
902
-		*/
903
-		function import_images( $slug, $title, $type = 'images', $callback = NULL ){
898
+        /**
899
+         *
900
+         * simply add an additional section 
901
+         *
902
+         */
903
+        function import_images( $slug, $title, $type = 'images', $callback = NULL ){
904 904
 			
905
-			if ( empty($title) or empty($slug) ) return;
905
+            if ( empty($title) or empty($slug) ) return;
906 906
 
907
-			if (is_array($slug)) {
907
+            if (is_array($slug)) {
908 908
                 $section_slug = 'pmxi_' . md5(serialize($slug));
909 909
             } else {
910 910
                 $section_slug = 'pmxi_' . $slug;
911 911
             }
912 912
 
913
-			$this->image_sections[] = array(
914
-				'title' => $title,
915
-				'slug'  => $section_slug,
916
-				'type'  => $type
917
-			);			
913
+            $this->image_sections[] = array(
914
+                'title' => $title,
915
+                'slug'  => $section_slug,
916
+                'type'  => $type
917
+            );			
918 918
 			
919
-			foreach ($this->image_options as $option_slug => $value) {
920
-				$this->add_option($section_slug . $option_slug, $value);
921
-			}
919
+            foreach ($this->image_options as $option_slug => $value) {
920
+                $this->add_option($section_slug . $option_slug, $value);
921
+            }
922 922
 
923
-			if (count($this->image_sections) > 1){
924
-				add_filter('wp_all_import_is_show_add_new_images', array($this, 'filter_is_show_add_new_images'), 10, 2);
925
-			}
923
+            if (count($this->image_sections) > 1){
924
+                add_filter('wp_all_import_is_show_add_new_images', array($this, 'filter_is_show_add_new_images'), 10, 2);
925
+            }
926 926
 
927
-			add_filter('wp_all_import_is_allow_import_images', array($this, 'is_allow_import_images'), 10, 2);			
927
+            add_filter('wp_all_import_is_allow_import_images', array($this, 'is_allow_import_images'), 10, 2);			
928 928
 
929
-			if ($callback && is_callable($callback)) {
929
+            if ($callback && is_callable($callback)) {
930 930
                 add_action( $section_slug, $callback, 10, 4);
931 931
             } else {
932 932
                 if (function_exists($slug)) {
933 933
                     add_action( $section_slug, $slug, 10, 4);
934 934
                 }
935 935
             }
936
-		}			
937
-			/**
938
-			*
939
-			* filter to allow import images for free edition of WP All Import
940
-			*
941
-			*/
942
-			function is_allow_import_images($is_allow, $post_type){
943
-				return ($this->is_active_addon($post_type)) ? true : $is_allow;
944
-			}
945
-
946
-		/**
947
-		*
948
-		* filter to control additional images sections
949
-		*
950
-		*/
951
-		function additional_sections($sections){
952
-			if ( ! empty($this->image_sections) ){
953
-				foreach ($this->image_sections as $add_section) {
954
-					$sections[] = $add_section;
955
-				}
956
-			}
936
+        }			
937
+            /**
938
+             *
939
+             * filter to allow import images for free edition of WP All Import
940
+             *
941
+             */
942
+            function is_allow_import_images($is_allow, $post_type){
943
+                return ($this->is_active_addon($post_type)) ? true : $is_allow;
944
+            }
945
+
946
+        /**
947
+         *
948
+         * filter to control additional images sections
949
+         *
950
+         */
951
+        function additional_sections($sections){
952
+            if ( ! empty($this->image_sections) ){
953
+                foreach ($this->image_sections as $add_section) {
954
+                    $sections[] = $add_section;
955
+                }
956
+            }
957 957
 			
958
-			return $sections;
959
-		}
960
-			/**
961
-			*
962
-			* remove the 'Don't touch existing images, append new images' when more than one image section is in use.
963
-			*
964
-			*/
965
-			function filter_is_show_add_new_images($is_show, $post_type){
966
-				return ($this->is_active_addon($post_type)) ? false : $is_show;
967
-			}
968
-
969
-		/**
970
-		*
971
-		* disable the default images section
972
-		*
973
-		*/		
974
-		function disable_default_images($post_type = false){
958
+            return $sections;
959
+        }
960
+            /**
961
+             *
962
+             * remove the 'Don't touch existing images, append new images' when more than one image section is in use.
963
+             *
964
+             */
965
+            function filter_is_show_add_new_images($is_show, $post_type){
966
+                return ($this->is_active_addon($post_type)) ? false : $is_show;
967
+            }
968
+
969
+        /**
970
+         *
971
+         * disable the default images section
972
+         *
973
+         */		
974
+        function disable_default_images($post_type = false){
975 975
 									
976
-			add_filter('wp_all_import_is_images_section_enabled', array($this, 'is_enable_default_images_section'), 10, 2);
976
+            add_filter('wp_all_import_is_images_section_enabled', array($this, 'is_enable_default_images_section'), 10, 2);
977 977
 
978
-		}
979
-			function is_enable_default_images_section($is_enabled, $post_type){						
978
+        }
979
+            function is_enable_default_images_section($is_enabled, $post_type){						
980 980
 				
981
-				return ($this->is_active_addon($post_type)) ? false : true;
981
+                return ($this->is_active_addon($post_type)) ? false : true;
982 982
 								
983
-			}
983
+            }
984 984
 
985
-		function helper_parse($parsingData, $options) {
985
+        function helper_parse($parsingData, $options) {
986 986
 
987
-			extract($parsingData);
987
+            extract($parsingData);
988 988
 
989
-			$data = array(); // parsed data
989
+            $data = array(); // parsed data
990 990
 
991
-			if ( ! empty($import->options[$this->slug])){
991
+            if ( ! empty($import->options[$this->slug])){
992 992
 
993
-				$this->logger = $parsingData['logger'];
993
+                $this->logger = $parsingData['logger'];
994 994
 
995
-				$cxpath = $xpath_prefix . $import->xpath;
995
+                $cxpath = $xpath_prefix . $import->xpath;
996 996
 
997
-				$tmp_files = array();
997
+                $tmp_files = array();
998 998
 
999
-				foreach ($options[$this->slug] as $option_name => $option_value) {					
1000
-					if ( isset($import->options[$this->slug][$option_name]) and $import->options[$this->slug][$option_name] != '') {						
1001
-						if ($import->options[$this->slug][$option_name] == "xpath") {
1002
-							if ($import->options[$this->slug]['xpaths'][$option_name] == ""){
1003
-								$count and $data[$option_name] = array_fill(0, $count, "");
1004
-							} else {
1005
-								$data[$option_name] = XmlImportParser::factory($xml, $cxpath, (string) $import->options[$this->slug]['xpaths'][$option_name], $file)->parse();
1006
-								$tmp_files[] = $file;						
1007
-							}
1008
-						} 
1009
-						else {							
1010
-							$data[$option_name] = XmlImportParser::factory($xml, $cxpath, (string) $import->options[$this->slug][$option_name], $file)->parse();
1011
-							$tmp_files[] = $file;
1012
-						}
999
+                foreach ($options[$this->slug] as $option_name => $option_value) {					
1000
+                    if ( isset($import->options[$this->slug][$option_name]) and $import->options[$this->slug][$option_name] != '') {						
1001
+                        if ($import->options[$this->slug][$option_name] == "xpath") {
1002
+                            if ($import->options[$this->slug]['xpaths'][$option_name] == ""){
1003
+                                $count and $data[$option_name] = array_fill(0, $count, "");
1004
+                            } else {
1005
+                                $data[$option_name] = XmlImportParser::factory($xml, $cxpath, (string) $import->options[$this->slug]['xpaths'][$option_name], $file)->parse();
1006
+                                $tmp_files[] = $file;						
1007
+                            }
1008
+                        } 
1009
+                        else {							
1010
+                            $data[$option_name] = XmlImportParser::factory($xml, $cxpath, (string) $import->options[$this->slug][$option_name], $file)->parse();
1011
+                            $tmp_files[] = $file;
1012
+                        }
1013 1013
 
1014 1014
 
1015
-					} else {
1016
-						$data[$option_name] = array_fill(0, $count, "");
1017
-					}
1015
+                    } else {
1016
+                        $data[$option_name] = array_fill(0, $count, "");
1017
+                    }
1018 1018
 
1019
-				}
1019
+                }
1020 1020
 
1021
-				foreach ($tmp_files as $file) { // remove all temporary files created
1022
-					unlink($file);
1023
-				}
1021
+                foreach ($tmp_files as $file) { // remove all temporary files created
1022
+                    unlink($file);
1023
+                }
1024 1024
 
1025
-			}
1025
+            }
1026 1026
 
1027
-			return $data;
1028
-		}
1027
+            return $data;
1028
+        }
1029 1029
 
1030 1030
 
1031
-		function can_update_meta($meta_key, $import_options) {
1031
+        function can_update_meta($meta_key, $import_options) {
1032 1032
 
1033
-			//echo "<pre>";
1034
-			//print_r($import_options['options']);
1035
-			//echo "</pre>";
1033
+            //echo "<pre>";
1034
+            //print_r($import_options['options']);
1035
+            //echo "</pre>";
1036 1036
 			
1037
-			$import_options = $import_options['options'];
1037
+            $import_options = $import_options['options'];
1038 1038
 
1039
-			if ($import_options['update_all_data'] == 'yes') return true;
1039
+            if ($import_options['update_all_data'] == 'yes') return true;
1040 1040
 
1041
-			if ( ! $import_options['is_update_custom_fields'] ) return false;			
1041
+            if ( ! $import_options['is_update_custom_fields'] ) return false;			
1042 1042
 
1043
-			if ($import_options['update_custom_fields_logic'] == "full_update") return true;
1044
-			if ($import_options['update_custom_fields_logic'] == "only" and ! empty($import_options['custom_fields_list']) and is_array($import_options['custom_fields_list']) and in_array($meta_key, $import_options['custom_fields_list']) ) return true;
1045
-			if ($import_options['update_custom_fields_logic'] == "all_except" and ( empty($import_options['custom_fields_list']) or ! in_array($meta_key, $import_options['custom_fields_list']) )) return true;
1043
+            if ($import_options['update_custom_fields_logic'] == "full_update") return true;
1044
+            if ($import_options['update_custom_fields_logic'] == "only" and ! empty($import_options['custom_fields_list']) and is_array($import_options['custom_fields_list']) and in_array($meta_key, $import_options['custom_fields_list']) ) return true;
1045
+            if ($import_options['update_custom_fields_logic'] == "all_except" and ( empty($import_options['custom_fields_list']) or ! in_array($meta_key, $import_options['custom_fields_list']) )) return true;
1046 1046
 
1047
-			return false;
1047
+            return false;
1048 1048
 
1049
-		}
1049
+        }
1050 1050
 
1051
-		function can_update_taxonomy($tax_name, $import_options) {
1051
+        function can_update_taxonomy($tax_name, $import_options) {
1052 1052
 
1053
-			//echo "<pre>";
1054
-			//print_r($import_options['options']);
1055
-			//echo "</pre>";
1053
+            //echo "<pre>";
1054
+            //print_r($import_options['options']);
1055
+            //echo "</pre>";
1056 1056
 			
1057
-			$import_options = $import_options['options'];
1057
+            $import_options = $import_options['options'];
1058 1058
 
1059
-			if ($import_options['update_all_data'] == 'yes') return true;
1059
+            if ($import_options['update_all_data'] == 'yes') return true;
1060 1060
 
1061
-			if ( ! $import_options['is_update_categories'] ) return false;			
1061
+            if ( ! $import_options['is_update_categories'] ) return false;			
1062 1062
 
1063
-			if ($import_options['update_categories_logic'] == "full_update") return true;
1064
-			if ($import_options['update_categories_logic'] == "only" and ! empty($import_options['taxonomies_list']) and is_array($import_options['taxonomies_list']) and in_array($tax_name, $import_options['taxonomies_list']) ) return true;
1065
-			if ($import_options['update_categories_logic'] == "all_except" and ( empty($import_options['taxonomies_list']) or ! in_array($tax_name, $import_options['taxonomies_list']) )) return true;
1063
+            if ($import_options['update_categories_logic'] == "full_update") return true;
1064
+            if ($import_options['update_categories_logic'] == "only" and ! empty($import_options['taxonomies_list']) and is_array($import_options['taxonomies_list']) and in_array($tax_name, $import_options['taxonomies_list']) ) return true;
1065
+            if ($import_options['update_categories_logic'] == "all_except" and ( empty($import_options['taxonomies_list']) or ! in_array($tax_name, $import_options['taxonomies_list']) )) return true;
1066 1066
 
1067
-			return false;
1067
+            return false;
1068 1068
 
1069
-		}
1069
+        }
1070 1070
 
1071
-		function can_update_image($import_options) {
1071
+        function can_update_image($import_options) {
1072 1072
 
1073
-			$import_options = $import_options['options'];
1073
+            $import_options = $import_options['options'];
1074 1074
 
1075
-			if ($import_options['update_all_data'] == 'yes') return true;
1075
+            if ($import_options['update_all_data'] == 'yes') return true;
1076 1076
 
1077
-			if (!$import_options['is_update_images']) return false;			
1077
+            if (!$import_options['is_update_images']) return false;			
1078 1078
 
1079
-			if ($import_options['is_update_images']) return true;			
1079
+            if ($import_options['is_update_images']) return true;			
1080 1080
 
1081
-			return false;
1082
-		}
1081
+            return false;
1082
+        }
1083 1083
 
1084 1084
 
1085
-		function admin_notice_ignore() {
1086
-			if (isset($_GET[$this->slug.'_ignore']) && '0' == $_GET[$this->slug.'_ignore'] ) {
1087
-				update_option($this->slug.'_ignore', 'true');
1088
-			}
1089
-		}
1085
+        function admin_notice_ignore() {
1086
+            if (isset($_GET[$this->slug.'_ignore']) && '0' == $_GET[$this->slug.'_ignore'] ) {
1087
+                update_option($this->slug.'_ignore', 'true');
1088
+            }
1089
+        }
1090 1090
 
1091
-		function display_admin_notice() {
1091
+        function display_admin_notice() {
1092 1092
 
1093 1093
 
1094
-			if ($this->notice_text) {
1095
-				$notice_text = $this->notice_text;
1096
-			} else {
1097
-				$notice_text = $this->name.' requires WP All Import <a href="http://www.wpallimport.com/" target="_blank">Pro</a> or <a href="http://wordpress.org/plugins/wp-all-import" target="_blank">Free</a>.';
1098
-			}
1094
+            if ($this->notice_text) {
1095
+                $notice_text = $this->notice_text;
1096
+            } else {
1097
+                $notice_text = $this->name.' requires WP All Import <a href="http://www.wpallimport.com/" target="_blank">Pro</a> or <a href="http://wordpress.org/plugins/wp-all-import" target="_blank">Free</a>.';
1098
+            }
1099 1099
 
1100
-			if (!get_option(sanitize_key($this->slug).'_notice_ignore')) {
1100
+            if (!get_option(sanitize_key($this->slug).'_notice_ignore')) {
1101 1101
 
1102
-				?>
1102
+                ?>
1103 1103
 
1104 1104
 	    		<div class="error notice is-dismissible wpallimport-dismissible" style="margin-top: 10px;" rel="<?php echo esc_attr($this->slug); ?>">
1105 1105
 	    		    <p><?php echo wp_kses_post(__(
1106
-		    		    	sprintf(
1107
-	    			    		$notice_text,
1108
-	    			    		'?'.$this->slug.'_ignore=0'
1109
-	    			    	), 
1110
-	    		    		'rapid_addon_'.$this->slug
1111
-	    		    	)); ?></p>
1106
+                            sprintf(
1107
+                                $notice_text,
1108
+                                '?'.$this->slug.'_ignore=0'
1109
+                            ), 
1110
+                            'rapid_addon_'.$this->slug
1111
+                        )); ?></p>
1112 1112
 			    </div>
1113 1113
 
1114 1114
 				<?php
1115 1115
 
1116
-			}
1116
+            }
1117 1117
 
1118
-		}
1118
+        }
1119 1119
 
1120
-		/*
1120
+        /*
1121 1121
 		*
1122 1122
 		* $conditions - array('themes' => array('Realia'), 'plugins' => array('plugin-directory/plugin-file.php', 'plugin-directory2/plugin-file.php')) 
1123 1123
 		*
1124 1124
 		*/
1125
-		function admin_notice($notice_text = '', $conditions = array()) {
1125
+        function admin_notice($notice_text = '', $conditions = array()) {
1126 1126
 
1127
-			$is_show_notice = false;
1127
+            $is_show_notice = false;
1128 1128
 
1129
-			include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1129
+            include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1130 1130
 
1131
-			if ( ! class_exists( 'PMXI_Plugin' ) ) {
1132
-				$is_show_notice = true;
1133
-			}
1131
+            if ( ! class_exists( 'PMXI_Plugin' ) ) {
1132
+                $is_show_notice = true;
1133
+            }
1134 1134
 
1135
-			// Supported Themes
1136
-			if ( ! $is_show_notice and ! empty($conditions['themes']) ){
1135
+            // Supported Themes
1136
+            if ( ! $is_show_notice and ! empty($conditions['themes']) ){
1137 1137
 
1138
-				$themeInfo    = wp_get_theme();
1139
-				$parentInfo = $themeInfo->parent();				
1140
-				$currentTheme = $themeInfo->get('Name');
1138
+                $themeInfo    = wp_get_theme();
1139
+                $parentInfo = $themeInfo->parent();				
1140
+                $currentTheme = $themeInfo->get('Name');
1141 1141
 				
1142
-				$is_show_notice = in_array($currentTheme, $conditions['themes']) ? false : true;				
1142
+                $is_show_notice = in_array($currentTheme, $conditions['themes']) ? false : true;				
1143 1143
 
1144
-				if ( $is_show_notice and $parentInfo ){
1145
-					$parent_theme = $parentInfo->get('Name');
1146
-					$is_show_notice = in_array($parent_theme, $conditions['themes']) ? false : true;					
1147
-				}
1144
+                if ( $is_show_notice and $parentInfo ){
1145
+                    $parent_theme = $parentInfo->get('Name');
1146
+                    $is_show_notice = in_array($parent_theme, $conditions['themes']) ? false : true;					
1147
+                }
1148 1148
 
1149
-			}			
1149
+            }			
1150 1150
 
1151
-			// Required Plugins
1152
-			if ( ! $is_show_notice and ! empty($conditions['plugins']) ){				
1151
+            // Required Plugins
1152
+            if ( ! $is_show_notice and ! empty($conditions['plugins']) ){				
1153 1153
 
1154
-				$requires_counter = 0;
1155
-				foreach ($conditions['plugins'] as $plugin) {
1156
-					if ( is_plugin_active($plugin) ) $requires_counter++;
1157
-				}
1154
+                $requires_counter = 0;
1155
+                foreach ($conditions['plugins'] as $plugin) {
1156
+                    if ( is_plugin_active($plugin) ) $requires_counter++;
1157
+                }
1158 1158
 
1159
-				if ($requires_counter != count($conditions['plugins'])){ 					
1160
-					$is_show_notice = true;			
1161
-				}
1159
+                if ($requires_counter != count($conditions['plugins'])){ 					
1160
+                    $is_show_notice = true;			
1161
+                }
1162 1162
 
1163
-			}
1163
+            }
1164 1164
 
1165
-			if ( $is_show_notice ){
1165
+            if ( $is_show_notice ){
1166 1166
 
1167
-				if ( $notice_text != '' ) {
1168
-					$this->notice_text = $notice_text;
1169
-				}
1167
+                if ( $notice_text != '' ) {
1168
+                    $this->notice_text = $notice_text;
1169
+                }
1170 1170
 
1171
-				add_action('admin_notices', array($this, 'display_admin_notice'));
1172
-			}
1171
+                add_action('admin_notices', array($this, 'display_admin_notice'));
1172
+            }
1173 1173
 
1174
-		}
1174
+        }
1175 1175
 
1176
-		function log( $m = false){		
1176
+        function log( $m = false){		
1177 1177
 
1178
-			$m and $this->logger and call_user_func($this->logger, $m);
1178
+            $m and $this->logger and call_user_func($this->logger, $m);
1179 1179
 
1180 1180
         }
1181 1181
         
@@ -1293,5 +1293,5 @@  discard block
 block discarded – undo
1293 1293
             }
1294 1294
             return $image;
1295 1295
         }
1296
-	}	
1296
+    }	
1297 1297
 }
1298 1298
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/subscriptions.php 1 patch
Spacing   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Contains functions that display the subscriptions admin page.
4 4
  */
5 5
 
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * Render the Subscriptions page
@@ -17,23 +17,23 @@  discard block
 block discarded – undo
17 17
 	?>
18 18
 
19 19
 	<div class="wrap">
20
-		<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
20
+		<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
21 21
 		<div class="bsui">
22 22
 
23 23
 			<?php
24 24
 
25 25
 				// Verify user permissions.
26
-				if ( ! wpinv_current_user_can_manage_invoicing() ) {
26
+				if (!wpinv_current_user_can_manage_invoicing()) {
27 27
 
28 28
 				aui()->alert(
29 29
                     array(
30 30
 						'type'    => 'danger',
31
-						'content' => __( 'You are not permitted to view this page.', 'invoicing' ),
31
+						'content' => __('You are not permitted to view this page.', 'invoicing'),
32 32
 					),
33 33
 					true
34 34
                 );
35 35
 
36
-				} elseif ( ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) ) {
36
+				} elseif (!empty($_GET['id']) && is_numeric($_GET['id'])) {
37 37
 
38 38
 				// Display a single subscription.
39 39
 				wpinv_recurring_subscription_details();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	<?php $subscribers_table->views(); ?>
68 68
 	<form id="subscribers-filter" class="bsui" method="get">
69 69
 		<input type="hidden" name="page" value="wpinv-subscriptions" />
70
-		<?php $subscribers_table->search_box( __( 'Search Subscriptions', 'invoicing' ), 'getpaid-search-subscriptions' ); ?>
70
+		<?php $subscribers_table->search_box(__('Search Subscriptions', 'invoicing'), 'getpaid-search-subscriptions'); ?>
71 71
 		<?php $subscribers_table->display(); ?>
72 72
 	</form>
73 73
 	<?php
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
 function wpinv_recurring_subscription_details() {
84 84
 
85 85
 	// Fetch the subscription.
86
-	$sub = new WPInv_Subscription( (int) $_GET['id'] );
87
-	if ( ! $sub->exists() ) {
86
+	$sub = new WPInv_Subscription((int) $_GET['id']);
87
+	if (!$sub->exists()) {
88 88
 
89 89
 		aui()->alert(
90 90
 			array(
91 91
 				'type'    => 'danger',
92
-				'content' => __( 'Subscription not found.', 'invoicing' ),
92
+				'content' => __('Subscription not found.', 'invoicing'),
93 93
 			),
94 94
 			true
95 95
 		);
@@ -98,32 +98,32 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	// Use metaboxes to display the subscription details.
101
-	add_meta_box( 'getpaid_admin_subscription_details_metabox', __( 'Subscription Details', 'invoicing' ), 'getpaid_admin_subscription_details_metabox', get_current_screen(), 'normal', 'high' );
102
-	add_meta_box( 'getpaid_admin_subscription_update_metabox', __( 'Change Status', 'invoicing' ), 'getpaid_admin_subscription_update_metabox', get_current_screen(), 'side' );
101
+	add_meta_box('getpaid_admin_subscription_details_metabox', __('Subscription Details', 'invoicing'), 'getpaid_admin_subscription_details_metabox', get_current_screen(), 'normal', 'high');
102
+	add_meta_box('getpaid_admin_subscription_update_metabox', __('Change Status', 'invoicing'), 'getpaid_admin_subscription_update_metabox', get_current_screen(), 'side');
103 103
 
104 104
 	$subscription_id     = $sub->get_id();
105
-	$subscription_groups = getpaid_get_invoice_subscription_groups( $sub->get_parent_invoice_id() );
106
-	$subscription_group  = wp_list_filter( $subscription_groups, compact( 'subscription_id' ) );
105
+	$subscription_groups = getpaid_get_invoice_subscription_groups($sub->get_parent_invoice_id());
106
+	$subscription_group  = wp_list_filter($subscription_groups, compact('subscription_id'));
107 107
 
108
-	if ( 1 < count( $subscription_groups ) ) {
109
-		add_meta_box( 'getpaid_admin_subscription_related_subscriptions_metabox', __( 'Related Subscriptions', 'invoicing' ), 'getpaid_admin_subscription_related_subscriptions_metabox', get_current_screen(), 'advanced' );
108
+	if (1 < count($subscription_groups)) {
109
+		add_meta_box('getpaid_admin_subscription_related_subscriptions_metabox', __('Related Subscriptions', 'invoicing'), 'getpaid_admin_subscription_related_subscriptions_metabox', get_current_screen(), 'advanced');
110 110
 	}
111 111
 
112
-	if ( ! empty( $subscription_group ) ) {
113
-		add_meta_box( 'getpaid_admin_subscription_item_details_metabox', __( 'Subscription Items', 'invoicing' ), 'getpaid_admin_subscription_item_details_metabox', get_current_screen(), 'normal', 'low' );
112
+	if (!empty($subscription_group)) {
113
+		add_meta_box('getpaid_admin_subscription_item_details_metabox', __('Subscription Items', 'invoicing'), 'getpaid_admin_subscription_item_details_metabox', get_current_screen(), 'normal', 'low');
114 114
 	}
115 115
 
116
-	add_meta_box( 'getpaid_admin_subscription_invoice_details_metabox', __( 'Related Invoices', 'invoicing' ), 'getpaid_admin_subscription_invoice_details_metabox', get_current_screen(), 'advanced' );
116
+	add_meta_box('getpaid_admin_subscription_invoice_details_metabox', __('Related Invoices', 'invoicing'), 'getpaid_admin_subscription_invoice_details_metabox', get_current_screen(), 'advanced');
117 117
 
118
-	do_action( 'getpaid_admin_single_subscription_register_metabox', $sub );
118
+	do_action('getpaid_admin_single_subscription_register_metabox', $sub);
119 119
 
120 120
 	?>
121 121
 
122
-		<form method="post" action="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $sub->get_id() ) ) ); ?>">
122
+		<form method="post" action="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($sub->get_id()))); ?>">
123 123
 
124
-			<?php wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); ?>
125
-			<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
126
-			<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
124
+			<?php wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); ?>
125
+			<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
126
+			<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
127 127
 			<input type="hidden" name="getpaid-admin-action" value="update_single_subscription" />
128 128
 			<input type="hidden" name="subscription_id" value="<?php echo (int) $sub->get_id(); ?>" />
129 129
 
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 				<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
132 132
 
133 133
 					<div id="postbox-container-1" class="postbox-container">
134
-						<?php do_meta_boxes( get_current_screen(), 'side', $sub ); ?>
134
+						<?php do_meta_boxes(get_current_screen(), 'side', $sub); ?>
135 135
 					</div>
136 136
 
137 137
 					<div id="postbox-container-2" class="postbox-container">
138
-						<?php do_meta_boxes( get_current_screen(), 'normal', $sub ); ?>
139
-						<?php do_meta_boxes( get_current_screen(), 'advanced', $sub ); ?>
138
+						<?php do_meta_boxes(get_current_screen(), 'normal', $sub); ?>
139
+						<?php do_meta_boxes(get_current_screen(), 'advanced', $sub); ?>
140 140
 					</div>
141 141
 
142 142
 				</div>
@@ -155,43 +155,43 @@  discard block
 block discarded – undo
155 155
  *
156 156
  * @param WPInv_Subscription $sub
157 157
  */
158
-function getpaid_admin_subscription_details_metabox( $sub ) {
158
+function getpaid_admin_subscription_details_metabox($sub) {
159 159
 
160 160
 	// Subscription items.
161
-	$subscription_group = getpaid_get_invoice_subscription_group( $sub->get_parent_invoice_id(), $sub->get_id() );
162
-	$items_count        = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] );
161
+	$subscription_group = getpaid_get_invoice_subscription_group($sub->get_parent_invoice_id(), $sub->get_id());
162
+	$items_count        = empty($subscription_group) ? 1 : count($subscription_group['items']);
163 163
 
164 164
 	// Prepare subscription detail columns.
165 165
 	$fields = apply_filters(
166 166
 		'getpaid_subscription_admin_page_fields',
167 167
 		array(
168
-			'subscription' => __( 'Subscription', 'invoicing' ),
169
-			'customer'     => __( 'Customer', 'invoicing' ),
170
-			'amount'       => __( 'Amount', 'invoicing' ),
171
-			'start_date'   => __( 'Start Date', 'invoicing' ),
172
-			'renews_on'    => __( 'Next Payment', 'invoicing' ),
173
-			'renewals'     => __( 'Payments', 'invoicing' ),
174
-			'item'         => _n( 'Item', 'Items', $items_count, 'invoicing' ),
175
-			'gateway'      => __( 'Payment Method', 'invoicing' ),
176
-			'profile_id'   => __( 'Profile ID', 'invoicing' ),
177
-			'status'       => __( 'Status', 'invoicing' ),
168
+			'subscription' => __('Subscription', 'invoicing'),
169
+			'customer'     => __('Customer', 'invoicing'),
170
+			'amount'       => __('Amount', 'invoicing'),
171
+			'start_date'   => __('Start Date', 'invoicing'),
172
+			'renews_on'    => __('Next Payment', 'invoicing'),
173
+			'renewals'     => __('Payments', 'invoicing'),
174
+			'item'         => _n('Item', 'Items', $items_count, 'invoicing'),
175
+			'gateway'      => __('Payment Method', 'invoicing'),
176
+			'profile_id'   => __('Profile ID', 'invoicing'),
177
+			'status'       => __('Status', 'invoicing'),
178 178
 		)
179 179
 	);
180 180
 
181
-	if ( ! $sub->is_active() ) {
181
+	if (!$sub->is_active()) {
182 182
 
183
-		if ( isset( $fields['renews_on'] ) ) {
184
-			unset( $fields['renews_on'] );
183
+		if (isset($fields['renews_on'])) {
184
+			unset($fields['renews_on']);
185 185
 		}
186 186
 
187
-		if ( isset( $fields['gateway'] ) ) {
188
-			unset( $fields['gateway'] );
187
+		if (isset($fields['gateway'])) {
188
+			unset($fields['gateway']);
189 189
 		}
190 190
 }
191 191
 
192 192
 	$profile_id = $sub->get_profile_id();
193
-	if ( empty( $profile_id ) && isset( $fields['profile_id'] ) ) {
194
-		unset( $fields['profile_id'] );
193
+	if (empty($profile_id) && isset($fields['profile_id'])) {
194
+		unset($fields['profile_id']);
195 195
 	}
196 196
 
197 197
 	?>
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
 		<table class="table table-borderless" style="font-size: 14px;">
200 200
 			<tbody>
201 201
 
202
-				<?php foreach ( $fields as $key => $label ) : ?>
202
+				<?php foreach ($fields as $key => $label) : ?>
203 203
 
204
-					<tr class="getpaid-subscription-meta-<?php echo esc_attr( $key ); ?>">
204
+					<tr class="getpaid-subscription-meta-<?php echo esc_attr($key); ?>">
205 205
 
206 206
 						<th class="w-25" style="font-weight: 500;">
207
-							<?php echo esc_html( $label ); ?>
207
+							<?php echo esc_html($label); ?>
208 208
 						</th>
209 209
 
210 210
 						<td class="w-75 text-muted">
211
-							<?php do_action( 'getpaid_subscription_admin_display_' . sanitize_key( $key ), $sub, $subscription_group ); ?>
211
+							<?php do_action('getpaid_subscription_admin_display_' . sanitize_key($key), $sub, $subscription_group); ?>
212 212
 						</td>
213 213
 
214 214
 					</tr>
@@ -226,135 +226,135 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @param WPInv_Subscription $subscription
228 228
  */
229
-function getpaid_admin_subscription_metabox_display_customer( $subscription ) {
229
+function getpaid_admin_subscription_metabox_display_customer($subscription) {
230 230
 
231
-	$username = __( '(Missing User)', 'invoicing' );
231
+	$username = __('(Missing User)', 'invoicing');
232 232
 
233
-	$user = get_userdata( $subscription->get_customer_id() );
234
-	if ( $user ) {
233
+	$user = get_userdata($subscription->get_customer_id());
234
+	if ($user) {
235 235
 
236 236
 		$username = sprintf(
237 237
 			'<a href="user-edit.php?user_id=%s">%s</a>',
238
-			absint( $user->ID ),
239
-			! empty( $user->display_name ) ? esc_html( $user->display_name ) : sanitize_email( $user->user_email )
238
+			absint($user->ID),
239
+			!empty($user->display_name) ? esc_html($user->display_name) : sanitize_email($user->user_email)
240 240
 		);
241 241
 
242 242
 	}
243 243
 
244
-	echo wp_kses_post( $username );
244
+	echo wp_kses_post($username);
245 245
 }
246
-add_action( 'getpaid_subscription_admin_display_customer', 'getpaid_admin_subscription_metabox_display_customer' );
246
+add_action('getpaid_subscription_admin_display_customer', 'getpaid_admin_subscription_metabox_display_customer');
247 247
 
248 248
 /**
249 249
  * Displays the subscription amount.
250 250
  *
251 251
  * @param WPInv_Subscription $subscription
252 252
  */
253
-function getpaid_admin_subscription_metabox_display_amount( $subscription ) {
254
-	$amount    = getpaid_get_formatted_subscription_amount( $subscription );
255
-	echo wp_kses_post( "<span>$amount</span>" );
253
+function getpaid_admin_subscription_metabox_display_amount($subscription) {
254
+	$amount = getpaid_get_formatted_subscription_amount($subscription);
255
+	echo wp_kses_post("<span>$amount</span>");
256 256
 }
257
-add_action( 'getpaid_subscription_admin_display_amount', 'getpaid_admin_subscription_metabox_display_amount' );
257
+add_action('getpaid_subscription_admin_display_amount', 'getpaid_admin_subscription_metabox_display_amount');
258 258
 
259 259
 /**
260 260
  * Displays the subscription id.
261 261
  *
262 262
  * @param WPInv_Subscription $subscription
263 263
  */
264
-function getpaid_admin_subscription_metabox_display_id( $subscription ) {
264
+function getpaid_admin_subscription_metabox_display_id($subscription) {
265 265
 
266 266
 	printf(
267 267
 		'<a href="%s">#%s</a>',
268
-		esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $subscription->get_id() ) ) ),
269
-		absint( $subscription->get_id() )
268
+		esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($subscription->get_id()))),
269
+		absint($subscription->get_id())
270 270
 	);
271 271
 
272 272
 }
273
-add_action( 'getpaid_subscription_admin_display_subscription', 'getpaid_admin_subscription_metabox_display_id' );
273
+add_action('getpaid_subscription_admin_display_subscription', 'getpaid_admin_subscription_metabox_display_id');
274 274
 
275 275
 /**
276 276
  * Displays the subscription renewal date.
277 277
  *
278 278
  * @param WPInv_Subscription $subscription
279 279
  */
280
-function getpaid_admin_subscription_metabox_display_start_date( $subscription ) {
281
-	echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) );
280
+function getpaid_admin_subscription_metabox_display_start_date($subscription) {
281
+	echo esc_html(getpaid_format_date_value($subscription->get_date_created()));
282 282
 }
283
-add_action( 'getpaid_subscription_admin_display_start_date', 'getpaid_admin_subscription_metabox_display_start_date' );
283
+add_action('getpaid_subscription_admin_display_start_date', 'getpaid_admin_subscription_metabox_display_start_date');
284 284
 
285 285
 /**
286 286
  * Displays the subscription renewal date.
287 287
  *
288 288
  * @param WPInv_Subscription $subscription
289 289
  */
290
-function getpaid_admin_subscription_metabox_display_renews_on( $subscription ) {
291
-	echo esc_html( getpaid_format_date_value( $subscription->get_expiration() ) );
290
+function getpaid_admin_subscription_metabox_display_renews_on($subscription) {
291
+	echo esc_html(getpaid_format_date_value($subscription->get_expiration()));
292 292
 }
293
-add_action( 'getpaid_subscription_admin_display_renews_on', 'getpaid_admin_subscription_metabox_display_renews_on' );
293
+add_action('getpaid_subscription_admin_display_renews_on', 'getpaid_admin_subscription_metabox_display_renews_on');
294 294
 
295 295
 /**
296 296
  * Displays the subscription renewal count.
297 297
  *
298 298
  * @param WPInv_Subscription $subscription
299 299
  */
300
-function getpaid_admin_subscription_metabox_display_renewals( $subscription ) {
300
+function getpaid_admin_subscription_metabox_display_renewals($subscription) {
301 301
 	$max_bills = $subscription->get_bill_times();
302
-	echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '&infin;' : (int) $max_bills );
302
+	echo ((int) $subscription->get_times_billed()) . ' / ' . (empty($max_bills) ? '&infin;' : (int) $max_bills);
303 303
 }
304
-add_action( 'getpaid_subscription_admin_display_renewals', 'getpaid_admin_subscription_metabox_display_renewals' );
304
+add_action('getpaid_subscription_admin_display_renewals', 'getpaid_admin_subscription_metabox_display_renewals');
305 305
 /**
306 306
  * Displays the subscription item.
307 307
  *
308 308
  * @param WPInv_Subscription $subscription
309 309
  * @param false|array $subscription_group
310 310
  */
311
-function getpaid_admin_subscription_metabox_display_item( $subscription, $subscription_group = false ) {
311
+function getpaid_admin_subscription_metabox_display_item($subscription, $subscription_group = false) {
312 312
 
313
-	if ( empty( $subscription_group ) ) {
314
-		echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) );
313
+	if (empty($subscription_group)) {
314
+		echo wp_kses_post(WPInv_Subscriptions_List_Table::generate_item_markup($subscription->get_product_id()));
315 315
 		return;
316 316
 	}
317 317
 
318
-	$markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
319
-	echo wp_kses_post( implode( ' | ', $markup ) );
318
+	$markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items']));
319
+	echo wp_kses_post(implode(' | ', $markup));
320 320
 
321 321
 }
322
-add_action( 'getpaid_subscription_admin_display_item', 'getpaid_admin_subscription_metabox_display_item', 10, 2 );
322
+add_action('getpaid_subscription_admin_display_item', 'getpaid_admin_subscription_metabox_display_item', 10, 2);
323 323
 
324 324
 /**
325 325
  * Displays the subscription gateway.
326 326
  *
327 327
  * @param WPInv_Subscription $subscription
328 328
  */
329
-function getpaid_admin_subscription_metabox_display_gateway( $subscription ) {
329
+function getpaid_admin_subscription_metabox_display_gateway($subscription) {
330 330
 
331 331
 	$gateway = $subscription->get_gateway();
332 332
 
333
-	if ( ! empty( $gateway ) ) {
334
-		echo esc_html( wpinv_get_gateway_admin_label( $gateway ) );
333
+	if (!empty($gateway)) {
334
+		echo esc_html(wpinv_get_gateway_admin_label($gateway));
335 335
 	} else {
336 336
 		echo '&mdash;';
337 337
 	}
338 338
 
339 339
 }
340
-add_action( 'getpaid_subscription_admin_display_gateway', 'getpaid_admin_subscription_metabox_display_gateway' );
340
+add_action('getpaid_subscription_admin_display_gateway', 'getpaid_admin_subscription_metabox_display_gateway');
341 341
 
342 342
 /**
343 343
  * Displays the subscription status.
344 344
  *
345 345
  * @param WPInv_Subscription $subscription
346 346
  */
347
-function getpaid_admin_subscription_metabox_display_status( $subscription ) {
348
-	echo wp_kses_post( $subscription->get_status_label_html() );
347
+function getpaid_admin_subscription_metabox_display_status($subscription) {
348
+	echo wp_kses_post($subscription->get_status_label_html());
349 349
 }
350
-add_action( 'getpaid_subscription_admin_display_status', 'getpaid_admin_subscription_metabox_display_status' );
350
+add_action('getpaid_subscription_admin_display_status', 'getpaid_admin_subscription_metabox_display_status');
351 351
 
352 352
 /**
353 353
  * Displays the subscription profile id.
354 354
  *
355 355
  * @param WPInv_Subscription $subscription
356 356
  */
357
-function getpaid_admin_subscription_metabox_display_profile_id( $subscription ) {
357
+function getpaid_admin_subscription_metabox_display_profile_id($subscription) {
358 358
 
359 359
 	$profile_id = $subscription->get_profile_id();
360 360
 
@@ -363,30 +363,30 @@  discard block
 block discarded – undo
363 363
 			'type'              => 'text',
364 364
 			'id'                => 'wpinv_subscription_profile_id',
365 365
 			'name'              => 'wpinv_subscription_profile_id',
366
-			'label'             => __( 'Profile Id', 'invoicing' ),
366
+			'label'             => __('Profile Id', 'invoicing'),
367 367
 			'label_type'        => 'hidden',
368
-			'placeholder'       => __( 'Profile Id', 'invoicing' ),
369
-			'value'             => esc_attr( $profile_id ),
368
+			'placeholder'       => __('Profile Id', 'invoicing'),
369
+			'value'             => esc_attr($profile_id),
370 370
 			'input_group_right' => '',
371 371
 			'no_wrap'           => true,
372 372
 		),
373 373
 		true
374 374
 	);
375 375
 
376
-	$url = apply_filters( 'getpaid_remote_subscription_profile_url', '', $subscription );
377
-	if ( ! empty( $url ) ) {
378
-		echo '&nbsp;<a href="' . esc_url_raw( $url ) . '" title="' . esc_attr__( 'View in Gateway', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-xs fa-fw align-top"></i></a>';
376
+	$url = apply_filters('getpaid_remote_subscription_profile_url', '', $subscription);
377
+	if (!empty($url)) {
378
+		echo '&nbsp;<a href="' . esc_url_raw($url) . '" title="' . esc_attr__('View in Gateway', 'invoicing') . '" target="_blank"><i class="fas fa-external-link-alt fa-xs fa-fw align-top"></i></a>';
379 379
 	}
380 380
 
381 381
 }
382
-add_action( 'getpaid_subscription_admin_display_profile_id', 'getpaid_admin_subscription_metabox_display_profile_id' );
382
+add_action('getpaid_subscription_admin_display_profile_id', 'getpaid_admin_subscription_metabox_display_profile_id');
383 383
 
384 384
 /**
385 385
  * Displays the subscriptions update metabox.
386 386
  *
387 387
  * @param WPInv_Subscription $subscription
388 388
  */
389
-function getpaid_admin_subscription_update_metabox( $subscription ) {
389
+function getpaid_admin_subscription_update_metabox($subscription) {
390 390
 
391 391
 	?>
392 392
 	<div class="mt-3">
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
 					'id'        => 'subscription_status_update_select',
400 400
 					'required'  => true,
401 401
 					'no_wrap'   => false,
402
-					'label'     => __( 'Subscription Status', 'invoicing' ),
403
-					'help_text' => __( 'Updating the status will trigger related actions and hooks', 'invoicing' ),
402
+					'label'     => __('Subscription Status', 'invoicing'),
403
+					'help_text' => __('Updating the status will trigger related actions and hooks', 'invoicing'),
404 404
 					'select2'   => true,
405
-					'value'     => $subscription->get_status( 'edit' ),
405
+					'value'     => $subscription->get_status('edit'),
406 406
 				),
407 407
 				true
408 408
 			);
@@ -411,14 +411,14 @@  discard block
 block discarded – undo
411 411
 		<div class="mt-2 px-3 py-2 bg-light border-top" style="margin: -12px;">
412 412
 
413 413
 		<?php
414
-			submit_button( __( 'Update', 'invoicing' ), 'primary', 'submit', false );
414
+			submit_button(__('Update', 'invoicing'), 'primary', 'submit', false);
415 415
 
416
-			$url    = wp_nonce_url( add_query_arg( 'getpaid-admin-action', 'subscription_manual_renew' ), 'getpaid-nonce', 'getpaid-nonce' );
417
-			$anchor = __( 'Renew Subscription', 'invoicing' );
418
-			$title  = esc_attr__( 'Are you sure you want to extend the subscription and generate a new invoice that will be automatically marked as paid?', 'invoicing' );
416
+			$url    = wp_nonce_url(add_query_arg('getpaid-admin-action', 'subscription_manual_renew'), 'getpaid-nonce', 'getpaid-nonce');
417
+			$anchor = __('Renew Subscription', 'invoicing');
418
+			$title  = esc_attr__('Are you sure you want to extend the subscription and generate a new invoice that will be automatically marked as paid?', 'invoicing');
419 419
 
420
-			if ( $subscription->is_active() ) {
421
-			echo "<a href='" . esc_url( $url ) . "' class='float-right text-muted' onclick='return confirm(\"" . esc_attr( $title ) . "\")'>" . esc_html( $anchor ) . "</a>";
420
+			if ($subscription->is_active()) {
421
+			echo "<a href='" . esc_url($url) . "' class='float-right text-muted' onclick='return confirm(\"" . esc_attr($title) . "\")'>" . esc_html($anchor) . "</a>";
422 422
 			}
423 423
 
424 424
 	echo '</div></div>';
@@ -430,44 +430,44 @@  discard block
 block discarded – undo
430 430
  * @param WPInv_Subscription $subscription
431 431
  * @param bool $strict Whether or not to skip invoices of sibling subscriptions
432 432
  */
433
-function getpaid_admin_subscription_invoice_details_metabox( $subscription, $strict = true ) {
433
+function getpaid_admin_subscription_invoice_details_metabox($subscription, $strict = true) {
434 434
 
435 435
 	$columns = apply_filters(
436 436
 		'getpaid_subscription_related_invoices_columns',
437 437
 		array(
438
-			'invoice'      => __( 'Invoice', 'invoicing' ),
439
-			'relationship' => __( 'Relationship', 'invoicing' ),
440
-			'date'         => __( 'Date', 'invoicing' ),
441
-			'status'       => __( 'Status', 'invoicing' ),
442
-			'total'        => __( 'Total', 'invoicing' ),
438
+			'invoice'      => __('Invoice', 'invoicing'),
439
+			'relationship' => __('Relationship', 'invoicing'),
440
+			'date'         => __('Date', 'invoicing'),
441
+			'status'       => __('Status', 'invoicing'),
442
+			'total'        => __('Total', 'invoicing'),
443 443
 		),
444 444
 		$subscription
445 445
 	);
446 446
 
447 447
 	// Prepare the invoices.
448
-	$payments = $subscription->get_child_payments( ! is_admin() );
448
+	$payments = $subscription->get_child_payments(!is_admin());
449 449
 	$parent   = $subscription->get_parent_invoice();
450 450
 
451
-	if ( $parent->exists() ) {
452
-		$payments = array_merge( array( $parent ), $payments );
451
+	if ($parent->exists()) {
452
+		$payments = array_merge(array($parent), $payments);
453 453
 	}
454 454
 
455 455
 	$table_class = 'w-100 bg-white';
456 456
 
457
-	if ( ! is_admin() ) {
457
+	if (!is_admin()) {
458 458
 		$table_class = 'table table-bordered';
459 459
 	}
460 460
 
461 461
 	?>
462 462
 		<div class="m-0" style="overflow: auto;">
463 463
 
464
-			<table class="<?php echo esc_attr( $table_class ); ?>">
464
+			<table class="<?php echo esc_attr($table_class); ?>">
465 465
 
466 466
 				<thead>
467 467
 					<tr>
468 468
 						<?php
469
-							foreach ( $columns as $key => $label ) {
470
-							echo "<th class='subscription-invoice-field-" . esc_attr( $key ) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html( $label ) . "</th>";
469
+							foreach ($columns as $key => $label) {
470
+							echo "<th class='subscription-invoice-field-" . esc_attr($key) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html($label) . "</th>";
471 471
 							}
472 472
 						?>
473 473
 					</tr>
@@ -475,71 +475,71 @@  discard block
 block discarded – undo
475 475
 
476 476
 				<tbody>
477 477
 
478
-					<?php if ( empty( $payments ) ) : ?>
478
+					<?php if (empty($payments)) : ?>
479 479
 						<tr>
480
-							<td colspan="<?php echo count( $columns ); ?>" class="p-2 text-left text-muted">
481
-								<?php esc_html_e( 'This subscription has no invoices.', 'invoicing' ); ?>
480
+							<td colspan="<?php echo count($columns); ?>" class="p-2 text-left text-muted">
481
+								<?php esc_html_e('This subscription has no invoices.', 'invoicing'); ?>
482 482
 							</td>
483 483
 						</tr>
484 484
 					<?php endif; ?>
485 485
 
486 486
 					<?php
487 487
 
488
-						foreach ( $payments as $payment ) :
488
+						foreach ($payments as $payment) :
489 489
 
490 490
 						// Ensure that we have an invoice.
491
-						$payment = new WPInv_Invoice( $payment );
491
+						$payment = new WPInv_Invoice($payment);
492 492
 
493 493
 						// Abort if the invoice is invalid...
494
-						if ( ! $payment->exists() ) {
494
+						if (!$payment->exists()) {
495 495
 							continue;
496 496
 							}
497 497
 
498 498
 						// ... or belongs to a different subscription.
499
-						if ( $strict && $payment->is_renewal() && $payment->get_subscription_id() && $payment->get_subscription_id() != $subscription->get_id() ) {
499
+						if ($strict && $payment->is_renewal() && $payment->get_subscription_id() && $payment->get_subscription_id() != $subscription->get_id()) {
500 500
 							continue;
501 501
 							}
502 502
 
503 503
 						echo '<tr>';
504 504
 
505
-						foreach ( array_keys( $columns ) as $key ) {
505
+						foreach (array_keys($columns) as $key) {
506 506
 
507 507
 							echo "<td class='p-2 text-left'>";
508 508
 
509
-								switch ( $key ) {
509
+								switch ($key) {
510 510
 
511 511
 								case 'total':
512 512
 										echo '<strong>';
513
-										wpinv_the_price( $payment->get_total(), $payment->get_currency() );
513
+										wpinv_the_price($payment->get_total(), $payment->get_currency());
514 514
 										echo '</strong>';
515 515
 									break;
516 516
 
517 517
 								case 'relationship':
518
-										echo $payment->is_renewal() ? esc_html__( 'Renewal Invoice', 'invoicing' ) : esc_html__( 'Initial Invoice', 'invoicing' );
518
+										echo $payment->is_renewal() ? esc_html__('Renewal Invoice', 'invoicing') : esc_html__('Initial Invoice', 'invoicing');
519 519
 									break;
520 520
 
521 521
 								case 'date':
522
-									echo esc_html( getpaid_format_date_value( $payment->get_date_created() ) );
522
+									echo esc_html(getpaid_format_date_value($payment->get_date_created()));
523 523
 									break;
524 524
 
525 525
 								case 'status':
526 526
 										$status = $payment->get_status_nicename();
527
-										if ( is_admin() ) {
527
+										if (is_admin()) {
528 528
 										$status = $payment->get_status_label_html();
529 529
 										}
530 530
 
531
-										echo wp_kses_post( $status );
531
+										echo wp_kses_post($status);
532 532
 									break;
533 533
 
534 534
 								case 'invoice':
535
-										$link    = esc_url( get_edit_post_link( $payment->get_id() ) );
535
+										$link = esc_url(get_edit_post_link($payment->get_id()));
536 536
 
537
-										if ( ! is_admin() ) {
538
-										$link = esc_url( $payment->get_view_url() );
537
+										if (!is_admin()) {
538
+										$link = esc_url($payment->get_view_url());
539 539
 										}
540 540
 
541
-										$invoice = esc_html( $payment->get_number() );
542
-										echo wp_kses_post( "<a href='$link'>$invoice</a>" );
541
+										$invoice = esc_html($payment->get_number());
542
+										echo wp_kses_post("<a href='$link'>$invoice</a>");
543 543
 									break;
544 544
 										}
545 545
 
@@ -566,12 +566,12 @@  discard block
 block discarded – undo
566 566
  *
567 567
  * @param WPInv_Subscription $subscription
568 568
  */
569
-function getpaid_admin_subscription_item_details_metabox( $subscription ) {
569
+function getpaid_admin_subscription_item_details_metabox($subscription) {
570 570
 
571 571
 	// Fetch the subscription group.
572
-	$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_payment_id(), $subscription->get_id() );
572
+	$subscription_group = getpaid_get_invoice_subscription_group($subscription->get_parent_payment_id(), $subscription->get_id());
573 573
 
574
-	if ( empty( $subscription_group ) || empty( $subscription_group['items'] ) ) {
574
+	if (empty($subscription_group) || empty($subscription_group['items'])) {
575 575
 		return;
576 576
 	}
577 577
 
@@ -579,12 +579,12 @@  discard block
 block discarded – undo
579 579
 	$columns = apply_filters(
580 580
 		'getpaid_subscription_item_details_columns',
581 581
 		array(
582
-			'item_name' => __( 'Item', 'invoicing' ),
583
-			'price'     => __( 'Price', 'invoicing' ),
584
-			'tax'       => __( 'Tax', 'invoicing' ),
585
-			'discount'  => __( 'Discount', 'invoicing' ),
582
+			'item_name' => __('Item', 'invoicing'),
583
+			'price'     => __('Price', 'invoicing'),
584
+			'tax'       => __('Tax', 'invoicing'),
585
+			'discount'  => __('Discount', 'invoicing'),
586 586
 			//'initial'      => __( 'Initial Amount', 'invoicing' ),
587
-			'recurring' => __( 'Subtotal', 'invoicing' ),
587
+			'recurring' => __('Subtotal', 'invoicing'),
588 588
 		),
589 589
 		$subscription
590 590
 	);
@@ -593,27 +593,27 @@  discard block
 block discarded – undo
593 593
 
594 594
 	$invoice = $subscription->get_parent_invoice();
595 595
 
596
-	if ( ( ! wpinv_use_taxes() || ! $invoice->is_taxable() ) && isset( $columns['tax'] ) ) {
597
-		unset( $columns['tax'] );
596
+	if ((!wpinv_use_taxes() || !$invoice->is_taxable()) && isset($columns['tax'])) {
597
+		unset($columns['tax']);
598 598
 	}
599 599
 
600 600
 	$table_class = 'w-100 bg-white';
601 601
 
602
-	if ( ! is_admin() ) {
602
+	if (!is_admin()) {
603 603
 		$table_class = 'table table-bordered';
604 604
 	}
605 605
 
606 606
 	?>
607 607
 		<div class="m-0" style="overflow: auto;">
608 608
 
609
-			<table class="<?php echo esc_attr( $table_class ); ?>">
609
+			<table class="<?php echo esc_attr($table_class); ?>">
610 610
 
611 611
 				<thead>
612 612
 					<tr>
613 613
 						<?php
614 614
 
615
-							foreach ( $columns as $key => $label ) {
616
-							echo "<th class='subscription-item-field-" . esc_attr( $key ) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html( $label ) . "</th>";
615
+							foreach ($columns as $key => $label) {
616
+							echo "<th class='subscription-item-field-" . esc_attr($key) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html($label) . "</th>";
617 617
 							}
618 618
 						?>
619 619
 					</tr>
@@ -623,48 +623,48 @@  discard block
 block discarded – undo
623 623
 
624 624
 					<?php
625 625
 
626
-						foreach ( $subscription_group['items'] as $subscription_group_item ) :
626
+						foreach ($subscription_group['items'] as $subscription_group_item) :
627 627
 
628 628
 						echo '<tr>';
629 629
 
630
-						foreach ( array_keys( $columns ) as $key ) {
630
+						foreach (array_keys($columns) as $key) {
631 631
 
632 632
 							$class = 'text-left';
633 633
 
634 634
 							echo "<td class='p-2 text-left'>";
635 635
 
636
-								switch ( $key ) {
636
+								switch ($key) {
637 637
 
638 638
 								case 'item_name':
639
-										$item_name = get_the_title( $subscription_group_item['item_id'] );
640
-										$item_name = empty( $item_name ) ? $subscription_group_item['item_name'] : $item_name;
639
+										$item_name = get_the_title($subscription_group_item['item_id']);
640
+										$item_name = empty($item_name) ? $subscription_group_item['item_name'] : $item_name;
641 641
 
642
-										if ( $invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity'] ) {
643
-										echo esc_html( $item_name );
642
+										if ($invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity']) {
643
+										echo esc_html($item_name);
644 644
 										} else {
645
-										printf( '%1$s x %2$d', esc_html( $item_name ), (float) $subscription_group_item['quantity'] );
645
+										printf('%1$s x %2$d', esc_html($item_name), (float) $subscription_group_item['quantity']);
646 646
 											}
647 647
 
648 648
 									break;
649 649
 
650 650
 								case 'price':
651
-									wpinv_the_price( $subscription_group_item['item_price'], $invoice->get_currency() );
651
+									wpinv_the_price($subscription_group_item['item_price'], $invoice->get_currency());
652 652
 									break;
653 653
 
654 654
 								case 'tax':
655
-									wpinv_the_price( $subscription_group_item['tax'], $invoice->get_currency() );
655
+									wpinv_the_price($subscription_group_item['tax'], $invoice->get_currency());
656 656
 									break;
657 657
 
658 658
 								case 'discount':
659
-									wpinv_the_price( $subscription_group_item['discount'], $invoice->get_currency() );
659
+									wpinv_the_price($subscription_group_item['discount'], $invoice->get_currency());
660 660
 									break;
661 661
 
662 662
 								case 'initial':
663
-									wpinv_the_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() );
663
+									wpinv_the_price($subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency());
664 664
 									break;
665 665
 
666 666
 								case 'recurring':
667
-										echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ) . '</strong>' );
667
+										echo wp_kses_post('<strong>' . wpinv_price($subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency()) . '</strong>');
668 668
 									break;
669 669
 
670 670
 										}
@@ -677,24 +677,24 @@  discard block
 block discarded – undo
677 677
 
678 678
 						endforeach;
679 679
 
680
-						foreach ( $subscription_group['fees'] as $subscription_group_fee ) :
680
+						foreach ($subscription_group['fees'] as $subscription_group_fee) :
681 681
 
682 682
 						echo '<tr>';
683 683
 
684
-						foreach ( array_keys( $columns ) as $key ) {
684
+						foreach (array_keys($columns) as $key) {
685 685
 
686 686
 							$class = 'text-left';
687 687
 
688 688
 							echo "<td class='p-2 text-left'>";
689 689
 
690
-								switch ( $key ) {
690
+								switch ($key) {
691 691
 
692 692
 								case 'item_name':
693
-										echo esc_html( $subscription_group_fee['name'] );
693
+										echo esc_html($subscription_group_fee['name']);
694 694
 									break;
695 695
 
696 696
 								case 'price':
697
-									wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() );
697
+									wpinv_the_price($subscription_group_fee['initial_fee'], $invoice->get_currency());
698 698
 									break;
699 699
 
700 700
 								case 'tax':
@@ -706,11 +706,11 @@  discard block
 block discarded – undo
706 706
 									break;
707 707
 
708 708
 								case 'initial':
709
-									wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() );
709
+									wpinv_the_price($subscription_group_fee['initial_fee'], $invoice->get_currency());
710 710
 									break;
711 711
 
712 712
 								case 'recurring':
713
-										echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_fee['recurring_fee'], $invoice->get_currency() ) . '</strong>' );
713
+										echo wp_kses_post('<strong>' . wpinv_price($subscription_group_fee['recurring_fee'], $invoice->get_currency()) . '</strong>');
714 714
 									break;
715 715
 
716 716
 										}
@@ -739,12 +739,12 @@  discard block
 block discarded – undo
739 739
  * @param WPInv_Subscription $subscription
740 740
  * @param bool $skip_current
741 741
  */
742
-function getpaid_admin_subscription_related_subscriptions_metabox( $subscription, $skip_current = true ) {
742
+function getpaid_admin_subscription_related_subscriptions_metabox($subscription, $skip_current = true) {
743 743
 
744 744
 	// Fetch the subscription groups.
745
-	$subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_payment_id() );
745
+	$subscription_groups = getpaid_get_invoice_subscription_groups($subscription->get_parent_payment_id());
746 746
 
747
-	if ( empty( $subscription_groups ) ) {
747
+	if (empty($subscription_groups)) {
748 748
 		return;
749 749
 	}
750 750
 
@@ -752,37 +752,37 @@  discard block
 block discarded – undo
752 752
 	$columns = apply_filters(
753 753
 		'getpaid_subscription_related_subscriptions_columns',
754 754
 		array(
755
-			'subscription' => __( 'Subscription', 'invoicing' ),
756
-			'start_date'   => __( 'Start Date', 'invoicing' ),
757
-			'renewal_date' => __( 'Next Payment', 'invoicing' ),
758
-			'renewals'     => __( 'Payments', 'invoicing' ),
759
-			'item'         => __( 'Items', 'invoicing' ),
760
-			'status'       => __( 'Status', 'invoicing' ),
755
+			'subscription' => __('Subscription', 'invoicing'),
756
+			'start_date'   => __('Start Date', 'invoicing'),
757
+			'renewal_date' => __('Next Payment', 'invoicing'),
758
+			'renewals'     => __('Payments', 'invoicing'),
759
+			'item'         => __('Items', 'invoicing'),
760
+			'status'       => __('Status', 'invoicing'),
761 761
 		),
762 762
 		$subscription
763 763
 	);
764 764
 
765
-	if ( $subscription->get_status() == 'pending' ) {
766
-		unset( $columns['start_date'], $columns['renewal_date'] );
765
+	if ($subscription->get_status() == 'pending') {
766
+		unset($columns['start_date'], $columns['renewal_date']);
767 767
 	}
768 768
 
769 769
 	$table_class = 'w-100 bg-white';
770 770
 
771
-	if ( ! is_admin() ) {
771
+	if (!is_admin()) {
772 772
 		$table_class = 'table table-bordered';
773 773
 	}
774 774
 
775 775
 	?>
776 776
 		<div class="m-0" style="overflow: auto;">
777 777
 
778
-			<table class="<?php echo esc_attr( $table_class ); ?>">
778
+			<table class="<?php echo esc_attr($table_class); ?>">
779 779
 
780 780
 				<thead>
781 781
 					<tr>
782 782
 						<?php
783 783
 
784
-							foreach ( $columns as $key => $label ) {
785
-							echo "<th class='related-subscription-field-" . esc_attr( $key ) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html( $label ) . "</th>";
784
+							foreach ($columns as $key => $label) {
785
+							echo "<th class='related-subscription-field-" . esc_attr($key) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html($label) . "</th>";
786 786
 							}
787 787
 						?>
788 788
 					</tr>
@@ -792,62 +792,62 @@  discard block
 block discarded – undo
792 792
 
793 793
 					<?php
794 794
 
795
-						foreach ( $subscription_groups as $subscription_group ) :
795
+						foreach ($subscription_groups as $subscription_group) :
796 796
 
797 797
 						// Do not list current subscription.
798
-						if ( $skip_current && (int) $subscription_group['subscription_id'] === $subscription->get_id() ) {
798
+						if ($skip_current && (int) $subscription_group['subscription_id'] === $subscription->get_id()) {
799 799
 							continue;
800 800
 							}
801 801
 
802 802
 						// Ensure the subscription exists.
803
-						$_suscription = new WPInv_Subscription( $subscription_group['subscription_id'] );
803
+						$_suscription = new WPInv_Subscription($subscription_group['subscription_id']);
804 804
 
805
-						if ( ! $_suscription->exists() ) {
805
+						if (!$_suscription->exists()) {
806 806
 							continue;
807 807
 							}
808 808
 
809 809
 						echo '<tr>';
810 810
 
811
-						foreach ( array_keys( $columns ) as $key ) {
811
+						foreach (array_keys($columns) as $key) {
812 812
 
813 813
 							$class = 'text-left';
814 814
 
815 815
 							echo "<td class='p-2 text-left'>";
816 816
 
817
-								switch ( $key ) {
817
+								switch ($key) {
818 818
 
819 819
 								case 'status':
820
-										echo wp_kses_post( $_suscription->get_status_label_html() );
820
+										echo wp_kses_post($_suscription->get_status_label_html());
821 821
 									break;
822 822
 
823 823
 								case 'item':
824
-											$markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
825
-											echo wp_kses_post( implode( ' | ', $markup ) );
824
+											$markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items']));
825
+											echo wp_kses_post(implode(' | ', $markup));
826 826
 									break;
827 827
 
828 828
 								case 'renewals':
829 829
 									$max_bills = $_suscription->get_bill_times();
830
-									echo ( (int) $_suscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '&infin;' : (int) $max_bills );
830
+									echo ((int) $_suscription->get_times_billed()) . ' / ' . (empty($max_bills) ? '&infin;' : (int) $max_bills);
831 831
 									break;
832 832
 
833 833
 								case 'renewal_date':
834
-										echo $_suscription->is_active() ? esc_html( getpaid_format_date_value( $_suscription->get_expiration() ) ) : '&mdash;';
834
+										echo $_suscription->is_active() ? esc_html(getpaid_format_date_value($_suscription->get_expiration())) : '&mdash;';
835 835
 									break;
836 836
 
837 837
 								case 'start_date':
838
-										echo 'pending' == $_suscription->get_status() ? '&mdash;' : esc_html( getpaid_format_date_value( $_suscription->get_date_created() ) );
838
+										echo 'pending' == $_suscription->get_status() ? '&mdash;' : esc_html(getpaid_format_date_value($_suscription->get_date_created()));
839 839
 									break;
840 840
 
841 841
 								case 'subscription':
842
-										$url = is_admin() ? admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $_suscription->get_id() ) ) : $_suscription->get_view_url();
842
+										$url = is_admin() ? admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($_suscription->get_id())) : $_suscription->get_view_url();
843 843
 										printf(
844 844
                                             '%1$s#%2$s%3$s',
845
-                                            '<a href="' . esc_url( $url ) . '">',
846
-                                            '<strong>' . intval( $_suscription->get_id() ) . '</strong>',
845
+                                            '<a href="' . esc_url($url) . '">',
846
+                                            '<strong>' . intval($_suscription->get_id()) . '</strong>',
847 847
 											'</a>'
848 848
                                         );
849 849
 
850
-											echo wp_kses_post( WPInv_Subscriptions_List_Table::column_amount( $_suscription ) );
850
+											echo wp_kses_post(WPInv_Subscriptions_List_Table::column_amount($_suscription));
851 851
 									break;
852 852
 
853 853
 										}
Please login to merge, or discard this patch.
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]',
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                                                                     'show_option_all'  => false,
162 162
                                                                     'show_option_none' => false,
163 163
                                                                     'class'            => 'gdmbx2-text-medium wpinv-quick-vat-rule',
164
-                                                                ) );
164
+                                                                ));
165 165
                                                             ?>
166 166
                                                         </span>
167 167
                                                     </label>
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
                                                     <label class="wpi-vat-class">
171 171
                                                         <span class="input-text-wrap">
172 172
                                                             <?php
173
-                                                                wpinv_html_select( array(
173
+                                                                wpinv_html_select(array(
174 174
                                                                     'options'          => array_merge(
175
-                                                                        array( '' => __( 'Select VAT Class', 'invoicing' ) ),
175
+                                                                        array('' => __('Select VAT Class', 'invoicing')),
176 176
                                                                         getpaid_get_tax_classes()
177 177
                                                                     ),
178 178
                                                                     'name'             => '_wpinv_quick[vat_class]',
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                                                                     'show_option_all'  => false,
181 181
                                                                     'show_option_none' => false,
182 182
                                                                     'class'            => 'gdmbx2-text-medium wpinv-quick-vat-class',
183
-                                                                ) );
183
+                                                                ));
184 184
                                                             ?>
185 185
                                                         </span>
186 186
                                                     </label>
@@ -201,29 +201,29 @@  discard block
 block discarded – undo
201 201
                         </td>
202 202
                     </tr>
203 203
                     <tr class="totals">
204
-                        <td colspan="<?php echo ( (int) $cols - 4 ); ?>"></td>
204
+                        <td colspan="<?php echo ((int) $cols - 4); ?>"></td>
205 205
                         <td colspan="4">
206 206
                             <table cellspacing="0" cellpadding="0">
207 207
                                 <tr class="subtotal">
208
-                                    <td class="name"><?php esc_html_e( 'Sub Total:', 'invoicing' );?></td>
209
-                                    <td class="total"><?php wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() );?></td>
208
+                                    <td class="name"><?php esc_html_e('Sub Total:', 'invoicing'); ?></td>
209
+                                    <td class="total"><?php wpinv_the_price($invoice->get_subtotal(), $invoice->get_currency()); ?></td>
210 210
                                     <td class="action"></td>
211 211
                                 </tr>
212 212
                                 <tr class="discount">
213
-                                    <td class="name"><?php esc_html_e( 'Discount:', 'invoicing' ) ; ?></td>
214
-                                    <td class="total"><?php wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() );?></td>
213
+                                    <td class="name"><?php esc_html_e('Discount:', 'invoicing'); ?></td>
214
+                                    <td class="total"><?php wpinv_the_price($invoice->get_total_discount(), $invoice->get_currency()); ?></td>
215 215
                                     <td class="action"></td>
216 216
                                 </tr>
217
-                                <?php if ( $use_taxes ) : ?>
217
+                                <?php if ($use_taxes) : ?>
218 218
                                 <tr class="tax">
219
-                                    <td class="name"><?php esc_html_e( 'Tax:', 'invoicing' );?></td>
220
-                                    <td class="total"><?php wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() );?></td>
219
+                                    <td class="name"><?php esc_html_e('Tax:', 'invoicing'); ?></td>
220
+                                    <td class="total"><?php wpinv_the_price($invoice->get_total_tax(), $invoice->get_currency()); ?></td>
221 221
                                     <td class="action"></td>
222 222
                                 </tr>
223 223
                                 <?php endif; ?>
224 224
                                 <tr class="total">
225
-                                    <td class="name"><?php esc_html_e( 'Total:', 'invoicing' );?></td>
226
-                                    <td class="total"><?php wpinv_the_price( $invoice->get_total(), $invoice->get_currency() );?></td>
225
+                                    <td class="name"><?php esc_html_e('Total:', 'invoicing'); ?></td>
226
+                                    <td class="total"><?php wpinv_the_price($invoice->get_total(), $invoice->get_currency()); ?></td>
227 227
                                     <td class="action"></td>
228 228
                                 </tr>
229 229
                             </table>
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             </table>
235 235
             <div class="wpinv-actions">
236 236
                 <?php
237
-                    if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
237
+                    if (!$invoice->is_paid() && !$invoice->is_refunded()) {
238 238
                         wpinv_item_dropdown(
239 239
                             array(
240 240
                                 'name'             => 'wpinv_invoice_item',
@@ -244,61 +244,61 @@  discard block
 block discarded – undo
244 244
                             )
245 245
                         );
246 246
 
247
-                        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>';
248
-                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__( 'Create new item', 'invoicing' ) . '</button>';
249
-                        echo "&nbsp;" . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__( 'Recalculate Totals', 'invoicing' ) . '</button>';
247
+                        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>';
248
+                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__('Create new item', 'invoicing') . '</button>';
249
+                        echo "&nbsp;" . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__('Recalculate Totals', 'invoicing') . '</button>';
250 250
 
251 251
                     }
252 252
                 ?>
253
-                <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?>
253
+                <?php do_action('wpinv_invoice_items_actions', $invoice); ?>
254 254
             </div>
255 255
         </div>
256 256
         <?php
257 257
     }
258 258
 
259
-    public static function output_row( $columns, $item, $invoice, $class='even' ) {
259
+    public static function output_row($columns, $item, $invoice, $class = 'even') {
260 260
 
261 261
     ?>
262
-        <tr class="item item-<?php echo esc_attr( $class ); ?>" data-item-id="<?php echo esc_attr( $item->get_id() ); ?>">
263
-            <?php foreach ( array_keys( $columns ) as $column ) : ?>
264
-                <td class="<?php echo esc_attr( $column ); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>">
262
+        <tr class="item item-<?php echo esc_attr($class); ?>" data-item-id="<?php echo esc_attr($item->get_id()); ?>">
263
+            <?php foreach (array_keys($columns) as $column) : ?>
264
+                <td class="<?php echo esc_attr($column); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>">
265 265
                     <?php
266
-                        switch ( $column ) {
266
+                        switch ($column) {
267 267
                             case 'id':
268 268
                                 echo (int) $item->get_id();
269 269
                                 break;
270 270
                             case 'title':
271 271
                                 printf(
272 272
                                     '<a href="%s" target="_blank">%s</a>',
273
-                                    esc_url( get_edit_post_link( $item->get_id() ) ),
274
-                                    esc_html( $item->get_raw_name() )
273
+                                    esc_url(get_edit_post_link($item->get_id())),
274
+                                    esc_html($item->get_raw_name())
275 275
                                 );
276 276
 
277
-                                $summary = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice );
278
-                                if ( $summary !== '' ) {
277
+                                $summary = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice);
278
+                                if ($summary !== '') {
279 279
                                     printf(
280 280
                                         '<span class="meta">%s</span>',
281
-                                        wp_kses_post( wpautop( $summary ) )
281
+                                        wp_kses_post(wpautop($summary))
282 282
                                     );
283 283
                                 }
284 284
 
285 285
                                 printf(
286 286
                                     '<input type="hidden" value="%s" name="getpaid_items[%s][name]" class="getpaid-recalculate-prices-on-change" />',
287
-                                    esc_attr( $item->get_raw_name() ),
287
+                                    esc_attr($item->get_raw_name()),
288 288
                                     (int) $item->get_id()
289 289
                                 );
290 290
 
291 291
                                 printf(
292 292
                                     '<textarea style="display: none;" name="getpaid_items[%s][description]" class="getpaid-recalculate-prices-on-change">%s</textarea>',
293 293
                                     (int) $item->get_id(),
294
-                                    esc_attr( $item->get_description() )
294
+                                    esc_attr($item->get_description())
295 295
                                 );
296 296
 
297 297
                                 break;
298 298
                             case 'price':
299 299
                                 printf(
300 300
                                     '<input type="text" value="%s" name="getpaid_items[%s][price]" style="width: 100px;" class="getpaid-admin-invoice-item-price getpaid-recalculate-prices-on-change" />',
301
-                                    esc_attr( getpaid_unstandardize_amount( $item->get_price() ) ),
301
+                                    esc_attr(getpaid_unstandardize_amount($item->get_price())),
302 302
                                     (int) $item->get_id()
303 303
                                 );
304 304
 
@@ -306,26 +306,26 @@  discard block
 block discarded – undo
306 306
                             case 'qty':
307 307
                                 printf(
308 308
                                     '<input type="text" style="width: 100px;" value="%s" name="getpaid_items[%s][quantity]" class="getpaid-admin-invoice-item-quantity getpaid-recalculate-prices-on-change" />',
309
-                                    floatval( $item->get_quantity() ),
309
+                                    floatval($item->get_quantity()),
310 310
                                     (int) $item->get_id()
311 311
                                 );
312 312
 
313 313
                                 break;
314 314
                             case 'total':
315
-                                wpinv_the_price( $item->get_sub_total(), $invoice->get_currency() );
315
+                                wpinv_the_price($item->get_sub_total(), $invoice->get_currency());
316 316
 
317 317
                                 break;
318 318
                             case 'tax':
319
-                                echo floatval( wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
319
+                                echo floatval(wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%';
320 320
 
321 321
                                 break;
322 322
                             case 'action':
323
-                                if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
323
+                                if (!$invoice->is_paid() && !$invoice->is_refunded()) {
324 324
                                     echo '<i class="fa fa-trash wpinv-item-remove"></i>';
325 325
                                 }
326 326
                                 break;
327 327
                         }
328
-                        do_action( 'getpaid_admin_edit_invoice_item_' . $column, $item, $invoice );
328
+                        do_action('getpaid_admin_edit_invoice_item_' . $column, $item, $invoice);
329 329
                     ?>
330 330
                 </td>
331 331
             <?php endforeach; ?>
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @param WP_Post $post
340 340
 	 */
341
-    public static function output2( $post ) {
341
+    public static function output2($post) {
342 342
 
343 343
         // Prepare the invoice.
344
-        $invoice = new WPInv_Invoice( $post );
344
+        $invoice = new WPInv_Invoice($post);
345 345
 
346 346
         // Invoice items.
347 347
         $items = $invoice->get_items();
@@ -349,28 +349,28 @@  discard block
 block discarded – undo
349 349
         $totals = array(
350 350
 
351 351
             'subtotal'  => array(
352
-                'label' => __( 'Items Subtotal', 'invoicing' ),
353
-                'value' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ),
352
+                'label' => __('Items Subtotal', 'invoicing'),
353
+                'value' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()),
354 354
             ),
355 355
 
356 356
             'discount'  => array(
357
-                'label' => __( 'Total Discount', 'invoicing' ),
358
-                'value' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ),
357
+                'label' => __('Total Discount', 'invoicing'),
358
+                'value' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()),
359 359
             ),
360 360
 
361 361
             'tax'       => array(
362
-                'label' => __( 'Total Tax', 'invoicing' ),
363
-                'value' => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ),
362
+                'label' => __('Total Tax', 'invoicing'),
363
+                'value' => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()),
364 364
             ),
365 365
 
366 366
             'total'     => array(
367
-                'label' => __( 'Invoice Total', 'invoicing' ),
368
-                'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ),
367
+                'label' => __('Invoice Total', 'invoicing'),
368
+                'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()),
369 369
             )
370 370
         );
371 371
 
372
-        if ( ! wpinv_use_taxes() ) {
373
-            unset( $totals['tax'] );
372
+        if (!wpinv_use_taxes()) {
373
+            unset($totals['tax']);
374 374
         }
375 375
 
376 376
         $item_args = array(
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
             'orderby'        => 'title',
379 379
             'order'          => 'ASC',
380 380
             'posts_per_page' => -1,
381
-            'post_status'    => array( 'publish' ),
381
+            'post_status'    => array('publish'),
382 382
             'meta_query'     => array(
383 383
                 array(
384 384
                     'key'       => '_wpinv_type',
@@ -402,10 +402,10 @@  discard block
 block discarded – undo
402 402
             }
403 403
         </style>
404 404
 
405
-                <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;">
405
+                <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;">
406 406
 
407
-                    <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?>
408
-                        <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?>
407
+                    <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?>
408
+                        <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?>
409 409
 
410 410
                         <div class="row">
411 411
                             <div class="col-12 col-sm-6">
@@ -414,15 +414,15 @@  discard block
 block discarded – undo
414 414
                                         array(
415 415
                                             'id'          => 'wpinv_template',
416 416
                                             'name'        => 'wpinv_template',
417
-                                            'label'       => __( 'Template', 'invoicing' ),
417
+                                            'label'       => __('Template', 'invoicing'),
418 418
                                             'label_type'  => 'vertical',
419
-                                            'placeholder' => __( 'Choose a template', 'invoicing' ),
419
+                                            'placeholder' => __('Choose a template', 'invoicing'),
420 420
                                             'class'       => 'form-control-sm',
421
-                                            'value'       => $invoice->get_template( 'edit' ),
421
+                                            'value'       => $invoice->get_template('edit'),
422 422
                                             'options'     => array(
423
-                                                'quantity' => __( 'Quantity', 'invoicing' ),
424
-                                                'hours'    => __( 'Hours', 'invoicing' ),
425
-                                                'amount'   => __( 'Amount Only', 'invoicing' ),
423
+                                                'quantity' => __('Quantity', 'invoicing'),
424
+                                                'hours'    => __('Hours', 'invoicing'),
425
+                                                'amount'   => __('Amount Only', 'invoicing'),
426 426
                                             ),
427 427
                                             'data-allow-clear' => 'false',
428 428
                                             'select2'          => true,
@@ -439,11 +439,11 @@  discard block
 block discarded – undo
439 439
                                         array(
440 440
                                             'id'          => 'wpinv_currency',
441 441
                                             'name'        => 'wpinv_currency',
442
-                                            'label'       => __( 'Currency', 'invoicing' ),
442
+                                            'label'       => __('Currency', 'invoicing'),
443 443
                                             'label_type'  => 'vertical',
444
-                                            'placeholder' => __( 'Select Invoice Currency', 'invoicing' ),
444
+                                            'placeholder' => __('Select Invoice Currency', 'invoicing'),
445 445
                                             'class'       => 'form-control-sm',
446
-                                            'value'       => $invoice->get_currency( 'edit' ),
446
+                                            'value'       => $invoice->get_currency('edit'),
447 447
                                             'required'    => false,
448 448
                                             'data-allow-clear' => 'false',
449 449
                                             'select2'          => true,
@@ -456,24 +456,24 @@  discard block
 block discarded – undo
456 456
                             </div>
457 457
                         </div>
458 458
 
459
-                        <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?>
459
+                        <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?>
460 460
                     <?php endif; ?>
461 461
 
462 462
                     <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items">
463 463
                         <thead>
464 464
                             <tr>
465
-                                <th class="getpaid-item" colspan="2"><?php esc_html_e( 'Item', 'invoicing' ) ?></th>
465
+                                <th class="getpaid-item" colspan="2"><?php esc_html_e('Item', 'invoicing') ?></th>
466 466
                                 <th class="getpaid-quantity hide-if-amount text-right">
467
-                                    <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Quantity', 'invoicing' ) ?></span>
468
-                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Hours', 'invoicing' ) ?></span>
467
+                                    <span class="getpaid-hide-if-hours"><?php esc_html_e('Quantity', 'invoicing') ?></span>
468
+                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e('Hours', 'invoicing') ?></span>
469 469
                                 </th>
470 470
                                 <th class="getpaid-price hide-if-amount text-right">
471
-                                    <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Price', 'invoicing' ) ?></span>
472
-                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Rate', 'invoicing' ) ?></span>
471
+                                    <span class="getpaid-hide-if-hours"><?php esc_html_e('Price', 'invoicing') ?></span>
472
+                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e('Rate', 'invoicing') ?></span>
473 473
                                 </th>
474 474
                                 <th class="getpaid-item-subtotal text-right">
475
-                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php esc_html_e( 'Amount', 'invoicing' ) ?></span>
476
-                                    <span class="hide-if-amount"><?php esc_html_e( 'Total', 'invoicing' ) ?></span>
475
+                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php esc_html_e('Amount', 'invoicing') ?></span>
476
+                                    <span class="hide-if-amount"><?php esc_html_e('Total', 'invoicing') ?></span>
477 477
                                 </th>
478 478
                                 <th class="getpaid-item-actions hide-if-not-editable" width="70px">&nbsp;</th>
479 479
                             </tr>
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 		                <tbody class="getpaid_invoice_line_items">
482 482
                             <tr class="hide-if-has-items hide-if-not-editable">
483 483
                                 <td colspan="2" class="pt-4 pb-4">
484
-                                    <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>
485
-                                    <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>
484
+                                    <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>
485
+                                    <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 486
                                 </td>
487 487
                                 <td class="hide-if-amount">&nbsp;</th>
488 488
                                 <td class="hide-if-amount">&nbsp;</th>
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
                             <div class="col-12 col-sm-6 offset-sm-6">
515 515
                                 <table class="getpaid-invoice-totals text-right w-100">
516 516
                                     <tbody>
517
-                                        <?php foreach ( apply_filters( 'getpaid_invoice_subtotal_rows', $totals, $invoice ) as $key => $data ) : ?>
518
-                                            <tr class="getpaid-totals-<?php echo esc_attr( $key ); ?>">
519
-                                                <td class="label"><?php echo esc_html( $data['label'] ) ?>:</td>
517
+                                        <?php foreach (apply_filters('getpaid_invoice_subtotal_rows', $totals, $invoice) as $key => $data) : ?>
518
+                                            <tr class="getpaid-totals-<?php echo esc_attr($key); ?>">
519
+                                                <td class="label"><?php echo esc_html($data['label']) ?>:</td>
520 520
                                                 <td width="1%"></td>
521
-                                                <td class="value"><?php echo wp_kses_post( $data['value'] ) ?></td>
521
+                                                <td class="value"><?php echo wp_kses_post($data['value']) ?></td>
522 522
                                             </tr>
523 523
                                         <?php endforeach; ?>
524 524
                                     </tbody>
@@ -531,18 +531,18 @@  discard block
 block discarded – undo
531 531
                     <div class="getpaid-invoice-item-actions hide-if-no-items hide-if-not-editable">
532 532
                         <div class="row">
533 533
                             <div class="text-left col-12 col-sm-8">
534
-                                <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>
535
-                                <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>
536
-                                <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?>
534
+                                <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>
535
+                                <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>
536
+                                <?php do_action('getpaid-invoice-items-actions', $invoice); ?>
537 537
                             </div>
538 538
                             <div class="text-right col-12 col-sm-4">
539
-                                <button type="button" class="button button-primary recalculate-totals-button"><?php esc_html_e( 'Recalculate Totals', 'invoicing' ) ?></button>
539
+                                <button type="button" class="button button-primary recalculate-totals-button"><?php esc_html_e('Recalculate Totals', 'invoicing') ?></button>
540 540
                             </div>
541 541
                         </div>
542 542
                     </div>
543 543
 
544 544
                     <div class="getpaid-invoice-item-actions hide-if-editable">
545
-                        <p class="description m-2 text-right text-muted"><?php esc_html_e( 'This invoice is no longer editable', 'invoicing' ); ?></p>
545
+                        <p class="description m-2 text-right text-muted"><?php esc_html_e('This invoice is no longer editable', 'invoicing'); ?></p>
546 546
                     </div>
547 547
 
548 548
                     <!-- Add items to an invoice -->
@@ -550,8 +550,8 @@  discard block
 block discarded – undo
550 550
                         <div class="modal-dialog modal-dialog-centered" role="document">
551 551
                             <div class="modal-content">
552 552
                                 <div class="modal-header">
553
-                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php esc_html_e( "Add Item(s)", 'invoicing' ); ?></h5>
554
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>">
553
+                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php esc_html_e("Add Item(s)", 'invoicing'); ?></h5>
554
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>">
555 555
                                         <span aria-hidden="true">&times;</span>
556 556
                                     </button>
557 557
                                 </div>
@@ -559,10 +559,10 @@  discard block
 block discarded – undo
559 559
                                     <table class="widefat">
560 560
                                         <thead>
561 561
                                             <tr>
562
-                                                <th class="pl-0 text-left"><?php esc_html_e( 'Item', 'invoicing' ) ?></th>
562
+                                                <th class="pl-0 text-left"><?php esc_html_e('Item', 'invoicing') ?></th>
563 563
                                                 <th class="pr-0 text-right hide-if-amount">
564
-                                                    <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Quantity', 'invoicing' ) ?></span>
565
-                                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Hours', 'invoicing' ) ?></span>
564
+                                                    <span class="getpaid-hide-if-hours"><?php esc_html_e('Quantity', 'invoicing') ?></span>
565
+                                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e('Hours', 'invoicing') ?></span>
566 566
                                                 </th>
567 567
                                             </tr>
568 568
                                         </thead>
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
 								            <tr>
571 571
 									            <td class="pl-0 text-left">
572 572
                                                     <select class="regular-text getpaid-add-invoice-item-select">
573
-                                                        <option value="" selected="selected" disabled><?php esc_html_e( 'Select an item…', 'invoicing' ); ?></option>
574
-                                                        <?php foreach ( get_posts( $item_args ) as $item ) : ?>
575
-                                                        <option value="<?php echo (int) $item->ID; ?>"><?php echo esc_html( $item->post_title ); ?></option>
573
+                                                        <option value="" selected="selected" disabled><?php esc_html_e('Select an item…', 'invoicing'); ?></option>
574
+                                                        <?php foreach (get_posts($item_args) as $item) : ?>
575
+                                                        <option value="<?php echo (int) $item->ID; ?>"><?php echo esc_html($item->post_title); ?></option>
576 576
                                                         <?php endforeach; ?>
577 577
                                                     </select>
578 578
                                                 </td>
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 						            </table>
585 585
                                 </div>
586 586
                                 <div class="modal-footer">
587
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button>
588
-                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php esc_html_e( 'Add', 'invoicing' ); ?></button>
587
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button>
588
+                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php esc_html_e('Add', 'invoicing'); ?></button>
589 589
                                 </div>
590 590
                             </div>
591 591
                         </div>
@@ -596,8 +596,8 @@  discard block
 block discarded – undo
596 596
                         <div class="modal-dialog modal-dialog-centered" role="document">
597 597
                             <div class="modal-content">
598 598
                                 <div class="modal-header">
599
-                                    <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php esc_html_e( "Create Item", 'invoicing' ); ?></h5>
600
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>">
599
+                                    <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php esc_html_e("Create Item", 'invoicing'); ?></h5>
600
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>">
601 601
                                         <span aria-hidden="true">&times;</span>
602 602
                                     </button>
603 603
                                 </div>
@@ -605,27 +605,27 @@  discard block
 block discarded – undo
605 605
                                     <div class="getpaid-create-item-div">
606 606
                                         <input type="hidden" name="id" value="new" class="form-control form-control-sm item-id">
607 607
                                         <label class="form-group w-100">
608
-                                            <span><?php esc_html_e( 'Name', 'invoicing' ); ?></span>
609
-                                            <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">
608
+                                            <span><?php esc_html_e('Name', 'invoicing'); ?></span>
609
+                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name">
610 610
                                         </label>
611 611
                                         <label class="form-group w-100">
612
-                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span>
613
-                                            <span class="hide-if-amount"><?php esc_html_e( 'Price', 'invoicing' ); ?></span>
614
-                                            <input type="text" name="price" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control form-control-sm item-price">
612
+                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e('Amount', 'invoicing'); ?></span>
613
+                                            <span class="hide-if-amount"><?php esc_html_e('Price', 'invoicing'); ?></span>
614
+                                            <input type="text" name="price" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control form-control-sm item-price">
615 615
                                         </label>
616 616
                                         <label class="form-group w-100 hide-if-amount">
617
-                                            <span><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span>
617
+                                            <span><?php esc_html_e('Quantity', 'invoicing'); ?></span>
618 618
                                             <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">
619 619
                                         </label>
620 620
                                         <label class="form-group w-100">
621
-                                            <span><?php esc_html_e( 'Item Description', 'invoicing' ); ?></span>
622
-                                            <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>
621
+                                            <span><?php esc_html_e('Item Description', 'invoicing'); ?></span>
622
+                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea>
623 623
                                         </label>
624 624
                                     </div>
625 625
                                 </div>
626 626
                                 <div class="modal-footer">
627
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button>
628
-                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e( 'Create', 'invoicing' ); ?></button>
627
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button>
628
+                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e('Create', 'invoicing'); ?></button>
629 629
                                 </div>
630 630
                             </div>
631 631
                         </div>
@@ -636,8 +636,8 @@  discard block
 block discarded – undo
636 636
                         <div class="modal-dialog modal-dialog-centered" role="document">
637 637
                             <div class="modal-content">
638 638
                                 <div class="modal-header">
639
-                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php esc_html_e( "Edit Item", 'invoicing' ); ?></h5>
640
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>">
639
+                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php esc_html_e("Edit Item", 'invoicing'); ?></h5>
640
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>">
641 641
                                         <span aria-hidden="true">&times;</span>
642 642
                                     </button>
643 643
                                 </div>
@@ -645,27 +645,27 @@  discard block
 block discarded – undo
645 645
                                     <div class="getpaid-edit-item-div">
646 646
                                         <input type="hidden" name="id" class="form-control form-control-sm item-id">
647 647
                                         <label class="form-group w-100">
648
-                                            <span><?php esc_html_e( 'Name', 'invoicing' ); ?></span>
649
-                                            <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">
648
+                                            <span><?php esc_html_e('Name', 'invoicing'); ?></span>
649
+                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name">
650 650
                                         </label>
651 651
                                         <label class="form-group w-100">
652
-                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span>
653
-                                            <span class="hide-if-amount"><?php esc_html_e( 'Price', 'invoicing' ); ?></span>
654
-                                            <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price">
652
+                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e('Amount', 'invoicing'); ?></span>
653
+                                            <span class="hide-if-amount"><?php esc_html_e('Price', 'invoicing'); ?></span>
654
+                                            <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price">
655 655
                                         </label>
656 656
                                         <label class="form-group w-100 hide-if-amount">
657
-                                            <span><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span>
657
+                                            <span><?php esc_html_e('Quantity', 'invoicing'); ?></span>
658 658
                                             <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">
659 659
                                         </label>
660 660
                                         <label class="form-group w-100">
661
-                                            <span><?php esc_html_e( 'Item Description', 'invoicing' ); ?></span>
662
-                                            <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>
661
+                                            <span><?php esc_html_e('Item Description', 'invoicing'); ?></span>
662
+                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea>
663 663
                                         </label>
664 664
                                     </div>
665 665
                                 </div>
666 666
                                 <div class="modal-footer">
667
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button>
668
-                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e( 'Save', 'invoicing' ); ?></button>
667
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button>
668
+                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e('Save', 'invoicing'); ?></button>
669 669
                                 </div>
670 670
                             </div>
671 671
                         </div>
Please login to merge, or discard this patch.