Passed
Push — master ( 215c11...221553 )
by Brian
14:30
created
templates/payment-forms/cart-item.php 2 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -26,58 +26,58 @@  discard block
 block discarded – undo
26 26
 
27 27
 				<?php
28 28
 
29
-					// Fires before printing a line item column.
30
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
29
+                    // Fires before printing a line item column.
30
+                    do_action( "getpaid_form_cart_item_before_$key", $item, $form );
31 31
 
32
-					// Item name.
33
-					if ( 'name' == $key ) {
32
+                    // Item name.
33
+                    if ( 'name' == $key ) {
34 34
 
35
-						ob_start();
36
-						// And an optional description.
35
+                        ob_start();
36
+                        // And an optional description.
37 37
                         $description = $item->get_description();
38 38
 
39 39
                         if ( ! empty( $description ) ) {
40 40
                             $description = wp_kses_post( $description );
41 41
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
42
-						}
42
+                        }
43 43
 
44
-						// Price help text.
44
+                        // Price help text.
45 45
                         $description = getpaid_item_recurring_price_help_text( $item, $currency );
46 46
                         if ( $description ) {
47 47
                             echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>";
48
-						}
48
+                        }
49 49
 
50
-						do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
50
+                        do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
51 51
 
52
-						if ( wpinv_current_user_can_manage_invoicing() ) {
52
+                        if ( wpinv_current_user_can_manage_invoicing() ) {
53 53
 
54
-							edit_post_link(
55
-								__( 'Edit this item.', 'invoicing' ),
56
-								'<small class="form-text text-muted">',
57
-								'</small>',
58
-								$item->get_id(),
59
-								'text-danger'
60
-							);
54
+                            edit_post_link(
55
+                                __( 'Edit this item.', 'invoicing' ),
56
+                                '<small class="form-text text-muted">',
57
+                                '</small>',
58
+                                $item->get_id(),
59
+                                'text-danger'
60
+                            );
61 61
 
62
-						}
62
+                        }
63 63
 
64
-						$description = ob_get_clean();
64
+                        $description = ob_get_clean();
65 65
 
66
-						// Display the name.
67
-						$tootip = empty( $description ) ? '' : "&nbsp;" . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
68
-						echo '<div class="mb-1">' . esc_html( $item->get_name() ) . $tootip . '</div>';
66
+                        // Display the name.
67
+                        $tootip = empty( $description ) ? '' : "&nbsp;" . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
68
+                        echo '<div class="mb-1">' . esc_html( $item->get_name() ) . $tootip . '</div>';
69 69
 
70
-						if ( ! empty( $description ) ) {
71
-							printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description );
72
-						}
73
-
74
-						if ( $item->allows_quantities() ) {
75
-							printf(
76
-								'<small class="d-sm-none text-muted form-text">%s</small>',
77
-								sprintf(
78
-									__( 'Qty %s', 'invoicing' ),
79
-									sprintf(
80
-										'<input
70
+                        if ( ! empty( $description ) ) {
71
+                            printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description );
72
+                        }
73
+
74
+                        if ( $item->allows_quantities() ) {
75
+                            printf(
76
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
77
+                                sprintf(
78
+                                    __( 'Qty %s', 'invoicing' ),
79
+                                    sprintf(
80
+                                        '<input
81 81
 											type="number"
82 82
 											step="0.01"
83 83
 											style="width: 48px;"
@@ -85,56 +85,56 @@  discard block
 block discarded – undo
85 85
 											value="%s"
86 86
 											min="1"
87 87
 											%s>',
88
-											(float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
89
-											null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''
90
-									)
91
-								)
92
-							);
93
-						} else {
94
-							printf(
95
-								'<small class="d-sm-none text-muted form-text">%s</small>',
96
-								sprintf(
97
-									__( 'Qty %s', 'invoicing' ),
98
-									(float) $item->get_quantity()
99
-								)
100
-							);
101
-						}
102
-
103
-					}
104
-
105
-					// Item price.
106
-					if ( 'price' == $key ) {
107
-
108
-						// Set the currency position.
109
-						$position = wpinv_currency_position();
110
-
111
-						if ( $position == 'left_space' ) {
112
-							$position = 'left';
113
-						}
114
-
115
-						if ( $position == 'right_space' ) {
116
-							$position = 'right';
117
-						}
118
-
119
-						if ( $item->user_can_set_their_price() ) {
120
-							$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
121
-							$minimum          = (float) $item->get_minimum_price();
122
-							$validate_minimum = '';
123
-							$class            = '';
124
-							$data_minimum     = '';
125
-
126
-							if ( $minimum > 0 ) {
127
-								$validate_minimum = sprintf(
128
-									esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
129
-									strip_tags( wpinv_price( $minimum, $currency ) )
130
-								);
131
-
132
-								$class = 'getpaid-validate-minimum-amount';
133
-
134
-								$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
135
-							}
136
-
137
-							?>
88
+                                            (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
89
+                                            null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''
90
+                                    )
91
+                                )
92
+                            );
93
+                        } else {
94
+                            printf(
95
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
96
+                                sprintf(
97
+                                    __( 'Qty %s', 'invoicing' ),
98
+                                    (float) $item->get_quantity()
99
+                                )
100
+                            );
101
+                        }
102
+
103
+                    }
104
+
105
+                    // Item price.
106
+                    if ( 'price' == $key ) {
107
+
108
+                        // Set the currency position.
109
+                        $position = wpinv_currency_position();
110
+
111
+                        if ( $position == 'left_space' ) {
112
+                            $position = 'left';
113
+                        }
114
+
115
+                        if ( $position == 'right_space' ) {
116
+                            $position = 'right';
117
+                        }
118
+
119
+                        if ( $item->user_can_set_their_price() ) {
120
+                            $price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
121
+                            $minimum          = (float) $item->get_minimum_price();
122
+                            $validate_minimum = '';
123
+                            $class            = '';
124
+                            $data_minimum     = '';
125
+
126
+                            if ( $minimum > 0 ) {
127
+                                $validate_minimum = sprintf(
128
+                                    esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
129
+                                    strip_tags( wpinv_price( $minimum, $currency ) )
130
+                                );
131
+
132
+                                $class = 'getpaid-validate-minimum-amount';
133
+
134
+                                $data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
135
+                            }
136
+
137
+                            ?>
138 138
 								<div class="input-group input-group-sm">
139 139
 									<?php if( 'left' == $position ) : ?>
140 140
 										<div class="input-group-prepend">
@@ -159,44 +159,44 @@  discard block
 block discarded – undo
159 159
 
160 160
 							<?php
161 161
 
162
-						} else {
163
-							echo wpinv_price( $item->get_price(), $currency );
162
+                        } else {
163
+                            echo wpinv_price( $item->get_price(), $currency );
164 164
 
165
-							?>
165
+                            ?>
166 166
 								<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() ); ?>'>
167 167
 							<?php
168
-						}
168
+                        }
169 169
 
