@@ -8,4 +8,4 @@ |
||
8 | 8 | * @package Pronamic\WordPress\Pay\Extensions\MemberPress |
9 | 9 | */ |
10 | 10 | |
11 | -class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\DirectDebitIDealGateway', 'MeprDirectDebitIDealGateway' ); |
|
11 | +class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\DirectDebitIDealGateway', 'MeprDirectDebitIDealGateway'); |
@@ -8,4 +8,4 @@ |
||
8 | 8 | * @package Pronamic\WordPress\Pay\Extensions\MemberPress |
9 | 9 | */ |
10 | 10 | |
11 | -class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\IDealGateway', 'MeprIDealGateway' ); |
|
11 | +class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\IDealGateway', 'MeprIDealGateway'); |
@@ -8,4 +8,4 @@ |
||
8 | 8 | * @package Pronamic\WordPress\Pay\Extensions\MemberPress |
9 | 9 | */ |
10 | 10 | |
11 | -class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\BancontactGateway', 'MeprMisterCashGateway' ); |
|
11 | +class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\BancontactGateway', 'MeprMisterCashGateway'); |
@@ -8,4 +8,4 @@ |
||
8 | 8 | * @package Pronamic\WordPress\Pay\Extensions\MemberPress |
9 | 9 | */ |
10 | 10 | |
11 | -class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\PayPalGateway', 'MeprPronamicPayPalGateway' ); |
|
11 | +class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\PayPalGateway', 'MeprPronamicPayPalGateway'); |
@@ -28,8 +28,8 @@ |
||
28 | 28 | * |
29 | 29 | * @param string $status MemberPress subscription status value. |
30 | 30 | */ |
31 | - public static function transform( $status ) { |
|
32 | - switch ( $status ) { |
|
31 | + public static function transform($status) { |
|
32 | + switch ($status) { |
|
33 | 33 | case MeprSubscription::$pending_str: |
34 | 34 | return Statuses::OPEN; |
35 | 35 | case MeprSubscription::$active_str: |
@@ -8,4 +8,4 @@ |
||
8 | 8 | * @package Pronamic\WordPress\Pay\Extensions\MemberPress |
9 | 9 | */ |
10 | 10 | |
11 | -class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\DirectDebitBancontactGateway', 'MeprDirectDebitBancontactGateway' ); |
|
11 | +class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\DirectDebitBancontactGateway', 'MeprDirectDebitBancontactGateway'); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * @return string |
36 | 36 | */ |
37 | 37 | protected function get_icon() { |
38 | - return plugins_url( 'images/bancontact/icon-32x32.png', Plugin::$file ); |
|
38 | + return plugins_url('images/bancontact/icon-32x32.png', Plugin::$file); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param MeprTransaction $transaction MemberPress transaction object. |
68 | 68 | * @param Gateway $gateway MemberPress gateway object. |
69 | 69 | */ |
70 | - public function __construct( MeprTransaction $transaction, Gateway $gateway ) { |
|
70 | + public function __construct(MeprTransaction $transaction, Gateway $gateway) { |
|
71 | 71 | parent::__construct(); |
72 | 72 | |
73 | 73 | $this->transaction = $transaction; |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | $items = new Items(); |
136 | 136 | |
137 | 137 | $item = new Item(); |
138 | - $item->set_number( $this->get_order_id() ); |
|
139 | - $item->set_description( $this->get_description() ); |
|
140 | - $item->set_price( $this->transaction->total ); |
|
141 | - $item->set_quantity( 1 ); |
|
138 | + $item->set_number($this->get_order_id()); |
|
139 | + $item->set_description($this->get_description()); |
|
140 | + $item->set_price($this->transaction->total); |
|
141 | + $item->set_quantity(1); |
|
142 | 142 | |
143 | - $items->addItem( $item ); |
|
143 | + $items->addItem($item); |
|
144 | 144 | |
145 | 145 | return $items; |
146 | 146 | } |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | * @return string|null |
217 | 217 | */ |
218 | 218 | public function get_address() { |
219 | - $value = $this->user->address( 'one', false ); |
|
219 | + $value = $this->user->address('one', false); |
|
220 | 220 | |
221 | - if ( false === $value ) { |
|
221 | + if (false === $value) { |
|
222 | 222 | return null; |
223 | 223 | } |
224 | 224 | |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | * @return string|null |
234 | 234 | */ |
235 | 235 | public function get_city() { |
236 | - $value = $this->user->address( 'city', false ); |
|
236 | + $value = $this->user->address('city', false); |
|
237 | 237 | |
238 | - if ( false === $value ) { |
|
238 | + if (false === $value) { |
|
239 | 239 | return null; |
240 | 240 | } |
241 | 241 | |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | * @return string|null |
251 | 251 | */ |
252 | 252 | public function get_zip() { |
253 | - $value = $this->user->address( 'zip', false ); |
|
253 | + $value = $this->user->address('zip', false); |
|
254 | 254 | |
255 | - if ( false === $value ) { |
|
255 | + if (false === $value) { |
|
256 | 256 | return null; |
257 | 257 | } |
258 | 258 | |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | * @return string|null |
268 | 268 | */ |
269 | 269 | public function get_country() { |
270 | - $value = $this->user->address( 'country', false ); |
|
270 | + $value = $this->user->address('country', false); |
|
271 | 271 | |
272 | - if ( false === $value ) { |
|
272 | + if (false === $value) { |
|
273 | 273 | return null; |
274 | 274 | } |
275 | 275 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | // @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprOptions.php#L768-782 |
290 | 290 | // @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/models/MeprOptions.php#L806-L835 |
291 | - return $mepr_options->thankyou_page_url( 'trans_num=' . $this->transaction->id ); |
|
291 | + return $mepr_options->thankyou_page_url('trans_num=' . $this->transaction->id); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -300,19 +300,19 @@ discard block |
||
300 | 300 | * @return string |
301 | 301 | */ |
302 | 302 | public function get_cancel_url() { |
303 | - if ( isset( $this->transaction->product_id ) && $this->transaction->product_id > 0 ) { |
|
304 | - $product = new MeprProduct( $this->transaction->product_id ); |
|
303 | + if (isset($this->transaction->product_id) && $this->transaction->product_id > 0) { |
|
304 | + $product = new MeprProduct($this->transaction->product_id); |
|
305 | 305 | |
306 | - $url = $this->gateway->message_page_url( $product, 'cancel' ); |
|
306 | + $url = $this->gateway->message_page_url($product, 'cancel'); |
|
307 | 307 | |
308 | - if ( false !== $url ) { |
|
308 | + if (false !== $url) { |
|
309 | 309 | return $url; |
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
313 | 313 | $mepr_options = MeprOptions::fetch(); |
314 | 314 | |
315 | - return $mepr_options->account_page_url( 'action=subscriptions' ); |
|
315 | + return $mepr_options->account_page_url('action=subscriptions'); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | public function get_error_url() { |
333 | 333 | $mepr_options = MeprOptions::fetch(); |
334 | 334 | |
335 | - return $mepr_options->account_page_url( 'action=subscriptions' ); |
|
335 | + return $mepr_options->account_page_url('action=subscriptions'); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -345,36 +345,36 @@ discard block |
||
345 | 345 | public function get_subscription() { |
346 | 346 | $product = $this->transaction->product(); |
347 | 347 | |
348 | - if ( $product->is_one_time_payment() ) { |
|
348 | + if ($product->is_one_time_payment()) { |
|
349 | 349 | return false; |
350 | 350 | } |
351 | 351 | |
352 | 352 | $mp_subscription = $this->transaction->subscription(); |
353 | 353 | |
354 | - if ( ! $mp_subscription ) { |
|
354 | + if ( ! $mp_subscription) { |
|
355 | 355 | return false; |
356 | 356 | } |
357 | 357 | |
358 | 358 | $frequency = ''; |
359 | 359 | |
360 | - if ( $mp_subscription->limit_cycles ) { |
|
360 | + if ($mp_subscription->limit_cycles) { |
|
361 | 361 | $frequency = $mp_subscription->limit_cycles; |
362 | 362 | } |
363 | 363 | |
364 | 364 | $subscription = new Subscription(); |
365 | 365 | $subscription->frequency = $frequency; |
366 | 366 | $subscription->interval = $product->period; |
367 | - $subscription->interval_period = Core_Util::to_period( $product->period_type ); |
|
367 | + $subscription->interval_period = Core_Util::to_period($product->period_type); |
|
368 | 368 | $subscription->description = sprintf( |
369 | 369 | 'Order #%s - %s', |
370 | 370 | $this->get_source_id(), |
371 | 371 | $this->get_description() |
372 | 372 | ); |
373 | 373 | |
374 | - $subscription->set_amount( new Money( |
|
374 | + $subscription->set_amount(new Money( |
|
375 | 375 | $this->transaction->total, |
376 | 376 | $this->get_currency_alphabetic_code() |
377 | - ) ); |
|
377 | + )); |
|
378 | 378 | |
379 | 379 | return $subscription; |
380 | 380 | } |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | public function get_subscription_source_id() { |
389 | 389 | $subscription = $this->get_subscription(); |
390 | 390 | |
391 | - if ( ! $subscription ) { |
|
391 | + if ( ! $subscription) { |
|
392 | 392 | return false; |
393 | 393 | } |
394 | 394 | |
395 | - if ( ! empty( $this->transaction->subscription_id ) ) { |
|
395 | + if ( ! empty($this->transaction->subscription_id)) { |
|
396 | 396 | return $this->transaction->subscription_id; |
397 | 397 | } |
398 | 398 |
@@ -47,22 +47,22 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function __construct() { |
49 | 49 | // @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprGatewayFactory.php#L48-50 |
50 | - add_filter( 'mepr-gateway-paths', array( $this, 'gateway_paths' ) ); |
|
51 | - add_filter( 'mepr_recurring_subscriptions_table_joins', array( $this, 'subscriptions_table_joins_nested_query_fix' ) ); |
|
50 | + add_filter('mepr-gateway-paths', array($this, 'gateway_paths')); |
|
51 | + add_filter('mepr_recurring_subscriptions_table_joins', array($this, 'subscriptions_table_joins_nested_query_fix')); |
|
52 | 52 | |
53 | - add_filter( 'pronamic_payment_redirect_url_' . self::SLUG, array( __CLASS__, 'redirect_url' ), 10, 2 ); |
|
54 | - add_action( 'pronamic_payment_status_update_' . self::SLUG, array( __CLASS__, 'status_update' ), 10, 1 ); |
|
53 | + add_filter('pronamic_payment_redirect_url_' . self::SLUG, array(__CLASS__, 'redirect_url'), 10, 2); |
|
54 | + add_action('pronamic_payment_status_update_' . self::SLUG, array(__CLASS__, 'status_update'), 10, 1); |
|
55 | 55 | |
56 | - add_filter( 'pronamic_payment_source_text_' . self::SLUG, array( __CLASS__, 'source_text' ), 10, 2 ); |
|
57 | - add_filter( 'pronamic_payment_source_description_' . self::SLUG, array( __CLASS__, 'source_description' ), 10, 2 ); |
|
58 | - add_filter( 'pronamic_payment_source_url_' . self::SLUG, array( __CLASS__, 'source_url' ), 10, 2 ); |
|
59 | - add_filter( 'pronamic_subscription_source_text_' . self::SLUG, array( __CLASS__, 'subscription_source_text' ), 10, 2 ); |
|
60 | - add_filter( 'pronamic_subscription_source_description_' . self::SLUG, array( __CLASS__, 'subscription_source_description' ), 10, 2 ); |
|
61 | - add_filter( 'pronamic_subscription_source_url_' . self::SLUG, array( __CLASS__, 'subscription_source_url' ), 10, 2 ); |
|
56 | + add_filter('pronamic_payment_source_text_' . self::SLUG, array(__CLASS__, 'source_text'), 10, 2); |
|
57 | + add_filter('pronamic_payment_source_description_' . self::SLUG, array(__CLASS__, 'source_description'), 10, 2); |
|
58 | + add_filter('pronamic_payment_source_url_' . self::SLUG, array(__CLASS__, 'source_url'), 10, 2); |
|
59 | + add_filter('pronamic_subscription_source_text_' . self::SLUG, array(__CLASS__, 'subscription_source_text'), 10, 2); |
|
60 | + add_filter('pronamic_subscription_source_description_' . self::SLUG, array(__CLASS__, 'subscription_source_description'), 10, 2); |
|
61 | + add_filter('pronamic_subscription_source_url_' . self::SLUG, array(__CLASS__, 'subscription_source_url'), 10, 2); |
|
62 | 62 | |
63 | - add_action( 'mepr_subscription_pre_delete', array( $this, 'subscription_pre_delete' ), 10, 1 ); |
|
63 | + add_action('mepr_subscription_pre_delete', array($this, 'subscription_pre_delete'), 10, 1); |
|
64 | 64 | |
65 | - add_action( 'mepr_subscription_transition_status', array( $this, 'memberpress_subscription_transition_status' ), 10, 3 ); |
|
65 | + add_action('mepr_subscription_transition_status', array($this, 'memberpress_subscription_transition_status'), 10, 3); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param array $paths Array with gateway paths. |
74 | 74 | * @return array |
75 | 75 | */ |
76 | - public function gateway_paths( $paths ) { |
|
77 | - $paths[] = dirname( __FILE__ ) . '/../gateways/'; |
|
76 | + public function gateway_paths($paths) { |
|
77 | + $paths[] = dirname(__FILE__) . '/../gateways/'; |
|
78 | 78 | |
79 | 79 | return $paths; |
80 | 80 | } |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return array |
89 | 89 | */ |
90 | - public function subscriptions_table_joins_nested_query_fix( $joins ) { |
|
91 | - if ( ! is_array( $joins ) ) { |
|
90 | + public function subscriptions_table_joins_nested_query_fix($joins) { |
|
91 | + if ( ! is_array($joins)) { |
|
92 | 92 | return $joins; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Loop joins. |
96 | - foreach ( $joins as &$join ) { |
|
96 | + foreach ($joins as &$join) { |
|
97 | 97 | // Determine if fix needs to be applied. |
98 | - if ( ! strpos( $join, 'expiring_txn' ) && ! strpos( $join, 't2.subscription_id=sub.id' ) ) { |
|
98 | + if ( ! strpos($join, 'expiring_txn') && ! strpos($join, 't2.subscription_id=sub.id')) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | $join = str_replace( |
111 | 111 | ' AS t', |
112 | - sprintf( ' AS t, %s AS sub', $mepr_db->subscriptions ), |
|
112 | + sprintf(' AS t, %s AS sub', $mepr_db->subscriptions), |
|
113 | 113 | $join |
114 | 114 | ); |
115 | 115 | } |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return string |
129 | 129 | */ |
130 | - public static function redirect_url( $url, Payment $payment ) { |
|
130 | + public static function redirect_url($url, Payment $payment) { |
|
131 | 131 | global $transaction; |
132 | 132 | |
133 | 133 | $transaction_id = $payment->get_source_id(); |
134 | 134 | |
135 | - $transaction = new MeprTransaction( $transaction_id ); |
|
135 | + $transaction = new MeprTransaction($transaction_id); |
|
136 | 136 | |
137 | - switch ( $payment->get_status() ) { |
|
137 | + switch ($payment->get_status()) { |
|
138 | 138 | case Statuses::CANCELLED: |
139 | 139 | case Statuses::EXPIRED: |
140 | 140 | case Statuses::FAILURE: |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | array( |
145 | 145 | 'action' => 'payment_form', |
146 | 146 | 'txn' => $transaction->trans_num, |
147 | - '_wpnonce' => wp_create_nonce( 'mepr_payment_form' ), |
|
147 | + '_wpnonce' => wp_create_nonce('mepr_payment_form'), |
|
148 | 148 | ), |
149 | 149 | $product->url() |
150 | 150 | ); |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | // @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprOptions.php#L768-782 |
155 | 155 | $mepr_options = MeprOptions::fetch(); |
156 | 156 | |
157 | - $product = new MeprProduct( $transaction->product_id ); |
|
158 | - $sanitized_title = sanitize_title( $product->post_title ); |
|
157 | + $product = new MeprProduct($transaction->product_id); |
|
158 | + $sanitized_title = sanitize_title($product->post_title); |
|
159 | 159 | |
160 | 160 | $args = array( |
161 | 161 | 'membership_id' => $product->ID, |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'trans_num' => $transaction->trans_num, |
164 | 164 | ); |
165 | 165 | |
166 | - $url = $mepr_options->thankyou_page_url( http_build_query( $args ) ); |
|
166 | + $url = $mepr_options->thankyou_page_url(http_build_query($args)); |
|
167 | 167 | |
168 | 168 | break; |
169 | 169 | case Statuses::OPEN: |
@@ -181,26 +181,26 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @param Payment $payment The payment whose status is updated. |
183 | 183 | */ |
184 | - public static function status_update( Payment $payment ) { |
|
184 | + public static function status_update(Payment $payment) { |
|
185 | 185 | $transaction_id = $payment->get_source_id(); |
186 | 186 | |
187 | - $transaction = new MeprTransaction( $transaction_id ); |
|
187 | + $transaction = new MeprTransaction($transaction_id); |
|
188 | 188 | |
189 | - if ( $payment->get_recurring() ) { |
|
189 | + if ($payment->get_recurring()) { |
|
190 | 190 | $subscription = $transaction->subscription(); |
191 | 191 | |
192 | - if ( empty( $subscription ) || empty( $subscription->id ) ) { |
|
192 | + if (empty($subscription) || empty($subscription->id)) { |
|
193 | 193 | $subscription_id = $payment->get_subscription()->get_source_id(); |
194 | 194 | |
195 | - $subscription = new MeprSubscription( $subscription_id ); |
|
195 | + $subscription = new MeprSubscription($subscription_id); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // Same source ID and first transaction ID for recurring payment means we need to add a new transaction. |
199 | - if ( $payment->get_source_id() === $subscription->id ) { |
|
199 | + if ($payment->get_source_id() === $subscription->id) { |
|
200 | 200 | // First transaction. |
201 | 201 | $first_txn = $subscription->first_txn(); |
202 | 202 | |
203 | - if ( false === $first_txn || ! ( $first_txn instanceof MeprTransaction ) ) { |
|
203 | + if (false === $first_txn || ! ($first_txn instanceof MeprTransaction)) { |
|
204 | 204 | $first_txn = new MeprTransaction(); |
205 | 205 | $first_txn->user_id = $subscription->user_id; |
206 | 206 | $first_txn->product_id = $subscription->product_id; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | // Transaction number. |
212 | 212 | $trans_num = $payment->get_transaction_id(); |
213 | 213 | |
214 | - if ( empty( $trans_num ) ) { |
|
214 | + if (empty($trans_num)) { |
|
215 | 215 | $trans_num = uniqid(); |
216 | 216 | } |
217 | 217 | |
@@ -227,16 +227,16 @@ discard block |
||
227 | 227 | $transaction->status = MeprTransaction::$pending_str; |
228 | 228 | $transaction->subscription_id = $subscription->id; |
229 | 229 | |
230 | - $transaction->set_gross( $payment->get_amount()->get_amount() ); |
|
230 | + $transaction->set_gross($payment->get_amount()->get_amount()); |
|
231 | 231 | |
232 | 232 | $transaction->store(); |
233 | 233 | |
234 | 234 | // Set source ID. |
235 | - $payment->set_meta( 'source_id', $transaction->id ); |
|
235 | + $payment->set_meta('source_id', $transaction->id); |
|
236 | 236 | |
237 | 237 | $payment->source_id = $transaction->id; |
238 | 238 | |
239 | - if ( MeprSubscription::$active_str === $subscription->status ) { |
|
239 | + if (MeprSubscription::$active_str === $subscription->status) { |
|
240 | 240 | // New transaction and subscription confirmation. |
241 | 241 | $subscription_confirmation = new MeprTransaction(); |
242 | 242 | $subscription_confirmation->created_at = $payment->post->post_date_gmt; |
@@ -248,26 +248,26 @@ discard block |
||
248 | 248 | $subscription_confirmation->txn_type = MeprTransaction::$subscription_confirmation_str; |
249 | 249 | $subscription_confirmation->status = MeprTransaction::$confirmed_str; |
250 | 250 | $subscription_confirmation->subscription_id = $subscription->id; |
251 | - $subscription_confirmation->expires_at = MeprUtils::ts_to_mysql_date( strtotime( $payment->post->post_date_gmt ) + MeprUtils::days( 15 ), 'Y-m-d 23:59:59' ); |
|
251 | + $subscription_confirmation->expires_at = MeprUtils::ts_to_mysql_date(strtotime($payment->post->post_date_gmt) + MeprUtils::days(15), 'Y-m-d 23:59:59'); |
|
252 | 252 | |
253 | - $subscription_confirmation->set_subtotal( 0.00 ); |
|
253 | + $subscription_confirmation->set_subtotal(0.00); |
|
254 | 254 | |
255 | 255 | $subscription_confirmation->store(); |
256 | 256 | } |
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
260 | - $should_update = ! MemberPress::transaction_has_status( $transaction, array( |
|
260 | + $should_update = ! MemberPress::transaction_has_status($transaction, array( |
|
261 | 261 | MeprTransaction::$failed_str, |
262 | 262 | MeprTransaction::$complete_str, |
263 | - ) ); |
|
263 | + )); |
|
264 | 264 | |
265 | - if ( $should_update ) { |
|
265 | + if ($should_update) { |
|
266 | 266 | $gateway = new Gateway(); |
267 | 267 | |
268 | 268 | $gateway->mp_txn = $transaction; |
269 | 269 | |
270 | - switch ( $payment->get_status() ) { |
|
270 | + switch ($payment->get_status()) { |
|
271 | 271 | case Statuses::CANCELLED: |
272 | 272 | case Statuses::EXPIRED: |
273 | 273 | case Statuses::FAILURE: |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | break; |
277 | 277 | case Statuses::SUCCESS: |
278 | - if ( $payment->get_recurring() ) { |
|
278 | + if ($payment->get_recurring()) { |
|
279 | 279 | $gateway->record_subscription_payment(); |
280 | 280 | } else { |
281 | 281 | $gateway->record_payment(); |
@@ -294,25 +294,25 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @param int $subscription_id MemberPress subscription id. |
296 | 296 | */ |
297 | - public function subscription_pre_delete( $subscription_id ) { |
|
298 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $subscription_id ); |
|
297 | + public function subscription_pre_delete($subscription_id) { |
|
298 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $subscription_id); |
|
299 | 299 | |
300 | - if ( ! $subscription ) { |
|
300 | + if ( ! $subscription) { |
|
301 | 301 | return; |
302 | 302 | } |
303 | 303 | |
304 | 304 | // Add note. |
305 | 305 | $note = sprintf( |
306 | 306 | /* translators: %s: MemberPress */ |
307 | - __( '%s subscription deleted.', 'pronamic_ideal' ), |
|
308 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
307 | + __('%s subscription deleted.', 'pronamic_ideal'), |
|
308 | + __('MemberPress', 'pronamic_ideal') |
|
309 | 309 | ); |
310 | 310 | |
311 | - $subscription->add_note( $note ); |
|
311 | + $subscription->add_note($note); |
|
312 | 312 | |
313 | 313 | // The status of canceled or completed subscriptions will not be changed automatically. |
314 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
315 | - $subscription->set_status( Statuses::CANCELLED ); |
|
314 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
315 | + $subscription->set_status(Statuses::CANCELLED); |
|
316 | 316 | |
317 | 317 | $subscription->save(); |
318 | 318 | } |
@@ -326,18 +326,18 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @return string |
328 | 328 | */ |
329 | - public static function source_text( $text, Payment $payment ) { |
|
330 | - $text = __( 'MemberPress', 'pronamic_ideal' ) . '<br />'; |
|
329 | + public static function source_text($text, Payment $payment) { |
|
330 | + $text = __('MemberPress', 'pronamic_ideal') . '<br />'; |
|
331 | 331 | |
332 | 332 | $text .= sprintf( |
333 | 333 | '<a href="%s">%s</a>', |
334 | - add_query_arg( array( |
|
334 | + add_query_arg(array( |
|
335 | 335 | 'page' => 'memberpress-trans', |
336 | 336 | 'action' => 'edit', |
337 | 337 | 'id' => $payment->source_id, |
338 | - ), admin_url( 'admin.php' ) ), |
|
338 | + ), admin_url('admin.php')), |
|
339 | 339 | /* translators: %s: payment source id */ |
340 | - sprintf( __( 'Transaction %s', 'pronamic_ideal' ), $payment->source_id ) |
|
340 | + sprintf(__('Transaction %s', 'pronamic_ideal'), $payment->source_id) |
|
341 | 341 | ); |
342 | 342 | |
343 | 343 | return $text; |
@@ -351,17 +351,17 @@ discard block |
||
351 | 351 | * |
352 | 352 | * @return string |
353 | 353 | */ |
354 | - public static function subscription_source_text( $text, Subscription $subscription ) { |
|
355 | - $text = __( 'MemberPress', 'pronamic_ideal' ) . '<br />'; |
|
354 | + public static function subscription_source_text($text, Subscription $subscription) { |
|
355 | + $text = __('MemberPress', 'pronamic_ideal') . '<br />'; |
|
356 | 356 | |
357 | 357 | $text .= sprintf( |
358 | 358 | '<a href="%s">%s</a>', |
359 | - add_query_arg( array( |
|
359 | + add_query_arg(array( |
|
360 | 360 | 'page' => 'memberpress-subscriptions', |
361 | 361 | 'subscription' => $subscription->source_id, |
362 | - ), admin_url( 'admin.php' ) ), |
|
362 | + ), admin_url('admin.php')), |
|
363 | 363 | /* translators: %s: payment source id */ |
364 | - sprintf( __( 'Subscription %s', 'pronamic_ideal' ), $subscription->source_id ) |
|
364 | + sprintf(__('Subscription %s', 'pronamic_ideal'), $subscription->source_id) |
|
365 | 365 | ); |
366 | 366 | |
367 | 367 | return $text; |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | * |
376 | 376 | * @return string |
377 | 377 | */ |
378 | - public static function source_description( $description, Payment $payment ) { |
|
379 | - return __( 'MemberPress Transaction', 'pronamic_ideal' ); |
|
378 | + public static function source_description($description, Payment $payment) { |
|
379 | + return __('MemberPress Transaction', 'pronamic_ideal'); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | * |
388 | 388 | * @return string |
389 | 389 | */ |
390 | - public static function subscription_source_description( $description, Subscription $subscription ) { |
|
391 | - return __( 'MemberPress Subscription', 'pronamic_ideal' ); |
|
390 | + public static function subscription_source_description($description, Subscription $subscription) { |
|
391 | + return __('MemberPress Subscription', 'pronamic_ideal'); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -399,12 +399,12 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return string |
401 | 401 | */ |
402 | - public static function source_url( $url, Payment $payment ) { |
|
403 | - $url = add_query_arg( array( |
|
402 | + public static function source_url($url, Payment $payment) { |
|
403 | + $url = add_query_arg(array( |
|
404 | 404 | 'page' => 'memberpress-trans', |
405 | 405 | 'action' => 'edit', |
406 | 406 | 'id' => $payment->source_id, |
407 | - ), admin_url( 'admin.php' ) ); |
|
407 | + ), admin_url('admin.php')); |
|
408 | 408 | |
409 | 409 | return $url; |
410 | 410 | } |
@@ -417,11 +417,11 @@ discard block |
||
417 | 417 | * |
418 | 418 | * @return string |
419 | 419 | */ |
420 | - public static function subscription_source_url( $url, Subscription $subscription ) { |
|
421 | - $url = add_query_arg( array( |
|
420 | + public static function subscription_source_url($url, Subscription $subscription) { |
|
421 | + $url = add_query_arg(array( |
|
422 | 422 | 'page' => 'memberpress-subscriptions', |
423 | 423 | 'subscription' => $subscription->source_id, |
424 | - ), admin_url( 'admin.php' ) ); |
|
424 | + ), admin_url('admin.php')); |
|
425 | 425 | |
426 | 426 | return $url; |
427 | 427 | } |
@@ -437,16 +437,16 @@ discard block |
||
437 | 437 | * @param string $status_new New status identifier. |
438 | 438 | * @param MeprSubscription $memberpress_subscription MemberPress subscription object. |
439 | 439 | */ |
440 | - public function memberpress_subscription_transition_status( $status_old, $status_new, $memberpress_subscription ) { |
|
441 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $memberpress_subscription->id ); |
|
440 | + public function memberpress_subscription_transition_status($status_old, $status_new, $memberpress_subscription) { |
|
441 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $memberpress_subscription->id); |
|
442 | 442 | |
443 | - if ( empty( $subscription ) ) { |
|
443 | + if (empty($subscription)) { |
|
444 | 444 | return; |
445 | 445 | } |
446 | 446 | |
447 | - $status = SubscriptionStatuses::transform( $status_new ); |
|
447 | + $status = SubscriptionStatuses::transform($status_new); |
|
448 | 448 | |
449 | - $subscription->set_status( $status ); |
|
449 | + $subscription->set_status($status); |
|
450 | 450 | |
451 | 451 | $subscription->save(); |
452 | 452 | } |