@@ -477,7 +477,7 @@ |
||
| 477 | 477 | * |
| 478 | 478 | * @param int $payment_id |
| 479 | 479 | * |
| 480 | - * @return int payment_id |
|
| 480 | + * @return string payment_id |
|
| 481 | 481 | */ |
| 482 | 482 | function give_email_tag_payment_id( $payment_id ) { |
| 483 | 483 | return give_get_payment_number( $payment_id ); |
@@ -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 | |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | * @param string $description Email tag description text |
| 56 | 56 | * @param callable $func Hook to run when email tag is found |
| 57 | 57 | */ |
| 58 | - public function add( $tag, $description, $func ) { |
|
| 59 | - if ( is_callable( $func ) ) { |
|
| 60 | - $this->tags[ $tag ] = array( |
|
| 58 | + public function add($tag, $description, $func) { |
|
| 59 | + if (is_callable($func)) { |
|
| 60 | + $this->tags[$tag] = array( |
|
| 61 | 61 | 'tag' => $tag, |
| 62 | 62 | 'description' => $description, |
| 63 | 63 | 'func' => $func |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @param string $tag Email tag to remove hook from |
| 74 | 74 | */ |
| 75 | - public function remove( $tag ) { |
|
| 76 | - unset( $this->tags[ $tag ] ); |
|
| 75 | + public function remove($tag) { |
|
| 76 | + unset($this->tags[$tag]); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @return bool |
| 87 | 87 | */ |
| 88 | - public function email_tag_exists( $tag ) { |
|
| 89 | - return array_key_exists( $tag, $this->tags ); |
|
| 88 | + public function email_tag_exists($tag) { |
|
| 89 | + return array_key_exists($tag, $this->tags); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -110,16 +110,16 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return string Content with email tags filtered out. |
| 112 | 112 | */ |
| 113 | - public function do_tags( $content, $payment_id ) { |
|
| 113 | + public function do_tags($content, $payment_id) { |
|
| 114 | 114 | |
| 115 | 115 | // Check if there is atleast one tag added |
| 116 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
| 116 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
| 117 | 117 | return $content; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $this->payment_id = $payment_id; |
| 121 | 121 | |
| 122 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
| 122 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
| 123 | 123 | |
| 124 | 124 | $this->payment_id = null; |
| 125 | 125 | |
@@ -135,17 +135,17 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @return mixed |
| 137 | 137 | */ |
| 138 | - public function do_tag( $m ) { |
|
| 138 | + public function do_tag($m) { |
|
| 139 | 139 | |
| 140 | 140 | // Get tag |
| 141 | 141 | $tag = $m[1]; |
| 142 | 142 | |
| 143 | 143 | // Return tag if tag not set |
| 144 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
| 144 | + if ( ! $this->email_tag_exists($tag)) { |
|
| 145 | 145 | return $m[0]; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag ); |
|
| 148 | + return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | } |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | * @param string $description Description of the email tag added |
| 160 | 160 | * @param callable $func Hook to run when email tag is found |
| 161 | 161 | */ |
| 162 | -function give_add_email_tag( $tag, $description, $func ) { |
|
| 163 | - Give()->email_tags->add( $tag, $description, $func ); |
|
| 162 | +function give_add_email_tag($tag, $description, $func) { |
|
| 163 | + Give()->email_tags->add($tag, $description, $func); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @param string $tag Email tag to remove hook from |
| 172 | 172 | */ |
| 173 | -function give_remove_email_tag( $tag ) { |
|
| 174 | - Give()->email_tags->remove( $tag ); |
|
| 173 | +function give_remove_email_tag($tag) { |
|
| 174 | + Give()->email_tags->remove($tag); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | * |
| 184 | 184 | * @return bool |
| 185 | 185 | */ |
| 186 | -function give_email_tag_exists( $tag ) { |
|
| 187 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
| 186 | +function give_email_tag_exists($tag) { |
|
| 187 | + return Give()->email_tags->email_tag_exists($tag); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
@@ -213,13 +213,13 @@ discard block |
||
| 213 | 213 | $email_tags = give_get_email_tags(); |
| 214 | 214 | |
| 215 | 215 | // Check |
| 216 | - if ( count( $email_tags ) > 0 ) { |
|
| 216 | + if (count($email_tags) > 0) { |
|
| 217 | 217 | |
| 218 | 218 | // Loop |
| 219 | - foreach ( $email_tags as $email_tag ) { |
|
| 219 | + foreach ($email_tags as $email_tag) { |
|
| 220 | 220 | |
| 221 | 221 | // Add email tag to list |
| 222 | - $list .= '<code>{' . $email_tag['tag'] . '}</code> - ' . $email_tag['description'] . '<br/>'; |
|
| 222 | + $list .= '<code>{'.$email_tag['tag'].'}</code> - '.$email_tag['description'].'<br/>'; |
|
| 223 | 223 | |
| 224 | 224 | } |
| 225 | 225 | |
@@ -239,13 +239,13 @@ discard block |
||
| 239 | 239 | * |
| 240 | 240 | * @return string Content with email tags filtered out. |
| 241 | 241 | */ |
| 242 | -function give_do_email_tags( $content, $payment_id ) { |
|
| 242 | +function give_do_email_tags($content, $payment_id) { |
|
| 243 | 243 | |
| 244 | 244 | // Replace all tags |
| 245 | - $content = Give()->email_tags->do_tags( $content, $payment_id ); |
|
| 245 | + $content = Give()->email_tags->do_tags($content, $payment_id); |
|
| 246 | 246 | |
| 247 | 247 | // Maintaining backwards compatibility |
| 248 | - $content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id ); |
|
| 248 | + $content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id); |
|
| 249 | 249 | |
| 250 | 250 | // Return content |
| 251 | 251 | return $content; |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | * |
| 265 | 265 | * @since 1.0 |
| 266 | 266 | */ |
| 267 | - do_action( 'give_add_email_tags' ); |
|
| 267 | + do_action('give_add_email_tags'); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
| 270 | +add_action('init', 'give_load_email_tags', - 999); |
|
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | 273 | * Add default Give email template tags. |
@@ -280,87 +280,87 @@ discard block |
||
| 280 | 280 | $email_tags = array( |
| 281 | 281 | array( |
| 282 | 282 | 'tag' => 'donation', |
| 283 | - 'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
| 283 | + 'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), |
|
| 284 | 284 | 'function' => 'give_email_tag_donation' |
| 285 | 285 | ), |
| 286 | 286 | array( |
| 287 | 287 | 'tag' => 'name', |
| 288 | - 'description' => esc_html__( 'The donor\'s first name.', 'give' ), |
|
| 288 | + 'description' => esc_html__('The donor\'s first name.', 'give'), |
|
| 289 | 289 | 'function' => 'give_email_tag_first_name' |
| 290 | 290 | ), |
| 291 | 291 | array( |
| 292 | 292 | 'tag' => 'fullname', |
| 293 | - 'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), |
|
| 293 | + 'description' => esc_html__('The donor\'s full name, first and last.', 'give'), |
|
| 294 | 294 | 'function' => 'give_email_tag_fullname' |
| 295 | 295 | ), |
| 296 | 296 | array( |
| 297 | 297 | 'tag' => 'username', |
| 298 | - 'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
| 298 | + 'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
| 299 | 299 | 'function' => 'give_email_tag_username' |
| 300 | 300 | ), |
| 301 | 301 | array( |
| 302 | 302 | 'tag' => 'user_email', |
| 303 | - 'description' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
| 303 | + 'description' => esc_html__('The donor\'s email address.', 'give'), |
|
| 304 | 304 | 'function' => 'give_email_tag_user_email' |
| 305 | 305 | ), |
| 306 | 306 | array( |
| 307 | 307 | 'tag' => 'billing_address', |
| 308 | - 'description' => esc_html__( 'The donor\'s billing address.', 'give' ), |
|
| 308 | + 'description' => esc_html__('The donor\'s billing address.', 'give'), |
|
| 309 | 309 | 'function' => 'give_email_tag_billing_address' |
| 310 | 310 | ), |
| 311 | 311 | array( |
| 312 | 312 | 'tag' => 'date', |
| 313 | - 'description' => esc_html__( 'The date of the donation.', 'give' ), |
|
| 313 | + 'description' => esc_html__('The date of the donation.', 'give'), |
|
| 314 | 314 | 'function' => 'give_email_tag_date' |
| 315 | 315 | ), |
| 316 | 316 | array( |
| 317 | 317 | 'tag' => 'price', |
| 318 | - 'description' => esc_html__( 'The total price of the donation.', 'give' ), |
|
| 318 | + 'description' => esc_html__('The total price of the donation.', 'give'), |
|
| 319 | 319 | 'function' => 'give_email_tag_price' |
| 320 | 320 | ), |
| 321 | 321 | array( |
| 322 | 322 | 'tag' => 'payment_id', |
| 323 | - 'description' => esc_html__( 'The unique ID number for this donation.', 'give' ), |
|
| 323 | + 'description' => esc_html__('The unique ID number for this donation.', 'give'), |
|
| 324 | 324 | 'function' => 'give_email_tag_payment_id' |
| 325 | 325 | ), |
| 326 | 326 | array( |
| 327 | 327 | 'tag' => 'receipt_id', |
| 328 | - 'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), |
|
| 328 | + 'description' => esc_html__('The unique ID number for this donation receipt.', 'give'), |
|
| 329 | 329 | 'function' => 'give_email_tag_receipt_id' |
| 330 | 330 | ), |
| 331 | 331 | array( |
| 332 | 332 | 'tag' => 'payment_method', |
| 333 | - 'description' => esc_html__( 'The method of payment used for this donation.', 'give' ), |
|
| 333 | + 'description' => esc_html__('The method of payment used for this donation.', 'give'), |
|
| 334 | 334 | 'function' => 'give_email_tag_payment_method' |
| 335 | 335 | ), |
| 336 | 336 | array( |
| 337 | 337 | 'tag' => 'sitename', |
| 338 | - 'description' => esc_html__( 'The name of the site.', 'give' ), |
|
| 338 | + 'description' => esc_html__('The name of the site.', 'give'), |
|
| 339 | 339 | 'function' => 'give_email_tag_sitename' |
| 340 | 340 | ), |
| 341 | 341 | array( |
| 342 | 342 | 'tag' => 'receipt_link', |
| 343 | - 'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
| 343 | + 'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
| 344 | 344 | 'function' => 'give_email_tag_receipt_link' |
| 345 | 345 | ), |
| 346 | 346 | array( |
| 347 | 347 | 'tag' => 'receipt_link_url', |
| 348 | - 'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
| 348 | + 'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
| 349 | 349 | 'function' => 'give_email_tag_receipt_link_url' |
| 350 | 350 | ), |
| 351 | 351 | ); |
| 352 | 352 | |
| 353 | 353 | // Apply give_email_tags filter |
| 354 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
| 354 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
| 355 | 355 | |
| 356 | 356 | // Add email tags |
| 357 | - foreach ( $email_tags as $email_tag ) { |
|
| 358 | - give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] ); |
|
| 357 | + foreach ($email_tags as $email_tag) { |
|
| 358 | + give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
| 363 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
| 364 | 364 | |
| 365 | 365 | |
| 366 | 366 | /** |
@@ -372,15 +372,15 @@ discard block |
||
| 372 | 372 | * |
| 373 | 373 | * @return string name |
| 374 | 374 | */ |
| 375 | -function give_email_tag_first_name( $payment_id ) { |
|
| 376 | - $payment = new Give_Payment( $payment_id ); |
|
| 375 | +function give_email_tag_first_name($payment_id) { |
|
| 376 | + $payment = new Give_Payment($payment_id); |
|
| 377 | 377 | $user_info = $payment->user_info; |
| 378 | 378 | |
| 379 | - if ( empty( $user_info ) ) { |
|
| 379 | + if (empty($user_info)) { |
|
| 380 | 380 | return ''; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - $email_name = give_get_email_names( $user_info ); |
|
| 383 | + $email_name = give_get_email_names($user_info); |
|
| 384 | 384 | |
| 385 | 385 | return $email_name['name']; |
| 386 | 386 | } |
@@ -394,15 +394,15 @@ discard block |
||
| 394 | 394 | * |
| 395 | 395 | * @return string fullname |
| 396 | 396 | */ |
| 397 | -function give_email_tag_fullname( $payment_id ) { |
|
| 398 | - $payment = new Give_Payment( $payment_id ); |
|
| 397 | +function give_email_tag_fullname($payment_id) { |
|
| 398 | + $payment = new Give_Payment($payment_id); |
|
| 399 | 399 | $user_info = $payment->user_info; |
| 400 | 400 | |
| 401 | - if ( empty( $user_info ) ) { |
|
| 401 | + if (empty($user_info)) { |
|
| 402 | 402 | return ''; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - $email_name = give_get_email_names( $user_info ); |
|
| 405 | + $email_name = give_get_email_names($user_info); |
|
| 406 | 406 | |
| 407 | 407 | return $email_name['fullname']; |
| 408 | 408 | } |
@@ -416,15 +416,15 @@ discard block |
||
| 416 | 416 | * |
| 417 | 417 | * @return string username. |
| 418 | 418 | */ |
| 419 | -function give_email_tag_username( $payment_id ) { |
|
| 420 | - $payment = new Give_Payment( $payment_id ); |
|
| 419 | +function give_email_tag_username($payment_id) { |
|
| 420 | + $payment = new Give_Payment($payment_id); |
|
| 421 | 421 | $user_info = $payment->user_info; |
| 422 | 422 | |
| 423 | - if ( empty( $user_info ) ) { |
|
| 423 | + if (empty($user_info)) { |
|
| 424 | 424 | return ''; |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - $email_name = give_get_email_names( $user_info ); |
|
| 427 | + $email_name = give_get_email_names($user_info); |
|
| 428 | 428 | |
| 429 | 429 | return $email_name['username']; |
| 430 | 430 | } |
@@ -438,8 +438,8 @@ discard block |
||
| 438 | 438 | * |
| 439 | 439 | * @return string user_email |
| 440 | 440 | */ |
| 441 | -function give_email_tag_user_email( $payment_id ) { |
|
| 442 | - $payment = new Give_Payment( $payment_id ); |
|
| 441 | +function give_email_tag_user_email($payment_id) { |
|
| 442 | + $payment = new Give_Payment($payment_id); |
|
| 443 | 443 | |
| 444 | 444 | return $payment->email; |
| 445 | 445 | } |
@@ -453,10 +453,10 @@ discard block |
||
| 453 | 453 | * |
| 454 | 454 | * @return string billing_address |
| 455 | 455 | */ |
| 456 | -function give_email_tag_billing_address( $payment_id ) { |
|
| 456 | +function give_email_tag_billing_address($payment_id) { |
|
| 457 | 457 | |
| 458 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 459 | - $user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( |
|
| 458 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
| 459 | + $user_address = ! empty($user_info['address']) ? $user_info['address'] : array( |
|
| 460 | 460 | 'line1' => '', |
| 461 | 461 | 'line2' => '', |
| 462 | 462 | 'city' => '', |
@@ -465,11 +465,11 @@ discard block |
||
| 465 | 465 | 'zip' => '' |
| 466 | 466 | ); |
| 467 | 467 | |
| 468 | - $return = $user_address['line1'] . "\n"; |
|
| 469 | - if ( ! empty( $user_address['line2'] ) ) { |
|
| 470 | - $return .= $user_address['line2'] . "\n"; |
|
| 468 | + $return = $user_address['line1']."\n"; |
|
| 469 | + if ( ! empty($user_address['line2'])) { |
|
| 470 | + $return .= $user_address['line2']."\n"; |
|
| 471 | 471 | } |
| 472 | - $return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n"; |
|
| 472 | + $return .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n"; |
|
| 473 | 473 | $return .= $user_address['country']; |
| 474 | 474 | |
| 475 | 475 | return $return; |
@@ -484,10 +484,10 @@ discard block |
||
| 484 | 484 | * |
| 485 | 485 | * @return string date |
| 486 | 486 | */ |
| 487 | -function give_email_tag_date( $payment_id ) { |
|
| 488 | - $payment = new Give_Payment( $payment_id ); |
|
| 487 | +function give_email_tag_date($payment_id) { |
|
| 488 | + $payment = new Give_Payment($payment_id); |
|
| 489 | 489 | |
| 490 | - return date_i18n( give_date_format(), strtotime( $payment->date ) ); |
|
| 490 | + return date_i18n(give_date_format(), strtotime($payment->date)); |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | /** |
@@ -499,11 +499,11 @@ discard block |
||
| 499 | 499 | * |
| 500 | 500 | * @return string price |
| 501 | 501 | */ |
| 502 | -function give_email_tag_price( $payment_id ) { |
|
| 503 | - $payment = new Give_Payment( $payment_id ); |
|
| 504 | - $price = give_currency_filter( give_format_amount( $payment->total ), $payment->currency ); |
|
| 502 | +function give_email_tag_price($payment_id) { |
|
| 503 | + $payment = new Give_Payment($payment_id); |
|
| 504 | + $price = give_currency_filter(give_format_amount($payment->total), $payment->currency); |
|
| 505 | 505 | |
| 506 | - return html_entity_decode( $price, ENT_COMPAT, 'UTF-8' ); |
|
| 506 | + return html_entity_decode($price, ENT_COMPAT, 'UTF-8'); |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /** |
@@ -515,8 +515,8 @@ discard block |
||
| 515 | 515 | * |
| 516 | 516 | * @return int payment_id |
| 517 | 517 | */ |
| 518 | -function give_email_tag_payment_id( $payment_id ) { |
|
| 519 | - $payment = new Give_Payment( $payment_id ); |
|
| 518 | +function give_email_tag_payment_id($payment_id) { |
|
| 519 | + $payment = new Give_Payment($payment_id); |
|
| 520 | 520 | |
| 521 | 521 | return $payment->number; |
| 522 | 522 | } |
@@ -530,8 +530,8 @@ discard block |
||
| 530 | 530 | * |
| 531 | 531 | * @return string receipt_id |
| 532 | 532 | */ |
| 533 | -function give_email_tag_receipt_id( $payment_id ) { |
|
| 534 | - $payment = new Give_Payment( $payment_id ); |
|
| 533 | +function give_email_tag_receipt_id($payment_id) { |
|
| 534 | + $payment = new Give_Payment($payment_id); |
|
| 535 | 535 | |
| 536 | 536 | return $payment->key; |
| 537 | 537 | } |
@@ -545,14 +545,14 @@ discard block |
||
| 545 | 545 | * |
| 546 | 546 | * @return string $form_title |
| 547 | 547 | */ |
| 548 | -function give_email_tag_donation( $payment_id ) { |
|
| 549 | - $payment = new Give_Payment( $payment_id ); |
|
| 548 | +function give_email_tag_donation($payment_id) { |
|
| 549 | + $payment = new Give_Payment($payment_id); |
|
| 550 | 550 | $payment_meta = $payment->payment_meta; |
| 551 | - $level_title = give_has_variable_prices( $payment_meta['form_id'] ); |
|
| 551 | + $level_title = give_has_variable_prices($payment_meta['form_id']); |
|
| 552 | 552 | $separator = $level_title ? '-' : ''; |
| 553 | - $form_title = strip_tags( give_get_payment_form_title( $payment_meta, $level_title, $separator ) ); |
|
| 553 | + $form_title = strip_tags(give_get_payment_form_title($payment_meta, $level_title, $separator)); |
|
| 554 | 554 | |
| 555 | - return ! empty( $form_title ) ? $form_title : esc_html__( 'There was an error retrieving the donation form name.', 'give' ); |
|
| 555 | + return ! empty($form_title) ? $form_title : esc_html__('There was an error retrieving the donation form name.', 'give'); |
|
| 556 | 556 | |
| 557 | 557 | } |
| 558 | 558 | |
@@ -565,10 +565,10 @@ discard block |
||
| 565 | 565 | * |
| 566 | 566 | * @return string gateway |
| 567 | 567 | */ |
| 568 | -function give_email_tag_payment_method( $payment_id ) { |
|
| 569 | - $payment = new Give_Payment( $payment_id ); |
|
| 568 | +function give_email_tag_payment_method($payment_id) { |
|
| 569 | + $payment = new Give_Payment($payment_id); |
|
| 570 | 570 | |
| 571 | - return give_get_gateway_checkout_label( $payment->gateway ); |
|
| 571 | + return give_get_gateway_checkout_label($payment->gateway); |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /** |
@@ -580,8 +580,8 @@ discard block |
||
| 580 | 580 | * |
| 581 | 581 | * @return string sitename |
| 582 | 582 | */ |
| 583 | -function give_email_tag_sitename( $payment_id ) { |
|
| 584 | - return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
| 583 | +function give_email_tag_sitename($payment_id) { |
|
| 584 | + return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -593,19 +593,19 @@ discard block |
||
| 593 | 593 | * |
| 594 | 594 | * @return string receipt_link |
| 595 | 595 | */ |
| 596 | -function give_email_tag_receipt_link( $payment_id ) { |
|
| 596 | +function give_email_tag_receipt_link($payment_id) { |
|
| 597 | 597 | |
| 598 | - $receipt_url = esc_url( add_query_arg( array( |
|
| 599 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
| 598 | + $receipt_url = esc_url(add_query_arg(array( |
|
| 599 | + 'payment_key' => give_get_payment_key($payment_id), |
|
| 600 | 600 | 'give_action' => 'view_receipt' |
| 601 | - ), home_url() ) ); |
|
| 602 | - $formatted = sprintf( |
|
| 601 | + ), home_url())); |
|
| 602 | + $formatted = sprintf( |
|
| 603 | 603 | '<a href="%1$s">%2$s</a>', |
| 604 | 604 | $receipt_url, |
| 605 | - esc_html__( 'View it in your browser', 'give' ) |
|
| 605 | + esc_html__('View it in your browser', 'give') |
|
| 606 | 606 | ); |
| 607 | 607 | |
| 608 | - if ( give_get_option( 'email_template' ) !== 'none' ) { |
|
| 608 | + if (give_get_option('email_template') !== 'none') { |
|
| 609 | 609 | return $formatted; |
| 610 | 610 | } else { |
| 611 | 611 | return $receipt_url; |
@@ -624,12 +624,12 @@ discard block |
||
| 624 | 624 | * |
| 625 | 625 | * @return string receipt_url |
| 626 | 626 | */ |
| 627 | -function give_email_tag_receipt_link_url( $payment_id ) { |
|
| 627 | +function give_email_tag_receipt_link_url($payment_id) { |
|
| 628 | 628 | |
| 629 | - $receipt_url = esc_url( add_query_arg( array( |
|
| 630 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
| 629 | + $receipt_url = esc_url(add_query_arg(array( |
|
| 630 | + 'payment_key' => give_get_payment_key($payment_id), |
|
| 631 | 631 | 'give_action' => 'view_receipt' |
| 632 | - ), home_url() ) ); |
|
| 632 | + ), home_url())); |
|
| 633 | 633 | |
| 634 | 634 | return $receipt_url; |
| 635 | 635 | |
@@ -358,9 +358,9 @@ |
||
| 358 | 358 | require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
| 359 | 359 | require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
| 360 | 360 | |
| 361 | - if( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 362 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 363 | - } |
|
| 361 | + if( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 362 | + require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 363 | + } |
|
| 364 | 364 | |
| 365 | 365 | if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
| 366 | 366 | |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | 42 | // Exit if accessed directly. |
| 43 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 43 | +if ( ! defined('ABSPATH')) {
|
|
| 44 | 44 | exit; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if ( ! class_exists( 'Give' ) ) : |
|
| 47 | +if ( ! class_exists('Give')) :
|
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | * @return Give |
| 196 | 196 | */ |
| 197 | 197 | public static function instance() {
|
| 198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
|
|
| 198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
|
|
| 199 | 199 | self::$instance = new Give; |
| 200 | 200 | self::$instance->setup_constants(); |
| 201 | 201 | |
| 202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
| 202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
|
|
| 203 | 203 | |
| 204 | 204 | self::$instance->includes(); |
| 205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function __clone() {
|
| 234 | 234 | // Cloning instances of the class is forbidden |
| 235 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 235 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ huh?', 'give'), '1.0');
|
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function __wakeup() {
|
| 247 | 247 | // Unserializing instances of the class is forbidden. |
| 248 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 248 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ huh?', 'give'), '1.0');
|
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -259,33 +259,33 @@ discard block |
||
| 259 | 259 | private function setup_constants() {
|
| 260 | 260 | |
| 261 | 261 | // Plugin version |
| 262 | - if ( ! defined( 'GIVE_VERSION' ) ) {
|
|
| 263 | - define( 'GIVE_VERSION', '1.7' ); |
|
| 262 | + if ( ! defined('GIVE_VERSION')) {
|
|
| 263 | + define('GIVE_VERSION', '1.7');
|
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | // Plugin Folder Path |
| 267 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
|
|
| 268 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
| 267 | + if ( ! defined('GIVE_PLUGIN_DIR')) {
|
|
| 268 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | // Plugin Folder URL |
| 272 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
|
|
| 273 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
| 272 | + if ( ! defined('GIVE_PLUGIN_URL')) {
|
|
| 273 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // Plugin Basename aka: "give/give.php" |
| 277 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
|
|
| 278 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
| 277 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) {
|
|
| 278 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Plugin Root File |
| 282 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
|
|
| 283 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
| 282 | + if ( ! defined('GIVE_PLUGIN_FILE')) {
|
|
| 283 | + define('GIVE_PLUGIN_FILE', __FILE__);
|
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Make sure CAL_GREGORIAN is defined |
| 287 | - if ( ! defined( 'CAL_GREGORIAN' ) ) {
|
|
| 288 | - define( 'CAL_GREGORIAN', 1 ); |
|
| 287 | + if ( ! defined('CAL_GREGORIAN')) {
|
|
| 288 | + define('CAL_GREGORIAN', 1);
|
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -300,117 +300,117 @@ discard block |
||
| 300 | 300 | private function includes() {
|
| 301 | 301 | global $give_options; |
| 302 | 302 | |
| 303 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
| 303 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
| 304 | 304 | $give_options = give_get_settings(); |
| 305 | 305 | |
| 306 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
| 307 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
| 308 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
| 309 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
| 310 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
| 311 | - |
|
| 312 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
| 313 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
| 314 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
| 315 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
| 316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
| 317 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
| 318 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
| 319 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
| 320 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
| 321 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
| 322 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
| 323 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
| 324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
| 325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
| 326 | - |
|
| 327 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
| 328 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
| 329 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
| 330 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
| 331 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
| 332 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
| 333 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
| 334 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
| 335 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
| 336 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
| 337 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
| 338 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
| 339 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
| 340 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
| 341 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
| 342 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
| 343 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
| 344 | - |
|
| 345 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
| 346 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
| 347 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
| 348 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
| 349 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
| 350 | - |
|
| 351 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
| 352 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
| 353 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
| 354 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
| 355 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
| 356 | - |
|
| 357 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
| 358 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
| 359 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
| 360 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
| 361 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
| 362 | - |
|
| 363 | - if( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 364 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 306 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
| 307 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
| 308 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
| 309 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
| 310 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
| 311 | + |
|
| 312 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
| 313 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
| 314 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
| 315 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
| 316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
| 317 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
| 318 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
| 319 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
| 320 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
| 321 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
| 322 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
| 323 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
| 324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
| 325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
| 326 | + |
|
| 327 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
| 328 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
| 329 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
| 330 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
| 331 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
| 332 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
| 333 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
| 334 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
| 335 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
| 336 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
| 337 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
| 338 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
| 339 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
| 340 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
| 341 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
| 342 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
| 343 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
| 344 | + |
|
| 345 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
| 346 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
| 347 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
| 348 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
| 349 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
| 350 | + |
|
| 351 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
| 352 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
| 353 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
| 354 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
| 355 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
| 356 | + |
|
| 357 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
| 358 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
| 359 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
| 360 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
| 361 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
| 362 | + |
|
| 363 | + if (defined('WP_CLI') && WP_CLI) {
|
|
| 364 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
|
| 368 | - |
|
| 369 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
| 370 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
| 371 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
| 372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
| 373 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
| 374 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
| 375 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
| 376 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
| 377 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
| 378 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
| 379 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
| 380 | - |
|
| 381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
| 382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
| 383 | - |
|
| 384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
| 385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
| 386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
| 387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
| 388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
| 389 | - |
|
| 390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
| 391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
| 392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
| 393 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
| 394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
| 395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
| 396 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
| 397 | - |
|
| 398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 404 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 406 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 407 | - |
|
| 408 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 409 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
| 367 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
|
|
| 368 | + |
|
| 369 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
| 370 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
| 371 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
| 372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
| 373 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
| 374 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
| 375 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
| 376 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
| 377 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
| 378 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
| 379 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
| 380 | + |
|
| 381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
| 382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
| 383 | + |
|
| 384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
| 385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
| 386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
| 387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
| 388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
| 389 | + |
|
| 390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
| 391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
| 392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
| 393 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
| 394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
| 395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
| 396 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
| 397 | + |
|
| 398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 404 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 407 | + |
|
| 408 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 409 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
| 410 | 410 | |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
| 413 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
| 414 | 414 | |
| 415 | 415 | } |
| 416 | 416 | |
@@ -424,26 +424,26 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | public function load_textdomain() {
|
| 426 | 426 | // Set filter for Give's languages directory |
| 427 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
| 428 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
| 427 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
| 428 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
|
|
| 429 | 429 | |
| 430 | 430 | // Traditional WordPress plugin locale filter |
| 431 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
| 432 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
| 431 | + $locale = apply_filters('plugin_locale', get_locale(), 'give');
|
|
| 432 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
|
|
| 433 | 433 | |
| 434 | 434 | // Setup paths to current locale file |
| 435 | - $mofile_local = $give_lang_dir . $mofile; |
|
| 436 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
| 435 | + $mofile_local = $give_lang_dir.$mofile; |
|
| 436 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
| 437 | 437 | |
| 438 | - if ( file_exists( $mofile_global ) ) {
|
|
| 438 | + if (file_exists($mofile_global)) {
|
|
| 439 | 439 | // Look in global /wp-content/languages/give folder |
| 440 | - load_textdomain( 'give', $mofile_global ); |
|
| 441 | - } elseif ( file_exists( $mofile_local ) ) {
|
|
| 440 | + load_textdomain('give', $mofile_global);
|
|
| 441 | + } elseif (file_exists($mofile_local)) {
|
|
| 442 | 442 | // Look in local location from filter `give_languages_directory` |
| 443 | - load_textdomain( 'give', $mofile_local ); |
|
| 443 | + load_textdomain('give', $mofile_local);
|
|
| 444 | 444 | } else {
|
| 445 | 445 | // Load the default language files packaged up w/ Give |
| 446 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
| 446 | + load_plugin_textdomain('give', false, $give_lang_dir);
|
|
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | 449 | |
@@ -10,13 +10,13 @@ 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 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - public function search_box( $text, $input_id ) { |
|
| 67 | - $input_id = $input_id . '-search-input'; |
|
| 66 | + public function search_box($text, $input_id) { |
|
| 67 | + $input_id = $input_id.'-search-input'; |
|
| 68 | 68 | |
| 69 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 70 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 69 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 70 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 71 | 71 | } |
| 72 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 73 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 72 | + if ( ! empty($_REQUEST['order'])) { |
|
| 73 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 74 | 74 | } |
| 75 | 75 | ?> |
| 76 | 76 | <p class="search-box"> |
| 77 | 77 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 78 | 78 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
| 79 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
| 79 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
| 80 | 80 | </p> |
| 81 | 81 | <?php |
| 82 | 82 | } |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function get_columns() { |
| 92 | 92 | $columns = array( |
| 93 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
| 94 | - 'details' => esc_html__( 'Request Details', 'give' ), |
|
| 95 | - 'ip' => esc_html__( 'Request IP', 'give' ), |
|
| 96 | - 'date' => esc_html__( 'Date', 'give' ) |
|
| 93 | + 'ID' => esc_html__('Log ID', 'give'), |
|
| 94 | + 'details' => esc_html__('Request Details', 'give'), |
|
| 95 | + 'ip' => esc_html__('Request IP', 'give'), |
|
| 96 | + 'date' => esc_html__('Date', 'give') |
|
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | 99 | return $columns; |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return string Column Name |
| 112 | 112 | */ |
| 113 | - public function column_default( $item, $column_name ) { |
|
| 114 | - switch ( $column_name ) { |
|
| 113 | + public function column_default($item, $column_name) { |
|
| 114 | + switch ($column_name) { |
|
| 115 | 115 | default: |
| 116 | - return $item[ $column_name ]; |
|
| 116 | + return $item[$column_name]; |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -127,26 +127,26 @@ discard block |
||
| 127 | 127 | * |
| 128 | 128 | * @return void |
| 129 | 129 | */ |
| 130 | - public function column_details( $item ) { |
|
| 130 | + public function column_details($item) { |
|
| 131 | 131 | ?> |
| 132 | - <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Request', 'give' ); ?></a> |
|
| 132 | + <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Request', 'give'); ?></a> |
|
| 133 | 133 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
| 134 | 134 | <?php |
| 135 | 135 | |
| 136 | - $request = get_post_field( 'post_excerpt', $item['ID'] ); |
|
| 137 | - $error = get_post_field( 'post_content', $item['ID'] ); |
|
| 138 | - echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>'; |
|
| 139 | - echo '<div>' . $request . '</div>'; |
|
| 140 | - if ( ! empty( $error ) ) { |
|
| 141 | - echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>'; |
|
| 142 | - echo '<div>' . esc_html( $error ) . '</div>'; |
|
| 136 | + $request = get_post_field('post_excerpt', $item['ID']); |
|
| 137 | + $error = get_post_field('post_content', $item['ID']); |
|
| 138 | + echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>'; |
|
| 139 | + echo '<div>'.$request.'</div>'; |
|
| 140 | + if ( ! empty($error)) { |
|
| 141 | + echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>'; |
|
| 142 | + echo '<div>'.esc_html($error).'</div>'; |
|
| 143 | 143 | } |
| 144 | - echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>'; |
|
| 145 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>'; |
|
| 146 | - echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>'; |
|
| 147 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>'; |
|
| 148 | - echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>'; |
|
| 149 | - echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>'; |
|
| 144 | + echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>'; |
|
| 145 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>'; |
|
| 146 | + echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>'; |
|
| 147 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>'; |
|
| 148 | + echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>'; |
|
| 149 | + echo '<div>'.get_post_field('post_date', $item['ID']).'</div>'; |
|
| 150 | 150 | ?> |
| 151 | 151 | </div> |
| 152 | 152 | <?php |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @return mixed String if search is present, false otherwise |
| 161 | 161 | */ |
| 162 | 162 | public function get_search() { |
| 163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
| 163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
@@ -176,19 +176,19 @@ discard block |
||
| 176 | 176 | * |
| 177 | 177 | * @param string $which |
| 178 | 178 | */ |
| 179 | - protected function display_tablenav( $which ) { |
|
| 180 | - if ( 'top' === $which ) { |
|
| 181 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 179 | + protected function display_tablenav($which) { |
|
| 180 | + if ('top' === $which) { |
|
| 181 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 182 | 182 | } |
| 183 | 183 | ?> |
| 184 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
| 184 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
| 185 | 185 | |
| 186 | 186 | <div class="alignleft actions bulkactions"> |
| 187 | - <?php $this->bulk_actions( $which ); ?> |
|
| 187 | + <?php $this->bulk_actions($which); ?> |
|
| 188 | 188 | </div> |
| 189 | 189 | <?php |
| 190 | - $this->extra_tablenav( $which ); |
|
| 191 | - $this->pagination( $which ); |
|
| 190 | + $this->extra_tablenav($which); |
|
| 191 | + $this->pagination($which); |
|
| 192 | 192 | ?> |
| 193 | 193 | |
| 194 | 194 | <br class="clear"/> |
@@ -210,31 +210,31 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | $search = $this->get_search(); |
| 212 | 212 | |
| 213 | - if ( $search ) { |
|
| 214 | - if ( filter_var( $search, FILTER_VALIDATE_IP ) ) { |
|
| 213 | + if ($search) { |
|
| 214 | + if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
| 215 | 215 | // This is an IP address search |
| 216 | 216 | $key = '_give_log_request_ip'; |
| 217 | - } else if ( is_email( $search ) ) { |
|
| 217 | + } else if (is_email($search)) { |
|
| 218 | 218 | // This is an email search |
| 219 | - $userdata = get_user_by( 'email', $search ); |
|
| 219 | + $userdata = get_user_by('email', $search); |
|
| 220 | 220 | |
| 221 | - if ( $userdata ) { |
|
| 221 | + if ($userdata) { |
|
| 222 | 222 | $search = $userdata->ID; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $key = '_give_log_user'; |
| 226 | - } elseif ( strlen( $search ) == 32 ) { |
|
| 226 | + } elseif (strlen($search) == 32) { |
|
| 227 | 227 | // Look for an API key |
| 228 | 228 | $key = '_give_log_key'; |
| 229 | - } elseif ( stristr( $search, 'token:' ) ) { |
|
| 229 | + } elseif (stristr($search, 'token:')) { |
|
| 230 | 230 | // Look for an API token |
| 231 | - $search = str_ireplace( 'token:', '', $search ); |
|
| 231 | + $search = str_ireplace('token:', '', $search); |
|
| 232 | 232 | $key = '_give_log_token'; |
| 233 | 233 | } else { |
| 234 | 234 | // This is (probably) a user ID search |
| 235 | - $userdata = get_userdata( $search ); |
|
| 235 | + $userdata = get_userdata($search); |
|
| 236 | 236 | |
| 237 | - if ( $userdata ) { |
|
| 237 | + if ($userdata) { |
|
| 238 | 238 | $search = $userdata->ID; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @return int Current page number |
| 261 | 261 | */ |
| 262 | 262 | public function get_paged() { |
| 263 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 263 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @since 1.0 |
| 271 | 271 | * @return void |
| 272 | 272 | */ |
| 273 | - function bulk_actions( $which = '' ) { |
|
| 273 | + function bulk_actions($which = '') { |
|
| 274 | 274 | give_log_views(); |
| 275 | 275 | } |
| 276 | 276 | |
@@ -293,14 +293,14 @@ discard block |
||
| 293 | 293 | 'meta_query' => $this->get_meta_query() |
| 294 | 294 | ); |
| 295 | 295 | |
| 296 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
| 296 | + $logs = $give_logs->get_connected_logs($log_query); |
|
| 297 | 297 | |
| 298 | - if ( $logs ) { |
|
| 299 | - foreach ( $logs as $log ) { |
|
| 298 | + if ($logs) { |
|
| 299 | + foreach ($logs as $log) { |
|
| 300 | 300 | |
| 301 | 301 | $logs_data[] = array( |
| 302 | 302 | 'ID' => $log->ID, |
| 303 | - 'ip' => get_post_meta( $log->ID, '_give_log_request_ip', true ), |
|
| 303 | + 'ip' => get_post_meta($log->ID, '_give_log_request_ip', true), |
|
| 304 | 304 | 'date' => $log->post_date |
| 305 | 305 | ); |
| 306 | 306 | } |
@@ -328,14 +328,14 @@ discard block |
||
| 328 | 328 | $columns = $this->get_columns(); |
| 329 | 329 | $hidden = array(); // No hidden columns |
| 330 | 330 | $sortable = $this->get_sortable_columns(); |
| 331 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 331 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 332 | 332 | $this->items = $this->get_logs(); |
| 333 | - $total_items = $give_logs->get_log_count( 0, 'api_requests' ); |
|
| 333 | + $total_items = $give_logs->get_log_count(0, 'api_requests'); |
|
| 334 | 334 | |
| 335 | - $this->set_pagination_args( array( |
|
| 335 | + $this->set_pagination_args(array( |
|
| 336 | 336 | 'total_items' => $total_items, |
| 337 | 337 | 'per_page' => $this->per_page, |
| 338 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 338 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 339 | 339 | ) |
| 340 | 340 | ); |
| 341 | 341 | } |
@@ -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 | |
@@ -54,50 +54,50 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function get_data() { |
| 56 | 56 | |
| 57 | - if ( $this->step == 1 ) { |
|
| 58 | - $this->delete_data( 'give_temp_recount_income' ); |
|
| 57 | + if ($this->step == 1) { |
|
| 58 | + $this->delete_data('give_temp_recount_income'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $total = get_option( 'give_temp_recount_income', false ); |
|
| 61 | + $total = get_option('give_temp_recount_income', false); |
|
| 62 | 62 | |
| 63 | - if ( false === $total ) { |
|
| 63 | + if (false === $total) { |
|
| 64 | 64 | $total = (float) 0; |
| 65 | - $this->store_data( 'give_temp_recount_income', $total ); |
|
| 65 | + $this->store_data('give_temp_recount_income', $total); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
| 68 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
| 69 | 69 | |
| 70 | - $args = apply_filters( 'give_recount_income_args', array( |
|
| 70 | + $args = apply_filters('give_recount_income_args', array( |
|
| 71 | 71 | 'number' => $this->per_step, |
| 72 | 72 | 'page' => $this->step, |
| 73 | 73 | 'status' => $accepted_statuses, |
| 74 | 74 | 'fields' => 'ids' |
| 75 | - ) ); |
|
| 75 | + )); |
|
| 76 | 76 | |
| 77 | - $payments = give_get_payments( $args ); |
|
| 77 | + $payments = give_get_payments($args); |
|
| 78 | 78 | |
| 79 | - if ( ! empty( $payments ) ) { |
|
| 79 | + if ( ! empty($payments)) { |
|
| 80 | 80 | |
| 81 | - foreach ( $payments as $payment ) { |
|
| 81 | + foreach ($payments as $payment) { |
|
| 82 | 82 | |
| 83 | - $total += give_get_payment_amount( $payment ); |
|
| 83 | + $total += give_get_payment_amount($payment); |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if ( $total < 0 ) { |
|
| 87 | + if ($total < 0) { |
|
| 88 | 88 | $totals = 0; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $total = round( $total, give_currency_decimal_filter() ); |
|
| 91 | + $total = round($total, give_currency_decimal_filter()); |
|
| 92 | 92 | |
| 93 | - $this->store_data( 'give_temp_recount_income', $total ); |
|
| 93 | + $this->store_data('give_temp_recount_income', $total); |
|
| 94 | 94 | |
| 95 | 95 | return true; |
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - update_option( 'give_income_total', $total ); |
|
| 100 | - set_transient( 'give_income_total', $total, 86400 ); |
|
| 99 | + update_option('give_income_total', $total); |
|
| 100 | + set_transient('give_income_total', $total, 86400); |
|
| 101 | 101 | |
| 102 | 102 | return false; |
| 103 | 103 | |
@@ -111,25 +111,25 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function get_percentage_complete() { |
| 113 | 113 | |
| 114 | - $total = $this->get_stored_data( 'give_recount_income_total' ); |
|
| 114 | + $total = $this->get_stored_data('give_recount_income_total'); |
|
| 115 | 115 | |
| 116 | - if ( false === $total ) { |
|
| 117 | - $args = apply_filters( 'give_recount_income_total_args', array() ); |
|
| 116 | + if (false === $total) { |
|
| 117 | + $args = apply_filters('give_recount_income_total_args', array()); |
|
| 118 | 118 | |
| 119 | - $counts = give_count_payments( $args ); |
|
| 120 | - $total = absint( $counts->publish ); |
|
| 121 | - $total = apply_filters( 'give_recount_store_income_total', $total ); |
|
| 119 | + $counts = give_count_payments($args); |
|
| 120 | + $total = absint($counts->publish); |
|
| 121 | + $total = apply_filters('give_recount_store_income_total', $total); |
|
| 122 | 122 | |
| 123 | - $this->store_data( 'give_recount_income_total', $total ); |
|
| 123 | + $this->store_data('give_recount_income_total', $total); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $percentage = 100; |
| 127 | 127 | |
| 128 | - if ( $total > 0 ) { |
|
| 129 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
| 128 | + if ($total > 0) { |
|
| 129 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if ( $percentage > 100 ) { |
|
| 132 | + if ($percentage > 100) { |
|
| 133 | 133 | $percentage = 100; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * |
| 144 | 144 | * @param array $request The Form Data passed into the batch processing |
| 145 | 145 | */ |
| 146 | - public function set_properties( $request ) { |
|
| 146 | + public function set_properties($request) { |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -154,31 +154,31 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function process_step() { |
| 156 | 156 | |
| 157 | - if ( ! $this->can_export() ) { |
|
| 158 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 157 | + if ( ! $this->can_export()) { |
|
| 158 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $had_data = $this->get_data(); |
| 162 | 162 | |
| 163 | - if ( $had_data ) { |
|
| 163 | + if ($had_data) { |
|
| 164 | 164 | $this->done = false; |
| 165 | 165 | |
| 166 | 166 | return true; |
| 167 | 167 | } else { |
| 168 | - $this->delete_data( 'give_recount_income_total' ); |
|
| 169 | - $this->delete_data( 'give_temp_recount_income' ); |
|
| 168 | + $this->delete_data('give_recount_income_total'); |
|
| 169 | + $this->delete_data('give_temp_recount_income'); |
|
| 170 | 170 | $this->done = true; |
| 171 | - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' ); |
|
| 171 | + $this->message = esc_html__('Income stats have been successfully recounted.', 'give'); |
|
| 172 | 172 | |
| 173 | 173 | return false; |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function headers() { |
| 178 | - ignore_user_abort( true ); |
|
| 178 | + ignore_user_abort(true); |
|
| 179 | 179 | |
| 180 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 181 | - set_time_limit( 0 ); |
|
| 180 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 181 | + set_time_limit(0); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return mixed Returns the data from the database |
| 208 | 208 | */ |
| 209 | - private function get_stored_data( $key ) { |
|
| 209 | + private function get_stored_data($key) { |
|
| 210 | 210 | global $wpdb; |
| 211 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
| 211 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
| 212 | 212 | |
| 213 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
| 213 | + return empty($value) ? false : maybe_unserialize($value); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -223,10 +223,10 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @return void |
| 225 | 225 | */ |
| 226 | - private function store_data( $key, $value ) { |
|
| 226 | + private function store_data($key, $value) { |
|
| 227 | 227 | global $wpdb; |
| 228 | 228 | |
| 229 | - $value = maybe_serialize( $value ); |
|
| 229 | + $value = maybe_serialize($value); |
|
| 230 | 230 | |
| 231 | 231 | $data = array( |
| 232 | 232 | 'option_name' => $key, |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | '%s', |
| 241 | 241 | ); |
| 242 | 242 | |
| 243 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
| 243 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -252,9 +252,9 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * @return void |
| 254 | 254 | */ |
| 255 | - private function delete_data( $key ) { |
|
| 255 | + private function delete_data($key) { |
|
| 256 | 256 | global $wpdb; |
| 257 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
| 257 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | } |
@@ -45,22 +45,22 @@ discard block |
||
| 45 | 45 | * @param string $default_path Default path. Default is empty. |
| 46 | 46 | */ |
| 47 | 47 | function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
| 48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
| 49 | - extract( $args ); |
|
| 50 | - } |
|
| 48 | + if ( ! empty( $args ) && is_array( $args ) ) { |
|
| 49 | + extract( $args ); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - $template_names = array( $template_name . '.php' ); |
|
| 52 | + $template_names = array( $template_name . '.php' ); |
|
| 53 | 53 | |
| 54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
| 54 | + $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
| 55 | 55 | |
| 56 | - if ( ! file_exists( $located ) ) { |
|
| 56 | + if ( ! file_exists( $located ) ) { |
|
| 57 | 57 | /* translators: %s: the template */ |
| 58 | - give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
| 59 | - return; |
|
| 60 | - } |
|
| 58 | + give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
| 59 | + return; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - // Allow 3rd party plugin filter template file from their plugin. |
|
| 63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
| 62 | + // Allow 3rd party plugin filter template file from their plugin. |
|
| 63 | + $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
| 75 | 75 | * @param array $args Passed arguments. |
| 76 | 76 | */ |
| 77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
| 77 | + do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
| 78 | 78 | |
| 79 | - include( $located ); |
|
| 79 | + include( $located ); |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
| 91 | 91 | * @param array $args Passed arguments. |
| 92 | 92 | */ |
| 93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
| 93 | + do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @return string |
| 22 | 22 | */ |
| 23 | 23 | function give_get_templates_dir() { |
| 24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
| 24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | 33 | function give_get_templates_url() { |
| 34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
| 34 | + return GIVE_PLUGIN_URL.'templates'; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -44,23 +44,23 @@ discard block |
||
| 44 | 44 | * @param string $template_path Template file path. Default is empty. |
| 45 | 45 | * @param string $default_path Default path. Default is empty. |
| 46 | 46 | */ |
| 47 | -function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
| 48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
| 49 | - extract( $args ); |
|
| 47 | +function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
| 48 | + if ( ! empty($args) && is_array($args)) { |
|
| 49 | + extract($args); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - $template_names = array( $template_name . '.php' ); |
|
| 52 | + $template_names = array($template_name.'.php'); |
|
| 53 | 53 | |
| 54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
| 54 | + $located = give_locate_template($template_names, $template_path, $default_path); |
|
| 55 | 55 | |
| 56 | - if ( ! file_exists( $located ) ) { |
|
| 56 | + if ( ! file_exists($located)) { |
|
| 57 | 57 | /* translators: %s: the template */ |
| 58 | - give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
| 58 | + give_output_error(sprintf(__('The %s template was not found.', 'give'), $located), true); |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // Allow 3rd party plugin filter template file from their plugin. |
| 63 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
| 63 | + $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path); |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Fires in give template, before the file is included. |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | * @param string $located Template file filter by 3rd party plugin. |
| 75 | 75 | * @param array $args Passed arguments. |
| 76 | 76 | */ |
| 77 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
| 77 | + do_action('give_before_template_part', $template_name, $template_path, $located, $args); |
|
| 78 | 78 | |
| 79 | - include( $located ); |
|
| 79 | + include($located); |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Fires in give template, after the file is included. |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param string $located Template file filter by 3rd party plugin. |
| 91 | 91 | * @param array $args Passed arguments. |
| 92 | 92 | */ |
| 93 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
| 93 | + do_action('give_after_template_part', $template_name, $template_path, $located, $args); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @return string |
| 108 | 108 | */ |
| 109 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
| 109 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * Fires in give template part, before the template part is retrieved. |
@@ -118,20 +118,20 @@ discard block |
||
| 118 | 118 | * @param string $slug Template part file slug {slug}.php. |
| 119 | 119 | * @param string $name Template part file name {slug}-{name}.php. |
| 120 | 120 | */ |
| 121 | - do_action( "get_template_part_{$slug}", $slug, $name ); |
|
| 121 | + do_action("get_template_part_{$slug}", $slug, $name); |
|
| 122 | 122 | |
| 123 | 123 | // Setup possible parts |
| 124 | 124 | $templates = array(); |
| 125 | - if ( isset( $name ) ) { |
|
| 126 | - $templates[] = $slug . '-' . $name . '.php'; |
|
| 125 | + if (isset($name)) { |
|
| 126 | + $templates[] = $slug.'-'.$name.'.php'; |
|
| 127 | 127 | } |
| 128 | - $templates[] = $slug . '.php'; |
|
| 128 | + $templates[] = $slug.'.php'; |
|
| 129 | 129 | |
| 130 | 130 | // Allow template parts to be filtered |
| 131 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
| 131 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
| 132 | 132 | |
| 133 | 133 | // Return the part that is found |
| 134 | - return give_locate_template( $templates, $load, false ); |
|
| 134 | + return give_locate_template($templates, $load, false); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -152,37 +152,37 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @return string The template filename if one is located. |
| 154 | 154 | */ |
| 155 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
| 155 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
| 156 | 156 | // No file found yet |
| 157 | 157 | $located = false; |
| 158 | 158 | |
| 159 | 159 | // Try to find a template file |
| 160 | - foreach ( (array) $template_names as $template_name ) { |
|
| 160 | + foreach ((array) $template_names as $template_name) { |
|
| 161 | 161 | |
| 162 | 162 | // Continue if template is empty |
| 163 | - if ( empty( $template_name ) ) { |
|
| 163 | + if (empty($template_name)) { |
|
| 164 | 164 | continue; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // Trim off any slashes from the template name |
| 168 | - $template_name = ltrim( $template_name, '/' ); |
|
| 168 | + $template_name = ltrim($template_name, '/'); |
|
| 169 | 169 | |
| 170 | 170 | // try locating this template file by looping through the template paths |
| 171 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
| 171 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
| 172 | 172 | |
| 173 | - if ( file_exists( $template_path . $template_name ) ) { |
|
| 174 | - $located = $template_path . $template_name; |
|
| 173 | + if (file_exists($template_path.$template_name)) { |
|
| 174 | + $located = $template_path.$template_name; |
|
| 175 | 175 | break; |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if ( $located ) { |
|
| 179 | + if ($located) { |
|
| 180 | 180 | break; |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
| 185 | - load_template( $located, $require_once ); |
|
| 184 | + if ((true == $load) && ! empty($located)) { |
|
| 185 | + load_template($located, $require_once); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | return $located; |
@@ -199,17 +199,17 @@ discard block |
||
| 199 | 199 | $template_dir = give_get_theme_template_dir_name(); |
| 200 | 200 | |
| 201 | 201 | $file_paths = array( |
| 202 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
| 203 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
| 202 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
| 203 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
| 204 | 204 | 100 => give_get_templates_dir() |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
| 207 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
| 208 | 208 | |
| 209 | 209 | // sort the file paths based on priority |
| 210 | - ksort( $file_paths, SORT_NUMERIC ); |
|
| 210 | + ksort($file_paths, SORT_NUMERIC); |
|
| 211 | 211 | |
| 212 | - return array_map( 'trailingslashit', $file_paths ); |
|
| 212 | + return array_map('trailingslashit', $file_paths); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @return string |
| 222 | 222 | */ |
| 223 | 223 | function give_get_theme_template_dir_name() { |
| 224 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
| 224 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -231,10 +231,10 @@ discard block |
||
| 231 | 231 | * @return void |
| 232 | 232 | */ |
| 233 | 233 | function give_version_in_header() { |
| 234 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
| 234 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
| 237 | +add_action('wp_head', 'give_version_in_header'); |
|
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | 240 | * Determines if we're currently on the Donations History page. |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | function give_is_donation_history_page() { |
| 246 | 246 | |
| 247 | - $ret = is_page( give_get_option( 'history_page' ) ); |
|
| 247 | + $ret = is_page(give_get_option('history_page')); |
|
| 248 | 248 | |
| 249 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
| 249 | + return apply_filters('give_is_donation_history_page', $ret); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -258,25 +258,25 @@ discard block |
||
| 258 | 258 | * |
| 259 | 259 | * @return array Modified array of classes |
| 260 | 260 | */ |
| 261 | -function give_add_body_classes( $class ) { |
|
| 261 | +function give_add_body_classes($class) { |
|
| 262 | 262 | $classes = (array) $class; |
| 263 | 263 | |
| 264 | - if ( give_is_success_page() ) { |
|
| 264 | + if (give_is_success_page()) { |
|
| 265 | 265 | $classes[] = 'give-success'; |
| 266 | 266 | $classes[] = 'give-page'; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - if ( give_is_failed_transaction_page() ) { |
|
| 269 | + if (give_is_failed_transaction_page()) { |
|
| 270 | 270 | $classes[] = 'give-failed-transaction'; |
| 271 | 271 | $classes[] = 'give-page'; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if ( give_is_donation_history_page() ) { |
|
| 274 | + if (give_is_donation_history_page()) { |
|
| 275 | 275 | $classes[] = 'give-donation-history'; |
| 276 | 276 | $classes[] = 'give-page'; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - if ( give_is_test_mode() ) { |
|
| 279 | + if (give_is_test_mode()) { |
|
| 280 | 280 | $classes[] = 'give-test-mode'; |
| 281 | 281 | $classes[] = 'give-page'; |
| 282 | 282 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | //Theme-specific Classes used to prevent conflicts via CSS |
| 285 | 285 | $current_theme = wp_get_theme(); |
| 286 | 286 | |
| 287 | - switch ( $current_theme->template ) { |
|
| 287 | + switch ($current_theme->template) { |
|
| 288 | 288 | |
| 289 | 289 | case 'Divi': |
| 290 | 290 | $classes[] = 'give-divi'; |
@@ -298,10 +298,10 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - return array_unique( $classes ); |
|
| 301 | + return array_unique($classes); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
| 304 | +add_filter('body_class', 'give_add_body_classes'); |
|
| 305 | 305 | |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -317,22 +317,22 @@ discard block |
||
| 317 | 317 | * |
| 318 | 318 | * @return array |
| 319 | 319 | */ |
| 320 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
| 321 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
| 320 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
| 321 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
| 322 | 322 | return $classes; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
| 326 | 326 | |
| 327 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
| 328 | - unset( $classes[ $key ] ); |
|
| 327 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
| 328 | + unset($classes[$key]); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | return $classes; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | |
| 335 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
| 335 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
| 336 | 336 | |
| 337 | 337 | /** |
| 338 | 338 | * Get the placeholder image URL for forms etc |
@@ -342,85 +342,85 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | function give_get_placeholder_img_src() { |
| 344 | 344 | |
| 345 | - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ); |
|
| 345 | + $placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')); |
|
| 346 | 346 | |
| 347 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
| 347 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | |
| 351 | 351 | /** |
| 352 | 352 | * Global |
| 353 | 353 | */ |
| 354 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
| 354 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
| 355 | 355 | |
| 356 | 356 | /** |
| 357 | 357 | * Output the start of the page wrapper. |
| 358 | 358 | */ |
| 359 | 359 | function give_output_content_wrapper() { |
| 360 | - give_get_template_part( 'global/wrapper-start' ); |
|
| 360 | + give_get_template_part('global/wrapper-start'); |
|
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
| 363 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
| 364 | 364 | |
| 365 | 365 | /** |
| 366 | 366 | * Output the end of the page wrapper. |
| 367 | 367 | */ |
| 368 | 368 | function give_output_content_wrapper_end() { |
| 369 | - give_get_template_part( 'global/wrapper-end' ); |
|
| 369 | + give_get_template_part('global/wrapper-end'); |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Single Give Form |
| 375 | 375 | */ |
| 376 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
| 376 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
| 377 | 377 | function give_left_sidebar_pre_wrap() { |
| 378 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
| 378 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
| 382 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
| 383 | 383 | function give_left_sidebar_post_wrap() { |
| 384 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
| 384 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
| 388 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
| 389 | 389 | function give_get_forms_sidebar() { |
| 390 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
| 390 | + give_get_template_part('single-give-form/sidebar'); |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
| 394 | +if ( ! function_exists('give_show_form_images')) { |
|
| 395 | 395 | |
| 396 | 396 | /** |
| 397 | 397 | * Output the product image before the single product summary. |
| 398 | 398 | */ |
| 399 | 399 | function give_show_form_images() { |
| 400 | - $featured_image_option = give_get_option( 'disable_form_featured_img' ); |
|
| 401 | - if ( $featured_image_option !== 'on' ) { |
|
| 402 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
| 400 | + $featured_image_option = give_get_option('disable_form_featured_img'); |
|
| 401 | + if ($featured_image_option !== 'on') { |
|
| 402 | + give_get_template_part('single-give-form/featured-image'); |
|
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
| 407 | +if ( ! function_exists('give_template_single_title')) { |
|
| 408 | 408 | |
| 409 | 409 | /** |
| 410 | 410 | * Output the product title. |
| 411 | 411 | */ |
| 412 | 412 | function give_template_single_title() { |
| 413 | - give_get_template_part( 'single-give-form/title' ); |
|
| 413 | + give_get_template_part('single-give-form/title'); |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | -if ( ! function_exists( 'give_show_avatars' ) ) { |
|
| 417 | +if ( ! function_exists('give_show_avatars')) { |
|
| 418 | 418 | |
| 419 | 419 | /** |
| 420 | 420 | * Output the product title. |
| 421 | 421 | */ |
| 422 | 422 | function give_show_avatars() { |
| 423 | - echo do_shortcode( '[give_donors_gravatars]' ); |
|
| 423 | + echo do_shortcode('[give_donors_gravatars]'); |
|
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | 426 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | * Conditional Functions |
| 429 | 429 | */ |
| 430 | 430 | |
| 431 | -if ( ! function_exists( 'is_give_form' ) ) { |
|
| 431 | +if ( ! function_exists('is_give_form')) { |
|
| 432 | 432 | |
| 433 | 433 | /** |
| 434 | 434 | * is_give_form |
@@ -440,11 +440,11 @@ discard block |
||
| 440 | 440 | * @return bool |
| 441 | 441 | */ |
| 442 | 442 | function is_give_form() { |
| 443 | - return is_singular( array( 'give_form' ) ); |
|
| 443 | + return is_singular(array('give_form')); |
|
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | -if ( ! function_exists( 'is_give_category' ) ) { |
|
| 447 | +if ( ! function_exists('is_give_category')) { |
|
| 448 | 448 | |
| 449 | 449 | /** |
| 450 | 450 | * is_give_category |
@@ -459,12 +459,12 @@ discard block |
||
| 459 | 459 | * |
| 460 | 460 | * @return bool |
| 461 | 461 | */ |
| 462 | - function is_give_category( $term = '' ) { |
|
| 463 | - return is_tax( 'give_forms_category', $term ); |
|
| 462 | + function is_give_category($term = '') { |
|
| 463 | + return is_tax('give_forms_category', $term); |
|
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | -if ( ! function_exists( 'is_give_tag' ) ) { |
|
| 467 | +if ( ! function_exists('is_give_tag')) { |
|
| 468 | 468 | |
| 469 | 469 | /** |
| 470 | 470 | * is_give_tag |
@@ -479,12 +479,12 @@ discard block |
||
| 479 | 479 | * |
| 480 | 480 | * @return bool |
| 481 | 481 | */ |
| 482 | - function is_give_tag( $term = '' ) { |
|
| 483 | - return is_tax( 'give_forms_tag', $term ); |
|
| 482 | + function is_give_tag($term = '') { |
|
| 483 | + return is_tax('give_forms_tag', $term); |
|
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | -if ( ! function_exists( 'is_give_taxonomy' ) ) { |
|
| 487 | +if ( ! function_exists('is_give_taxonomy')) { |
|
| 488 | 488 | |
| 489 | 489 | /** |
| 490 | 490 | * is_give_taxonomy |
@@ -496,6 +496,6 @@ discard block |
||
| 496 | 496 | * @return bool |
| 497 | 497 | */ |
| 498 | 498 | function is_give_taxonomy() { |
| 499 | - return is_tax( get_object_taxonomies( 'give_form' ) ); |
|
| 499 | + return is_tax(get_object_taxonomies('give_form')); |
|
| 500 | 500 | } |
| 501 | 501 | } |
@@ -33,20 +33,20 @@ discard block |
||
| 33 | 33 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if ( empty( $logout_redirect ) ) { |
|
| 37 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
| 38 | - } |
|
| 36 | + if ( empty( $logout_redirect ) ) { |
|
| 37 | + $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - // Add user_logout action to logout url. |
|
| 42 | - $logout_redirect = add_query_arg( |
|
| 43 | - array( |
|
| 44 | - 'give_action' => 'user_logout', |
|
| 45 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
| 46 | - 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
| 47 | - ), |
|
| 48 | - home_url('/') |
|
| 49 | - ); |
|
| 41 | + // Add user_logout action to logout url. |
|
| 42 | + $logout_redirect = add_query_arg( |
|
| 43 | + array( |
|
| 44 | + 'give_action' => 'user_logout', |
|
| 45 | + 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
| 46 | + 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
| 47 | + ), |
|
| 48 | + home_url('/') |
|
| 49 | + ); |
|
| 50 | 50 | |
| 51 | 51 | $give_login_redirect = $login_redirect; |
| 52 | 52 | $give_logout_redirect = $logout_redirect; |
@@ -136,31 +136,31 @@ discard block |
||
| 136 | 136 | * @return void |
| 137 | 137 | */ |
| 138 | 138 | function give_process_user_logout( $data ) { |
| 139 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
| 139 | + if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
| 140 | 140 | |
| 141 | - // Prevent occurring of any custom action on wp_logout. |
|
| 142 | - remove_all_actions( 'wp_logout' ); |
|
| 141 | + // Prevent occurring of any custom action on wp_logout. |
|
| 142 | + remove_all_actions( 'wp_logout' ); |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * Fires before processing user logout. |
| 146 | 146 | * |
| 147 | 147 | * @since 1.0 |
| 148 | 148 | */ |
| 149 | - do_action( 'give_before_user_logout' ); |
|
| 149 | + do_action( 'give_before_user_logout' ); |
|
| 150 | 150 | |
| 151 | - // Logout user. |
|
| 152 | - wp_logout(); |
|
| 151 | + // Logout user. |
|
| 152 | + wp_logout(); |
|
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | 155 | * Fires after processing user logout. |
| 156 | 156 | * |
| 157 | 157 | * @since 1.0 |
| 158 | 158 | */ |
| 159 | - do_action( 'give_after_user_logout' ); |
|
| 159 | + do_action( 'give_after_user_logout' ); |
|
| 160 | 160 | |
| 161 | - wp_redirect( $data['give_logout_redirect'] ); |
|
| 162 | - give_die(); |
|
| 163 | - } |
|
| 161 | + wp_redirect( $data['give_logout_redirect'] ); |
|
| 162 | + give_die(); |
|
| 163 | + } |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | add_action( 'give_user_logout', 'give_process_user_logout' ); |
@@ -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 | |
@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return string Login form |
| 28 | 28 | */ |
| 29 | -function give_login_form( $login_redirect = '', $logout_redirect = '' ) { |
|
| 29 | +function give_login_form($login_redirect = '', $logout_redirect = '') { |
|
| 30 | 30 | global $give_login_redirect, $give_logout_redirect; |
| 31 | 31 | |
| 32 | - if ( empty( $login_redirect ) ) { |
|
| 32 | + if (empty($login_redirect)) { |
|
| 33 | 33 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if ( empty( $logout_redirect ) ) { |
|
| 37 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
| 36 | + if (empty($logout_redirect)) { |
|
| 37 | + $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url()); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | $logout_redirect = add_query_arg( |
| 43 | 43 | array( |
| 44 | 44 | 'give_action' => 'user_logout', |
| 45 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
| 46 | - 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
| 45 | + 'give_logout_nonce' => wp_create_nonce('give-logout-nonce'), |
|
| 46 | + 'give_logout_redirect' => urlencode($logout_redirect) |
|
| 47 | 47 | ), |
| 48 | 48 | home_url('/') |
| 49 | 49 | ); |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | ob_start(); |
| 55 | 55 | |
| 56 | - give_get_template_part( 'shortcode', 'login' ); |
|
| 56 | + give_get_template_part('shortcode', 'login'); |
|
| 57 | 57 | |
| 58 | - return apply_filters( 'give_login_form', ob_get_clean() ); |
|
| 58 | + return apply_filters('give_login_form', ob_get_clean()); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return string Register form |
| 70 | 70 | */ |
| 71 | -function give_register_form( $redirect = '' ) { |
|
| 71 | +function give_register_form($redirect = '') { |
|
| 72 | 72 | global $give_register_redirect; |
| 73 | 73 | |
| 74 | - if ( empty( $redirect ) ) { |
|
| 74 | + if (empty($redirect)) { |
|
| 75 | 75 | $redirect = give_get_current_page_url(); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | ob_start(); |
| 81 | 81 | |
| 82 | - if ( ! is_user_logged_in() ) { |
|
| 83 | - give_get_template_part( 'shortcode', 'register' ); |
|
| 82 | + if ( ! is_user_logged_in()) { |
|
| 83 | + give_get_template_part('shortcode', 'register'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - return apply_filters( 'give_register_form', ob_get_clean() ); |
|
| 86 | + return apply_filters('give_register_form', ob_get_clean()); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -95,34 +95,34 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @return void |
| 97 | 97 | */ |
| 98 | -function give_process_login_form( $data ) { |
|
| 99 | - if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) { |
|
| 100 | - $user_data = get_user_by( 'login', $data['give_user_login'] ); |
|
| 101 | - if ( ! $user_data ) { |
|
| 102 | - $user_data = get_user_by( 'email', $data['give_user_login'] ); |
|
| 98 | +function give_process_login_form($data) { |
|
| 99 | + if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) { |
|
| 100 | + $user_data = get_user_by('login', $data['give_user_login']); |
|
| 101 | + if ( ! $user_data) { |
|
| 102 | + $user_data = get_user_by('email', $data['give_user_login']); |
|
| 103 | 103 | } |
| 104 | - if ( $user_data ) { |
|
| 104 | + if ($user_data) { |
|
| 105 | 105 | $user_ID = $user_data->ID; |
| 106 | 106 | $user_email = $user_data->user_email; |
| 107 | - if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) { |
|
| 108 | - give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] ); |
|
| 107 | + if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) { |
|
| 108 | + give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']); |
|
| 109 | 109 | } else { |
| 110 | - give_set_error( 'password_incorrect', esc_html__( 'The password you entered is incorrect.', 'give' ) ); |
|
| 110 | + give_set_error('password_incorrect', esc_html__('The password you entered is incorrect.', 'give')); |
|
| 111 | 111 | } |
| 112 | 112 | } else { |
| 113 | - give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) ); |
|
| 113 | + give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give')); |
|
| 114 | 114 | } |
| 115 | 115 | // Check for errors and redirect if none present |
| 116 | 116 | $errors = give_get_errors(); |
| 117 | - if ( ! $errors ) { |
|
| 118 | - $redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID ); |
|
| 119 | - wp_redirect( $redirect ); |
|
| 117 | + if ( ! $errors) { |
|
| 118 | + $redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID); |
|
| 119 | + wp_redirect($redirect); |
|
| 120 | 120 | give_die(); |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -add_action( 'give_user_login', 'give_process_login_form' ); |
|
| 125 | +add_action('give_user_login', 'give_process_login_form'); |
|
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -134,18 +134,18 @@ discard block |
||
| 134 | 134 | * |
| 135 | 135 | * @return void |
| 136 | 136 | */ |
| 137 | -function give_process_user_logout( $data ) { |
|
| 138 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
| 137 | +function give_process_user_logout($data) { |
|
| 138 | + if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) { |
|
| 139 | 139 | |
| 140 | 140 | // Prevent occurring of any custom action on wp_logout. |
| 141 | - remove_all_actions( 'wp_logout' ); |
|
| 141 | + remove_all_actions('wp_logout'); |
|
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * Fires before processing user logout. |
| 145 | 145 | * |
| 146 | 146 | * @since 1.0 |
| 147 | 147 | */ |
| 148 | - do_action( 'give_before_user_logout' ); |
|
| 148 | + do_action('give_before_user_logout'); |
|
| 149 | 149 | |
| 150 | 150 | // Logout user. |
| 151 | 151 | wp_logout(); |
@@ -155,14 +155,14 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @since 1.0 |
| 157 | 157 | */ |
| 158 | - do_action( 'give_after_user_logout' ); |
|
| 158 | + do_action('give_after_user_logout'); |
|
| 159 | 159 | |
| 160 | - wp_redirect( $data['give_logout_redirect'] ); |
|
| 160 | + wp_redirect($data['give_logout_redirect']); |
|
| 161 | 161 | give_die(); |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | -add_action( 'give_user_logout', 'give_process_user_logout' ); |
|
| 165 | +add_action('give_user_logout', 'give_process_user_logout'); |
|
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * Log User In |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @return void |
| 177 | 177 | */ |
| 178 | -function give_log_user_in( $user_id, $user_login, $user_pass ) { |
|
| 179 | - if ( $user_id < 1 ) { |
|
| 178 | +function give_log_user_in($user_id, $user_login, $user_pass) { |
|
| 179 | + if ($user_id < 1) { |
|
| 180 | 180 | return; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - wp_set_auth_cookie( $user_id ); |
|
| 184 | - wp_set_current_user( $user_id, $user_login ); |
|
| 183 | + wp_set_auth_cookie($user_id); |
|
| 184 | + wp_set_current_user($user_id, $user_login); |
|
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | 187 | * Fires after the user has successfully logged in. |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param string $user_login Username. |
| 192 | 192 | * @param WP_User $$user WP_User object of the logged-in user. |
| 193 | 193 | */ |
| 194 | - do_action( 'wp_login', $user_login, get_userdata( $user_id ) ); |
|
| 194 | + do_action('wp_login', $user_login, get_userdata($user_id)); |
|
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * Fires after give user has successfully logged in. |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @param string $user_login Username. |
| 203 | 203 | * @param string $user_pass User password. |
| 204 | 204 | */ |
| 205 | - do_action( 'give_log_user_in', $user_id, $user_login, $user_pass ); |
|
| 205 | + do_action('give_log_user_in', $user_id, $user_login, $user_pass); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
@@ -215,13 +215,13 @@ discard block |
||
| 215 | 215 | * |
| 216 | 216 | * @return void |
| 217 | 217 | */ |
| 218 | -function give_process_register_form( $data ) { |
|
| 218 | +function give_process_register_form($data) { |
|
| 219 | 219 | |
| 220 | - if ( is_user_logged_in() ) { |
|
| 220 | + if (is_user_logged_in()) { |
|
| 221 | 221 | return; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if ( empty( $_POST['give_register_submit'] ) ) { |
|
| 224 | + if (empty($_POST['give_register_submit'])) { |
|
| 225 | 225 | return; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -230,38 +230,38 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @since 1.0 |
| 232 | 232 | */ |
| 233 | - do_action( 'give_pre_process_register_form' ); |
|
| 233 | + do_action('give_pre_process_register_form'); |
|
| 234 | 234 | |
| 235 | - if ( empty( $data['give_user_login'] ) ) { |
|
| 236 | - give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) ); |
|
| 235 | + if (empty($data['give_user_login'])) { |
|
| 236 | + give_set_error('empty_username', esc_html__('Invalid username.', 'give')); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - if ( username_exists( $data['give_user_login'] ) ) { |
|
| 240 | - give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) ); |
|
| 239 | + if (username_exists($data['give_user_login'])) { |
|
| 240 | + give_set_error('username_unavailable', esc_html__('Username already taken.', 'give')); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if ( ! validate_username( $data['give_user_login'] ) ) { |
|
| 244 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) ); |
|
| 243 | + if ( ! validate_username($data['give_user_login'])) { |
|
| 244 | + give_set_error('username_invalid', esc_html__('Invalid username.', 'give')); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - if ( email_exists( $data['give_user_email'] ) ) { |
|
| 248 | - give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) ); |
|
| 247 | + if (email_exists($data['give_user_email'])) { |
|
| 248 | + give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give')); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) { |
|
| 252 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
| 251 | + if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) { |
|
| 252 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) { |
|
| 256 | - give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) ); |
|
| 255 | + if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) { |
|
| 256 | + give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give')); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ( empty( $_POST['give_user_pass'] ) ) { |
|
| 260 | - give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) ); |
|
| 259 | + if (empty($_POST['give_user_pass'])) { |
|
| 260 | + give_set_error('empty_password', esc_html__('Please enter a password.', 'give')); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) { |
|
| 264 | - give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) ); |
|
| 263 | + if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) { |
|
| 264 | + give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give')); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -269,26 +269,26 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @since 1.0 |
| 271 | 271 | */ |
| 272 | - do_action( 'give_process_register_form' ); |
|
| 272 | + do_action('give_process_register_form'); |
|
| 273 | 273 | |
| 274 | 274 | // Check for errors and redirect if none present |
| 275 | 275 | $errors = give_get_errors(); |
| 276 | 276 | |
| 277 | - if ( empty( $errors ) ) { |
|
| 277 | + if (empty($errors)) { |
|
| 278 | 278 | |
| 279 | - $redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] ); |
|
| 279 | + $redirect = apply_filters('give_register_redirect', $data['give_redirect']); |
|
| 280 | 280 | |
| 281 | - give_register_and_login_new_user( array( |
|
| 281 | + give_register_and_login_new_user(array( |
|
| 282 | 282 | 'user_login' => $data['give_user_login'], |
| 283 | 283 | 'user_pass' => $data['give_user_pass'], |
| 284 | 284 | 'user_email' => $data['give_user_email'], |
| 285 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
| 286 | - 'role' => get_option( 'default_role' ) |
|
| 287 | - ) ); |
|
| 285 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
| 286 | + 'role' => get_option('default_role') |
|
| 287 | + )); |
|
| 288 | 288 | |
| 289 | - wp_redirect( $redirect ); |
|
| 289 | + wp_redirect($redirect); |
|
| 290 | 290 | give_die(); |
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | -add_action( 'give_user_register', 'give_process_register_form' ); |
|
| 295 | 294 | \ No newline at end of file |
| 295 | +add_action('give_user_register', 'give_process_register_form'); |
|
| 296 | 296 | \ 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 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @since 1.0 |
| 21 | 21 | * @return void |
| 22 | 22 | */ |
| 23 | -add_action( 'give_manual_cc_form', '__return_false' ); |
|
| 23 | +add_action('give_manual_cc_form', '__return_false'); |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Processes the purchase data and uses the Manual Payment gateway to record |
@@ -32,17 +32,17 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @return void |
| 34 | 34 | */ |
| 35 | -function give_manual_payment( $purchase_data ) { |
|
| 35 | +function give_manual_payment($purchase_data) { |
|
| 36 | 36 | |
| 37 | - if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) { |
|
| 38 | - wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 37 | + if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) { |
|
| 38 | + wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | //Create payment_data array |
| 42 | 42 | $payment_data = array( |
| 43 | 43 | 'price' => $purchase_data['price'], |
| 44 | 44 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
| 45 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
| 45 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
| 46 | 46 | 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
| 47 | 47 | 'date' => $purchase_data['date'], |
| 48 | 48 | 'user_email' => $purchase_data['user_email'], |
@@ -52,24 +52,24 @@ discard block |
||
| 52 | 52 | 'status' => 'pending' |
| 53 | 53 | ); |
| 54 | 54 | // Record the pending payment |
| 55 | - $payment = give_insert_payment( $payment_data ); |
|
| 55 | + $payment = give_insert_payment($payment_data); |
|
| 56 | 56 | |
| 57 | - if ( $payment ) { |
|
| 58 | - give_update_payment_status( $payment, 'publish' ); |
|
| 57 | + if ($payment) { |
|
| 58 | + give_update_payment_status($payment, 'publish'); |
|
| 59 | 59 | give_send_to_success_page(); |
| 60 | 60 | } else { |
| 61 | 61 | give_record_gateway_error( |
| 62 | - esc_html__( 'Payment Error', 'give' ), |
|
| 62 | + esc_html__('Payment Error', 'give'), |
|
| 63 | 63 | sprintf( |
| 64 | 64 | /* translators: %s: payment data */ |
| 65 | - esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ), |
|
| 66 | - json_encode( $payment_data ) |
|
| 65 | + esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'), |
|
| 66 | + json_encode($payment_data) |
|
| 67 | 67 | ), |
| 68 | 68 | $payment |
| 69 | 69 | ); |
| 70 | 70 | // If errors are present, send the user back to the purchase page so they can be corrected |
| 71 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
| 71 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -add_action( 'give_gateway_manual', 'give_manual_payment' ); |
|
| 75 | +add_action('give_gateway_manual', 'give_manual_payment'); |
|
@@ -10,13 +10,13 @@ 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 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string Column Name |
| 66 | 66 | */ |
| 67 | - public function column_default( $item, $column_name ) { |
|
| 68 | - switch ( $column_name ) { |
|
| 67 | + public function column_default($item, $column_name) { |
|
| 68 | + switch ($column_name) { |
|
| 69 | 69 | default: |
| 70 | - return $item[ $column_name ]; |
|
| 70 | + return $item[$column_name]; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function get_columns() { |
| 82 | 82 | $columns = array( |
| 83 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
| 84 | - 'complete_sales' => esc_attr__( 'Complete Transactions', 'give' ), |
|
| 85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Transactions', 'give' ), |
|
| 86 | - 'total_sales' => esc_attr__( 'Total Transactions', 'give' ), |
|
| 87 | - 'total_donations' => esc_attr__( 'Total Donations', 'give' ) |
|
| 83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
| 84 | + 'complete_sales' => esc_attr__('Complete Transactions', 'give'), |
|
| 85 | + 'pending_sales' => esc_attr__('Pending / Failed Transactions', 'give'), |
|
| 86 | + 'total_sales' => esc_attr__('Total Transactions', 'give'), |
|
| 87 | + 'total_donations' => esc_attr__('Total Donations', 'give') |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return int Current page number |
| 100 | 100 | */ |
| 101 | 101 | public function get_paged() { |
| 102 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 102 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @since 1.0 |
| 111 | 111 | * @return void |
| 112 | 112 | */ |
| 113 | - public function bulk_actions( $which = '' ) { |
|
| 113 | + public function bulk_actions($which = '') { |
|
| 114 | 114 | // These aren't really bulk actions but this outputs the markup in the right place |
| 115 | 115 | give_report_views(); |
| 116 | 116 | } |
@@ -123,23 +123,23 @@ discard block |
||
| 123 | 123 | * |
| 124 | 124 | * @param string $which |
| 125 | 125 | */ |
| 126 | - protected function display_tablenav( $which ) { |
|
| 126 | + protected function display_tablenav($which) { |
|
| 127 | 127 | |
| 128 | - if ( 'top' == $which ) { |
|
| 129 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 128 | + if ('top' == $which) { |
|
| 129 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 130 | 130 | } |
| 131 | 131 | ?> |
| 132 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 132 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 133 | 133 | |
| 134 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donation Methods Report', 'give' ); ?></span></h3> |
|
| 134 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donation Methods Report', 'give'); ?></span></h3> |
|
| 135 | 135 | |
| 136 | 136 | <div class="alignright tablenav-right"> |
| 137 | 137 | <div class="actions bulkactions"> |
| 138 | - <?php $this->bulk_actions( $which ); ?> |
|
| 138 | + <?php $this->bulk_actions($which); ?> |
|
| 139 | 139 | </div> |
| 140 | 140 | <?php |
| 141 | - $this->extra_tablenav( $which ); |
|
| 142 | - $this->pagination( $which ); |
|
| 141 | + $this->extra_tablenav($which); |
|
| 142 | + $this->pagination($which); |
|
| 143 | 143 | ?> |
| 144 | 144 | </div> |
| 145 | 145 | |
@@ -164,18 +164,18 @@ discard block |
||
| 164 | 164 | $gateways = give_get_payment_gateways(); |
| 165 | 165 | $stats = new Give_Payment_Stats(); |
| 166 | 166 | |
| 167 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
| 167 | + foreach ($gateways as $gateway_id => $gateway) { |
|
| 168 | 168 | |
| 169 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
| 170 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
| 169 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
| 170 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
| 171 | 171 | |
| 172 | 172 | $reports_data[] = array( |
| 173 | 173 | 'ID' => $gateway_id, |
| 174 | 174 | 'label' => $gateway['admin_label'], |
| 175 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
| 176 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
| 177 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ), |
|
| 178 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) ) |
|
| 175 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
| 176 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
| 177 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false), |
|
| 178 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id))) |
|
| 179 | 179 | ); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $columns = $this->get_columns(); |
| 198 | 198 | $hidden = array(); // No hidden columns |
| 199 | 199 | $sortable = $this->get_sortable_columns(); |
| 200 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 200 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 201 | 201 | $this->items = $this->reports_data(); |
| 202 | 202 | |
| 203 | 203 | } |
@@ -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,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | 25 | function give_logs_view_sales() { |
| 26 | - include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' ); |
|
| 26 | + include(dirname(__FILE__).'/class-sales-logs-list-table.php'); |
|
| 27 | 27 | |
| 28 | 28 | $logs_table = new Give_Sales_Log_Table(); |
| 29 | 29 | $logs_table->prepare_items(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
| 34 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | 45 | function give_logs_view_gateway_errors() { |
| 46 | - include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' ); |
|
| 46 | + include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php'); |
|
| 47 | 47 | |
| 48 | 48 | $logs_table = new Give_Gateway_Error_Log_Table(); |
| 49 | 49 | $logs_table->prepare_items(); |
| 50 | 50 | $logs_table->display(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
| 53 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * API Request Logs |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @return void |
| 63 | 63 | */ |
| 64 | 64 | function give_logs_view_api_requests() { |
| 65 | - include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' ); |
|
| 65 | + include(dirname(__FILE__).'/class-api-requests-logs-list-table.php'); |
|
| 66 | 66 | |
| 67 | 67 | $logs_table = new Give_API_Request_Log_Table(); |
| 68 | 68 | $logs_table->prepare_items(); |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @since 1.0 |
| 77 | 77 | */ |
| 78 | - do_action( 'give_logs_api_requests_top' ); |
|
| 78 | + do_action('give_logs_api_requests_top'); |
|
| 79 | 79 | ?> |
| 80 | 80 | |
| 81 | - <form id="give-logs-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs' ); ?>"> |
|
| 81 | + <form id="give-logs-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs'); ?>"> |
|
| 82 | 82 | <?php |
| 83 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
| 83 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
| 84 | 84 | $logs_table->display(); |
| 85 | 85 | ?> |
| 86 | 86 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @since 1.0 |
| 95 | 95 | */ |
| 96 | - do_action( 'give_logs_api_requests_bottom' ); |
|
| 96 | + do_action('give_logs_api_requests_bottom'); |
|
| 97 | 97 | ?> |
| 98 | 98 | |
| 99 | 99 | </div> |
| 100 | 100 | <?php |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
| 103 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | function give_log_default_views() { |
| 113 | 113 | $views = array( |
| 114 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
| 115 | - 'gateway_errors' => esc_html__( 'Payment Errors', 'give' ), |
|
| 116 | - 'api_requests' => esc_html__( 'API Requests', 'give' ) |
|
| 114 | + 'sales' => esc_html__('Donations', 'give'), |
|
| 115 | + 'gateway_errors' => esc_html__('Payment Errors', 'give'), |
|
| 116 | + 'api_requests' => esc_html__('API Requests', 'give') |
|
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | - $views = apply_filters( 'give_log_views', $views ); |
|
| 119 | + $views = apply_filters('give_log_views', $views); |
|
| 120 | 120 | |
| 121 | 121 | return $views; |
| 122 | 122 | } |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | function give_log_views() { |
| 131 | 131 | $views = give_log_default_views(); |
| 132 | - $current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales'; |
|
| 132 | + $current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales'; |
|
| 133 | 133 | ?> |
| 134 | 134 | <form id="give-logs-filter" method="get" action="edit.php"> |
| 135 | 135 | <select id="give-logs-view" name="view"> |
| 136 | 136 | <optgroup label="Log Type:"> |
| 137 | - <?php foreach ( $views as $view_id => $label ): ?> |
|
| 138 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 137 | + <?php foreach ($views as $view_id => $label): ?> |
|
| 138 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 139 | 139 | <?php endforeach; ?> |
| 140 | 140 | </optgroup> |
| 141 | 141 | </select> |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @since 1.0 |
| 150 | 150 | */ |
| 151 | - do_action( 'give_log_view_actions' ); |
|
| 151 | + do_action('give_log_view_actions'); |
|
| 152 | 152 | ?> |
| 153 | 153 | |
| 154 | 154 | <input type="hidden" name="post_type" value="give_forms"/> |
| 155 | 155 | <input type="hidden" name="page" value="give-reports"/> |
| 156 | 156 | <input type="hidden" name="tab" value="logs"/> |
| 157 | 157 | |
| 158 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 158 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
| 159 | 159 | </form> |
| 160 | 160 | <?php |
| 161 | 161 | } |
| 162 | 162 | \ No newline at end of file |