@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | wp_register_style( |
18 | 18 | 'pronamic-pay-redirect', |
19 | - plugins_url( 'css/redirect' . $min . '.css', Plugin::$file ), |
|
19 | + plugins_url( 'css/redirect'.$min.'.css', Plugin::$file ), |
|
20 | 20 | array(), |
21 | 21 | $pronamic_ideal->get_version() |
22 | 22 | ); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public static function transform_code_to_number( $code ) { |
29 | 29 | $currencies = array(); |
30 | 30 | |
31 | - $file = dirname( Plugin::$file ) . '/other/dl_iso_table_a1.xml'; |
|
31 | + $file = dirname( Plugin::$file ).'/other/dl_iso_table_a1.xml'; |
|
32 | 32 | |
33 | 33 | $xml = simplexml_load_file( $file ); |
34 | 34 |
@@ -121,7 +121,7 @@ |
||
121 | 121 | * @return DateTime |
122 | 122 | */ |
123 | 123 | public function get_expiration_date() { |
124 | - return new DateTime( '@' . gmmktime( 0, 0, 0, $this->expiration_month, 1, $this->expiration_year ) ); |
|
124 | + return new DateTime( '@'.gmmktime( 0, 0, 0, $this->expiration_month, 1, $this->expiration_year ) ); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | ); |
53 | 53 | |
54 | 54 | foreach ( $no_trim_options as $option ) { |
55 | - add_filter( 'sanitize_option_' . $option, array( $this, 'sanitize_option_dont_trim_posted_value' ), 10, 2 ); |
|
55 | + add_filter( 'sanitize_option_'.$option, array( $this, 'sanitize_option_dont_trim_posted_value' ), 10, 2 ); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | register_setting( |
120 | 120 | 'pronamic_pay', 'pronamic_pay_thousands_sep', array( |
121 | 121 | 'type' => 'string', |
122 | - 'default' => $wp_locale->number_format['thousands_sep'], |
|
122 | + 'default' => $wp_locale->number_format[ 'thousands_sep' ], |
|
123 | 123 | 'sanitize_callback' => null, |
124 | 124 | ) |
125 | 125 | ); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | register_setting( |
133 | 133 | 'pronamic_pay', 'pronamic_pay_decimal_sep', array( |
134 | 134 | 'type' => 'string', |
135 | - 'default' => $wp_locale->number_format['decimal_point'], |
|
135 | + 'default' => $wp_locale->number_format[ 'decimal_point' ], |
|
136 | 136 | 'sanitize_callback' => null, |
137 | 137 | ) |
138 | 138 | ); |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | * email notifications so users can cancel or renew their subscription. |
80 | 80 | */ |
81 | 81 | public function handle_subscription() { |
82 | - if ( ! filter_has_var( INPUT_GET, 'subscription' ) ) { |
|
82 | + if ( !filter_has_var( INPUT_GET, 'subscription' ) ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - if ( ! filter_has_var( INPUT_GET, 'action' ) ) { |
|
86 | + if ( !filter_has_var( INPUT_GET, 'action' ) ) { |
|
87 | 87 | return; |
88 | 88 | } |
89 | 89 | |
90 | - if ( ! filter_has_var( INPUT_GET, 'key' ) ) { |
|
90 | + if ( !filter_has_var( INPUT_GET, 'key' ) ) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_STRING ); |
100 | 100 | |
101 | 101 | // Check if subscription is valid. |
102 | - if ( ! $subscription ) { |
|
102 | + if ( !$subscription ) { |
|
103 | 103 | return; |
104 | 104 | } |
105 | 105 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | if ( Statuses::SUCCESS !== $subscription->get_status() ) { |
129 | 129 | $payment = $this->start_recurring( $subscription, $gateway, true ); |
130 | 130 | |
131 | - if ( ! $gateway->has_error() ) { |
|
131 | + if ( !$gateway->has_error() ) { |
|
132 | 132 | // Redirect. |
133 | 133 | $gateway->redirect( $payment ); |
134 | 134 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | - if ( ! empty( $subscription->final_payment ) && $subscription->final_payment <= $subscription->next_payment ) { |
|
160 | + if ( !empty( $subscription->final_payment ) && $subscription->final_payment <= $subscription->next_payment ) { |
|
161 | 161 | $subscription->next_payment = null; |
162 | 162 | $subscription->status = Statuses::COMPLETED; |
163 | 163 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $payment->start_date = $start_date; |
200 | 200 | $payment->end_date = $end_date; |
201 | 201 | $payment->recurring_type = 'recurring'; |
202 | - $payment->recurring = ! $renewal; |
|
202 | + $payment->recurring = !$renewal; |
|
203 | 203 | |
204 | 204 | // Start payment. |
205 | 205 | $payment = Plugin::start_payment( $payment, $gateway ); |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | * @return array |
243 | 243 | */ |
244 | 244 | public function exclude_subscription_comment_notes( $clauses, $query ) { |
245 | - $type = $query->query_vars['type']; |
|
245 | + $type = $query->query_vars[ 'type' ]; |
|
246 | 246 | |
247 | 247 | // Ignore subscription notes comments if it's not specifically requested. |
248 | 248 | if ( 'subscription_note' !== $type ) { |
249 | - $clauses['where'] .= " AND comment_type != 'subscription_note'"; |
|
249 | + $clauses[ 'where' ] .= " AND comment_type != 'subscription_note'"; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return $clauses; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | // Check if there is already subscription attached to the payment. |
273 | 273 | $subscription_id = $payment->get_subscription_id(); |
274 | 274 | |
275 | - if ( ! empty( $subscription_id ) ) { |
|
275 | + if ( !empty( $subscription_id ) ) { |
|
276 | 276 | // Subscription already created. |
277 | 277 | return; |
278 | 278 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | foreach ( $query->posts as $post ) { |
434 | 434 | $subscription = new Subscription( $post->ID ); |
435 | 435 | |
436 | - do_action( 'pronamic_subscription_renewal_notice_' . $subscription->get_source(), $subscription ); |
|
436 | + do_action( 'pronamic_subscription_renewal_notice_'.$subscription->get_source(), $subscription ); |
|
437 | 437 | |
438 | 438 | // Set next renewal date meta. |
439 | 439 | $next_renewal = $subscription->get_next_payment_date( 1 ); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * @throws \Exception Throws an Exception when the `interval_spec` cannot be parsed as an interval. |
381 | 381 | */ |
382 | 382 | public function get_date_interval() { |
383 | - $interval_spec = 'P' . $this->interval . $this->interval_period; |
|
383 | + $interval_spec = 'P'.$this->interval.$this->interval_period; |
|
384 | 384 | |
385 | 385 | $interval = new DateInterval( $interval_spec ); |
386 | 386 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | * @return string |
510 | 510 | */ |
511 | 511 | public function get_meta( $key ) { |
512 | - $key = '_pronamic_subscription_' . $key; |
|
512 | + $key = '_pronamic_subscription_'.$key; |
|
513 | 513 | |
514 | 514 | return get_post_meta( $this->id, $key, true ); |
515 | 515 | } |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | * @return boolean True on successful update, false on failure. |
524 | 524 | */ |
525 | 525 | public function set_meta( $key, $value = false ) { |
526 | - $key = '_pronamic_subscription_' . $key; |
|
526 | + $key = '_pronamic_subscription_'.$key; |
|
527 | 527 | |
528 | 528 | if ( $value instanceof DateTime ) { |
529 | 529 | $value = $value->format( 'Y-m-d H:i:s' ); |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | |
549 | 549 | if ( $payment ) { |
550 | 550 | $description = apply_filters( 'pronamic_payment_source_description', $description, $payment ); |
551 | - $description = apply_filters( 'pronamic_payment_source_description_' . $this->source, $description, $payment ); |
|
551 | + $description = apply_filters( 'pronamic_payment_source_description_'.$this->source, $description, $payment ); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | return $description; |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | if ( $payment ) { |
568 | 568 | $url = apply_filters( 'pronamic_payment_source_url', $url, $payment ); |
569 | - $url = apply_filters( 'pronamic_payment_source_url_' . $this->source, $url, $payment ); |
|
569 | + $url = apply_filters( 'pronamic_payment_source_url_'.$this->source, $url, $payment ); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | return $url; |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | $payments = $this->get_payments(); |
642 | 642 | |
643 | 643 | if ( count( $payments ) > 0 ) { |
644 | - return $payments[0]; |
|
644 | + return $payments[ 0 ]; |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | return null; |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | if ( Statuses::OPEN !== $meta_status ) { |
912 | 912 | $this->refresh_next_payment_date(); |
913 | 913 | |
914 | - if ( ! $note ) { |
|
914 | + if ( !$note ) { |
|
915 | 915 | $this->add_note( __( "Subscription status changed to 'Open'", 'pronamic_ideal' ) ); |
916 | 916 | } |
917 | 917 | } |
@@ -923,14 +923,14 @@ discard block |
||
923 | 923 | if ( Statuses::SUCCESS !== $meta_status ) { |
924 | 924 | $this->refresh_next_payment_date(); |
925 | 925 | |
926 | - if ( ! $note ) { |
|
926 | + if ( !$note ) { |
|
927 | 927 | $this->add_note( __( "Subscription status changed to 'Active'", 'pronamic_ideal' ) ); |
928 | 928 | } |
929 | 929 | } |
930 | 930 | |
931 | 931 | break; |
932 | 932 | case Statuses::FAILURE: |
933 | - if ( ! $note ) { |
|
933 | + if ( !$note ) { |
|
934 | 934 | $this->add_note( __( "Subscription status changed to 'Failed'", 'pronamic_ideal' ) ); |
935 | 935 | } |
936 | 936 | |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | case Statuses::CANCELLED: |
939 | 939 | $this->set_next_payment_date( false ); |
940 | 940 | |
941 | - if ( ! $note ) { |
|
941 | + if ( !$note ) { |
|
942 | 942 | $this->add_note( __( "Subscription status changed to 'Cancelled'", 'pronamic_ideal' ) ); |
943 | 943 | } |
944 | 944 | |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | $this->set_next_payment_date( false ); |
948 | 948 | $this->set_start_date( false ); |
949 | 949 | |
950 | - if ( ! $note ) { |
|
950 | + if ( !$note ) { |
|
951 | 951 | $this->add_note( __( "Subscription status changed to 'Completed'", 'pronamic_ideal' ) ); |
952 | 952 | } |
953 | 953 | |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | * @param array $meta The meta data to update. |
969 | 969 | */ |
970 | 970 | public function update_meta( $meta ) { |
971 | - if ( ! is_array( $meta ) || count( $meta ) === 0 ) { |
|
971 | + if ( !is_array( $meta ) || count( $meta ) === 0 ) { |
|
972 | 972 | return; |
973 | 973 | } |
974 | 974 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $post_status = $this->get_post_status( $subscription, null ); |
89 | 89 | |
90 | 90 | if ( null !== $post_status ) { |
91 | - $data['post_status'] = $post_status; |
|
91 | + $data[ 'post_status' ] = $post_status; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | wp_update_post( $data ); |
@@ -139,21 +139,21 @@ discard block |
||
139 | 139 | |
140 | 140 | $id = $subscription->get_id(); |
141 | 141 | |
142 | - $subscription->config_id = get_post_meta( $id, $prefix . 'config_id', true ); |
|
143 | - $subscription->key = get_post_meta( $id, $prefix . 'key', true ); |
|
144 | - $subscription->source = get_post_meta( $id, $prefix . 'source', true ); |
|
145 | - $subscription->source_id = get_post_meta( $id, $prefix . 'source_id', true ); |
|
146 | - $subscription->frequency = get_post_meta( $id, $prefix . 'frequency', true ); |
|
147 | - $subscription->interval = get_post_meta( $id, $prefix . 'interval', true ); |
|
148 | - $subscription->interval_period = get_post_meta( $id, $prefix . 'interval_period', true ); |
|
149 | - $subscription->currency = get_post_meta( $id, $prefix . 'currency', true ); |
|
150 | - $subscription->amount = get_post_meta( $id, $prefix . 'amount', true ); |
|
151 | - $subscription->transaction_id = get_post_meta( $id, $prefix . 'transaction_id', true ); |
|
152 | - $subscription->status = get_post_meta( $id, $prefix . 'status', true ); |
|
153 | - $subscription->description = get_post_meta( $id, $prefix . 'description', true ); |
|
154 | - $subscription->email = get_post_meta( $id, $prefix . 'email', true ); |
|
155 | - $subscription->customer_name = get_post_meta( $id, $prefix . 'customer_name', true ); |
|
156 | - $subscription->payment_method = get_post_meta( $id, $prefix . 'payment_method', true ); |
|
142 | + $subscription->config_id = get_post_meta( $id, $prefix.'config_id', true ); |
|
143 | + $subscription->key = get_post_meta( $id, $prefix.'key', true ); |
|
144 | + $subscription->source = get_post_meta( $id, $prefix.'source', true ); |
|
145 | + $subscription->source_id = get_post_meta( $id, $prefix.'source_id', true ); |
|
146 | + $subscription->frequency = get_post_meta( $id, $prefix.'frequency', true ); |
|
147 | + $subscription->interval = get_post_meta( $id, $prefix.'interval', true ); |
|
148 | + $subscription->interval_period = get_post_meta( $id, $prefix.'interval_period', true ); |
|
149 | + $subscription->currency = get_post_meta( $id, $prefix.'currency', true ); |
|
150 | + $subscription->amount = get_post_meta( $id, $prefix.'amount', true ); |
|
151 | + $subscription->transaction_id = get_post_meta( $id, $prefix.'transaction_id', true ); |
|
152 | + $subscription->status = get_post_meta( $id, $prefix.'status', true ); |
|
153 | + $subscription->description = get_post_meta( $id, $prefix.'description', true ); |
|
154 | + $subscription->email = get_post_meta( $id, $prefix.'email', true ); |
|
155 | + $subscription->customer_name = get_post_meta( $id, $prefix.'customer_name', true ); |
|
156 | + $subscription->payment_method = get_post_meta( $id, $prefix.'payment_method', true ); |
|
157 | 157 | |
158 | 158 | $first_payment = $subscription->get_first_payment(); |
159 | 159 | |
@@ -171,22 +171,22 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | - $date_string = get_post_meta( $id, $prefix . 'start_date', true ); |
|
174 | + $date_string = get_post_meta( $id, $prefix.'start_date', true ); |
|
175 | 175 | $subscription->start_date = empty( $date_string ) ? null : new DateTime( $date_string ); |
176 | 176 | |
177 | - $date_string = get_post_meta( $id, $prefix . 'expiry_date', true ); |
|
177 | + $date_string = get_post_meta( $id, $prefix.'expiry_date', true ); |
|
178 | 178 | $subscription->expiry_date = empty( $date_string ) ? null : new DateTime( $date_string ); |
179 | 179 | |
180 | - $date_string = get_post_meta( $id, $prefix . 'first_payment', true ); |
|
180 | + $date_string = get_post_meta( $id, $prefix.'first_payment', true ); |
|
181 | 181 | $subscription->first_payment = empty( $date_string ) ? null : new DateTime( $date_string ); |
182 | 182 | |
183 | - $date_string = get_post_meta( $id, $prefix . 'next_payment', true ); |
|
183 | + $date_string = get_post_meta( $id, $prefix.'next_payment', true ); |
|
184 | 184 | $subscription->next_payment = empty( $date_string ) ? null : new DateTime( $date_string ); |
185 | 185 | |
186 | - $date_string = get_post_meta( $id, $prefix . 'final_payment', true ); |
|
186 | + $date_string = get_post_meta( $id, $prefix.'final_payment', true ); |
|
187 | 187 | $subscription->final_payment = empty( $date_string ) ? null : new DateTime( $date_string ); |
188 | 188 | |
189 | - $date_string = get_post_meta( $id, $prefix . 'renewal_notice', true ); |
|
189 | + $date_string = get_post_meta( $id, $prefix.'renewal_notice', true ); |
|
190 | 190 | $subscription->renewal_notice = empty( $date_string ) ? null : new DateTime( $date_string ); |
191 | 191 | } |
192 | 192 | |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | $data = array_merge( $subscription->meta, $data ); |
248 | 248 | |
249 | 249 | foreach ( $data as $key => $value ) { |
250 | - if ( ! empty( $value ) ) { |
|
251 | - $meta_key = $prefix . $key; |
|
250 | + if ( !empty( $value ) ) { |
|
251 | + $meta_key = $prefix.$key; |
|
252 | 252 | |
253 | 253 | update_post_meta( $id, $meta_key, $value ); |
254 | 254 | } |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | if ( $previous_status !== $subscription->status ) { |
258 | 258 | $can_redirect = false; |
259 | 259 | |
260 | - do_action( 'pronamic_subscription_status_update_' . $subscription->source . '_' . strtolower( $previous_status ) . '_to_' . strtolower( $subscription->status ), $subscription, $can_redirect ); |
|
261 | - do_action( 'pronamic_subscription_status_update_' . $subscription->source, $subscription, $can_redirect ); |
|
260 | + do_action( 'pronamic_subscription_status_update_'.$subscription->source.'_'.strtolower( $previous_status ).'_to_'.strtolower( $subscription->status ), $subscription, $can_redirect ); |
|
261 | + do_action( 'pronamic_subscription_status_update_'.$subscription->source, $subscription, $can_redirect ); |
|
262 | 262 | do_action( 'pronamic_subscription_status_update', $subscription, $can_redirect ); |
263 | 263 | } |
264 | 264 | } |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | private function get_client_id( Payment $payment ) { |
164 | 164 | $client_id = $payment->get_analytics_client_id(); |
165 | 165 | |
166 | - if ( ! empty( $client_id ) ) { |
|
166 | + if ( !empty( $client_id ) ) { |
|
167 | 167 | return $client_id; |
168 | 168 | } |
169 | 169 | |
170 | - if ( ! empty( $this->client_id ) ) { |
|
170 | + if ( !empty( $this->client_id ) ) { |
|
171 | 171 | return $this->client_id; |
172 | 172 | } |
173 | 173 | |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | |
229 | 229 | $ga = explode( '.', $ga_cookie ); |
230 | 230 | |
231 | - if ( isset( $ga[2] ) && GoogleAnalyticsEcommerce::is_uuid( $ga[2] ) ) { |
|
231 | + if ( isset( $ga[ 2 ] ) && GoogleAnalyticsEcommerce::is_uuid( $ga[ 2 ] ) ) { |
|
232 | 232 | // Use UUID from cookie. |
233 | - $client_id = $ga[2]; |
|
234 | - } elseif ( isset( $ga[2], $ga[3] ) ) { |
|
233 | + $client_id = $ga[ 2 ]; |
|
234 | + } elseif ( isset( $ga[ 2 ], $ga[ 3 ] ) ) { |
|
235 | 235 | // Older Google Client ID. |
236 | - $client_id = sprintf( '%s.%s', $ga[2], $ga[3] ); |
|
236 | + $client_id = sprintf( '%s.%s', $ga[ 2 ], $ga[ 3 ] ); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | return $client_id; |
@@ -219,13 +219,13 @@ |
||
219 | 219 | * @return string |
220 | 220 | */ |
221 | 221 | public function get_subscription_id() { |
222 | - if ( ! $this->get_subscription() ) { |
|
222 | + if ( !$this->get_subscription() ) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | 226 | $payment = get_pronamic_payment_by_meta( '_pronamic_payment_source_id', $this->get_subscription_source_id() ); |
227 | 227 | |
228 | - if ( ! $payment ) { |
|
228 | + if ( !$payment ) { |
|
229 | 229 | return; |
230 | 230 | } |
231 | 231 |