170
-						printf(
171
-							'<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
172
-							sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) )
173
-						);
174
-					}
170
+                        printf(
171
+                            '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
172
+                            sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) )
173
+                        );
174
+                    }
175 175
 
176
-					// Item quantity.
177
-					if ( 'quantity' == $key ) {
176
+                    // Item quantity.
177
+                    if ( 'quantity' == $key ) {
178 178
 
179
-						if ( $item->allows_quantities() ) {
180
-							?>
179
+                        if ( $item->allows_quantities() ) {
180
+                            ?>
181 181
 								<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>
182 182
 							<?php
183
-						} else {
184
-							echo (float) $item->get_quantity();
185
-							echo '&nbsp;&nbsp;&nbsp;';
186
-							?>
183
+                        } else {
184
+                            echo (float) $item->get_quantity();
185
+                            echo '&nbsp;&nbsp;&nbsp;';
186
+                            ?>
187 187
 								<input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'>
188 188
 							<?php
189
-						}
189
+                        }
190 190
 
191
-					}
191
+                    }
192 192
 
193
-					// Item sub total.
194
-					if ( 'subtotal' == $key ) {
195
-						echo wpinv_price( $item->get_sub_total(), $currency );
196
-					}
193
+                    // Item sub total.
194
+                    if ( 'subtotal' == $key ) {
195
+                        echo wpinv_price( $item->get_sub_total(), $currency );
196
+                    }
197 197
 
198
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
199
-				?>
198
+                    do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
199
+                ?>
200 200
 
201 201
 			</div>
202 202
 
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -9,50 +9,50 @@  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
-<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required'  : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'>
19
+<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $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 sanitize_html_class( $key ); ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>-<?php echo $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 sanitize_html_class($key); ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>-<?php echo $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
-                            $description = wp_kses_post( $description );
39
+                        if (!empty($description)) {
40
+                            $description = wp_kses_post($description);
41 41
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
42 42
 						}
43 43
 
44 44
 						// Price help text.
