@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Exit if accessed directly. |
26 | -if ( ! defined( 'ABSPATH' ) ) { |
|
26 | +if ( ! defined('ABSPATH')) { |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param callable $func Hook to run when email tag is found |
57 | 57 | * @param string $context Email tag category |
58 | 58 | */ |
59 | - public function add( $tag, $description, $func, $context = '' ) { |
|
60 | - if ( is_callable( $func ) ) { |
|
61 | - $this->tags[ $tag ] = array( |
|
59 | + public function add($tag, $description, $func, $context = '') { |
|
60 | + if (is_callable($func)) { |
|
61 | + $this->tags[$tag] = array( |
|
62 | 62 | 'tag' => $tag, |
63 | 63 | 'description' => $description, |
64 | 64 | 'func' => $func, |
65 | - 'context' => give_check_variable( $context, 'empty', 'general' ), |
|
65 | + 'context' => give_check_variable($context, 'empty', 'general'), |
|
66 | 66 | ); |
67 | 67 | } |
68 | 68 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param string $tag Email tag to remove hook from |
76 | 76 | */ |
77 | - public function remove( $tag ) { |
|
78 | - unset( $this->tags[ $tag ] ); |
|
77 | + public function remove($tag) { |
|
78 | + unset($this->tags[$tag]); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | - public function email_tag_exists( $tag ) { |
|
91 | - return array_key_exists( $tag, $this->tags ); |
|
90 | + public function email_tag_exists($tag) { |
|
91 | + return array_key_exists($tag, $this->tags); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -102,23 +102,23 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - public function get_tags( $context_type = 'all', $field = '' ) { |
|
105 | + public function get_tags($context_type = 'all', $field = '') { |
|
106 | 106 | $tags = $this->tags; |
107 | 107 | |
108 | - if ( 'all' !== $context_type ) { |
|
108 | + if ('all' !== $context_type) { |
|
109 | 109 | $tags = array(); |
110 | 110 | |
111 | - foreach ( $this->tags as $tag ) { |
|
112 | - if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) { |
|
111 | + foreach ($this->tags as $tag) { |
|
112 | + if (empty($tag['context']) || $context_type !== $tag['context']) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | |
116 | - $tags[ $tag['tag'] ] = $tag; |
|
116 | + $tags[$tag['tag']] = $tag; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - if ( ! empty( $tags ) && ! empty( $field ) ) { |
|
121 | - $tags = wp_list_pluck( $tags, $field ); |
|
120 | + if ( ! empty($tags) && ! empty($field)) { |
|
121 | + $tags = wp_list_pluck($tags, $field); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | return $tags; |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return string Content with email tags filtered out. |
138 | 138 | */ |
139 | - public function do_tags( $content, $tag_args ) { |
|
139 | + public function do_tags($content, $tag_args) { |
|
140 | 140 | |
141 | 141 | // Check if there is at least one tag added. |
142 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
142 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
143 | 143 | return $content; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $this->tag_args = $tag_args; |
147 | 147 | |
148 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
148 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
149 | 149 | |
150 | 150 | $this->tag_args = null; |
151 | 151 | |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return mixed |
163 | 163 | */ |
164 | - public function do_tag( $m ) { |
|
164 | + public function do_tag($m) { |
|
165 | 165 | |
166 | 166 | // Get tag |
167 | 167 | $tag = $m[1]; |
168 | 168 | |
169 | 169 | // Return tag if tag not set |
170 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
170 | + if ( ! $this->email_tag_exists($tag)) { |
|
171 | 171 | return $m[0]; |
172 | 172 | } |
173 | 173 | |
174 | - return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag ); |
|
174 | + return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | } |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param callable $func Hook to run when email tag is found |
187 | 187 | * @param string $context Email tag category |
188 | 188 | */ |
189 | -function give_add_email_tag( $tag, $description, $func, $context = '' ) { |
|
190 | - Give()->email_tags->add( $tag, $description, $func, $context ); |
|
189 | +function give_add_email_tag($tag, $description, $func, $context = '') { |
|
190 | + Give()->email_tags->add($tag, $description, $func, $context); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param string $tag Email tag to remove hook from |
199 | 199 | */ |
200 | -function give_remove_email_tag( $tag ) { |
|
201 | - Give()->email_tags->remove( $tag ); |
|
200 | +function give_remove_email_tag($tag) { |
|
201 | + Give()->email_tags->remove($tag); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return bool |
212 | 212 | */ |
213 | -function give_email_tag_exists( $tag ) { |
|
214 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
213 | +function give_email_tag_exists($tag) { |
|
214 | + return Give()->email_tags->email_tag_exists($tag); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | $email_tags = give_get_email_tags(); |
239 | 239 | |
240 | 240 | ob_start(); |
241 | - if ( count( $email_tags ) > 0 ) : ?> |
|
241 | + if (count($email_tags) > 0) : ?> |
|
242 | 242 | <div class="give-email-tags-wrap"> |
243 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
243 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
244 | 244 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
245 | 245 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
246 | 246 | </span> |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @return string Content with email tags filtered out. |
266 | 266 | */ |
267 | -function give_do_email_tags( $content, $tag_args ) { |
|
267 | +function give_do_email_tags($content, $tag_args) { |
|
268 | 268 | // Backward compatibility < 2.0 |
269 | - if ( ! is_array( $tag_args ) ) { |
|
270 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
269 | + if ( ! is_array($tag_args)) { |
|
270 | + $tag_args = array('payment_id' => $tag_args); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | // Replace all tags |
274 | - $content = Give()->email_tags->do_tags( $content, $tag_args ); |
|
274 | + $content = Give()->email_tags->do_tags($content, $tag_args); |
|
275 | 275 | |
276 | 276 | /** |
277 | 277 | * Filter the filtered content text. |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @since 1.0 |
280 | 280 | * @since 2.0 $payment_meta, $payment_id removed and $tag_args added. |
281 | 281 | */ |
282 | - $content = apply_filters( 'give_email_template_tags', $content, $tag_args ); |
|
282 | + $content = apply_filters('give_email_template_tags', $content, $tag_args); |
|
283 | 283 | |
284 | 284 | // Return content |
285 | 285 | return $content; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @since 1.0 |
300 | 300 | */ |
301 | - do_action( 'give_add_email_tags' ); |
|
301 | + do_action('give_add_email_tags'); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
304 | +add_action('init', 'give_load_email_tags', - 999); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | /** |
@@ -316,67 +316,67 @@ discard block |
||
316 | 316 | /* Donation Payment */ |
317 | 317 | array( |
318 | 318 | 'tag' => 'donation', |
319 | - 'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
319 | + 'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), |
|
320 | 320 | 'function' => 'give_email_tag_donation', |
321 | 321 | 'context' => 'donation', |
322 | 322 | ), |
323 | 323 | array( |
324 | 324 | 'tag' => 'amount', |
325 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
325 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
326 | 326 | 'function' => 'give_email_tag_amount', |
327 | 327 | 'context' => 'donation', |
328 | 328 | ), |
329 | 329 | array( |
330 | 330 | 'tag' => 'price', |
331 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
331 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
332 | 332 | 'function' => 'give_email_tag_price', |
333 | 333 | 'context' => 'donation', |
334 | 334 | ), |
335 | 335 | array( |
336 | 336 | 'tag' => 'billing_address', |
337 | - 'description' => esc_html__( 'The donor\'s billing address.', 'give' ), |
|
337 | + 'description' => esc_html__('The donor\'s billing address.', 'give'), |
|
338 | 338 | 'function' => 'give_email_tag_billing_address', |
339 | 339 | 'context' => 'donation', |
340 | 340 | ), |
341 | 341 | array( |
342 | 342 | 'tag' => 'date', |
343 | - 'description' => esc_html__( 'The date of the donation.', 'give' ), |
|
343 | + 'description' => esc_html__('The date of the donation.', 'give'), |
|
344 | 344 | 'function' => 'give_email_tag_date', |
345 | 345 | 'context' => 'donation', |
346 | 346 | ), |
347 | 347 | array( |
348 | 348 | 'tag' => 'payment_id', |
349 | - 'description' => esc_html__( 'The unique ID number for this donation.', 'give' ), |
|
349 | + 'description' => esc_html__('The unique ID number for this donation.', 'give'), |
|
350 | 350 | 'function' => 'give_email_tag_payment_id', |
351 | 351 | 'context' => 'donation', |
352 | 352 | ), |
353 | 353 | array( |
354 | 354 | 'tag' => 'payment_method', |
355 | - 'description' => esc_html__( 'The method of payment used for this donation.', 'give' ), |
|
355 | + 'description' => esc_html__('The method of payment used for this donation.', 'give'), |
|
356 | 356 | 'function' => 'give_email_tag_payment_method', |
357 | 357 | 'context' => 'donation', |
358 | 358 | ), |
359 | 359 | array( |
360 | 360 | 'tag' => 'payment_total', |
361 | - 'description' => esc_html__( 'The payment total for this donation.', 'give' ), |
|
361 | + 'description' => esc_html__('The payment total for this donation.', 'give'), |
|
362 | 362 | 'function' => 'give_email_tag_payment_total', |
363 | 363 | 'context' => 'donation', |
364 | 364 | ), |
365 | 365 | array( |
366 | 366 | 'tag' => 'receipt_id', |
367 | - 'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), |
|
367 | + 'description' => esc_html__('The unique ID number for this donation receipt.', 'give'), |
|
368 | 368 | 'function' => 'give_email_tag_receipt_id', |
369 | 369 | 'context' => 'donation', |
370 | 370 | ), |
371 | 371 | array( |
372 | 372 | 'tag' => 'receipt_link', |
373 | - 'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
373 | + 'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
374 | 374 | 'function' => 'give_email_tag_receipt_link', |
375 | 375 | 'context' => 'donation', |
376 | 376 | ), |
377 | 377 | array( |
378 | 378 | 'tag' => 'receipt_link_url', |
379 | - 'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
379 | + 'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
380 | 380 | 'function' => 'give_email_tag_receipt_link_url', |
381 | 381 | 'context' => 'donation', |
382 | 382 | ), |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | /* Donation Form */ |
385 | 385 | array( |
386 | 386 | 'tag' => 'form_title', |
387 | - 'description' => esc_html__( 'The donation form name.', 'give' ), |
|
387 | + 'description' => esc_html__('The donation form name.', 'give'), |
|
388 | 388 | 'function' => 'give_email_tag_form_title', |
389 | 389 | 'context' => 'form', |
390 | 390 | ), |
@@ -392,37 +392,37 @@ discard block |
||
392 | 392 | /* Donor */ |
393 | 393 | array( |
394 | 394 | 'tag' => 'name', |
395 | - 'description' => esc_html__( 'The donor\'s first name.', 'give' ), |
|
395 | + 'description' => esc_html__('The donor\'s first name.', 'give'), |
|
396 | 396 | 'function' => 'give_email_tag_first_name', |
397 | 397 | 'context' => 'donor', |
398 | 398 | ), |
399 | 399 | array( |
400 | 400 | 'tag' => 'fullname', |
401 | - 'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), |
|
401 | + 'description' => esc_html__('The donor\'s full name, first and last.', 'give'), |
|
402 | 402 | 'function' => 'give_email_tag_fullname', |
403 | 403 | 'context' => 'donor', |
404 | 404 | ), |
405 | 405 | array( |
406 | 406 | 'tag' => 'username', |
407 | - 'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
407 | + 'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
408 | 408 | 'function' => 'give_email_tag_username', |
409 | 409 | 'context' => 'donor', |
410 | 410 | ), |
411 | 411 | array( |
412 | 412 | 'tag' => 'company_name', |
413 | - 'description' => esc_html__( 'Company name.', 'give' ), |
|
413 | + 'description' => esc_html__('Company name.', 'give'), |
|
414 | 414 | 'function' => 'give_email_tag_company_name', |
415 | 415 | 'context' => 'donation', |
416 | 416 | ), |
417 | 417 | array( |
418 | 418 | 'tag' => 'user_email', |
419 | - 'description' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
419 | + 'description' => esc_html__('The donor\'s email address.', 'give'), |
|
420 | 420 | 'function' => 'give_email_tag_user_email', |
421 | 421 | 'context' => 'donor', |
422 | 422 | ), |
423 | 423 | array( |
424 | 424 | 'tag' => 'email_access_link', |
425 | - 'description' => esc_html__( 'The donor\'s email access link.', 'give' ), |
|
425 | + 'description' => esc_html__('The donor\'s email access link.', 'give'), |
|
426 | 426 | 'function' => 'give_email_tag_email_access_link', |
427 | 427 | 'context' => 'donor', |
428 | 428 | ), |
@@ -430,14 +430,14 @@ discard block |
||
430 | 430 | /* General */ |
431 | 431 | array( |
432 | 432 | 'tag' => 'sitename', |
433 | - 'description' => esc_html__( 'The name of your site.', 'give' ), |
|
433 | + 'description' => esc_html__('The name of your site.', 'give'), |
|
434 | 434 | 'function' => 'give_email_tag_sitename', |
435 | 435 | 'context' => 'general', |
436 | 436 | ), |
437 | 437 | |
438 | 438 | array( |
439 | 439 | 'tag' => 'reset_password_link', |
440 | - 'description' => esc_html__( 'The reset password link for user.', 'give' ), |
|
440 | + 'description' => esc_html__('The reset password link for user.', 'give'), |
|
441 | 441 | 'function' => 'give_email_tag_reset_password_link', |
442 | 442 | 'context' => 'general', |
443 | 443 | ), |
@@ -445,21 +445,21 @@ discard block |
||
445 | 445 | ); |
446 | 446 | |
447 | 447 | // Apply give_email_tags filter |
448 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
448 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
449 | 449 | |
450 | 450 | // Add email tags |
451 | - foreach ( $email_tags as $email_tag ) { |
|
451 | + foreach ($email_tags as $email_tag) { |
|
452 | 452 | give_add_email_tag( |
453 | 453 | $email_tag['tag'], |
454 | 454 | $email_tag['description'], |
455 | 455 | $email_tag['function'], |
456 | - ( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' ) |
|
456 | + ( ! empty($email_tag['context']) ? $email_tag['context'] : '') |
|
457 | 457 | ); |
458 | 458 | } |
459 | 459 | |
460 | 460 | } |
461 | 461 | |
462 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
462 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
@@ -471,24 +471,24 @@ discard block |
||
471 | 471 | * |
472 | 472 | * @return string $firstname |
473 | 473 | */ |
474 | -function give_email_tag_first_name( $tag_args ) { |
|
474 | +function give_email_tag_first_name($tag_args) { |
|
475 | 475 | $user_info = array(); |
476 | 476 | $firstname = ''; |
477 | 477 | |
478 | 478 | // Backward compatibility. |
479 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
479 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
480 | 480 | |
481 | - switch ( true ) { |
|
482 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
483 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
484 | - $email_names = give_get_email_names( $donor_info ); |
|
481 | + switch (true) { |
|
482 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
483 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
484 | + $email_names = give_get_email_names($donor_info); |
|
485 | 485 | $firstname = $email_names['name']; |
486 | 486 | |
487 | 487 | break; |
488 | 488 | |
489 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
489 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
490 | 490 | $firstname = Give()->donor_meta->get_meta( |
491 | - Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ), |
|
491 | + Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']), |
|
492 | 492 | '_give_donor_first_name', |
493 | 493 | true |
494 | 494 | ); |
@@ -499,8 +499,8 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @since 2.0 |
501 | 501 | */ |
502 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
503 | - $firstname = Give()->donor_meta->get_meta( $tag_args['donor_id'], '_give_donor_first_name', true ); |
|
502 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
503 | + $firstname = Give()->donor_meta->get_meta($tag_args['donor_id'], '_give_donor_first_name', true); |
|
504 | 504 | break; |
505 | 505 | } |
506 | 506 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @param string $firstname |
513 | 513 | * @param array $tag_args |
514 | 514 | */ |
515 | - $firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args ); |
|
515 | + $firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args); |
|
516 | 516 | |
517 | 517 | return $firstname; |
518 | 518 | } |
@@ -526,21 +526,21 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @return string $fullname |
528 | 528 | */ |
529 | -function give_email_tag_fullname( $tag_args ) { |
|
529 | +function give_email_tag_fullname($tag_args) { |
|
530 | 530 | $fullname = ''; |
531 | 531 | |
532 | 532 | // Backward compatibility. |
533 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
533 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
534 | 534 | |
535 | - switch ( true ) { |
|
536 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
537 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
538 | - $email_names = give_get_email_names( $donor_info ); |
|
535 | + switch (true) { |
|
536 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
537 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
538 | + $email_names = give_get_email_names($donor_info); |
|
539 | 539 | $fullname = $email_names['fullname']; |
540 | 540 | break; |
541 | 541 | |
542 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
543 | - $fullname = Give()->donors->get_column_by( 'name', 'user_id', $tag_args['user_id'] ); |
|
542 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
543 | + $fullname = Give()->donors->get_column_by('name', 'user_id', $tag_args['user_id']); |
|
544 | 544 | break; |
545 | 545 | |
546 | 546 | /** |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @since 2.0 |
550 | 550 | */ |
551 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
552 | - $fullname = Give()->donors->get_column( 'name', $tag_args['donor_id'] ); |
|
551 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
552 | + $fullname = Give()->donors->get_column('name', $tag_args['donor_id']); |
|
553 | 553 | break; |
554 | 554 | } |
555 | 555 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | * @param string $fullname |
562 | 562 | * @param array $tag_args |
563 | 563 | */ |
564 | - $fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args ); |
|
564 | + $fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args); |
|
565 | 565 | |
566 | 566 | return $fullname; |
567 | 567 | } |
@@ -575,21 +575,21 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @return string username. |
577 | 577 | */ |
578 | -function give_email_tag_username( $tag_args ) { |
|
578 | +function give_email_tag_username($tag_args) { |
|
579 | 579 | $username = ''; |
580 | 580 | |
581 | 581 | // Backward compatibility. |
582 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
582 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
583 | 583 | |
584 | - switch ( true ) { |
|
585 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
586 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
587 | - $email_names = give_get_email_names( $donor_info ); |
|
584 | + switch (true) { |
|
585 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
586 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
587 | + $email_names = give_get_email_names($donor_info); |
|
588 | 588 | $username = $email_names['username']; |
589 | 589 | break; |
590 | 590 | |
591 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
592 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
591 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
592 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
593 | 593 | $username = $user_info->user_login; |
594 | 594 | break; |
595 | 595 | |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @since 2.0 |
600 | 600 | */ |
601 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
602 | - if ( $user_id = Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ) { |
|
603 | - $user_info = get_user_by( 'id', $user_id ); |
|
601 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
602 | + if ($user_id = Give()->donors->get_column('user_id', $tag_args['donor_id'])) { |
|
603 | + $user_info = get_user_by('id', $user_id); |
|
604 | 604 | $username = $user_info->user_login; |
605 | 605 | } |
606 | 606 | break; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * @param string $username |
615 | 615 | * @param array $tag_args |
616 | 616 | */ |
617 | - $username = apply_filters( 'give_email_tag_username', $username, $tag_args ); |
|
617 | + $username = apply_filters('give_email_tag_username', $username, $tag_args); |
|
618 | 618 | |
619 | 619 | return $username; |
620 | 620 | } |
@@ -628,19 +628,19 @@ discard block |
||
628 | 628 | * |
629 | 629 | * @return string user_email |
630 | 630 | */ |
631 | -function give_email_tag_user_email( $tag_args ) { |
|
631 | +function give_email_tag_user_email($tag_args) { |
|
632 | 632 | $email = ''; |
633 | 633 | |
634 | 634 | // Backward compatibility. |
635 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
635 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
636 | 636 | |
637 | - switch ( true ) { |
|
638 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
639 | - $email = give_get_donation_donor_email( $tag_args['payment_id'] ); |
|
637 | + switch (true) { |
|
638 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
639 | + $email = give_get_donation_donor_email($tag_args['payment_id']); |
|
640 | 640 | break; |
641 | 641 | |
642 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
643 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
642 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
643 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
644 | 644 | $email = $user_info->user_email; |
645 | 645 | break; |
646 | 646 | |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | * |
650 | 650 | * @since 2.0 |
651 | 651 | */ |
652 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
653 | - $email = Give()->donors->get_column( 'email', $tag_args['donor_id'] ); |
|
652 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
653 | + $email = Give()->donors->get_column('email', $tag_args['donor_id']); |
|
654 | 654 | break; |
655 | 655 | } |
656 | 656 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | * @param string $email |
663 | 663 | * @param array $tag_args |
664 | 664 | */ |
665 | - $email = apply_filters( 'give_email_tag_user_email', $email, $tag_args ); |
|
665 | + $email = apply_filters('give_email_tag_user_email', $email, $tag_args); |
|
666 | 666 | |
667 | 667 | return $email; |
668 | 668 | } |
@@ -676,22 +676,22 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @return string billing_address |
678 | 678 | */ |
679 | -function give_email_tag_billing_address( $tag_args ) { |
|
679 | +function give_email_tag_billing_address($tag_args) { |
|
680 | 680 | $address = ''; |
681 | 681 | |
682 | 682 | // Backward compatibility. |
683 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
683 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
684 | 684 | |
685 | - switch ( true ) { |
|
686 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
687 | - $donation_address = give_get_donation_address( $tag_args['payment_id'] ); |
|
688 | - $address = $donation_address['line1'] . "\n"; |
|
685 | + switch (true) { |
|
686 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
687 | + $donation_address = give_get_donation_address($tag_args['payment_id']); |
|
688 | + $address = $donation_address['line1']."\n"; |
|
689 | 689 | |
690 | - if ( ! empty( $donation_address['line2'] ) ) { |
|
691 | - $address .= $donation_address['line2'] . "\n"; |
|
690 | + if ( ! empty($donation_address['line2'])) { |
|
691 | + $address .= $donation_address['line2']."\n"; |
|
692 | 692 | } |
693 | 693 | |
694 | - $address .= $donation_address['city'] . ' ' . $donation_address['zip'] . ' ' . $donation_address['state'] . "\n"; |
|
694 | + $address .= $donation_address['city'].' '.$donation_address['zip'].' '.$donation_address['state']."\n"; |
|
695 | 695 | $address .= $donation_address['country']; |
696 | 696 | break; |
697 | 697 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * @param string $address |
705 | 705 | * @param array $tag_args |
706 | 706 | */ |
707 | - $address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args ); |
|
707 | + $address = apply_filters('give_email_tag_billing_address', $address, $tag_args); |
|
708 | 708 | |
709 | 709 | return $address; |
710 | 710 | } |
@@ -718,15 +718,15 @@ discard block |
||
718 | 718 | * |
719 | 719 | * @return string $date Post Date. |
720 | 720 | */ |
721 | -function give_email_tag_date( $tag_args ) { |
|
721 | +function give_email_tag_date($tag_args) { |
|
722 | 722 | $date = ''; |
723 | 723 | |
724 | 724 | // Backward compatibility. |
725 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
725 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
726 | 726 | |
727 | - switch ( true ) { |
|
728 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
729 | - $date = date_i18n( give_date_format(), get_the_date( 'U', $tag_args['payment_id'] ) ); |
|
727 | + switch (true) { |
|
728 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
729 | + $date = date_i18n(give_date_format(), get_the_date('U', $tag_args['payment_id'])); |
|
730 | 730 | break; |
731 | 731 | } |
732 | 732 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * @param string $date |
739 | 739 | * @param array $tag_args |
740 | 740 | */ |
741 | - $date = apply_filters( 'give_email_tag_date', $date, $tag_args ); |
|
741 | + $date = apply_filters('give_email_tag_date', $date, $tag_args); |
|
742 | 742 | |
743 | 743 | return $date; |
744 | 744 | } |
@@ -752,16 +752,16 @@ discard block |
||
752 | 752 | * |
753 | 753 | * @return string amount |
754 | 754 | */ |
755 | -function give_email_tag_amount( $tag_args ) { |
|
755 | +function give_email_tag_amount($tag_args) { |
|
756 | 756 | $amount = ''; |
757 | 757 | |
758 | 758 | // Backward compatibility. |
759 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
759 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
760 | 760 | |
761 | - switch ( true ) { |
|
762 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
763 | - $give_amount = give_donation_amount( $tag_args['payment_id'], true ); |
|
764 | - $amount = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
761 | + switch (true) { |
|
762 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
763 | + $give_amount = give_donation_amount($tag_args['payment_id'], true); |
|
764 | + $amount = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
765 | 765 | break; |
766 | 766 | } |
767 | 767 | |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * @param string $amount |
774 | 774 | * @param array $tag_args |
775 | 775 | */ |
776 | - $amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args ); |
|
776 | + $amount = apply_filters('give_email_tag_amount', $amount, $tag_args); |
|
777 | 777 | |
778 | 778 | return $amount; |
779 | 779 | } |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | * |
788 | 788 | * @return string price |
789 | 789 | */ |
790 | -function give_email_tag_price( $tag_args ) { |
|
791 | - return give_email_tag_amount( $tag_args ); |
|
790 | +function give_email_tag_price($tag_args) { |
|
791 | + return give_email_tag_amount($tag_args); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | /** |
@@ -800,15 +800,15 @@ discard block |
||
800 | 800 | * |
801 | 801 | * @return int payment_id |
802 | 802 | */ |
803 | -function give_email_tag_payment_id( $tag_args ) { |
|
803 | +function give_email_tag_payment_id($tag_args) { |
|
804 | 804 | $payment_id = ''; |
805 | 805 | |
806 | 806 | // Backward compatibility. |
807 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
807 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
808 | 808 | |
809 | - switch ( true ) { |
|
810 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
811 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
809 | + switch (true) { |
|
810 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
811 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
812 | 812 | break; |
813 | 813 | } |
814 | 814 | |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | * @param string $payment_id |
821 | 821 | * @param array $tag_args |
822 | 822 | */ |
823 | - return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args ); |
|
823 | + return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | /** |
@@ -832,15 +832,15 @@ discard block |
||
832 | 832 | * |
833 | 833 | * @return string receipt_id |
834 | 834 | */ |
835 | -function give_email_tag_receipt_id( $tag_args ) { |
|
835 | +function give_email_tag_receipt_id($tag_args) { |
|
836 | 836 | $receipt_id = ''; |
837 | 837 | |
838 | 838 | // Backward compatibility. |
839 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
839 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
840 | 840 | |
841 | - switch ( true ) { |
|
842 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
843 | - $receipt_id = give_get_payment_key( $tag_args['payment_id'] ); |
|
841 | + switch (true) { |
|
842 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
843 | + $receipt_id = give_get_payment_key($tag_args['payment_id']); |
|
844 | 844 | break; |
845 | 845 | } |
846 | 846 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | * @param string $receipt_id |
853 | 853 | * @param array $tag_args |
854 | 854 | */ |
855 | - return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args ); |
|
855 | + return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -864,21 +864,21 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return string $form_title |
866 | 866 | */ |
867 | -function give_email_tag_donation( $tag_args ) { |
|
867 | +function give_email_tag_donation($tag_args) { |
|
868 | 868 | $donation_form_title = ''; |
869 | 869 | |
870 | 870 | // Backward compatibility. |
871 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
871 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
872 | 872 | |
873 | - switch ( true ) { |
|
874 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
875 | - $level_title = give_has_variable_prices( give_get_payment_form_id( $tag_args['payment_id'] ) ); |
|
873 | + switch (true) { |
|
874 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
875 | + $level_title = give_has_variable_prices(give_get_payment_form_id($tag_args['payment_id'])); |
|
876 | 876 | $separator = $level_title ? '-' : ''; |
877 | 877 | $donation_form_title = strip_tags( |
878 | 878 | give_check_variable( |
879 | 879 | give_get_donation_form_title( |
880 | 880 | $tag_args['payment_id'], |
881 | - array( 'separator' => $separator, ) |
|
881 | + array('separator' => $separator,) |
|
882 | 882 | ), |
883 | 883 | 'empty', |
884 | 884 | '' |
@@ -911,15 +911,15 @@ discard block |
||
911 | 911 | * |
912 | 912 | * @return string $form_title |
913 | 913 | */ |
914 | -function give_email_tag_form_title( $tag_args ) { |
|
914 | +function give_email_tag_form_title($tag_args) { |
|
915 | 915 | $donation_form_title = ''; |
916 | 916 | |
917 | 917 | // Backward compatibility. |
918 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
918 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
919 | 919 | |
920 | - switch ( true ) { |
|
921 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
922 | - $donation_form_title = give_get_payment_meta( $tag_args['payment_id'], '_give_payment_form_title' ); |
|
920 | + switch (true) { |
|
921 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
922 | + $donation_form_title = give_get_payment_meta($tag_args['payment_id'], '_give_payment_form_title'); |
|
923 | 923 | break; |
924 | 924 | } |
925 | 925 | |
@@ -948,15 +948,15 @@ discard block |
||
948 | 948 | * |
949 | 949 | * @return string $company_name |
950 | 950 | */ |
951 | -function give_email_tag_company_name( $tag_args ) { |
|
951 | +function give_email_tag_company_name($tag_args) { |
|
952 | 952 | $company_name = ''; |
953 | 953 | |
954 | 954 | // Backward compatibility. |
955 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
955 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
956 | 956 | |
957 | - switch ( true ) { |
|
958 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
959 | - $company_name = give_get_payment_meta( $tag_args['payment_id'], '_give_donation_company', true ); |
|
957 | + switch (true) { |
|
958 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
959 | + $company_name = give_get_payment_meta($tag_args['payment_id'], '_give_donation_company', true); |
|
960 | 960 | break; |
961 | 961 | } |
962 | 962 | |
@@ -984,18 +984,18 @@ discard block |
||
984 | 984 | * |
985 | 985 | * @return string gateway |
986 | 986 | */ |
987 | -function give_email_tag_payment_method( $tag_args ) { |
|
987 | +function give_email_tag_payment_method($tag_args) { |
|
988 | 988 | $payment_method = ''; |
989 | 989 | |
990 | 990 | // Backward compatibility. |
991 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
991 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
992 | 992 | |
993 | 993 | // Backward compatibility. |
994 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
994 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
995 | 995 | |
996 | - switch ( true ) { |
|
997 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
998 | - $payment_method = give_get_gateway_checkout_label( give_get_payment_gateway( $tag_args['payment_id'] ) ); |
|
996 | + switch (true) { |
|
997 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
998 | + $payment_method = give_get_gateway_checkout_label(give_get_payment_gateway($tag_args['payment_id'])); |
|
999 | 999 | break; |
1000 | 1000 | } |
1001 | 1001 | |
@@ -1026,15 +1026,15 @@ discard block |
||
1026 | 1026 | * |
1027 | 1027 | * @return string |
1028 | 1028 | */ |
1029 | -function give_email_tag_payment_total( $tag_args ) { |
|
1029 | +function give_email_tag_payment_total($tag_args) { |
|
1030 | 1030 | $payment_total = ''; |
1031 | 1031 | |
1032 | 1032 | // Backward compatibility. |
1033 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1033 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1034 | 1034 | |
1035 | - switch ( true ) { |
|
1036 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1037 | - $payment_total = give_currency_filter( give_get_payment_total( $tag_args['payment_id'] ) ); |
|
1035 | + switch (true) { |
|
1036 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1037 | + $payment_total = give_currency_filter(give_get_payment_total($tag_args['payment_id'])); |
|
1038 | 1038 | break; |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1062,11 +1062,11 @@ discard block |
||
1062 | 1062 | * |
1063 | 1063 | * @return string |
1064 | 1064 | */ |
1065 | -function give_email_tag_sitename( $tag_args = array() ) { |
|
1066 | - $sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
1065 | +function give_email_tag_sitename($tag_args = array()) { |
|
1066 | + $sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
1067 | 1067 | |
1068 | 1068 | // Backward compatibility. |
1069 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1069 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * Filter the {sitename} email template tag output. |
@@ -1092,26 +1092,26 @@ discard block |
||
1092 | 1092 | * |
1093 | 1093 | * @return string receipt_link |
1094 | 1094 | */ |
1095 | -function give_email_tag_receipt_link( $tag_args ) { |
|
1095 | +function give_email_tag_receipt_link($tag_args) { |
|
1096 | 1096 | // Backward compatibility. |
1097 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1097 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1098 | 1098 | |
1099 | - $receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1099 | + $receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1100 | 1100 | |
1101 | 1101 | // Bailout. |
1102 | - if ( give_get_option( 'email_template' ) === 'none' ) { |
|
1102 | + if (give_get_option('email_template') === 'none') { |
|
1103 | 1103 | return $receipt_url; |
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | |
1107 | - $receipt_url = esc_url( add_query_arg( array( |
|
1108 | - 'payment_key' => give_get_payment_key( $tag_args['payment_id'] ), |
|
1109 | - ), give_get_history_page_uri() ) ); |
|
1107 | + $receipt_url = esc_url(add_query_arg(array( |
|
1108 | + 'payment_key' => give_get_payment_key($tag_args['payment_id']), |
|
1109 | + ), give_get_history_page_uri())); |
|
1110 | 1110 | |
1111 | 1111 | $formatted = sprintf( |
1112 | 1112 | '<a href="%1$s">%2$s</a>', |
1113 | 1113 | $receipt_url, |
1114 | - __( 'View it in your browser »', 'give' ) |
|
1114 | + __('View it in your browser »', 'give') |
|
1115 | 1115 | ); |
1116 | 1116 | |
1117 | 1117 | /** |
@@ -1140,11 +1140,11 @@ discard block |
||
1140 | 1140 | * |
1141 | 1141 | * @return string receipt_url |
1142 | 1142 | */ |
1143 | -function give_email_tag_receipt_link_url( $tag_args ) { |
|
1143 | +function give_email_tag_receipt_link_url($tag_args) { |
|
1144 | 1144 | // Backward compatibility. |
1145 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1145 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1146 | 1146 | |
1147 | - $receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1147 | + $receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1148 | 1148 | |
1149 | 1149 | /** |
1150 | 1150 | * Filter the {receipt_link_url} email template tag output. |
@@ -1171,13 +1171,13 @@ discard block |
||
1171 | 1171 | * |
1172 | 1172 | * @return string |
1173 | 1173 | */ |
1174 | -function give_get_receipt_url( $payment_id ) { |
|
1174 | +function give_get_receipt_url($payment_id) { |
|
1175 | 1175 | $receipt_url = ''; |
1176 | 1176 | |
1177 | - if ( $payment_id ) { |
|
1178 | - $receipt_url = esc_url( add_query_arg( array( |
|
1179 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
1180 | - ), give_get_history_page_uri() ) ); |
|
1177 | + if ($payment_id) { |
|
1178 | + $receipt_url = esc_url(add_query_arg(array( |
|
1179 | + 'payment_key' => give_get_payment_key($payment_id), |
|
1180 | + ), give_get_history_page_uri())); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | return $receipt_url; |
@@ -1193,22 +1193,22 @@ discard block |
||
1193 | 1193 | * |
1194 | 1194 | * @return string |
1195 | 1195 | */ |
1196 | -function give_email_tag_email_access_link( $tag_args ) { |
|
1196 | +function give_email_tag_email_access_link($tag_args) { |
|
1197 | 1197 | $donor_id = 0; |
1198 | 1198 | $donor = array(); |
1199 | 1199 | $email_access_link = ''; |
1200 | 1200 | |
1201 | 1201 | // Backward compatibility. |
1202 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1202 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1203 | 1203 | |
1204 | - switch ( true ) { |
|
1205 | - case ! empty( $tag_args['donor_id'] ): |
|
1204 | + switch (true) { |
|
1205 | + case ! empty($tag_args['donor_id']): |
|
1206 | 1206 | $donor_id = $tag_args['donor_id']; |
1207 | - $donor = Give()->donors->get_by( 'id', $tag_args['donor_id'] ); |
|
1207 | + $donor = Give()->donors->get_by('id', $tag_args['donor_id']); |
|
1208 | 1208 | break; |
1209 | 1209 | |
1210 | - case ! empty( $tag_args['user_id'] ): |
|
1211 | - $donor = Give()->donors->get_by( 'user_id', $tag_args['user_id'] ); |
|
1210 | + case ! empty($tag_args['user_id']): |
|
1211 | + $donor = Give()->donors->get_by('user_id', $tag_args['user_id']); |
|
1212 | 1212 | $donor_id = $donor->id; |
1213 | 1213 | break; |
1214 | 1214 | |
@@ -1217,11 +1217,11 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | // Set email access link if donor exist. |
1220 | - if ( $donor_id ) { |
|
1221 | - $verify_key = wp_generate_password( 20, false ); |
|
1220 | + if ($donor_id) { |
|
1221 | + $verify_key = wp_generate_password(20, false); |
|
1222 | 1222 | |
1223 | 1223 | // Generate a new verify key |
1224 | - Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key ); |
|
1224 | + Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key); |
|
1225 | 1225 | |
1226 | 1226 | $access_url = add_query_arg( |
1227 | 1227 | array( |
@@ -1231,28 +1231,28 @@ discard block |
||
1231 | 1231 | ); |
1232 | 1232 | |
1233 | 1233 | // Add Payment Key to email access url, if it exists. |
1234 | - if ( ! empty( $_GET['payment_key'] ) ) { |
|
1234 | + if ( ! empty($_GET['payment_key'])) { |
|
1235 | 1235 | $access_url = add_query_arg( |
1236 | 1236 | array( |
1237 | - 'payment_key' => give_clean( $_GET['payment_key'] ), |
|
1237 | + 'payment_key' => give_clean($_GET['payment_key']), |
|
1238 | 1238 | ), |
1239 | 1239 | $access_url |
1240 | 1240 | ); |
1241 | 1241 | } |
1242 | 1242 | |
1243 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1243 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1244 | 1244 | $email_access_link = sprintf( |
1245 | 1245 | '<a href="%1$s" target="_blank">%2$s</a>', |
1246 | - esc_url( $access_url ), |
|
1247 | - __( 'View your donation history »', 'give' ) |
|
1246 | + esc_url($access_url), |
|
1247 | + __('View your donation history »', 'give') |
|
1248 | 1248 | ); |
1249 | 1249 | |
1250 | 1250 | } else { |
1251 | 1251 | |
1252 | 1252 | $email_access_link = sprintf( |
1253 | 1253 | '%1$s: %2$s', |
1254 | - __( 'View your donation history', 'give' ), |
|
1255 | - esc_url( $access_url ) |
|
1254 | + __('View your donation history', 'give'), |
|
1255 | + esc_url($access_url) |
|
1256 | 1256 | ); |
1257 | 1257 | } |
1258 | 1258 | } |
@@ -1284,23 +1284,23 @@ discard block |
||
1284 | 1284 | * |
1285 | 1285 | * @return array |
1286 | 1286 | */ |
1287 | -function __give_20_bc_str_type_email_tag_param( $tag_args ) { |
|
1288 | - if ( ! is_array( $tag_args ) ) { |
|
1289 | - switch ( true ) { |
|
1290 | - case ( 'give_payment' === get_post_type( $tag_args ) ): |
|
1291 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
1287 | +function __give_20_bc_str_type_email_tag_param($tag_args) { |
|
1288 | + if ( ! is_array($tag_args)) { |
|
1289 | + switch (true) { |
|
1290 | + case ('give_payment' === get_post_type($tag_args)): |
|
1291 | + $tag_args = array('payment_id' => $tag_args); |
|
1292 | 1292 | break; |
1293 | 1293 | |
1294 | - case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ): |
|
1295 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1294 | + case ( ! is_wp_error(get_user_by('id', $tag_args))): |
|
1295 | + $tag_args = array('user_id' => $tag_args); |
|
1296 | 1296 | break; |
1297 | 1297 | |
1298 | - case ( Give()->donors->get_by( 'id', $tag_args ) ): |
|
1299 | - $tag_args = array( 'donor_id' => $tag_args ); |
|
1298 | + case (Give()->donors->get_by('id', $tag_args)): |
|
1299 | + $tag_args = array('donor_id' => $tag_args); |
|
1300 | 1300 | break; |
1301 | 1301 | |
1302 | - case ( Give()->donors->get_by( 'user_id', $tag_args ) ): |
|
1303 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1302 | + case (Give()->donors->get_by('user_id', $tag_args)): |
|
1303 | + $tag_args = array('user_id' => $tag_args); |
|
1304 | 1304 | break; |
1305 | 1305 | } |
1306 | 1306 | } |
@@ -1318,36 +1318,36 @@ discard block |
||
1318 | 1318 | * |
1319 | 1319 | * @return array |
1320 | 1320 | */ |
1321 | -function give_email_tag_reset_password_link( $tag_args, $payment_id ) { |
|
1321 | +function give_email_tag_reset_password_link($tag_args, $payment_id) { |
|
1322 | 1322 | |
1323 | 1323 | $reset_password_url = ''; |
1324 | 1324 | |
1325 | - switch ( true ) { |
|
1326 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1327 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
1325 | + switch (true) { |
|
1326 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1327 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
1328 | 1328 | break; |
1329 | 1329 | |
1330 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
1331 | - $reset_password_url = give_get_reset_password_url( $tag_args['user_id'] ); |
|
1330 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
1331 | + $reset_password_url = give_get_reset_password_url($tag_args['user_id']); |
|
1332 | 1332 | break; |
1333 | 1333 | |
1334 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
1335 | - $reset_password_url = give_get_reset_password_url( Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ); |
|
1334 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
1335 | + $reset_password_url = give_get_reset_password_url(Give()->donors->get_column('user_id', $tag_args['donor_id'])); |
|
1336 | 1336 | break; |
1337 | 1337 | } |
1338 | 1338 | |
1339 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1339 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1340 | 1340 | // Generate link, if Email content type is html. |
1341 | 1341 | $reset_password_link = sprintf( |
1342 | 1342 | '<a href="%1$s" target="_blank">%2$s</a>', |
1343 | - esc_url( $reset_password_url ), |
|
1344 | - __( 'Reset your password »', 'give' ) |
|
1343 | + esc_url($reset_password_url), |
|
1344 | + __('Reset your password »', 'give') |
|
1345 | 1345 | ); |
1346 | 1346 | } else { |
1347 | 1347 | $reset_password_link = sprintf( |
1348 | 1348 | '%1$s: %2$s', |
1349 | - __( 'Reset your password', 'give' ), |
|
1350 | - esc_url( $reset_password_url ) |
|
1349 | + __('Reset your password', 'give'), |
|
1350 | + esc_url($reset_password_url) |
|
1351 | 1351 | ); |
1352 | 1352 | } |
1353 | 1353 | |
@@ -1376,21 +1376,21 @@ discard block |
||
1376 | 1376 | * |
1377 | 1377 | * @return mixed|string |
1378 | 1378 | */ |
1379 | -function give_get_reset_password_url( $user_id ) { |
|
1379 | +function give_get_reset_password_url($user_id) { |
|
1380 | 1380 | $reset_password_url = ''; |
1381 | 1381 | |
1382 | 1382 | // Proceed further only, if user_id exists. |
1383 | - if ( $user_id ) { |
|
1383 | + if ($user_id) { |
|
1384 | 1384 | |
1385 | 1385 | // Get User Object Details. |
1386 | - $user = get_user_by( 'ID', $user_id ); |
|
1386 | + $user = get_user_by('ID', $user_id); |
|
1387 | 1387 | |
1388 | 1388 | // Prepare Reset Password URL. |
1389 | - $reset_password_url = esc_url( add_query_arg( array( |
|
1389 | + $reset_password_url = esc_url(add_query_arg(array( |
|
1390 | 1390 | 'action' => 'rp', |
1391 | - 'key' => get_password_reset_key( $user ), |
|
1391 | + 'key' => get_password_reset_key($user), |
|
1392 | 1392 | 'login' => $user->user_login, |
1393 | - ), wp_login_url() ) ); |
|
1393 | + ), wp_login_url())); |
|
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | return $reset_password_url; |
@@ -1409,94 +1409,94 @@ discard block |
||
1409 | 1409 | * |
1410 | 1410 | * @return mixed |
1411 | 1411 | */ |
1412 | -function __give_render_metadata_email_tag( $content, $tag_args ) { |
|
1413 | - preg_match_all( "/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches ); |
|
1412 | +function __give_render_metadata_email_tag($content, $tag_args) { |
|
1413 | + preg_match_all("/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches); |
|
1414 | 1414 | |
1415 | - if ( ! empty( $matches[0] ) ) { |
|
1415 | + if ( ! empty($matches[0])) { |
|
1416 | 1416 | $search = $replace = array(); |
1417 | - foreach ( $matches[0] as $index => $meta_tag ) { |
|
1418 | - if ( in_array( $meta_tag, $search ) ) { |
|
1417 | + foreach ($matches[0] as $index => $meta_tag) { |
|
1418 | + if (in_array($meta_tag, $search)) { |
|
1419 | 1419 | continue; |
1420 | 1420 | } |
1421 | 1421 | |
1422 | 1422 | $search[] = $meta_tag; |
1423 | 1423 | |
1424 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1425 | - $meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) ); |
|
1426 | - $meta_tag = current( $meta_tag_arr ); |
|
1424 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1425 | + $meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2)); |
|
1426 | + $meta_tag = current($meta_tag_arr); |
|
1427 | 1427 | |
1428 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1429 | - $type = current( explode( '_', $meta_tag, 2 ) ); |
|
1430 | - $meta_name = preg_replace( "/^{$type}_/", '', $meta_tag ); |
|
1428 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1429 | + $type = current(explode('_', $meta_tag, 2)); |
|
1430 | + $meta_name = preg_replace("/^{$type}_/", '', $meta_tag); |
|
1431 | 1431 | |
1432 | - switch ( $type ) { |
|
1432 | + switch ($type) { |
|
1433 | 1433 | case 'donation': |
1434 | 1434 | |
1435 | 1435 | //Bailout. |
1436 | - if ( ! isset( $tag_args['payment_id'] ) ) { |
|
1436 | + if ( ! isset($tag_args['payment_id'])) { |
|
1437 | 1437 | $replace[] = ''; |
1438 | 1438 | continue; |
1439 | 1439 | } |
1440 | 1440 | |
1441 | - $meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' ); |
|
1441 | + $meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, ''); |
|
1442 | 1442 | |
1443 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1443 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1444 | 1444 | $replace[] = $meta_data; |
1445 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1446 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1445 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1446 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | 1449 | break; |
1450 | 1450 | |
1451 | 1451 | case 'form': |
1452 | - $form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0; |
|
1452 | + $form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0; |
|
1453 | 1453 | |
1454 | 1454 | // Bailout. |
1455 | - if ( ! $form_id && isset( $tag_args['payment_id'] ) ) { |
|
1456 | - $form_id = give_get_payment_form_id( $tag_args['payment_id'] ); |
|
1455 | + if ( ! $form_id && isset($tag_args['payment_id'])) { |
|
1456 | + $form_id = give_get_payment_form_id($tag_args['payment_id']); |
|
1457 | 1457 | } |
1458 | 1458 | |
1459 | - $meta_data = give_get_meta( $form_id, $meta_name, true, '' ); |
|
1460 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1459 | + $meta_data = give_get_meta($form_id, $meta_name, true, ''); |
|
1460 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1461 | 1461 | $replace[] = $meta_data; |
1462 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1463 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1462 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1463 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1464 | 1464 | } |
1465 | 1465 | break; |
1466 | 1466 | |
1467 | 1467 | case 'donor': |
1468 | - $donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0; |
|
1468 | + $donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0; |
|
1469 | 1469 | |
1470 | 1470 | // Bailout. |
1471 | - if ( ! $donor_id ) { |
|
1472 | - if ( isset( $tag_args['payment_id'] ) ) { |
|
1473 | - $donor_id = give_get_payment_donor_id( $tag_args['payment_id'] ); |
|
1474 | - } elseif ( isset( $tag_args['user_id'] ) ) { |
|
1475 | - $donor_id = Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ); |
|
1471 | + if ( ! $donor_id) { |
|
1472 | + if (isset($tag_args['payment_id'])) { |
|
1473 | + $donor_id = give_get_payment_donor_id($tag_args['payment_id']); |
|
1474 | + } elseif (isset($tag_args['user_id'])) { |
|
1475 | + $donor_id = Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']); |
|
1476 | 1476 | } |
1477 | 1477 | } |
1478 | 1478 | |
1479 | - $meta_data = Give()->donor_meta->get_meta( $donor_id, $meta_name, true ); |
|
1479 | + $meta_data = Give()->donor_meta->get_meta($donor_id, $meta_name, true); |
|
1480 | 1480 | |
1481 | - if( empty( $meta_data ) && in_array( $meta_name, array_keys( Give()->donors->get_columns() ) ) ) { |
|
1482 | - $meta_data = Give()->donors->get_column_by( $meta_name, 'id', $donor_id ); |
|
1481 | + if (empty($meta_data) && in_array($meta_name, array_keys(Give()->donors->get_columns()))) { |
|
1482 | + $meta_data = Give()->donors->get_column_by($meta_name, 'id', $donor_id); |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1485 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1486 | 1486 | $replace[] = $meta_data; |
1487 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1488 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1487 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1488 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1489 | 1489 | } |
1490 | 1490 | |
1491 | 1491 | break; |
1492 | 1492 | |
1493 | 1493 | default: |
1494 | - $replace[] = end( $search ); |
|
1494 | + $replace[] = end($search); |
|
1495 | 1495 | } |
1496 | 1496 | } |
1497 | 1497 | |
1498 | - if ( ! empty( $search ) && ! empty( $replace ) ) { |
|
1499 | - $content = str_replace( $search, $replace, $content ); |
|
1498 | + if ( ! empty($search) && ! empty($replace)) { |
|
1499 | + $content = str_replace($search, $replace, $content); |
|
1500 | 1500 | } |
1501 | 1501 | } |
1502 | 1502 | |
@@ -1504,4 +1504,4 @@ discard block |
||
1504 | 1504 | return $content; |
1505 | 1505 | } |
1506 | 1506 | |
1507 | -add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 ); |
|
1507 | +add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 10, 2); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | * @param int|bool $_id Post id. Default is false. |
349 | 349 | * @param array $_args Arguments passed. |
350 | 350 | */ |
351 | - public function __construct( $_id = false, $_args = array() ) { |
|
351 | + public function __construct($_id = false, $_args = array()) { |
|
352 | 352 | |
353 | - $donation_form = WP_Post::get_instance( $_id ); |
|
353 | + $donation_form = WP_Post::get_instance($_id); |
|
354 | 354 | |
355 | - return $this->setup_donation_form( $donation_form ); |
|
355 | + return $this->setup_donation_form($donation_form); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -365,23 +365,23 @@ discard block |
||
365 | 365 | * |
366 | 366 | * @return bool If the setup was successful or not. |
367 | 367 | */ |
368 | - private function setup_donation_form( $donation_form ) { |
|
368 | + private function setup_donation_form($donation_form) { |
|
369 | 369 | |
370 | - if ( ! is_object( $donation_form ) ) { |
|
370 | + if ( ! is_object($donation_form)) { |
|
371 | 371 | return false; |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
374 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
375 | 375 | return false; |
376 | 376 | } |
377 | 377 | |
378 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
378 | + if ('give_forms' !== $donation_form->post_type) { |
|
379 | 379 | return false; |
380 | 380 | } |
381 | 381 | |
382 | - foreach ( $donation_form as $key => $value ) { |
|
382 | + foreach ($donation_form as $key => $value) { |
|
383 | 383 | |
384 | - switch ( $key ) { |
|
384 | + switch ($key) { |
|
385 | 385 | |
386 | 386 | default: |
387 | 387 | $this->$key = $value; |
@@ -405,16 +405,16 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @return mixed |
407 | 407 | */ |
408 | - public function __get( $key ) { |
|
408 | + public function __get($key) { |
|
409 | 409 | |
410 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
410 | + if (method_exists($this, 'get_'.$key)) { |
|
411 | 411 | |
412 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
412 | + return call_user_func(array($this, 'get_'.$key)); |
|
413 | 413 | |
414 | 414 | } else { |
415 | 415 | |
416 | 416 | /* translators: %s: property key */ |
417 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
417 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
418 | 418 | |
419 | 419 | } |
420 | 420 | |
@@ -430,30 +430,30 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
432 | 432 | */ |
433 | - public function create( $data = array() ) { |
|
433 | + public function create($data = array()) { |
|
434 | 434 | |
435 | - if ( $this->id != 0 ) { |
|
435 | + if ($this->id != 0) { |
|
436 | 436 | return false; |
437 | 437 | } |
438 | 438 | |
439 | 439 | $defaults = array( |
440 | 440 | 'post_type' => 'give_forms', |
441 | 441 | 'post_status' => 'draft', |
442 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
442 | + 'post_title' => __('New Donation Form', 'give'), |
|
443 | 443 | ); |
444 | 444 | |
445 | - $args = wp_parse_args( $data, $defaults ); |
|
445 | + $args = wp_parse_args($data, $defaults); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Fired before a donation form is created |
449 | 449 | * |
450 | 450 | * @param array $args The post object arguments used for creation. |
451 | 451 | */ |
452 | - do_action( 'give_form_pre_create', $args ); |
|
452 | + do_action('give_form_pre_create', $args); |
|
453 | 453 | |
454 | - $id = wp_insert_post( $args, true ); |
|
454 | + $id = wp_insert_post($args, true); |
|
455 | 455 | |
456 | - $donation_form = WP_Post::get_instance( $id ); |
|
456 | + $donation_form = WP_Post::get_instance($id); |
|
457 | 457 | |
458 | 458 | /** |
459 | 459 | * Fired after a donation form is created |
@@ -461,9 +461,9 @@ discard block |
||
461 | 461 | * @param int $id The post ID of the created item. |
462 | 462 | * @param array $args The post object arguments used for creation. |
463 | 463 | */ |
464 | - do_action( 'give_form_post_create', $id, $args ); |
|
464 | + do_action('give_form_post_create', $id, $args); |
|
465 | 465 | |
466 | - return $this->setup_donation_form( $donation_form ); |
|
466 | + return $this->setup_donation_form($donation_form); |
|
467 | 467 | |
468 | 468 | } |
469 | 469 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @return string Donation form name. |
489 | 489 | */ |
490 | 490 | public function get_name() { |
491 | - return get_the_title( $this->ID ); |
|
491 | + return get_the_title($this->ID); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | /** |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | */ |
502 | 502 | public function get_price() { |
503 | 503 | |
504 | - if ( ! isset( $this->price ) ) { |
|
504 | + if ( ! isset($this->price)) { |
|
505 | 505 | |
506 | 506 | $this->price = give_maybe_sanitize_amount( |
507 | 507 | give_get_meta( |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | ) |
512 | 512 | ); |
513 | 513 | |
514 | - if ( ! $this->price ) { |
|
514 | + if ( ! $this->price) { |
|
515 | 515 | $this->price = 0; |
516 | 516 | } |
517 | 517 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @param string $price The donation form price. |
526 | 526 | * @param string|int $id The form ID. |
527 | 527 | */ |
528 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
528 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -538,22 +538,22 @@ discard block |
||
538 | 538 | */ |
539 | 539 | public function get_minimum_price() { |
540 | 540 | |
541 | - if ( ! isset( $this->minimum_price ) ) { |
|
541 | + if ( ! isset($this->minimum_price)) { |
|
542 | 542 | |
543 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_range_minimum', true ); |
|
543 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_range_minimum', true); |
|
544 | 544 | |
545 | 545 | // Give backward < 2.1 |
546 | - if ( empty( $this->minimum_price ) ) { |
|
547 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
546 | + if (empty($this->minimum_price)) { |
|
547 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true); |
|
548 | 548 | } |
549 | 549 | |
550 | - if ( ! $this->is_custom_price_mode() ) { |
|
551 | - $this->minimum_price = give_get_lowest_price_option( $this->ID ); |
|
550 | + if ( ! $this->is_custom_price_mode()) { |
|
551 | + $this->minimum_price = give_get_lowest_price_option($this->ID); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | } |
555 | 555 | |
556 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
556 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
@@ -566,15 +566,15 @@ discard block |
||
566 | 566 | */ |
567 | 567 | public function get_maximum_price() { |
568 | 568 | |
569 | - if ( ! isset( $this->maximum_price ) ) { |
|
570 | - $this->maximum_price = give_get_meta( $this->ID, '_give_custom_amount_range_maximum', true, 999999.99 ); |
|
569 | + if ( ! isset($this->maximum_price)) { |
|
570 | + $this->maximum_price = give_get_meta($this->ID, '_give_custom_amount_range_maximum', true, 999999.99); |
|
571 | 571 | |
572 | - if ( ! $this->is_custom_price_mode() ) { |
|
573 | - $this->maximum_price = give_get_highest_price_option( $this->ID ); |
|
572 | + if ( ! $this->is_custom_price_mode()) { |
|
573 | + $this->maximum_price = give_get_highest_price_option($this->ID); |
|
574 | 574 | } |
575 | 575 | } |
576 | 576 | |
577 | - return apply_filters( 'give_get_set_maximum_price', $this->maximum_price, $this->ID ); |
|
577 | + return apply_filters('give_get_set_maximum_price', $this->maximum_price, $this->ID); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | /** |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | */ |
588 | 588 | public function get_prices() { |
589 | 589 | |
590 | - if ( ! isset( $this->prices ) ) { |
|
590 | + if ( ! isset($this->prices)) { |
|
591 | 591 | |
592 | - $this->prices = give_get_meta( $this->ID, '_give_donation_levels', true ); |
|
592 | + $this->prices = give_get_meta($this->ID, '_give_donation_levels', true); |
|
593 | 593 | |
594 | 594 | } |
595 | 595 | |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | * @param array $prices The array of mulit-level prices. |
602 | 602 | * @param int|string $ID The ID of the form. |
603 | 603 | */ |
604 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
604 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
605 | 605 | |
606 | 606 | } |
607 | 607 | |
@@ -615,18 +615,18 @@ discard block |
||
615 | 615 | * |
616 | 616 | * @return array|null |
617 | 617 | */ |
618 | - public function get_level_info( $price_id ) { |
|
618 | + public function get_level_info($price_id) { |
|
619 | 619 | $level_info = array(); |
620 | 620 | |
621 | 621 | // Bailout. |
622 | - if ( 'multi' !== $this->get_type() ) { |
|
622 | + if ('multi' !== $this->get_type()) { |
|
623 | 623 | return null; |
624 | - } elseif ( ! ( $levels = $this->get_prices() ) ) { |
|
624 | + } elseif ( ! ($levels = $this->get_prices())) { |
|
625 | 625 | return $level_info; |
626 | 626 | } |
627 | 627 | |
628 | - foreach ( $levels as $level ) { |
|
629 | - if ( $price_id === $level['_give_id']['level_id'] ) { |
|
628 | + foreach ($levels as $level) { |
|
629 | + if ($price_id === $level['_give_id']['level_id']) { |
|
630 | 630 | $level_info = $level; |
631 | 631 | break; |
632 | 632 | } |
@@ -646,25 +646,25 @@ discard block |
||
646 | 646 | */ |
647 | 647 | public function get_goal() { |
648 | 648 | |
649 | - if ( ! isset( $this->goal ) ) { |
|
649 | + if ( ! isset($this->goal)) { |
|
650 | 650 | |
651 | - $goal_format = give_get_form_goal_format( $this->ID ); |
|
651 | + $goal_format = give_get_form_goal_format($this->ID); |
|
652 | 652 | |
653 | - if ( 'donation' === $goal_format ) { |
|
654 | - $this->goal = give_get_meta( $this->ID, '_give_number_of_donation_goal', true ); |
|
655 | - } elseif ( 'donors' === $goal_format ) { |
|
656 | - $this->goal = give_get_meta( $this->ID, '_give_number_of_donor_goal', true ); |
|
653 | + if ('donation' === $goal_format) { |
|
654 | + $this->goal = give_get_meta($this->ID, '_give_number_of_donation_goal', true); |
|
655 | + } elseif ('donors' === $goal_format) { |
|
656 | + $this->goal = give_get_meta($this->ID, '_give_number_of_donor_goal', true); |
|
657 | 657 | } else { |
658 | - $this->goal = give_get_meta( $this->ID, '_give_set_goal', true ); |
|
658 | + $this->goal = give_get_meta($this->ID, '_give_set_goal', true); |
|
659 | 659 | } |
660 | 660 | |
661 | - if ( ! $this->goal ) { |
|
661 | + if ( ! $this->goal) { |
|
662 | 662 | $this->goal = 0; |
663 | 663 | } |
664 | 664 | |
665 | 665 | } |
666 | 666 | |
667 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
667 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
668 | 668 | |
669 | 669 | } |
670 | 670 | |
@@ -678,10 +678,10 @@ discard block |
||
678 | 678 | */ |
679 | 679 | public function is_single_price_mode() { |
680 | 680 | |
681 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
681 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
682 | 682 | $ret = 0; |
683 | 683 | |
684 | - if ( empty( $option ) || $option === 'set' ) { |
|
684 | + if (empty($option) || $option === 'set') { |
|
685 | 685 | $ret = 1; |
686 | 686 | } |
687 | 687 | |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | * @param bool $ret Is donation form in single price mode? |
694 | 694 | * @param int|string $ID The ID of the donation form. |
695 | 695 | */ |
696 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
696 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
697 | 697 | |
698 | 698 | } |
699 | 699 | |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | */ |
708 | 708 | public function is_custom_price_mode() { |
709 | 709 | |
710 | - $option = give_get_meta( $this->ID, '_give_custom_amount', true ); |
|
710 | + $option = give_get_meta($this->ID, '_give_custom_amount', true); |
|
711 | 711 | $ret = 0; |
712 | 712 | |
713 | - if ( give_is_setting_enabled( $option ) ) { |
|
713 | + if (give_is_setting_enabled($option)) { |
|
714 | 714 | $ret = 1; |
715 | 715 | } |
716 | 716 | |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * @param bool $ret Is donation form in custom price mode? |
723 | 723 | * @param int|string $ID The ID of the donation form. |
724 | 724 | */ |
725 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
725 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
726 | 726 | |
727 | 727 | } |
728 | 728 | |
@@ -736,20 +736,20 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @return bool |
738 | 738 | */ |
739 | - public function is_custom_price( $amount ) { |
|
739 | + public function is_custom_price($amount) { |
|
740 | 740 | $result = false; |
741 | - $amount = give_maybe_sanitize_amount( $amount ); |
|
741 | + $amount = give_maybe_sanitize_amount($amount); |
|
742 | 742 | |
743 | - if ( $this->is_custom_price_mode() ) { |
|
743 | + if ($this->is_custom_price_mode()) { |
|
744 | 744 | |
745 | - if ( 'set' === $this->get_type() ) { |
|
746 | - if ( $amount !== $this->get_price() ) { |
|
745 | + if ('set' === $this->get_type()) { |
|
746 | + if ($amount !== $this->get_price()) { |
|
747 | 747 | $result = true; |
748 | 748 | } |
749 | 749 | |
750 | - } elseif ( 'multi' === $this->get_type() ) { |
|
751 | - $level_amounts = array_map( 'give_maybe_sanitize_amount', wp_list_pluck( $this->get_prices(), '_give_amount' ) ); |
|
752 | - $result = ! in_array( $amount, $level_amounts ); |
|
750 | + } elseif ('multi' === $this->get_type()) { |
|
751 | + $level_amounts = array_map('give_maybe_sanitize_amount', wp_list_pluck($this->get_prices(), '_give_amount')); |
|
752 | + $result = ! in_array($amount, $level_amounts); |
|
753 | 753 | } |
754 | 754 | } |
755 | 755 | |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * |
763 | 763 | * @since 1.8.18 |
764 | 764 | */ |
765 | - return (bool) apply_filters( 'give_is_custom_price', $result, $amount, $this->ID ); |
|
765 | + return (bool) apply_filters('give_is_custom_price', $result, $amount, $this->ID); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
@@ -777,10 +777,10 @@ discard block |
||
777 | 777 | */ |
778 | 778 | public function has_variable_prices() { |
779 | 779 | |
780 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
780 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
781 | 781 | $ret = 0; |
782 | 782 | |
783 | - if ( $option === 'multi' ) { |
|
783 | + if ($option === 'multi') { |
|
784 | 784 | $ret = 1; |
785 | 785 | } |
786 | 786 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | * @param bool $ret Does donation form have variable prices? |
791 | 791 | * @param int|string $ID The ID of the donation form. |
792 | 792 | */ |
793 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
793 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
794 | 794 | |
795 | 795 | } |
796 | 796 | |
@@ -804,17 +804,17 @@ discard block |
||
804 | 804 | */ |
805 | 805 | public function get_type() { |
806 | 806 | |
807 | - if ( ! isset( $this->type ) ) { |
|
807 | + if ( ! isset($this->type)) { |
|
808 | 808 | |
809 | - $this->type = give_get_meta( $this->ID, '_give_price_option', true ); |
|
809 | + $this->type = give_get_meta($this->ID, '_give_price_option', true); |
|
810 | 810 | |
811 | - if ( empty( $this->type ) ) { |
|
811 | + if (empty($this->type)) { |
|
812 | 812 | $this->type = 'set'; |
813 | 813 | } |
814 | 814 | |
815 | 815 | } |
816 | 816 | |
817 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
817 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
818 | 818 | |
819 | 819 | } |
820 | 820 | |
@@ -830,23 +830,23 @@ discard block |
||
830 | 830 | * |
831 | 831 | * @return string |
832 | 832 | */ |
833 | - public function get_form_classes( $args ) { |
|
833 | + public function get_form_classes($args) { |
|
834 | 834 | |
835 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
835 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
836 | 836 | ? 'float-labels-enabled' |
837 | 837 | : ''; |
838 | 838 | |
839 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
839 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
840 | 840 | 'give-form', |
841 | - 'give-form-' . $this->ID, |
|
842 | - 'give-form-type-' . $this->get_type(), |
|
841 | + 'give-form-'.$this->ID, |
|
842 | + 'give-form-type-'.$this->get_type(), |
|
843 | 843 | $float_labels_option, |
844 | - ), $this->ID, $args ); |
|
844 | + ), $this->ID, $args); |
|
845 | 845 | |
846 | 846 | // Remove empty class names. |
847 | - $form_classes_array = array_filter( $form_classes_array ); |
|
847 | + $form_classes_array = array_filter($form_classes_array); |
|
848 | 848 | |
849 | - return implode( ' ', $form_classes_array ); |
|
849 | + return implode(' ', $form_classes_array); |
|
850 | 850 | |
851 | 851 | } |
852 | 852 | |
@@ -861,22 +861,22 @@ discard block |
||
861 | 861 | * |
862 | 862 | * @return string |
863 | 863 | */ |
864 | - public function get_form_wrap_classes( $args ) { |
|
864 | + public function get_form_wrap_classes($args) { |
|
865 | 865 | $custom_class = array( |
866 | 866 | 'give-form-wrap', |
867 | 867 | ); |
868 | 868 | |
869 | - if ( $this->is_close_donation_form() ) { |
|
869 | + if ($this->is_close_donation_form()) { |
|
870 | 870 | $custom_class[] = 'give-form-closed'; |
871 | 871 | } else { |
872 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
872 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
873 | 873 | ? $args['display_style'] |
874 | - : give_get_meta( $this->ID, '_give_payment_display', true ); |
|
874 | + : give_get_meta($this->ID, '_give_payment_display', true); |
|
875 | 875 | |
876 | 876 | $custom_class[] = "give-display-{$display_option}"; |
877 | 877 | |
878 | 878 | // If admin want to show only button for form then user inbuilt modal functionality. |
879 | - if ( 'button' === $display_option ) { |
|
879 | + if ('button' === $display_option) { |
|
880 | 880 | $custom_class[] = 'give-display-button-only'; |
881 | 881 | } |
882 | 882 | } |
@@ -887,10 +887,10 @@ discard block |
||
887 | 887 | * |
888 | 888 | * @since 1.0 |
889 | 889 | */ |
890 | - $form_wrap_classes_array = (array) apply_filters( 'give_form_wrap_classes', $custom_class, $this->ID, $args ); |
|
890 | + $form_wrap_classes_array = (array) apply_filters('give_form_wrap_classes', $custom_class, $this->ID, $args); |
|
891 | 891 | |
892 | 892 | |
893 | - return implode( ' ', $form_wrap_classes_array ); |
|
893 | + return implode(' ', $form_wrap_classes_array); |
|
894 | 894 | |
895 | 895 | } |
896 | 896 | |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | public function is_set_type_donation_form() { |
906 | 906 | $form_type = $this->get_type(); |
907 | 907 | |
908 | - return ( 'set' === $form_type ? true : false ); |
|
908 | + return ('set' === $form_type ? true : false); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | /** |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | public function is_multi_type_donation_form() { |
920 | 920 | $form_type = $this->get_type(); |
921 | 921 | |
922 | - return ( 'multi' === $form_type ? true : false ); |
|
922 | + return ('multi' === $form_type ? true : false); |
|
923 | 923 | |
924 | 924 | } |
925 | 925 | |
@@ -933,15 +933,15 @@ discard block |
||
933 | 933 | */ |
934 | 934 | public function get_sales() { |
935 | 935 | |
936 | - if ( ! isset( $this->sales ) ) { |
|
936 | + if ( ! isset($this->sales)) { |
|
937 | 937 | |
938 | - if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) { |
|
939 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
938 | + if ('' == give_get_meta($this->ID, '_give_form_sales', true)) { |
|
939 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
940 | 940 | } // End if |
941 | 941 | |
942 | - $this->sales = give_get_meta( $this->ID, '_give_form_sales', true ); |
|
942 | + $this->sales = give_get_meta($this->ID, '_give_form_sales', true); |
|
943 | 943 | |
944 | - if ( $this->sales < 0 ) { |
|
944 | + if ($this->sales < 0) { |
|
945 | 945 | // Never let sales be less than zero. |
946 | 946 | $this->sales = 0; |
947 | 947 | } |
@@ -962,13 +962,13 @@ discard block |
||
962 | 962 | * |
963 | 963 | * @return int|false New number of total sales. |
964 | 964 | */ |
965 | - public function increase_sales( $quantity = 1 ) { |
|
965 | + public function increase_sales($quantity = 1) { |
|
966 | 966 | |
967 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
968 | - $quantity = absint( $quantity ); |
|
967 | + $sales = give_get_form_sales_stats($this->ID); |
|
968 | + $quantity = absint($quantity); |
|
969 | 969 | $total_sales = $sales + $quantity; |
970 | 970 | |
971 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
971 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
972 | 972 | |
973 | 973 | $this->sales = $total_sales; |
974 | 974 | |
@@ -989,17 +989,17 @@ discard block |
||
989 | 989 | * |
990 | 990 | * @return int|false New number of total sales. |
991 | 991 | */ |
992 | - public function decrease_sales( $quantity = 1 ) { |
|
992 | + public function decrease_sales($quantity = 1) { |
|
993 | 993 | |
994 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
994 | + $sales = give_get_form_sales_stats($this->ID); |
|
995 | 995 | |
996 | 996 | // Only decrease if not already zero |
997 | - if ( $sales > 0 ) { |
|
997 | + if ($sales > 0) { |
|
998 | 998 | |
999 | - $quantity = absint( $quantity ); |
|
999 | + $quantity = absint($quantity); |
|
1000 | 1000 | $total_sales = $sales - $quantity; |
1001 | 1001 | |
1002 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
1002 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
1003 | 1003 | |
1004 | 1004 | $this->sales = $sales; |
1005 | 1005 | |
@@ -1023,15 +1023,15 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | public function get_earnings() { |
1025 | 1025 | |
1026 | - if ( ! isset( $this->earnings ) ) { |
|
1026 | + if ( ! isset($this->earnings)) { |
|
1027 | 1027 | |
1028 | - if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
1029 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
1028 | + if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) { |
|
1029 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | - $this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true ); |
|
1032 | + $this->earnings = give_get_meta($this->ID, '_give_form_earnings', true); |
|
1033 | 1033 | |
1034 | - if ( $this->earnings < 0 ) { |
|
1034 | + if ($this->earnings < 0) { |
|
1035 | 1035 | // Never let earnings be less than zero |
1036 | 1036 | $this->earnings = 0; |
1037 | 1037 | } |
@@ -1055,9 +1055,9 @@ discard block |
||
1055 | 1055 | * |
1056 | 1056 | * @return float|false |
1057 | 1057 | */ |
1058 | - public function increase_earnings( $amount = 0, $payment_id = 0 ) { |
|
1058 | + public function increase_earnings($amount = 0, $payment_id = 0) { |
|
1059 | 1059 | |
1060 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
1060 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
1061 | 1061 | |
1062 | 1062 | /** |
1063 | 1063 | * Modify the earning amount when increasing. |
@@ -1068,11 +1068,11 @@ discard block |
||
1068 | 1068 | * @param int $form_id Donation form ID. |
1069 | 1069 | * @param int $payment_id Donation ID. |
1070 | 1070 | */ |
1071 | - $amount = apply_filters( 'give_increase_form_earnings_amount', $amount, $this->ID, $payment_id ); |
|
1071 | + $amount = apply_filters('give_increase_form_earnings_amount', $amount, $this->ID, $payment_id); |
|
1072 | 1072 | |
1073 | 1073 | $new_amount = $earnings + (float) $amount; |
1074 | 1074 | |
1075 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
1075 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
1076 | 1076 | |
1077 | 1077 | $this->earnings = $new_amount; |
1078 | 1078 | |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | * |
1096 | 1096 | * @return float|false |
1097 | 1097 | */ |
1098 | - public function decrease_earnings( $amount, $payment_id = 0 ) { |
|
1098 | + public function decrease_earnings($amount, $payment_id = 0) { |
|
1099 | 1099 | |
1100 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
1100 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
1101 | 1101 | |
1102 | - if ( $earnings > 0 ) { |
|
1102 | + if ($earnings > 0) { |
|
1103 | 1103 | |
1104 | 1104 | /** |
1105 | 1105 | * Modify the earning value when decreasing it. |
@@ -1110,12 +1110,12 @@ discard block |
||
1110 | 1110 | * @param int $form_id Donation Form ID. |
1111 | 1111 | * @param int $payment_id Donation ID. |
1112 | 1112 | */ |
1113 | - $amount = apply_filters( 'give_decrease_form_earnings_amount', $amount, $this->ID, $payment_id ); |
|
1113 | + $amount = apply_filters('give_decrease_form_earnings_amount', $amount, $this->ID, $payment_id); |
|
1114 | 1114 | |
1115 | 1115 | // Only decrease if greater than zero |
1116 | 1116 | $new_amount = $earnings - (float) $amount; |
1117 | 1117 | |
1118 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
1118 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
1119 | 1119 | $this->earnings = $new_amount; |
1120 | 1120 | |
1121 | 1121 | return $this->earnings; |
@@ -1141,10 +1141,10 @@ discard block |
||
1141 | 1141 | * @return bool |
1142 | 1142 | */ |
1143 | 1143 | public function is_close_donation_form() { |
1144 | - $is_closed = ( 'closed' === give_get_meta( $this->ID, '_give_form_status', true, 'open' ) ); |
|
1144 | + $is_closed = ('closed' === give_get_meta($this->ID, '_give_form_status', true, 'open')); |
|
1145 | 1145 | |
1146 | 1146 | // If manual upgrade not completed, proceed with backward compatible code. |
1147 | - if ( ! give_has_upgrade_completed( 'v210_verify_form_status_upgrades' ) ) { |
|
1147 | + if ( ! give_has_upgrade_completed('v210_verify_form_status_upgrades')) { |
|
1148 | 1148 | |
1149 | 1149 | // Check for backward compatibility. |
1150 | 1150 | $is_closed = $this->bc_210_is_close_donation_form(); |
@@ -1174,17 +1174,17 @@ discard block |
||
1174 | 1174 | * |
1175 | 1175 | * @return bool The result of the update query. |
1176 | 1176 | */ |
1177 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1177 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1178 | 1178 | |
1179 | 1179 | /* @var WPDB $wpdb */ |
1180 | 1180 | global $wpdb; |
1181 | 1181 | |
1182 | 1182 | // Bailout. |
1183 | - if ( empty( $meta_key ) ) { |
|
1183 | + if (empty($meta_key)) { |
|
1184 | 1184 | return false; |
1185 | 1185 | } |
1186 | 1186 | |
1187 | - if ( give_update_meta( $this->ID, $meta_key, $meta_value ) ) { |
|
1187 | + if (give_update_meta($this->ID, $meta_key, $meta_value)) { |
|
1188 | 1188 | return true; |
1189 | 1189 | } |
1190 | 1190 | |
@@ -1201,33 +1201,33 @@ discard block |
||
1201 | 1201 | private function bc_210_is_close_donation_form() { |
1202 | 1202 | |
1203 | 1203 | $close_form = false; |
1204 | - $is_goal_enabled = give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true, 'disabled' ) ); |
|
1204 | + $is_goal_enabled = give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true, 'disabled')); |
|
1205 | 1205 | |
1206 | 1206 | // Proceed, if the form goal is enabled. |
1207 | - if ( $is_goal_enabled ) { |
|
1207 | + if ($is_goal_enabled) { |
|
1208 | 1208 | |
1209 | - $close_form_when_goal_achieved = give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true, 'disabled' ) ); |
|
1209 | + $close_form_when_goal_achieved = give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true, 'disabled')); |
|
1210 | 1210 | |
1211 | 1211 | // Proceed, if close form when goal achieved option is enabled. |
1212 | - if ( $close_form_when_goal_achieved ) { |
|
1212 | + if ($close_form_when_goal_achieved) { |
|
1213 | 1213 | |
1214 | - $form = new Give_Donate_Form( $this->ID ); |
|
1215 | - $goal_format = give_get_form_goal_format( $this->ID ); |
|
1214 | + $form = new Give_Donate_Form($this->ID); |
|
1215 | + $goal_format = give_get_form_goal_format($this->ID); |
|
1216 | 1216 | |
1217 | 1217 | // Verify whether the form is closed or not after processing data based on goal format. |
1218 | - switch ( $goal_format ) { |
|
1218 | + switch ($goal_format) { |
|
1219 | 1219 | case 'donation': |
1220 | 1220 | $closed = $form->get_goal() <= $form->get_sales(); |
1221 | 1221 | break; |
1222 | 1222 | case 'donors': |
1223 | - $closed = $form->get_goal() <= give_get_form_donor_count( $this->ID ); |
|
1223 | + $closed = $form->get_goal() <= give_get_form_donor_count($this->ID); |
|
1224 | 1224 | break; |
1225 | 1225 | default : |
1226 | 1226 | $closed = $form->get_goal() <= $form->get_earnings(); |
1227 | 1227 | break; |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( $closed ) { |
|
1230 | + if ($closed) { |
|
1231 | 1231 | $close_form = true; |
1232 | 1232 | } |
1233 | 1233 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param array $settings Array of settings class object. |
74 | 74 | */ |
75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
76 | 76 | |
77 | 77 | return self::$settings; |
78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return bool |
87 | 87 | */ |
88 | 88 | public static function verify_nonce() { |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | public static function save() { |
103 | 103 | $current_tab = give_get_current_setting_tab(); |
104 | 104 | |
105 | - if ( ! self::verify_nonce() ) { |
|
106 | - echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
105 | + if ( ! self::verify_nonce()) { |
|
106 | + echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
107 | 107 | die(); |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
111 | - if ( isset( $_POST['akismet_spam_protection'] ) |
|
112 | - && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
111 | + if (isset($_POST['akismet_spam_protection']) |
|
112 | + && give_is_setting_enabled($_POST['akismet_spam_protection']) |
|
113 | 113 | && ! give_check_akismet_key() |
114 | 114 | ) { |
115 | - self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) ); |
|
115 | + self::add_error('give-akismet-protection', __('Please properly configure Akismet to enable SPAM protection.', 'give')); |
|
116 | 116 | |
117 | 117 | return; |
118 | 118 | } |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 1.8 |
128 | 128 | */ |
129 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
129 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
130 | 130 | |
131 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
131 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Trigger Action. |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @since 1.8 |
141 | 141 | */ |
142 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
142 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - public static function add_message( $code, $message ) { |
|
156 | - self::$messages[ $code ] = $message; |
|
155 | + public static function add_message($code, $message) { |
|
156 | + self::$messages[$code] = $message; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public static function add_error( $code, $message ) { |
|
170 | - self::$errors[ $code ] = $message; |
|
169 | + public static function add_error($code, $message) { |
|
170 | + self::$errors[$code] = $message; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,18 +180,18 @@ discard block |
||
180 | 180 | $notice_html = ''; |
181 | 181 | $classes = 'give-notice settings-error notice is-dismissible'; |
182 | 182 | |
183 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
184 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
183 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
184 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
185 | 185 | |
186 | - if ( 0 < count( self::$errors ) ) { |
|
187 | - foreach ( self::$errors as $code => $message ) { |
|
188 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
186 | + if (0 < count(self::$errors)) { |
|
187 | + foreach (self::$errors as $code => $message) { |
|
188 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - if ( 0 < count( self::$messages ) ) { |
|
193 | - foreach ( self::$messages as $code => $message ) { |
|
194 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
192 | + if (0 < count(self::$messages)) { |
|
193 | + foreach (self::$messages as $code => $message) { |
|
194 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | self::$setting_filter_prefix = give_get_current_setting_page(); |
212 | 212 | |
213 | 213 | // Bailout: Exit if setting page is not defined. |
214 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
214 | + if (empty(self::$setting_filter_prefix)) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @since 1.8 |
226 | 226 | */ |
227 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
227 | + do_action(self::$setting_filter_prefix.'_start'); |
|
228 | 228 | |
229 | 229 | $current_tab = give_get_current_setting_tab(); |
230 | 230 | |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | /* @var object $current_setting_obj */ |
235 | 235 | $current_setting_obj = new StdClass; |
236 | 236 | |
237 | - foreach ( $all_setting as $setting ) { |
|
237 | + foreach ($all_setting as $setting) { |
|
238 | 238 | if ( |
239 | - method_exists( $setting, 'get_id' ) && |
|
239 | + method_exists($setting, 'get_id') && |
|
240 | 240 | $current_tab === $setting->get_id() |
241 | 241 | ) { |
242 | 242 | $current_setting_obj = $setting; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | // Save settings if data has been posted. |
248 | - if ( ! empty( $_POST ) ) { |
|
248 | + if ( ! empty($_POST)) { |
|
249 | 249 | self::save(); |
250 | 250 | } |
251 | 251 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @since 1.8 |
260 | 260 | */ |
261 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
261 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
262 | 262 | |
263 | 263 | include 'views/html-admin-settings.php'; |
264 | 264 | |
@@ -276,25 +276,25 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @return string|bool |
278 | 278 | */ |
279 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
279 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
280 | 280 | // Bailout. |
281 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
281 | + if (empty($option_name) && empty($field_id)) { |
|
282 | 282 | return false; |
283 | 283 | } |
284 | 284 | |
285 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
285 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
286 | 286 | // Get field value if any. |
287 | - $option_value = get_option( $option_name ); |
|
287 | + $option_value = get_option($option_name); |
|
288 | 288 | |
289 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
290 | - ? $option_value[ $field_id ] |
|
289 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
290 | + ? $option_value[$field_id] |
|
291 | 291 | : $default; |
292 | 292 | } else { |
293 | 293 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
294 | 294 | $option_name = ! $option_name ? $field_id : $option_name; |
295 | 295 | |
296 | 296 | // Get option value if any. |
297 | - $option_value = get_option( $option_name, $default ); |
|
297 | + $option_value = get_option($option_name, $default); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | return $option_value; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @return void |
315 | 315 | */ |
316 | - public static function output_fields( $options, $option_name = '' ) { |
|
316 | + public static function output_fields($options, $option_name = '') { |
|
317 | 317 | $current_tab = give_get_current_setting_tab(); |
318 | 318 | |
319 | 319 | // Field Default values. |
@@ -325,62 +325,62 @@ discard block |
||
325 | 325 | 'desc' => '', |
326 | 326 | 'table_html' => true, |
327 | 327 | 'repeat' => false, |
328 | - 'repeat_btn_title' => __( 'Add Field', 'give' ), |
|
328 | + 'repeat_btn_title' => __('Add Field', 'give'), |
|
329 | 329 | ); |
330 | 330 | |
331 | - foreach ( $options as $value ) { |
|
332 | - if ( ! isset( $value['type'] ) ) { |
|
331 | + foreach ($options as $value) { |
|
332 | + if ( ! isset($value['type'])) { |
|
333 | 333 | continue; |
334 | 334 | } |
335 | 335 | |
336 | 336 | // Set title. |
337 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
337 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
338 | 338 | |
339 | 339 | // Set default setting. |
340 | - $value = wp_parse_args( $value, $defaults ); |
|
340 | + $value = wp_parse_args($value, $defaults); |
|
341 | 341 | |
342 | 342 | // Colorpicker field. |
343 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
344 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
343 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
344 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
345 | 345 | |
346 | 346 | |
347 | 347 | // Custom attribute handling. |
348 | 348 | $custom_attributes = array(); |
349 | 349 | |
350 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
351 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
352 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
350 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
351 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
352 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | 356 | // Description handling. |
357 | - $description = self::get_field_description( $value ); |
|
357 | + $description = self::get_field_description($value); |
|
358 | 358 | |
359 | 359 | // Switch based on type. |
360 | - switch ( $value['type'] ) { |
|
360 | + switch ($value['type']) { |
|
361 | 361 | |
362 | 362 | // Section Titles |
363 | 363 | case 'title': |
364 | - if ( ! empty( $value['title'] ) || ! empty( $value['desc'] ) ) { |
|
364 | + if ( ! empty($value['title']) || ! empty($value['desc'])) { |
|
365 | 365 | ?> |
366 | 366 | <div class="give-setting-tab-header give-setting-tab-header-<?php echo $current_tab; ?>"> |
367 | - <?php if ( ! empty( $value['title'] ) ) : ?> |
|
368 | - <h2><?php echo self::get_field_title( $value ); ?></h2> |
|
367 | + <?php if ( ! empty($value['title'])) : ?> |
|
368 | + <h2><?php echo self::get_field_title($value); ?></h2> |
|
369 | 369 | <hr> |
370 | 370 | <?php endif; ?> |
371 | 371 | |
372 | - <?php if ( ! empty( $value['desc'] ) ) : ?> |
|
373 | - <?php echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); ?> |
|
372 | + <?php if ( ! empty($value['desc'])) : ?> |
|
373 | + <?php echo wpautop(wptexturize(wp_kses_post($value['desc']))); ?> |
|
374 | 374 | <?php endif; ?> |
375 | 375 | </div> |
376 | 376 | <?php |
377 | 377 | } |
378 | 378 | |
379 | - if ( $value['table_html'] ) { |
|
380 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
379 | + if ($value['table_html']) { |
|
380 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
381 | 381 | } |
382 | 382 | |
383 | - if ( ! empty( $value['id'] ) ) { |
|
383 | + if ( ! empty($value['id'])) { |
|
384 | 384 | |
385 | 385 | /** |
386 | 386 | * Trigger Action. |
@@ -389,14 +389,14 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @since 1.8 |
391 | 391 | */ |
392 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
392 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | break; |
396 | 396 | |
397 | 397 | // Section Ends. |
398 | 398 | case 'sectionend': |
399 | - if ( ! empty( $value['id'] ) ) { |
|
399 | + if ( ! empty($value['id'])) { |
|
400 | 400 | |
401 | 401 | /** |
402 | 402 | * Trigger Action. |
@@ -405,14 +405,14 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @since 1.8 |
407 | 407 | */ |
408 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
408 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
409 | 409 | } |
410 | 410 | |
411 | - if ( $value['table_html'] ) { |
|
411 | + if ($value['table_html']) { |
|
412 | 412 | echo '</table>'; |
413 | 413 | } |
414 | 414 | |
415 | - if ( ! empty( $value['id'] ) ) { |
|
415 | + if ( ! empty($value['id'])) { |
|
416 | 416 | |
417 | 417 | /** |
418 | 418 | * Trigger Action. |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @since 1.8 |
423 | 423 | */ |
424 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
424 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | break; |
@@ -429,51 +429,51 @@ discard block |
||
429 | 429 | // Standard text inputs and subtypes like 'number'. |
430 | 430 | case 'colorpicker': |
431 | 431 | case 'hidden' : |
432 | - $value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden'; |
|
432 | + $value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden'; |
|
433 | 433 | case 'text': |
434 | 434 | case 'email': |
435 | 435 | case 'number': |
436 | 436 | case 'password' : |
437 | 437 | $type = $value['type']; |
438 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
438 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
439 | 439 | |
440 | 440 | // Set default value for repeater field if not any value set yet. |
441 | - if ( $value['repeat'] && is_string( $option_value ) ) { |
|
442 | - $option_value = array( $value['default'] ); |
|
441 | + if ($value['repeat'] && is_string($option_value)) { |
|
442 | + $option_value = array($value['default']); |
|
443 | 443 | } |
444 | 444 | ?> |
445 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
445 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
446 | 446 | <th scope="row" class="titledesc"> |
447 | 447 | <label |
448 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
448 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
449 | 449 | </th> |
450 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
451 | - <?php if ( $value['repeat'] ) : ?> |
|
452 | - <?php foreach ( $option_value as $index => $field_value ) : ?> |
|
450 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
451 | + <?php if ($value['repeat']) : ?> |
|
452 | + <?php foreach ($option_value as $index => $field_value) : ?> |
|
453 | 453 | <p> |
454 | 454 | <input |
455 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
456 | - type="<?php echo esc_attr( $type ); ?>" |
|
457 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
458 | - value="<?php echo esc_attr( $field_value ); ?>" |
|
459 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?> <?php echo esc_attr( $value['id'] ); ?>" |
|
460 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
455 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
456 | + type="<?php echo esc_attr($type); ?>" |
|
457 | + style="<?php echo esc_attr($value['css']); ?>" |
|
458 | + value="<?php echo esc_attr($field_value); ?>" |
|
459 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?> <?php echo esc_attr($value['id']); ?>" |
|
460 | + <?php echo implode(' ', $custom_attributes); ?> |
|
461 | 461 | /> |
462 | 462 | <span class="give-remove-setting-field" |
463 | - title="<?php esc_html_e( 'Remove setting field', 'give' ); ?>">-</span> |
|
463 | + title="<?php esc_html_e('Remove setting field', 'give'); ?>">-</span> |
|
464 | 464 | </p> |
465 | 465 | <?php endforeach; ?> |
466 | 466 | <a href="#" data-id="<?php echo $value['id']; ?>" |
467 | 467 | class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a> |
468 | 468 | <?php else : ?> |
469 | 469 | <input |
470 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
471 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
472 | - type="<?php echo esc_attr( $type ); ?>" |
|
473 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
474 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
475 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
476 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
470 | + name="<?php echo esc_attr($value['id']); ?>" |
|
471 | + id="<?php echo esc_attr($value['id']); ?>" |
|
472 | + type="<?php echo esc_attr($type); ?>" |
|
473 | + style="<?php echo esc_attr($value['css']); ?>" |
|
474 | + value="<?php echo esc_attr($option_value); ?>" |
|
475 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
476 | + <?php echo implode(' ', $custom_attributes); ?> |
|
477 | 477 | /> |
478 | 478 | <?php endif; ?> |
479 | 479 | <?php echo $description; ?> |
@@ -484,24 +484,24 @@ discard block |
||
484 | 484 | // Textarea. |
485 | 485 | case 'textarea': |
486 | 486 | |
487 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
487 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
488 | 488 | |
489 | 489 | ?> |
490 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
490 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
491 | 491 | <th scope="row" class="titledesc"> |
492 | 492 | <label |
493 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
493 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
494 | 494 | </th> |
495 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
495 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
496 | 496 | <textarea |
497 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
498 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
499 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
500 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
497 | + name="<?php echo esc_attr($value['id']); ?>" |
|
498 | + id="<?php echo esc_attr($value['id']); ?>" |
|
499 | + style="<?php echo esc_attr($value['css']); ?>" |
|
500 | + class="<?php echo esc_attr($value['class']); ?>" |
|
501 | 501 | rows="10" |
502 | 502 | cols="60" |
503 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
504 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
503 | + <?php echo implode(' ', $custom_attributes); ?> |
|
504 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
505 | 505 | <?php echo $description; ?> |
506 | 506 | </td> |
507 | 507 | </tr><?php |
@@ -510,47 +510,47 @@ discard block |
||
510 | 510 | // Select boxes. |
511 | 511 | case 'select' : |
512 | 512 | case 'multiselect' : |
513 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
513 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
514 | 514 | |
515 | 515 | /** |
516 | 516 | * insert page in option if missing. |
517 | 517 | * |
518 | 518 | * check success_page setting in general settings. |
519 | 519 | */ |
520 | - if( |
|
521 | - isset( $value['attributes' ] ) && |
|
522 | - false !== strpos( $value['class'], 'give-select-chosen' ) && |
|
523 | - in_array( 'data-search-type', array_keys( $value['attributes' ] ) ) && |
|
524 | - 'pages' == $value['attributes' ]['data-search-type'] && |
|
525 | - ! in_array( $option_value, array_keys( $value['options'] ) ) |
|
520 | + if ( |
|
521 | + isset($value['attributes']) && |
|
522 | + false !== strpos($value['class'], 'give-select-chosen') && |
|
523 | + in_array('data-search-type', array_keys($value['attributes'])) && |
|
524 | + 'pages' == $value['attributes']['data-search-type'] && |
|
525 | + ! in_array($option_value, array_keys($value['options'])) |
|
526 | 526 | ) { |
527 | - $value['options'][$option_value] = get_the_title( $option_value ); |
|
527 | + $value['options'][$option_value] = get_the_title($option_value); |
|
528 | 528 | } |
529 | 529 | ?> |
530 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
530 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
531 | 531 | <th scope="row" class="titledesc"> |
532 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
532 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
533 | 533 | </th> |
534 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
534 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
535 | 535 | <select |
536 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) echo '[]'; ?>" |
|
537 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
538 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
539 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
540 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
541 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
536 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') echo '[]'; ?>" |
|
537 | + id="<?php echo esc_attr($value['id']); ?>" |
|
538 | + style="<?php echo esc_attr($value['css']); ?>" |
|
539 | + class="<?php echo esc_attr($value['class']); ?>" |
|
540 | + <?php echo implode(' ', $custom_attributes); ?> |
|
541 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
542 | 542 | > |
543 | 543 | |
544 | 544 | <?php |
545 | - if ( ! empty( $value['options'] ) ) { |
|
546 | - foreach ( $value['options'] as $key => $val ) { |
|
545 | + if ( ! empty($value['options'])) { |
|
546 | + foreach ($value['options'] as $key => $val) { |
|
547 | 547 | ?> |
548 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
548 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
549 | 549 | |
550 | - if ( is_array( $option_value ) ) { |
|
551 | - selected( in_array( $key, $option_value ), true ); |
|
550 | + if (is_array($option_value)) { |
|
551 | + selected(in_array($key, $option_value), true); |
|
552 | 552 | } else { |
553 | - selected( $option_value, $key ); |
|
553 | + selected($option_value, $key); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | ?>><?php echo $val ?></option> |
@@ -566,29 +566,29 @@ discard block |
||
566 | 566 | |
567 | 567 | // Radio inputs. |
568 | 568 | case 'radio_inline' : |
569 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
569 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
570 | 570 | case 'radio' : |
571 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
571 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
572 | 572 | ?> |
573 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
573 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
574 | 574 | <th scope="row" class="titledesc"> |
575 | 575 | <label |
576 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
576 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
577 | 577 | </th> |
578 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
578 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
579 | 579 | <fieldset> |
580 | 580 | <ul> |
581 | 581 | <?php |
582 | - foreach ( $value['options'] as $key => $val ) { |
|
582 | + foreach ($value['options'] as $key => $val) { |
|
583 | 583 | ?> |
584 | 584 | <li> |
585 | 585 | <label><input |
586 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
586 | + name="<?php echo esc_attr($value['id']); ?>" |
|
587 | 587 | value="<?php echo $key; ?>" |
588 | 588 | type="radio" |
589 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
590 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
591 | - <?php checked( $key, $option_value ); ?> |
|
589 | + style="<?php echo esc_attr($value['css']); ?>" |
|
590 | + <?php echo implode(' ', $custom_attributes); ?> |
|
591 | + <?php checked($key, $option_value); ?> |
|
592 | 592 | /> <?php echo $val ?></label> |
593 | 593 | </li> |
594 | 594 | <?php |
@@ -602,22 +602,22 @@ discard block |
||
602 | 602 | |
603 | 603 | // Checkbox input. |
604 | 604 | case 'checkbox' : |
605 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
605 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
606 | 606 | ?> |
607 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
607 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
608 | 608 | <th scope="row" class="titledesc"> |
609 | 609 | <label |
610 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
610 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
611 | 611 | </th> |
612 | 612 | <td class="give-forminp"> |
613 | 613 | <input |
614 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
615 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
614 | + name="<?php echo esc_attr($value['id']); ?>" |
|
615 | + id="<?php echo esc_attr($value['id']); ?>" |
|
616 | 616 | type="checkbox" |
617 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
617 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
618 | 618 | value="1" |
619 | - <?php checked( $option_value, 'on' ); ?> |
|
620 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
619 | + <?php checked($option_value, 'on'); ?> |
|
620 | + <?php echo implode(' ', $custom_attributes); ?> |
|
621 | 621 | /> |
622 | 622 | <?php echo $description; ?> |
623 | 623 | </td> |
@@ -627,29 +627,29 @@ discard block |
||
627 | 627 | |
628 | 628 | // Multi Checkbox input. |
629 | 629 | case 'multicheck' : |
630 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
631 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
630 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
631 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
632 | 632 | ?> |
633 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
633 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
634 | 634 | <th scope="row" class="titledesc"> |
635 | 635 | <label |
636 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
636 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
637 | 637 | </th> |
638 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
638 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
639 | 639 | <fieldset> |
640 | 640 | <ul> |
641 | 641 | <?php |
642 | - foreach ( $value['options'] as $key => $val ) { |
|
642 | + foreach ($value['options'] as $key => $val) { |
|
643 | 643 | ?> |
644 | 644 | <li> |
645 | 645 | <label> |
646 | 646 | <input |
647 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
647 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
648 | 648 | value="<?php echo $key; ?>" |
649 | 649 | type="checkbox" |
650 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
651 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
652 | - <?php if ( in_array( $key, $option_value ) ) { |
|
650 | + style="<?php echo esc_attr($value['css']); ?>" |
|
651 | + <?php echo implode(' ', $custom_attributes); ?> |
|
652 | + <?php if (in_array($key, $option_value)) { |
|
653 | 653 | echo 'checked="checked"'; |
654 | 654 | } ?> |
655 | 655 | /> <?php echo $val ?> |
@@ -668,31 +668,31 @@ discard block |
||
668 | 668 | // File input field. |
669 | 669 | case 'file' : |
670 | 670 | case 'media' : |
671 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
672 | - $button_label = sprintf( __( 'Add or Upload %s', 'give' ), ( 'file' === $value['type'] ? __( 'File', 'give' ) : __( 'Image', 'give' ) ) ); |
|
673 | - $fvalue = empty( $value['fvalue'] ) ? 'url' : $value['fvalue']; |
|
674 | - |
|
675 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
676 | - $preview_image_src = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : ''; |
|
677 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
678 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
671 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
672 | + $button_label = sprintf(__('Add or Upload %s', 'give'), ('file' === $value['type'] ? __('File', 'give') : __('Image', 'give'))); |
|
673 | + $fvalue = empty($value['fvalue']) ? 'url' : $value['fvalue']; |
|
674 | + |
|
675 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
676 | + $preview_image_src = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : ''; |
|
677 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
678 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
679 | 679 | ?> |
680 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
680 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
681 | 681 | <th scope="row" class="titledesc"> |
682 | 682 | <label |
683 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
683 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
684 | 684 | </th> |
685 | 685 | <td class="give-forminp"> |
686 | 686 | <div class="give-field-wrap"> |
687 | 687 | <label for="<?php echo $value['id'] ?>"> |
688 | 688 | <input |
689 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
690 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
689 | + name="<?php echo esc_attr($value['id']); ?>" |
|
690 | + id="<?php echo esc_attr($value['id']); ?>" |
|
691 | 691 | type="text" |
692 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
692 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
693 | 693 | value="<?php echo $option_value; ?>" |
694 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
695 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
694 | + style="<?php echo esc_attr($value['css']); ?>" |
|
695 | + <?php echo implode(' ', $custom_attributes); ?> |
|
696 | 696 | /> <input class="give-upload-button button" type="button" |
697 | 697 | data-fvalue="<?php echo $fvalue; ?>" |
698 | 698 | data-field-type="<?php echo $value['type']; ?>" |
@@ -713,18 +713,18 @@ discard block |
||
713 | 713 | // WordPress Editor. |
714 | 714 | case 'wysiwyg' : |
715 | 715 | // Get option value. |
716 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
716 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
717 | 717 | |
718 | 718 | // Get editor settings. |
719 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
719 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
720 | 720 | ?> |
721 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
721 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
722 | 722 | <th scope="row" class="titledesc"> |
723 | 723 | <label |
724 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
724 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
725 | 725 | </th> |
726 | 726 | <td class="give-forminp"> |
727 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
727 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
728 | 728 | <?php echo $description; ?> |
729 | 729 | </td> |
730 | 730 | </tr><?php |
@@ -732,15 +732,15 @@ discard block |
||
732 | 732 | |
733 | 733 | // Custom: Default gateways setting field. |
734 | 734 | case 'default_gateway' : |
735 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
735 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
736 | 736 | ?> |
737 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
737 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
738 | 738 | <th scope="row" class="titledesc"> |
739 | 739 | <label |
740 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
740 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
741 | 741 | </th> |
742 | 742 | <td class="give-forminp"> |
743 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
743 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
744 | 744 | <?php echo $description; ?> |
745 | 745 | </td> |
746 | 746 | </tr><?php |
@@ -749,13 +749,13 @@ discard block |
||
749 | 749 | // Custom: Email preview buttons field. |
750 | 750 | case 'email_preview_buttons' : |
751 | 751 | ?> |
752 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
752 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
753 | 753 | <th scope="row" class="titledesc"> |
754 | 754 | <label |
755 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
755 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
756 | 756 | </th> |
757 | 757 | <td class="give-forminp"> |
758 | - <?php give_email_preview_buttons_callback( $value ); ?> |
|
758 | + <?php give_email_preview_buttons_callback($value); ?> |
|
759 | 759 | <?php echo $description; ?> |
760 | 760 | </td> |
761 | 761 | </tr><?php |
@@ -769,23 +769,23 @@ discard block |
||
769 | 769 | |
770 | 770 | // Custom: Gateway API key. |
771 | 771 | case 'api_key' : |
772 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
773 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
772 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
773 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
774 | 774 | ?> |
775 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
775 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
776 | 776 | <th scope="row" class="titledesc"> |
777 | 777 | <label |
778 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
778 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
779 | 779 | </th> |
780 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
780 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
781 | 781 | <input |
782 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
783 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
784 | - type="<?php echo esc_attr( $type ); ?>" |
|
785 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
786 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
787 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
788 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
782 | + name="<?php echo esc_attr($value['id']); ?>" |
|
783 | + id="<?php echo esc_attr($value['id']); ?>" |
|
784 | + type="<?php echo esc_attr($type); ?>" |
|
785 | + style="<?php echo esc_attr($value['css']); ?>" |
|
786 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
787 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
788 | + <?php echo implode(' ', $custom_attributes); ?> |
|
789 | 789 | /> <?php echo $description; ?> |
790 | 790 | </td> |
791 | 791 | </tr><?php |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | * |
803 | 803 | * @since 1.0 |
804 | 804 | */ |
805 | - do_action( "give_logs_view_{$current_section}" ); |
|
805 | + do_action("give_logs_view_{$current_section}"); |
|
806 | 806 | |
807 | 807 | echo $description; |
808 | 808 | break; |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | // Custom: Data field. |
811 | 811 | case 'data' : |
812 | 812 | |
813 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php'; |
|
813 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php'; |
|
814 | 814 | |
815 | 815 | echo $description; |
816 | 816 | break; |
@@ -818,12 +818,12 @@ discard block |
||
818 | 818 | // Custom: Give Docs Link field type. |
819 | 819 | case 'give_docs_link' : |
820 | 820 | ?> |
821 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
821 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
822 | 822 | <td class="give-docs-link" colspan="2"> |
823 | 823 | <?php |
824 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
824 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
825 | 825 | . '" target="_blank">' |
826 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
826 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title']) |
|
827 | 827 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
828 | 828 | ?> |
829 | 829 | </td> |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | // You can add or handle your custom field action. |
835 | 835 | default: |
836 | 836 | // Get option value. |
837 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
838 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
837 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
838 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
839 | 839 | break; |
840 | 840 | } |
841 | 841 | } |
@@ -851,15 +851,15 @@ discard block |
||
851 | 851 | * |
852 | 852 | * @return string The HTML description of the field. |
853 | 853 | */ |
854 | - public static function get_field_description( $value ) { |
|
854 | + public static function get_field_description($value) { |
|
855 | 855 | $description = ''; |
856 | 856 | |
857 | 857 | // Support for both 'description' and 'desc' args. |
858 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
859 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
858 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
859 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
860 | 860 | |
861 | - if ( ! empty( $value ) ) { |
|
862 | - $description = '<div class="give-field-description">' . wp_kses_post( $value ) . '</div>'; |
|
861 | + if ( ! empty($value)) { |
|
862 | + $description = '<div class="give-field-description">'.wp_kses_post($value).'</div>'; |
|
863 | 863 | } |
864 | 864 | |
865 | 865 | return $description; |
@@ -876,11 +876,11 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @return array The description and tip as a 2 element array |
878 | 878 | */ |
879 | - public static function get_field_title( $value ) { |
|
880 | - $title = esc_html( $value['title'] ); |
|
879 | + public static function get_field_title($value) { |
|
880 | + $title = esc_html($value['title']); |
|
881 | 881 | |
882 | 882 | // If html tag detected then allow them to print. |
883 | - if ( strip_tags( $title ) ) { |
|
883 | + if (strip_tags($title)) { |
|
884 | 884 | $title = $value['title']; |
885 | 885 | } |
886 | 886 | |
@@ -899,8 +899,8 @@ discard block |
||
899 | 899 | * |
900 | 900 | * @return bool |
901 | 901 | */ |
902 | - public static function save_fields( $options, $option_name = '' ) { |
|
903 | - if ( empty( $_POST ) ) { |
|
902 | + public static function save_fields($options, $option_name = '') { |
|
903 | + if (empty($_POST)) { |
|
904 | 904 | return false; |
905 | 905 | } |
906 | 906 | |
@@ -908,37 +908,37 @@ discard block |
||
908 | 908 | $update_options = array(); |
909 | 909 | |
910 | 910 | // Loop options and get values to save. |
911 | - foreach ( $options as $option ) { |
|
912 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
911 | + foreach ($options as $option) { |
|
912 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
913 | 913 | continue; |
914 | 914 | } |
915 | 915 | |
916 | 916 | // Get posted value. |
917 | - if ( strstr( $option['id'], '[' ) ) { |
|
918 | - parse_str( $option['id'], $option_name_array ); |
|
919 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
920 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
921 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
917 | + if (strstr($option['id'], '[')) { |
|
918 | + parse_str($option['id'], $option_name_array); |
|
919 | + $field_option_name = current(array_keys($option_name_array)); |
|
920 | + $setting_name = key($option_name_array[$field_option_name]); |
|
921 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
922 | 922 | } else { |
923 | 923 | $field_option_name = $option['id']; |
924 | 924 | $setting_name = ''; |
925 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
925 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | // Format the value based on option type. |
929 | - switch ( $option['type'] ) { |
|
929 | + switch ($option['type']) { |
|
930 | 930 | case 'checkbox' : |
931 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
931 | + $value = is_null($raw_value) ? '' : 'on'; |
|
932 | 932 | break; |
933 | 933 | case 'wysiwyg' : |
934 | 934 | case 'textarea' : |
935 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
935 | + $value = wp_kses_post(trim($raw_value)); |
|
936 | 936 | break; |
937 | 937 | case 'multiselect' : |
938 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
938 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
939 | 939 | break; |
940 | 940 | default : |
941 | - $value = give_clean( $raw_value ); |
|
941 | + $value = give_clean($raw_value); |
|
942 | 942 | break; |
943 | 943 | } |
944 | 944 | |
@@ -947,37 +947,37 @@ discard block |
||
947 | 947 | * |
948 | 948 | * @since 1.8 |
949 | 949 | */ |
950 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
950 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
951 | 951 | |
952 | 952 | /** |
953 | 953 | * Sanitize the value of an option by option name. |
954 | 954 | * |
955 | 955 | * @since 1.8 |
956 | 956 | */ |
957 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
957 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
958 | 958 | |
959 | - if ( is_null( $value ) ) { |
|
959 | + if (is_null($value)) { |
|
960 | 960 | continue; |
961 | 961 | } |
962 | 962 | |
963 | 963 | // Check if option is an array and handle that differently to single values. |
964 | - if ( $field_option_name && $setting_name ) { |
|
965 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
966 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
964 | + if ($field_option_name && $setting_name) { |
|
965 | + if ( ! isset($update_options[$field_option_name])) { |
|
966 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
967 | 967 | } |
968 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
969 | - $update_options[ $field_option_name ] = array(); |
|
968 | + if ( ! is_array($update_options[$field_option_name])) { |
|
969 | + $update_options[$field_option_name] = array(); |
|
970 | 970 | } |
971 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
971 | + $update_options[$field_option_name][$setting_name] = $value; |
|
972 | 972 | } else { |
973 | - $update_options[ $field_option_name ] = $value; |
|
973 | + $update_options[$field_option_name] = $value; |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | |
977 | 977 | // Save all options in our array or there own option name i.e. option id. |
978 | - if ( empty( $option_name ) ) { |
|
979 | - foreach ( $update_options as $name => $value ) { |
|
980 | - update_option( $name, $value ); |
|
978 | + if (empty($option_name)) { |
|
979 | + foreach ($update_options as $name => $value) { |
|
980 | + update_option($name, $value); |
|
981 | 981 | |
982 | 982 | /** |
983 | 983 | * Trigger action. |
@@ -986,13 +986,13 @@ discard block |
||
986 | 986 | * |
987 | 987 | * @since 1.8 |
988 | 988 | */ |
989 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
989 | + do_action("give_save_option_{$name}", $value, $name); |
|
990 | 990 | } |
991 | 991 | } else { |
992 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
993 | - $update_options = array_merge( $old_options, $update_options ); |
|
992 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
993 | + $update_options = array_merge($old_options, $update_options); |
|
994 | 994 | |
995 | - update_option( $option_name, $update_options ); |
|
995 | + update_option($option_name, $update_options); |
|
996 | 996 | |
997 | 997 | /** |
998 | 998 | * Trigger action. |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | * |
1002 | 1002 | * @since 1.8 |
1003 | 1003 | */ |
1004 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name, $old_options ); |
|
1004 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name, $old_options); |
|
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | return true; |
@@ -1030,21 +1030,21 @@ discard block |
||
1030 | 1030 | * |
1031 | 1031 | * @return bool |
1032 | 1032 | */ |
1033 | - public static function is_setting_page( $tab = '', $section = '' ) { |
|
1033 | + public static function is_setting_page($tab = '', $section = '') { |
|
1034 | 1034 | $is_setting_page = false; |
1035 | 1035 | |
1036 | - if( ! is_admin() ) { |
|
1036 | + if ( ! is_admin()) { |
|
1037 | 1037 | return $is_setting_page; |
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | // Check fo setting tab. |
1041 | - if ( ! empty( $tab ) ) { |
|
1042 | - $is_setting_page = ( $tab === give_get_current_setting_tab() ); |
|
1041 | + if ( ! empty($tab)) { |
|
1042 | + $is_setting_page = ($tab === give_get_current_setting_tab()); |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | // Check fo setting section. |
1046 | - if ( ! empty( $section ) ) { |
|
1047 | - $is_setting_page = ( $section === give_get_current_setting_section() ); |
|
1046 | + if ( ! empty($section)) { |
|
1047 | + $is_setting_page = ($section === give_get_current_setting_section()); |
|
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | return $is_setting_page; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @since 1.0 |
64 | 64 | */ |
65 | - public function __construct( $shortcode ) { |
|
65 | + public function __construct($shortcode) { |
|
66 | 66 | |
67 | 67 | $this->shortcode_tag = $shortcode; |
68 | 68 | |
69 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
69 | + add_action('admin_init', array($this, 'init')); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function init() { |
79 | 79 | |
80 | - if ( $this->shortcode_tag ) { |
|
80 | + if ($this->shortcode_tag) { |
|
81 | 81 | |
82 | - $this->self = get_class( $this ); |
|
82 | + $this->self = get_class($this); |
|
83 | 83 | |
84 | 84 | $this->errors = array(); |
85 | 85 | $this->required = array(); |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | $fields = $this->get_fields(); |
89 | 89 | |
90 | 90 | $defaults = array( |
91 | - 'btn_close' => esc_html__( 'Close', 'give' ), |
|
92 | - 'btn_okay' => esc_html__( 'Insert Shortcode', 'give' ), |
|
91 | + 'btn_close' => esc_html__('Close', 'give'), |
|
92 | + 'btn_okay' => esc_html__('Insert Shortcode', 'give'), |
|
93 | 93 | 'errors' => $this->errors, |
94 | 94 | 'fields' => $fields, |
95 | - 'label' => '[' . $this->shortcode_tag . ']', |
|
95 | + 'label' => '['.$this->shortcode_tag.']', |
|
96 | 96 | 'required' => $this->required, |
97 | - 'title' => esc_html__( 'Insert Shortcode', 'give' ), |
|
97 | + 'title' => esc_html__('Insert Shortcode', 'give'), |
|
98 | 98 | ); |
99 | 99 | |
100 | - if ( user_can_richedit() ) { |
|
100 | + if (user_can_richedit()) { |
|
101 | 101 | |
102 | - Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults ); |
|
102 | + Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults); |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | } |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @since 1.0 |
130 | 130 | */ |
131 | - protected function generate_fields( $defined_fields ) { |
|
131 | + protected function generate_fields($defined_fields) { |
|
132 | 132 | |
133 | 133 | $fields = array(); |
134 | 134 | |
135 | - if ( is_array( $defined_fields ) ) { |
|
135 | + if (is_array($defined_fields)) { |
|
136 | 136 | |
137 | - foreach ( $defined_fields as $field ) { |
|
137 | + foreach ($defined_fields as $field) { |
|
138 | 138 | |
139 | 139 | $defaults = array( |
140 | 140 | 'label' => false, |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | 'type' => '', |
146 | 146 | ); |
147 | 147 | |
148 | - $field = wp_parse_args( (array) $field, $defaults ); |
|
149 | - $method = 'generate_' . strtolower( $field['type'] ); |
|
148 | + $field = wp_parse_args((array) $field, $defaults); |
|
149 | + $method = 'generate_'.strtolower($field['type']); |
|
150 | 150 | |
151 | - if ( method_exists( $this, $method ) ) { |
|
151 | + if (method_exists($this, $method)) { |
|
152 | 152 | |
153 | - $field = call_user_func( array( $this, $method ), $field ); |
|
153 | + $field = call_user_func(array($this, $method), $field); |
|
154 | 154 | |
155 | - if ( $field ) { |
|
155 | + if ($field) { |
|
156 | 156 | $fields[] = $field; |
157 | 157 | } |
158 | 158 | } |
@@ -172,23 +172,23 @@ discard block |
||
172 | 172 | protected function get_fields() { |
173 | 173 | |
174 | 174 | $defined_fields = $this->define_fields(); |
175 | - $generated_fields = $this->generate_fields( $defined_fields ); |
|
175 | + $generated_fields = $this->generate_fields($defined_fields); |
|
176 | 176 | |
177 | 177 | $errors = array(); |
178 | 178 | |
179 | - if ( ! empty( $this->errors ) ) { |
|
180 | - foreach ( $this->required as $name => $alert ) { |
|
179 | + if ( ! empty($this->errors)) { |
|
180 | + foreach ($this->required as $name => $alert) { |
|
181 | 181 | // Using WordPress function in place of array_column wp_list_pluck as it support older version as well. |
182 | - if ( false === array_search( $name, give_list_pluck( $generated_fields, 'name' ) ) ) { |
|
182 | + if (false === array_search($name, give_list_pluck($generated_fields, 'name'))) { |
|
183 | 183 | |
184 | - $errors[] = $this->errors[ $name ]; |
|
184 | + $errors[] = $this->errors[$name]; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | 188 | $this->errors = $errors; |
189 | 189 | } |
190 | 190 | |
191 | - if ( ! empty( $errors ) ) { |
|
191 | + if ( ! empty($errors)) { |
|
192 | 192 | |
193 | 193 | return $errors; |
194 | 194 | } |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @since 1.0 |
207 | 207 | */ |
208 | - protected function generate_container( $field ) { |
|
208 | + protected function generate_container($field) { |
|
209 | 209 | |
210 | - if ( array_key_exists( 'html', $field ) ) { |
|
210 | + if (array_key_exists('html', $field)) { |
|
211 | 211 | |
212 | 212 | return array( |
213 | 213 | 'type' => $field['type'], |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @since 1.0 |
229 | 229 | */ |
230 | - protected function generate_listbox( $field ) { |
|
230 | + protected function generate_listbox($field) { |
|
231 | 231 | |
232 | - $listbox = shortcode_atts( array( |
|
232 | + $listbox = shortcode_atts(array( |
|
233 | 233 | 'label' => '', |
234 | 234 | 'minWidth' => '', |
235 | 235 | 'name' => false, |
@@ -237,27 +237,27 @@ discard block |
||
237 | 237 | 'type' => '', |
238 | 238 | 'value' => '', |
239 | 239 | 'classes' => '' |
240 | - ), $field ); |
|
240 | + ), $field); |
|
241 | 241 | |
242 | - if ( $this->validate( $field ) ) { |
|
242 | + if ($this->validate($field)) { |
|
243 | 243 | |
244 | 244 | $new_listbox = array(); |
245 | 245 | |
246 | - foreach ( $listbox as $key => $value ) { |
|
246 | + foreach ($listbox as $key => $value) { |
|
247 | 247 | |
248 | - if ( $key == 'value' && empty( $value ) ) { |
|
249 | - $new_listbox[ $key ] = $listbox['name']; |
|
250 | - } else if ( $value ) { |
|
251 | - $new_listbox[ $key ] = $value; |
|
248 | + if ($key == 'value' && empty($value)) { |
|
249 | + $new_listbox[$key] = $listbox['name']; |
|
250 | + } else if ($value) { |
|
251 | + $new_listbox[$key] = $value; |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | // do not reindex array! |
256 | 256 | $field['options'] = array( |
257 | - '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ), |
|
257 | + '' => ($field['placeholder'] ? $field['placeholder'] : esc_attr__('- Select -', 'give')), |
|
258 | 258 | ) + $field['options']; |
259 | 259 | |
260 | - foreach ( $field['options'] as $value => $text ) { |
|
260 | + foreach ($field['options'] as $value => $text) { |
|
261 | 261 | $new_listbox['values'][] = array( |
262 | 262 | 'text' => $text, |
263 | 263 | 'value' => $value, |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @since 1.0 |
281 | 281 | */ |
282 | - protected function generate_post( $field ) { |
|
282 | + protected function generate_post($field) { |
|
283 | 283 | |
284 | 284 | $args = array( |
285 | 285 | 'post_type' => 'post', |
@@ -288,26 +288,26 @@ discard block |
||
288 | 288 | 'posts_per_page' => 30, |
289 | 289 | ); |
290 | 290 | |
291 | - $args = wp_parse_args( (array) $field['query_args'], $args ); |
|
292 | - $posts = new WP_Query( $args ); |
|
291 | + $args = wp_parse_args((array) $field['query_args'], $args); |
|
292 | + $posts = new WP_Query($args); |
|
293 | 293 | $options = array(); |
294 | 294 | |
295 | - if ( $posts->have_posts() ) { |
|
296 | - while ( $posts->have_posts() ) { |
|
295 | + if ($posts->have_posts()) { |
|
296 | + while ($posts->have_posts()) { |
|
297 | 297 | $posts->the_post(); |
298 | 298 | $post_title = get_the_title(); |
299 | 299 | $post_id = get_the_ID(); |
300 | - $options[ absint( $post_id ) ] = ( empty( $post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $post_id ) : $post_title ); |
|
300 | + $options[absint($post_id)] = (empty($post_title) ? sprintf(__('Untitled (#%s)', 'give'), $post_id) : $post_title); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | $field['type'] = 'listbox'; |
304 | 304 | $field['options'] = $options; |
305 | 305 | |
306 | - return $this->generate_listbox( $field ); |
|
306 | + return $this->generate_listbox($field); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | // perform validation here before returning false |
310 | - $this->validate( $field ); |
|
310 | + $this->validate($field); |
|
311 | 311 | |
312 | 312 | return false; |
313 | 313 | } |
@@ -321,9 +321,9 @@ discard block |
||
321 | 321 | * |
322 | 322 | * @since 1.0 |
323 | 323 | */ |
324 | - protected function generate_textbox( $field ) { |
|
324 | + protected function generate_textbox($field) { |
|
325 | 325 | |
326 | - $textbox = shortcode_atts( array( |
|
326 | + $textbox = shortcode_atts(array( |
|
327 | 327 | 'label' => '', |
328 | 328 | 'maxLength' => '', |
329 | 329 | 'minHeight' => '', |
@@ -335,15 +335,15 @@ discard block |
||
335 | 335 | 'value' => '', |
336 | 336 | 'classes' => '', |
337 | 337 | 'placeholder' => '' |
338 | - ), $field ); |
|
338 | + ), $field); |
|
339 | 339 | |
340 | 340 | // Remove empty placeholder. |
341 | - if( empty( $textbox['placeholder'] ) ) { |
|
342 | - unset( $textbox['placeholder'] ); |
|
341 | + if (empty($textbox['placeholder'])) { |
|
342 | + unset($textbox['placeholder']); |
|
343 | 343 | } |
344 | 344 | |
345 | - if ( $this->validate( $field ) ) { |
|
346 | - return array_filter( $textbox, array( $this, 'return_textbox_value' ) ); |
|
345 | + if ($this->validate($field)) { |
|
346 | + return array_filter($textbox, array($this, 'return_textbox_value')); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | return false; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @return bool |
358 | 358 | */ |
359 | - function return_textbox_value( $value ) { |
|
359 | + function return_textbox_value($value) { |
|
360 | 360 | return $value !== ''; |
361 | 361 | } |
362 | 362 | |
@@ -372,9 +372,9 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @since 1.0 |
374 | 374 | */ |
375 | - protected function validate( $field ) { |
|
375 | + protected function validate($field) { |
|
376 | 376 | |
377 | - extract( shortcode_atts( |
|
377 | + extract(shortcode_atts( |
|
378 | 378 | array( |
379 | 379 | 'name' => false, |
380 | 380 | 'required' => false, |
@@ -382,36 +382,36 @@ discard block |
||
382 | 382 | ), $field ) |
383 | 383 | ); |
384 | 384 | |
385 | - if ( $name ) { |
|
385 | + if ($name) { |
|
386 | 386 | |
387 | - if ( isset( $required['error'] ) ) { |
|
387 | + if (isset($required['error'])) { |
|
388 | 388 | |
389 | 389 | $error = array( |
390 | 390 | 'type' => 'container', |
391 | 391 | 'html' => $required['error'], |
392 | 392 | ); |
393 | 393 | |
394 | - $this->errors[ $name ] = $this->generate_container( $error ); |
|
394 | + $this->errors[$name] = $this->generate_container($error); |
|
395 | 395 | } |
396 | 396 | |
397 | - if ( ! ! $required || is_array( $required ) ) { |
|
397 | + if ( ! ! $required || is_array($required)) { |
|
398 | 398 | |
399 | - $alert = esc_html__( 'Some of the shortcode options are required.', 'give' ); |
|
399 | + $alert = esc_html__('Some of the shortcode options are required.', 'give'); |
|
400 | 400 | |
401 | - if ( isset( $required['alert'] ) ) { |
|
401 | + if (isset($required['alert'])) { |
|
402 | 402 | |
403 | 403 | $alert = $required['alert']; |
404 | 404 | |
405 | - } else if ( ! empty( $label ) ) { |
|
405 | + } else if ( ! empty($label)) { |
|
406 | 406 | |
407 | 407 | $alert = sprintf( |
408 | 408 | /* translators: %s: option label */ |
409 | - esc_html__( 'The "%s" option is required.', 'give' ), |
|
410 | - str_replace( ':', '', $label ) |
|
409 | + esc_html__('The "%s" option is required.', 'give'), |
|
410 | + str_replace(':', '', $label) |
|
411 | 411 | ); |
412 | 412 | } |
413 | 413 | |
414 | - $this->required[ $name ] = $alert; |
|
414 | + $this->required[$name] = $alert; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | return true; |
@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Admin View: Settings |
4 | 4 | */ |
5 | -if ( ! defined( 'ABSPATH' ) ) { |
|
5 | +if ( ! defined('ABSPATH')) { |
|
6 | 6 | exit; |
7 | 7 | } |
8 | 8 | |
9 | 9 | // Bailout: Do not output anything if setting tab is not defined. |
10 | -if ( ! empty( $tabs ) && array_key_exists( give_get_current_setting_tab(), $tabs ) ) : |
|
10 | +if ( ! empty($tabs) && array_key_exists(give_get_current_setting_tab(), $tabs)) : |
|
11 | 11 | /** |
12 | 12 | * Filter the form action. |
13 | 13 | * |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @since 1.8 |
19 | 19 | */ |
20 | - $form_method = apply_filters( self::$setting_filter_prefix . '_form_method_tab_' . $current_tab, 'post' ); |
|
20 | + $form_method = apply_filters(self::$setting_filter_prefix.'_form_method_tab_'.$current_tab, 'post'); |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Filter the main form tab. |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @since 1.8 |
31 | 31 | */ |
32 | - $form_open_tag = apply_filters( self::$setting_filter_prefix . '_open_form', '<form method="' . $form_method . '" id="give-mainform" action="" enctype="multipart/form-data">' ); |
|
33 | - $form_close_tag = apply_filters( self::$setting_filter_prefix . '_close_form', '</form>' ); |
|
32 | + $form_open_tag = apply_filters(self::$setting_filter_prefix.'_open_form', '<form method="'.$form_method.'" id="give-mainform" action="" enctype="multipart/form-data">'); |
|
33 | + $form_close_tag = apply_filters(self::$setting_filter_prefix.'_close_form', '</form>'); |
|
34 | 34 | |
35 | - $wrapper_class = implode( ' ', |
|
35 | + $wrapper_class = implode(' ', |
|
36 | 36 | array( |
37 | - self::$setting_filter_prefix . '-setting-page', |
|
38 | - self::$setting_filter_prefix . '-' . give_get_current_setting_section() . '-section', |
|
39 | - self::$setting_filter_prefix . '-' . give_get_current_setting_tab() . '-tab', |
|
37 | + self::$setting_filter_prefix.'-setting-page', |
|
38 | + self::$setting_filter_prefix.'-'.give_get_current_setting_section().'-section', |
|
39 | + self::$setting_filter_prefix.'-'.give_get_current_setting_tab().'-tab', |
|
40 | 40 | ) |
41 | 41 | ); |
42 | 42 | ?> |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | /* @var Give_Settings_Page $current_setting_obj */ |
48 | 48 | if ( |
49 | - ! empty( $current_setting_obj ) && |
|
50 | - method_exists( $current_setting_obj, 'get_heading_html' ) |
|
49 | + ! empty($current_setting_obj) && |
|
50 | + method_exists($current_setting_obj, 'get_heading_html') |
|
51 | 51 | ) { |
52 | 52 | echo $current_setting_obj->get_heading_html(); |
53 | 53 | } else { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | // Backward compatibility. |
56 | 56 | echo sprintf( |
57 | 57 | '<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">', |
58 | - esc_html( $tabs[ $current_tab ] ) |
|
58 | + esc_html($tabs[$current_tab]) |
|
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | ?> |
64 | 64 | <div class="nav-tab-wrapper give-nav-tab-wrapper"> |
65 | 65 | <?php |
66 | - foreach ( $tabs as $name => $label ) { |
|
67 | - echo '<a href="' . admin_url( "edit.php?post_type=give_forms&page=" . self::$setting_filter_prefix . "&tab={$name}" ) . '" class="nav-tab ' . ( $current_tab === $name ? 'nav-tab-active' : 'give-mobile-hidden' ) . '">' . $label . '</a>'; |
|
66 | + foreach ($tabs as $name => $label) { |
|
67 | + echo '<a href="'.admin_url("edit.php?post_type=give_forms&page=".self::$setting_filter_prefix."&tab={$name}").'" class="nav-tab '.($current_tab === $name ? 'nav-tab-active' : 'give-mobile-hidden').'">'.$label.'</a>'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @since 1.8 |
78 | 78 | */ |
79 | - do_action( self::$setting_filter_prefix . '_tabs' ); |
|
79 | + do_action(self::$setting_filter_prefix.'_tabs'); |
|
80 | 80 | ?> |
81 | 81 | <div class="give-sub-nav-tab-wrapper"> |
82 | - <a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e( 'View remaining setting tabs', 'give' ); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span> |
|
82 | + <a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e('View remaining setting tabs', 'give'); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span> |
|
83 | 83 | </a> |
84 | 84 | <nav class="give-sub-nav-tab give-hidden"></nav> |
85 | 85 | </div> |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @since 1.8 |
97 | 97 | */ |
98 | - do_action( self::$setting_filter_prefix . "_sections_{$current_tab}_page" ); |
|
98 | + do_action(self::$setting_filter_prefix."_sections_{$current_tab}_page"); |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Trigger Action. |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @since 1.8 |
108 | 108 | */ |
109 | - do_action( self::$setting_filter_prefix . "_settings_{$current_tab}_page" ); |
|
109 | + do_action(self::$setting_filter_prefix."_settings_{$current_tab}_page"); |
|
110 | 110 | |
111 | - wp_nonce_field( 'give-save-settings', '_give-save-settings' ); |
|
111 | + wp_nonce_field('give-save-settings', '_give-save-settings'); |
|
112 | 112 | |
113 | - if ( empty( $GLOBALS['give_hide_save_button'] ) ) : ?> |
|
113 | + if (empty($GLOBALS['give_hide_save_button'])) : ?> |
|
114 | 114 | <div class="give-submit-wrap"> |
115 | - <input name="save" class="button-primary give-save-button" type="submit" value="<?php _e( 'Save changes', 'give' ); ?>"/> |
|
115 | + <input name="save" class="button-primary give-save-button" type="submit" value="<?php _e('Save changes', 'give'); ?>"/> |
|
116 | 116 | </div> |
117 | 117 | <?php endif; ?> |
118 | 118 | <?php echo $form_close_tag; ?> |
119 | 119 | </div> |
120 | -<?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?> |
|
120 | +<?php else : echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; ?> |
|
121 | 121 | <?php endif; ?> |
122 | 122 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_is_test_mode() { |
25 | 25 | |
26 | - $ret = give_is_setting_enabled( give_get_option( 'test_mode' ) ); |
|
26 | + $ret = give_is_setting_enabled(give_get_option('test_mode')); |
|
27 | 27 | |
28 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); |
|
28 | + return (bool) apply_filters('give_is_test_mode', $ret); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | |
40 | 40 | global $wp; |
41 | 41 | |
42 | - if ( get_option( 'permalink_structure' ) ) { |
|
43 | - $base = trailingslashit( home_url( $wp->request ) ); |
|
42 | + if (get_option('permalink_structure')) { |
|
43 | + $base = trailingslashit(home_url($wp->request)); |
|
44 | 44 | } else { |
45 | - $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) ); |
|
46 | - $base = remove_query_arg( array( 'post_type', 'name' ), $base ); |
|
45 | + $base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request))); |
|
46 | + $base = remove_query_arg(array('post_type', 'name'), $base); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $scheme = is_ssl() ? 'https' : 'http'; |
50 | - $current_uri = set_url_scheme( $base, $scheme ); |
|
50 | + $current_uri = set_url_scheme($base, $scheme); |
|
51 | 51 | |
52 | - if ( is_front_page() ) { |
|
53 | - $current_uri = home_url( '/' ); |
|
52 | + if (is_front_page()) { |
|
53 | + $current_uri = home_url('/'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @param string $current_uri |
62 | 62 | */ |
63 | - return apply_filters( 'give_get_current_page_url', $current_uri ); |
|
63 | + return apply_filters('give_get_current_page_url', $current_uri); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | */ |
83 | 83 | $gateways = give_get_enabled_payment_gateways(); |
84 | 84 | |
85 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
85 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
86 | 86 | $ret = true; |
87 | - } elseif ( count( $gateways ) == 1 ) { |
|
87 | + } elseif (count($gateways) == 1) { |
|
88 | 88 | $ret = false; |
89 | - } elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
89 | + } elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
90 | 90 | $ret = false; |
91 | 91 | } |
92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @param bool $ret |
99 | 99 | */ |
100 | - return (bool) apply_filters( 'give_is_cc_verify_enabled', $ret ); |
|
100 | + return (bool) apply_filters('give_is_cc_verify_enabled', $ret); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -109,26 +109,26 @@ discard block |
||
109 | 109 | function give_get_timezone_id() { |
110 | 110 | |
111 | 111 | // if site timezone string exists, return it. |
112 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
112 | + if ($timezone = get_option('timezone_string')) { |
|
113 | 113 | return $timezone; |
114 | 114 | } |
115 | 115 | |
116 | 116 | // get UTC offset, if it isn't set return UTC. |
117 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
117 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
118 | 118 | return 'UTC'; |
119 | 119 | } |
120 | 120 | |
121 | 121 | // attempt to guess the timezone string from the UTC offset. |
122 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
122 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
123 | 123 | |
124 | 124 | // last try, guess timezone string manually. |
125 | - if ( $timezone === false ) { |
|
125 | + if ($timezone === false) { |
|
126 | 126 | |
127 | - $is_dst = date( 'I' ); |
|
127 | + $is_dst = date('I'); |
|
128 | 128 | |
129 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
130 | - foreach ( $abbr as $city ) { |
|
131 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
129 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
130 | + foreach ($abbr as $city) { |
|
131 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
132 | 132 | return $city['timezone_id']; |
133 | 133 | } |
134 | 134 | } |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | |
153 | 153 | $ip = '127.0.0.1'; |
154 | 154 | |
155 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
155 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
156 | 156 | // check ip from share internet |
157 | 157 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
158 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
158 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
159 | 159 | // to check ip is pass from proxy |
160 | 160 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
161 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
161 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
162 | 162 | $ip = $_SERVER['REMOTE_ADDR']; |
163 | 163 | } |
164 | 164 | |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @since 1.0 |
169 | 169 | */ |
170 | - $ip = apply_filters( 'give_get_ip', $ip ); |
|
170 | + $ip = apply_filters('give_get_ip', $ip); |
|
171 | 171 | |
172 | 172 | // Filter empty values. |
173 | - if( false !== strpos( $ip, ',' ) ) { |
|
174 | - $ip = give_clean( explode( ',', $ip ) ); |
|
175 | - $ip = array_filter( $ip ); |
|
176 | - $ip = implode( ',', $ip ); |
|
177 | - } else{ |
|
178 | - $ip = give_clean( $ip ); |
|
173 | + if (false !== strpos($ip, ',')) { |
|
174 | + $ip = give_clean(explode(',', $ip)); |
|
175 | + $ip = array_filter($ip); |
|
176 | + $ip = implode(',', $ip); |
|
177 | + } else { |
|
178 | + $ip = give_clean($ip); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $ip; |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @uses Give()->session->set() |
195 | 195 | */ |
196 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
197 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
198 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
196 | +function give_set_purchase_session($purchase_data = array()) { |
|
197 | + Give()->session->set('give_purchase', $purchase_data); |
|
198 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return mixed array | false |
210 | 210 | */ |
211 | 211 | function give_get_purchase_session() { |
212 | - return Give()->session->get( 'give_purchase' ); |
|
212 | + return Give()->session->get('give_purchase'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return array|string |
221 | 221 | */ |
222 | 222 | function give_get_receipt_session() { |
223 | - return Give()->session->get( 'receipt_access' ); |
|
223 | + return Give()->session->get('receipt_access'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @return array|string |
232 | 232 | */ |
233 | 233 | function give_get_history_session() { |
234 | - return (bool) Give()->session->get( 'history_access' ); |
|
234 | + return (bool) Give()->session->get('history_access'); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @return string By default, the name of the form. Then the price level text if any is found. |
245 | 245 | */ |
246 | -function give_payment_gateway_item_title( $payment_data ) { |
|
246 | +function give_payment_gateway_item_title($payment_data) { |
|
247 | 247 | |
248 | - $form_id = intval( $payment_data['post_data']['give-form-id'] ); |
|
249 | - $item_name = isset( $payment_data['post_data']['give-form-title'] ) ? $payment_data['post_data']['give-form-title'] : ''; |
|
250 | - $price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : ''; |
|
248 | + $form_id = intval($payment_data['post_data']['give-form-id']); |
|
249 | + $item_name = isset($payment_data['post_data']['give-form-title']) ? $payment_data['post_data']['give-form-title'] : ''; |
|
250 | + $price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : ''; |
|
251 | 251 | |
252 | 252 | |
253 | 253 | // Verify has variable prices. |
254 | - if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) { |
|
254 | + if (give_has_variable_prices($form_id) && ! empty($price_id)) { |
|
255 | 255 | |
256 | - $item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false ); |
|
256 | + $item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false); |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Output donation level text if: |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | */ |
264 | 264 | if ( |
265 | 265 | 'custom' !== $price_id |
266 | - && ! empty( $item_price_level_text ) |
|
266 | + && ! empty($item_price_level_text) |
|
267 | 267 | ) { |
268 | 268 | // Matches a donation level - append level text. |
269 | - $item_name .= ' - ' . $item_price_level_text; |
|
269 | + $item_name .= ' - '.$item_price_level_text; |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return string |
283 | 283 | */ |
284 | - return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data ); |
|
284 | + return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -297,38 +297,38 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return string |
299 | 299 | */ |
300 | -function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) { |
|
300 | +function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) { |
|
301 | 301 | |
302 | - $form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : ''; |
|
303 | - $price_id = isset( $donation_data['post_data']['give-price-id'] ) ? $donation_data['post_data']['give-price-id'] : ''; |
|
302 | + $form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : ''; |
|
303 | + $price_id = isset($donation_data['post_data']['give-price-id']) ? $donation_data['post_data']['give-price-id'] : ''; |
|
304 | 304 | |
305 | 305 | // Form title. |
306 | - $summary = ( ! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : ( ! empty( $form_id ) ? wp_sprintf( __( 'Donation Form ID: %d', 'give' ), $form_id ) : __( 'Untitled donation form', 'give' ) ) ); |
|
306 | + $summary = ( ! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : ( ! empty($form_id) ? wp_sprintf(__('Donation Form ID: %d', 'give'), $form_id) : __('Untitled donation form', 'give'))); |
|
307 | 307 | |
308 | 308 | // Form multilevel if applicable. |
309 | - if ( ! empty( $price_id ) && 'custom' !== $price_id ) { |
|
310 | - $summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] ); |
|
309 | + if ( ! empty($price_id) && 'custom' !== $price_id) { |
|
310 | + $summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | // Add Donor's name + email if requested. |
314 | - if ( $name_and_email ) { |
|
314 | + if ($name_and_email) { |
|
315 | 315 | |
316 | 316 | // First name |
317 | - if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) { |
|
318 | - $summary .= ' - ' . $donation_data['user_info']['first_name']; |
|
317 | + if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) { |
|
318 | + $summary .= ' - '.$donation_data['user_info']['first_name']; |
|
319 | 319 | } |
320 | 320 | |
321 | - if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) { |
|
322 | - $summary .= ' ' . $donation_data['user_info']['last_name']; |
|
321 | + if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) { |
|
322 | + $summary .= ' '.$donation_data['user_info']['last_name']; |
|
323 | 323 | } |
324 | 324 | |
325 | - $summary .= ' (' . $donation_data['user_email'] . ')'; |
|
325 | + $summary .= ' ('.$donation_data['user_email'].')'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | // Cut the length |
329 | - $summary = substr( $summary, 0, $length ); |
|
329 | + $summary = substr($summary, 0, $length); |
|
330 | 330 | |
331 | - return apply_filters( 'give_payment_gateway_donation_summary', $summary ); |
|
331 | + return apply_filters('give_payment_gateway_donation_summary', $summary); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -343,31 +343,31 @@ discard block |
||
343 | 343 | function give_get_host() { |
344 | 344 | $host = false; |
345 | 345 | |
346 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
346 | + if (defined('WPE_APIKEY')) { |
|
347 | 347 | $host = 'WP Engine'; |
348 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
348 | + } elseif (defined('PAGELYBIN')) { |
|
349 | 349 | $host = 'Pagely'; |
350 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
350 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
351 | 351 | $host = 'ICDSoft'; |
352 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
352 | + } elseif (DB_HOST == 'mysqlv5') { |
|
353 | 353 | $host = 'NetworkSolutions'; |
354 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
354 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
355 | 355 | $host = 'iPage'; |
356 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
356 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
357 | 357 | $host = 'IPower'; |
358 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
358 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
359 | 359 | $host = 'MediaTemple Grid'; |
360 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
360 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
361 | 361 | $host = 'pair Networks'; |
362 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
362 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
363 | 363 | $host = 'Rackspace Cloud'; |
364 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
364 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
365 | 365 | $host = 'SysFix.eu Power Hosting'; |
366 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
366 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
367 | 367 | $host = 'Flywheel'; |
368 | 368 | } else { |
369 | 369 | // Adding a general fallback for data gathering |
370 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
370 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | return $host; |
@@ -383,67 +383,67 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @return bool true if host matches, false if not |
385 | 385 | */ |
386 | -function give_is_host( $host = false ) { |
|
386 | +function give_is_host($host = false) { |
|
387 | 387 | |
388 | 388 | $return = false; |
389 | 389 | |
390 | - if ( $host ) { |
|
391 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
390 | + if ($host) { |
|
391 | + $host = str_replace(' ', '', strtolower($host)); |
|
392 | 392 | |
393 | - switch ( $host ) { |
|
393 | + switch ($host) { |
|
394 | 394 | case 'wpengine': |
395 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
395 | + if (defined('WPE_APIKEY')) { |
|
396 | 396 | $return = true; |
397 | 397 | } |
398 | 398 | break; |
399 | 399 | case 'pagely': |
400 | - if ( defined( 'PAGELYBIN' ) ) { |
|
400 | + if (defined('PAGELYBIN')) { |
|
401 | 401 | $return = true; |
402 | 402 | } |
403 | 403 | break; |
404 | 404 | case 'icdsoft': |
405 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
405 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
406 | 406 | $return = true; |
407 | 407 | } |
408 | 408 | break; |
409 | 409 | case 'networksolutions': |
410 | - if ( DB_HOST == 'mysqlv5' ) { |
|
410 | + if (DB_HOST == 'mysqlv5') { |
|
411 | 411 | $return = true; |
412 | 412 | } |
413 | 413 | break; |
414 | 414 | case 'ipage': |
415 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
415 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
416 | 416 | $return = true; |
417 | 417 | } |
418 | 418 | break; |
419 | 419 | case 'ipower': |
420 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
420 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
421 | 421 | $return = true; |
422 | 422 | } |
423 | 423 | break; |
424 | 424 | case 'mediatemplegrid': |
425 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
425 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
426 | 426 | $return = true; |
427 | 427 | } |
428 | 428 | break; |
429 | 429 | case 'pairnetworks': |
430 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
430 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
431 | 431 | $return = true; |
432 | 432 | } |
433 | 433 | break; |
434 | 434 | case 'rackspacecloud': |
435 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
435 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
436 | 436 | $return = true; |
437 | 437 | } |
438 | 438 | break; |
439 | 439 | case 'sysfix.eu': |
440 | 440 | case 'sysfix.eupowerhosting': |
441 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
441 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
442 | 442 | $return = true; |
443 | 443 | } |
444 | 444 | break; |
445 | 445 | case 'flywheel': |
446 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
446 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
447 | 447 | $return = true; |
448 | 448 | } |
449 | 449 | break; |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * @param string $replacement Optional. The function that should have been called. |
477 | 477 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. |
478 | 478 | */ |
479 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
479 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
480 | 480 | |
481 | 481 | /** |
482 | 482 | * Fires while give deprecated function call occurs. |
@@ -489,19 +489,19 @@ discard block |
||
489 | 489 | * @param string $replacement Optional. The function that should have been called. |
490 | 490 | * @param string $version The plugin version that deprecated the function. |
491 | 491 | */ |
492 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
492 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
493 | 493 | |
494 | - $show_errors = current_user_can( 'manage_options' ); |
|
494 | + $show_errors = current_user_can('manage_options'); |
|
495 | 495 | |
496 | 496 | // Allow plugin to filter the output error trigger. |
497 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
498 | - if ( ! is_null( $replacement ) ) { |
|
499 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
500 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
497 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
498 | + if ( ! is_null($replacement)) { |
|
499 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
500 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
501 | 501 | // Alternatively we could dump this to a file. |
502 | 502 | } else { |
503 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
504 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
503 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
504 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
505 | 505 | // Alternatively we could dump this to a file. |
506 | 506 | } |
507 | 507 | } |
@@ -515,17 +515,17 @@ discard block |
||
515 | 515 | * @return string $post_id |
516 | 516 | */ |
517 | 517 | function give_get_admin_post_id() { |
518 | - $post_id = isset( $_REQUEST['post'] ) |
|
519 | - ? absint( $_REQUEST['post'] ) |
|
518 | + $post_id = isset($_REQUEST['post']) |
|
519 | + ? absint($_REQUEST['post']) |
|
520 | 520 | : null; |
521 | 521 | |
522 | - $post_id = ! empty( $post_id ) |
|
522 | + $post_id = ! empty($post_id) |
|
523 | 523 | ? $post_id |
524 | - : ( isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : null ); |
|
524 | + : (isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : null); |
|
525 | 525 | |
526 | - $post_id = ! empty( $post_id ) |
|
526 | + $post_id = ! empty($post_id) |
|
527 | 527 | ? $post_id |
528 | - : ( isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : null ); |
|
528 | + : (isset($_REQUEST['post_ID']) ? absint($_REQUEST['post_ID']) : null); |
|
529 | 529 | |
530 | 530 | return $post_id; |
531 | 531 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @return string Arg separator output |
538 | 538 | */ |
539 | 539 | function give_get_php_arg_separator_output() { |
540 | - return ini_get( 'arg_separator.output' ); |
|
540 | + return ini_get('arg_separator.output'); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -552,10 +552,10 @@ discard block |
||
552 | 552 | * |
553 | 553 | * @return string Short month name |
554 | 554 | */ |
555 | -function give_month_num_to_name( $n ) { |
|
556 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
555 | +function give_month_num_to_name($n) { |
|
556 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
557 | 557 | |
558 | - return date_i18n( 'M', $timestamp ); |
|
558 | + return date_i18n('M', $timestamp); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | |
@@ -568,10 +568,10 @@ discard block |
||
568 | 568 | * |
569 | 569 | * @return bool Whether or not function is disabled. |
570 | 570 | */ |
571 | -function give_is_func_disabled( $function ) { |
|
572 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
571 | +function give_is_func_disabled($function) { |
|
572 | + $disabled = explode(',', ini_get('disable_functions')); |
|
573 | 573 | |
574 | - return in_array( $function, $disabled ); |
|
574 | + return in_array($function, $disabled); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | function give_get_newsletter() { |
584 | 584 | ?> |
585 | 585 | |
586 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
586 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
587 | 587 | |
588 | 588 | <div class="give-newsletter-form-wrap"> |
589 | 589 | |
@@ -591,33 +591,33 @@ discard block |
||
591 | 591 | method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" |
592 | 592 | target="_blank" novalidate> |
593 | 593 | <div class="give-newsletter-confirmation"> |
594 | - <p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
594 | + <p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
595 | 595 | </div> |
596 | 596 | |
597 | 597 | <table class="form-table give-newsletter-form"> |
598 | 598 | <tr valign="middle"> |
599 | 599 | <td> |
600 | 600 | <label for="mce-EMAIL" |
601 | - class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> |
|
601 | + class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> |
|
602 | 602 | <input type="email" name="EMAIL" id="mce-EMAIL" |
603 | - placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" |
|
603 | + placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" |
|
604 | 604 | class="required email" value=""> |
605 | 605 | </td> |
606 | 606 | <td> |
607 | 607 | <label for="mce-FNAME" |
608 | - class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
608 | + class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> |
|
609 | 609 | <input type="text" name="FNAME" id="mce-FNAME" |
610 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value=""> |
|
610 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value=""> |
|
611 | 611 | </td> |
612 | 612 | <td> |
613 | 613 | <label for="mce-LNAME" |
614 | - class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
614 | + class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
615 | 615 | <input type="text" name="LNAME" id="mce-LNAME" |
616 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> |
|
616 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> |
|
617 | 617 | </td> |
618 | 618 | <td> |
619 | 619 | <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" |
620 | - value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> |
|
620 | + value="<?php esc_attr_e('Subscribe', 'give'); ?>"> |
|
621 | 621 | </td> |
622 | 622 | </tr> |
623 | 623 | </table> |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | * |
671 | 671 | * @return string |
672 | 672 | */ |
673 | -function give_svg_icons( $icon ) { |
|
673 | +function give_svg_icons($icon) { |
|
674 | 674 | |
675 | 675 | // Store your SVGs in an associative array |
676 | 676 | $svgs = array( |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | ); |
683 | 683 | |
684 | 684 | // Return the chosen icon's SVG string |
685 | - return $svgs[ $icon ]; |
|
685 | + return $svgs[$icon]; |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | /** |
@@ -694,15 +694,15 @@ discard block |
||
694 | 694 | * |
695 | 695 | * @return mixed |
696 | 696 | */ |
697 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
698 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
699 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); |
|
697 | +function modify_nav_menu_meta_box_object($post_type) { |
|
698 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
699 | + $post_type->labels->name = esc_html__('Donation Forms', 'give'); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | return $post_type; |
703 | 703 | } |
704 | 704 | |
705 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
705 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
706 | 706 | |
707 | 707 | /** |
708 | 708 | * Show Donation Forms Post Type in Appearance > Menus by default on fresh install. |
@@ -721,35 +721,35 @@ discard block |
||
721 | 721 | // Proceed, if current screen is navigation menus. |
722 | 722 | if ( |
723 | 723 | 'nav-menus' === $screen->id && |
724 | - give_is_setting_enabled( give_get_option( 'forms_singular' ) ) && |
|
725 | - ! get_user_option( 'give_is_donation_forms_menu_updated' ) |
|
724 | + give_is_setting_enabled(give_get_option('forms_singular')) && |
|
725 | + ! get_user_option('give_is_donation_forms_menu_updated') |
|
726 | 726 | ) { |
727 | 727 | |
728 | 728 | // Return false, if it fails to retrieve hidden meta box list and is not admin. |
729 | 729 | if ( |
730 | 730 | ! is_admin() || |
731 | - ( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) ) |
|
731 | + ( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus')) |
|
732 | 732 | ) { |
733 | 733 | return false; |
734 | 734 | } |
735 | 735 | |
736 | 736 | // Return false, In case, we don't find 'Donation Form' in hidden meta box list. |
737 | - if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) { |
|
737 | + if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) { |
|
738 | 738 | return false; |
739 | 739 | } |
740 | 740 | |
741 | 741 | // Exclude 'Donation Form' value from hidden meta box's list. |
742 | - $hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) ); |
|
742 | + $hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms')); |
|
743 | 743 | |
744 | 744 | // Get current user ID. |
745 | 745 | $user = wp_get_current_user(); |
746 | 746 | |
747 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
748 | - update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true ); |
|
747 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
748 | + update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true); |
|
749 | 749 | } |
750 | 750 | } |
751 | 751 | |
752 | -add_action( 'current_screen', 'give_donation_metabox_menu' ); |
|
752 | +add_action('current_screen', 'give_donation_metabox_menu'); |
|
753 | 753 | |
754 | 754 | /** |
755 | 755 | * Array_column backup usage |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * @license https://opensource.org/licenses/MIT MIT |
763 | 763 | */ |
764 | 764 | |
765 | -if ( ! function_exists( 'array_column' ) ) { |
|
765 | +if ( ! function_exists('array_column')) { |
|
766 | 766 | /** |
767 | 767 | * Returns the values from a single column of the input array, identified by |
768 | 768 | * the $columnKey. |
@@ -781,53 +781,53 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @return array |
783 | 783 | */ |
784 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
784 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
785 | 785 | // Using func_get_args() in order to check for proper number of |
786 | 786 | // parameters and trigger errors exactly as the built-in array_column() |
787 | 787 | // does in PHP 5.5. |
788 | 788 | $argc = func_num_args(); |
789 | 789 | $params = func_get_args(); |
790 | 790 | |
791 | - if ( $argc < 2 ) { |
|
792 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); |
|
791 | + if ($argc < 2) { |
|
792 | + trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); |
|
793 | 793 | |
794 | 794 | return null; |
795 | 795 | } |
796 | 796 | |
797 | - if ( ! is_array( $params[0] ) ) { |
|
798 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); |
|
797 | + if ( ! is_array($params[0])) { |
|
798 | + trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); |
|
799 | 799 | |
800 | 800 | return null; |
801 | 801 | } |
802 | 802 | |
803 | - if ( ! is_int( $params[1] ) |
|
804 | - && ! is_float( $params[1] ) |
|
805 | - && ! is_string( $params[1] ) |
|
803 | + if ( ! is_int($params[1]) |
|
804 | + && ! is_float($params[1]) |
|
805 | + && ! is_string($params[1]) |
|
806 | 806 | && $params[1] !== null |
807 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
807 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
808 | 808 | ) { |
809 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
809 | + trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
810 | 810 | |
811 | 811 | return false; |
812 | 812 | } |
813 | 813 | |
814 | - if ( isset( $params[2] ) |
|
815 | - && ! is_int( $params[2] ) |
|
816 | - && ! is_float( $params[2] ) |
|
817 | - && ! is_string( $params[2] ) |
|
818 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
814 | + if (isset($params[2]) |
|
815 | + && ! is_int($params[2]) |
|
816 | + && ! is_float($params[2]) |
|
817 | + && ! is_string($params[2]) |
|
818 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
819 | 819 | ) { |
820 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
820 | + trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
821 | 821 | |
822 | 822 | return false; |
823 | 823 | } |
824 | 824 | |
825 | 825 | $paramsInput = $params[0]; |
826 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
826 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
827 | 827 | |
828 | 828 | $paramsIndexKey = null; |
829 | - if ( isset( $params[2] ) ) { |
|
830 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
829 | + if (isset($params[2])) { |
|
830 | + if (is_float($params[2]) || is_int($params[2])) { |
|
831 | 831 | $paramsIndexKey = (int) $params[2]; |
832 | 832 | } else { |
833 | 833 | $paramsIndexKey = (string) $params[2]; |
@@ -836,26 +836,26 @@ discard block |
||
836 | 836 | |
837 | 837 | $resultArray = array(); |
838 | 838 | |
839 | - foreach ( $paramsInput as $row ) { |
|
839 | + foreach ($paramsInput as $row) { |
|
840 | 840 | $key = $value = null; |
841 | 841 | $keySet = $valueSet = false; |
842 | 842 | |
843 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
843 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
844 | 844 | $keySet = true; |
845 | - $key = (string) $row[ $paramsIndexKey ]; |
|
845 | + $key = (string) $row[$paramsIndexKey]; |
|
846 | 846 | } |
847 | 847 | |
848 | - if ( $paramsColumnKey === null ) { |
|
848 | + if ($paramsColumnKey === null) { |
|
849 | 849 | $valueSet = true; |
850 | 850 | $value = $row; |
851 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
851 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
852 | 852 | $valueSet = true; |
853 | - $value = $row[ $paramsColumnKey ]; |
|
853 | + $value = $row[$paramsColumnKey]; |
|
854 | 854 | } |
855 | 855 | |
856 | - if ( $valueSet ) { |
|
857 | - if ( $keySet ) { |
|
858 | - $resultArray[ $key ] = $value; |
|
856 | + if ($valueSet) { |
|
857 | + if ($keySet) { |
|
858 | + $resultArray[$key] = $value; |
|
859 | 859 | } else { |
860 | 860 | $resultArray[] = $value; |
861 | 861 | } |
@@ -875,54 +875,54 @@ discard block |
||
875 | 875 | * |
876 | 876 | * @return bool Whether the receipt is visible or not. |
877 | 877 | */ |
878 | -function give_can_view_receipt( $payment_key = '' ) { |
|
878 | +function give_can_view_receipt($payment_key = '') { |
|
879 | 879 | |
880 | 880 | $return = false; |
881 | 881 | |
882 | - if ( empty( $payment_key ) ) { |
|
882 | + if (empty($payment_key)) { |
|
883 | 883 | return $return; |
884 | 884 | } |
885 | 885 | |
886 | 886 | global $give_receipt_args; |
887 | 887 | |
888 | - $give_receipt_args['id'] = give_get_donation_id_by_key( $payment_key ); |
|
888 | + $give_receipt_args['id'] = give_get_donation_id_by_key($payment_key); |
|
889 | 889 | |
890 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
890 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
891 | 891 | |
892 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
892 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
893 | 893 | |
894 | - if ( is_user_logged_in() ) { |
|
895 | - if ( $user_id === (int) get_current_user_id() ) { |
|
894 | + if (is_user_logged_in()) { |
|
895 | + if ($user_id === (int) get_current_user_id()) { |
|
896 | 896 | $return = true; |
897 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
897 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
898 | 898 | $return = true; |
899 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
899 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
900 | 900 | $return = true; |
901 | 901 | } |
902 | 902 | } |
903 | 903 | |
904 | 904 | // Check whether it is purchase session? |
905 | 905 | $purchase_session = give_get_purchase_session(); |
906 | - if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) { |
|
907 | - if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) { |
|
906 | + if ( ! empty($purchase_session) && ! is_user_logged_in()) { |
|
907 | + if ($purchase_session['purchase_key'] === $payment_meta['key']) { |
|
908 | 908 | $return = true; |
909 | 909 | } |
910 | 910 | } |
911 | 911 | |
912 | 912 | // Check whether it is receipt access session? |
913 | 913 | $receipt_session = give_get_receipt_session(); |
914 | - if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) { |
|
915 | - if ( $receipt_session === $payment_meta['key'] ) { |
|
914 | + if ( ! empty($receipt_session) && ! is_user_logged_in()) { |
|
915 | + if ($receipt_session === $payment_meta['key']) { |
|
916 | 916 | $return = true; |
917 | 917 | } |
918 | 918 | } |
919 | 919 | |
920 | 920 | // Check whether it is history access session? |
921 | - if ( true === give_get_history_session() ) { |
|
921 | + if (true === give_get_history_session()) { |
|
922 | 922 | $return = true; |
923 | 923 | } |
924 | 924 | |
925 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
925 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
926 | 926 | |
927 | 927 | } |
928 | 928 | |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | * |
932 | 932 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
933 | 933 | */ |
934 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
934 | +if ( ! function_exists('cal_days_in_month')) { |
|
935 | 935 | /** |
936 | 936 | * cal_days_in_month |
937 | 937 | * |
@@ -941,8 +941,8 @@ discard block |
||
941 | 941 | * |
942 | 942 | * @return bool|string |
943 | 943 | */ |
944 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
945 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
944 | + function cal_days_in_month($calendar, $month, $year) { |
|
945 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
946 | 946 | } |
947 | 947 | } |
948 | 948 | |
@@ -961,40 +961,40 @@ discard block |
||
961 | 961 | */ |
962 | 962 | function give_get_plugins() { |
963 | 963 | $plugins = get_plugins(); |
964 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); |
|
964 | + $active_plugin_paths = (array) get_option('active_plugins', array()); |
|
965 | 965 | |
966 | - if ( is_multisite() ) { |
|
967 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); |
|
968 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); |
|
966 | + if (is_multisite()) { |
|
967 | + $network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); |
|
968 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); |
|
969 | 969 | } |
970 | 970 | |
971 | - foreach ( $plugins as $plugin_path => $plugin_data ) { |
|
971 | + foreach ($plugins as $plugin_path => $plugin_data) { |
|
972 | 972 | // Is plugin active? |
973 | - if ( in_array( $plugin_path, $active_plugin_paths ) ) { |
|
974 | - $plugins[ $plugin_path ]['Status'] = 'active'; |
|
973 | + if (in_array($plugin_path, $active_plugin_paths)) { |
|
974 | + $plugins[$plugin_path]['Status'] = 'active'; |
|
975 | 975 | } else { |
976 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; |
|
976 | + $plugins[$plugin_path]['Status'] = 'inactive'; |
|
977 | 977 | } |
978 | 978 | |
979 | - $dirname = strtolower( dirname( $plugin_path ) ); |
|
979 | + $dirname = strtolower(dirname($plugin_path)); |
|
980 | 980 | |
981 | 981 | // Is plugin a Give add-on by WordImpress? |
982 | - if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { |
|
982 | + if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { |
|
983 | 983 | // Plugin is a Give-addon. |
984 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; |
|
984 | + $plugins[$plugin_path]['Type'] = 'add-on'; |
|
985 | 985 | |
986 | 986 | /* @var stdClass $license_active */ |
987 | - $license_active = __give_get_active_license_info( Give_License::get_short_name( $plugin_data['Name'] ) ); |
|
987 | + $license_active = __give_get_active_license_info(Give_License::get_short_name($plugin_data['Name'])); |
|
988 | 988 | |
989 | 989 | // Does a valid license exist? |
990 | - if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { |
|
991 | - $plugins[ $plugin_path ]['License'] = true; |
|
990 | + if ( ! empty($license_active) && 'valid' === $license_active->license) { |
|
991 | + $plugins[$plugin_path]['License'] = true; |
|
992 | 992 | } else { |
993 | - $plugins[ $plugin_path ]['License'] = false; |
|
993 | + $plugins[$plugin_path]['License'] = false; |
|
994 | 994 | } |
995 | 995 | } else { |
996 | 996 | // Plugin is not a Give add-on. |
997 | - $plugins[ $plugin_path ]['Type'] = 'other'; |
|
997 | + $plugins[$plugin_path]['Type'] = 'other'; |
|
998 | 998 | } |
999 | 999 | } |
1000 | 1000 | |
@@ -1010,16 +1010,16 @@ discard block |
||
1010 | 1010 | * |
1011 | 1011 | * @return bool |
1012 | 1012 | */ |
1013 | -function give_is_terms_enabled( $form_id ) { |
|
1014 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
1013 | +function give_is_terms_enabled($form_id) { |
|
1014 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
1015 | 1015 | |
1016 | 1016 | if ( |
1017 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1018 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1017 | + give_is_setting_enabled($form_option, 'global') |
|
1018 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1019 | 1019 | ) { |
1020 | 1020 | return true; |
1021 | 1021 | |
1022 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1022 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1023 | 1023 | return true; |
1024 | 1024 | |
1025 | 1025 | } else { |
@@ -1043,10 +1043,10 @@ discard block |
||
1043 | 1043 | * |
1044 | 1044 | * @return WP_Error|bool |
1045 | 1045 | */ |
1046 | -function give_delete_donation_stats( $date_range = '', $args = array() ) { |
|
1046 | +function give_delete_donation_stats($date_range = '', $args = array()) { |
|
1047 | 1047 | |
1048 | 1048 | // Delete all cache. |
1049 | - $status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) ); |
|
1049 | + $status = Give_Cache::delete(Give_Cache::get_options_like('give_stats')); |
|
1050 | 1050 | |
1051 | 1051 | /** |
1052 | 1052 | * Fire the action when donation stats delete. |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | * @param string|array $date_range |
1057 | 1057 | * @param array $args |
1058 | 1058 | */ |
1059 | - do_action( 'give_delete_donation_stats', $status, $date_range, $args ); |
|
1059 | + do_action('give_delete_donation_stats', $status, $date_range, $args); |
|
1060 | 1060 | |
1061 | 1061 | return $status; |
1062 | 1062 | } |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | function give_is_add_new_form_page() { |
1071 | 1071 | $status = false; |
1072 | 1072 | |
1073 | - if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) { |
|
1073 | + if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) { |
|
1074 | 1074 | $status = true; |
1075 | 1075 | } |
1076 | 1076 | |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | * |
1094 | 1094 | * @return mixed |
1095 | 1095 | */ |
1096 | -function give_get_meta( $id, $meta_key = '', $single = false, $default = false ) { |
|
1096 | +function give_get_meta($id, $meta_key = '', $single = false, $default = false) { |
|
1097 | 1097 | /** |
1098 | 1098 | * Filter the meta value |
1099 | 1099 | * |
@@ -1101,14 +1101,14 @@ discard block |
||
1101 | 1101 | */ |
1102 | 1102 | $meta_value = apply_filters( |
1103 | 1103 | 'give_get_meta', |
1104 | - get_post_meta( $id, $meta_key, $single ), |
|
1104 | + get_post_meta($id, $meta_key, $single), |
|
1105 | 1105 | $id, |
1106 | 1106 | $meta_key, |
1107 | 1107 | $default |
1108 | 1108 | ); |
1109 | 1109 | |
1110 | 1110 | if ( |
1111 | - ( empty( $meta_key ) || empty( $meta_value ) ) |
|
1111 | + (empty($meta_key) || empty($meta_value)) |
|
1112 | 1112 | && $default |
1113 | 1113 | ) { |
1114 | 1114 | $meta_value = $default; |
@@ -1129,15 +1129,15 @@ discard block |
||
1129 | 1129 | * |
1130 | 1130 | * @return mixed |
1131 | 1131 | */ |
1132 | -function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1133 | - $status = update_post_meta( $id, $meta_key, $meta_value, $prev_value ); |
|
1132 | +function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') { |
|
1133 | + $status = update_post_meta($id, $meta_key, $meta_value, $prev_value); |
|
1134 | 1134 | |
1135 | 1135 | /** |
1136 | 1136 | * Filter the meta value update status |
1137 | 1137 | * |
1138 | 1138 | * @since 1.8.8 |
1139 | 1139 | */ |
1140 | - return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value ); |
|
1140 | + return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value); |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | /** |
@@ -1151,15 +1151,15 @@ discard block |
||
1151 | 1151 | * |
1152 | 1152 | * @return mixed |
1153 | 1153 | */ |
1154 | -function give_delete_meta( $id, $meta_key, $meta_value = '' ) { |
|
1155 | - $status = delete_post_meta( $id, $meta_key, $meta_value ); |
|
1154 | +function give_delete_meta($id, $meta_key, $meta_value = '') { |
|
1155 | + $status = delete_post_meta($id, $meta_key, $meta_value); |
|
1156 | 1156 | |
1157 | 1157 | /** |
1158 | 1158 | * Filter the meta value delete status |
1159 | 1159 | * |
1160 | 1160 | * @since 1.8.8 |
1161 | 1161 | */ |
1162 | - return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value ); |
|
1162 | + return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value); |
|
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | /** |
@@ -1171,23 +1171,23 @@ discard block |
||
1171 | 1171 | * |
1172 | 1172 | * @return bool If the action has been added to the completed actions array |
1173 | 1173 | */ |
1174 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
1174 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
1175 | 1175 | // Bailout. |
1176 | - if ( empty( $upgrade_action ) ) { |
|
1176 | + if (empty($upgrade_action)) { |
|
1177 | 1177 | return false; |
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | // Fresh install? |
1181 | 1181 | // If fresh install then all upgrades will be consider as completed. |
1182 | - $is_fresh_install = ! get_option( 'give_version' ); |
|
1183 | - if ( $is_fresh_install ) { |
|
1182 | + $is_fresh_install = ! get_option('give_version'); |
|
1183 | + if ($is_fresh_install) { |
|
1184 | 1184 | return true; |
1185 | 1185 | } |
1186 | 1186 | |
1187 | 1187 | |
1188 | 1188 | $completed_upgrades = give_get_completed_upgrades(); |
1189 | 1189 | |
1190 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
1190 | + return in_array($upgrade_action, $completed_upgrades); |
|
1191 | 1191 | |
1192 | 1192 | } |
1193 | 1193 | |
@@ -1199,8 +1199,8 @@ discard block |
||
1199 | 1199 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
1200 | 1200 | */ |
1201 | 1201 | function give_maybe_resume_upgrade() { |
1202 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
1203 | - if ( empty( $doing_upgrade ) ) { |
|
1202 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
1203 | + if (empty($doing_upgrade)) { |
|
1204 | 1204 | return false; |
1205 | 1205 | } |
1206 | 1206 | |
@@ -1216,9 +1216,9 @@ discard block |
||
1216 | 1216 | * |
1217 | 1217 | * @return bool If the function was successfully added |
1218 | 1218 | */ |
1219 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
1219 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
1220 | 1220 | |
1221 | - if ( empty( $upgrade_action ) ) { |
|
1221 | + if (empty($upgrade_action)) { |
|
1222 | 1222 | return false; |
1223 | 1223 | } |
1224 | 1224 | |
@@ -1226,16 +1226,16 @@ discard block |
||
1226 | 1226 | $completed_upgrades[] = $upgrade_action; |
1227 | 1227 | |
1228 | 1228 | // Remove any blanks, and only show uniques. |
1229 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
1229 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
1230 | 1230 | |
1231 | 1231 | /** |
1232 | 1232 | * Fire the action when any upgrade set to complete. |
1233 | 1233 | * |
1234 | 1234 | * @since 1.8.12 |
1235 | 1235 | */ |
1236 | - do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades ); |
|
1236 | + do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades); |
|
1237 | 1237 | |
1238 | - return update_option( 'give_completed_upgrades', $completed_upgrades, 'no' ); |
|
1238 | + return update_option('give_completed_upgrades', $completed_upgrades, 'no'); |
|
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | /** |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | * @return array The array of completed upgrades |
1246 | 1246 | */ |
1247 | 1247 | function give_get_completed_upgrades() { |
1248 | - return (array) get_option( 'give_completed_upgrades' ); |
|
1248 | + return (array) get_option('give_completed_upgrades'); |
|
1249 | 1249 | } |
1250 | 1250 | |
1251 | 1251 | /** |
@@ -1260,16 +1260,16 @@ discard block |
||
1260 | 1260 | * |
1261 | 1261 | * @return null|array |
1262 | 1262 | */ |
1263 | -function __give_v20_bc_table_details( $type ) { |
|
1263 | +function __give_v20_bc_table_details($type) { |
|
1264 | 1264 | global $wpdb; |
1265 | 1265 | $table = array(); |
1266 | 1266 | |
1267 | 1267 | // Bailout. |
1268 | - if ( empty( $type ) ) { |
|
1268 | + if (empty($type)) { |
|
1269 | 1269 | return null; |
1270 | 1270 | } |
1271 | 1271 | |
1272 | - switch ( $type ) { |
|
1272 | + switch ($type) { |
|
1273 | 1273 | case 'form': |
1274 | 1274 | $table['name'] = $wpdb->formmeta; |
1275 | 1275 | $table['column']['id'] = 'form_id'; |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | } |
1283 | 1283 | |
1284 | 1284 | // Backward compatibility. |
1285 | - if ( ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) ) { |
|
1285 | + if ( ! give_has_upgrade_completed('v20_move_metadata_into_new_table')) { |
|
1286 | 1286 | $table['name'] = $wpdb->postmeta; |
1287 | 1287 | $table['column']['id'] = 'post_id'; |
1288 | 1288 | } |
@@ -1298,12 +1298,12 @@ discard block |
||
1298 | 1298 | * |
1299 | 1299 | * @param WP_Query $query |
1300 | 1300 | */ |
1301 | -function give_remove_pages_from_search( $query ) { |
|
1301 | +function give_remove_pages_from_search($query) { |
|
1302 | 1302 | |
1303 | - if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) { |
|
1303 | + if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) { |
|
1304 | 1304 | |
1305 | - $transaction_failed = give_get_option( 'failure_page', 0 ); |
|
1306 | - $success_page = give_get_option( 'success_page', 0 ); |
|
1305 | + $transaction_failed = give_get_option('failure_page', 0); |
|
1306 | + $success_page = give_get_option('success_page', 0); |
|
1307 | 1307 | |
1308 | 1308 | $args = apply_filters( |
1309 | 1309 | 'give_remove_pages_from_search', array( |
@@ -1311,11 +1311,11 @@ discard block |
||
1311 | 1311 | $success_page, |
1312 | 1312 | ), $query |
1313 | 1313 | ); |
1314 | - $query->set( 'post__not_in', $args ); |
|
1314 | + $query->set('post__not_in', $args); |
|
1315 | 1315 | } |
1316 | 1316 | } |
1317 | 1317 | |
1318 | -add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 ); |
|
1318 | +add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1); |
|
1319 | 1319 | |
1320 | 1320 | /** |
1321 | 1321 | * Inserts a new key/value before a key in the array. |
@@ -1331,14 +1331,14 @@ discard block |
||
1331 | 1331 | * |
1332 | 1332 | * @see array_insert_before() |
1333 | 1333 | */ |
1334 | -function give_array_insert_before( $key, array &$array, $new_key, $new_value ) { |
|
1335 | - if ( array_key_exists( $key, $array ) ) { |
|
1334 | +function give_array_insert_before($key, array &$array, $new_key, $new_value) { |
|
1335 | + if (array_key_exists($key, $array)) { |
|
1336 | 1336 | $new = array(); |
1337 | - foreach ( $array as $k => $value ) { |
|
1338 | - if ( $k === $key ) { |
|
1339 | - $new[ $new_key ] = $new_value; |
|
1337 | + foreach ($array as $k => $value) { |
|
1338 | + if ($k === $key) { |
|
1339 | + $new[$new_key] = $new_value; |
|
1340 | 1340 | } |
1341 | - $new[ $k ] = $value; |
|
1341 | + $new[$k] = $value; |
|
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | return $new; |
@@ -1361,13 +1361,13 @@ discard block |
||
1361 | 1361 | * |
1362 | 1362 | * @see array_insert_before() |
1363 | 1363 | */ |
1364 | -function give_array_insert_after( $key, array &$array, $new_key, $new_value ) { |
|
1365 | - if ( array_key_exists( $key, $array ) ) { |
|
1364 | +function give_array_insert_after($key, array &$array, $new_key, $new_value) { |
|
1365 | + if (array_key_exists($key, $array)) { |
|
1366 | 1366 | $new = array(); |
1367 | - foreach ( $array as $k => $value ) { |
|
1368 | - $new[ $k ] = $value; |
|
1369 | - if ( $k === $key ) { |
|
1370 | - $new[ $new_key ] = $new_value; |
|
1367 | + foreach ($array as $k => $value) { |
|
1368 | + $new[$k] = $value; |
|
1369 | + if ($k === $key) { |
|
1370 | + $new[$new_key] = $new_value; |
|
1371 | 1371 | } |
1372 | 1372 | } |
1373 | 1373 | |
@@ -1394,21 +1394,21 @@ discard block |
||
1394 | 1394 | * corresponding to `$index_key`. If `$index_key` is null, array keys from the original |
1395 | 1395 | * `$list` will be preserved in the results. |
1396 | 1396 | */ |
1397 | -function give_list_pluck( $list, $field, $index_key = null ) { |
|
1397 | +function give_list_pluck($list, $field, $index_key = null) { |
|
1398 | 1398 | |
1399 | - if ( ! $index_key ) { |
|
1399 | + if ( ! $index_key) { |
|
1400 | 1400 | /** |
1401 | 1401 | * This is simple. Could at some point wrap array_column() |
1402 | 1402 | * if we knew we had an array of arrays. |
1403 | 1403 | */ |
1404 | - foreach ( $list as $key => $value ) { |
|
1405 | - if ( is_object( $value ) ) { |
|
1406 | - if ( isset( $value->$field ) ) { |
|
1407 | - $list[ $key ] = $value->$field; |
|
1404 | + foreach ($list as $key => $value) { |
|
1405 | + if (is_object($value)) { |
|
1406 | + if (isset($value->$field)) { |
|
1407 | + $list[$key] = $value->$field; |
|
1408 | 1408 | } |
1409 | 1409 | } else { |
1410 | - if ( isset( $value[ $field ] ) ) { |
|
1411 | - $list[ $key ] = $value[ $field ]; |
|
1410 | + if (isset($value[$field])) { |
|
1411 | + $list[$key] = $value[$field]; |
|
1412 | 1412 | } |
1413 | 1413 | } |
1414 | 1414 | } |
@@ -1421,18 +1421,18 @@ discard block |
||
1421 | 1421 | * to the end of the stack. This is how array_column() behaves. |
1422 | 1422 | */ |
1423 | 1423 | $newlist = array(); |
1424 | - foreach ( $list as $value ) { |
|
1425 | - if ( is_object( $value ) ) { |
|
1426 | - if ( isset( $value->$index_key ) ) { |
|
1427 | - $newlist[ $value->$index_key ] = $value->$field; |
|
1424 | + foreach ($list as $value) { |
|
1425 | + if (is_object($value)) { |
|
1426 | + if (isset($value->$index_key)) { |
|
1427 | + $newlist[$value->$index_key] = $value->$field; |
|
1428 | 1428 | } else { |
1429 | 1429 | $newlist[] = $value->$field; |
1430 | 1430 | } |
1431 | 1431 | } else { |
1432 | - if ( isset( $value[ $index_key ] ) ) { |
|
1433 | - $newlist[ $value[ $index_key ] ] = $value[ $field ]; |
|
1432 | + if (isset($value[$index_key])) { |
|
1433 | + $newlist[$value[$index_key]] = $value[$field]; |
|
1434 | 1434 | } else { |
1435 | - $newlist[] = $value[ $field ]; |
|
1435 | + $newlist[] = $value[$field]; |
|
1436 | 1436 | } |
1437 | 1437 | } |
1438 | 1438 | } |
@@ -1455,8 +1455,8 @@ discard block |
||
1455 | 1455 | * |
1456 | 1456 | * @return int|false Meta ID on success, false on failure. |
1457 | 1457 | */ |
1458 | -function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) { |
|
1459 | - return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
1458 | +function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) { |
|
1459 | + return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique); |
|
1460 | 1460 | } |
1461 | 1461 | |
1462 | 1462 | /** |
@@ -1474,8 +1474,8 @@ discard block |
||
1474 | 1474 | * |
1475 | 1475 | * @return bool True on success, false on failure. |
1476 | 1476 | */ |
1477 | -function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) { |
|
1478 | - return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value ); |
|
1477 | +function delete_donor_meta($donor_id, $meta_key, $meta_value = '') { |
|
1478 | + return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value); |
|
1479 | 1479 | } |
1480 | 1480 | |
1481 | 1481 | /** |
@@ -1490,8 +1490,8 @@ discard block |
||
1490 | 1490 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single |
1491 | 1491 | * is true. |
1492 | 1492 | */ |
1493 | -function get_donor_meta( $donor_id, $key = '', $single = false ) { |
|
1494 | - return get_metadata( 'give_customer', $donor_id, $key, $single ); |
|
1493 | +function get_donor_meta($donor_id, $key = '', $single = false) { |
|
1494 | + return get_metadata('give_customer', $donor_id, $key, $single); |
|
1495 | 1495 | } |
1496 | 1496 | |
1497 | 1497 | /** |
@@ -1508,8 +1508,8 @@ discard block |
||
1508 | 1508 | * |
1509 | 1509 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure. |
1510 | 1510 | */ |
1511 | -function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1512 | - return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
1511 | +function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') { |
|
1512 | + return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
1513 | 1513 | } |
1514 | 1514 | |
1515 | 1515 | |
@@ -1522,15 +1522,15 @@ discard block |
||
1522 | 1522 | * |
1523 | 1523 | * @return void |
1524 | 1524 | */ |
1525 | -function give_recount_form_income_donation( $form_id = 0 ) { |
|
1525 | +function give_recount_form_income_donation($form_id = 0) { |
|
1526 | 1526 | // Check if form id is not empty. |
1527 | - if ( ! empty( $form_id ) ) { |
|
1527 | + if ( ! empty($form_id)) { |
|
1528 | 1528 | /** |
1529 | 1529 | * Filter to modify payment status. |
1530 | 1530 | * |
1531 | 1531 | * @since 1.8.13 |
1532 | 1532 | */ |
1533 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
1533 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
1534 | 1534 | |
1535 | 1535 | /** |
1536 | 1536 | * Filter to modify args of payment query before recalculating the form total |
@@ -1541,7 +1541,7 @@ discard block |
||
1541 | 1541 | 'give_recount_form_stats_args', array( |
1542 | 1542 | 'give_forms' => $form_id, |
1543 | 1543 | 'status' => $accepted_statuses, |
1544 | - 'posts_per_page' => - 1, |
|
1544 | + 'posts_per_page' => -1, |
|
1545 | 1545 | 'fields' => 'ids', |
1546 | 1546 | ) |
1547 | 1547 | ); |
@@ -1551,28 +1551,28 @@ discard block |
||
1551 | 1551 | 'earnings' => 0, |
1552 | 1552 | ); |
1553 | 1553 | |
1554 | - $payments = new Give_Payments_Query( $args ); |
|
1554 | + $payments = new Give_Payments_Query($args); |
|
1555 | 1555 | $payments = $payments->get_payments(); |
1556 | 1556 | |
1557 | - if ( $payments ) { |
|
1558 | - foreach ( $payments as $payment ) { |
|
1557 | + if ($payments) { |
|
1558 | + foreach ($payments as $payment) { |
|
1559 | 1559 | // Ensure acceptible status only |
1560 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
1560 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
1561 | 1561 | continue; |
1562 | 1562 | } |
1563 | 1563 | |
1564 | 1564 | // Ensure only payments for this form are counted |
1565 | - if ( $payment->form_id != $form_id ) { |
|
1565 | + if ($payment->form_id != $form_id) { |
|
1566 | 1566 | continue; |
1567 | 1567 | } |
1568 | 1568 | |
1569 | - $totals['sales'] ++; |
|
1569 | + $totals['sales']++; |
|
1570 | 1570 | $totals['earnings'] += $payment->total; |
1571 | 1571 | |
1572 | 1572 | } |
1573 | 1573 | } |
1574 | - give_update_meta( $form_id, '_give_form_sales', $totals['sales'] ); |
|
1575 | - give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) ); |
|
1574 | + give_update_meta($form_id, '_give_form_sales', $totals['sales']); |
|
1575 | + give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings'])); |
|
1576 | 1576 | }// End if(). |
1577 | 1577 | } |
1578 | 1578 | |
@@ -1586,18 +1586,18 @@ discard block |
||
1586 | 1586 | * |
1587 | 1587 | * @return string |
1588 | 1588 | */ |
1589 | -function give_get_attribute_str( $attributes ) { |
|
1589 | +function give_get_attribute_str($attributes) { |
|
1590 | 1590 | $attribute_str = ''; |
1591 | 1591 | |
1592 | - if ( empty( $attributes ) ) { |
|
1592 | + if (empty($attributes)) { |
|
1593 | 1593 | return $attribute_str; |
1594 | 1594 | } |
1595 | 1595 | |
1596 | - foreach ( $attributes as $tag => $value ) { |
|
1596 | + foreach ($attributes as $tag => $value) { |
|
1597 | 1597 | $attribute_str .= " {$tag}=\"{$value}\""; |
1598 | 1598 | } |
1599 | 1599 | |
1600 | - return trim( $attribute_str ); |
|
1600 | + return trim($attribute_str); |
|
1601 | 1601 | } |
1602 | 1602 | |
1603 | 1603 | /** |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | function give_get_wp_upload_dir() { |
1611 | 1611 | $wp_upload_dir = wp_upload_dir(); |
1612 | 1612 | |
1613 | - return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false ); |
|
1613 | + return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false); |
|
1614 | 1614 | } |
1615 | 1615 | |
1616 | 1616 | /** |
@@ -1622,15 +1622,15 @@ discard block |
||
1622 | 1622 | * |
1623 | 1623 | * @return string|bool $file_contents File content |
1624 | 1624 | */ |
1625 | -function give_get_core_settings_json( $file_name ) { |
|
1625 | +function give_get_core_settings_json($file_name) { |
|
1626 | 1626 | $upload_dir = give_get_wp_upload_dir(); |
1627 | - $file_path = $upload_dir . '/' . $file_name; |
|
1627 | + $file_path = $upload_dir.'/'.$file_name; |
|
1628 | 1628 | |
1629 | - if ( is_wp_error( $file_path ) || empty( $file_path ) ) { |
|
1630 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
1629 | + if (is_wp_error($file_path) || empty($file_path)) { |
|
1630 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
1631 | 1631 | } |
1632 | 1632 | |
1633 | - $file_contents = file_get_contents( $file_path ); |
|
1633 | + $file_contents = file_get_contents($file_path); |
|
1634 | 1634 | |
1635 | 1635 | return $file_contents; |
1636 | 1636 | } |
@@ -1643,7 +1643,7 @@ discard block |
||
1643 | 1643 | * @return int $country The two letter country code for the site's base country |
1644 | 1644 | */ |
1645 | 1645 | function give_get_limit_display_donations() { |
1646 | - return give_get_option( 'limit_display_donations', 1 ); |
|
1646 | + return give_get_option('limit_display_donations', 1); |
|
1647 | 1647 | } |
1648 | 1648 | |
1649 | 1649 | /** |
@@ -1652,7 +1652,7 @@ discard block |
||
1652 | 1652 | * @since 1.8.17 |
1653 | 1653 | */ |
1654 | 1654 | function give_donation_history_table_end() { |
1655 | - $email = Give()->session->get( 'give_email' ); |
|
1655 | + $email = Give()->session->get('give_email'); |
|
1656 | 1656 | ?> |
1657 | 1657 | <tfoot> |
1658 | 1658 | <tr> |
@@ -1661,16 +1661,16 @@ discard block |
||
1661 | 1661 | <div class="give-security-column give-security-description-wrap"> |
1662 | 1662 | <?php |
1663 | 1663 | echo sprintf( |
1664 | - __( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ), |
|
1664 | + __('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'), |
|
1665 | 1665 | |
1666 | 1666 | ); |
1667 | 1667 | ?> |
1668 | 1668 | </div> |
1669 | 1669 | <div class="give-security-column give-security-button-wrap"> |
1670 | 1670 | <a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn" class="give-confirm-email-btn give-btn"> |
1671 | - <?php _e( 'Confirm Email', 'give' ); ?> |
|
1671 | + <?php _e('Confirm Email', 'give'); ?> |
|
1672 | 1672 | </a> |
1673 | - <span><?php _e( 'Email Sent!', 'give' ); ?></span> |
|
1673 | + <span><?php _e('Email Sent!', 'give'); ?></span> |
|
1674 | 1674 | </div> |
1675 | 1675 | </div> |
1676 | 1676 | </td> |
@@ -1690,10 +1690,10 @@ discard block |
||
1690 | 1690 | * |
1691 | 1691 | * @return void |
1692 | 1692 | */ |
1693 | -function give_doing_it_wrong( $function, $message, $version ) { |
|
1694 | - $message .= "\nBacktrace:" . wp_debug_backtrace_summary(); |
|
1693 | +function give_doing_it_wrong($function, $message, $version) { |
|
1694 | + $message .= "\nBacktrace:".wp_debug_backtrace_summary(); |
|
1695 | 1695 | |
1696 | - _doing_it_wrong( $function, $message , $version ); |
|
1696 | + _doing_it_wrong($function, $message, $version); |
|
1697 | 1697 | } |
1698 | 1698 | |
1699 | 1699 | |
@@ -1702,11 +1702,11 @@ discard block |
||
1702 | 1702 | * |
1703 | 1703 | * @since 1.8.18 |
1704 | 1704 | */ |
1705 | -function give_ignore_user_abort(){ |
|
1706 | - ignore_user_abort( true ); |
|
1705 | +function give_ignore_user_abort() { |
|
1706 | + ignore_user_abort(true); |
|
1707 | 1707 | |
1708 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
1709 | - set_time_limit( 0 ); |
|
1708 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
1709 | + set_time_limit(0); |
|
1710 | 1710 | } |
1711 | 1711 | } |
1712 | 1712 | |
@@ -1720,28 +1720,28 @@ discard block |
||
1720 | 1720 | * |
1721 | 1721 | * @return int |
1722 | 1722 | */ |
1723 | -function give_get_total_post_type_count( $post_type = '', $args = array() ){ |
|
1723 | +function give_get_total_post_type_count($post_type = '', $args = array()) { |
|
1724 | 1724 | global $wpdb; |
1725 | 1725 | $where = ''; |
1726 | 1726 | |
1727 | - if( ! $post_type ) { |
|
1727 | + if ( ! $post_type) { |
|
1728 | 1728 | return 0; |
1729 | 1729 | } |
1730 | 1730 | |
1731 | 1731 | // Bulit where query |
1732 | - if( ! empty( $post_type ) ) { |
|
1733 | - $where.=' WHERE'; |
|
1732 | + if ( ! empty($post_type)) { |
|
1733 | + $where .= ' WHERE'; |
|
1734 | 1734 | |
1735 | - if( is_array( $post_type ) ) { |
|
1736 | - $where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'"; |
|
1737 | - }else{ |
|
1735 | + if (is_array($post_type)) { |
|
1736 | + $where .= " post_type='".implode("' OR post_type='", $post_type)."'"; |
|
1737 | + } else { |
|
1738 | 1738 | $where .= " post_type='{$post_type}'"; |
1739 | 1739 | } |
1740 | 1740 | } |
1741 | 1741 | |
1742 | 1742 | $result = $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts}{$where}"); |
1743 | 1743 | |
1744 | - return absint( $result ); |
|
1744 | + return absint($result); |
|
1745 | 1745 | } |
1746 | 1746 | |
1747 | 1747 | /** |
@@ -1753,9 +1753,9 @@ discard block |
||
1753 | 1753 | * |
1754 | 1754 | * @credit WooCommerce |
1755 | 1755 | */ |
1756 | -function give_maybe_define_constant( $name, $value ) { |
|
1757 | - if ( ! defined( $name ) ) { |
|
1758 | - define( $name, $value ); |
|
1756 | +function give_maybe_define_constant($name, $value) { |
|
1757 | + if ( ! defined($name)) { |
|
1758 | + define($name, $value); |
|
1759 | 1759 | } |
1760 | 1760 | } |
1761 | 1761 | |
@@ -1769,8 +1769,8 @@ discard block |
||
1769 | 1769 | * |
1770 | 1770 | * @return string |
1771 | 1771 | */ |
1772 | -function give_time_do_tags( $string, $timestamp = 0 ) { |
|
1773 | - $current_time = ! empty( $timestamp ) ? $timestamp : current_time( 'timestamp' ); |
|
1772 | +function give_time_do_tags($string, $timestamp = 0) { |
|
1773 | + $current_time = ! empty($timestamp) ? $timestamp : current_time('timestamp'); |
|
1774 | 1774 | |
1775 | 1775 | $formatted_string = str_replace( |
1776 | 1776 | array( |
@@ -1786,15 +1786,15 @@ discard block |
||
1786 | 1786 | '{S}' |
1787 | 1787 | ), |
1788 | 1788 | array( |
1789 | - date( 'j', $current_time ), |
|
1790 | - date( 'd', $current_time ), |
|
1791 | - date( 'n', $current_time ), |
|
1792 | - date( 'm', $current_time ), |
|
1793 | - date( 'Y', $current_time ), |
|
1794 | - date( 'Y', $current_time ), |
|
1795 | - date( 'G', $current_time ), |
|
1796 | - date( 'H', $current_time ), |
|
1797 | - date( 's', $current_time ) |
|
1789 | + date('j', $current_time), |
|
1790 | + date('d', $current_time), |
|
1791 | + date('n', $current_time), |
|
1792 | + date('m', $current_time), |
|
1793 | + date('Y', $current_time), |
|
1794 | + date('Y', $current_time), |
|
1795 | + date('G', $current_time), |
|
1796 | + date('H', $current_time), |
|
1797 | + date('s', $current_time) |
|
1798 | 1798 | ), |
1799 | 1799 | $string |
1800 | 1800 | ); |
@@ -1804,7 +1804,7 @@ discard block |
||
1804 | 1804 | * |
1805 | 1805 | * @since 2.1.0 |
1806 | 1806 | */ |
1807 | - return apply_filters( 'give_time_do_tags', $formatted_string, $string, $timestamp ); |
|
1807 | + return apply_filters('give_time_do_tags', $formatted_string, $string, $timestamp); |
|
1808 | 1808 | } |
1809 | 1809 | |
1810 | 1810 | |
@@ -1817,20 +1817,20 @@ discard block |
||
1817 | 1817 | * |
1818 | 1818 | * @return bool |
1819 | 1819 | */ |
1820 | -function give_is_company_field_enabled( $form_id ) { |
|
1821 | - $form_setting_val = give_get_meta( $form_id, '_give_company_field', true ); |
|
1822 | - $global_setting_val = give_get_option( 'company_field' ); |
|
1820 | +function give_is_company_field_enabled($form_id) { |
|
1821 | + $form_setting_val = give_get_meta($form_id, '_give_company_field', true); |
|
1822 | + $global_setting_val = give_get_option('company_field'); |
|
1823 | 1823 | |
1824 | - if ( ! empty( $form_setting_val ) ) { |
|
1825 | - if( give_is_setting_enabled( $form_setting_val, array( 'required', 'optional' ) ) ) { |
|
1824 | + if ( ! empty($form_setting_val)) { |
|
1825 | + if (give_is_setting_enabled($form_setting_val, array('required', 'optional'))) { |
|
1826 | 1826 | return true; |
1827 | - } elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val, array( 'required', 'optional' ) ) ) { |
|
1827 | + } elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val, array('required', 'optional'))) { |
|
1828 | 1828 | return true; |
1829 | - } else{ |
|
1829 | + } else { |
|
1830 | 1830 | return false; |
1831 | 1831 | } |
1832 | 1832 | |
1833 | - } elseif ( give_is_setting_enabled( $global_setting_val, array( 'required', 'optional' ) ) ) { |
|
1833 | + } elseif (give_is_setting_enabled($global_setting_val, array('required', 'optional'))) { |
|
1834 | 1834 | return true; |
1835 | 1835 | |
1836 | 1836 | } else { |
@@ -1848,13 +1848,13 @@ discard block |
||
1848 | 1848 | * |
1849 | 1849 | * @return array |
1850 | 1850 | */ |
1851 | -function __give_get_active_license_info( $license_id ) { |
|
1851 | +function __give_get_active_license_info($license_id) { |
|
1852 | 1852 | global $wpdb; |
1853 | 1853 | $option_name = "{$license_id}_license_active"; |
1854 | 1854 | $data = array(); |
1855 | 1855 | |
1856 | - if ( ! isset( $GLOBALS['give_active_licenses_info'] ) ) { |
|
1857 | - $GLOBALS['give_active_licenses_info'] = array(); |
|
1856 | + if ( ! isset($GLOBALS['give_active_licenses_info'])) { |
|
1857 | + $GLOBALS['give_active_licenses_info'] = array(); |
|
1858 | 1858 | |
1859 | 1859 | $licenses_info = $wpdb->get_results( |
1860 | 1860 | " |
@@ -1866,16 +1866,16 @@ discard block |
||
1866 | 1866 | ARRAY_A |
1867 | 1867 | ); |
1868 | 1868 | |
1869 | - if ( ! empty( $licenses_info ) ) { |
|
1869 | + if ( ! empty($licenses_info)) { |
|
1870 | 1870 | $GLOBALS['give_active_licenses_info'] = array_combine( |
1871 | - wp_list_pluck( $licenses_info, 'option_name' ), |
|
1872 | - wp_list_pluck( $licenses_info, 'option_value' ) |
|
1871 | + wp_list_pluck($licenses_info, 'option_name'), |
|
1872 | + wp_list_pluck($licenses_info, 'option_value') |
|
1873 | 1873 | ); |
1874 | 1874 | } |
1875 | 1875 | } |
1876 | 1876 | |
1877 | - if ( in_array( $option_name, array_keys( $GLOBALS['give_active_licenses_info'] ) ) ) { |
|
1878 | - $data = maybe_unserialize( $GLOBALS['give_active_licenses_info'][ $option_name ] ); |
|
1877 | + if (in_array($option_name, array_keys($GLOBALS['give_active_licenses_info']))) { |
|
1878 | + $data = maybe_unserialize($GLOBALS['give_active_licenses_info'][$option_name]); |
|
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | return $data; |
@@ -1891,18 +1891,18 @@ discard block |
||
1891 | 1891 | * |
1892 | 1892 | * @return array |
1893 | 1893 | */ |
1894 | -function __give_get_active_by_user_meta( $banner_addon_name ) { |
|
1894 | +function __give_get_active_by_user_meta($banner_addon_name) { |
|
1895 | 1895 | global $wpdb; |
1896 | 1896 | |
1897 | 1897 | // Get the option key. |
1898 | - $option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key( $banner_addon_name ); |
|
1898 | + $option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key($banner_addon_name); |
|
1899 | 1899 | $data = array(); |
1900 | 1900 | |
1901 | 1901 | if ( |
1902 | - ! isset( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] ) |
|
1903 | - || empty( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] ) |
|
1902 | + ! isset($GLOBALS['give_addon_activated_by_user'][$banner_addon_name]) |
|
1903 | + || empty($GLOBALS['give_addon_activated_by_user'][$banner_addon_name]) |
|
1904 | 1904 | ) { |
1905 | - $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] = array(); |
|
1905 | + $GLOBALS['give_addon_activated_by_user'][$banner_addon_name] = array(); |
|
1906 | 1906 | |
1907 | 1907 | // Get the meta of activation banner by user. |
1908 | 1908 | $activation_banners = $wpdb->get_results( |
@@ -1915,16 +1915,16 @@ discard block |
||
1915 | 1915 | ARRAY_A |
1916 | 1916 | ); |
1917 | 1917 | |
1918 | - if ( ! empty( $activation_banners ) ) { |
|
1918 | + if ( ! empty($activation_banners)) { |
|
1919 | 1919 | $GLOBALS['give_addon_activated_by_user'] = array_combine( |
1920 | - wp_list_pluck( $activation_banners, 'option_name' ), |
|
1921 | - wp_list_pluck( $activation_banners, 'option_value' ) |
|
1920 | + wp_list_pluck($activation_banners, 'option_name'), |
|
1921 | + wp_list_pluck($activation_banners, 'option_value') |
|
1922 | 1922 | ); |
1923 | 1923 | } |
1924 | 1924 | } |
1925 | 1925 | |
1926 | - if ( in_array( $option_name, array_keys( $GLOBALS['give_addon_activated_by_user'] ) ) ) { |
|
1927 | - $data = maybe_unserialize( $GLOBALS['give_addon_activated_by_user'][ $option_name ] ); |
|
1926 | + if (in_array($option_name, array_keys($GLOBALS['give_addon_activated_by_user']))) { |
|
1927 | + $data = maybe_unserialize($GLOBALS['give_addon_activated_by_user'][$option_name]); |
|
1928 | 1928 | } |
1929 | 1929 | |
1930 | 1930 | return $data; |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | |
41 | 41 | // Exit if accessed directly. |
42 | -if ( ! defined( 'ABSPATH' ) ) { |
|
42 | +if ( ! defined('ABSPATH')) { |
|
43 | 43 | exit; |
44 | 44 | } |
45 | 45 | |
46 | -if ( ! class_exists( 'Give' ) ) : |
|
46 | +if ( ! class_exists('Give')) : |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Main Give Class |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @return Give |
262 | 262 | */ |
263 | 263 | public static function instance() { |
264 | - if ( is_null( self::$_instance ) ) { |
|
264 | + if (is_null(self::$_instance)) { |
|
265 | 265 | self::$_instance = new self(); |
266 | 266 | } |
267 | 267 | |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function __construct() { |
275 | 275 | // PHP version |
276 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
277 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
276 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
277 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // Bailout: Need minimum php version to load plugin. |
281 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
282 | - add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) ); |
|
281 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
282 | + add_action('admin_notices', array($this, 'minimum_phpversion_notice')); |
|
283 | 283 | |
284 | 284 | return; |
285 | 285 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $this->includes(); |
289 | 289 | $this->init_hooks(); |
290 | 290 | |
291 | - do_action( 'give_loaded' ); |
|
291 | + do_action('give_loaded'); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -297,11 +297,11 @@ discard block |
||
297 | 297 | * @since 1.8.9 |
298 | 298 | */ |
299 | 299 | private function init_hooks() { |
300 | - register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
301 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
300 | + register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
301 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
302 | 302 | |
303 | 303 | // Set up localization on init Hook. |
304 | - add_action( 'init', array( $this, 'load_textdomain' ), 0 ); |
|
304 | + add_action('init', array($this, 'load_textdomain'), 0); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @since 1.8.9 |
319 | 319 | */ |
320 | - do_action( 'before_give_init' ); |
|
320 | + do_action('before_give_init'); |
|
321 | 321 | |
322 | 322 | // Set up localization. |
323 | 323 | $this->load_textdomain(); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @since 1.8.7 |
352 | 352 | */ |
353 | - do_action( 'give_init', $this ); |
|
353 | + do_action('give_init', $this); |
|
354 | 354 | |
355 | 355 | } |
356 | 356 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | */ |
368 | 368 | public function __clone() { |
369 | 369 | // Cloning instances of the class is forbidden. |
370 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
370 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | public function __wakeup() { |
382 | 382 | // Unserializing instances of the class is forbidden. |
383 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
383 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -394,33 +394,33 @@ discard block |
||
394 | 394 | private function setup_constants() { |
395 | 395 | |
396 | 396 | // Plugin version |
397 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
398 | - define( 'GIVE_VERSION', '2.1.2' ); |
|
397 | + if ( ! defined('GIVE_VERSION')) { |
|
398 | + define('GIVE_VERSION', '2.1.2'); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | // Plugin Root File |
402 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
403 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
402 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
403 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | // Plugin Folder Path |
407 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
408 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) ); |
|
407 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
408 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE)); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | // Plugin Folder URL |
412 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
413 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) ); |
|
412 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
413 | + define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE)); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | // Plugin Basename aka: "give/give.php" |
417 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
418 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) ); |
|
417 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
418 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE)); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | // Make sure CAL_GREGORIAN is defined |
422 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
423 | - define( 'CAL_GREGORIAN', 1 ); |
|
422 | + if ( ! defined('CAL_GREGORIAN')) { |
|
423 | + define('CAL_GREGORIAN', 1); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | |
@@ -438,160 +438,160 @@ discard block |
||
438 | 438 | /** |
439 | 439 | * Load libraries. |
440 | 440 | */ |
441 | - if ( ! class_exists( 'WP_Async_Request' ) ) { |
|
442 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' ); |
|
441 | + if ( ! class_exists('WP_Async_Request')) { |
|
442 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php'); |
|
443 | 443 | } |
444 | 444 | |
445 | - if ( ! class_exists( 'WP_Background_Process' ) ) { |
|
446 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' ); |
|
445 | + if ( ! class_exists('WP_Background_Process')) { |
|
446 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php'); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | 450 | * Load plugin files |
451 | 451 | */ |
452 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
453 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
452 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
453 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
454 | 454 | $give_options = give_get_settings(); |
455 | 455 | |
456 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
457 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php'; |
|
458 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
459 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
460 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
461 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
462 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
463 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
464 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
465 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php'; |
|
466 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php'; |
|
467 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
468 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php'; |
|
469 | - |
|
470 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php'; |
|
471 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
472 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
473 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
474 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
475 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php'; |
|
476 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
477 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
478 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
484 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
485 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php'; |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php'; |
|
487 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php'; |
|
488 | - |
|
489 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
490 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
491 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
492 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
493 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
494 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
495 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
496 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
497 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
498 | - require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php'; |
|
499 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
500 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
501 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
502 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
503 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
504 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
505 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
506 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
507 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
508 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
509 | - |
|
510 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php'; |
|
511 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
512 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
513 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
514 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
515 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
516 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php'; |
|
517 | - |
|
518 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
519 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
520 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
521 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
522 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
523 | - |
|
524 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
525 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
526 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php'; |
|
527 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
528 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
529 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
530 | - |
|
531 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
532 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php'; |
|
533 | - |
|
534 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
535 | - |
|
536 | - require_once GIVE_PLUGIN_DIR . 'blocks/load.php'; |
|
537 | - |
|
538 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
539 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
456 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
457 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php'; |
|
458 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
459 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
460 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
461 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
462 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
463 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
464 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
465 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php'; |
|
466 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php'; |
|
467 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
468 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php'; |
|
469 | + |
|
470 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php'; |
|
471 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
472 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
473 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
475 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php'; |
|
476 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
477 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
478 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
484 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
485 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php'; |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php'; |
|
487 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php'; |
|
488 | + |
|
489 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
490 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
491 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
493 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
494 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
495 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
496 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
497 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
498 | + require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php'; |
|
499 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
500 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
501 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
502 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
503 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
504 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
505 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
506 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
507 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
508 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
509 | + |
|
510 | + require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php'; |
|
511 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
512 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
513 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
514 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
515 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
516 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php'; |
|
517 | + |
|
518 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
519 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
520 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
521 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
522 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
523 | + |
|
524 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
525 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
526 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php'; |
|
527 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
528 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
529 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
530 | + |
|
531 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
532 | + require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php'; |
|
533 | + |
|
534 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
535 | + |
|
536 | + require_once GIVE_PLUGIN_DIR.'blocks/load.php'; |
|
537 | + |
|
538 | + if (defined('WP_CLI') && WP_CLI) { |
|
539 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
540 | 540 | } |
541 | 541 | |
542 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
543 | - |
|
544 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
545 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
546 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
547 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
548 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
549 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
550 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
551 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
552 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
553 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
554 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
555 | - |
|
556 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
557 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
558 | - |
|
559 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
560 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
561 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
562 | - |
|
563 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
564 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
565 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
566 | - |
|
567 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
568 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
569 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
570 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
571 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php'; |
|
572 | - |
|
573 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
574 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
575 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
576 | - |
|
577 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
578 | - |
|
579 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
580 | - |
|
581 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
582 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
583 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
584 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
585 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
586 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
587 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
588 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
589 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
590 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
591 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
542 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
543 | + |
|
544 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
545 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
546 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
547 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
548 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
549 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
550 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
551 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
552 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
553 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
554 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
555 | + |
|
556 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
557 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
558 | + |
|
559 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
560 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
561 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
562 | + |
|
563 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
564 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
565 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
566 | + |
|
567 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
568 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
569 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
570 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
571 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php'; |
|
572 | + |
|
573 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
574 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
575 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
576 | + |
|
577 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
578 | + |
|
579 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
580 | + |
|
581 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
582 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
583 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
584 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
585 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
586 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
587 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
588 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
589 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
590 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
591 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
592 | 592 | }// End if(). |
593 | 593 | |
594 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
594 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
595 | 595 | |
596 | 596 | } |
597 | 597 | |
@@ -606,16 +606,16 @@ discard block |
||
606 | 606 | public function load_textdomain() { |
607 | 607 | |
608 | 608 | // Set filter for Give's languages directory |
609 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
610 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
609 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
610 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
611 | 611 | |
612 | 612 | // Traditional WordPress plugin locale filter. |
613 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
614 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
613 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
614 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
615 | 615 | |
616 | - unload_textdomain( 'give' ); |
|
617 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
618 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
616 | + unload_textdomain('give'); |
|
617 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
618 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
619 | 619 | |
620 | 620 | } |
621 | 621 | |
@@ -628,21 +628,21 @@ discard block |
||
628 | 628 | */ |
629 | 629 | public function minimum_phpversion_notice() { |
630 | 630 | // Bailout. |
631 | - if ( ! is_admin() ) { |
|
631 | + if ( ! is_admin()) { |
|
632 | 632 | return; |
633 | 633 | } |
634 | 634 | |
635 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
636 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
637 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
638 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
639 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
640 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
641 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
635 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
636 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
637 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
638 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
639 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
640 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
641 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
642 | 642 | |
643 | 643 | echo sprintf( |
644 | 644 | '<div class="notice notice-error">%1$s</div>', |
645 | - wp_kses_post( $notice_desc ) |
|
645 | + wp_kses_post($notice_desc) |
|
646 | 646 | ); |
647 | 647 | } |
648 | 648 |