@@ -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: |
@@ -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->setNumber( $this->get_order_id() ); |
|
139 | - $item->setDescription( $this->get_description() ); |
|
140 | - $item->setPrice( $this->transaction->total ); |
|
141 | - $item->setQuantity( 1 ); |
|
138 | + $item->setNumber($this->get_order_id()); |
|
139 | + $item->setDescription($this->get_description()); |
|
140 | + $item->setPrice($this->transaction->total); |
|
141 | + $item->setQuantity(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 |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | |
56 | 56 | // Set the name of this gateway. |
57 | 57 | // @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L12-13. |
58 | - $this->name = __( 'Pronamic', 'pronamic_ideal' ); |
|
58 | + $this->name = __('Pronamic', 'pronamic_ideal'); |
|
59 | 59 | |
60 | - if ( ! empty( $this->payment_method ) ) { |
|
61 | - $this->name = PaymentMethods::get_name( $this->payment_method ); |
|
60 | + if ( ! empty($this->payment_method)) { |
|
61 | + $this->name = PaymentMethods::get_name($this->payment_method); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // Set the default settings. |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param array $settings MemberPress gateway settings array. |
82 | 82 | */ |
83 | - public function load( $settings ) { |
|
83 | + public function load($settings) { |
|
84 | 84 | $this->settings = (object) $settings; |
85 | 85 | |
86 | 86 | $this->set_defaults(); |
@@ -97,19 +97,19 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return mixed |
99 | 99 | */ |
100 | - public function send_transaction_notices( $transaction, $method ) { |
|
100 | + public function send_transaction_notices($transaction, $method) { |
|
101 | 101 | $class = 'MeprUtils'; |
102 | 102 | |
103 | - if ( ! Core_Util::class_method_exists( $class, $method ) ) { |
|
103 | + if ( ! Core_Util::class_method_exists($class, $method)) { |
|
104 | 104 | $class = $this; |
105 | 105 | } |
106 | 106 | |
107 | - if ( 'MeprUtils' === $class && 'send_product_welcome_notices' === $method ) { |
|
107 | + if ('MeprUtils' === $class && 'send_product_welcome_notices' === $method) { |
|
108 | 108 | // `send_product_welcome_notices` is called from `send_signup_notices` in newer versions. |
109 | 109 | return; |
110 | 110 | } |
111 | 111 | |
112 | - return call_user_func( array( $class, $method ), $transaction ); |
|
112 | + return call_user_func(array($class, $method), $transaction); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L72-73 |
138 | 138 | */ |
139 | 139 | protected function set_defaults() { |
140 | - if ( ! isset( $this->settings ) ) { |
|
140 | + if ( ! isset($this->settings)) { |
|
141 | 141 | $this->settings = array(); |
142 | 142 | } |
143 | 143 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L119-122 |
177 | 177 | */ |
178 | - public function process_payment( $txn ) { |
|
178 | + public function process_payment($txn) { |
|
179 | 179 | |
180 | 180 | } |
181 | 181 | |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | |
193 | 193 | $subscription = $transaction->subscription(); |
194 | 194 | |
195 | - if ( $subscription ) { |
|
196 | - if ( MeprSubscription::$active_str !== $subscription->status ) { |
|
195 | + if ($subscription) { |
|
196 | + if (MeprSubscription::$active_str !== $subscription->status) { |
|
197 | 197 | $subscription->status = MeprSubscription::$active_str; |
198 | 198 | $subscription->store(); |
199 | 199 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $subscription->limit_payment_cycles(); |
202 | 202 | } |
203 | 203 | |
204 | - $this->send_transaction_notices( $transaction, 'send_transaction_receipt_notices' ); |
|
204 | + $this->send_transaction_notices($transaction, 'send_transaction_receipt_notices'); |
|
205 | 205 | |
206 | 206 | return $transaction; |
207 | 207 | } |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | // Expire associated transactions for subscription. |
222 | 222 | $subscription = $transaction->subscription(); |
223 | 223 | |
224 | - if ( $subscription ) { |
|
224 | + if ($subscription) { |
|
225 | 225 | $subscription->expire_txns(); |
226 | 226 | $subscription->store(); |
227 | 227 | } |
228 | 228 | |
229 | - $this->send_transaction_notices( $transaction, 'send_failed_txn_notices' ); |
|
229 | + $this->send_transaction_notices($transaction, 'send_failed_txn_notices'); |
|
230 | 230 | |
231 | 231 | return $transaction; |
232 | 232 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | $subscription = $transaction->subscription(); |
252 | 252 | |
253 | - if ( $subscription ) { |
|
253 | + if ($subscription) { |
|
254 | 254 | $subscription->status = MeprSubscription::$active_str; |
255 | 255 | $subscription->created_at = $transaction->created_at; |
256 | 256 | $subscription->store(); |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | * @see https://github.com/wp-premium/memberpress-business/blob/1.2.7/app/lib/MeprBaseGateway.php#L609-L619 |
265 | 265 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprTransaction.php#L51 |
266 | 266 | */ |
267 | - $reflection = new ReflectionClass( 'MeprBaseRealGateway' ); |
|
267 | + $reflection = new ReflectionClass('MeprBaseRealGateway'); |
|
268 | 268 | |
269 | - if ( $reflection->hasMethod( 'send_product_welcome_notices' ) && 3 === $reflection->getMethod( 'send_product_welcome_notices' )->getNumberOfParameters() ) { |
|
269 | + if ($reflection->hasMethod('send_product_welcome_notices') && 3 === $reflection->getMethod('send_product_welcome_notices')->getNumberOfParameters()) { |
|
270 | 270 | $uemail = MeprEmailFactory::fetch( |
271 | 271 | 'MeprUserProductWelcomeEmail', |
272 | 272 | 'MeprBaseProductEmail', |
@@ -284,24 +284,24 @@ discard block |
||
284 | 284 | */ |
285 | 285 | $this->send_product_welcome_notices( |
286 | 286 | $uemail, |
287 | - MeprTransactionsHelper::get_email_params( $transaction ), |
|
287 | + MeprTransactionsHelper::get_email_params($transaction), |
|
288 | 288 | $transaction->user() |
289 | 289 | ); |
290 | 290 | } else { |
291 | - $this->send_transaction_notices( $transaction, 'send_product_welcome_notices' ); |
|
291 | + $this->send_transaction_notices($transaction, 'send_product_welcome_notices'); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // Send upgrade/downgrade notices. |
295 | - if ( $upgrade ) { |
|
296 | - $this->upgraded_sub( $transaction ); |
|
297 | - $this->send_transaction_notices( $transaction, 'send_upgraded_txn_notices' ); |
|
298 | - } elseif ( $downgrade ) { |
|
299 | - $this->downgraded_sub( $transaction ); |
|
300 | - $this->send_transaction_notices( $transaction, 'send_downgraded_txn_notices' ); |
|
295 | + if ($upgrade) { |
|
296 | + $this->upgraded_sub($transaction); |
|
297 | + $this->send_transaction_notices($transaction, 'send_upgraded_txn_notices'); |
|
298 | + } elseif ($downgrade) { |
|
299 | + $this->downgraded_sub($transaction); |
|
300 | + $this->send_transaction_notices($transaction, 'send_downgraded_txn_notices'); |
|
301 | 301 | } |
302 | 302 | |
303 | - $this->send_transaction_notices( $transaction, 'send_signup_notices' ); |
|
304 | - $this->send_transaction_notices( $transaction, 'send_transaction_receipt_notices' ); |
|
303 | + $this->send_transaction_notices($transaction, 'send_signup_notices'); |
|
304 | + $this->send_transaction_notices($transaction, 'send_transaction_receipt_notices'); |
|
305 | 305 | |
306 | 306 | return $transaction; |
307 | 307 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L131-133 |
315 | 315 | */ |
316 | - public function process_refund( MeprTransaction $txn ) { |
|
316 | + public function process_refund(MeprTransaction $txn) { |
|
317 | 317 | |
318 | 318 | } |
319 | 319 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @param MeprTransaction $transaction MemberPress transaction object. |
335 | 335 | */ |
336 | - public function process_trial_payment( $transaction ) { |
|
336 | + public function process_trial_payment($transaction) { |
|
337 | 337 | |
338 | 338 | } |
339 | 339 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * |
345 | 345 | * @param MeprTransaction $transaction MemberPress transaction object. |
346 | 346 | */ |
347 | - public function record_trial_payment( $transaction ) { |
|
347 | + public function record_trial_payment($transaction) { |
|
348 | 348 | |
349 | 349 | } |
350 | 350 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @param MeprTransaction $txn MemberPress transaction object. |
357 | 357 | */ |
358 | - public function process_create_subscription( $txn ) { |
|
358 | + public function process_create_subscription($txn) { |
|
359 | 359 | |
360 | 360 | } |
361 | 361 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @param int $sub_id Subscription ID. |
378 | 378 | */ |
379 | - public function process_update_subscription( $sub_id ) { |
|
379 | + public function process_update_subscription($sub_id) { |
|
380 | 380 | |
381 | 381 | } |
382 | 382 | |
@@ -396,21 +396,21 @@ discard block |
||
396 | 396 | * |
397 | 397 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L184-186 |
398 | 398 | */ |
399 | - public function process_suspend_subscription( $sub_id ) { |
|
400 | - if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
399 | + public function process_suspend_subscription($sub_id) { |
|
400 | + if ( ! MeprSubscription::exists($sub_id)) { |
|
401 | 401 | return; |
402 | 402 | } |
403 | 403 | |
404 | - $sub = new MeprSubscription( $sub_id ); |
|
404 | + $sub = new MeprSubscription($sub_id); |
|
405 | 405 | |
406 | - if ( MeprSubscription::$suspended_str === $sub->status ) { |
|
406 | + if (MeprSubscription::$suspended_str === $sub->status) { |
|
407 | 407 | // Subscription is already suspended. |
408 | 408 | return; |
409 | 409 | } |
410 | 410 | |
411 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->id ); |
|
411 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $sub->id); |
|
412 | 412 | |
413 | - if ( ! $subscription ) { |
|
413 | + if ( ! $subscription) { |
|
414 | 414 | return; |
415 | 415 | } |
416 | 416 | |
@@ -419,19 +419,19 @@ discard block |
||
419 | 419 | $sub->store(); |
420 | 420 | |
421 | 421 | // Send suspended subscription notices. |
422 | - MeprUtils::send_suspended_sub_notices( $sub ); |
|
422 | + MeprUtils::send_suspended_sub_notices($sub); |
|
423 | 423 | |
424 | 424 | $note = sprintf( |
425 | 425 | /* translators: %s: MemberPress */ |
426 | - __( '%s subscription on hold.', 'pronamic_ideal' ), |
|
427 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
426 | + __('%s subscription on hold.', 'pronamic_ideal'), |
|
427 | + __('MemberPress', 'pronamic_ideal') |
|
428 | 428 | ); |
429 | 429 | |
430 | - $subscription->add_note( $note ); |
|
430 | + $subscription->add_note($note); |
|
431 | 431 | |
432 | 432 | // The status of canceled or completed subscriptions will not be changed automatically. |
433 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
434 | - $subscription->set_status( Statuses::OPEN ); |
|
433 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
434 | + $subscription->set_status(Statuses::OPEN); |
|
435 | 435 | |
436 | 436 | $subscription->save(); |
437 | 437 | } |
@@ -453,21 +453,21 @@ discard block |
||
453 | 453 | * |
454 | 454 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L193-195 |
455 | 455 | */ |
456 | - public function process_resume_subscription( $sub_id ) { |
|
457 | - if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
456 | + public function process_resume_subscription($sub_id) { |
|
457 | + if ( ! MeprSubscription::exists($sub_id)) { |
|
458 | 458 | return; |
459 | 459 | } |
460 | 460 | |
461 | - $sub = new MeprSubscription( $sub_id ); |
|
461 | + $sub = new MeprSubscription($sub_id); |
|
462 | 462 | |
463 | - if ( MeprSubscription::$active_str === $sub->status ) { |
|
463 | + if (MeprSubscription::$active_str === $sub->status) { |
|
464 | 464 | // Subscription is already active. |
465 | 465 | return; |
466 | 466 | } |
467 | 467 | |
468 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->id ); |
|
468 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $sub->id); |
|
469 | 469 | |
470 | - if ( ! $subscription ) { |
|
470 | + if ( ! $subscription) { |
|
471 | 471 | return; |
472 | 472 | } |
473 | 473 | |
@@ -478,35 +478,35 @@ discard block |
||
478 | 478 | // Check if prior txn is expired yet or not, if so create a temporary txn so the user can access the content immediately. |
479 | 479 | $prior_txn = $sub->latest_txn(); |
480 | 480 | |
481 | - if ( false === $prior_txn || ! ( $prior_txn instanceof MeprTransaction ) || strtotime( $prior_txn->expires_at ) < time() ) { |
|
481 | + if (false === $prior_txn || ! ($prior_txn instanceof MeprTransaction) || strtotime($prior_txn->expires_at) < time()) { |
|
482 | 482 | $txn = new MeprTransaction(); |
483 | 483 | $txn->subscription_id = $sub->id; |
484 | 484 | $txn->trans_num = $sub->subscr_id . '-' . uniqid(); |
485 | 485 | $txn->status = MeprTransaction::$confirmed_str; |
486 | 486 | $txn->txn_type = MeprTransaction::$subscription_confirmation_str; |
487 | 487 | $txn->response = (string) $sub; |
488 | - $txn->expires_at = MeprUtils::ts_to_mysql_date( time() + MeprUtils::days( 1 ), 'Y-m-d 23:59:59' ); |
|
488 | + $txn->expires_at = MeprUtils::ts_to_mysql_date(time() + MeprUtils::days(1), 'Y-m-d 23:59:59'); |
|
489 | 489 | |
490 | - $txn->set_subtotal( 0.00 ); // Just a confirmation txn. |
|
490 | + $txn->set_subtotal(0.00); // Just a confirmation txn. |
|
491 | 491 | |
492 | 492 | $txn->store(); |
493 | 493 | } |
494 | 494 | |
495 | 495 | // Send resumed subscription notices. |
496 | - MeprUtils::send_resumed_sub_notices( $sub ); |
|
496 | + MeprUtils::send_resumed_sub_notices($sub); |
|
497 | 497 | |
498 | 498 | // Add note. |
499 | 499 | $note = sprintf( |
500 | 500 | /* translators: %s: MemberPress */ |
501 | - __( '%s subscription reactivated.', 'pronamic_ideal' ), |
|
502 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
501 | + __('%s subscription reactivated.', 'pronamic_ideal'), |
|
502 | + __('MemberPress', 'pronamic_ideal') |
|
503 | 503 | ); |
504 | 504 | |
505 | - $subscription->add_note( $note ); |
|
505 | + $subscription->add_note($note); |
|
506 | 506 | |
507 | 507 | // The status of canceled or completed subscriptions will not be changed automatically. |
508 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
509 | - $subscription->set_status( Statuses::ACTIVE ); |
|
508 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
509 | + $subscription->set_status(Statuses::ACTIVE); |
|
510 | 510 | |
511 | 511 | $subscription->save(); |
512 | 512 | } |
@@ -528,21 +528,21 @@ discard block |
||
528 | 528 | * |
529 | 529 | * @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L202-206 |
530 | 530 | */ |
531 | - public function process_cancel_subscription( $sub_id ) { |
|
532 | - if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
531 | + public function process_cancel_subscription($sub_id) { |
|
532 | + if ( ! MeprSubscription::exists($sub_id)) { |
|
533 | 533 | return; |
534 | 534 | } |
535 | 535 | |
536 | - $sub = new MeprSubscription( $sub_id ); |
|
536 | + $sub = new MeprSubscription($sub_id); |
|
537 | 537 | |
538 | - if ( MeprSubscription::$cancelled_str === $sub->status ) { |
|
538 | + if (MeprSubscription::$cancelled_str === $sub->status) { |
|
539 | 539 | // Subscription is already cancelled. |
540 | 540 | return; |
541 | 541 | } |
542 | 542 | |
543 | - $subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->id ); |
|
543 | + $subscription = get_pronamic_subscription_by_meta('_pronamic_subscription_source_id', $sub->id); |
|
544 | 544 | |
545 | - if ( ! $subscription ) { |
|
545 | + if ( ! $subscription) { |
|
546 | 546 | return; |
547 | 547 | } |
548 | 548 | |
@@ -551,27 +551,27 @@ discard block |
||
551 | 551 | $sub->store(); |
552 | 552 | |
553 | 553 | // Expire the grace period (confirmation) if no completed payments have come through. |
554 | - if ( (int) $sub->txn_count <= 0 ) { |
|
554 | + if ((int) $sub->txn_count <= 0) { |
|
555 | 555 | $sub->expire_txns(); |
556 | 556 | } |
557 | 557 | |
558 | 558 | $sub->limit_reached_actions(); |
559 | 559 | |
560 | 560 | // Send cancelled subscription notices. |
561 | - MeprUtils::send_cancelled_sub_notices( $sub ); |
|
561 | + MeprUtils::send_cancelled_sub_notices($sub); |
|
562 | 562 | |
563 | 563 | // Add note. |
564 | 564 | $note = sprintf( |
565 | 565 | /* translators: %s: MemberPress */ |
566 | - __( '%s subscription cancelled.', 'pronamic_ideal' ), |
|
567 | - __( 'MemberPress', 'pronamic_ideal' ) |
|
566 | + __('%s subscription cancelled.', 'pronamic_ideal'), |
|
567 | + __('MemberPress', 'pronamic_ideal') |
|
568 | 568 | ); |
569 | 569 | |
570 | - $subscription->add_note( $note ); |
|
570 | + $subscription->add_note($note); |
|
571 | 571 | |
572 | 572 | // The status of canceled or completed subscriptions will not be changed automatically. |
573 | - if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
574 | - $subscription->set_status( Statuses::CANCELLED ); |
|
573 | + if ( ! in_array($subscription->get_status(), array(Statuses::CANCELLED, Statuses::COMPLETED), true)) { |
|
574 | + $subscription->set_status(Statuses::CANCELLED); |
|
575 | 575 | |
576 | 576 | $subscription->save(); |
577 | 577 | } |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @param MeprTransaction $txn MemberPress transaction object. |
600 | 600 | */ |
601 | - public function process_signup_form( $txn ) { |
|
601 | + public function process_signup_form($txn) { |
|
602 | 602 | |
603 | 603 | } |
604 | 604 | |
@@ -609,28 +609,28 @@ discard block |
||
609 | 609 | * |
610 | 610 | * @param MeprTransaction $txn MemberPress transaction object. |
611 | 611 | */ |
612 | - public function payment_redirect( $txn ) { |
|
613 | - $txn = new MeprTransaction( $txn->id ); |
|
612 | + public function payment_redirect($txn) { |
|
613 | + $txn = new MeprTransaction($txn->id); |
|
614 | 614 | |
615 | 615 | // Gateway. |
616 | 616 | $config_id = $this->settings->config_id; |
617 | 617 | |
618 | - $gateway = Plugin::get_gateway( $config_id ); |
|
618 | + $gateway = Plugin::get_gateway($config_id); |
|
619 | 619 | |
620 | - if ( ! $gateway ) { |
|
620 | + if ( ! $gateway) { |
|
621 | 621 | return; |
622 | 622 | } |
623 | 623 | |
624 | 624 | // Data. |
625 | - $data = new PaymentData( $txn, $this ); |
|
625 | + $data = new PaymentData($txn, $this); |
|
626 | 626 | |
627 | - $payment = Plugin::start( $config_id, $gateway, $data, $this->payment_method ); |
|
627 | + $payment = Plugin::start($config_id, $gateway, $data, $this->payment_method); |
|
628 | 628 | |
629 | 629 | $error = $gateway->get_error(); |
630 | 630 | |
631 | - if ( ! is_wp_error( $error ) ) { |
|
631 | + if ( ! is_wp_error($error)) { |
|
632 | 632 | // Redirect. |
633 | - $gateway->redirect( $payment ); |
|
633 | + $gateway->redirect($payment); |
|
634 | 634 | } |
635 | 635 | } |
636 | 636 | |
@@ -643,14 +643,14 @@ discard block |
||
643 | 643 | * |
644 | 644 | * @param MeprTransaction $txn MemberPress transaction object. |
645 | 645 | */ |
646 | - public function display_payment_page( $txn ) { |
|
646 | + public function display_payment_page($txn) { |
|
647 | 647 | // Gateway. |
648 | 648 | $config_id = $this->settings->config_id; |
649 | 649 | |
650 | - $gateway = Plugin::get_gateway( $config_id ); |
|
650 | + $gateway = Plugin::get_gateway($config_id); |
|
651 | 651 | |
652 | - if ( $gateway && '' === $gateway->get_input_html() ) { |
|
653 | - $this->payment_redirect( $txn ); |
|
652 | + if ($gateway && '' === $gateway->get_input_html()) { |
|
653 | + $this->payment_redirect($txn); |
|
654 | 654 | } |
655 | 655 | } |
656 | 656 | |
@@ -664,18 +664,18 @@ discard block |
||
664 | 664 | * @param MeprTransaction $txn MemberPress transaction object. |
665 | 665 | * @return bool |
666 | 666 | */ |
667 | - public function process_payment_form( $txn ) { |
|
668 | - if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_memberpress_pay' ) ) { |
|
667 | + public function process_payment_form($txn) { |
|
668 | + if ( ! filter_has_var(INPUT_POST, 'pronamic_pay_memberpress_pay')) { |
|
669 | 669 | return false; |
670 | 670 | } |
671 | 671 | |
672 | 672 | // Gateway. |
673 | 673 | $config_id = $this->settings->config_id; |
674 | 674 | |
675 | - $gateway = Plugin::get_gateway( $config_id ); |
|
675 | + $gateway = Plugin::get_gateway($config_id); |
|
676 | 676 | |
677 | - if ( $gateway ) { |
|
678 | - $this->payment_redirect( $txn ); |
|
677 | + if ($gateway) { |
|
678 | + $this->payment_redirect($txn); |
|
679 | 679 | } |
680 | 680 | } |
681 | 681 | |
@@ -703,20 +703,20 @@ discard block |
||
703 | 703 | * @param int $product_id Product ID. |
704 | 704 | * @param int $txn_id Transaction ID. |
705 | 705 | */ |
706 | - public function display_payment_form( $amount, $user, $product_id, $txn_id ) { |
|
707 | - $product = new MeprProduct( $product_id ); |
|
706 | + public function display_payment_form($amount, $user, $product_id, $txn_id) { |
|
707 | + $product = new MeprProduct($product_id); |
|
708 | 708 | |
709 | 709 | $coupon = false; |
710 | 710 | |
711 | - $txn = new MeprTransaction( $txn_id ); |
|
711 | + $txn = new MeprTransaction($txn_id); |
|
712 | 712 | |
713 | 713 | // Artifically set the price of the $prd in case a coupon was used. |
714 | - if ( $product->price !== $amount ) { |
|
714 | + if ($product->price !== $amount) { |
|
715 | 715 | $coupon = true; |
716 | 716 | $product->price = $amount; |
717 | 717 | } |
718 | 718 | |
719 | - $invoice = MeprTransactionsHelper::get_invoice( $txn ); |
|
719 | + $invoice = MeprTransactionsHelper::get_invoice($txn); |
|
720 | 720 | |
721 | 721 | echo $invoice; // WPCS: XSS ok. |
722 | 722 | |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | <div class="mp_wrapper mp_payment_form_wrapper"> |
725 | 725 | <form action="" method="post" id="payment-form" class="mepr-form" novalidate> |
726 | 726 | <input type="hidden" name="mepr_process_payment_form" value="Y"/> |
727 | - <input type="hidden" name="mepr_transaction_id" value="<?php echo esc_attr( $txn_id ); ?>"/> |
|
727 | + <input type="hidden" name="mepr_transaction_id" value="<?php echo esc_attr($txn_id); ?>"/> |
|
728 | 728 | <input type="hidden" name="pronamic_pay_memberpress_pay" value="1"/> |
729 | 729 | |
730 | 730 | <div class="mepr_spacer"> </div> |
@@ -734,9 +734,9 @@ discard block |
||
734 | 734 | // Gateway. |
735 | 735 | $config_id = $this->settings->config_id; |
736 | 736 | |
737 | - $gateway = Plugin::get_gateway( $config_id ); |
|
737 | + $gateway = Plugin::get_gateway($config_id); |
|
738 | 738 | |
739 | - if ( $gateway ) { |
|
739 | + if ($gateway) { |
|
740 | 740 | echo $gateway->get_input_html(); // WPCS: XSS ok. |
741 | 741 | } |
742 | 742 | |
@@ -744,13 +744,13 @@ discard block |
||
744 | 744 | |
745 | 745 | <div class="mepr_spacer"> </div> |
746 | 746 | |
747 | - <input type="submit" class="mepr-submit" value="<?php esc_attr_e( 'Pay', 'pronamic_ideal' ); ?>"/> |
|
748 | - <img src="<?php echo esc_attr( admin_url( 'images/loading.gif' ) ); ?>" style="display: none;" class="mepr-loading-gif"/> |
|
749 | - <?php MeprView::render( '/shared/has_errors', get_defined_vars() ); ?> |
|
747 | + <input type="submit" class="mepr-submit" value="<?php esc_attr_e('Pay', 'pronamic_ideal'); ?>"/> |
|
748 | + <img src="<?php echo esc_attr(admin_url('images/loading.gif')); ?>" style="display: none;" class="mepr-loading-gif"/> |
|
749 | + <?php MeprView::render('/shared/has_errors', get_defined_vars()); ?> |
|
750 | 750 | |
751 | 751 | <noscript> |
752 | 752 | <p class="mepr_nojs"> |
753 | - <?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' ); ?> |
|
753 | + <?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'); ?> |
|
754 | 754 | </p> |
755 | 755 | </noscript> |
756 | 756 | </form> |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | * @param array $errors Array with errors. |
769 | 769 | * @return array |
770 | 770 | */ |
771 | - public function validate_payment_form( $errors ) { |
|
771 | + public function validate_payment_form($errors) { |
|
772 | 772 | return $errors; |
773 | 773 | } |
774 | 774 | |
@@ -795,18 +795,18 @@ discard block |
||
795 | 795 | |
796 | 796 | ?> |
797 | 797 | <td> |
798 | - <?php esc_html_e( 'Configuration', 'pronamic_ideal' ); ?> |
|
798 | + <?php esc_html_e('Configuration', 'pronamic_ideal'); ?> |
|
799 | 799 | </td> |
800 | 800 | <td> |
801 | - <select name="<?php echo esc_attr( $name ); ?>"> |
|
801 | + <select name="<?php echo esc_attr($name); ?>"> |
|
802 | 802 | <?php |
803 | 803 | |
804 | - foreach ( Plugin::get_config_select_options( $this->payment_method ) as $value => $label ) { |
|
804 | + foreach (Plugin::get_config_select_options($this->payment_method) as $value => $label) { |
|
805 | 805 | printf( |
806 | 806 | '<option value="%s" %s>%s</option>', |
807 | - esc_attr( $value ), |
|
808 | - selected( $value, $this->settings->config_id, false ), |
|
809 | - esc_html( $label ) |
|
807 | + esc_attr($value), |
|
808 | + selected($value, $this->settings->config_id, false), |
|
809 | + esc_html($label) |
|
810 | 810 | ); |
811 | 811 | } |
812 | 812 | |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | * @param array $errors Array with errors. |
829 | 829 | * @return array |
830 | 830 | */ |
831 | - public function validate_options_form( $errors ) { |
|
831 | + public function validate_options_form($errors) { |
|
832 | 832 | return $errors; |
833 | 833 | } |
834 | 834 | |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | * @see https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprStripeGateway.php#L1108-L1168 |
854 | 854 | * @see https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprAccountCtrl.php#L388 |
855 | 855 | */ |
856 | - public function display_update_account_form( $sub_id, $errors = array(), $message = '' ) { |
|
856 | + public function display_update_account_form($sub_id, $errors = array(), $message = '') { |
|
857 | 857 | |
858 | 858 | } |
859 | 859 | |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | * @param array $errors Array with errors. |
867 | 867 | * @return array |
868 | 868 | */ |
869 | - public function validate_update_account_form( $errors = array() ) { |
|
869 | + public function validate_update_account_form($errors = array()) { |
|
870 | 870 | return $errors; |
871 | 871 | } |
872 | 872 | |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | * |
879 | 879 | * @param int $sub_id Subscription ID. |
880 | 880 | */ |
881 | - public function process_update_account_form( $sub_id ) { |
|
881 | + public function process_update_account_form($sub_id) { |
|
882 | 882 | |
883 | 883 | } |
884 | 884 |
@@ -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 | /** |