45
-                        $description = getpaid_item_recurring_price_help_text( $item, $currency );
46
-                        if ( $description ) {
45
+                        $description = getpaid_item_recurring_price_help_text($item, $currency);
46
+                        if ($description) {
47 47
                             echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>";
48 48
 						}
49 49
 
50
-						do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
50
+						do_action('getpaid_payment_form_cart_item_description', $item, $form);
51 51
 
52
-						if ( wpinv_current_user_can_manage_invoicing() ) {
52
+						if (wpinv_current_user_can_manage_invoicing()) {
53 53
 
54 54
 							edit_post_link(
55
-								__( 'Edit this item.', 'invoicing' ),
55
+								__('Edit this item.', 'invoicing'),
56 56
 								'<small class="form-text text-muted">',
57 57
 								'</small>',
58 58
 								$item->get_id(),
@@ -64,18 +64,18 @@  discard block
 block discarded – undo
64 64
 						$description = ob_get_clean();
65 65
 
66 66
 						// Display the name.
67
-						$tootip = empty( $description ) ? '' : "&nbsp;" . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
68
-						echo '<div class="mb-1">' . esc_html( $item->get_name() ) . $tootip . '</div>';
67
+						$tootip = empty($description) ? '' : "&nbsp;" . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
68
+						echo '<div class="mb-1">' . esc_html($item->get_name()) . $tootip . '</div>';
69 69
 
70
-						if ( ! empty( $description ) ) {
71
-							printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description );
70
+						if (!empty($description)) {
71
+							printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description);
72 72
 						}
73 73
 
74
-						if ( $item->allows_quantities() ) {
74
+						if ($item->allows_quantities()) {
75 75
 							printf(
76 76
 								'<small class="d-sm-none text-muted form-text">%s</small>',
77 77
 								sprintf(
78
-									__( 'Qty %s', 'invoicing' ),
78
+									__('Qty %s', 'invoicing'),
79 79
 									sprintf(
80 80
 										'<input
81 81
 											type="number"
@@ -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
-									__( 'Qty %s', 'invoicing' ),
97
+									__('Qty %s', 'invoicing'),
98 98
 									(float) $item->get_quantity()
99 99
 								)
100 100
 							);
@@ -103,56 +103,56 @@  discard block
 block discarded – undo
103 103
 					}
104 104
 
105 105
 					// Item price.
106
-					if ( 'price' == $key ) {
106
+					if ('price' == $key) {
107 107
 
108 108
 						// Set the currency position.
109 109
 						$position = wpinv_currency_position();
110 110
 
111
-						if ( $position == 'left_space' ) {
111
+						if ($position == 'left_space') {
112 112
 							$position = 'left';
113 113
 						}
114 114
 
115
-						if ( $position == 'right_space' ) {
115
+						if ($position == 'right_space') {
116 116
 							$position = 'right';
117 117
 						}
118 118
 
119
-						if ( $item->user_can_set_their_price() ) {
120
-							$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
119
+						if ($item->user_can_set_their_price()) {
120
+							$price            = max((float) $item->get_price(), (float) $item->get_minimum_price());
121 121
 							$minimum          = (float) $item->get_minimum_price();
122 122
 							$validate_minimum = '';
123 123
 							$class            = '';
124 124
 							$data_minimum     = '';
125 125
 
126
-							if ( $minimum > 0 ) {
126
+							if ($minimum > 0) {
127 127
 								$validate_minimum = sprintf(
128
-									esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
129
-									strip_tags( wpinv_price( $minimum, $currency ) )
128
+									esc_attr__('The minimum allowed amount is %s', 'invoicing'),
129
+									strip_tags(wpinv_price($minimum, $currency))
130 130
 								);
131 131
 
132 132
 								$class = 'getpaid-validate-minimum-amount';
133 133
 
134
-								$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
134
+								$data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'";
135 135
 							}
136 136
 
137 137
 							?>
138 138
 								<div class="input-group input-group-sm">
139
-									<?php if( 'left' == $position ) : ?>
139
+									<?php if ('left' == $position) : ?>
140 140
 										<div class="input-group-prepend">
141
-											<span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
141
+											<span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
142 142
 										</div>
143 143
 									<?php endif; ?>
144 144
 
145
-									<input type="text" <?php echo $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 $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;">
145
+									<input type="text" <?php echo $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 $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;">
146 146
 
147
-									<?php if ( ! empty( $validate_minimum ) ) : ?>
147
+									<?php if (!empty($validate_minimum)) : ?>
148 148
 										<div class="invalid-tooltip">
149 149
 											<?php echo $validate_minimum; ?>
150 150
 										</div>
151 151
 									<?php endif; ?>
152 152
 
153
-									<?php if( 'left' != $position ) : ?>
153
+									<?php if ('left' != $position) : ?>
154 154
 										<div class="input-group-append">
155
-											<span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
155
+											<span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
156 156
 										</div>
157 157
 									<?php endif; ?>
158 158
 								</div>
@@ -160,23 +160,23 @@  discard block
 block discarded – undo
160 160
 							<?php
161 161
 
162 162
 						} else {
163
-							echo wpinv_price( $item->get_price(), $currency );
163
+							echo wpinv_price($item->get_price(), $currency);
164 164
 
165 165
 							?>
166
-								<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
+								<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()); ?>'>
167 167
 							<?php
168 168
 						}
169 169
 
170 170
 						printf(
171 171
 							'<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
172
-							sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) )
172
+							sprintf(__('Subtotal: %s', 'invoicing'), wpinv_price($item->get_sub_total(), $currency))
173 173
 						);
174 174
 					}
175 175
 
176 176
 					// Item quantity.
177
-					if ( 'quantity' == $key ) {
177
+					if ('quantity' == $key) {
178 178
 
179
-						if ( $item->allows_quantities() ) {
179
+						if ($item->allows_quantities()) {
180 180
 							?>
181 181
 								<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>
182 182
 							<?php
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 					}
192 192
 
193 193
 					// Item sub total.
194
-					if ( 'subtotal' == $key ) {
195
-						echo wpinv_price( $item->get_sub_total(), $currency );
194
+					if ('subtotal' == $key) {
195
+						echo wpinv_price($item->get_sub_total(), $currency);
196 196
 					}
197 197
 
198
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
198
+					do_action("getpaid_payment_form_cart_item_$key", $item, $form);
199 199
 				?>
200 200
 
201 201
 			</div>
@@ -206,4 +206,4 @@  discard block
 block discarded – undo
206 206
 
207 207
 </div>
208 208
 <?php
209
-do_action(  'getpaid_payment_form_cart_item', $form, $item );
209
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.
includes/wpinv-item-functions.php 1 patch
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Retrieves an item by it's ID.
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
  * @param int the item ID to retrieve.
15 15
  * @return WPInv_Item|false
16 16
  */
17
-function wpinv_get_item_by_id( $id ) {
18
-    $item = wpinv_get_item( $id );
19
-    return empty( $item ) || $id != $item->get_id() ? false : $item;
17
+function wpinv_get_item_by_id($id) {
18
+    $item = wpinv_get_item($id);
19
+    return empty($item) || $id != $item->get_id() ? false : $item;
20 20
 }
21 21
 
22 22
 /**
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return WPInv_Item|false
26 26
  */
27
-function wpinv_get_item_by( $field = '', $value = '', $type = '' ) {
27
+function wpinv_get_item_by($field = '', $value = '', $type = '') {
28 28
 
29
-    if ( 'id' == strtolower( $field ) ) {
30
-        return wpinv_get_item_by_id( $field );
29
+    if ('id' == strtolower($field)) {
30
+        return wpinv_get_item_by_id($field);
31 31
     }
32 32
 
33
-    $id = WPInv_Item::get_item_id_by_field( $value, strtolower( $field ), $type );
34
-    return empty( $id ) ? false : wpinv_get_item( $id );
33
+    $id = WPInv_Item::get_item_id_by_field($value, strtolower($field), $type);
34
+    return empty($id) ? false : wpinv_get_item($id);
35 35
 
36 36
 }
37 37
 
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
  * @param int|WPInv_Item the item to retrieve.
42 42
  * @return WPInv_Item|false
43 43
  */
44
-function wpinv_get_item( $item = 0 ) {
44
+function wpinv_get_item($item = 0) {
45 45
 
46
-    if ( empty( $item ) ) {
46
+    if (empty($item)) {
47 47
         return false;
48 48
     }
49 49
 
50
-    $item = new WPInv_Item( $item );
50
+    $item = new WPInv_Item($item);
51 51
     return $item->exists() ? $item : false;
52 52
 
53 53
 }
54 54
 
55
-function wpinv_get_all_items( $args = array() ) {
55
+function wpinv_get_all_items($args = array()) {
56 56
 
57
-    $args = wp_parse_args( $args, array(
58
-        'status'         => array( 'publish' ),
59
-        'limit'          => get_option( 'posts_per_page' ),
57
+    $args = wp_parse_args($args, array(
58
+        'status'         => array('publish'),
59
+        'limit'          => get_option('posts_per_page'),
60 60
         'page'           => 1,
61 61
         'exclude'        => array(),
62 62
         'orderby'        => 'date',
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         'meta_query'     => array(),
66 66
         'return'         => 'objects',
67 67
         'paginate'       => false,
68
-    ) );
68
+    ));
69 69
 
70 70
     $wp_query_args = array(
71 71
         'post_type'      => 'wpi_item',
@@ -75,26 +75,26 @@  discard block
 block discarded – undo
75 75
         'fields'         => 'ids',
76 76
         'orderby'        => $args['orderby'],
77 77
         'order'          => $args['order'],
78
-        'paged'          => absint( $args['page'] ),
78
+        'paged'          => absint($args['page']),
79 79
     );
80 80
 
81
-    if ( ! empty( $args['exclude'] ) ) {
82
-        $wp_query_args['post__not_in'] = array_map( 'absint', $args['exclude'] );
81
+    if (!empty($args['exclude'])) {
82
+        $wp_query_args['post__not_in'] = array_map('absint', $args['exclude']);
83 83
     }
84 84
 
85
-    if ( ! $args['paginate' ] ) {
85
+    if (!$args['paginate']) {
86 86
         $wp_query_args['no_found_rows'] = true;
87 87
     }
88 88
 
89
-    if ( ! empty( $args['search'] ) ) {
89
+    if (!empty($args['search'])) {
90 90
         $wp_query_args['s'] = $args['search'];
91 91
     }
92 92
 
93
-    if ( ! empty( $args['type'] ) && $args['type'] !== wpinv_item_types() ) {
94
-        $types = wpinv_parse_list( $args['type'] );
93
+    if (!empty($args['type']) && $args['type'] !== wpinv_item_types()) {
94
+        $types = wpinv_parse_list($args['type']);
95 95
         $wp_query_args['meta_query'][] = array(
96 96
             'key'     => '_wpinv_type',
97
-            'value'   => implode( ',', $types ),
97
+            'value'   => implode(',', $types),
98 98
             'compare' => 'IN',
99 99
         );
100 100
     }
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
     $wp_query_args = apply_filters('wpinv_get_items_args', $wp_query_args, $args);
103 103
 
104 104
     // Get results.
105
-    $items = new WP_Query( $wp_query_args );
105
+    $items = new WP_Query($wp_query_args);
106 106
 
107
-    if ( 'objects' === $args['return'] ) {
108
-        $return = array_map( 'wpinv_get_item_by_id', $items->posts );
109
-    } elseif ( 'self' === $args['return'] ) {
107
+    if ('objects' === $args['return']) {
108
+        $return = array_map('wpinv_get_item_by_id', $items->posts);
109
+    } elseif ('self' === $args['return']) {
110 110
         return $items;
111 111
     } else {
112 112
         $return = $items->posts;
113 113
     }
114 114
 
115
-    if ( $args['paginate' ] ) {
115
+    if ($args['paginate']) {
116 116
         return (object) array(
117 117
             'items'      => $return,
118 118
             'total'         => $items->found_posts,
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 
125 125
 }
126 126
 
127
-function wpinv_is_free_item( $item_id = 0 ) {
128
-    if( empty( $item_id ) ) {
127
+function wpinv_is_free_item($item_id = 0) {
128
+    if (empty($item_id)) {
129 129
         return false;
130 130
     }
131 131
 
132
-    $item = new WPInv_Item( $item_id );
132
+    $item = new WPInv_Item($item_id);
133 133
 
134 134
     return $item->is_free();
135 135
 }
@@ -139,21 +139,21 @@  discard block
 block discarded – undo
139 139
  *
140 140
  * @param WP_Post|WPInv_Item|Int $item The item to check for.
141 141
  */
142
-function wpinv_item_is_editable( $item = 0 ) {
142
+function wpinv_item_is_editable($item = 0) {
143 143
 
144 144
     // Fetch the item.
145
-    $item = new WPInv_Item( $item );
145
+    $item = new WPInv_Item($item);
146 146
 
147 147
     // Check if it is editable.
148 148
     return $item->is_editable();
149 149
 }
150 150
 
151
-function wpinv_get_item_price( $item_id = 0 ) {
152
-    if( empty( $item_id ) ) {
151
+function wpinv_get_item_price($item_id = 0) {
152
+    if (empty($item_id)) {
153 153
         return false;
154 154
     }
155 155
 
156
-    $item = new WPInv_Item( $item_id );
156
+    $item = new WPInv_Item($item_id);
157 157
 
158 158
     return $item->get_price();
159 159
 }
@@ -163,96 +163,96 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @param WPInv_Item|int $item
165 165
  */
166
-function wpinv_is_recurring_item( $item = 0 ) {
167
-    $item = new WPInv_Item( $item );
166
+function wpinv_is_recurring_item($item = 0) {
167
+    $item = new WPInv_Item($item);
168 168
     return $item->is_recurring();
169 169
 }
170 170
 
171
-function wpinv_item_price( $item_id = 0 ) {
172
-    if( empty( $item_id ) ) {
171
+function wpinv_item_price($item_id = 0) {
172
+    if (empty($item_id)) {
173 173
         return false;
174 174
     }
175 175
 
176
-    $price = wpinv_get_item_price( $item_id );
177
-    $price = wpinv_price( $price );
176
+    $price = wpinv_get_item_price($item_id);
177
+    $price = wpinv_price($price);
178 178
 
179
-    return apply_filters( 'wpinv_item_price', $price, $item_id );
179
+    return apply_filters('wpinv_item_price', $price, $item_id);
180 180
 }
181 181
 
182
-function wpinv_get_item_final_price( $item_id = 0, $amount_override = null ) {
183
-    if ( is_null( $amount_override ) ) {
184
-        $original_price = get_post_meta( $item_id, '_wpinv_price', true );
182
+function wpinv_get_item_final_price($item_id = 0, $amount_override = null) {
183
+    if (is_null($amount_override)) {
184
+        $original_price = get_post_meta($item_id, '_wpinv_price', true);
185 185
     } else {
186 186
         $original_price = $amount_override;
187 187
     }
188 188
 
189 189
     $price = $original_price;
190 190
 
191
-    return apply_filters( 'wpinv_get_item_final_price', $price, $item_id );
191
+    return apply_filters('wpinv_get_item_final_price', $price, $item_id);
192 192
 }
193 193
 
194
-function wpinv_item_custom_singular_name( $item_id ) {
195
-    if( empty( $item_id ) ) {
194
+function wpinv_item_custom_singular_name($item_id) {
195
+    if (empty($item_id)) {
196 196
         return false;
197 197
     }
198 198
 
199
-    $item = new WPInv_Item( $item_id );
199
+    $item = new WPInv_Item($item_id);
200 200
 
201 201
     return $item->get_custom_singular_name();
202 202
 }
203 203
 
204 204
 function wpinv_get_item_types() {
205 205
     $item_types = array(
206
-            'custom'    => __( 'Standard', 'invoicing' ),
207
-            'fee'       => __( 'Fee', 'invoicing' ),
206
+            'custom'    => __('Standard', 'invoicing'),
207
+            'fee'       => __('Fee', 'invoicing'),
208 208
         );
209
-    return apply_filters( 'wpinv_get_item_types', $item_types );
209
+    return apply_filters('wpinv_get_item_types', $item_types);
210 210
 }
211 211
 
212 212
 function wpinv_item_types() {
213 213
     $item_types = wpinv_get_item_types();
214 214
 
215
-    return ( !empty( $item_types ) ? array_keys( $item_types ) : array() );
215
+    return (!empty($item_types) ? array_keys($item_types) : array());
216 216
 }
217 217
 
218
-function wpinv_get_item_type( $item_id ) {
219
-    if( empty( $item_id ) ) {
218
+function wpinv_get_item_type($item_id) {
219
+    if (empty($item_id)) {
220 220
         return false;
221 221
     }
222 222
 
223
-    $item = new WPInv_Item( $item_id );
223
+    $item = new WPInv_Item($item_id);
224 224
 
225 225
     return $item->get_type();
226 226
 }
227 227
 
228
-function wpinv_item_type( $item_id ) {
228
+function wpinv_item_type($item_id) {
229 229
     $item_types = wpinv_get_item_types();
230 230
 
231
-    $item_type = wpinv_get_item_type( $item_id );
231
+    $item_type = wpinv_get_item_type($item_id);
232 232
 
233
-    if ( empty( $item_type ) ) {
233
+    if (empty($item_type)) {
234 234
         $item_type = '-';
235 235
     }
236 236
 
237
-    $item_type = isset( $item_types[$item_type] ) ? $item_types[$item_type] : __( $item_type, 'invoicing' );
237
+    $item_type = isset($item_types[$item_type]) ? $item_types[$item_type] : __($item_type, 'invoicing');
238 238
 
239
-    return apply_filters( 'wpinv_item_type', $item_type, $item_id );
239
+    return apply_filters('wpinv_item_type', $item_type, $item_id);
240 240
 }
241 241
 
242
-function wpinv_get_random_item( $post_ids = true ) {
243
-    wpinv_get_random_items( 1, $post_ids );
242
+function wpinv_get_random_item($post_ids = true) {
243
+    wpinv_get_random_items(1, $post_ids);
244 244
 }
245 245
 
246
-function wpinv_get_random_items( $num = 3, $post_ids = true ) {
247
-    if ( $post_ids ) {
248
-        $args = array( 'post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num, 'fields' => 'ids' );
246
+function wpinv_get_random_items($num = 3, $post_ids = true) {
247
+    if ($post_ids) {
248
+        $args = array('post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num, 'fields' => 'ids');
249 249
     } else {
250
-        $args = array( 'post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num );
250
+        $args = array('post_type' => 'wpi_item', 'orderby' => 'rand', 'post_count' => $num);
251 251
     }
252 252
 
253
-    $args  = apply_filters( 'wpinv_get_random_items', $args );
253
+    $args = apply_filters('wpinv_get_random_items', $args);
254 254
 
255
-    return get_posts( $args );
255
+    return get_posts($args);
256 256
 }
257 257
 
258 258
 /**
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
  * @param WPInv_Item|int $item
262 262
  * @param bool $html
263 263
  */
264
-function wpinv_get_item_suffix( $item, $html = true ) {
264
+function wpinv_get_item_suffix($item, $html = true) {
265 265
 
266
-    $item   = new WPInv_Item( $item );
267
-    $suffix = $item->is_recurring() ? ' ' . __( '(r)', 'invoicing' ) : '';
268
-    $suffix = $html ? $suffix : strip_tags( $suffix );
266
+    $item   = new WPInv_Item($item);
267
+    $suffix = $item->is_recurring() ? ' ' . __('(r)', 'invoicing') : '';
268
+    $suffix = $html ? $suffix : strip_tags($suffix);
269 269
 
270
-    return apply_filters( 'wpinv_get_item_suffix', $suffix, $item, $html );
270
+    return apply_filters('wpinv_get_item_suffix', $suffix, $item, $html);
271 271
 }
272 272
 
273 273
 /**
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
  * @param WPInv_Item|int $item
277 277
  * @param bool $force_delete
278 278
  */
279
-function wpinv_remove_item( $item = 0, $force_delete = false ) {
280
-    $item = new WPInv_Item( $item );
281
-    $item->delete( $force_delete );
279
+function wpinv_remove_item($item = 0, $force_delete = false) {
280
+    $item = new WPInv_Item($item);
281
+    $item->delete($force_delete);
282 282
 }
283 283
 
284 284
 /**
@@ -317,45 +317,45 @@  discard block
 block discarded – undo
317 317
  * @param bool $wp_error whether or not to return a WP_Error on failure.
318 318
  * @return bool|WP_Error|WPInv_Item
319 319
  */
320
-function wpinv_create_item( $args = array(), $wp_error = false ) {
320
+function wpinv_create_item($args = array(), $wp_error = false) {
321 321
 
322 322
     // Prepare the item.
323
-    if ( ! empty( $args['custom_id'] ) && empty( $args['ID'] ) ) {
324
-        $type = empty( $args['type'] ) ? 'custom' : $args['type'];
325
-        $item = wpinv_get_item_by( 'custom_id', $args['custom_id'], $type );
323
+    if (!empty($args['custom_id']) && empty($args['ID'])) {
324
+        $type = empty($args['type']) ? 'custom' : $args['type'];
325
+        $item = wpinv_get_item_by('custom_id', $args['custom_id'], $type);
326 326
 
327
-        if ( ! empty( $item ) ) {
327
+        if (!empty($item)) {
328 328
             $args['ID'] = $item->get_id();
329 329
         }
330 330
 
331 331
     }
332 332
 
333 333
     // Do we have an item?
334
-    if ( ! empty( $args['ID'] ) ) {
335
-        $item = new WPInv_Item( $args['ID'] );
334
+    if (!empty($args['ID'])) {
335
+        $item = new WPInv_Item($args['ID']);
336 336
     } else {
337 337
         $item = new WPInv_Item();
338 338
     }
339 339
 
340 340
     // Do we have an error?
341
-    if ( ! empty( $item->last_error ) ) {
342
-        return $wp_error ? new WP_Error( 'invalid_item', $item->last_error ) : false;
341
+    if (!empty($item->last_error)) {
342
+        return $wp_error ? new WP_Error('invalid_item', $item->last_error) : false;
343 343
     }
344 344
 
345 345
     // Update item props.
346
-    $item->set_props( $args );
346
+    $item->set_props($args);
347 347
 
348 348
     // Save the item.
349 349
     $item->save();
350 350
 
351 351
     // Do we have an error?
352
-    if ( ! empty( $item->last_error ) ) {
353
-        return $wp_error ? new WP_Error( 'not_saved', $item->last_error ) : false;
352
+    if (!empty($item->last_error)) {
353
+        return $wp_error ? new WP_Error('not_saved', $item->last_error) : false;
354 354
     }
355 355
 
356 356
     // Was the item saved?
357
-    if ( ! $item->get_id() ) {
358
-        return $wp_error ? new WP_Error( 'not_saved', __( 'An error occured while saving the item', 'invoicing' ) ) : false;
357
+    if (!$item->get_id()) {
358
+        return $wp_error ? new WP_Error('not_saved', __('An error occured while saving the item', 'invoicing')) : false;
359 359
     }
360 360
 
361 361
     return $item;
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
  *
368 368
  * @see wpinv_create_item()
369 369
  */
370
-function wpinv_update_item( $args = array(), $wp_error = false ) {
371
-    return wpinv_create_item( $args, $wp_error );
370
+function wpinv_update_item($args = array(), $wp_error = false) {
371
+    return wpinv_create_item($args, $wp_error);
372 372
 }
373 373
 
374 374
 /**
375 375
  * Sanitizes a recurring period
376 376
  */
377
-function getpaid_sanitize_recurring_period( $period, $full = false ) {
377
+function getpaid_sanitize_recurring_period($period, $full = false) {
378 378
 
379 379
     $periods = array(
380 380
         'D' => 'day',
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
         'Y' => 'year',
384 384
     );
385 385
 
386
-    if ( ! isset( $periods[ $period ] ) ) {
386
+    if (!isset($periods[$period])) {
387 387
         $period = 'D';
388 388
     }
389 389
 
390
-    return $full ? $periods[ $period ] : $period;
390
+    return $full ? $periods[$period] : $period;
391 391
 
392 392
 }
393 393
 
394
-function wpinv_item_max_buyable_quantity( $item_id ) {
395
-    return apply_filters( 'wpinv_item_max_buyable_quantity', 5, $item_id );
394
+function wpinv_item_max_buyable_quantity($item_id) {
395
+    return apply_filters('wpinv_item_max_buyable_quantity', 5, $item_id);
396 396
 }
397 397
 
398 398
 /**
@@ -400,46 +400,46 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @param WPInv_Item|GetPaid_Form_Item $item
402 402
  */
403
-function getpaid_item_recurring_price_help_text( $item, $currency = '', $_initial_price = false, $_recurring_price = false ) {
403
+function getpaid_item_recurring_price_help_text($item, $currency = '', $_initial_price = false, $_recurring_price = false) {
404 404
 
405 405
     // Abort if it is not recurring.
406
-    if ( ! $item->is_recurring() ) {
406
+    if (!$item->is_recurring()) {
407 407
         return '';
408 408
     }
409 409
 
410
-    $initial_price   = false === $_initial_price ? wpinv_price( $item->get_initial_price(), $currency ) : $_initial_price;
411
-    $recurring_price = false === $_recurring_price ? wpinv_price( $item->get_recurring_price(), $currency ) : $_recurring_price;
412
-    $period          = getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' );
410
+    $initial_price   = false === $_initial_price ? wpinv_price($item->get_initial_price(), $currency) : $_initial_price;
411
+    $recurring_price = false === $_recurring_price ? wpinv_price($item->get_recurring_price(), $currency) : $_recurring_price;
412
+    $period          = getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '');
413 413
     $initial_class   = 'getpaid-item-initial-price';
414 414
     $recurring_class = 'getpaid-item-recurring-price';
415 415
     $bill_times      = $item->get_recurring_limit();
416 416
 
417
-    if ( ! empty( $bill_times ) ) {
417
+    if (!empty($bill_times)) {
418 418
 		$bill_times = $item->get_recurring_interval() * $bill_times;
419
-		$bill_times = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times );
419
+		$bill_times = getpaid_get_subscription_period_label($item->get_recurring_period(), $bill_times);
420 420
 	}
421 421
 
422
-    if ( $item instanceof GetPaid_Form_Item && false === $_initial_price ) {
423
-        $initial_price   = wpinv_price( $item->get_sub_total(), $currency );
424
-        $recurring_price = wpinv_price( $item->get_recurring_sub_total(), $currency );
422
+    if ($item instanceof GetPaid_Form_Item && false === $_initial_price) {
423
+        $initial_price   = wpinv_price($item->get_sub_total(), $currency);
424
+        $recurring_price = wpinv_price($item->get_recurring_sub_total(), $currency);
425 425
     }
426 426
 
427
-    if ( wpinv_price( 0, $currency ) == $initial_price && wpinv_price( 0, $currency ) == $recurring_price ) {
428
-        return __( 'Free forever', 'invoicing' );
427
+    if (wpinv_price(0, $currency) == $initial_price && wpinv_price(0, $currency) == $recurring_price) {
428
+        return __('Free forever', 'invoicing');
429 429
     }
430 430
 
431 431
     // For free trial items.
432
-    if ( $item->has_free_trial() ) {
433
-        $trial_period = getpaid_get_subscription_period_label( $item->get_trial_period(), $item->get_trial_interval() );
432
+    if ($item->has_free_trial()) {
433
+        $trial_period = getpaid_get_subscription_period_label($item->get_trial_period(), $item->get_trial_interval());
434 434
 
435
-        if ( wpinv_price( 0, $currency ) == $initial_price ) {
435
+        if (wpinv_price(0, $currency) == $initial_price) {
436 436
 
437
-            if ( empty( $bill_times ) ) {
437
+            if (empty($bill_times)) {
438 438
 
439 439
                 return sprintf(
440 440
 
441 441
                     // translators: $1: is the trial period, $2: is the recurring price, $3: is the susbcription period
442
-                    _x( 'Free for %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year)', 'invoicing' ),
442
+                    _x('Free for %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year)', 'invoicing'),
443 443
                     "<span class='getpaid-item-trial-period'>$trial_period</span>",
444 444
                     "<span class='$recurring_class'>$recurring_price</span>",
445 445
                     "<span class='getpaid-item-recurring-period'>$period</span>"
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
             return sprintf(
452 452
 
453 453
                 // translators: $1: is the trial period, $2: is the recurring price, $3: is the susbcription period, $4: is the bill times
454
-                _x( 'Free for %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year for 4 years)', 'invoicing' ),
454
+                _x('Free for %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Free for 1 month then $120 / year for 4 years)', 'invoicing'),
455 455
                 "<span class='getpaid-item-trial-period'>$trial_period</span>",
456 456
                 "<span class='$recurring_class'>$recurring_price</span>",
457 457
                 "<span class='getpaid-item-recurring-period'>$period</span>",
@@ -461,12 +461,12 @@  discard block
 block discarded – undo
461 461
 
462 462
         }
463 463
 
464
-        if ( empty( $bill_times ) ) {
464
+        if (empty($bill_times)) {
465 465
 
466 466
             return sprintf(
467 467
 
468 468
                 // translators: $1: is the initial price, $2: is the trial period, $3: is the recurring price, $4: is the susbcription period
469
-                _x( '%1$s for %2$s then %3$s / %4$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year)', 'invoicing' ),
469
+                _x('%1$s for %2$s then %3$s / %4$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year)', 'invoicing'),
470 470
                 "<span class='$initial_class'>$initial_price</span>",
471 471
                 "<span class='getpaid-item-trial-period'>$trial_period</span>",
472 472
                 "<span class='$recurring_class'>$recurring_price</span>",
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         return sprintf(
480 480
 
481 481
             // translators: $1: is the initial price, $2: is the trial period, $3: is the recurring price, $4: is the susbcription period, $4: is the susbcription bill times
482
-            _x( '%1$s for %2$s then %3$s / %4$s for %5$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year for 5 years)', 'invoicing' ),
482
+            _x('%1$s for %2$s then %3$s / %4$s for %5$s', 'Item subscription amount. (e.g.: $7 for 1 month then $120 / year for 5 years)', 'invoicing'),
483 483
             "<span class='$initial_class'>$initial_price</span>",
484 484
             "<span class='getpaid-item-trial-period'>$trial_period</span>",
485 485
             "<span class='$recurring_class'>$recurring_price</span>",
@@ -490,14 +490,14 @@  discard block
 block discarded – undo
490 490
 
491 491
     }
492 492
 
493
-    if ( $initial_price == $recurring_price ) {
493
+    if ($initial_price == $recurring_price) {
494 494
 
495
-        if ( empty( $bill_times ) ) {
495
+        if (empty($bill_times)) {
496 496
 
497 497
             return sprintf(
498 498
 
499 499
                 // translators: $1: is the recurring price, $2: is the susbcription period
500
-                _x( '%1$s / %2$s', 'Item subscription amount. (e.g.: $120 / year)', 'invoicing' ),
500
+                _x('%1$s / %2$s', 'Item subscription amount. (e.g.: $120 / year)', 'invoicing'),
501 501
                 "<span class='$recurring_class'>$recurring_price</span>",
502 502
                 "<span class='getpaid-item-recurring-period'>$period</span>"
503 503
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
         return sprintf(
509 509
 
510 510
             // translators: $1: is the recurring price, $2: is the susbcription period, $3: is the susbcription bill times
511
-            _x( '%1$s / %2$s for %3$s', 'Item subscription amount. (e.g.: $120 / year for 5 years)', 'invoicing' ),
511
+            _x('%1$s / %2$s for %3$s', 'Item subscription amount. (e.g.: $120 / year for 5 years)', 'invoicing'),
512 512
             "<span class='$recurring_class'>$recurring_price</span>",
513 513
             "<span class='getpaid-item-recurring-period'>$period</span>",
514 514
             "<span class='getpaid-item-recurring-bill-times'>$bill_times</span>"
@@ -517,14 +517,14 @@  discard block
 block discarded – undo
517 517
 
518 518
     }
519 519
 
520
-    if ( $initial_price == wpinv_price( 0, $currency ) ) {
520
+    if ($initial_price == wpinv_price(0, $currency)) {
521 521
 
522
-        if ( empty( $bill_times ) ) {
522
+        if (empty($bill_times)) {
523 523
 
524 524
             return sprintf(
525 525
 
526 526
                 // translators: $1: is the recurring period, $2: is the recurring price
527
-                _x( 'Free for %1$s then %2$s / %1$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months)', 'invoicing' ),
527
+                _x('Free for %1$s then %2$s / %1$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months)', 'invoicing'),
528 528
                 "<span class='getpaid-item-recurring-period'>$period</span>",
529 529
                 "<span class='$recurring_class'>$recurring_price</span>"
530 530
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
         return sprintf(
536 536
 
537 537
             // translators: $1: is the recurring period, $2: is the recurring price, $3: is the bill times
538
-            _x( 'Free for %1$s then %2$s / %1$s for %3$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months for 12 months)', 'invoicing' ),
538
+            _x('Free for %1$s then %2$s / %1$s for %3$s', 'Item subscription amount. (e.g.: Free for 3 months then $7 / 3 months for 12 months)', 'invoicing'),
539 539
             "<span class='getpaid-item-recurring-period'>$period</span>",
540 540
             "<span class='$recurring_class'>$recurring_price</span>",
541 541
             "<span class='getpaid-item-recurring-bill-times'>$bill_times</span>"
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
 
545 545
     }
546 546
 
547
-    if ( empty( $bill_times ) ) {
547
+    if (empty($bill_times)) {
548 548
 
549 549
         return sprintf(
550 550
 
551 551
             // translators: $1: is the initial price, $2: is the recurring price, $3: is the susbcription period
552
-            _x( 'Initial payment of %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year)', 'invoicing' ),
552
+            _x('Initial payment of %1$s then %2$s / %3$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year)', 'invoicing'),
553 553
             "<span class='$initial_class'>$initial_price</span>",
554 554
             "<span class='$recurring_class'>$recurring_price</span>",
555 555
             "<span class='getpaid-item-recurring-period'>$period</span>"
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
     return sprintf(
562 562
 
563 563
         // translators: $1: is the initial price, $2: is the recurring price, $3: is the susbcription period, $4: is the susbcription bill times
564
-        _x( 'Initial payment of %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year for 4 years)', 'invoicing' ),
564
+        _x('Initial payment of %1$s then %2$s / %3$s for %4$s', 'Item subscription amount. (e.g.: Initial payment of $7 then $120 / year for 4 years)', 'invoicing'),
565 565
         "<span class='$initial_class'>$initial_price</span>",
566 566
         "<span class='$recurring_class'>$recurring_price</span>",
567 567
         "<span class='getpaid-item-recurring-period'>$period</span>",
Please login to merge, or discard this patch.