@@ -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,31 +392,31 @@ 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' => 'user_email', |
| 413 | - 'description' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
| 413 | + 'description' => esc_html__('The donor\'s email address.', 'give'), |
|
| 414 | 414 | 'function' => 'give_email_tag_user_email', |
| 415 | 415 | 'context' => 'donor', |
| 416 | 416 | ), |
| 417 | 417 | array( |
| 418 | 418 | 'tag' => 'email_access_link', |
| 419 | - 'description' => esc_html__( 'The donor\'s email access link.', 'give' ), |
|
| 419 | + 'description' => esc_html__('The donor\'s email access link.', 'give'), |
|
| 420 | 420 | 'function' => 'give_email_tag_email_access_link', |
| 421 | 421 | 'context' => 'donor', |
| 422 | 422 | ), |
@@ -424,14 +424,14 @@ discard block |
||
| 424 | 424 | /* General */ |
| 425 | 425 | array( |
| 426 | 426 | 'tag' => 'sitename', |
| 427 | - 'description' => esc_html__( 'The name of your site.', 'give' ), |
|
| 427 | + 'description' => esc_html__('The name of your site.', 'give'), |
|
| 428 | 428 | 'function' => 'give_email_tag_sitename', |
| 429 | 429 | 'context' => 'general', |
| 430 | 430 | ), |
| 431 | 431 | |
| 432 | 432 | array( |
| 433 | 433 | 'tag' => 'reset_password_link', |
| 434 | - 'description' => esc_html__( 'The reset password link for user.', 'give' ), |
|
| 434 | + 'description' => esc_html__('The reset password link for user.', 'give'), |
|
| 435 | 435 | 'function' => 'give_email_tag_reset_password_link', |
| 436 | 436 | 'context' => 'general', |
| 437 | 437 | ), |
@@ -439,21 +439,21 @@ discard block |
||
| 439 | 439 | ); |
| 440 | 440 | |
| 441 | 441 | // Apply give_email_tags filter |
| 442 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
| 442 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
| 443 | 443 | |
| 444 | 444 | // Add email tags |
| 445 | - foreach ( $email_tags as $email_tag ) { |
|
| 445 | + foreach ($email_tags as $email_tag) { |
|
| 446 | 446 | give_add_email_tag( |
| 447 | 447 | $email_tag['tag'], |
| 448 | 448 | $email_tag['description'], |
| 449 | 449 | $email_tag['function'], |
| 450 | - ( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' ) |
|
| 450 | + ( ! empty($email_tag['context']) ? $email_tag['context'] : '') |
|
| 451 | 451 | ); |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
| 456 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
| 457 | 457 | |
| 458 | 458 | |
| 459 | 459 | /** |
@@ -465,26 +465,26 @@ discard block |
||
| 465 | 465 | * |
| 466 | 466 | * @return string $firstname |
| 467 | 467 | */ |
| 468 | -function give_email_tag_first_name( $tag_args ) { |
|
| 468 | +function give_email_tag_first_name($tag_args) { |
|
| 469 | 469 | $user_info = array(); |
| 470 | 470 | $firstname = ''; |
| 471 | 471 | |
| 472 | 472 | // Backward compatibility. |
| 473 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 473 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 474 | 474 | |
| 475 | - switch ( true ) { |
|
| 476 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 477 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 475 | + switch (true) { |
|
| 476 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 477 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 478 | 478 | |
| 479 | 479 | // Get firstname. |
| 480 | - if ( ! empty( $payment->user_info ) ) { |
|
| 481 | - $email_names = give_get_email_names( $payment->user_info ); |
|
| 480 | + if ( ! empty($payment->user_info)) { |
|
| 481 | + $email_names = give_get_email_names($payment->user_info); |
|
| 482 | 482 | $firstname = $email_names['name']; |
| 483 | 483 | } |
| 484 | 484 | break; |
| 485 | 485 | |
| 486 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
| 487 | - $donor = new Give_Donor( $tag_args['user_id'], true ); |
|
| 486 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
| 487 | + $donor = new Give_Donor($tag_args['user_id'], true); |
|
| 488 | 488 | $firstname = $donor->get_first_name(); |
| 489 | 489 | break; |
| 490 | 490 | |
@@ -493,8 +493,8 @@ discard block |
||
| 493 | 493 | * |
| 494 | 494 | * @since 2.0 |
| 495 | 495 | */ |
| 496 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
| 497 | - $donor = new Give_Donor( $tag_args['donor_id'] ); |
|
| 496 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
| 497 | + $donor = new Give_Donor($tag_args['donor_id']); |
|
| 498 | 498 | $firstname = $donor->get_first_name(); |
| 499 | 499 | break; |
| 500 | 500 | } |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | * @param string $firstname |
| 508 | 508 | * @param array $tag_args |
| 509 | 509 | */ |
| 510 | - $firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args ); |
|
| 510 | + $firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args); |
|
| 511 | 511 | |
| 512 | 512 | return $firstname; |
| 513 | 513 | } |
@@ -521,26 +521,26 @@ discard block |
||
| 521 | 521 | * |
| 522 | 522 | * @return string $fullname |
| 523 | 523 | */ |
| 524 | -function give_email_tag_fullname( $tag_args ) { |
|
| 524 | +function give_email_tag_fullname($tag_args) { |
|
| 525 | 525 | $fullname = ''; |
| 526 | 526 | |
| 527 | 527 | // Backward compatibility. |
| 528 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 528 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 529 | 529 | |
| 530 | - switch ( true ) { |
|
| 531 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 532 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 530 | + switch (true) { |
|
| 531 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 532 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 533 | 533 | |
| 534 | 534 | // Get fullname. |
| 535 | - if ( ! empty( $payment->user_info ) ) { |
|
| 536 | - $email_names = give_get_email_names( $payment->user_info ); |
|
| 535 | + if ( ! empty($payment->user_info)) { |
|
| 536 | + $email_names = give_get_email_names($payment->user_info); |
|
| 537 | 537 | $fullname = $email_names['fullname']; |
| 538 | 538 | } |
| 539 | 539 | break; |
| 540 | 540 | |
| 541 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
| 542 | - $donor = new Give_Donor( $tag_args['user_id'], true ); |
|
| 543 | - $fullname = trim( "{$donor->get_first_name()} {$donor->get_last_name()}" ); |
|
| 541 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
| 542 | + $donor = new Give_Donor($tag_args['user_id'], true); |
|
| 543 | + $fullname = trim("{$donor->get_first_name()} {$donor->get_last_name()}"); |
|
| 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 | - $donor = new Give_Donor( $tag_args['donor_id'] ); |
|
| 551 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
| 552 | + $donor = new Give_Donor($tag_args['donor_id']); |
|
| 553 | 553 | $fullname = $donor->name; |
| 554 | 554 | break; |
| 555 | 555 | } |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | * @param string $fullname |
| 563 | 563 | * @param array $tag_args |
| 564 | 564 | */ |
| 565 | - $fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args ); |
|
| 565 | + $fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args); |
|
| 566 | 566 | |
| 567 | 567 | return $fullname; |
| 568 | 568 | } |
@@ -576,25 +576,25 @@ discard block |
||
| 576 | 576 | * |
| 577 | 577 | * @return string username. |
| 578 | 578 | */ |
| 579 | -function give_email_tag_username( $tag_args ) { |
|
| 579 | +function give_email_tag_username($tag_args) { |
|
| 580 | 580 | $username = ''; |
| 581 | 581 | |
| 582 | 582 | // Backward compatibility. |
| 583 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 583 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 584 | 584 | |
| 585 | - switch ( true ) { |
|
| 586 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 587 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 585 | + switch (true) { |
|
| 586 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 587 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 588 | 588 | |
| 589 | 589 | // Get username. |
| 590 | - if ( ! empty( $payment->user_info ) ) { |
|
| 591 | - $email_names = give_get_email_names( $payment->user_info ); |
|
| 590 | + if ( ! empty($payment->user_info)) { |
|
| 591 | + $email_names = give_get_email_names($payment->user_info); |
|
| 592 | 592 | $username = $email_names['username']; |
| 593 | 593 | } |
| 594 | 594 | break; |
| 595 | 595 | |
| 596 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
| 597 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
| 596 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
| 597 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
| 598 | 598 | $username = $user_info->user_login; |
| 599 | 599 | break; |
| 600 | 600 | |
@@ -603,10 +603,10 @@ discard block |
||
| 603 | 603 | * |
| 604 | 604 | * @since 2.0 |
| 605 | 605 | */ |
| 606 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
| 607 | - $donor = new Give_Donor( $tag_args['donor_id'] ); |
|
| 608 | - if ( ! empty( $donor->id ) && ! empty( $donor->user_id ) ) { |
|
| 609 | - $user_info = get_user_by( 'id', $donor->user_id ); |
|
| 606 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
| 607 | + $donor = new Give_Donor($tag_args['donor_id']); |
|
| 608 | + if ( ! empty($donor->id) && ! empty($donor->user_id)) { |
|
| 609 | + $user_info = get_user_by('id', $donor->user_id); |
|
| 610 | 610 | $username = $user_info->user_login; |
| 611 | 611 | } |
| 612 | 612 | break; |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | * @param string $username |
| 621 | 621 | * @param array $tag_args |
| 622 | 622 | */ |
| 623 | - $username = apply_filters( 'give_email_tag_username', $username, $tag_args ); |
|
| 623 | + $username = apply_filters('give_email_tag_username', $username, $tag_args); |
|
| 624 | 624 | |
| 625 | 625 | return $username; |
| 626 | 626 | } |
@@ -634,20 +634,20 @@ discard block |
||
| 634 | 634 | * |
| 635 | 635 | * @return string user_email |
| 636 | 636 | */ |
| 637 | -function give_email_tag_user_email( $tag_args ) { |
|
| 637 | +function give_email_tag_user_email($tag_args) { |
|
| 638 | 638 | $email = ''; |
| 639 | 639 | |
| 640 | 640 | // Backward compatibility. |
| 641 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 641 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 642 | 642 | |
| 643 | - switch ( true ) { |
|
| 644 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 645 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 643 | + switch (true) { |
|
| 644 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 645 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 646 | 646 | $email = $payment->email; |
| 647 | 647 | break; |
| 648 | 648 | |
| 649 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
| 650 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
| 649 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
| 650 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
| 651 | 651 | $email = $user_info->user_email; |
| 652 | 652 | break; |
| 653 | 653 | |
@@ -656,9 +656,9 @@ discard block |
||
| 656 | 656 | * |
| 657 | 657 | * @since 2.0 |
| 658 | 658 | */ |
| 659 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
| 660 | - $donor = new Give_Donor( $tag_args['donor_id'] ); |
|
| 661 | - $email = $donor->email; |
|
| 659 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
| 660 | + $donor = new Give_Donor($tag_args['donor_id']); |
|
| 661 | + $email = $donor->email; |
|
| 662 | 662 | break; |
| 663 | 663 | } |
| 664 | 664 | |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | * @param string $email |
| 671 | 671 | * @param array $tag_args |
| 672 | 672 | */ |
| 673 | - $email = apply_filters( 'give_email_tag_user_email', $email, $tag_args ); |
|
| 673 | + $email = apply_filters('give_email_tag_user_email', $email, $tag_args); |
|
| 674 | 674 | |
| 675 | 675 | return $email; |
| 676 | 676 | } |
@@ -684,22 +684,22 @@ discard block |
||
| 684 | 684 | * |
| 685 | 685 | * @return string billing_address |
| 686 | 686 | */ |
| 687 | -function give_email_tag_billing_address( $tag_args ) { |
|
| 687 | +function give_email_tag_billing_address($tag_args) { |
|
| 688 | 688 | $address = ''; |
| 689 | 689 | |
| 690 | 690 | // Backward compatibility. |
| 691 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 691 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 692 | 692 | |
| 693 | - switch ( true ) { |
|
| 694 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 695 | - $donation = new Give_Payment( $tag_args['payment_id'] ); |
|
| 696 | - $address = $donation->address['line1'] . "\n"; |
|
| 693 | + switch (true) { |
|
| 694 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 695 | + $donation = new Give_Payment($tag_args['payment_id']); |
|
| 696 | + $address = $donation->address['line1']."\n"; |
|
| 697 | 697 | |
| 698 | - if ( ! empty( $donation->address['line2'] ) ) { |
|
| 699 | - $address .= $donation->address['line2'] . "\n"; |
|
| 698 | + if ( ! empty($donation->address['line2'])) { |
|
| 699 | + $address .= $donation->address['line2']."\n"; |
|
| 700 | 700 | } |
| 701 | 701 | |
| 702 | - $address .= $donation->address['city'] . ' ' . $donation->address['zip'] . ' ' . $donation->address['state'] . "\n"; |
|
| 702 | + $address .= $donation->address['city'].' '.$donation->address['zip'].' '.$donation->address['state']."\n"; |
|
| 703 | 703 | $address .= $donation->address['country']; |
| 704 | 704 | break; |
| 705 | 705 | } |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | * @param string $address |
| 713 | 713 | * @param array $tag_args |
| 714 | 714 | */ |
| 715 | - $address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args ); |
|
| 715 | + $address = apply_filters('give_email_tag_billing_address', $address, $tag_args); |
|
| 716 | 716 | |
| 717 | 717 | return $address; |
| 718 | 718 | } |
@@ -726,16 +726,16 @@ discard block |
||
| 726 | 726 | * |
| 727 | 727 | * @return string date |
| 728 | 728 | */ |
| 729 | -function give_email_tag_date( $tag_args ) { |
|
| 729 | +function give_email_tag_date($tag_args) { |
|
| 730 | 730 | $date = ''; |
| 731 | 731 | |
| 732 | 732 | // Backward compatibility. |
| 733 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 733 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 734 | 734 | |
| 735 | - switch ( true ) { |
|
| 736 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 737 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 738 | - $date = date_i18n( give_date_format(), strtotime( $payment->date ) ); |
|
| 735 | + switch (true) { |
|
| 736 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 737 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 738 | + $date = date_i18n(give_date_format(), strtotime($payment->date)); |
|
| 739 | 739 | break; |
| 740 | 740 | } |
| 741 | 741 | |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | * @param string $date |
| 748 | 748 | * @param array $tag_args |
| 749 | 749 | */ |
| 750 | - $date = apply_filters( 'give_email_tag_date', $date, $tag_args ); |
|
| 750 | + $date = apply_filters('give_email_tag_date', $date, $tag_args); |
|
| 751 | 751 | |
| 752 | 752 | return $date; |
| 753 | 753 | } |
@@ -761,17 +761,17 @@ discard block |
||
| 761 | 761 | * |
| 762 | 762 | * @return string amount |
| 763 | 763 | */ |
| 764 | -function give_email_tag_amount( $tag_args ) { |
|
| 764 | +function give_email_tag_amount($tag_args) { |
|
| 765 | 765 | $amount = ''; |
| 766 | 766 | |
| 767 | 767 | // Backward compatibility. |
| 768 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 768 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 769 | 769 | |
| 770 | - switch ( true ) { |
|
| 771 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 772 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 773 | - $give_amount = give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), array( 'currency_code' => $payment->currency ) ); |
|
| 774 | - $amount = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
| 770 | + switch (true) { |
|
| 771 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 772 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 773 | + $give_amount = give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), array('currency_code' => $payment->currency)); |
|
| 774 | + $amount = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
| 775 | 775 | break; |
| 776 | 776 | } |
| 777 | 777 | |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | * @param string $amount |
| 784 | 784 | * @param array $tag_args |
| 785 | 785 | */ |
| 786 | - $amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args ); |
|
| 786 | + $amount = apply_filters('give_email_tag_amount', $amount, $tag_args); |
|
| 787 | 787 | |
| 788 | 788 | return $amount; |
| 789 | 789 | } |
@@ -797,8 +797,8 @@ discard block |
||
| 797 | 797 | * |
| 798 | 798 | * @return string price |
| 799 | 799 | */ |
| 800 | -function give_email_tag_price( $tag_args ) { |
|
| 801 | - return give_email_tag_amount( $tag_args ); |
|
| 800 | +function give_email_tag_price($tag_args) { |
|
| 801 | + return give_email_tag_amount($tag_args); |
|
| 802 | 802 | } |
| 803 | 803 | |
| 804 | 804 | /** |
@@ -810,15 +810,15 @@ discard block |
||
| 810 | 810 | * |
| 811 | 811 | * @return int payment_id |
| 812 | 812 | */ |
| 813 | -function give_email_tag_payment_id( $tag_args ) { |
|
| 813 | +function give_email_tag_payment_id($tag_args) { |
|
| 814 | 814 | $payment_id = ''; |
| 815 | 815 | |
| 816 | 816 | // Backward compatibility. |
| 817 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 817 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 818 | 818 | |
| 819 | - switch ( true ) { |
|
| 820 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 821 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 819 | + switch (true) { |
|
| 820 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 821 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 822 | 822 | $payment_id = $payment->number; |
| 823 | 823 | break; |
| 824 | 824 | } |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | * @param string $payment_id |
| 832 | 832 | * @param array $tag_args |
| 833 | 833 | */ |
| 834 | - return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args ); |
|
| 834 | + return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args); |
|
| 835 | 835 | } |
| 836 | 836 | |
| 837 | 837 | /** |
@@ -843,15 +843,15 @@ discard block |
||
| 843 | 843 | * |
| 844 | 844 | * @return string receipt_id |
| 845 | 845 | */ |
| 846 | -function give_email_tag_receipt_id( $tag_args ) { |
|
| 846 | +function give_email_tag_receipt_id($tag_args) { |
|
| 847 | 847 | $receipt_id = ''; |
| 848 | 848 | |
| 849 | 849 | // Backward compatibility. |
| 850 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 850 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 851 | 851 | |
| 852 | - switch ( true ) { |
|
| 853 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 854 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 852 | + switch (true) { |
|
| 853 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 854 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 855 | 855 | $receipt_id = $payment->key; |
| 856 | 856 | break; |
| 857 | 857 | } |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | * @param string $receipt_id |
| 865 | 865 | * @param array $tag_args |
| 866 | 866 | */ |
| 867 | - return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args ); |
|
| 867 | + return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args); |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | /** |
@@ -876,23 +876,23 @@ discard block |
||
| 876 | 876 | * |
| 877 | 877 | * @return string $form_title |
| 878 | 878 | */ |
| 879 | -function give_email_tag_donation( $tag_args ) { |
|
| 879 | +function give_email_tag_donation($tag_args) { |
|
| 880 | 880 | $donation_form_title = ''; |
| 881 | 881 | |
| 882 | 882 | // Backward compatibility. |
| 883 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 883 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 884 | 884 | |
| 885 | - switch ( true ) { |
|
| 886 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 887 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 888 | - $level_title = give_has_variable_prices( $payment->form_id ); |
|
| 885 | + switch (true) { |
|
| 886 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 887 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 888 | + $level_title = give_has_variable_prices($payment->form_id); |
|
| 889 | 889 | $separator = $level_title ? '-' : ''; |
| 890 | - $donation_form_title = strip_tags( give_check_variable( give_get_donation_form_title( |
|
| 890 | + $donation_form_title = strip_tags(give_check_variable(give_get_donation_form_title( |
|
| 891 | 891 | $payment, |
| 892 | 892 | array( |
| 893 | 893 | 'separator' => $separator, |
| 894 | 894 | ) |
| 895 | - ), 'empty', '' ) ); |
|
| 895 | + ), 'empty', '')); |
|
| 896 | 896 | break; |
| 897 | 897 | } |
| 898 | 898 | |
@@ -920,17 +920,17 @@ discard block |
||
| 920 | 920 | * |
| 921 | 921 | * @return string $form_title |
| 922 | 922 | */ |
| 923 | -function give_email_tag_form_title( $tag_args ) { |
|
| 923 | +function give_email_tag_form_title($tag_args) { |
|
| 924 | 924 | $donation_form_title = ''; |
| 925 | 925 | |
| 926 | 926 | // Backward compatibility. |
| 927 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 927 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 928 | 928 | |
| 929 | - switch ( true ) { |
|
| 930 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 931 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 929 | + switch (true) { |
|
| 930 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 931 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 932 | 932 | $payment_meta = $payment->payment_meta; |
| 933 | - $donation_form_title = strip_tags( give_check_variable( $payment_meta, 'empty', '', 'form_title' ) ); |
|
| 933 | + $donation_form_title = strip_tags(give_check_variable($payment_meta, 'empty', '', 'form_title')); |
|
| 934 | 934 | break; |
| 935 | 935 | } |
| 936 | 936 | |
@@ -958,19 +958,19 @@ discard block |
||
| 958 | 958 | * |
| 959 | 959 | * @return string gateway |
| 960 | 960 | */ |
| 961 | -function give_email_tag_payment_method( $tag_args ) { |
|
| 961 | +function give_email_tag_payment_method($tag_args) { |
|
| 962 | 962 | $payment_method = ''; |
| 963 | 963 | |
| 964 | 964 | // Backward compatibility. |
| 965 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 965 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 966 | 966 | |
| 967 | 967 | // Backward compatibility. |
| 968 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 968 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 969 | 969 | |
| 970 | - switch ( true ) { |
|
| 971 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 972 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 973 | - $payment_method = give_get_gateway_checkout_label( $payment->gateway ); |
|
| 970 | + switch (true) { |
|
| 971 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 972 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 973 | + $payment_method = give_get_gateway_checkout_label($payment->gateway); |
|
| 974 | 974 | break; |
| 975 | 975 | } |
| 976 | 976 | |
@@ -1001,16 +1001,16 @@ discard block |
||
| 1001 | 1001 | * |
| 1002 | 1002 | * @return string |
| 1003 | 1003 | */ |
| 1004 | -function give_email_tag_payment_total( $tag_args ) { |
|
| 1004 | +function give_email_tag_payment_total($tag_args) { |
|
| 1005 | 1005 | $payment_total = ''; |
| 1006 | 1006 | |
| 1007 | 1007 | // Backward compatibility. |
| 1008 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 1008 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 1009 | 1009 | |
| 1010 | - switch ( true ) { |
|
| 1011 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 1012 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 1013 | - $payment_total = give_currency_filter( $payment->total ); |
|
| 1010 | + switch (true) { |
|
| 1011 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 1012 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 1013 | + $payment_total = give_currency_filter($payment->total); |
|
| 1014 | 1014 | break; |
| 1015 | 1015 | } |
| 1016 | 1016 | |
@@ -1038,11 +1038,11 @@ discard block |
||
| 1038 | 1038 | * |
| 1039 | 1039 | * @return string |
| 1040 | 1040 | */ |
| 1041 | -function give_email_tag_sitename( $tag_args = array() ) { |
|
| 1042 | - $sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
| 1041 | +function give_email_tag_sitename($tag_args = array()) { |
|
| 1042 | + $sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
| 1043 | 1043 | |
| 1044 | 1044 | // Backward compatibility. |
| 1045 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 1045 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 1046 | 1046 | |
| 1047 | 1047 | /** |
| 1048 | 1048 | * Filter the {sitename} email template tag output. |
@@ -1068,26 +1068,26 @@ discard block |
||
| 1068 | 1068 | * |
| 1069 | 1069 | * @return string receipt_link |
| 1070 | 1070 | */ |
| 1071 | -function give_email_tag_receipt_link( $tag_args ) { |
|
| 1071 | +function give_email_tag_receipt_link($tag_args) { |
|
| 1072 | 1072 | // Backward compatibility. |
| 1073 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 1073 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 1074 | 1074 | |
| 1075 | - $receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
| 1075 | + $receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
| 1076 | 1076 | |
| 1077 | 1077 | // Bailout. |
| 1078 | - if ( give_get_option( 'email_template' ) === 'none' ) { |
|
| 1078 | + if (give_get_option('email_template') === 'none') { |
|
| 1079 | 1079 | return $receipt_url; |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | |
| 1083 | - $receipt_url = esc_url( add_query_arg( array( |
|
| 1084 | - 'payment_key' => give_get_payment_key( $tag_args['payment_id'] ), |
|
| 1085 | - ), give_get_history_page_uri() ) ); |
|
| 1083 | + $receipt_url = esc_url(add_query_arg(array( |
|
| 1084 | + 'payment_key' => give_get_payment_key($tag_args['payment_id']), |
|
| 1085 | + ), give_get_history_page_uri())); |
|
| 1086 | 1086 | |
| 1087 | - $formatted = sprintf( |
|
| 1087 | + $formatted = sprintf( |
|
| 1088 | 1088 | '<a href="%1$s">%2$s</a>', |
| 1089 | 1089 | $receipt_url, |
| 1090 | - __( 'View it in your browser »', 'give' ) |
|
| 1090 | + __('View it in your browser »', 'give') |
|
| 1091 | 1091 | ); |
| 1092 | 1092 | |
| 1093 | 1093 | /** |
@@ -1116,11 +1116,11 @@ discard block |
||
| 1116 | 1116 | * |
| 1117 | 1117 | * @return string receipt_url |
| 1118 | 1118 | */ |
| 1119 | -function give_email_tag_receipt_link_url( $tag_args ) { |
|
| 1119 | +function give_email_tag_receipt_link_url($tag_args) { |
|
| 1120 | 1120 | // Backward compatibility. |
| 1121 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 1121 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 1122 | 1122 | |
| 1123 | - $receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
| 1123 | + $receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
| 1124 | 1124 | |
| 1125 | 1125 | /** |
| 1126 | 1126 | * Filter the {receipt_link_url} email template tag output. |
@@ -1147,13 +1147,13 @@ discard block |
||
| 1147 | 1147 | * |
| 1148 | 1148 | * @return string |
| 1149 | 1149 | */ |
| 1150 | -function give_get_receipt_url( $payment_id ) { |
|
| 1150 | +function give_get_receipt_url($payment_id) { |
|
| 1151 | 1151 | $receipt_url = ''; |
| 1152 | 1152 | |
| 1153 | - if ( $payment_id ) { |
|
| 1154 | - $receipt_url = esc_url( add_query_arg( array( |
|
| 1155 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
| 1156 | - ), give_get_history_page_uri() ) ); |
|
| 1153 | + if ($payment_id) { |
|
| 1154 | + $receipt_url = esc_url(add_query_arg(array( |
|
| 1155 | + 'payment_key' => give_get_payment_key($payment_id), |
|
| 1156 | + ), give_get_history_page_uri())); |
|
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | 1159 | return $receipt_url; |
@@ -1169,22 +1169,22 @@ discard block |
||
| 1169 | 1169 | * |
| 1170 | 1170 | * @return string |
| 1171 | 1171 | */ |
| 1172 | -function give_email_tag_email_access_link( $tag_args ) { |
|
| 1172 | +function give_email_tag_email_access_link($tag_args) { |
|
| 1173 | 1173 | $donor_id = 0; |
| 1174 | 1174 | $donor = array(); |
| 1175 | 1175 | $email_access_link = ''; |
| 1176 | 1176 | |
| 1177 | 1177 | // Backward compatibility. |
| 1178 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
| 1178 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
| 1179 | 1179 | |
| 1180 | - switch ( true ) { |
|
| 1181 | - case ! empty( $tag_args['donor_id'] ): |
|
| 1180 | + switch (true) { |
|
| 1181 | + case ! empty($tag_args['donor_id']): |
|
| 1182 | 1182 | $donor_id = $tag_args['donor_id']; |
| 1183 | - $donor = Give()->donors->get_by( 'id', $tag_args['donor_id'] ); |
|
| 1183 | + $donor = Give()->donors->get_by('id', $tag_args['donor_id']); |
|
| 1184 | 1184 | break; |
| 1185 | 1185 | |
| 1186 | - case ! empty( $tag_args['user_id'] ): |
|
| 1187 | - $donor = Give()->donors->get_by( 'user_id', $tag_args['user_id'] ); |
|
| 1186 | + case ! empty($tag_args['user_id']): |
|
| 1187 | + $donor = Give()->donors->get_by('user_id', $tag_args['user_id']); |
|
| 1188 | 1188 | $donor_id = $donor->id; |
| 1189 | 1189 | break; |
| 1190 | 1190 | |
@@ -1193,11 +1193,11 @@ discard block |
||
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | // Set email access link if donor exist. |
| 1196 | - if ( $donor_id ) { |
|
| 1197 | - $verify_key = wp_generate_password( 20, false ); |
|
| 1196 | + if ($donor_id) { |
|
| 1197 | + $verify_key = wp_generate_password(20, false); |
|
| 1198 | 1198 | |
| 1199 | 1199 | // Generate a new verify key |
| 1200 | - Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key ); |
|
| 1200 | + Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key); |
|
| 1201 | 1201 | |
| 1202 | 1202 | $access_url = add_query_arg( |
| 1203 | 1203 | array( |
@@ -1207,28 +1207,28 @@ discard block |
||
| 1207 | 1207 | ); |
| 1208 | 1208 | |
| 1209 | 1209 | // Add Payment Key to email access url, if it exists. |
| 1210 | - if ( ! empty( $_GET['payment_key'] ) ) { |
|
| 1210 | + if ( ! empty($_GET['payment_key'])) { |
|
| 1211 | 1211 | $access_url = add_query_arg( |
| 1212 | 1212 | array( |
| 1213 | - 'payment_key' => give_clean( $_GET['payment_key'] ), |
|
| 1213 | + 'payment_key' => give_clean($_GET['payment_key']), |
|
| 1214 | 1214 | ), |
| 1215 | 1215 | $access_url |
| 1216 | 1216 | ); |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
| 1219 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
| 1220 | 1220 | $email_access_link = sprintf( |
| 1221 | 1221 | '<a href="%1$s" target="_blank">%2$s</a>', |
| 1222 | - esc_url( $access_url ), |
|
| 1223 | - __( 'View your donation history »', 'give' ) |
|
| 1222 | + esc_url($access_url), |
|
| 1223 | + __('View your donation history »', 'give') |
|
| 1224 | 1224 | ); |
| 1225 | 1225 | |
| 1226 | 1226 | } else { |
| 1227 | 1227 | |
| 1228 | 1228 | $email_access_link = sprintf( |
| 1229 | 1229 | '%1$s: %2$s', |
| 1230 | - __( 'View your donation history', 'give' ), |
|
| 1231 | - esc_url( $access_url ) |
|
| 1230 | + __('View your donation history', 'give'), |
|
| 1231 | + esc_url($access_url) |
|
| 1232 | 1232 | ); |
| 1233 | 1233 | } |
| 1234 | 1234 | } |
@@ -1260,23 +1260,23 @@ discard block |
||
| 1260 | 1260 | * |
| 1261 | 1261 | * @return array |
| 1262 | 1262 | */ |
| 1263 | -function __give_20_bc_str_type_email_tag_param( $tag_args ) { |
|
| 1264 | - if ( ! is_array( $tag_args ) ) { |
|
| 1265 | - switch ( true ) { |
|
| 1266 | - case ( 'give_payment' === get_post_type( $tag_args ) ): |
|
| 1267 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
| 1263 | +function __give_20_bc_str_type_email_tag_param($tag_args) { |
|
| 1264 | + if ( ! is_array($tag_args)) { |
|
| 1265 | + switch (true) { |
|
| 1266 | + case ('give_payment' === get_post_type($tag_args)): |
|
| 1267 | + $tag_args = array('payment_id' => $tag_args); |
|
| 1268 | 1268 | break; |
| 1269 | 1269 | |
| 1270 | - case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ): |
|
| 1271 | - $tag_args = array( 'user_id' => $tag_args ); |
|
| 1270 | + case ( ! is_wp_error(get_user_by('id', $tag_args))): |
|
| 1271 | + $tag_args = array('user_id' => $tag_args); |
|
| 1272 | 1272 | break; |
| 1273 | 1273 | |
| 1274 | - case ( Give()->donors->get_by( 'id', $tag_args ) ): |
|
| 1275 | - $tag_args = array( 'donor_id' => $tag_args ); |
|
| 1274 | + case (Give()->donors->get_by('id', $tag_args)): |
|
| 1275 | + $tag_args = array('donor_id' => $tag_args); |
|
| 1276 | 1276 | break; |
| 1277 | 1277 | |
| 1278 | - case ( Give()->donors->get_by( 'user_id', $tag_args ) ): |
|
| 1279 | - $tag_args = array( 'user_id' => $tag_args ); |
|
| 1278 | + case (Give()->donors->get_by('user_id', $tag_args)): |
|
| 1279 | + $tag_args = array('user_id' => $tag_args); |
|
| 1280 | 1280 | break; |
| 1281 | 1281 | } |
| 1282 | 1282 | } |
@@ -1294,39 +1294,39 @@ discard block |
||
| 1294 | 1294 | * |
| 1295 | 1295 | * @return array |
| 1296 | 1296 | */ |
| 1297 | -function give_email_tag_reset_password_link( $tag_args, $payment_id ) { |
|
| 1297 | +function give_email_tag_reset_password_link($tag_args, $payment_id) { |
|
| 1298 | 1298 | |
| 1299 | 1299 | $reset_password_url = ''; |
| 1300 | 1300 | |
| 1301 | - switch ( true ) { |
|
| 1302 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
| 1303 | - $payment = new Give_Payment( $tag_args['payment_id'] ); |
|
| 1301 | + switch (true) { |
|
| 1302 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
| 1303 | + $payment = new Give_Payment($tag_args['payment_id']); |
|
| 1304 | 1304 | $payment_id = $payment->number; |
| 1305 | 1305 | break; |
| 1306 | 1306 | |
| 1307 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
| 1308 | - $reset_password_url = give_get_reset_password_url( $tag_args['user_id'] ); |
|
| 1307 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
| 1308 | + $reset_password_url = give_get_reset_password_url($tag_args['user_id']); |
|
| 1309 | 1309 | break; |
| 1310 | 1310 | |
| 1311 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
| 1311 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
| 1312 | 1312 | /* @var Give_Donor $donor */ |
| 1313 | - $donor = new Give_Donor( $tag_args['user_id'], true ); |
|
| 1314 | - $reset_password_url = give_get_reset_password_url( $donor->user_id ); |
|
| 1313 | + $donor = new Give_Donor($tag_args['user_id'], true); |
|
| 1314 | + $reset_password_url = give_get_reset_password_url($donor->user_id); |
|
| 1315 | 1315 | break; |
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | - if( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
| 1318 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
| 1319 | 1319 | // Generate link, if Email content type is html. |
| 1320 | 1320 | $reset_password_link = sprintf( |
| 1321 | 1321 | '<a href="%1$s" target="_blank">%2$s</a>', |
| 1322 | - esc_url( $reset_password_url ), |
|
| 1323 | - __( 'Reset your password »', 'give' ) |
|
| 1322 | + esc_url($reset_password_url), |
|
| 1323 | + __('Reset your password »', 'give') |
|
| 1324 | 1324 | ); |
| 1325 | - } else{ |
|
| 1325 | + } else { |
|
| 1326 | 1326 | $reset_password_link = sprintf( |
| 1327 | 1327 | '%1$s: %2$s', |
| 1328 | - __( 'Reset your password', 'give' ), |
|
| 1329 | - esc_url( $reset_password_url ) |
|
| 1328 | + __('Reset your password', 'give'), |
|
| 1329 | + esc_url($reset_password_url) |
|
| 1330 | 1330 | ); |
| 1331 | 1331 | } |
| 1332 | 1332 | |
@@ -1355,21 +1355,21 @@ discard block |
||
| 1355 | 1355 | * |
| 1356 | 1356 | * @return mixed|string |
| 1357 | 1357 | */ |
| 1358 | -function give_get_reset_password_url( $user_id ) { |
|
| 1358 | +function give_get_reset_password_url($user_id) { |
|
| 1359 | 1359 | $reset_password_url = ''; |
| 1360 | 1360 | |
| 1361 | 1361 | // Proceed further only, if user_id exists. |
| 1362 | - if ( $user_id ) { |
|
| 1362 | + if ($user_id) { |
|
| 1363 | 1363 | |
| 1364 | 1364 | // Get User Object Details. |
| 1365 | - $user = get_user_by( 'ID', $user_id ); |
|
| 1365 | + $user = get_user_by('ID', $user_id); |
|
| 1366 | 1366 | |
| 1367 | 1367 | // Prepare Reset Password URL. |
| 1368 | - $reset_password_url = esc_url( add_query_arg( array( |
|
| 1368 | + $reset_password_url = esc_url(add_query_arg(array( |
|
| 1369 | 1369 | 'action' => 'rp', |
| 1370 | - 'key' => get_password_reset_key( $user ), |
|
| 1370 | + 'key' => get_password_reset_key($user), |
|
| 1371 | 1371 | 'login' => $user->user_login, |
| 1372 | - ), wp_login_url() ) ); |
|
| 1372 | + ), wp_login_url())); |
|
| 1373 | 1373 | } |
| 1374 | 1374 | |
| 1375 | 1375 | return $reset_password_url; |
@@ -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 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /* @var WPDB $wpdb */ |
| 54 | 54 | global $wpdb; |
| 55 | 55 | |
| 56 | - $wpdb->donormeta = $this->table_name = $wpdb->prefix . 'give_donormeta'; |
|
| 56 | + $wpdb->donormeta = $this->table_name = $wpdb->prefix.'give_donormeta'; |
|
| 57 | 57 | $this->primary_key = 'meta_id'; |
| 58 | 58 | $this->version = '1.0'; |
| 59 | 59 | |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return bool False for failure. True for success. |
| 92 | 92 | */ |
| 93 | - public function delete_all_meta( $donor_id = 0 ) { |
|
| 93 | + public function delete_all_meta($donor_id = 0) { |
|
| 94 | 94 | global $wpdb; |
| 95 | - $status = $wpdb->delete( $this->table_name, array( 'customer_id' => $donor_id ), array( '%d' ) ); |
|
| 95 | + $status = $wpdb->delete($this->table_name, array('customer_id' => $donor_id), array('%d')); |
|
| 96 | 96 | |
| 97 | - if( $status ) { |
|
| 98 | - Give_Cache::delete_group( $donor_id, 'give-donors' ); |
|
| 97 | + if ($status) { |
|
| 98 | + Give_Cache::delete_group($donor_id, 'give-donors'); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | global $wpdb; |
| 112 | 112 | |
| 113 | 113 | if ( |
| 114 | - ! give_has_upgrade_completed( 'v20_rename_donor_tables' ) && |
|
| 115 | - $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s","{$wpdb->prefix}give_customermeta" ) ) |
|
| 114 | + ! give_has_upgrade_completed('v20_rename_donor_tables') && |
|
| 115 | + $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customermeta")) |
|
| 116 | 116 | ) { |
| 117 | 117 | $wpdb->donormeta = $this->table_name = "{$wpdb->prefix}give_customermeta"; |
| 118 | 118 | $this->meta_type = 'customer'; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @return bool |
| 133 | 133 | */ |
| 134 | - protected function is_valid_post_type( $ID ) { |
|
| 134 | + protected function is_valid_post_type($ID) { |
|
| 135 | 135 | return $ID && true; |
| 136 | 136 | } |
| 137 | 137 | |