@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | |
57 | 57 | // Set the name of this gateway. |
58 | 58 | // @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L12-13. |
59 | - $this->name = __( 'Pronamic', 'pronamic_ideal' ); |
|
59 | + $this->name = __('Pronamic', 'pronamic_ideal'); |
|
60 | 60 | |
61 | - if ( ! empty( $this->payment_method ) ) { |
|
62 | - $this->name = PaymentMethods::get_name( $this->payment_method ); |
|
61 | + if ( ! empty($this->payment_method)) { |
|
62 | + $this->name = PaymentMethods::get_name($this->payment_method); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Set the default settings. |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @param array $settings MemberPress gateway settings array. |
83 | 83 | */ |
84 | - public function load( $settings ) { |
|
84 | + public function load($settings) { |
|
85 | 85 | $this->settings = (object) $settings; |
86 | 86 | |
87 | 87 | $this->set_defaults(); |
@@ -98,19 +98,19 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return mixed |
100 | 100 | */ |
101 | - public function send_transaction_notices( $transaction, $method ) { |
|
101 | + public function send_transaction_notices($transaction, $method) { |
|
102 | 102 | $class = 'MeprUtils'; |
103 | 103 | |
104 | - if ( ! Core_Util::class_method_exists( $class, $method ) ) { |
|
104 | + if ( ! Core_Util::class_method_exists($class, $method)) { |
|
105 | 105 | $class = $this; |
106 | 106 | } |
107 | 107 | |
108 | - if ( 'MeprUtils' === $class && 'send_product_welcome_notices' === $method ) { |
|
108 | + if ('MeprUtils' === $class && 'send_product_welcome_notices' === $method) { |
|
109 | 109 | // `send_product_welcome_notices` is called from `send_signup_notices` in newer versions. |
110 | 110 | return; |
111 | 111 | } |
112 | 112 | |
113 | - return call_user_func( array( $class, $method ), $transaction ); |
|
113 | + return call_user_func(array($class, $method), $transaction); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L72-73 |
139 | 139 | */ |
140 | 140 | protected function set_defaults() { |
141 | - if ( ! isset( $this->settings ) ) { |
|
141 | + if ( ! isset($this->settings)) { |
|
142 | 142 | $this->settings = array(); |
143 | 143 | } |
144 | 144 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L119-122 |
178 | 178 | */ |
179 | - public function process_payment( $txn ) { |
|
179 | + public function process_payment($txn) { |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | |
196 | 196 | $subscription = $transaction->subscription(); |
197 | 197 | |
198 | - if ( $subscription ) { |
|
199 | - if ( MeprSubscription::$active_str !== $subscription->status ) { |
|
198 | + if ($subscription) { |
|
199 | + if (MeprSubscription::$active_str !== $subscription->status) { |
|
200 | 200 | $subscription->status = MeprSubscription::$active_str; |
201 | 201 | $subscription->store(); |
202 | 202 | } |
@@ -204,17 +204,17 @@ discard block |
||
204 | 204 | // Expire subscription confirmations. |
205 | 205 | $mepr_db = new MeprDb(); |
206 | 206 | |
207 | - $wpdb->query( $wpdb->prepare( |
|
207 | + $wpdb->query($wpdb->prepare( |
|
208 | 208 | 'UPDATE %s SET expires_at = created_at WHERE subscription_id = %d AND txn_type = %s', |
209 | 209 | $mepr_db->transactions, |
210 | 210 | $subscription->id, |
211 | 211 | MeprTransaction::$subscription_confirmation_str |
212 | - ) ); |
|
212 | + )); |
|
213 | 213 | |
214 | 214 | $subscription->limit_payment_cycles(); |
215 | 215 | } |
216 | 216 | |
217 | - $this->send_transaction_notices( $transaction, 'send_transaction_receipt_notices' ); |
|
217 | + $this->send_transaction_notices($transaction, 'send_transaction_receipt_notices'); |
|
218 | 218 | |
219 | 219 | return $transaction; |
220 | 220 | } |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | // Expire associated transactions for subscription. |
235 | 235 | $subscription = $transaction->subscription(); |
236 | 236 | |
237 | - if ( $subscription ) { |
|
237 | + if ($subscription) { |
|
238 | 238 | $subscription->expire_txns(); |
239 | 239 | $subscription->store(); |
240 | 240 | } |
241 | 241 | |
242 | - $this->send_transaction_notices( $transaction, 'send_failed_txn_notices' ); |
|
242 | + $this->send_transaction_notices($transaction, 'send_failed_txn_notices'); |
|
243 | 243 | |
244 | 244 | return $transaction; |
245 | 245 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | |
264 | 264 | $subscription = $transaction->subscription(); |
265 | 265 | |
266 | - if ( $subscription ) { |
|
266 | + if ($subscription) { |
|
267 | 267 | $subscription->status = MeprSubscription::$active_str; |
268 | 268 | $subscription->created_at = $transaction->created_at; |
269 | 269 | $subscription->store(); |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | * @see https://github.com/wp-premium/memberpress-business/blob/1.2.7/app/lib/MeprBaseGateway.php#L609-L619 |
278 | 278 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprTransaction.php#L51 |
279 | 279 | */ |
280 | - $reflection = new ReflectionClass( 'MeprBaseRealGateway' ); |
|
280 | + $reflection = new ReflectionClass('MeprBaseRealGateway'); |
|
281 | 281 | |
282 | - if ( $reflection->hasMethod( 'send_product_welcome_notices' ) && 3 === $reflection->getMethod( 'send_product_welcome_notices' )->getNumberOfParameters() ) { |
|
282 | + if ($reflection->hasMethod('send_product_welcome_notices') && 3 === $reflection->getMethod('send_product_welcome_notices')->getNumberOfParameters()) { |
|
283 | 283 | $uemail = MeprEmailFactory::fetch( |
284 | 284 | 'MeprUserProductWelcomeEmail', |
285 | 285 | 'MeprBaseProductEmail', |
@@ -297,24 +297,24 @@ discard block |
||
297 | 297 | */ |
298 | 298 | $this->send_product_welcome_notices( |
299 | 299 | $uemail, |
300 | - MeprTransactionsHelper::get_email_params( $transaction ), |
|
300 | + MeprTransactionsHelper::get_email_params($transaction), |
|
301 | 301 | $transaction->user() |
302 | 302 | ); |
303 | 303 | } else { |
304 | - $this->send_transaction_notices( $transaction, 'send_product_welcome_notices' ); |
|
304 | + $this->send_transaction_notices($transaction, 'send_product_welcome_notices'); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | // Send upgrade/downgrade notices. |
308 | - if ( $upgrade ) { |
|
309 | - $this->upgraded_sub( $transaction ); |
|
310 | - $this->send_transaction_notices( $transaction, 'send_upgraded_txn_notices' ); |
|
311 | - } elseif ( $downgrade ) { |
|
312 | - $this->downgraded_sub( $transaction ); |
|
313 | - $this->send_transaction_notices( $transaction, 'send_downgraded_txn_notices' ); |
|
308 | + if ($upgrade) { |
|
309 | + $this->upgraded_sub($transaction); |
|
310 | + $this->send_transaction_notices($transaction, 'send_upgraded_txn_notices'); |
|
311 | + } elseif ($downgrade) { |
|
312 | + $this->downgraded_sub($transaction); |
|
313 | + $this->send_transaction_notices($transaction, 'send_downgraded_txn_notices'); |
|
314 | 314 | } |
315 | 315 | |
316 | - $this->send_transaction_notices( $transaction, 'send_signup_notices' ); |
|
317 | - $this->send_transaction_notices( $transaction, 'send_transaction_receipt_notices' ); |
|
316 | + $this->send_transaction_notices($transaction, 'send_signup_notices'); |
|
317 | + $this->send_transaction_notices($transaction, 'send_transaction_receipt_notices'); |
|
318 | 318 | |
319 | 319 | return $transaction; |
320 | 320 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L131-133 |
328 | 328 | */ |
329 | - public function process_refund( MeprTransaction $txn ) { |
|
329 | + public function process_refund(MeprTransaction $txn) { |
|
330 | 330 | |
331 | 331 | } |
332 | 332 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @param MeprTransaction $transaction MemberPress transaction object. |
348 | 348 | */ |
349 | - public function process_trial_payment( $transaction ) { |
|
349 | + public function process_trial_payment($transaction) { |
|
350 | 350 | |
351 | 351 | } |
352 | 352 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @param MeprTransaction $transaction MemberPress transaction object. |
359 | 359 | */ |
360 | - public function record_trial_payment( $transaction ) { |
|
360 | + public function record_trial_payment($transaction) { |
|
361 | 361 | |
362 | 362 | } |
363 | 363 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @param MeprTransaction $txn MemberPress transaction object. |
370 | 370 | */ |
371 | - public function process_create_subscription( $txn ) { |
|
371 | + public function process_create_subscription($txn) { |
|
372 | 372 | |
373 | 373 | } |
374 | 374 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @param int $sub_id Subscription ID. |
391 | 391 | */ |
392 | - public function process_update_subscription( $sub_id ) { |
|
392 | + public function process_update_subscription($sub_id) { |
|
393 | 393 | |
394 | 394 | } |
395 | 395 | |
@@ -409,21 +409,21 @@ discard block |
||
409 | 409 | * |
410 | 410 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L184-186 |
411 | 411 | */ |
412 | - public function process_suspend_subscription( $sub_id ) { |
|
413 | - if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
412 | + public function process_suspend_subscription($sub_id) { |
|
413 | + if ( ! MeprSubscription::exists($sub_id)) { |
|
414 | 414 | return; |
415 | 415 | } |
416 | 416 | |
417 | - $sub = new MeprSubscription( $sub_id ); |
|
417 | + $sub = new MeprSubscription($sub_id); |
|
418 | 418 | |
419 | - if ( MeprSubscription::$suspended_str === $sub->status ) { |
|
419 | + if (MeprSubscription::$suspended_str === $sub->status) { |
|
420 | 420 | // Subscription is already suspended. |
421 | 421 | return; |
422 | 422 | } |
423 | 423 | |
424 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->id ); |
|
424 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $sub->id); |
|
425 | 425 | |
426 | - if ( ! $subscription ) { |
|
426 | + if ( ! $subscription) { |
|
427 | 427 | return; |
428 | 428 | } |
429 | 429 | |
@@ -432,19 +432,19 @@ discard block |
||
432 | 432 | $sub->store(); |
433 | 433 | |
434 | 434 | // Send suspended subscription notices. |
435 | - MeprUtils::send_suspended_sub_notices( $sub ); |
|
435 | + MeprUtils::send_suspended_sub_notices($sub); |
|
436 | 436 | |
437 | 437 | $note = sprintf( |
438 | 438 | /* translators: %s: MemberPress */ |
439 | - __( '%s subscription on hold.', 'pronamic_ideal' ), |
|
440 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
439 | + __('%s subscription on hold.', 'pronamic_ideal'), |
|
440 | + __('MemberPress', 'pronamic_ideal') |
|
441 | 441 | ); |
442 | 442 | |
443 | - $subscription->add_note( $note ); |
|
443 | + $subscription->add_note($note); |
|
444 | 444 | |
445 | 445 | // The status of canceled or completed subscriptions will not be changed automatically. |
446 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
447 | - $subscription->set_status( Statuses::OPEN ); |
|
446 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
447 | + $subscription->set_status(Statuses::OPEN); |
|
448 | 448 | |
449 | 449 | $subscription->save(); |
450 | 450 | } |
@@ -466,21 +466,21 @@ discard block |
||
466 | 466 | * |
467 | 467 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L193-195 |
468 | 468 | */ |
469 | - public function process_resume_subscription( $sub_id ) { |
|
470 | - if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
469 | + public function process_resume_subscription($sub_id) { |
|
470 | + if ( ! MeprSubscription::exists($sub_id)) { |
|
471 | 471 | return; |
472 | 472 | } |
473 | 473 | |
474 | - $sub = new MeprSubscription( $sub_id ); |
|
474 | + $sub = new MeprSubscription($sub_id); |
|
475 | 475 | |
476 | - if ( MeprSubscription::$active_str === $sub->status ) { |
|
476 | + if (MeprSubscription::$active_str === $sub->status) { |
|
477 | 477 | // Subscription is already active. |
478 | 478 | return; |
479 | 479 | } |
480 | 480 | |
481 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->id ); |
|
481 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $sub->id); |
|
482 | 482 | |
483 | - if ( ! $subscription ) { |
|
483 | + if ( ! $subscription) { |
|
484 | 484 | return; |
485 | 485 | } |
486 | 486 | |
@@ -491,35 +491,35 @@ discard block |
||
491 | 491 | // Check if prior txn is expired yet or not, if so create a temporary txn so the user can access the content immediately. |
492 | 492 | $prior_txn = $sub->latest_txn(); |
493 | 493 | |
494 | - if ( false === $prior_txn || ! ( $prior_txn instanceof MeprTransaction ) || strtotime( $prior_txn->expires_at ) < time() ) { |
|
494 | + if (false === $prior_txn || ! ($prior_txn instanceof MeprTransaction) || strtotime($prior_txn->expires_at) < time()) { |
|
495 | 495 | $txn = new MeprTransaction(); |
496 | 496 | $txn->subscription_id = $sub->id; |
497 | 497 | $txn->trans_num = $sub->subscr_id . '-' . uniqid(); |
498 | 498 | $txn->status = MeprTransaction::$confirmed_str; |
499 | 499 | $txn->txn_type = MeprTransaction::$subscription_confirmation_str; |
500 | 500 | $txn->response = (string) $sub; |
501 | - $txn->expires_at = MeprUtils::ts_to_mysql_date( time() + MeprUtils::days( 1 ), 'Y-m-d 23:59:59' ); |
|
501 | + $txn->expires_at = MeprUtils::ts_to_mysql_date(time() + MeprUtils::days(1), 'Y-m-d 23:59:59'); |
|
502 | 502 | |
503 | - $txn->set_subtotal( 0.00 ); // Just a confirmation txn. |
|
503 | + $txn->set_subtotal(0.00); // Just a confirmation txn. |
|
504 | 504 | |
505 | 505 | $txn->store(); |
506 | 506 | } |
507 | 507 | |
508 | 508 | // Send resumed subscription notices. |
509 | - MeprUtils::send_resumed_sub_notices( $sub ); |
|
509 | + MeprUtils::send_resumed_sub_notices($sub); |
|
510 | 510 | |
511 | 511 | // Add note. |
512 | 512 | $note = sprintf( |
513 | 513 | /* translators: %s: MemberPress */ |
514 | - __( '%s subscription reactivated.', 'pronamic_ideal' ), |
|
515 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
514 | + __('%s subscription reactivated.', 'pronamic_ideal'), |
|
515 | + __('MemberPress', 'pronamic_ideal') |
|
516 | 516 | ); |
517 | 517 | |
518 | - $subscription->add_note( $note ); |
|
518 | + $subscription->add_note($note); |
|
519 | 519 | |
520 | 520 | // The status of canceled or completed subscriptions will not be changed automatically. |
521 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
522 | - $subscription->set_status( Statuses::ACTIVE ); |
|
521 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
522 | + $subscription->set_status(Statuses::ACTIVE); |
|
523 | 523 | |
524 | 524 | $subscription->save(); |
525 | 525 | } |
@@ -541,21 +541,21 @@ discard block |
||
541 | 541 | * |
542 | 542 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L202-206 |
543 | 543 | */ |
544 | - public function process_cancel_subscription( $sub_id ) { |
|
545 | - if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
544 | + public function process_cancel_subscription($sub_id) { |
|
545 | + if ( ! MeprSubscription::exists($sub_id)) { |
|
546 | 546 | return; |
547 | 547 | } |
548 | 548 | |
549 | - $sub = new MeprSubscription( $sub_id ); |
|
549 | + $sub = new MeprSubscription($sub_id); |
|
550 | 550 | |
551 | - if ( MeprSubscription::$cancelled_str === $sub->status ) { |
|
551 | + if (MeprSubscription::$cancelled_str === $sub->status) { |
|
552 | 552 | // Subscription is already cancelled. |
553 | 553 | return; |
554 | 554 | } |
555 | 555 | |
556 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->id ); |
|
556 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $sub->id); |
|
557 | 557 | |
558 | - if ( ! $subscription ) { |
|
558 | + if ( ! $subscription) { |
|
559 | 559 | return; |
560 | 560 | } |
561 | 561 | |
@@ -564,27 +564,27 @@ discard block |
||
564 | 564 | $sub->store(); |
565 | 565 | |
566 | 566 | // Expire the grace period (confirmation) if no completed payments have come through. |
567 | - if ( (int) $sub->txn_count <= 0 ) { |
|
567 | + if ((int) $sub->txn_count <= 0) { |
|
568 | 568 | $sub->expire_txns(); |
569 | 569 | } |
570 | 570 | |
571 | 571 | $sub->limit_reached_actions(); |
572 | 572 | |
573 | 573 | // Send cancelled subscription notices. |
574 | - MeprUtils::send_cancelled_sub_notices( $sub ); |
|
574 | + MeprUtils::send_cancelled_sub_notices($sub); |
|
575 | 575 | |
576 | 576 | // Add note. |
577 | 577 | $note = sprintf( |
578 | 578 | /* translators: %s: MemberPress */ |
579 | - __( '%s subscription cancelled.', 'pronamic_ideal' ), |
|
580 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
579 | + __('%s subscription cancelled.', 'pronamic_ideal'), |
|
580 | + __('MemberPress', 'pronamic_ideal') |
|
581 | 581 | ); |
582 | 582 | |
583 | - $subscription->add_note( $note ); |
|
583 | + $subscription->add_note($note); |
|
584 | 584 | |
585 | 585 | // The status of canceled or completed subscriptions will not be changed automatically. |
586 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
587 | - $subscription->set_status( Statuses::CANCELLED ); |
|
586 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
587 | + $subscription->set_status(Statuses::CANCELLED); |
|
588 | 588 | |
589 | 589 | $subscription->save(); |
590 | 590 | } |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * |
612 | 612 | * @param MeprTransaction $txn MemberPress transaction object. |
613 | 613 | */ |
614 | - public function process_signup_form( $txn ) { |
|
614 | + public function process_signup_form($txn) { |
|
615 | 615 | |
616 | 616 | } |
617 | 617 | |
@@ -622,28 +622,28 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @param MeprTransaction $txn MemberPress transaction object. |
624 | 624 | */ |
625 | - public function payment_redirect( $txn ) { |
|
626 | - $txn = new MeprTransaction( $txn->id ); |
|
625 | + public function payment_redirect($txn) { |
|
626 | + $txn = new MeprTransaction($txn->id); |
|
627 | 627 | |
628 | 628 | // Gateway. |
629 | 629 | $config_id = $this->settings->config_id; |
630 | 630 | |
631 | - $gateway = Plugin::get_gateway( $config_id ); |
|
631 | + $gateway = Plugin::get_gateway($config_id); |
|
632 | 632 | |
633 | - if ( ! $gateway ) { |
|
633 | + if ( ! $gateway) { |
|
634 | 634 | return; |
635 | 635 | } |
636 | 636 | |
637 | 637 | // Data. |
638 | - $data = new PaymentData( $txn, $this ); |
|
638 | + $data = new PaymentData($txn, $this); |
|
639 | 639 | |
640 | - $payment = Plugin::start( $config_id, $gateway, $data, $this->payment_method ); |
|
640 | + $payment = Plugin::start($config_id, $gateway, $data, $this->payment_method); |
|
641 | 641 | |
642 | 642 | $error = $gateway->get_error(); |
643 | 643 | |
644 | - if ( ! is_wp_error( $error ) ) { |
|
644 | + if ( ! is_wp_error($error)) { |
|
645 | 645 | // Redirect. |
646 | - $gateway->redirect( $payment ); |
|
646 | + $gateway->redirect($payment); |
|
647 | 647 | } |
648 | 648 | } |
649 | 649 | |
@@ -656,14 +656,14 @@ discard block |
||
656 | 656 | * |
657 | 657 | * @param MeprTransaction $txn MemberPress transaction object. |
658 | 658 | */ |
659 | - public function display_payment_page( $txn ) { |
|
659 | + public function display_payment_page($txn) { |
|
660 | 660 | // Gateway. |
661 | 661 | $config_id = $this->settings->config_id; |
662 | 662 | |
663 | - $gateway = Plugin::get_gateway( $config_id ); |
|
663 | + $gateway = Plugin::get_gateway($config_id); |
|
664 | 664 | |
665 | - if ( $gateway && '' === $gateway->get_input_html() ) { |
|
666 | - $this->payment_redirect( $txn ); |
|
665 | + if ($gateway && '' === $gateway->get_input_html()) { |
|
666 | + $this->payment_redirect($txn); |
|
667 | 667 | } |
668 | 668 | } |
669 | 669 | |
@@ -677,18 +677,18 @@ discard block |
||
677 | 677 | * @param MeprTransaction $txn MemberPress transaction object. |
678 | 678 | * @return bool |
679 | 679 | */ |
680 | - public function process_payment_form( $txn ) { |
|
681 | - if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_memberpress_pay' ) ) { |
|
680 | + public function process_payment_form($txn) { |
|
681 | + if ( ! filter_has_var(INPUT_POST, 'pronamic_pay_memberpress_pay')) { |
|
682 | 682 | return false; |
683 | 683 | } |
684 | 684 | |
685 | 685 | // Gateway. |
686 | 686 | $config_id = $this->settings->config_id; |
687 | 687 | |
688 | - $gateway = Plugin::get_gateway( $config_id ); |
|
688 | + $gateway = Plugin::get_gateway($config_id); |
|
689 | 689 | |
690 | - if ( $gateway ) { |
|
691 | - $this->payment_redirect( $txn ); |
|
690 | + if ($gateway) { |
|
691 | + $this->payment_redirect($txn); |
|
692 | 692 | } |
693 | 693 | } |
694 | 694 | |
@@ -716,20 +716,20 @@ discard block |
||
716 | 716 | * @param int $product_id Product ID. |
717 | 717 | * @param int $txn_id Transaction ID. |
718 | 718 | */ |
719 | - public function display_payment_form( $amount, $user, $product_id, $txn_id ) { |
|
720 | - $product = new MeprProduct( $product_id ); |
|
719 | + public function display_payment_form($amount, $user, $product_id, $txn_id) { |
|
720 | + $product = new MeprProduct($product_id); |
|
721 | 721 | |
722 | 722 | $coupon = false; |
723 | 723 | |
724 | - $txn = new MeprTransaction( $txn_id ); |
|
724 | + $txn = new MeprTransaction($txn_id); |
|
725 | 725 | |
726 | 726 | // Artifically set the price of the $prd in case a coupon was used. |
727 | - if ( $product->price !== $amount ) { |
|
727 | + if ($product->price !== $amount) { |
|
728 | 728 | $coupon = true; |
729 | 729 | $product->price = $amount; |
730 | 730 | } |
731 | 731 | |
732 | - $invoice = MeprTransactionsHelper::get_invoice( $txn ); |
|
732 | + $invoice = MeprTransactionsHelper::get_invoice($txn); |
|
733 | 733 | |
734 | 734 | echo $invoice; // WPCS: XSS ok. |
735 | 735 | |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | <div class="mp_wrapper mp_payment_form_wrapper"> |
738 | 738 | <form action="" method="post" id="payment-form" class="mepr-form" novalidate> |
739 | 739 | <input type="hidden" name="mepr_process_payment_form" value="Y"/> |
740 | - <input type="hidden" name="mepr_transaction_id" value="<?php echo esc_attr( $txn_id ); ?>"/> |
|
740 | + <input type="hidden" name="mepr_transaction_id" value="<?php echo esc_attr($txn_id); ?>"/> |
|
741 | 741 | <input type="hidden" name="pronamic_pay_memberpress_pay" value="1"/> |
742 | 742 | |
743 | 743 | <div class="mepr_spacer"> </div> |
@@ -747,9 +747,9 @@ discard block |
||
747 | 747 | // Gateway. |
748 | 748 | $config_id = $this->settings->config_id; |
749 | 749 | |
750 | - $gateway = Plugin::get_gateway( $config_id ); |
|
750 | + $gateway = Plugin::get_gateway($config_id); |
|
751 | 751 | |
752 | - if ( $gateway ) { |
|
752 | + if ($gateway) { |
|
753 | 753 | echo $gateway->get_input_html(); // WPCS: XSS ok. |
754 | 754 | } |
755 | 755 | |
@@ -757,13 +757,13 @@ discard block |
||
757 | 757 | |
758 | 758 | <div class="mepr_spacer"> </div> |
759 | 759 | |
760 | - <input type="submit" class="mepr-submit" value="<?php esc_attr_e( 'Pay', 'pronamic_ideal' ); ?>"/> |
|
761 | - <img src="<?php echo esc_attr( admin_url( 'images/loading.gif' ) ); ?>" style="display: none;" class="mepr-loading-gif"/> |
|
762 | - <?php MeprView::render( '/shared/has_errors', get_defined_vars() ); ?> |
|
760 | + <input type="submit" class="mepr-submit" value="<?php esc_attr_e('Pay', 'pronamic_ideal'); ?>"/> |
|
761 | + <img src="<?php echo esc_attr(admin_url('images/loading.gif')); ?>" style="display: none;" class="mepr-loading-gif"/> |
|
762 | + <?php MeprView::render('/shared/has_errors', get_defined_vars()); ?> |
|
763 | 763 | |
764 | 764 | <noscript> |
765 | 765 | <p class="mepr_nojs"> |
766 | - <?php esc_html_e( 'JavaScript is disabled in your browser. You will not be able to complete your purchase until you either enable JavaScript in your browser, or switch to a browser that supports it.', 'pronamic_ideal' ); ?> |
|
766 | + <?php esc_html_e('JavaScript is disabled in your browser. You will not be able to complete your purchase until you either enable JavaScript in your browser, or switch to a browser that supports it.', 'pronamic_ideal'); ?> |
|
767 | 767 | </p> |
768 | 768 | </noscript> |
769 | 769 | </form> |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * @param array $errors Array with errors. |
782 | 782 | * @return array |
783 | 783 | */ |
784 | - public function validate_payment_form( $errors ) { |
|
784 | + public function validate_payment_form($errors) { |
|
785 | 785 | return $errors; |
786 | 786 | } |
787 | 787 | |
@@ -808,18 +808,18 @@ discard block |
||
808 | 808 | |
809 | 809 | ?> |
810 | 810 | <td> |
811 | - <?php esc_html_e( 'Configuration', 'pronamic_ideal' ); ?> |
|
811 | + <?php esc_html_e('Configuration', 'pronamic_ideal'); ?> |
|
812 | 812 | </td> |
813 | 813 | <td> |
814 | - <select name="<?php echo esc_attr( $name ); ?>"> |
|
814 | + <select name="<?php echo esc_attr($name); ?>"> |
|
815 | 815 | <?php |
816 | 816 | |
817 | - foreach ( Plugin::get_config_select_options( $this->payment_method ) as $value => $label ) { |
|
817 | + foreach (Plugin::get_config_select_options($this->payment_method) as $value => $label) { |
|
818 | 818 | printf( |
819 | 819 | '<option value="%s" %s>%s</option>', |
820 | - esc_attr( $value ), |
|
821 | - selected( $value, $this->settings->config_id, false ), |
|
822 | - esc_html( $label ) |
|
820 | + esc_attr($value), |
|
821 | + selected($value, $this->settings->config_id, false), |
|
822 | + esc_html($label) |
|
823 | 823 | ); |
824 | 824 | } |
825 | 825 | |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | * @param array $errors Array with errors. |
842 | 842 | * @return array |
843 | 843 | */ |
844 | - public function validate_options_form( $errors ) { |
|
844 | + public function validate_options_form($errors) { |
|
845 | 845 | return $errors; |
846 | 846 | } |
847 | 847 | |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | * @see https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprStripeGateway.php#L1108-L1168 |
867 | 867 | * @see https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprAccountCtrl.php#L388 |
868 | 868 | */ |
869 | - public function display_update_account_form( $sub_id, $errors = array(), $message = '' ) { |
|
869 | + public function display_update_account_form($sub_id, $errors = array(), $message = '') { |
|
870 | 870 | |
871 | 871 | } |
872 | 872 | |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | * @param array $errors Array with errors. |
880 | 880 | * @return array |
881 | 881 | */ |
882 | - public function validate_update_account_form( $errors = array() ) { |
|
882 | + public function validate_update_account_form($errors = array()) { |
|
883 | 883 | return $errors; |
884 | 884 | } |
885 | 885 | |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | * |
892 | 892 | * @param int $sub_id Subscription ID. |
893 | 893 | */ |
894 | - public function process_update_account_form( $sub_id ) { |
|
894 | + public function process_update_account_form($sub_id) { |
|
895 | 895 | |
896 | 896 | } |
897 | 897 |