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