@@ -411,9 +411,9 @@ |
||
411 | 411 | $bill_times = $item->get_recurring_limit(); |
412 | 412 | |
413 | 413 | if ( ! empty( $bill_times ) ) { |
414 | - $bill_times = $item->get_recurring_interval() * $bill_times; |
|
415 | - $bill_times = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times ); |
|
416 | - } |
|
414 | + $bill_times = $item->get_recurring_interval() * $bill_times; |
|
415 | + $bill_times = getpaid_get_subscription_period_label( $item->get_recurring_period(), $bill_times ); |
|
416 | + } |
|
417 | 417 | |
418 | 418 | if ( $item instanceof GetPaid_Form_Item && false === $_initial_price ) { |
419 | 419 | $initial_price = wpinv_price( $item->get_sub_total(), $currency ); |
@@ -17,28 +17,28 @@ discard block |
||
17 | 17 | */ |
18 | 18 | function getpaid_get_subscriptions( $args = array(), $return = 'results' ) { |
19 | 19 | |
20 | - // Do not retrieve all fields if we just want the count. |
|
21 | - if ( 'count' == $return ) { |
|
22 | - $args['fields'] = 'id'; |
|
23 | - $args['number'] = 1; |
|
24 | - } |
|
20 | + // Do not retrieve all fields if we just want the count. |
|
21 | + if ( 'count' == $return ) { |
|
22 | + $args['fields'] = 'id'; |
|
23 | + $args['number'] = 1; |
|
24 | + } |
|
25 | 25 | |
26 | - // Do not count all matches if we just want the results. |
|
27 | - if ( 'results' == $return ) { |
|
28 | - $args['count_total'] = false; |
|
29 | - } |
|
26 | + // Do not count all matches if we just want the results. |
|
27 | + if ( 'results' == $return ) { |
|
28 | + $args['count_total'] = false; |
|
29 | + } |
|
30 | 30 | |
31 | - $query = new GetPaid_Subscriptions_Query( $args ); |
|
31 | + $query = new GetPaid_Subscriptions_Query( $args ); |
|
32 | 32 | |
33 | - if ( 'results' == $return ) { |
|
34 | - return $query->get_results(); |
|
35 | - } |
|
33 | + if ( 'results' == $return ) { |
|
34 | + return $query->get_results(); |
|
35 | + } |
|
36 | 36 | |
37 | - if ( 'count' == $return ) { |
|
38 | - return $query->get_total(); |
|
39 | - } |
|
37 | + if ( 'count' == $return ) { |
|
38 | + return $query->get_total(); |
|
39 | + } |
|
40 | 40 | |
41 | - return $query; |
|
41 | + return $query; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | */ |
49 | 49 | function getpaid_get_subscription_statuses() { |
50 | 50 | |
51 | - return apply_filters( |
|
52 | - 'getpaid_get_subscription_statuses', |
|
53 | - array( |
|
54 | - 'pending' => __( 'Pending', 'invoicing' ), |
|
55 | - 'trialling' => __( 'Trialing', 'invoicing' ), |
|
56 | - 'active' => __( 'Active', 'invoicing' ), |
|
57 | - 'failing' => __( 'Failing', 'invoicing' ), |
|
58 | - 'expired' => __( 'Expired', 'invoicing' ), |
|
59 | - 'completed' => __( 'Complete', 'invoicing' ), |
|
60 | - 'cancelled' => __( 'Cancelled', 'invoicing' ), |
|
61 | - ) |
|
62 | - ); |
|
51 | + return apply_filters( |
|
52 | + 'getpaid_get_subscription_statuses', |
|
53 | + array( |
|
54 | + 'pending' => __( 'Pending', 'invoicing' ), |
|
55 | + 'trialling' => __( 'Trialing', 'invoicing' ), |
|
56 | + 'active' => __( 'Active', 'invoicing' ), |
|
57 | + 'failing' => __( 'Failing', 'invoicing' ), |
|
58 | + 'expired' => __( 'Expired', 'invoicing' ), |
|
59 | + 'completed' => __( 'Complete', 'invoicing' ), |
|
60 | + 'cancelled' => __( 'Cancelled', 'invoicing' ), |
|
61 | + ) |
|
62 | + ); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | * @return string |
70 | 70 | */ |
71 | 71 | function getpaid_get_subscription_status_label( $status ) { |
72 | - $statuses = getpaid_get_subscription_statuses(); |
|
73 | - return isset( $statuses[ $status ] ) ? $statuses[ $status ] : ucfirst( sanitize_text_field( $status ) ); |
|
72 | + $statuses = getpaid_get_subscription_statuses(); |
|
73 | + return isset( $statuses[ $status ] ) ? $statuses[ $status ] : ucfirst( sanitize_text_field( $status ) ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -80,18 +80,18 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function getpaid_get_subscription_status_classes() { |
82 | 82 | |
83 | - return apply_filters( |
|
84 | - 'getpaid_get_subscription_status_classes', |
|
85 | - array( |
|
86 | - 'pending' => 'badge-dark', |
|
87 | - 'trialling' => 'badge-info', |
|
88 | - 'active' => 'badge-success', |
|
89 | - 'failing' => 'badge-warning', |
|
90 | - 'expired' => 'badge-danger', |
|
91 | - 'completed' => 'badge-primary', |
|
92 | - 'cancelled' => 'badge-secondary', |
|
93 | - ) |
|
94 | - ); |
|
83 | + return apply_filters( |
|
84 | + 'getpaid_get_subscription_status_classes', |
|
85 | + array( |
|
86 | + 'pending' => 'badge-dark', |
|
87 | + 'trialling' => 'badge-info', |
|
88 | + 'active' => 'badge-success', |
|
89 | + 'failing' => 'badge-warning', |
|
90 | + 'expired' => 'badge-danger', |
|
91 | + 'completed' => 'badge-primary', |
|
92 | + 'cancelled' => 'badge-secondary', |
|
93 | + ) |
|
94 | + ); |
|
95 | 95 | |
96 | 96 | } |
97 | 97 | |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | */ |
103 | 103 | function getpaid_get_subscription_status_counts( $args = array() ) { |
104 | 104 | |
105 | - $statuses = array_keys( getpaid_get_subscription_statuses() ); |
|
106 | - $counts = array(); |
|
105 | + $statuses = array_keys( getpaid_get_subscription_statuses() ); |
|
106 | + $counts = array(); |
|
107 | 107 | |
108 | - foreach ( $statuses as $status ) { |
|
109 | - $_args = wp_parse_args( "status=$status", $args ); |
|
110 | - $counts[ $status ] = getpaid_get_subscriptions( $_args, 'count' ); |
|
111 | - } |
|
108 | + foreach ( $statuses as $status ) { |
|
109 | + $_args = wp_parse_args( "status=$status", $args ); |
|
110 | + $counts[ $status ] = getpaid_get_subscriptions( $_args, 'count' ); |
|
111 | + } |
|
112 | 112 | |
113 | - return $counts; |
|
113 | + return $counts; |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | |
@@ -121,32 +121,32 @@ discard block |
||
121 | 121 | */ |
122 | 122 | function getpaid_get_subscription_periods() { |
123 | 123 | |
124 | - return apply_filters( |
|
125 | - 'getpaid_get_subscription_periods', |
|
126 | - array( |
|
124 | + return apply_filters( |
|
125 | + 'getpaid_get_subscription_periods', |
|
126 | + array( |
|
127 | 127 | |
128 | - 'day' => array( |
|
129 | - 'singular' => __( '%s day', 'invoicing' ), |
|
130 | - 'plural' => __( '%d days', 'invoicing' ), |
|
131 | - ), |
|
128 | + 'day' => array( |
|
129 | + 'singular' => __( '%s day', 'invoicing' ), |
|
130 | + 'plural' => __( '%d days', 'invoicing' ), |
|
131 | + ), |
|
132 | 132 | |
133 | - 'week' => array( |
|
134 | - 'singular' => __( '%s week', 'invoicing' ), |
|
135 | - 'plural' => __( '%d weeks', 'invoicing' ), |
|
136 | - ), |
|
133 | + 'week' => array( |
|
134 | + 'singular' => __( '%s week', 'invoicing' ), |
|
135 | + 'plural' => __( '%d weeks', 'invoicing' ), |
|
136 | + ), |
|
137 | 137 | |
138 | - 'month' => array( |
|
139 | - 'singular' => __( '%s month', 'invoicing' ), |
|
140 | - 'plural' => __( '%d months', 'invoicing' ), |
|
141 | - ), |
|
138 | + 'month' => array( |
|
139 | + 'singular' => __( '%s month', 'invoicing' ), |
|
140 | + 'plural' => __( '%d months', 'invoicing' ), |
|
141 | + ), |
|
142 | 142 | |
143 | - 'year' => array( |
|
144 | - 'singular' => __( '%s year', 'invoicing' ), |
|
145 | - 'plural' => __( '%d years', 'invoicing' ), |
|
146 | - ), |
|
143 | + 'year' => array( |
|
144 | + 'singular' => __( '%s year', 'invoicing' ), |
|
145 | + 'plural' => __( '%d years', 'invoicing' ), |
|
146 | + ), |
|
147 | 147 | |
148 | - ) |
|
149 | - ); |
|
148 | + ) |
|
149 | + ); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return int |
158 | 158 | */ |
159 | 159 | function getpaid_get_subscription_trial_period_interval( $trial_period ) { |
160 | - return (int) preg_replace( '/[^0-9]/', '', $trial_period ); |
|
160 | + return (int) preg_replace( '/[^0-9]/', '', $trial_period ); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @return string |
168 | 168 | */ |
169 | 169 | function getpaid_get_subscription_trial_period_period( $trial_period ) { |
170 | - return preg_replace( '/[^a-z]/', '', strtolower( $trial_period ) ); |
|
170 | + return preg_replace( '/[^a-z]/', '', strtolower( $trial_period ) ); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @return string |
179 | 179 | */ |
180 | 180 | function getpaid_get_subscription_period_label( $period, $interval = 1, $singular_prefix = '1' ) { |
181 | - $label = (int) $interval > 1 ? getpaid_get_plural_subscription_period_label( $period, $interval ) : getpaid_get_singular_subscription_period_label( $period, $singular_prefix ); |
|
182 | - return strtolower( sanitize_text_field( $label ) ); |
|
181 | + $label = (int) $interval > 1 ? getpaid_get_plural_subscription_period_label( $period, $interval ) : getpaid_get_singular_subscription_period_label( $period, $singular_prefix ); |
|
182 | + return strtolower( sanitize_text_field( $label ) ); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -190,22 +190,22 @@ discard block |
||
190 | 190 | */ |
191 | 191 | function getpaid_get_singular_subscription_period_label( $period, $singular_prefix = '1' ) { |
192 | 192 | |
193 | - $periods = getpaid_get_subscription_periods(); |
|
194 | - $period = strtolower( $period ); |
|
193 | + $periods = getpaid_get_subscription_periods(); |
|
194 | + $period = strtolower( $period ); |
|
195 | 195 | |
196 | - if ( isset( $periods[ $period ] ) ) { |
|
197 | - return sprintf( $periods[ $period ]['singular'], $singular_prefix ); |
|
198 | - } |
|
196 | + if ( isset( $periods[ $period ] ) ) { |
|
197 | + return sprintf( $periods[ $period ]['singular'], $singular_prefix ); |
|
198 | + } |
|
199 | 199 | |
200 | - // Backwards compatibility. |
|
201 | - foreach ( $periods as $key => $data ) { |
|
202 | - if ( strpos( $key, $period ) === 0 ) { |
|
203 | - return sprintf( $data['singular'], $singular_prefix ); |
|
204 | - } |
|
205 | - } |
|
200 | + // Backwards compatibility. |
|
201 | + foreach ( $periods as $key => $data ) { |
|
202 | + if ( strpos( $key, $period ) === 0 ) { |
|
203 | + return sprintf( $data['singular'], $singular_prefix ); |
|
204 | + } |
|
205 | + } |
|
206 | 206 | |
207 | - // Invalid string. |
|
208 | - return ''; |
|
207 | + // Invalid string. |
|
208 | + return ''; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -217,22 +217,22 @@ discard block |
||
217 | 217 | */ |
218 | 218 | function getpaid_get_plural_subscription_period_label( $period, $interval ) { |
219 | 219 | |
220 | - $periods = getpaid_get_subscription_periods(); |
|
221 | - $period = strtolower( $period ); |
|
220 | + $periods = getpaid_get_subscription_periods(); |
|
221 | + $period = strtolower( $period ); |
|
222 | 222 | |
223 | - if ( isset( $periods[ $period ] ) ) { |
|
224 | - return sprintf( $periods[ $period ]['plural'], $interval ); |
|
225 | - } |
|
223 | + if ( isset( $periods[ $period ] ) ) { |
|
224 | + return sprintf( $periods[ $period ]['plural'], $interval ); |
|
225 | + } |
|
226 | 226 | |
227 | - // Backwards compatibility. |
|
228 | - foreach ( $periods as $key => $data ) { |
|
229 | - if ( strpos( $key, $period ) === 0 ) { |
|
230 | - return sprintf( $data['plural'], $interval ); |
|
231 | - } |
|
232 | - } |
|
227 | + // Backwards compatibility. |
|
228 | + foreach ( $periods as $key => $data ) { |
|
229 | + if ( strpos( $key, $period ) === 0 ) { |
|
230 | + return sprintf( $data['plural'], $interval ); |
|
231 | + } |
|
232 | + } |
|
233 | 233 | |
234 | - // Invalid string. |
|
235 | - return ''; |
|
234 | + // Invalid string. |
|
235 | + return ''; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -243,101 +243,101 @@ discard block |
||
243 | 243 | */ |
244 | 244 | function getpaid_get_formatted_subscription_amount( $subscription ) { |
245 | 245 | |
246 | - $initial = wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
247 | - $recurring = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
248 | - $period = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
249 | - $bill_times = $subscription->get_bill_times(); |
|
246 | + $initial = wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
247 | + $recurring = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
248 | + $period = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
249 | + $bill_times = $subscription->get_bill_times(); |
|
250 | 250 | |
251 | - if ( ! empty( $bill_times ) ) { |
|
252 | - $bill_times = $subscription->get_frequency() * $bill_times; |
|
253 | - $bill_times = getpaid_get_subscription_period_label( $subscription->get_period(), $bill_times ); |
|
254 | - } |
|
251 | + if ( ! empty( $bill_times ) ) { |
|
252 | + $bill_times = $subscription->get_frequency() * $bill_times; |
|
253 | + $bill_times = getpaid_get_subscription_period_label( $subscription->get_period(), $bill_times ); |
|
254 | + } |
|
255 | 255 | |
256 | - // Trial periods. |
|
257 | - if ( $subscription->has_trial_period() ) { |
|
256 | + // Trial periods. |
|
257 | + if ( $subscription->has_trial_period() ) { |
|
258 | 258 | |
259 | - $trial_period = getpaid_get_subscription_trial_period_period( $subscription->get_trial_period() ); |
|
260 | - $trial_interval = getpaid_get_subscription_trial_period_interval( $subscription->get_trial_period() ); |
|
259 | + $trial_period = getpaid_get_subscription_trial_period_period( $subscription->get_trial_period() ); |
|
260 | + $trial_interval = getpaid_get_subscription_trial_period_interval( $subscription->get_trial_period() ); |
|
261 | 261 | |
262 | - if ( empty( $bill_times ) ) { |
|
262 | + if ( empty( $bill_times ) ) { |
|
263 | 263 | |
264 | - return sprintf( |
|
264 | + return sprintf( |
|
265 | 265 | |
266 | - // translators: $1: is the initial amount, $2: is the trial period, $3: is the recurring amount, $4: is the recurring period |
|
267 | - _x( '%1$s trial for %2$s then %3$s / %4$s', 'Subscription amount. (e.g.: $10 trial for 1 month then $120 / year)', 'invoicing' ), |
|
268 | - $initial, |
|
269 | - getpaid_get_subscription_period_label( $trial_period, $trial_interval ), |
|
270 | - $recurring, |
|
271 | - $period |
|
266 | + // translators: $1: is the initial amount, $2: is the trial period, $3: is the recurring amount, $4: is the recurring period |
|
267 | + _x( '%1$s trial for %2$s then %3$s / %4$s', 'Subscription amount. (e.g.: $10 trial for 1 month then $120 / year)', 'invoicing' ), |
|
268 | + $initial, |
|
269 | + getpaid_get_subscription_period_label( $trial_period, $trial_interval ), |
|
270 | + $recurring, |
|
271 | + $period |
|
272 | 272 | |
273 | - ); |
|
273 | + ); |
|
274 | 274 | |
275 | - } |
|
275 | + } |
|
276 | 276 | |
277 | - return sprintf( |
|
277 | + return sprintf( |
|
278 | 278 | |
279 | - // translators: $1: is the initial amount, $2: is the trial period, $3: is the recurring amount, $4: is the recurring period, $5: is the bill times |
|
280 | - _x( '%1$s trial for %2$s then %3$s / %4$s for %5$s', 'Subscription amount. (e.g.: $10 trial for 1 month then $120 / year for 4 years)', 'invoicing' ), |
|
281 | - $initial, |
|
282 | - getpaid_get_subscription_period_label( $trial_period, $trial_interval ), |
|
283 | - $recurring, |
|
284 | - $period, |
|
285 | - $bill_times |
|
286 | - ); |
|
279 | + // translators: $1: is the initial amount, $2: is the trial period, $3: is the recurring amount, $4: is the recurring period, $5: is the bill times |
|
280 | + _x( '%1$s trial for %2$s then %3$s / %4$s for %5$s', 'Subscription amount. (e.g.: $10 trial for 1 month then $120 / year for 4 years)', 'invoicing' ), |
|
281 | + $initial, |
|
282 | + getpaid_get_subscription_period_label( $trial_period, $trial_interval ), |
|
283 | + $recurring, |
|
284 | + $period, |
|
285 | + $bill_times |
|
286 | + ); |
|
287 | 287 | |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | - if ( $initial != $recurring ) { |
|
290 | + if ( $initial != $recurring ) { |
|
291 | 291 | |
292 | - if ( empty( $bill_times ) ) { |
|
292 | + if ( empty( $bill_times ) ) { |
|
293 | 293 | |
294 | - return sprintf( |
|
294 | + return sprintf( |
|
295 | 295 | |
296 | - // translators: $1: is the initial amount, $2: is the recurring amount, $3: is the recurring period |
|
297 | - _x( 'Initial payment of %1$s which renews at %2$s / %3$s', 'Subscription amount. (e.g.:Initial payment of $100 which renews at $120 / year)', 'invoicing' ), |
|
298 | - $initial, |
|
299 | - $recurring, |
|
300 | - $period |
|
296 | + // translators: $1: is the initial amount, $2: is the recurring amount, $3: is the recurring period |
|
297 | + _x( 'Initial payment of %1$s which renews at %2$s / %3$s', 'Subscription amount. (e.g.:Initial payment of $100 which renews at $120 / year)', 'invoicing' ), |
|
298 | + $initial, |
|
299 | + $recurring, |
|
300 | + $period |
|
301 | 301 | |
302 | - ); |
|
302 | + ); |
|
303 | 303 | |
304 | - } |
|
304 | + } |
|
305 | 305 | |
306 | - return sprintf( |
|
306 | + return sprintf( |
|
307 | 307 | |
308 | - // translators: $1: is the initial amount, $2: is the recurring amount, $3: is the recurring period, $4: is the bill times |
|
309 | - _x( 'Initial payment of %1$s which renews at %2$s / %3$s for %4$s', 'Subscription amount. (e.g.:Initial payment of $100 which renews at $120 / year for 5 years)', 'invoicing' ), |
|
310 | - $initial, |
|
311 | - $recurring, |
|
312 | - $period, |
|
313 | - $bill_times |
|
308 | + // translators: $1: is the initial amount, $2: is the recurring amount, $3: is the recurring period, $4: is the bill times |
|
309 | + _x( 'Initial payment of %1$s which renews at %2$s / %3$s for %4$s', 'Subscription amount. (e.g.:Initial payment of $100 which renews at $120 / year for 5 years)', 'invoicing' ), |
|
310 | + $initial, |
|
311 | + $recurring, |
|
312 | + $period, |
|
313 | + $bill_times |
|
314 | 314 | |
315 | - ); |
|
315 | + ); |
|
316 | 316 | |
317 | - } |
|
317 | + } |
|
318 | 318 | |
319 | - if ( empty( $bill_times ) ) { |
|
319 | + if ( empty( $bill_times ) ) { |
|
320 | 320 | |
321 | - return sprintf( |
|
321 | + return sprintf( |
|
322 | 322 | |
323 | - // translators: $1: is the recurring amount, $2: is the recurring period |
|
324 | - _x( '%1$s / %2$s', 'Subscription amount. (e.g.: $120 / year)', 'invoicing' ), |
|
325 | - $initial, |
|
326 | - $period |
|
323 | + // translators: $1: is the recurring amount, $2: is the recurring period |
|
324 | + _x( '%1$s / %2$s', 'Subscription amount. (e.g.: $120 / year)', 'invoicing' ), |
|
325 | + $initial, |
|
326 | + $period |
|
327 | 327 | |
328 | - ); |
|
328 | + ); |
|
329 | 329 | |
330 | - } |
|
330 | + } |
|
331 | 331 | |
332 | - return sprintf( |
|
332 | + return sprintf( |
|
333 | 333 | |
334 | - // translators: $1: is the bill times, $2: is the recurring amount, $3: is the recurring period |
|
335 | - _x( '%2$s / %3$s for %1$s', 'Subscription amount. (e.g.: $120 / year for 5 years)', 'invoicing' ), |
|
336 | - $bill_times, |
|
337 | - $initial, |
|
338 | - $period |
|
334 | + // translators: $1: is the bill times, $2: is the recurring amount, $3: is the recurring period |
|
335 | + _x( '%2$s / %3$s for %1$s', 'Subscription amount. (e.g.: $120 / year for 5 years)', 'invoicing' ), |
|
336 | + $bill_times, |
|
337 | + $initial, |
|
338 | + $period |
|
339 | 339 | |
340 | - ); |
|
340 | + ); |
|
341 | 341 | |
342 | 342 | } |
343 | 343 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @return WPInv_Subscription|bool |
349 | 349 | */ |
350 | 350 | function getpaid_get_invoice_subscription( $invoice ) { |
351 | - return getpaid_subscriptions()->get_invoice_subscription( $invoice ); |
|
351 | + return getpaid_subscriptions()->get_invoice_subscription( $invoice ); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | * @param WPInv_Invoice $invoice |
358 | 358 | */ |
359 | 359 | function getpaid_activate_invoice_subscription( $invoice ) { |
360 | - $subscription = getpaid_get_invoice_subscription( $invoice ); |
|
361 | - if ( is_a( $subscription, 'WPInv_Subscription' ) ) { |
|
362 | - $subscription->activate(); |
|
363 | - } |
|
360 | + $subscription = getpaid_get_invoice_subscription( $invoice ); |
|
361 | + if ( is_a( $subscription, 'WPInv_Subscription' ) ) { |
|
362 | + $subscription->activate(); |
|
363 | + } |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * @return WPInv_Subscriptions |
370 | 370 | */ |
371 | 371 | function getpaid_subscriptions() { |
372 | - return getpaid()->get( 'subscriptions' ); |
|
372 | + return getpaid()->get( 'subscriptions' ); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | /** |
@@ -387,14 +387,14 @@ discard block |
||
387 | 387 | return false; |
388 | 388 | } |
389 | 389 | |
390 | - // Fetch the invoiec subscription. |
|
391 | - $subscription = getpaid_get_subscriptions( |
|
392 | - array( |
|
393 | - 'invoice_in' => $invoice->is_renewal() ? $invoice->get_parent_id() : $invoice->get_id(), |
|
394 | - 'number' => 1, |
|
395 | - ) |
|
396 | - ); |
|
390 | + // Fetch the invoiec subscription. |
|
391 | + $subscription = getpaid_get_subscriptions( |
|
392 | + array( |
|
393 | + 'invoice_in' => $invoice->is_renewal() ? $invoice->get_parent_id() : $invoice->get_id(), |
|
394 | + 'number' => 1, |
|
395 | + ) |
|
396 | + ); |
|
397 | 397 | |
398 | - return empty( $subscription ) ? false : $subscription[0]; |
|
398 | + return empty( $subscription ) ? false : $subscription[0]; |
|
399 | 399 | |
400 | 400 | } |