@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class_alias( 'Pronamic\WordPress\Pay\Extensions\MemberPress\SofortGateway', 'MeprSofortGateway' ); |
|
| 3 | +class_alias('Pronamic\WordPress\Pay\Extensions\MemberPress\SofortGateway', 'MeprSofortGateway'); |
|
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | // Set the name of this gateway. |
| 51 | 51 | // @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L12-13 |
| 52 | - $this->name = __( 'Pronamic', 'pronamic_ideal' ); |
|
| 52 | + $this->name = __('Pronamic', 'pronamic_ideal'); |
|
| 53 | 53 | |
| 54 | - if ( ! empty( $this->payment_method ) ) { |
|
| 55 | - $this->name = PaymentMethods::get_name( $this->payment_method ); |
|
| 54 | + if ( ! empty($this->payment_method)) { |
|
| 55 | + $this->name = PaymentMethods::get_name($this->payment_method); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Set the default settings. |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L69-70 |
| 76 | 76 | */ |
| 77 | - public function load( $settings ) { |
|
| 77 | + public function load($settings) { |
|
| 78 | 78 | $this->settings = (object) $settings; |
| 79 | 79 | |
| 80 | 80 | $this->set_defaults(); |
@@ -88,19 +88,19 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return mixed |
| 90 | 90 | */ |
| 91 | - public function send_transaction_notices( $transaction, $method ) { |
|
| 91 | + public function send_transaction_notices($transaction, $method) { |
|
| 92 | 92 | $class = 'MeprUtils'; |
| 93 | 93 | |
| 94 | - if ( ! Core_Util::class_method_exists( $class, $method ) ) { |
|
| 94 | + if ( ! Core_Util::class_method_exists($class, $method)) { |
|
| 95 | 95 | $class = $this; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if ( 'MeprUtils' === $class && 'send_product_welcome_notices' === $method ) { |
|
| 98 | + if ('MeprUtils' === $class && 'send_product_welcome_notices' === $method) { |
|
| 99 | 99 | // `send_product_welcome_notices` is called from `send_signup_notices` in newer versions. |
| 100 | 100 | return; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - return call_user_func( array( $class, $method ), $transaction ); |
|
| 103 | + return call_user_func(array($class, $method), $transaction); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L72-73 |
| 129 | 129 | */ |
| 130 | 130 | protected function set_defaults() { |
| 131 | - if ( ! isset( $this->settings ) ) { |
|
| 131 | + if ( ! isset($this->settings)) { |
|
| 132 | 132 | $this->settings = array(); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * |
| 167 | 167 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L119-122 |
| 168 | 168 | */ |
| 169 | - public function process_payment( $txn ) { |
|
| 169 | + public function process_payment($txn) { |
|
| 170 | 170 | |
| 171 | 171 | } |
| 172 | 172 | |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $subscription = $transaction->subscription(); |
| 185 | 185 | |
| 186 | - if ( $subscription ) { |
|
| 187 | - if ( MeprSubscription::$active_str !== $subscription->status ) { |
|
| 186 | + if ($subscription) { |
|
| 187 | + if (MeprSubscription::$active_str !== $subscription->status) { |
|
| 188 | 188 | $subscription->status = MeprSubscription::$active_str; |
| 189 | 189 | $subscription->store(); |
| 190 | 190 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $subscription->limit_payment_cycles(); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $this->send_transaction_notices( $transaction, 'send_transaction_receipt_notices' ); |
|
| 195 | + $this->send_transaction_notices($transaction, 'send_transaction_receipt_notices'); |
|
| 196 | 196 | |
| 197 | 197 | return $transaction; |
| 198 | 198 | } |
@@ -212,12 +212,12 @@ discard block |
||
| 212 | 212 | // Expire associated transactions for subscription |
| 213 | 213 | $subscription = $transaction->subscription(); |
| 214 | 214 | |
| 215 | - if ( $subscription ) { |
|
| 215 | + if ($subscription) { |
|
| 216 | 216 | $subscription->expire_txns(); |
| 217 | 217 | $subscription->store(); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - $this->send_transaction_notices( $transaction, 'send_failed_txn_notices' ); |
|
| 220 | + $this->send_transaction_notices($transaction, 'send_failed_txn_notices'); |
|
| 221 | 221 | |
| 222 | 222 | return $transaction; |
| 223 | 223 | } |
@@ -241,17 +241,17 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $subscription = $transaction->subscription(); |
| 243 | 243 | |
| 244 | - if ( $subscription ) { |
|
| 244 | + if ($subscription) { |
|
| 245 | 245 | $subscription->status = MeprSubscription::$active_str; |
| 246 | 246 | $subscription->created_at = $transaction->created_at; |
| 247 | 247 | $subscription->store(); |
| 248 | 248 | |
| 249 | 249 | // Set subscription first transaction id meta. |
| 250 | - $pronamic_subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $subscription->first_txn_id ); |
|
| 250 | + $pronamic_subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $subscription->first_txn_id); |
|
| 251 | 251 | |
| 252 | - if ( $pronamic_subscription ) { |
|
| 252 | + if ($pronamic_subscription) { |
|
| 253 | 253 | // Store MemberPress subscription id to be able to cancel subscription on delete. |
| 254 | - $pronamic_subscription->set_meta( 'memberpress_subscription_id', $subscription->id ); |
|
| 254 | + $pronamic_subscription->set_meta('memberpress_subscription_id', $subscription->id); |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | * @see https://github.com/wp-premium/memberpress-business/blob/1.2.7/app/lib/MeprBaseGateway.php#L609-L619 |
| 264 | 264 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprTransaction.php#L51 |
| 265 | 265 | */ |
| 266 | - $reflection = new ReflectionClass( 'MeprBaseRealGateway' ); |
|
| 266 | + $reflection = new ReflectionClass('MeprBaseRealGateway'); |
|
| 267 | 267 | |
| 268 | - if ( $reflection->hasMethod( 'send_product_welcome_notices' ) && 3 === $reflection->getMethod( 'send_product_welcome_notices' )->getNumberOfParameters() ) { |
|
| 268 | + if ($reflection->hasMethod('send_product_welcome_notices') && 3 === $reflection->getMethod('send_product_welcome_notices')->getNumberOfParameters()) { |
|
| 269 | 269 | $uemail = MeprEmailFactory::fetch( |
| 270 | 270 | 'MeprUserProductWelcomeEmail', |
| 271 | 271 | 'MeprBaseProductEmail', |
@@ -278,24 +278,24 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $this->send_product_welcome_notices( |
| 280 | 280 | $uemail, |
| 281 | - MeprTransactionsHelper::get_email_params( $transaction ), |
|
| 281 | + MeprTransactionsHelper::get_email_params($transaction), |
|
| 282 | 282 | $transaction->user() |
| 283 | 283 | ); |
| 284 | 284 | } else { |
| 285 | - $this->send_transaction_notices( $transaction, 'send_product_welcome_notices' ); |
|
| 285 | + $this->send_transaction_notices($transaction, 'send_product_welcome_notices'); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | // Send upgrade/downgrade notices |
| 289 | - if ( $upgrade ) { |
|
| 290 | - $this->upgraded_sub( $transaction ); |
|
| 291 | - $this->send_transaction_notices( $transaction, 'send_upgraded_txn_notices' ); |
|
| 292 | - } elseif ( $downgrade ) { |
|
| 293 | - $this->downgraded_sub( $transaction ); |
|
| 294 | - $this->send_transaction_notices( $transaction, 'send_downgraded_txn_notices' ); |
|
| 289 | + if ($upgrade) { |
|
| 290 | + $this->upgraded_sub($transaction); |
|
| 291 | + $this->send_transaction_notices($transaction, 'send_upgraded_txn_notices'); |
|
| 292 | + } elseif ($downgrade) { |
|
| 293 | + $this->downgraded_sub($transaction); |
|
| 294 | + $this->send_transaction_notices($transaction, 'send_downgraded_txn_notices'); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - $this->send_transaction_notices( $transaction, 'send_signup_notices' ); |
|
| 298 | - $this->send_transaction_notices( $transaction, 'send_transaction_receipt_notices' ); |
|
| 297 | + $this->send_transaction_notices($transaction, 'send_signup_notices'); |
|
| 298 | + $this->send_transaction_notices($transaction, 'send_transaction_receipt_notices'); |
|
| 299 | 299 | |
| 300 | 300 | return $transaction; |
| 301 | 301 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * |
| 308 | 308 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L131-133 |
| 309 | 309 | */ |
| 310 | - public function process_refund( MeprTransaction $txn ) { |
|
| 310 | + public function process_refund(MeprTransaction $txn) { |
|
| 311 | 311 | |
| 312 | 312 | } |
| 313 | 313 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * |
| 328 | 328 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L150-157 |
| 329 | 329 | */ |
| 330 | - public function process_trial_payment( $transaction ) { |
|
| 330 | + public function process_trial_payment($transaction) { |
|
| 331 | 331 | |
| 332 | 332 | } |
| 333 | 333 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * |
| 339 | 339 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L159-161 |
| 340 | 340 | */ |
| 341 | - public function record_trial_payment( $transaction ) { |
|
| 341 | + public function record_trial_payment($transaction) { |
|
| 342 | 342 | |
| 343 | 343 | } |
| 344 | 344 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | * |
| 350 | 350 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L163-167 |
| 351 | 351 | */ |
| 352 | - public function process_create_subscription( $txn ) { |
|
| 352 | + public function process_create_subscription($txn) { |
|
| 353 | 353 | |
| 354 | 354 | } |
| 355 | 355 | |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | * |
| 370 | 370 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L176 |
| 371 | 371 | */ |
| 372 | - public function process_update_subscription( $sub_id ) { |
|
| 372 | + public function process_update_subscription($sub_id) { |
|
| 373 | 373 | |
| 374 | 374 | } |
| 375 | 375 | |
@@ -389,21 +389,21 @@ discard block |
||
| 389 | 389 | * |
| 390 | 390 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L184-186 |
| 391 | 391 | */ |
| 392 | - public function process_suspend_subscription( $sub_id ) { |
|
| 393 | - if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
| 392 | + public function process_suspend_subscription($sub_id) { |
|
| 393 | + if ( ! MeprSubscription::exists($sub_id)) { |
|
| 394 | 394 | return; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - $sub = new MeprSubscription( $sub_id ); |
|
| 397 | + $sub = new MeprSubscription($sub_id); |
|
| 398 | 398 | |
| 399 | - if ( MeprSubscription::$suspended_str === $sub->status ) { |
|
| 399 | + if (MeprSubscription::$suspended_str === $sub->status) { |
|
| 400 | 400 | // Subscription is already suspended. |
| 401 | 401 | return; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->first_txn_id ); |
|
| 404 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $sub->first_txn_id); |
|
| 405 | 405 | |
| 406 | - if ( ! $subscription ) { |
|
| 406 | + if ( ! $subscription) { |
|
| 407 | 407 | return; |
| 408 | 408 | } |
| 409 | 409 | |
@@ -412,19 +412,19 @@ discard block |
||
| 412 | 412 | $sub->store(); |
| 413 | 413 | |
| 414 | 414 | // Send suspended subscription notices. |
| 415 | - MeprUtils::send_suspended_sub_notices( $sub ); |
|
| 415 | + MeprUtils::send_suspended_sub_notices($sub); |
|
| 416 | 416 | |
| 417 | 417 | $note = sprintf( |
| 418 | 418 | /* translators: %s: MemberPress */ |
| 419 | - __( '%s subscription on hold.', 'pronamic_ideal' ), |
|
| 420 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
| 419 | + __('%s subscription on hold.', 'pronamic_ideal'), |
|
| 420 | + __('MemberPress', 'pronamic_ideal') |
|
| 421 | 421 | ); |
| 422 | 422 | |
| 423 | - $subscription->add_note( $note ); |
|
| 423 | + $subscription->add_note($note); |
|
| 424 | 424 | |
| 425 | 425 | // The status of canceled or completed subscriptions will not be changed automatically. |
| 426 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
| 427 | - $subscription->set_status( Statuses::OPEN ); |
|
| 426 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
| 427 | + $subscription->set_status(Statuses::OPEN); |
|
| 428 | 428 | |
| 429 | 429 | $subscription->save(); |
| 430 | 430 | } |
@@ -446,21 +446,21 @@ discard block |
||
| 446 | 446 | * |
| 447 | 447 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L193-195 |
| 448 | 448 | */ |
| 449 | - public function process_resume_subscription( $sub_id ) { |
|
| 450 | - if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
| 449 | + public function process_resume_subscription($sub_id) { |
|
| 450 | + if ( ! MeprSubscription::exists($sub_id)) { |
|
| 451 | 451 | return; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - $sub = new MeprSubscription( $sub_id ); |
|
| 454 | + $sub = new MeprSubscription($sub_id); |
|
| 455 | 455 | |
| 456 | - if ( MeprSubscription::$active_str === $sub->status ) { |
|
| 456 | + if (MeprSubscription::$active_str === $sub->status) { |
|
| 457 | 457 | // Subscription is already active. |
| 458 | 458 | return; |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->first_txn_id ); |
|
| 461 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $sub->first_txn_id); |
|
| 462 | 462 | |
| 463 | - if ( ! $subscription ) { |
|
| 463 | + if ( ! $subscription) { |
|
| 464 | 464 | return; |
| 465 | 465 | } |
| 466 | 466 | |
@@ -471,35 +471,35 @@ discard block |
||
| 471 | 471 | // Check if prior txn is expired yet or not, if so create a temporary txn so the user can access the content immediately. |
| 472 | 472 | $prior_txn = $sub->latest_txn(); |
| 473 | 473 | |
| 474 | - if ( false === $prior_txn || ! ( $prior_txn instanceof MeprTransaction ) || strtotime( $prior_txn->expires_at ) < time() ) { |
|
| 474 | + if (false === $prior_txn || ! ($prior_txn instanceof MeprTransaction) || strtotime($prior_txn->expires_at) < time()) { |
|
| 475 | 475 | $txn = new MeprTransaction(); |
| 476 | 476 | $txn->subscription_id = $sub->id; |
| 477 | 477 | $txn->trans_num = $sub->subscr_id . '-' . uniqid(); |
| 478 | 478 | $txn->status = MeprTransaction::$confirmed_str; |
| 479 | 479 | $txn->txn_type = MeprTransaction::$subscription_confirmation_str; |
| 480 | 480 | $txn->response = (string) $sub; |
| 481 | - $txn->expires_at = MeprUtils::ts_to_mysql_date( time() + MeprUtils::days( 1 ), 'Y-m-d 23:59:59' ); |
|
| 481 | + $txn->expires_at = MeprUtils::ts_to_mysql_date(time() + MeprUtils::days(1), 'Y-m-d 23:59:59'); |
|
| 482 | 482 | |
| 483 | - $txn->set_subtotal( 0.00 ); // Just a confirmation txn. |
|
| 483 | + $txn->set_subtotal(0.00); // Just a confirmation txn. |
|
| 484 | 484 | |
| 485 | 485 | $txn->store(); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | // Send resumed subscription notices. |
| 489 | - MeprUtils::send_resumed_sub_notices( $sub ); |
|
| 489 | + MeprUtils::send_resumed_sub_notices($sub); |
|
| 490 | 490 | |
| 491 | 491 | // Add note. |
| 492 | 492 | $note = sprintf( |
| 493 | 493 | /* translators: %s: MemberPress */ |
| 494 | - __( '%s subscription reactivated.', 'pronamic_ideal' ), |
|
| 495 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
| 494 | + __('%s subscription reactivated.', 'pronamic_ideal'), |
|
| 495 | + __('MemberPress', 'pronamic_ideal') |
|
| 496 | 496 | ); |
| 497 | 497 | |
| 498 | - $subscription->add_note( $note ); |
|
| 498 | + $subscription->add_note($note); |
|
| 499 | 499 | |
| 500 | 500 | // The status of canceled or completed subscriptions will not be changed automatically. |
| 501 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
| 502 | - $subscription->set_status( Statuses::ACTIVE ); |
|
| 501 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
| 502 | + $subscription->set_status(Statuses::ACTIVE); |
|
| 503 | 503 | |
| 504 | 504 | $subscription->save(); |
| 505 | 505 | } |
@@ -521,21 +521,21 @@ discard block |
||
| 521 | 521 | * |
| 522 | 522 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L202-206 |
| 523 | 523 | */ |
| 524 | - public function process_cancel_subscription( $sub_id ) { |
|
| 525 | - if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
| 524 | + public function process_cancel_subscription($sub_id) { |
|
| 525 | + if ( ! MeprSubscription::exists($sub_id)) { |
|
| 526 | 526 | return; |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - $sub = new MeprSubscription( $sub_id ); |
|
| 529 | + $sub = new MeprSubscription($sub_id); |
|
| 530 | 530 | |
| 531 | - if ( MeprSubscription::$cancelled_str === $sub->status ) { |
|
| 531 | + if (MeprSubscription::$cancelled_str === $sub->status) { |
|
| 532 | 532 | // Subscription is already cancelled. |
| 533 | 533 | return; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->first_txn_id ); |
|
| 536 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $sub->first_txn_id); |
|
| 537 | 537 | |
| 538 | - if ( ! $subscription ) { |
|
| 538 | + if ( ! $subscription) { |
|
| 539 | 539 | return; |
| 540 | 540 | } |
| 541 | 541 | |
@@ -544,27 +544,27 @@ discard block |
||
| 544 | 544 | $sub->store(); |
| 545 | 545 | |
| 546 | 546 | // Expire the grace period (confirmation) if no completed payments have come through. |
| 547 | - if ( (int) $sub->txn_count <= 0 ) { |
|
| 547 | + if ((int) $sub->txn_count <= 0) { |
|
| 548 | 548 | $sub->expire_txns(); |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | $sub->limit_reached_actions(); |
| 552 | 552 | |
| 553 | 553 | // Send cancelled subscription notices. |
| 554 | - MeprUtils::send_cancelled_sub_notices( $sub ); |
|
| 554 | + MeprUtils::send_cancelled_sub_notices($sub); |
|
| 555 | 555 | |
| 556 | 556 | // Add note. |
| 557 | 557 | $note = sprintf( |
| 558 | 558 | /* translators: %s: MemberPress */ |
| 559 | - __( '%s subscription cancelled.', 'pronamic_ideal' ), |
|
| 560 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
| 559 | + __('%s subscription cancelled.', 'pronamic_ideal'), |
|
| 560 | + __('MemberPress', 'pronamic_ideal') |
|
| 561 | 561 | ); |
| 562 | 562 | |
| 563 | - $subscription->add_note( $note ); |
|
| 563 | + $subscription->add_note($note); |
|
| 564 | 564 | |
| 565 | 565 | // The status of canceled or completed subscriptions will not be changed automatically. |
| 566 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
| 567 | - $subscription->set_status( Statuses::CANCELLED ); |
|
| 566 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
| 567 | + $subscription->set_status(Statuses::CANCELLED); |
|
| 568 | 568 | |
| 569 | 569 | $subscription->save(); |
| 570 | 570 | } |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | * |
| 587 | 587 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L214-217 |
| 588 | 588 | */ |
| 589 | - public function process_signup_form( $txn ) { |
|
| 589 | + public function process_signup_form($txn) { |
|
| 590 | 590 | |
| 591 | 591 | } |
| 592 | 592 | |
@@ -597,28 +597,28 @@ discard block |
||
| 597 | 597 | * |
| 598 | 598 | * @param $txn |
| 599 | 599 | */ |
| 600 | - public function payment_redirect( $txn ) { |
|
| 601 | - $txn = new MeprTransaction( $txn->id ); |
|
| 600 | + public function payment_redirect($txn) { |
|
| 601 | + $txn = new MeprTransaction($txn->id); |
|
| 602 | 602 | |
| 603 | 603 | // Gateway |
| 604 | 604 | $config_id = $this->settings->config_id; |
| 605 | 605 | |
| 606 | - $gateway = Plugin::get_gateway( $config_id ); |
|
| 606 | + $gateway = Plugin::get_gateway($config_id); |
|
| 607 | 607 | |
| 608 | - if ( ! $gateway ) { |
|
| 608 | + if ( ! $gateway) { |
|
| 609 | 609 | return; |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | // Data |
| 613 | - $data = new PaymentData( $txn ); |
|
| 613 | + $data = new PaymentData($txn); |
|
| 614 | 614 | |
| 615 | - $payment = Plugin::start( $config_id, $gateway, $data, $this->payment_method ); |
|
| 615 | + $payment = Plugin::start($config_id, $gateway, $data, $this->payment_method); |
|
| 616 | 616 | |
| 617 | 617 | $error = $gateway->get_error(); |
| 618 | 618 | |
| 619 | - if ( ! is_wp_error( $error ) ) { |
|
| 619 | + if ( ! is_wp_error($error)) { |
|
| 620 | 620 | // Redirect |
| 621 | - $gateway->redirect( $payment ); |
|
| 621 | + $gateway->redirect($payment); |
|
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | |
@@ -631,18 +631,18 @@ discard block |
||
| 631 | 631 | * |
| 632 | 632 | * @return bool |
| 633 | 633 | */ |
| 634 | - public function display_payment_page( $txn ) { |
|
| 635 | - if ( ! $txn instanceof MeprTransaction ) { |
|
| 634 | + public function display_payment_page($txn) { |
|
| 635 | + if ( ! $txn instanceof MeprTransaction) { |
|
| 636 | 636 | return false; |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | // Gateway |
| 640 | 640 | $config_id = $this->settings->config_id; |
| 641 | 641 | |
| 642 | - $gateway = Plugin::get_gateway( $config_id ); |
|
| 642 | + $gateway = Plugin::get_gateway($config_id); |
|
| 643 | 643 | |
| 644 | - if ( $gateway && '' === $gateway->get_input_html() ) { |
|
| 645 | - $this->payment_redirect( $txn ); |
|
| 644 | + if ($gateway && '' === $gateway->get_input_html()) { |
|
| 645 | + $this->payment_redirect($txn); |
|
| 646 | 646 | } |
| 647 | 647 | } |
| 648 | 648 | |
@@ -655,22 +655,22 @@ discard block |
||
| 655 | 655 | * |
| 656 | 656 | * @return bool |
| 657 | 657 | */ |
| 658 | - public function process_payment_form( $txn ) { |
|
| 659 | - if ( ! $txn instanceof MeprTransaction ) { |
|
| 658 | + public function process_payment_form($txn) { |
|
| 659 | + if ( ! $txn instanceof MeprTransaction) { |
|
| 660 | 660 | return false; |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | - if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_memberpress_pay' ) ) { |
|
| 663 | + if ( ! filter_has_var(INPUT_POST, 'pronamic_pay_memberpress_pay')) { |
|
| 664 | 664 | return false; |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | // Gateway |
| 668 | 668 | $config_id = $this->settings->config_id; |
| 669 | 669 | |
| 670 | - $gateway = Plugin::get_gateway( $config_id ); |
|
| 670 | + $gateway = Plugin::get_gateway($config_id); |
|
| 671 | 671 | |
| 672 | - if ( $gateway ) { |
|
| 673 | - $this->payment_redirect( $txn ); |
|
| 672 | + if ($gateway) { |
|
| 673 | + $this->payment_redirect($txn); |
|
| 674 | 674 | } |
| 675 | 675 | } |
| 676 | 676 | |
@@ -693,20 +693,20 @@ discard block |
||
| 693 | 693 | * |
| 694 | 694 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L230-233 |
| 695 | 695 | */ |
| 696 | - public function display_payment_form( $amount, $user, $product_id, $txn_id ) { |
|
| 697 | - $product = new MeprProduct( $product_id ); |
|
| 696 | + public function display_payment_form($amount, $user, $product_id, $txn_id) { |
|
| 697 | + $product = new MeprProduct($product_id); |
|
| 698 | 698 | |
| 699 | 699 | $coupon = false; |
| 700 | 700 | |
| 701 | - $txn = new MeprTransaction( $txn_id ); |
|
| 701 | + $txn = new MeprTransaction($txn_id); |
|
| 702 | 702 | |
| 703 | 703 | // Artifically set the price of the $prd in case a coupon was used |
| 704 | - if ( $product->price !== $amount ) { |
|
| 704 | + if ($product->price !== $amount) { |
|
| 705 | 705 | $coupon = true; |
| 706 | 706 | $product->price = $amount; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - $invoice = MeprTransactionsHelper::get_invoice( $txn ); |
|
| 709 | + $invoice = MeprTransactionsHelper::get_invoice($txn); |
|
| 710 | 710 | |
| 711 | 711 | echo $invoice; // WPCS: XSS ok. |
| 712 | 712 | |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | <div class="mp_wrapper mp_payment_form_wrapper"> |
| 715 | 715 | <form action="" method="post" id="payment-form" class="mepr-form" novalidate> |
| 716 | 716 | <input type="hidden" name="mepr_process_payment_form" value="Y"/> |
| 717 | - <input type="hidden" name="mepr_transaction_id" value="<?php echo esc_attr( $txn_id ); ?>"/> |
|
| 717 | + <input type="hidden" name="mepr_transaction_id" value="<?php echo esc_attr($txn_id); ?>"/> |
|
| 718 | 718 | <input type="hidden" name="pronamic_pay_memberpress_pay" value="1"/> |
| 719 | 719 | |
| 720 | 720 | <div class="mepr_spacer"> </div> |
@@ -724,9 +724,9 @@ discard block |
||
| 724 | 724 | // Gateway |
| 725 | 725 | $config_id = $this->settings->config_id; |
| 726 | 726 | |
| 727 | - $gateway = Plugin::get_gateway( $config_id ); |
|
| 727 | + $gateway = Plugin::get_gateway($config_id); |
|
| 728 | 728 | |
| 729 | - if ( $gateway ) { |
|
| 729 | + if ($gateway) { |
|
| 730 | 730 | echo $gateway->get_input_html(); // WPCS: XSS ok. |
| 731 | 731 | } |
| 732 | 732 | |
@@ -734,13 +734,13 @@ discard block |
||
| 734 | 734 | |
| 735 | 735 | <div class="mepr_spacer"> </div> |
| 736 | 736 | |
| 737 | - <input type="submit" class="mepr-submit" value="<?php esc_attr_e( 'Pay', 'pronamic_ideal' ); ?>"/> |
|
| 738 | - <img src="<?php echo esc_attr( admin_url( 'images/loading.gif' ) ); ?>" style="display: none;" class="mepr-loading-gif"/> |
|
| 739 | - <?php MeprView::render( '/shared/has_errors', get_defined_vars() ); ?> |
|
| 737 | + <input type="submit" class="mepr-submit" value="<?php esc_attr_e('Pay', 'pronamic_ideal'); ?>"/> |
|
| 738 | + <img src="<?php echo esc_attr(admin_url('images/loading.gif')); ?>" style="display: none;" class="mepr-loading-gif"/> |
|
| 739 | + <?php MeprView::render('/shared/has_errors', get_defined_vars()); ?> |
|
| 740 | 740 | |
| 741 | 741 | <noscript> |
| 742 | 742 | <p class="mepr_nojs"> |
| 743 | - <?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' ); ?> |
|
| 743 | + <?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'); ?> |
|
| 744 | 744 | </p> |
| 745 | 745 | </noscript> |
| 746 | 746 | </form> |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | * |
| 756 | 756 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L235-236 |
| 757 | 757 | */ |
| 758 | - public function validate_payment_form( $errors ) { |
|
| 758 | + public function validate_payment_form($errors) { |
|
| 759 | 759 | |
| 760 | 760 | } |
| 761 | 761 | |
@@ -783,18 +783,18 @@ discard block |
||
| 783 | 783 | |
| 784 | 784 | ?> |
| 785 | 785 | <td> |
| 786 | - <?php esc_html_e( 'Configuration', 'pronamic_ideal' ); ?> |
|
| 786 | + <?php esc_html_e('Configuration', 'pronamic_ideal'); ?> |
|
| 787 | 787 | </td> |
| 788 | 788 | <td> |
| 789 | - <select name="<?php echo esc_attr( $name ); ?>"> |
|
| 789 | + <select name="<?php echo esc_attr($name); ?>"> |
|
| 790 | 790 | <?php |
| 791 | 791 | |
| 792 | - foreach ( Plugin::get_config_select_options( $this->payment_method ) as $value => $label ) { |
|
| 792 | + foreach (Plugin::get_config_select_options($this->payment_method) as $value => $label) { |
|
| 793 | 793 | printf( |
| 794 | 794 | '<option value="%s" %s>%s</option>', |
| 795 | - esc_attr( $value ), |
|
| 796 | - selected( $value, $this->settings->config_id, false ), |
|
| 797 | - esc_html( $label ) |
|
| 795 | + esc_attr($value), |
|
| 796 | + selected($value, $this->settings->config_id, false), |
|
| 797 | + esc_html($label) |
|
| 798 | 798 | ); |
| 799 | 799 | } |
| 800 | 800 | |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | * |
| 816 | 816 | * @return array |
| 817 | 817 | */ |
| 818 | - public function validate_options_form( $errors ) { |
|
| 818 | + public function validate_options_form($errors) { |
|
| 819 | 819 | return $errors; |
| 820 | 820 | } |
| 821 | 821 | |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | * |
| 838 | 838 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L365-366 |
| 839 | 839 | */ |
| 840 | - public function display_update_account_form( $sub_id, $errors = array(), $message = '' ) { |
|
| 840 | + public function display_update_account_form($sub_id, $errors = array(), $message = '') { |
|
| 841 | 841 | |
| 842 | 842 | } |
| 843 | 843 | |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | * |
| 851 | 851 | * @return array |
| 852 | 852 | */ |
| 853 | - public function validate_update_account_form( $errors = array() ) { |
|
| 853 | + public function validate_update_account_form($errors = array()) { |
|
| 854 | 854 | return $errors; |
| 855 | 855 | } |
| 856 | 856 | |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | * |
| 862 | 862 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L371-372 |
| 863 | 863 | */ |
| 864 | - public function process_update_account_form( $sub_id ) { |
|
| 864 | + public function process_update_account_form($sub_id) { |
|
| 865 | 865 | |
| 866 | 866 | } |
| 867 | 867 | |
@@ -23,11 +23,11 @@ |
||
| 23 | 23 | * |
| 24 | 24 | * @return bool |
| 25 | 25 | */ |
| 26 | - public static function transaction_has_status( MeprTransaction $transaction, $status ) { |
|
| 27 | - if ( is_array( $status ) ) { |
|
| 28 | - return in_array( $transaction->status, $status, true ); |
|
| 26 | + public static function transaction_has_status(MeprTransaction $transaction, $status) { |
|
| 27 | + if (is_array($status)) { |
|
| 28 | + return in_array($transaction->status, $status, true); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - return ( $transaction->status === $status ); |
|
| 31 | + return ($transaction->status === $status); |
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | 32 | protected function get_icon() { |
| 33 | - return plugins_url( 'images/sepa-sofort/icon-24x24.png', Plugin::$file ); |
|
| 33 | + return plugins_url('images/sepa-sofort/icon-24x24.png', Plugin::$file); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | 32 | protected function get_icon() { |
| 33 | - return plugins_url( 'images/paypal/icon-32x32.png', Plugin::$file ); |
|
| 33 | + return plugins_url('images/paypal/icon-32x32.png', Plugin::$file); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * Constructs and initialize payment data object. |
| 42 | 42 | */ |
| 43 | - public function __construct( MeprTransaction $txn ) { |
|
| 43 | + public function __construct(MeprTransaction $txn) { |
|
| 44 | 44 | parent::__construct(); |
| 45 | 45 | |
| 46 | 46 | $this->txn = $txn; |
| 47 | 47 | $this->member = $this->txn->user(); |
| 48 | - $this->recurring = ( $txn->subscription() && $txn->subscription()->txn_count > 1 ); |
|
| 48 | + $this->recurring = ($txn->subscription() && $txn->subscription()->txn_count > 1); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public function get_source() { |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | $items = new Items(); |
| 69 | 69 | |
| 70 | 70 | $item = new Item(); |
| 71 | - $item->setNumber( $this->get_order_id() ); |
|
| 72 | - $item->setDescription( $this->get_description() ); |
|
| 73 | - $item->setPrice( $this->txn->total ); |
|
| 74 | - $item->setQuantity( 1 ); |
|
| 71 | + $item->setNumber($this->get_order_id()); |
|
| 72 | + $item->setDescription($this->get_description()); |
|
| 73 | + $item->setPrice($this->txn->total); |
|
| 74 | + $item->setQuantity(1); |
|
| 75 | 75 | |
| 76 | - $items->addItem( $item ); |
|
| 76 | + $items->addItem($item); |
|
| 77 | 77 | |
| 78 | 78 | return $items; |
| 79 | 79 | } |
@@ -86,25 +86,25 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function get_email() { |
| 89 | - if ( $this->member instanceof MeprUser ) { |
|
| 89 | + if ($this->member instanceof MeprUser) { |
|
| 90 | 90 | return $this->member->user_email; |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public function get_first_name() { |
| 95 | - if ( $this->member instanceof MeprUser ) { |
|
| 95 | + if ($this->member instanceof MeprUser) { |
|
| 96 | 96 | return $this->member->first_name; |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | public function get_last_name() { |
| 101 | - if ( $this->member instanceof MeprUser ) { |
|
| 101 | + if ($this->member instanceof MeprUser) { |
|
| 102 | 102 | return $this->member->last_name; |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | public function get_customer_name() { |
| 107 | - if ( $this->member instanceof MeprUser ) { |
|
| 107 | + if ($this->member instanceof MeprUser) { |
|
| 108 | 108 | return $this->member->get_full_name(); |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $mepr_options = MeprOptions::fetch(); |
| 126 | 126 | |
| 127 | 127 | // @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprOptions.php#L768-782 |
| 128 | - return $mepr_options->thankyou_page_url( 'trans_num=' . $this->txn->id ); |
|
| 128 | + return $mepr_options->thankyou_page_url('trans_num=' . $this->txn->id); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | public function get_cancel_url() { |
@@ -150,36 +150,36 @@ discard block |
||
| 150 | 150 | public function get_subscription() { |
| 151 | 151 | $product = $this->txn->product(); |
| 152 | 152 | |
| 153 | - if ( $product->is_one_time_payment() ) { |
|
| 153 | + if ($product->is_one_time_payment()) { |
|
| 154 | 154 | return false; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $mp_subscription = $this->txn->subscription(); |
| 158 | 158 | |
| 159 | - if ( ! $mp_subscription ) { |
|
| 159 | + if ( ! $mp_subscription) { |
|
| 160 | 160 | return false; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $frequency = ''; |
| 164 | 164 | |
| 165 | - if ( $mp_subscription->limit_cycles ) { |
|
| 165 | + if ($mp_subscription->limit_cycles) { |
|
| 166 | 166 | $frequency = $mp_subscription->limit_cycles; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $subscription = new Subscription(); |
| 170 | 170 | $subscription->frequency = $frequency; |
| 171 | 171 | $subscription->interval = $product->period; |
| 172 | - $subscription->interval_period = Core_Util::to_period( $product->period_type ); |
|
| 172 | + $subscription->interval_period = Core_Util::to_period($product->period_type); |
|
| 173 | 173 | $subscription->description = sprintf( |
| 174 | 174 | 'Order #%s - %s', |
| 175 | 175 | $this->get_source_id(), |
| 176 | 176 | $this->get_description() |
| 177 | 177 | ); |
| 178 | 178 | |
| 179 | - $subscription->set_amount( new Money( |
|
| 179 | + $subscription->set_amount(new Money( |
|
| 180 | 180 | $this->txn->total, |
| 181 | 181 | $this->get_currency_alphabetic_code() |
| 182 | - ) ); |
|
| 182 | + )); |
|
| 183 | 183 | |
| 184 | 184 | return $subscription; |
| 185 | 185 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | public function get_subscription_source_id() { |
| 194 | 194 | $subscription = $this->get_subscription(); |
| 195 | 195 | |
| 196 | - if ( ! $subscription ) { |
|
| 196 | + if ( ! $subscription) { |
|
| 197 | 197 | return false; |
| 198 | 198 | } |
| 199 | 199 | |
@@ -39,16 +39,16 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function __construct() { |
| 41 | 41 | // @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprGatewayFactory.php#L48-50 |
| 42 | - add_filter( 'mepr-gateway-paths', array( $this, 'gateway_paths' ) ); |
|
| 42 | + add_filter('mepr-gateway-paths', array($this, 'gateway_paths')); |
|
| 43 | 43 | |
| 44 | - add_filter( 'pronamic_payment_redirect_url_' . self::SLUG, array( __CLASS__, 'redirect_url' ), 10, 2 ); |
|
| 45 | - add_action( 'pronamic_payment_status_update_' . self::SLUG, array( __CLASS__, 'status_update' ), 10, 1 ); |
|
| 44 | + add_filter('pronamic_payment_redirect_url_' . self::SLUG, array(__CLASS__, 'redirect_url'), 10, 2); |
|
| 45 | + add_action('pronamic_payment_status_update_' . self::SLUG, array(__CLASS__, 'status_update'), 10, 1); |
|
| 46 | 46 | |
| 47 | - add_filter( 'pronamic_payment_source_text_' . self::SLUG, array( __CLASS__, 'source_text' ), 10, 2 ); |
|
| 48 | - add_filter( 'pronamic_payment_source_description_' . self::SLUG, array( __CLASS__, 'source_description' ), 10, 2 ); |
|
| 49 | - add_filter( 'pronamic_payment_source_url_' . self::SLUG, array( __CLASS__, 'source_url' ), 10, 2 ); |
|
| 47 | + add_filter('pronamic_payment_source_text_' . self::SLUG, array(__CLASS__, 'source_text'), 10, 2); |
|
| 48 | + add_filter('pronamic_payment_source_description_' . self::SLUG, array(__CLASS__, 'source_description'), 10, 2); |
|
| 49 | + add_filter('pronamic_payment_source_url_' . self::SLUG, array(__CLASS__, 'source_url'), 10, 2); |
|
| 50 | 50 | |
| 51 | - add_action( 'mepr_subscription_pre_delete', array( $this, 'subscription_pre_delete' ), 10, 1 ); |
|
| 51 | + add_action('mepr_subscription_pre_delete', array($this, 'subscription_pre_delete'), 10, 1); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return array |
| 62 | 62 | */ |
| 63 | - public function gateway_paths( $paths ) { |
|
| 64 | - $paths[] = dirname( __FILE__ ) . '/../gateways/'; |
|
| 63 | + public function gateway_paths($paths) { |
|
| 64 | + $paths[] = dirname(__FILE__) . '/../gateways/'; |
|
| 65 | 65 | |
| 66 | 66 | return $paths; |
| 67 | 67 | } |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @return string |
| 78 | 78 | */ |
| 79 | - public static function redirect_url( $url, Payment $payment ) { |
|
| 79 | + public static function redirect_url($url, Payment $payment) { |
|
| 80 | 80 | global $transaction; |
| 81 | 81 | |
| 82 | 82 | $transaction_id = $payment->get_source_id(); |
| 83 | 83 | |
| 84 | - $transaction = new MeprTransaction( $transaction_id ); |
|
| 84 | + $transaction = new MeprTransaction($transaction_id); |
|
| 85 | 85 | |
| 86 | - switch ( $payment->get_status() ) { |
|
| 86 | + switch ($payment->get_status()) { |
|
| 87 | 87 | case Statuses::CANCELLED: |
| 88 | 88 | case Statuses::EXPIRED: |
| 89 | 89 | case Statuses::FAILURE: |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | array( |
| 94 | 94 | 'action' => 'payment_form', |
| 95 | 95 | 'txn' => $transaction->trans_num, |
| 96 | - '_wpnonce' => wp_create_nonce( 'mepr_payment_form' ), |
|
| 96 | + '_wpnonce' => wp_create_nonce('mepr_payment_form'), |
|
| 97 | 97 | ), |
| 98 | 98 | $product->url() |
| 99 | 99 | ); |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | // @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprOptions.php#L768-782 |
| 104 | 104 | $mepr_options = MeprOptions::fetch(); |
| 105 | 105 | |
| 106 | - $product = new MeprProduct( $transaction->product_id ); |
|
| 107 | - $sanitized_title = sanitize_title( $product->post_title ); |
|
| 106 | + $product = new MeprProduct($transaction->product_id); |
|
| 107 | + $sanitized_title = sanitize_title($product->post_title); |
|
| 108 | 108 | |
| 109 | 109 | $args = array( |
| 110 | 110 | 'membership_id' => $product->ID, |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | 'trans_num' => $transaction->trans_num, |
| 113 | 113 | ); |
| 114 | 114 | |
| 115 | - $url = $mepr_options->thankyou_page_url( http_build_query( $args ) ); |
|
| 115 | + $url = $mepr_options->thankyou_page_url(http_build_query($args)); |
|
| 116 | 116 | |
| 117 | 117 | break; |
| 118 | 118 | case Statuses::OPEN: |
@@ -130,22 +130,22 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @param Payment $payment |
| 132 | 132 | */ |
| 133 | - public static function status_update( Payment $payment ) { |
|
| 133 | + public static function status_update(Payment $payment) { |
|
| 134 | 134 | global $transaction; |
| 135 | 135 | |
| 136 | 136 | $transaction_id = $payment->get_source_id(); |
| 137 | 137 | |
| 138 | - $transaction = new MeprTransaction( $transaction_id ); |
|
| 138 | + $transaction = new MeprTransaction($transaction_id); |
|
| 139 | 139 | |
| 140 | - if ( $payment->get_recurring() ) { |
|
| 140 | + if ($payment->get_recurring()) { |
|
| 141 | 141 | $sub = $transaction->subscription(); |
| 142 | 142 | |
| 143 | 143 | // Same source ID and first transaction ID for recurring payment means we need to add a new transaction. |
| 144 | - if ( $payment->get_source_id() === $sub->first_txn_id ) { |
|
| 144 | + if ($payment->get_source_id() === $sub->first_txn_id) { |
|
| 145 | 145 | // First transaction. |
| 146 | 146 | $first_txn = $sub->first_txn(); |
| 147 | 147 | |
| 148 | - if ( false === $first_txn || ! ( $first_txn instanceof MeprTransaction ) ) { |
|
| 148 | + if (false === $first_txn || ! ($first_txn instanceof MeprTransaction)) { |
|
| 149 | 149 | $first_txn = new MeprTransaction(); |
| 150 | 150 | $first_txn->user_id = $sub->user_id; |
| 151 | 151 | $first_txn->product_id = $sub->product_id; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | // Transaction number. |
| 156 | 156 | $trans_num = $payment->get_transaction_id(); |
| 157 | 157 | |
| 158 | - if ( empty( $trans_num ) ) { |
|
| 158 | + if (empty($trans_num)) { |
|
| 159 | 159 | $trans_num = uniqid(); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -171,27 +171,27 @@ discard block |
||
| 171 | 171 | $txn->status = MeprTransaction::$pending_str; |
| 172 | 172 | $txn->subscription_id = $sub->id; |
| 173 | 173 | |
| 174 | - $txn->set_gross( $payment->get_amount()->get_amount() ); |
|
| 174 | + $txn->set_gross($payment->get_amount()->get_amount()); |
|
| 175 | 175 | |
| 176 | 176 | $txn->store(); |
| 177 | 177 | |
| 178 | - update_post_meta( $payment->get_id(), '_pronamic_payment_source_id', $txn->id ); |
|
| 178 | + update_post_meta($payment->get_id(), '_pronamic_payment_source_id', $txn->id); |
|
| 179 | 179 | |
| 180 | 180 | $transaction = $txn; |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $should_update = ! MemberPress::transaction_has_status( $transaction, array( |
|
| 184 | + $should_update = ! MemberPress::transaction_has_status($transaction, array( |
|
| 185 | 185 | MeprTransaction::$failed_str, |
| 186 | 186 | MeprTransaction::$complete_str, |
| 187 | - ) ); |
|
| 187 | + )); |
|
| 188 | 188 | |
| 189 | - if ( $should_update ) { |
|
| 189 | + if ($should_update) { |
|
| 190 | 190 | $gateway = new Gateway(); |
| 191 | 191 | |
| 192 | 192 | $gateway->mp_txn = $transaction; |
| 193 | 193 | |
| 194 | - switch ( $payment->get_status() ) { |
|
| 194 | + switch ($payment->get_status()) { |
|
| 195 | 195 | case Statuses::CANCELLED: |
| 196 | 196 | case Statuses::EXPIRED: |
| 197 | 197 | case Statuses::FAILURE: |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | break; |
| 201 | 201 | case Statuses::SUCCESS: |
| 202 | - if ( $payment->get_recurring() ) { |
|
| 202 | + if ($payment->get_recurring()) { |
|
| 203 | 203 | $gateway->record_subscription_payment(); |
| 204 | 204 | } else { |
| 205 | 205 | $gateway->record_payment(); |
@@ -220,25 +220,25 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | * @return void |
| 222 | 222 | */ |
| 223 | - public function subscription_pre_delete( $subscription_id ) { |
|
| 224 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_memberpress_subscription_id', $subscription_id ); |
|
| 223 | + public function subscription_pre_delete($subscription_id) { |
|
| 224 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_memberpress_subscription_id', $subscription_id); |
|
| 225 | 225 | |
| 226 | - if ( ! $subscription ) { |
|
| 226 | + if ( ! $subscription) { |
|
| 227 | 227 | return; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | // Add note. |
| 231 | 231 | $note = sprintf( |
| 232 | 232 | /* translators: %s: MemberPress */ |
| 233 | - __( '%s subscription deleted.', 'pronamic_ideal' ), |
|
| 234 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
| 233 | + __('%s subscription deleted.', 'pronamic_ideal'), |
|
| 234 | + __('MemberPress', 'pronamic_ideal') |
|
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | - $subscription->add_note( $note ); |
|
| 237 | + $subscription->add_note($note); |
|
| 238 | 238 | |
| 239 | 239 | // The status of canceled or completed subscriptions will not be changed automatically. |
| 240 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
| 241 | - $subscription->set_status( Statuses::CANCELLED ); |
|
| 240 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
| 241 | + $subscription->set_status(Statuses::CANCELLED); |
|
| 242 | 242 | |
| 243 | 243 | $subscription->save(); |
| 244 | 244 | } |
@@ -252,18 +252,18 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * @return string |
| 254 | 254 | */ |
| 255 | - public static function source_text( $text, Payment $payment ) { |
|
| 256 | - $text = __( 'MemberPress', 'pronamic_ideal' ) . '<br />'; |
|
| 255 | + public static function source_text($text, Payment $payment) { |
|
| 256 | + $text = __('MemberPress', 'pronamic_ideal') . '<br />'; |
|
| 257 | 257 | |
| 258 | 258 | $text .= sprintf( |
| 259 | 259 | '<a href="%s">%s</a>', |
| 260 | - add_query_arg( array( |
|
| 260 | + add_query_arg(array( |
|
| 261 | 261 | 'page' => 'memberpress-trans', |
| 262 | 262 | 'action' => 'edit', |
| 263 | 263 | 'id' => $payment->source_id, |
| 264 | - ), admin_url( 'admin.php' ) ), |
|
| 264 | + ), admin_url('admin.php')), |
|
| 265 | 265 | /* translators: %s: payment source id */ |
| 266 | - sprintf( __( 'Transaction %s', 'pronamic_ideal' ), $payment->source_id ) |
|
| 266 | + sprintf(__('Transaction %s', 'pronamic_ideal'), $payment->source_id) |
|
| 267 | 267 | ); |
| 268 | 268 | |
| 269 | 269 | return $text; |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | * |
| 278 | 278 | * @return string |
| 279 | 279 | */ |
| 280 | - public static function source_description( $description, Payment $payment ) { |
|
| 281 | - return __( 'MemberPress Transaction', 'pronamic_ideal' ); |
|
| 280 | + public static function source_description($description, Payment $payment) { |
|
| 281 | + return __('MemberPress Transaction', 'pronamic_ideal'); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
@@ -289,12 +289,12 @@ discard block |
||
| 289 | 289 | * |
| 290 | 290 | * @return string |
| 291 | 291 | */ |
| 292 | - public static function source_url( $url, Payment $payment ) { |
|
| 293 | - $url = add_query_arg( array( |
|
| 292 | + public static function source_url($url, Payment $payment) { |
|
| 293 | + $url = add_query_arg(array( |
|
| 294 | 294 | 'page' => 'memberpress-trans', |
| 295 | 295 | 'action' => 'edit', |
| 296 | 296 | 'id' => $payment->source_id, |
| 297 | - ), admin_url( 'admin.php' ) ); |
|
| 297 | + ), admin_url('admin.php')); |
|
| 298 | 298 | |
| 299 | 299 | return $url; |
| 300 | 300 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | 32 | protected function get_icon() { |
| 33 | - return plugins_url( 'images/sepa-ideal/icon-24x24.png', Plugin::$file ); |
|
| 33 | + return plugins_url('images/sepa-ideal/icon-24x24.png', Plugin::$file); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | 32 | protected function get_icon() { |
| 33 | - return plugins_url( 'images/sepa-bancontact/icon-24x24.png', Plugin::$file ); |
|
| 33 | + return plugins_url('images/sepa-bancontact/icon-24x24.png', Plugin::$file); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |