@@ -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 The email tag description. |
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 at least 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 | /** |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | $email_tags = give_get_email_tags(); |
212 | 212 | |
213 | 213 | ob_start(); |
214 | - if ( count( $email_tags ) > 0 ) : ?> |
|
214 | + if (count($email_tags) > 0) : ?> |
|
215 | 215 | <div class="give-email-tags-wrap"> |
216 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
216 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
217 | 217 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
218 | 218 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
219 | 219 | </span> |
@@ -235,13 +235,13 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return string Content with email tags filtered out. |
237 | 237 | */ |
238 | -function give_do_email_tags( $content, $payment_id ) { |
|
238 | +function give_do_email_tags($content, $payment_id) { |
|
239 | 239 | |
240 | 240 | // Replace all tags |
241 | - $content = Give()->email_tags->do_tags( $content, $payment_id ); |
|
241 | + $content = Give()->email_tags->do_tags($content, $payment_id); |
|
242 | 242 | |
243 | 243 | // Maintaining backwards compatibility |
244 | - $content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id ); |
|
244 | + $content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id); |
|
245 | 245 | |
246 | 246 | // Return content |
247 | 247 | return $content; |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | * @since 1.0 |
254 | 254 | */ |
255 | 255 | function give_load_email_tags() { |
256 | - do_action( 'give_add_email_tags' ); |
|
256 | + do_action('give_add_email_tags'); |
|
257 | 257 | } |
258 | 258 | |
259 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
259 | +add_action('init', 'give_load_email_tags', - 999); |
|
260 | 260 | |
261 | 261 | /** |
262 | 262 | * Add default Give email template tags. |
@@ -269,92 +269,92 @@ discard block |
||
269 | 269 | $email_tags = array( |
270 | 270 | array( |
271 | 271 | 'tag' => 'donation', |
272 | - 'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
272 | + 'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), |
|
273 | 273 | 'function' => 'give_email_tag_donation' |
274 | 274 | ), |
275 | 275 | array( |
276 | 276 | 'tag' => 'form_title', |
277 | - 'description' => esc_html__( 'The donation form name.', 'give' ), |
|
277 | + 'description' => esc_html__('The donation form name.', 'give'), |
|
278 | 278 | 'function' => 'give_email_tag_form_title' |
279 | 279 | ), |
280 | 280 | array( |
281 | 281 | 'tag' => 'amount', |
282 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
282 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
283 | 283 | 'function' => 'give_email_tag_amount' |
284 | 284 | ), |
285 | 285 | array( |
286 | 286 | 'tag' => 'price', |
287 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
287 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
288 | 288 | 'function' => 'give_email_tag_price' |
289 | 289 | ), |
290 | 290 | array( |
291 | 291 | 'tag' => 'name', |
292 | - 'description' => esc_html__( 'The donor\'s first name.', 'give' ), |
|
292 | + 'description' => esc_html__('The donor\'s first name.', 'give'), |
|
293 | 293 | 'function' => 'give_email_tag_first_name' |
294 | 294 | ), |
295 | 295 | array( |
296 | 296 | 'tag' => 'fullname', |
297 | - 'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), |
|
297 | + 'description' => esc_html__('The donor\'s full name, first and last.', 'give'), |
|
298 | 298 | 'function' => 'give_email_tag_fullname' |
299 | 299 | ), |
300 | 300 | array( |
301 | 301 | 'tag' => 'username', |
302 | - 'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
302 | + 'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
303 | 303 | 'function' => 'give_email_tag_username' |
304 | 304 | ), |
305 | 305 | array( |
306 | 306 | 'tag' => 'user_email', |
307 | - 'description' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
307 | + 'description' => esc_html__('The donor\'s email address.', 'give'), |
|
308 | 308 | 'function' => 'give_email_tag_user_email' |
309 | 309 | ), |
310 | 310 | array( |
311 | 311 | 'tag' => 'billing_address', |
312 | - 'description' => esc_html__( 'The donor\'s billing address.', 'give' ), |
|
312 | + 'description' => esc_html__('The donor\'s billing address.', 'give'), |
|
313 | 313 | 'function' => 'give_email_tag_billing_address' |
314 | 314 | ), |
315 | 315 | array( |
316 | 316 | 'tag' => 'date', |
317 | - 'description' => esc_html__( 'The date of the donation.', 'give' ), |
|
317 | + 'description' => esc_html__('The date of the donation.', 'give'), |
|
318 | 318 | 'function' => 'give_email_tag_date' |
319 | 319 | ), |
320 | 320 | array( |
321 | 321 | 'tag' => 'payment_id', |
322 | - 'description' => esc_html__( 'The unique ID number for this donation.', 'give' ), |
|
322 | + 'description' => esc_html__('The unique ID number for this donation.', 'give'), |
|
323 | 323 | 'function' => 'give_email_tag_payment_id' |
324 | 324 | ), |
325 | 325 | array( |
326 | 326 | 'tag' => 'receipt_id', |
327 | - 'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), |
|
327 | + 'description' => esc_html__('The unique ID number for this donation receipt.', 'give'), |
|
328 | 328 | 'function' => 'give_email_tag_receipt_id' |
329 | 329 | ), |
330 | 330 | array( |
331 | 331 | 'tag' => 'payment_method', |
332 | - 'description' => esc_html__( 'The method of payment used for this donation.', 'give' ), |
|
332 | + 'description' => esc_html__('The method of payment used for this donation.', 'give'), |
|
333 | 333 | 'function' => 'give_email_tag_payment_method' |
334 | 334 | ), |
335 | 335 | array( |
336 | 336 | 'tag' => 'sitename', |
337 | - 'description' => esc_html__( 'Your site name.', 'give' ), |
|
337 | + 'description' => esc_html__('Your site name.', 'give'), |
|
338 | 338 | 'function' => 'give_email_tag_sitename' |
339 | 339 | ), |
340 | 340 | array( |
341 | 341 | 'tag' => 'receipt_link', |
342 | - 'description' => esc_html__( 'Adds a link so users can view their receipt directly on your website if they are unable to view it in the browser correctly.', 'give' ), |
|
342 | + 'description' => esc_html__('Adds a link so users can view their receipt directly on your website if they are unable to view it in the browser correctly.', 'give'), |
|
343 | 343 | 'function' => 'give_email_tag_receipt_link' |
344 | 344 | ), |
345 | 345 | ); |
346 | 346 | |
347 | 347 | // Apply give_email_tags filter |
348 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
348 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
349 | 349 | |
350 | 350 | // Add email tags |
351 | - foreach ( $email_tags as $email_tag ) { |
|
352 | - give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] ); |
|
351 | + foreach ($email_tags as $email_tag) { |
|
352 | + give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | } |
356 | 356 | |
357 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
357 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
358 | 358 | |
359 | 359 | |
360 | 360 | /** |
@@ -366,15 +366,15 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @return string name |
368 | 368 | */ |
369 | -function give_email_tag_first_name( $payment_id ) { |
|
370 | - $payment = new Give_Payment( $payment_id ); |
|
369 | +function give_email_tag_first_name($payment_id) { |
|
370 | + $payment = new Give_Payment($payment_id); |
|
371 | 371 | $user_info = $payment->user_info; |
372 | 372 | |
373 | - if ( empty( $user_info ) ) { |
|
373 | + if (empty($user_info)) { |
|
374 | 374 | return ''; |
375 | 375 | } |
376 | 376 | |
377 | - $email_name = give_get_email_names( $user_info ); |
|
377 | + $email_name = give_get_email_names($user_info); |
|
378 | 378 | |
379 | 379 | return $email_name['name']; |
380 | 380 | } |
@@ -388,15 +388,15 @@ discard block |
||
388 | 388 | * |
389 | 389 | * @return string fullname |
390 | 390 | */ |
391 | -function give_email_tag_fullname( $payment_id ) { |
|
392 | - $payment = new Give_Payment( $payment_id ); |
|
391 | +function give_email_tag_fullname($payment_id) { |
|
392 | + $payment = new Give_Payment($payment_id); |
|
393 | 393 | $user_info = $payment->user_info; |
394 | 394 | |
395 | - if ( empty( $user_info ) ) { |
|
395 | + if (empty($user_info)) { |
|
396 | 396 | return ''; |
397 | 397 | } |
398 | 398 | |
399 | - $email_name = give_get_email_names( $user_info ); |
|
399 | + $email_name = give_get_email_names($user_info); |
|
400 | 400 | |
401 | 401 | return $email_name['fullname']; |
402 | 402 | } |
@@ -409,15 +409,15 @@ discard block |
||
409 | 409 | * |
410 | 410 | * @return string username. |
411 | 411 | */ |
412 | -function give_email_tag_username( $payment_id ) { |
|
413 | - $payment = new Give_Payment( $payment_id ); |
|
412 | +function give_email_tag_username($payment_id) { |
|
413 | + $payment = new Give_Payment($payment_id); |
|
414 | 414 | $user_info = $payment->user_info; |
415 | 415 | |
416 | - if ( empty( $user_info ) ) { |
|
416 | + if (empty($user_info)) { |
|
417 | 417 | return ''; |
418 | 418 | } |
419 | 419 | |
420 | - $email_name = give_get_email_names( $user_info ); |
|
420 | + $email_name = give_get_email_names($user_info); |
|
421 | 421 | |
422 | 422 | return $email_name['username']; |
423 | 423 | } |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @return string user_email |
432 | 432 | */ |
433 | -function give_email_tag_user_email( $payment_id ) { |
|
434 | - $payment = new Give_Payment( $payment_id ); |
|
433 | +function give_email_tag_user_email($payment_id) { |
|
434 | + $payment = new Give_Payment($payment_id); |
|
435 | 435 | |
436 | 436 | return $payment->email; |
437 | 437 | } |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | * |
445 | 445 | * @return string billing_address |
446 | 446 | */ |
447 | -function give_email_tag_billing_address( $payment_id ) { |
|
448 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
449 | - $user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( |
|
447 | +function give_email_tag_billing_address($payment_id) { |
|
448 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
449 | + $user_address = ! empty($user_info['address']) ? $user_info['address'] : array( |
|
450 | 450 | 'line1' => '', |
451 | 451 | 'line2' => '', |
452 | 452 | 'city' => '', |
@@ -455,11 +455,11 @@ discard block |
||
455 | 455 | 'zip' => '' |
456 | 456 | ); |
457 | 457 | |
458 | - $return = $user_address['line1'] . "\n"; |
|
459 | - if ( ! empty( $user_address['line2'] ) ) { |
|
460 | - $return .= $user_address['line2'] . "\n"; |
|
458 | + $return = $user_address['line1']."\n"; |
|
459 | + if ( ! empty($user_address['line2'])) { |
|
460 | + $return .= $user_address['line2']."\n"; |
|
461 | 461 | } |
462 | - $return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n"; |
|
462 | + $return .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n"; |
|
463 | 463 | $return .= $user_address['country']; |
464 | 464 | |
465 | 465 | return $return; |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | * |
474 | 474 | * @return string date |
475 | 475 | */ |
476 | -function give_email_tag_date( $payment_id ) { |
|
477 | - $payment = new Give_Payment( $payment_id ); |
|
476 | +function give_email_tag_date($payment_id) { |
|
477 | + $payment = new Give_Payment($payment_id); |
|
478 | 478 | |
479 | - return date_i18n( get_option( 'date_format' ), strtotime( $payment->date ) ); |
|
479 | + return date_i18n(get_option('date_format'), strtotime($payment->date)); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |
@@ -488,11 +488,11 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return string amount |
490 | 490 | */ |
491 | -function give_email_tag_amount( $payment_id ) { |
|
492 | - $payment = new Give_Payment( $payment_id ); |
|
493 | - $give_amount = give_currency_filter( give_format_amount( $payment->total ), $payment->currency ); |
|
491 | +function give_email_tag_amount($payment_id) { |
|
492 | + $payment = new Give_Payment($payment_id); |
|
493 | + $give_amount = give_currency_filter(give_format_amount($payment->total), $payment->currency); |
|
494 | 494 | |
495 | - return html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
495 | + return html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | /** |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | * |
505 | 505 | * @return string price |
506 | 506 | */ |
507 | -function give_email_tag_price( $payment_id ) { |
|
508 | - return give_email_tag_amount( $payment_id ); |
|
507 | +function give_email_tag_price($payment_id) { |
|
508 | + return give_email_tag_amount($payment_id); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | * |
518 | 518 | * @return int payment_id |
519 | 519 | */ |
520 | -function give_email_tag_payment_id( $payment_id ) { |
|
521 | - $payment = new Give_Payment( $payment_id ); |
|
520 | +function give_email_tag_payment_id($payment_id) { |
|
521 | + $payment = new Give_Payment($payment_id); |
|
522 | 522 | |
523 | 523 | return $payment->number; |
524 | 524 | } |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | * |
532 | 532 | * @return string receipt_id |
533 | 533 | */ |
534 | -function give_email_tag_receipt_id( $payment_id ) { |
|
535 | - $payment = new Give_Payment( $payment_id ); |
|
534 | +function give_email_tag_receipt_id($payment_id) { |
|
535 | + $payment = new Give_Payment($payment_id); |
|
536 | 536 | |
537 | 537 | return $payment->key; |
538 | 538 | } |
@@ -546,14 +546,14 @@ discard block |
||
546 | 546 | * |
547 | 547 | * @return string $form_title |
548 | 548 | */ |
549 | -function give_email_tag_donation( $payment_id ) { |
|
550 | - $payment = new Give_Payment( $payment_id ); |
|
549 | +function give_email_tag_donation($payment_id) { |
|
550 | + $payment = new Give_Payment($payment_id); |
|
551 | 551 | $payment_meta = $payment->payment_meta; |
552 | - $level_title = give_has_variable_prices( $payment_meta['form_id'] ); |
|
552 | + $level_title = give_has_variable_prices($payment_meta['form_id']); |
|
553 | 553 | $separator = $level_title ? '-' : ''; |
554 | - $form_title = strip_tags( give_get_payment_form_title( $payment_meta, false, $separator ) ); |
|
554 | + $form_title = strip_tags(give_get_payment_form_title($payment_meta, false, $separator)); |
|
555 | 555 | |
556 | - return ! empty( $form_title ) ? $form_title : esc_html__( 'There was an error retrieving the donation form name.', 'give' ); |
|
556 | + return ! empty($form_title) ? $form_title : esc_html__('There was an error retrieving the donation form name.', 'give'); |
|
557 | 557 | |
558 | 558 | } |
559 | 559 | |
@@ -566,11 +566,11 @@ discard block |
||
566 | 566 | * |
567 | 567 | * @return string $form_title |
568 | 568 | */ |
569 | -function give_email_tag_form_title( $payment_id ) { |
|
570 | - $payment = new Give_Payment( $payment_id ); |
|
569 | +function give_email_tag_form_title($payment_id) { |
|
570 | + $payment = new Give_Payment($payment_id); |
|
571 | 571 | $payment_meta = $payment->payment_meta; |
572 | 572 | |
573 | - return isset( $payment_meta['form_title'] ) ? strip_tags( $payment_meta['form_title'] ) : esc_html__( 'There was an error retrieving the donation form name.', 'give' ); |
|
573 | + return isset($payment_meta['form_title']) ? strip_tags($payment_meta['form_title']) : esc_html__('There was an error retrieving the donation form name.', 'give'); |
|
574 | 574 | |
575 | 575 | } |
576 | 576 | |
@@ -583,10 +583,10 @@ discard block |
||
583 | 583 | * |
584 | 584 | * @return string gateway |
585 | 585 | */ |
586 | -function give_email_tag_payment_method( $payment_id ) { |
|
587 | - $payment = new Give_Payment( $payment_id ); |
|
586 | +function give_email_tag_payment_method($payment_id) { |
|
587 | + $payment = new Give_Payment($payment_id); |
|
588 | 588 | |
589 | - return give_get_gateway_checkout_label( $payment->gateway ); |
|
589 | + return give_get_gateway_checkout_label($payment->gateway); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | /** |
@@ -598,8 +598,8 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @return string sitename |
600 | 600 | */ |
601 | -function give_email_tag_sitename( $payment_id ) { |
|
602 | - return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
601 | +function give_email_tag_sitename($payment_id) { |
|
602 | + return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | /** |
@@ -611,19 +611,19 @@ discard block |
||
611 | 611 | * |
612 | 612 | * @return string receipt_link |
613 | 613 | */ |
614 | -function give_email_tag_receipt_link( $payment_id ) { |
|
614 | +function give_email_tag_receipt_link($payment_id) { |
|
615 | 615 | |
616 | - $receipt_url = esc_url( add_query_arg( array( |
|
617 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
616 | + $receipt_url = esc_url(add_query_arg(array( |
|
617 | + 'payment_key' => give_get_payment_key($payment_id), |
|
618 | 618 | 'give_action' => 'view_receipt' |
619 | - ), home_url() ) ); |
|
620 | - $formatted = sprintf( |
|
619 | + ), home_url())); |
|
620 | + $formatted = sprintf( |
|
621 | 621 | '<a href="%1$s">%2$s</a>', |
622 | 622 | $receipt_url, |
623 | - esc_html__( 'View it in your browser', 'give' ) |
|
623 | + esc_html__('View it in your browser', 'give') |
|
624 | 624 | ); |
625 | 625 | |
626 | - if ( give_get_option( 'email_template' ) !== 'none' ) { |
|
626 | + if (give_get_option('email_template') !== 'none') { |
|
627 | 627 | return $formatted; |
628 | 628 | } else { |
629 | 629 | return $receipt_url; |
@@ -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.6.4' ); |
|
262 | + if ( ! defined('GIVE_VERSION')) { |
|
263 | + define('GIVE_VERSION', '1.6.4'); |
|
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,111 +300,111 @@ 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-functions.php'; |
|
342 | - |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
348 | - |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
354 | - |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
356 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
358 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
360 | - |
|
361 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
362 | - |
|
363 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
364 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
365 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
366 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
367 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
368 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
369 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
370 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
371 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
374 | - |
|
375 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
377 | - |
|
378 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
379 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
380 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
383 | - |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
391 | - |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
393 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
396 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
401 | - |
|
402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.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-functions.php'; |
|
342 | + |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
348 | + |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
354 | + |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
356 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
358 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
360 | + |
|
361 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
362 | + |
|
363 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
365 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
366 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
368 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
369 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
370 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
374 | + |
|
375 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
377 | + |
|
378 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
379 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
380 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
383 | + |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
391 | + |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
393 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
396 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
401 | + |
|
402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
404 | 404 | |
405 | 405 | } |
406 | 406 | |
407 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | |
@@ -418,26 +418,26 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function load_textdomain() { |
420 | 420 | // Set filter for Give's languages directory |
421 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
422 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
421 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
422 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
423 | 423 | |
424 | 424 | // Traditional WordPress plugin locale filter |
425 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
426 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
425 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
426 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
427 | 427 | |
428 | 428 | // Setup paths to current locale file |
429 | - $mofile_local = $give_lang_dir . $mofile; |
|
430 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
429 | + $mofile_local = $give_lang_dir.$mofile; |
|
430 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
431 | 431 | |
432 | - if ( file_exists( $mofile_global ) ) { |
|
432 | + if (file_exists($mofile_global)) { |
|
433 | 433 | // Look in global /wp-content/languages/give folder |
434 | - load_textdomain( 'give', $mofile_global ); |
|
435 | - } elseif ( file_exists( $mofile_local ) ) { |
|
434 | + load_textdomain('give', $mofile_global); |
|
435 | + } elseif (file_exists($mofile_local)) { |
|
436 | 436 | // Look in local location from filter `give_languages_directory` |
437 | - load_textdomain( 'give', $mofile_local ); |
|
437 | + load_textdomain('give', $mofile_local); |
|
438 | 438 | } else { |
439 | 439 | // Load the default language files packaged up w/ Give |
440 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
440 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,56 +40,56 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | |
45 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
46 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
47 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
45 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
46 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
47 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
48 | 48 | $offline_instructions = $global_offline_instruction; |
49 | 49 | |
50 | - if ( $post_offline_customization_option == 'yes' ) { |
|
50 | + if ($post_offline_customization_option == 'yes') { |
|
51 | 51 | $offline_instructions = $post_offline_instructions; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | ob_start(); ?> |
56 | - <?php do_action( 'give_before_offline_info_fields', $form_id ); ?> |
|
56 | + <?php do_action('give_before_offline_info_fields', $form_id); ?> |
|
57 | 57 | <fieldset id="give_offline_payment_info"> |
58 | 58 | <?php |
59 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
59 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
60 | 60 | /* translators: %s: form settings url */ |
61 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
62 | - echo wpautop( stripslashes( $offline_instructions ) ); |
|
61 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
62 | + echo wpautop(stripslashes($offline_instructions)); |
|
63 | 63 | ?> |
64 | 64 | </fieldset> |
65 | - <?php do_action( 'give_after_offline_info_fields', $form_id ); ?> |
|
65 | + <?php do_action('give_after_offline_info_fields', $form_id); ?> |
|
66 | 66 | <?php |
67 | 67 | echo ob_get_clean(); |
68 | 68 | } |
69 | 69 | |
70 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
70 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Give Offline Billing Field |
74 | 74 | * |
75 | 75 | * @param $form_id |
76 | 76 | */ |
77 | -function give_offline_billing_fields( $form_id ) { |
|
77 | +function give_offline_billing_fields($form_id) { |
|
78 | 78 | //Enable Default CC fields (billing info) |
79 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
80 | - $post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
79 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
80 | + $post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
81 | 81 | |
82 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
82 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
83 | 83 | |
84 | 84 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
85 | - if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) { |
|
86 | - give_default_cc_address_fields( $form_id ); |
|
87 | - } elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
88 | - give_default_cc_address_fields( $form_id ); |
|
85 | + if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') { |
|
86 | + give_default_cc_address_fields($form_id); |
|
87 | + } elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
88 | + give_default_cc_address_fields($form_id); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
92 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Process the payment |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return void |
102 | 102 | */ |
103 | -function give_offline_process_payment( $purchase_data ) { |
|
103 | +function give_offline_process_payment($purchase_data) { |
|
104 | 104 | |
105 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
105 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
106 | 106 | |
107 | 107 | // setup the payment details |
108 | 108 | $payment_data = array( |
109 | 109 | 'price' => $purchase_data['price'], |
110 | 110 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
111 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
112 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
111 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
112 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
113 | 113 | 'date' => $purchase_data['date'], |
114 | 114 | 'user_email' => $purchase_data['user_email'], |
115 | 115 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | // record the pending payment |
124 | - $payment = give_insert_payment( $payment_data ); |
|
124 | + $payment = give_insert_payment($payment_data); |
|
125 | 125 | |
126 | - if ( $payment ) { |
|
127 | - give_offline_send_admin_notice( $payment ); |
|
128 | - give_offline_send_donor_instructions( $payment ); |
|
126 | + if ($payment) { |
|
127 | + give_offline_send_admin_notice($payment); |
|
128 | + give_offline_send_donor_instructions($payment); |
|
129 | 129 | give_send_to_success_page(); |
130 | 130 | } else { |
131 | 131 | // if errors are present, send the user back to the donation form so they can be corrected |
132 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
132 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
137 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | /** |
@@ -147,47 +147,47 @@ discard block |
||
147 | 147 | * @since 1.0 |
148 | 148 | * @return void |
149 | 149 | */ |
150 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
150 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
151 | 151 | |
152 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
153 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
152 | + $payment_data = give_get_payment_meta($payment_id); |
|
153 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
154 | 154 | |
155 | 155 | //Customize email content depending on whether the single form has been customized |
156 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
156 | + $email_content = give_get_option('global_offline_donation_email'); |
|
157 | 157 | |
158 | - if ( $post_offline_customization_option === 'yes' ) { |
|
159 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
158 | + if ($post_offline_customization_option === 'yes') { |
|
159 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
160 | 160 | } |
161 | 161 | |
162 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
163 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
162 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
163 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
164 | 164 | |
165 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
166 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
165 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
166 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
167 | 167 | |
168 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
168 | + $to_email = give_get_payment_user_email($payment_id); |
|
169 | 169 | |
170 | - $subject = give_get_option( 'offline_donation_subject', esc_html__( 'Offline Donation Instructions', 'give' ) ); |
|
171 | - if ( $post_offline_customization_option === 'yes' ) { |
|
172 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
170 | + $subject = give_get_option('offline_donation_subject', esc_html__('Offline Donation Instructions', 'give')); |
|
171 | + if ($post_offline_customization_option === 'yes') { |
|
172 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
173 | 173 | } |
174 | 174 | |
175 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
176 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
175 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
176 | + $subject = give_do_email_tags($subject, $payment_id); |
|
177 | 177 | |
178 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
179 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
178 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
179 | + $message = give_do_email_tags($email_content, $payment_id); |
|
180 | 180 | |
181 | 181 | $emails = Give()->emails; |
182 | 182 | |
183 | - $emails->__set( 'from_name', $from_name ); |
|
184 | - $emails->__set( 'from_email', $from_email ); |
|
185 | - $emails->__set( 'heading', esc_html__( 'Offline Donation Instructions', 'give' ) ); |
|
183 | + $emails->__set('from_name', $from_name); |
|
184 | + $emails->__set('from_email', $from_email); |
|
185 | + $emails->__set('heading', esc_html__('Offline Donation Instructions', 'give')); |
|
186 | 186 | |
187 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
188 | - $emails->__set( 'headers', $headers ); |
|
187 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
188 | + $emails->__set('headers', $headers); |
|
189 | 189 | |
190 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
190 | + $emails->send($to_email, $subject, $message, $attachments); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 | |
@@ -204,52 +204,52 @@ discard block |
||
204 | 204 | * @return void |
205 | 205 | * |
206 | 206 | */ |
207 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
207 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
208 | 208 | |
209 | 209 | /* Send an email notification to the admin */ |
210 | 210 | $admin_email = give_get_admin_notice_emails(); |
211 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
211 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
212 | 212 | |
213 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
214 | - $user_data = get_userdata( $user_info['id'] ); |
|
213 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
214 | + $user_data = get_userdata($user_info['id']); |
|
215 | 215 | $name = $user_data->display_name; |
216 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
217 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
216 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
217 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
218 | 218 | } else { |
219 | 219 | $name = $user_info['email']; |
220 | 220 | } |
221 | 221 | |
222 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
222 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
223 | 223 | |
224 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id ); |
|
224 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id); |
|
225 | 225 | |
226 | - $admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n"; |
|
227 | - $admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' '; |
|
228 | - $admin_message .= esc_attr__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
226 | + $admin_message = esc_attr__('Dear Admin,', 'give')."\n\n"; |
|
227 | + $admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' '; |
|
228 | + $admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
229 | 229 | |
230 | 230 | |
231 | - $admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . '{fullname}' . "\n"; |
|
232 | - $admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . '{amount}' . "\n\n"; |
|
231 | + $admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.'{fullname}'."\n"; |
|
232 | + $admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.'{amount}'."\n\n"; |
|
233 | 233 | |
234 | 234 | $admin_message .= sprintf( |
235 | 235 | '<a href="%1$s">%2$s</a>', |
236 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
237 | - esc_html__( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
238 | - ) . "\n\n"; |
|
236 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
237 | + esc_html__('Click Here to View and/or Update Donation Details', 'give') |
|
238 | + )."\n\n"; |
|
239 | 239 | |
240 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
241 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
240 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
241 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
242 | 242 | |
243 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
244 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
243 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
244 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
245 | 245 | |
246 | 246 | //Send Email |
247 | 247 | $emails = Give()->emails; |
248 | - if ( ! empty( $admin_headers ) ) { |
|
249 | - $emails->__set( 'headers', $admin_headers ); |
|
248 | + if ( ! empty($admin_headers)) { |
|
249 | + $emails->__set('headers', $admin_headers); |
|
250 | 250 | } |
251 | 251 | |
252 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
252 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
253 | 253 | |
254 | 254 | } |
255 | 255 | |
@@ -260,15 +260,15 @@ discard block |
||
260 | 260 | * @since 1.0 |
261 | 261 | * @return array |
262 | 262 | */ |
263 | -function give_offline_add_settings( $settings ) { |
|
263 | +function give_offline_add_settings($settings) { |
|
264 | 264 | |
265 | 265 | //Vars |
266 | 266 | $prefix = '_give_'; |
267 | 267 | |
268 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
268 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
269 | 269 | |
270 | 270 | //this gateway isn't active |
271 | - if ( ! $is_gateway_active ) { |
|
271 | + if ( ! $is_gateway_active) { |
|
272 | 272 | //return settings and bounce |
273 | 273 | return $settings; |
274 | 274 | } |
@@ -277,27 +277,27 @@ discard block |
||
277 | 277 | $check_settings = array( |
278 | 278 | |
279 | 279 | array( |
280 | - 'name' => esc_attr__( 'Customize Offline Donations', 'give' ), |
|
281 | - 'desc' => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ), |
|
282 | - 'id' => $prefix . 'customize_offline_donations', |
|
280 | + 'name' => esc_attr__('Customize Offline Donations', 'give'), |
|
281 | + 'desc' => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'), |
|
282 | + 'id' => $prefix.'customize_offline_donations', |
|
283 | 283 | 'type' => 'radio_inline', |
284 | 284 | 'default' => 'no', |
285 | 285 | 'options' => array( |
286 | - 'yes' => esc_attr__( 'Yes', 'give' ), |
|
287 | - 'no' => esc_attr__( 'No', 'give' ), |
|
286 | + 'yes' => esc_attr__('Yes', 'give'), |
|
287 | + 'no' => esc_attr__('No', 'give'), |
|
288 | 288 | ), |
289 | 289 | ), |
290 | 290 | array( |
291 | - 'name' => esc_attr__( 'Request Billing Information', 'give' ), |
|
292 | - 'desc' => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
293 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
291 | + 'name' => esc_attr__('Request Billing Information', 'give'), |
|
292 | + 'desc' => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
293 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
294 | 294 | 'row_classes' => 'give-subfield', |
295 | 295 | 'type' => 'checkbox' |
296 | 296 | ), |
297 | 297 | array( |
298 | - 'id' => $prefix . 'offline_checkout_notes', |
|
299 | - 'name' => esc_attr__( 'Offline Donation Instructions', 'give' ), |
|
300 | - 'desc' => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
298 | + 'id' => $prefix.'offline_checkout_notes', |
|
299 | + 'name' => esc_attr__('Offline Donation Instructions', 'give'), |
|
300 | + 'desc' => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
301 | 301 | 'default' => give_get_default_offline_donation_content(), |
302 | 302 | 'type' => 'wysiwyg', |
303 | 303 | 'row_classes' => 'give-subfield', |
@@ -306,17 +306,17 @@ discard block |
||
306 | 306 | ) |
307 | 307 | ), |
308 | 308 | array( |
309 | - 'id' => $prefix . 'offline_donation_subject', |
|
310 | - 'name' => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
311 | - 'desc' => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
312 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
309 | + 'id' => $prefix.'offline_donation_subject', |
|
310 | + 'name' => esc_attr__('Offline Donation Email Instructions Subject', 'give'), |
|
311 | + 'desc' => esc_attr__('Enter the subject line for the donation receipt email.', 'give'), |
|
312 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
313 | 313 | 'row_classes' => 'give-subfield', |
314 | 314 | 'type' => 'text' |
315 | 315 | ), |
316 | 316 | array( |
317 | - 'id' => $prefix . 'offline_donation_email', |
|
318 | - 'name' => esc_attr__( 'Offline Donation Email Instructions', 'give' ), |
|
319 | - 'desc' => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
317 | + 'id' => $prefix.'offline_donation_email', |
|
318 | + 'name' => esc_attr__('Offline Donation Email Instructions', 'give'), |
|
319 | + 'desc' => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
320 | 320 | 'default' => give_get_default_offline_donation_email_content(), |
321 | 321 | 'type' => 'wysiwyg', |
322 | 322 | 'row_classes' => 'give-subfield', |
@@ -326,10 +326,10 @@ discard block |
||
326 | 326 | ) |
327 | 327 | ); |
328 | 328 | |
329 | - return array_merge( $settings, $check_settings ); |
|
329 | + return array_merge($settings, $check_settings); |
|
330 | 330 | } |
331 | 331 | |
332 | -add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' ); |
|
332 | +add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings'); |
|
333 | 333 | |
334 | 334 | |
335 | 335 | /** |
@@ -341,32 +341,32 @@ discard block |
||
341 | 341 | */ |
342 | 342 | function give_get_default_offline_donation_content() { |
343 | 343 | |
344 | - $sitename = get_bloginfo( 'sitename' ); |
|
344 | + $sitename = get_bloginfo('sitename'); |
|
345 | 345 | |
346 | - $default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
346 | + $default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
347 | 347 | $default_text .= '<ol>'; |
348 | 348 | $default_text .= '<li>'; |
349 | 349 | $default_text .= sprintf( |
350 | 350 | /* translators: %s: site name */ |
351 | - esc_html__( 'Make a check payable to "%s"', 'give' ), |
|
351 | + esc_html__('Make a check payable to "%s"', 'give'), |
|
352 | 352 | $sitename |
353 | 353 | ); |
354 | 354 | $default_text .= '</li>'; |
355 | 355 | $default_text .= '<li>'; |
356 | 356 | $default_text .= sprintf( |
357 | 357 | /* translators: %s: site name */ |
358 | - esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
358 | + esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
359 | 359 | $sitename |
360 | 360 | ); |
361 | 361 | $default_text .= '</li>'; |
362 | - $default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>'; |
|
362 | + $default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>'; |
|
363 | 363 | $default_text .= '</ol>'; |
364 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
364 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
365 | 365 | $default_text .= ' <em>123 G Street </em><br>'; |
366 | 366 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
367 | - $default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
367 | + $default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
368 | 368 | |
369 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
369 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
370 | 370 | |
371 | 371 | } |
372 | 372 | |
@@ -379,33 +379,33 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function give_get_default_offline_donation_email_content() { |
381 | 381 | |
382 | - $sitename = get_bloginfo( 'sitename' ); |
|
383 | - $default_text = '<p>' . esc_html__( 'Dear {name},', 'give' ) . '</p>'; |
|
384 | - $default_text .= '<p>' . esc_html__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
382 | + $sitename = get_bloginfo('sitename'); |
|
383 | + $default_text = '<p>'.esc_html__('Dear {name},', 'give').'</p>'; |
|
384 | + $default_text .= '<p>'.esc_html__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
385 | 385 | $default_text .= '<ol>'; |
386 | 386 | $default_text .= '<li>'; |
387 | 387 | $default_text .= sprintf( |
388 | 388 | /* translators: %s: site name */ |
389 | - esc_html__( 'Make a check payable to "%s"', 'give' ), |
|
389 | + esc_html__('Make a check payable to "%s"', 'give'), |
|
390 | 390 | $sitename |
391 | 391 | ); |
392 | 392 | $default_text .= '</li>'; |
393 | 393 | $default_text .= '<li>'; |
394 | 394 | $default_text .= sprintf( |
395 | 395 | /* translators: %s: site name */ |
396 | - esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
396 | + esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
397 | 397 | $sitename |
398 | 398 | ); |
399 | 399 | $default_text .= '</li>'; |
400 | - $default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>'; |
|
400 | + $default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>'; |
|
401 | 401 | $default_text .= '</ol>'; |
402 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
402 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
403 | 403 | $default_text .= ' <em>123 G Street </em><br>'; |
404 | 404 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
405 | - $default_text .= '<p>' . esc_html__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
406 | - $default_text .= '<p>' . esc_html__( 'Sincerely,', 'give' ) . '</p>'; |
|
407 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
405 | + $default_text .= '<p>'.esc_html__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
406 | + $default_text .= '<p>'.esc_html__('Sincerely,', 'give').'</p>'; |
|
407 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
408 | 408 | |
409 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
409 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
410 | 410 | |
411 | 411 | } |
@@ -41,26 +41,26 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function __construct() { |
43 | 43 | |
44 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
44 | + add_action('admin_init', array($this, 'init')); |
|
45 | 45 | |
46 | 46 | //Customize CMB2 URL |
47 | - add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) ); |
|
47 | + add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url')); |
|
48 | 48 | |
49 | 49 | //Custom CMB2 Settings Fields |
50 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
51 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
52 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
54 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
55 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
56 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
57 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
58 | - add_action( 'admin_notices', array( $this, 'settings_notices' ) ); |
|
50 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
51 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
52 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
53 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
54 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
55 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
56 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
57 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
58 | + add_action('admin_notices', array($this, 'settings_notices')); |
|
59 | 59 | |
60 | 60 | // Include CMB CSS in the head to avoid FOUC |
61 | - add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) ); |
|
61 | + add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css')); |
|
62 | 62 | |
63 | - add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 ); |
|
63 | + add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @since 1.0 |
72 | 72 | */ |
73 | 73 | public function init() { |
74 | - register_setting( $this->key, $this->key ); |
|
74 | + register_setting($this->key, $this->key); |
|
75 | 75 | |
76 | 76 | } |
77 | 77 | |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return mixed |
87 | 87 | */ |
88 | - public function give_update_cmb_meta_box_url( $url ) { |
|
88 | + public function give_update_cmb_meta_box_url($url) { |
|
89 | 89 | //Path to Give's CMB |
90 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
90 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function give_get_settings_tabs() { |
101 | 101 | |
102 | - $settings = $this->give_settings( null ); |
|
102 | + $settings = $this->give_settings(null); |
|
103 | 103 | |
104 | 104 | $tabs = array(); |
105 | - $tabs['general'] = esc_html__( 'General', 'give' ); |
|
106 | - $tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' ); |
|
107 | - $tabs['display'] = esc_html__( 'Display Options', 'give' ); |
|
108 | - $tabs['emails'] = esc_html__( 'Emails', 'give' ); |
|
105 | + $tabs['general'] = esc_html__('General', 'give'); |
|
106 | + $tabs['gateways'] = esc_html__('Payment Gateways', 'give'); |
|
107 | + $tabs['display'] = esc_html__('Display Options', 'give'); |
|
108 | + $tabs['emails'] = esc_html__('Emails', 'give'); |
|
109 | 109 | |
110 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
111 | - $tabs['addons'] = esc_html__( 'Add-ons', 'give' ); |
|
110 | + if ( ! empty($settings['addons']['fields'])) { |
|
111 | + $tabs['addons'] = esc_html__('Add-ons', 'give'); |
|
112 | 112 | } |
113 | 113 | |
114 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
115 | - $tabs['licenses'] = esc_html__( 'Licenses', 'give' ); |
|
114 | + if ( ! empty($settings['licenses']['fields'])) { |
|
115 | + $tabs['licenses'] = esc_html__('Licenses', 'give'); |
|
116 | 116 | } |
117 | 117 | |
118 | - $tabs['advanced'] = esc_html__( 'Advanced', 'give' ); |
|
119 | - $tabs['api'] = esc_html__( 'API', 'give' ); |
|
120 | - $tabs['system_info'] = esc_html__( 'System Info', 'give' ); |
|
118 | + $tabs['advanced'] = esc_html__('Advanced', 'give'); |
|
119 | + $tabs['api'] = esc_html__('API', 'give'); |
|
120 | + $tabs['system_info'] = esc_html__('System Info', 'give'); |
|
121 | 121 | |
122 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
122 | + return apply_filters('give_settings_tabs', $tabs); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -129,32 +129,32 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function admin_page_display() { |
131 | 131 | |
132 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
132 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
133 | 133 | |
134 | 134 | ?> |
135 | 135 | |
136 | 136 | <div class="wrap give_settings_page cmb2_options_page <?php echo $this->key; ?>"> |
137 | 137 | |
138 | - <h1 class="screen-reader-text"><?php esc_html_e( 'Give Settings', 'give' ); ?></h1> |
|
138 | + <h1 class="screen-reader-text"><?php esc_html_e('Give Settings', 'give'); ?></h1> |
|
139 | 139 | |
140 | 140 | <h2 class="nav-tab-wrapper"> |
141 | 141 | <?php |
142 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
142 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
143 | 143 | |
144 | - $tab_url = esc_url( add_query_arg( array( |
|
144 | + $tab_url = esc_url(add_query_arg(array( |
|
145 | 145 | 'settings-updated' => false, |
146 | 146 | 'tab' => $tab_id |
147 | - ) ) ); |
|
147 | + ))); |
|
148 | 148 | |
149 | 149 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
150 | 150 | |
151 | - echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>'; |
|
151 | + echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr($tab_name).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>'; |
|
152 | 152 | |
153 | 153 | } |
154 | 154 | ?> |
155 | 155 | </h2> |
156 | 156 | |
157 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
157 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
158 | 158 | |
159 | 159 | </div><!-- .wrap --> |
160 | 160 | |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return string |
178 | 178 | */ |
179 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
179 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
180 | 180 | |
181 | 181 | //only modify the give settings form |
182 | - if ( 'give_settings' == $object_id ) { |
|
182 | + if ('give_settings' == $object_id) { |
|
183 | 183 | |
184 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
184 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
185 | 185 | |
186 | 186 | } |
187 | 187 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @return array |
200 | 200 | */ |
201 | - public function give_settings( $active_tab ) { |
|
201 | + public function give_settings($active_tab) { |
|
202 | 202 | |
203 | 203 | $give_settings = array( |
204 | 204 | /** |
@@ -206,99 +206,99 @@ discard block |
||
206 | 206 | */ |
207 | 207 | 'general' => array( |
208 | 208 | 'id' => 'general_settings', |
209 | - 'give_title' => esc_html__( 'General Settings', 'give' ), |
|
210 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
211 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
209 | + 'give_title' => esc_html__('General Settings', 'give'), |
|
210 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
211 | + 'fields' => apply_filters('give_settings_general', array( |
|
212 | 212 | array( |
213 | - 'name' => esc_html__( 'General Settings', 'give' ), |
|
213 | + 'name' => esc_html__('General Settings', 'give'), |
|
214 | 214 | 'desc' => '', |
215 | 215 | 'type' => 'give_title', |
216 | 216 | 'id' => 'give_title_general_settings_1' |
217 | 217 | ), |
218 | 218 | array( |
219 | - 'name' => esc_html__( 'Success Page', 'give' ), |
|
219 | + 'name' => esc_html__('Success Page', 'give'), |
|
220 | 220 | /* translators: %s: [give_receipt] */ |
221 | - 'desc' => sprintf( __( 'This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
221 | + 'desc' => sprintf(__('This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
222 | 222 | 'id' => 'success_page', |
223 | 223 | 'type' => 'select', |
224 | - 'options' => give_cmb2_get_post_options( array( |
|
224 | + 'options' => give_cmb2_get_post_options(array( |
|
225 | 225 | 'post_type' => 'page', |
226 | - 'numberposts' => - 1 |
|
227 | - ) ), |
|
226 | + 'numberposts' => -1 |
|
227 | + )), |
|
228 | 228 | ), |
229 | 229 | array( |
230 | - 'name' => esc_html__( 'Failed Transaction Page', 'give' ), |
|
231 | - 'desc' => esc_html__( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ), |
|
230 | + 'name' => esc_html__('Failed Transaction Page', 'give'), |
|
231 | + 'desc' => esc_html__('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'), |
|
232 | 232 | 'id' => 'failure_page', |
233 | 233 | 'type' => 'select', |
234 | - 'options' => give_cmb2_get_post_options( array( |
|
234 | + 'options' => give_cmb2_get_post_options(array( |
|
235 | 235 | 'post_type' => 'page', |
236 | - 'numberposts' => - 1 |
|
237 | - ) ), |
|
236 | + 'numberposts' => -1 |
|
237 | + )), |
|
238 | 238 | ), |
239 | 239 | array( |
240 | - 'name' => esc_html__( 'Donation History Page', 'give' ), |
|
240 | + 'name' => esc_html__('Donation History Page', 'give'), |
|
241 | 241 | /* translators: %s: [donation_history] */ |
242 | - 'desc' => sprintf( __( 'This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
242 | + 'desc' => sprintf(__('This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
243 | 243 | 'id' => 'history_page', |
244 | 244 | 'type' => 'select', |
245 | - 'options' => give_cmb2_get_post_options( array( |
|
245 | + 'options' => give_cmb2_get_post_options(array( |
|
246 | 246 | 'post_type' => 'page', |
247 | - 'numberposts' => - 1 |
|
248 | - ) ), |
|
247 | + 'numberposts' => -1 |
|
248 | + )), |
|
249 | 249 | ), |
250 | 250 | array( |
251 | - 'name' => esc_html__( 'Base Country', 'give' ), |
|
252 | - 'desc' => esc_html__( 'Where does your site operate from?', 'give' ), |
|
251 | + 'name' => esc_html__('Base Country', 'give'), |
|
252 | + 'desc' => esc_html__('Where does your site operate from?', 'give'), |
|
253 | 253 | 'id' => 'base_country', |
254 | 254 | 'type' => 'select', |
255 | 255 | 'options' => give_get_country_list(), |
256 | 256 | ), |
257 | 257 | array( |
258 | - 'name' => esc_html__( 'Currency Settings', 'give' ), |
|
258 | + 'name' => esc_html__('Currency Settings', 'give'), |
|
259 | 259 | 'desc' => '', |
260 | 260 | 'type' => 'give_title', |
261 | 261 | 'id' => 'give_title_general_settings_2' |
262 | 262 | ), |
263 | 263 | array( |
264 | - 'name' => esc_html__( 'Currency', 'give' ), |
|
265 | - 'desc' => esc_html__( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
264 | + 'name' => esc_html__('Currency', 'give'), |
|
265 | + 'desc' => esc_html__('Choose your currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
266 | 266 | 'id' => 'currency', |
267 | 267 | 'type' => 'select', |
268 | 268 | 'options' => give_get_currencies(), |
269 | 269 | 'default' => 'USD', |
270 | 270 | ), |
271 | 271 | array( |
272 | - 'name' => esc_html__( 'Currency Position', 'give' ), |
|
273 | - 'desc' => esc_html__( 'Choose the position of the currency sign.', 'give' ), |
|
272 | + 'name' => esc_html__('Currency Position', 'give'), |
|
273 | + 'desc' => esc_html__('Choose the position of the currency sign.', 'give'), |
|
274 | 274 | 'id' => 'currency_position', |
275 | 275 | 'type' => 'select', |
276 | 276 | 'options' => array( |
277 | 277 | /* translators: %s: currency symbol */ |
278 | - 'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
278 | + 'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
279 | 279 | /* translators: %s: currency symbol */ |
280 | - 'after' => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ) |
|
280 | + 'after' => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())) |
|
281 | 281 | ), |
282 | 282 | 'default' => 'before', |
283 | 283 | ), |
284 | 284 | array( |
285 | - 'name' => esc_html__( 'Thousands Separator', 'give' ), |
|
286 | - 'desc' => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
285 | + 'name' => esc_html__('Thousands Separator', 'give'), |
|
286 | + 'desc' => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'), |
|
287 | 287 | 'id' => 'thousands_separator', |
288 | 288 | 'type' => 'text_small', |
289 | 289 | 'sanitization_cb' => 'give_sanitize_thousand_separator', |
290 | 290 | 'default' => ',', |
291 | 291 | ), |
292 | 292 | array( |
293 | - 'name' => esc_html__( 'Decimal Separator', 'give' ), |
|
294 | - 'desc' => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
293 | + 'name' => esc_html__('Decimal Separator', 'give'), |
|
294 | + 'desc' => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
295 | 295 | 'id' => 'decimal_separator', |
296 | 296 | 'type' => 'text_small', |
297 | 297 | 'default' => '.', |
298 | 298 | ), |
299 | 299 | array( |
300 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
301 | - 'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'give' ), |
|
300 | + 'name' => __('Number of Decimals', 'give'), |
|
301 | + 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'give'), |
|
302 | 302 | 'id' => 'number_decimals', |
303 | 303 | 'type' => 'text_small', |
304 | 304 | 'default' => 2, |
@@ -312,83 +312,83 @@ discard block |
||
312 | 312 | */ |
313 | 313 | 'gateways' => array( |
314 | 314 | 'id' => 'payment_gateways', |
315 | - 'give_title' => esc_html__( 'Payment Gateways', 'give' ), |
|
316 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
317 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
315 | + 'give_title' => esc_html__('Payment Gateways', 'give'), |
|
316 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
317 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
318 | 318 | array( |
319 | - 'name' => esc_html__( 'Gateways Settings', 'give' ), |
|
319 | + 'name' => esc_html__('Gateways Settings', 'give'), |
|
320 | 320 | 'desc' => '', |
321 | 321 | 'id' => 'give_title_gateway_settings_1', |
322 | 322 | 'type' => 'give_title' |
323 | 323 | ), |
324 | 324 | array( |
325 | - 'name' => esc_html__( 'Test Mode', 'give' ), |
|
326 | - 'desc' => esc_html__( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
325 | + 'name' => esc_html__('Test Mode', 'give'), |
|
326 | + 'desc' => esc_html__('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
327 | 327 | 'id' => 'test_mode', |
328 | 328 | 'type' => 'checkbox' |
329 | 329 | ), |
330 | 330 | array( |
331 | - 'name' => esc_html__( 'Enabled Gateways', 'give' ), |
|
332 | - 'desc' => esc_html__( 'Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give' ), |
|
331 | + 'name' => esc_html__('Enabled Gateways', 'give'), |
|
332 | + 'desc' => esc_html__('Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give'), |
|
333 | 333 | 'id' => 'gateways', |
334 | 334 | 'type' => 'enabled_gateways' |
335 | 335 | ), |
336 | 336 | array( |
337 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
338 | - 'desc' => esc_html__( 'This is the gateway that will be selected by default.', 'give' ), |
|
337 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
338 | + 'desc' => esc_html__('This is the gateway that will be selected by default.', 'give'), |
|
339 | 339 | 'id' => 'default_gateway', |
340 | 340 | 'type' => 'default_gateway' |
341 | 341 | ), |
342 | 342 | array( |
343 | - 'name' => esc_html__( 'PayPal Standard', 'give' ), |
|
343 | + 'name' => esc_html__('PayPal Standard', 'give'), |
|
344 | 344 | 'desc' => '', |
345 | 345 | 'type' => 'give_title', |
346 | 346 | 'id' => 'give_title_gateway_settings_2', |
347 | 347 | ), |
348 | 348 | array( |
349 | - 'name' => esc_html__( 'PayPal Email', 'give' ), |
|
350 | - 'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ), |
|
349 | + 'name' => esc_html__('PayPal Email', 'give'), |
|
350 | + 'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'), |
|
351 | 351 | 'id' => 'paypal_email', |
352 | 352 | 'type' => 'text_email', |
353 | 353 | ), |
354 | 354 | array( |
355 | - 'name' => esc_html__( 'PayPal Page Style', 'give' ), |
|
356 | - 'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ), |
|
355 | + 'name' => esc_html__('PayPal Page Style', 'give'), |
|
356 | + 'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'), |
|
357 | 357 | 'id' => 'paypal_page_style', |
358 | 358 | 'type' => 'text', |
359 | 359 | ), |
360 | 360 | array( |
361 | - 'name' => esc_html__( 'PayPal Transaction Type', 'give' ), |
|
362 | - 'desc' => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
361 | + 'name' => esc_html__('PayPal Transaction Type', 'give'), |
|
362 | + 'desc' => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
363 | 363 | 'id' => 'paypal_button_type', |
364 | 364 | 'type' => 'radio_inline', |
365 | 365 | 'options' => array( |
366 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
367 | - 'standard' => esc_html__( 'Standard Transaction', 'give' ) |
|
366 | + 'donation' => esc_html__('Donation', 'give'), |
|
367 | + 'standard' => esc_html__('Standard Transaction', 'give') |
|
368 | 368 | ), |
369 | 369 | 'default' => 'donation', |
370 | 370 | ), |
371 | 371 | array( |
372 | - 'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ), |
|
373 | - 'desc' => esc_html__( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ), |
|
372 | + 'name' => esc_html__('Disable PayPal IPN Verification', 'give'), |
|
373 | + 'desc' => esc_html__('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'), |
|
374 | 374 | 'id' => 'disable_paypal_verification', |
375 | 375 | 'type' => 'checkbox' |
376 | 376 | ), |
377 | 377 | array( |
378 | - 'name' => esc_html__( 'Offline Donations', 'give' ), |
|
378 | + 'name' => esc_html__('Offline Donations', 'give'), |
|
379 | 379 | 'desc' => '', |
380 | 380 | 'type' => 'give_title', |
381 | 381 | 'id' => 'give_title_gateway_settings_3', |
382 | 382 | ), |
383 | 383 | array( |
384 | - 'name' => esc_html__( 'Collect Billing Details', 'give' ), |
|
385 | - 'desc' => esc_html__( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ), |
|
384 | + 'name' => esc_html__('Collect Billing Details', 'give'), |
|
385 | + 'desc' => esc_html__('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'), |
|
386 | 386 | 'id' => 'give_offline_donation_enable_billing_fields', |
387 | 387 | 'type' => 'checkbox' |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'name' => esc_html__( 'Offline Donation Instructions', 'give' ), |
|
391 | - 'desc' => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
390 | + 'name' => esc_html__('Offline Donation Instructions', 'give'), |
|
391 | + 'desc' => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
392 | 392 | 'id' => 'global_offline_donation_content', |
393 | 393 | 'default' => give_get_default_offline_donation_content(), |
394 | 394 | 'type' => 'wysiwyg', |
@@ -397,15 +397,15 @@ discard block |
||
397 | 397 | ) |
398 | 398 | ), |
399 | 399 | array( |
400 | - 'name' => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
401 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
400 | + 'name' => esc_html__('Offline Donation Email Instructions Subject', 'give'), |
|
401 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
402 | 402 | 'id' => 'offline_donation_subject', |
403 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
403 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
404 | 404 | 'type' => 'text' |
405 | 405 | ), |
406 | 406 | array( |
407 | - 'name' => esc_html__( 'Offline Donation Email Instructions', 'give' ), |
|
408 | - 'desc' => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
407 | + 'name' => esc_html__('Offline Donation Email Instructions', 'give'), |
|
408 | + 'desc' => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
409 | 409 | 'id' => 'global_offline_donation_email', |
410 | 410 | 'default' => give_get_default_offline_donation_email_content(), |
411 | 411 | 'type' => 'wysiwyg', |
@@ -419,100 +419,100 @@ discard block |
||
419 | 419 | /** Display Settings */ |
420 | 420 | 'display' => array( |
421 | 421 | 'id' => 'display_settings', |
422 | - 'give_title' => esc_html__( 'Display Settings', 'give' ), |
|
423 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
424 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
422 | + 'give_title' => esc_html__('Display Settings', 'give'), |
|
423 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
424 | + 'fields' => apply_filters('give_settings_display', array( |
|
425 | 425 | array( |
426 | - 'name' => esc_html__( 'Display Settings', 'give' ), |
|
426 | + 'name' => esc_html__('Display Settings', 'give'), |
|
427 | 427 | 'desc' => '', |
428 | 428 | 'id' => 'give_title_display_settings_1', |
429 | 429 | 'type' => 'give_title' |
430 | 430 | ), |
431 | 431 | array( |
432 | - 'name' => esc_html__( 'Disable CSS', 'give' ), |
|
433 | - 'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
432 | + 'name' => esc_html__('Disable CSS', 'give'), |
|
433 | + 'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
434 | 434 | 'id' => 'disable_css', |
435 | 435 | 'type' => 'checkbox' |
436 | 436 | ), |
437 | 437 | array( |
438 | - 'name' => esc_html__( 'Enable Floating Labels', 'give' ), |
|
438 | + 'name' => esc_html__('Enable Floating Labels', 'give'), |
|
439 | 439 | /* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
440 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
440 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
441 | 441 | 'a' => array( |
442 | 442 | 'href' => array(), |
443 | 443 | 'target' => array() |
444 | 444 | ) |
445 | - ) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ), |
|
445 | + )), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')), |
|
446 | 446 | 'id' => 'enable_floatlabels', |
447 | 447 | 'type' => 'checkbox' |
448 | 448 | ), |
449 | 449 | array( |
450 | - 'name' => esc_html__( 'Disable Welcome Screen', 'give' ), |
|
450 | + 'name' => esc_html__('Disable Welcome Screen', 'give'), |
|
451 | 451 | /* translators: %s: about page URL */ |
452 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
452 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give'), array('a' => array('href' => array()))), esc_url(admin_url('index.php?page=give-about'))), |
|
453 | 453 | 'id' => 'disable_welcome', |
454 | 454 | 'type' => 'checkbox' |
455 | 455 | ), |
456 | 456 | array( |
457 | - 'name' => esc_html__( 'Post Types', 'give' ), |
|
457 | + 'name' => esc_html__('Post Types', 'give'), |
|
458 | 458 | 'desc' => '', |
459 | 459 | 'id' => 'give_title_display_settings_2', |
460 | 460 | 'type' => 'give_title' |
461 | 461 | ), |
462 | 462 | array( |
463 | - 'name' => esc_html__( 'Disable Form Single Views', 'give' ), |
|
464 | - 'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
463 | + 'name' => esc_html__('Disable Form Single Views', 'give'), |
|
464 | + 'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
465 | 465 | 'id' => 'disable_forms_singular', |
466 | 466 | 'type' => 'checkbox' |
467 | 467 | ), |
468 | 468 | array( |
469 | - 'name' => esc_html__( 'Disable Form Archives', 'give' ), |
|
470 | - 'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
469 | + 'name' => esc_html__('Disable Form Archives', 'give'), |
|
470 | + 'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
471 | 471 | 'id' => 'disable_forms_archives', |
472 | 472 | 'type' => 'checkbox' |
473 | 473 | ), |
474 | 474 | array( |
475 | - 'name' => esc_html__( 'Disable Form Excerpts', 'give' ), |
|
476 | - 'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
475 | + 'name' => esc_html__('Disable Form Excerpts', 'give'), |
|
476 | + 'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
477 | 477 | 'id' => 'disable_forms_excerpt', |
478 | 478 | 'type' => 'checkbox' |
479 | 479 | ), |
480 | 480 | |
481 | 481 | array( |
482 | - 'name' => esc_html__( 'Featured Image Size', 'give' ), |
|
483 | - 'desc' => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ), |
|
482 | + 'name' => esc_html__('Featured Image Size', 'give'), |
|
483 | + 'desc' => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'), |
|
484 | 484 | 'id' => 'featured_image_size', |
485 | 485 | 'type' => 'select', |
486 | 486 | 'default' => 'large', |
487 | 487 | 'options' => give_get_featured_image_sizes() |
488 | 488 | ), |
489 | 489 | array( |
490 | - 'name' => esc_html__( 'Disable Form Featured Image', 'give' ), |
|
491 | - 'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
490 | + 'name' => esc_html__('Disable Form Featured Image', 'give'), |
|
491 | + 'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
492 | 492 | 'id' => 'disable_form_featured_img', |
493 | 493 | 'type' => 'checkbox' |
494 | 494 | ), |
495 | 495 | array( |
496 | - 'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ), |
|
497 | - 'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
496 | + 'name' => esc_html__('Disable Single Form Sidebar', 'give'), |
|
497 | + 'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
498 | 498 | 'id' => 'disable_form_sidebar', |
499 | 499 | 'type' => 'checkbox' |
500 | 500 | ), |
501 | 501 | array( |
502 | - 'name' => esc_html__( 'Taxonomies', 'give' ), |
|
502 | + 'name' => esc_html__('Taxonomies', 'give'), |
|
503 | 503 | 'desc' => '', |
504 | 504 | 'id' => 'give_title_display_settings_3', |
505 | 505 | 'type' => 'give_title' |
506 | 506 | ), |
507 | 507 | array( |
508 | - 'name' => esc_html__( 'Enable Form Categories', 'give' ), |
|
509 | - 'desc' => esc_html__( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ), |
|
508 | + 'name' => esc_html__('Enable Form Categories', 'give'), |
|
509 | + 'desc' => esc_html__('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'), |
|
510 | 510 | 'id' => 'enable_categories', |
511 | 511 | 'type' => 'checkbox' |
512 | 512 | ), |
513 | 513 | array( |
514 | - 'name' => esc_html__( 'Enable Form Tags', 'give' ), |
|
515 | - 'desc' => esc_html__( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ), |
|
514 | + 'name' => esc_html__('Enable Form Tags', 'give'), |
|
515 | + 'desc' => esc_html__('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'), |
|
516 | 516 | 'id' => 'enable_tags', |
517 | 517 | 'type' => 'checkbox' |
518 | 518 | ), |
@@ -525,95 +525,95 @@ discard block |
||
525 | 525 | */ |
526 | 526 | 'emails' => array( |
527 | 527 | 'id' => 'email_settings', |
528 | - 'give_title' => esc_html__( 'Email Settings', 'give' ), |
|
529 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
530 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
528 | + 'give_title' => esc_html__('Email Settings', 'give'), |
|
529 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
530 | + 'fields' => apply_filters('give_settings_emails', array( |
|
531 | 531 | array( |
532 | - 'name' => esc_html__( 'Email Settings', 'give' ), |
|
532 | + 'name' => esc_html__('Email Settings', 'give'), |
|
533 | 533 | 'desc' => '', |
534 | 534 | 'id' => 'give_title_email_settings_1', |
535 | 535 | 'type' => 'give_title' |
536 | 536 | ), |
537 | 537 | array( |
538 | 538 | 'id' => 'email_template', |
539 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
540 | - 'desc' => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
539 | + 'name' => esc_html__('Email Template', 'give'), |
|
540 | + 'desc' => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
541 | 541 | 'type' => 'select', |
542 | 542 | 'options' => give_get_email_templates() |
543 | 543 | ), |
544 | 544 | array( |
545 | 545 | 'id' => 'email_logo', |
546 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
547 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
546 | + 'name' => esc_html__('Logo', 'give'), |
|
547 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
548 | 548 | 'type' => 'file' |
549 | 549 | ), |
550 | 550 | array( |
551 | 551 | 'id' => 'from_name', |
552 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
553 | - 'desc' => esc_html__( 'The name donation receipts are said to come from. This is most likely the name of your organization or website.', 'give' ), |
|
554 | - 'default' => get_bloginfo( 'name' ), |
|
552 | + 'name' => esc_html__('From Name', 'give'), |
|
553 | + 'desc' => esc_html__('The name donation receipts are said to come from. This is most likely the name of your organization or website.', 'give'), |
|
554 | + 'default' => get_bloginfo('name'), |
|
555 | 555 | 'type' => 'text' |
556 | 556 | ), |
557 | 557 | array( |
558 | 558 | 'id' => 'from_email', |
559 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
560 | - 'desc' => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
561 | - 'default' => get_bloginfo( 'admin_email' ), |
|
559 | + 'name' => esc_html__('From Email', 'give'), |
|
560 | + 'desc' => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
561 | + 'default' => get_bloginfo('admin_email'), |
|
562 | 562 | 'type' => 'text' |
563 | 563 | ), |
564 | 564 | array( |
565 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
565 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
566 | 566 | 'desc' => '', |
567 | 567 | 'id' => 'give_title_email_settings_2', |
568 | 568 | 'type' => 'give_title' |
569 | 569 | ), |
570 | 570 | array( |
571 | 571 | 'id' => 'donation_subject', |
572 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
573 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
574 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
572 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
573 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
574 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
575 | 575 | 'type' => 'text' |
576 | 576 | ), |
577 | 577 | array( |
578 | 578 | 'id' => 'donation_receipt', |
579 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
579 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
580 | 580 | /* translators: %s: emails tags list */ |
581 | - 'desc' => sprintf( __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ), |
|
581 | + 'desc' => sprintf(__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()), |
|
582 | 582 | 'type' => 'wysiwyg', |
583 | 583 | 'default' => give_get_default_donation_receipt_email() |
584 | 584 | ), |
585 | 585 | array( |
586 | - 'name' => esc_html__( 'New Donation Notification', 'give' ), |
|
586 | + 'name' => esc_html__('New Donation Notification', 'give'), |
|
587 | 587 | 'desc' => '', |
588 | 588 | 'id' => 'give_title_email_settings_3', |
589 | 589 | 'type' => 'give_title' |
590 | 590 | ), |
591 | 591 | array( |
592 | 592 | 'id' => 'donation_notification_subject', |
593 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
594 | - 'desc' => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ), |
|
593 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
594 | + 'desc' => esc_html__('Enter the subject line for the donation notification email.', 'give'), |
|
595 | 595 | 'type' => 'text', |
596 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ) |
|
596 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give') |
|
597 | 597 | ), |
598 | 598 | array( |
599 | 599 | 'id' => 'donation_notification', |
600 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
600 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
601 | 601 | /* translators: %s: emails tags list */ |
602 | - 'desc' => sprintf( __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ), |
|
602 | + 'desc' => sprintf(__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()), |
|
603 | 603 | 'type' => 'wysiwyg', |
604 | 604 | 'default' => give_get_default_donation_notification_email() |
605 | 605 | ), |
606 | 606 | array( |
607 | 607 | 'id' => 'admin_notice_emails', |
608 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
609 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
608 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
609 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
610 | 610 | 'type' => 'textarea', |
611 | - 'default' => get_bloginfo( 'admin_email' ) |
|
611 | + 'default' => get_bloginfo('admin_email') |
|
612 | 612 | ), |
613 | 613 | array( |
614 | 614 | 'id' => 'disable_admin_notices', |
615 | - 'name' => esc_html__( 'Disable Admin Notifications', 'give' ), |
|
616 | - 'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
615 | + 'name' => esc_html__('Disable Admin Notifications', 'give'), |
|
616 | + 'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
617 | 617 | 'type' => 'checkbox' |
618 | 618 | ) |
619 | 619 | ) |
@@ -622,99 +622,99 @@ discard block |
||
622 | 622 | /** Extension Settings */ |
623 | 623 | 'addons' => array( |
624 | 624 | 'id' => 'addons', |
625 | - 'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ), |
|
626 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
627 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
625 | + 'give_title' => esc_html__('Give Add-ons Settings', 'give'), |
|
626 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
627 | + 'fields' => apply_filters('give_settings_addons', array() |
|
628 | 628 | ) |
629 | 629 | ), |
630 | 630 | /** Licenses Settings */ |
631 | 631 | 'licenses' => array( |
632 | 632 | 'id' => 'licenses', |
633 | - 'give_title' => esc_html__( 'Give Licenses', 'give' ), |
|
634 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
635 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
633 | + 'give_title' => esc_html__('Give Licenses', 'give'), |
|
634 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
635 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
636 | 636 | ) |
637 | 637 | ), |
638 | 638 | /** Advanced Options */ |
639 | 639 | 'advanced' => array( |
640 | 640 | 'id' => 'advanced_options', |
641 | - 'give_title' => esc_html__( 'Advanced Options', 'give' ), |
|
642 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
643 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
641 | + 'give_title' => esc_html__('Advanced Options', 'give'), |
|
642 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
643 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
644 | 644 | array( |
645 | - 'name' => esc_html__( 'Access Control', 'give' ), |
|
645 | + 'name' => esc_html__('Access Control', 'give'), |
|
646 | 646 | 'desc' => '', |
647 | 647 | 'id' => 'give_title_session_control_1', |
648 | 648 | 'type' => 'give_title' |
649 | 649 | ), |
650 | 650 | array( |
651 | 651 | 'id' => 'session_lifetime', |
652 | - 'name' => esc_html__( 'Session Lifetime', 'give' ), |
|
653 | - 'desc' => esc_html__( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give' ), |
|
652 | + 'name' => esc_html__('Session Lifetime', 'give'), |
|
653 | + 'desc' => esc_html__('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'), |
|
654 | 654 | 'type' => 'select', |
655 | 655 | 'options' => array( |
656 | - '86400' => esc_html__( '24 Hours', 'give' ), |
|
657 | - '172800' => esc_html__( '48 Hours', 'give' ), |
|
658 | - '259200' => esc_html__( '72 Hours', 'give' ), |
|
659 | - '604800' => esc_html__( '1 Week', 'give' ), |
|
656 | + '86400' => esc_html__('24 Hours', 'give'), |
|
657 | + '172800' => esc_html__('48 Hours', 'give'), |
|
658 | + '259200' => esc_html__('72 Hours', 'give'), |
|
659 | + '604800' => esc_html__('1 Week', 'give'), |
|
660 | 660 | ) |
661 | 661 | ), |
662 | 662 | array( |
663 | - 'name' => esc_html__( 'Email Access', 'give' ), |
|
664 | - 'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
663 | + 'name' => esc_html__('Email Access', 'give'), |
|
664 | + 'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
665 | 665 | 'id' => 'email_access', |
666 | 666 | 'type' => 'checkbox', |
667 | 667 | ), |
668 | 668 | array( |
669 | 669 | 'id' => 'recaptcha_key', |
670 | - 'name' => esc_html__( 'reCAPTCHA Site Key', 'give' ), |
|
670 | + 'name' => esc_html__('reCAPTCHA Site Key', 'give'), |
|
671 | 671 | /* translators: %s: https://www.google.com/recaptcha/ */ |
672 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ), |
|
672 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')), |
|
673 | 673 | 'default' => '', |
674 | 674 | 'type' => 'text' |
675 | 675 | ), |
676 | 676 | array( |
677 | 677 | 'id' => 'recaptcha_secret', |
678 | - 'name' => esc_html__( 'reCAPTCHA Secret Key', 'give' ), |
|
679 | - 'desc' => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
678 | + 'name' => esc_html__('reCAPTCHA Secret Key', 'give'), |
|
679 | + 'desc' => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
680 | 680 | 'default' => '', |
681 | 681 | 'type' => 'text' |
682 | 682 | ), |
683 | 683 | array( |
684 | - 'name' => esc_html__( 'Data Control', 'give' ), |
|
684 | + 'name' => esc_html__('Data Control', 'give'), |
|
685 | 685 | 'desc' => '', |
686 | 686 | 'id' => 'give_title_data_control_2', |
687 | 687 | 'type' => 'give_title' |
688 | 688 | ), |
689 | 689 | array( |
690 | - 'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ), |
|
691 | - 'desc' => esc_html__( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ), |
|
690 | + 'name' => esc_html__('Remove All Data on Uninstall?', 'give'), |
|
691 | + 'desc' => esc_html__('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'), |
|
692 | 692 | 'id' => 'uninstall_on_delete', |
693 | 693 | 'type' => 'checkbox' |
694 | 694 | ), |
695 | 695 | array( |
696 | - 'name' => esc_html__( 'Filter Control', 'give' ), |
|
696 | + 'name' => esc_html__('Filter Control', 'give'), |
|
697 | 697 | 'desc' => '', |
698 | 698 | 'id' => 'give_title_filter_control', |
699 | 699 | 'type' => 'give_title' |
700 | 700 | ), |
701 | 701 | array( |
702 | 702 | /* translators: %s: the_content */ |
703 | - 'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ), |
|
703 | + 'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'), |
|
704 | 704 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
705 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
705 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
706 | 706 | 'id' => 'disable_the_content_filter', |
707 | 707 | 'type' => 'checkbox' |
708 | 708 | ), |
709 | 709 | array( |
710 | - 'name' => esc_html__( 'Script Loading', 'give' ), |
|
710 | + 'name' => esc_html__('Script Loading', 'give'), |
|
711 | 711 | 'desc' => '', |
712 | 712 | 'id' => 'give_title_script_control', |
713 | 713 | 'type' => 'give_title' |
714 | 714 | ), |
715 | 715 | array( |
716 | - 'name' => esc_html__( 'Load Scripts in Footer?', 'give' ), |
|
717 | - 'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
716 | + 'name' => esc_html__('Load Scripts in Footer?', 'give'), |
|
717 | + 'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
718 | 718 | 'id' => 'scripts_footer', |
719 | 719 | 'type' => 'checkbox' |
720 | 720 | ) |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | /** API Settings */ |
725 | 725 | 'api' => array( |
726 | 726 | 'id' => 'api', |
727 | - 'give_title' => esc_html__( 'API', 'give' ), |
|
728 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
727 | + 'give_title' => esc_html__('API', 'give'), |
|
728 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
729 | 729 | 'show_names' => false, // Hide field names on the left |
730 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
730 | + 'fields' => apply_filters('give_settings_system', array( |
|
731 | 731 | array( |
732 | 732 | 'id' => 'api', |
733 | - 'name' => esc_html__( 'API', 'give' ), |
|
733 | + 'name' => esc_html__('API', 'give'), |
|
734 | 734 | 'type' => 'api' |
735 | 735 | ) |
736 | 736 | ) |
@@ -739,13 +739,13 @@ discard block |
||
739 | 739 | /** Licenses Settings */ |
740 | 740 | 'system_info' => array( |
741 | 741 | 'id' => 'system_info', |
742 | - 'give_title' => esc_html__( 'System Info', 'give' ), |
|
743 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
744 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
742 | + 'give_title' => esc_html__('System Info', 'give'), |
|
743 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
744 | + 'fields' => apply_filters('give_settings_system', array( |
|
745 | 745 | array( |
746 | 746 | 'id' => 'system_info', |
747 | - 'name' => esc_html__( 'System Info', 'give' ), |
|
748 | - 'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
747 | + 'name' => esc_html__('System Info', 'give'), |
|
748 | + 'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
749 | 749 | 'type' => 'system_info' |
750 | 750 | ) |
751 | 751 | ) |
@@ -754,15 +754,15 @@ discard block |
||
754 | 754 | ); |
755 | 755 | |
756 | 756 | //Return all settings array if no active tab |
757 | - if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) { |
|
757 | + if ($active_tab === null || ! isset($give_settings[$active_tab])) { |
|
758 | 758 | |
759 | - return apply_filters( 'give_registered_settings', $give_settings ); |
|
759 | + return apply_filters('give_registered_settings', $give_settings); |
|
760 | 760 | |
761 | 761 | } |
762 | 762 | |
763 | 763 | |
764 | 764 | // Add other tabs and settings fields as needed |
765 | - return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] ); |
|
765 | + return apply_filters('give_registered_settings', $give_settings[$active_tab]); |
|
766 | 766 | |
767 | 767 | } |
768 | 768 | |
@@ -771,11 +771,11 @@ discard block |
||
771 | 771 | */ |
772 | 772 | public function settings_notices() { |
773 | 773 | |
774 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
774 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
775 | 775 | return; |
776 | 776 | } |
777 | 777 | |
778 | - add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' ); |
|
778 | + add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated'); |
|
779 | 779 | |
780 | 780 | } |
781 | 781 | |
@@ -789,17 +789,17 @@ discard block |
||
789 | 789 | * |
790 | 790 | * @return mixed Field value or exception is thrown |
791 | 791 | */ |
792 | - public function __get( $field ) { |
|
792 | + public function __get($field) { |
|
793 | 793 | |
794 | 794 | // Allowed fields to retrieve |
795 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
795 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
796 | 796 | return $this->{$field}; |
797 | 797 | } |
798 | - if ( 'option_metabox' === $field ) { |
|
798 | + if ('option_metabox' === $field) { |
|
799 | 799 | return $this->option_metabox(); |
800 | 800 | } |
801 | 801 | |
802 | - throw new Exception( 'Invalid property: ' . $field ); |
|
802 | + throw new Exception('Invalid property: '.$field); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | |
@@ -817,12 +817,12 @@ discard block |
||
817 | 817 | * |
818 | 818 | * @return mixed Option value |
819 | 819 | */ |
820 | -function give_get_option( $key = '', $default = false ) { |
|
820 | +function give_get_option($key = '', $default = false) { |
|
821 | 821 | global $give_options; |
822 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
823 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
822 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
823 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
824 | 824 | |
825 | - return apply_filters( 'give_get_option_' . $key, $value, $key, $default ); |
|
825 | + return apply_filters('give_get_option_'.$key, $value, $key, $default); |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | |
@@ -840,33 +840,33 @@ discard block |
||
840 | 840 | * |
841 | 841 | * @return boolean True if updated, false if not. |
842 | 842 | */ |
843 | -function give_update_option( $key = '', $value = false ) { |
|
843 | +function give_update_option($key = '', $value = false) { |
|
844 | 844 | |
845 | 845 | // If no key, exit |
846 | - if ( empty( $key ) ) { |
|
846 | + if (empty($key)) { |
|
847 | 847 | return false; |
848 | 848 | } |
849 | 849 | |
850 | - if ( empty( $value ) ) { |
|
851 | - $remove_option = give_delete_option( $key ); |
|
850 | + if (empty($value)) { |
|
851 | + $remove_option = give_delete_option($key); |
|
852 | 852 | |
853 | 853 | return $remove_option; |
854 | 854 | } |
855 | 855 | |
856 | 856 | // First let's grab the current settings |
857 | - $options = get_option( 'give_settings' ); |
|
857 | + $options = get_option('give_settings'); |
|
858 | 858 | |
859 | 859 | // Let's let devs alter that value coming in |
860 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
860 | + $value = apply_filters('give_update_option', $value, $key); |
|
861 | 861 | |
862 | 862 | // Next let's try to update the value |
863 | - $options[ $key ] = $value; |
|
864 | - $did_update = update_option( 'give_settings', $options ); |
|
863 | + $options[$key] = $value; |
|
864 | + $did_update = update_option('give_settings', $options); |
|
865 | 865 | |
866 | 866 | // If it updated, let's update the global variable |
867 | - if ( $did_update ) { |
|
867 | + if ($did_update) { |
|
868 | 868 | global $give_options; |
869 | - $give_options[ $key ] = $value; |
|
869 | + $give_options[$key] = $value; |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | return $did_update; |
@@ -883,27 +883,27 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @return boolean True if updated, false if not. |
885 | 885 | */ |
886 | -function give_delete_option( $key = '' ) { |
|
886 | +function give_delete_option($key = '') { |
|
887 | 887 | |
888 | 888 | // If no key, exit |
889 | - if ( empty( $key ) ) { |
|
889 | + if (empty($key)) { |
|
890 | 890 | return false; |
891 | 891 | } |
892 | 892 | |
893 | 893 | // First let's grab the current settings |
894 | - $options = get_option( 'give_settings' ); |
|
894 | + $options = get_option('give_settings'); |
|
895 | 895 | |
896 | 896 | // Next let's try to update the value |
897 | - if ( isset( $options[ $key ] ) ) { |
|
897 | + if (isset($options[$key])) { |
|
898 | 898 | |
899 | - unset( $options[ $key ] ); |
|
899 | + unset($options[$key]); |
|
900 | 900 | |
901 | 901 | } |
902 | 902 | |
903 | - $did_update = update_option( 'give_settings', $options ); |
|
903 | + $did_update = update_option('give_settings', $options); |
|
904 | 904 | |
905 | 905 | // If it updated, let's update the global variable |
906 | - if ( $did_update ) { |
|
906 | + if ($did_update) { |
|
907 | 907 | global $give_options; |
908 | 908 | $give_options = $options; |
909 | 909 | } |
@@ -922,9 +922,9 @@ discard block |
||
922 | 922 | */ |
923 | 923 | function give_get_settings() { |
924 | 924 | |
925 | - $settings = get_option( 'give_settings' ); |
|
925 | + $settings = get_option('give_settings'); |
|
926 | 926 | |
927 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
927 | + return (array) apply_filters('give_get_settings', $settings); |
|
928 | 928 | |
929 | 929 | } |
930 | 930 | |
@@ -942,25 +942,25 @@ discard block |
||
942 | 942 | * |
943 | 943 | * @return array |
944 | 944 | */ |
945 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
946 | - if ( is_int( $position ) ) { |
|
947 | - array_splice( $array, $position, 0, $insert ); |
|
945 | +function give_settings_array_insert($array, $position, $insert) { |
|
946 | + if (is_int($position)) { |
|
947 | + array_splice($array, $position, 0, $insert); |
|
948 | 948 | } else { |
949 | 949 | |
950 | - foreach ( $array as $index => $subarray ) { |
|
951 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
950 | + foreach ($array as $index => $subarray) { |
|
951 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
952 | 952 | $pos = $index; |
953 | 953 | } |
954 | 954 | } |
955 | 955 | |
956 | - if ( ! isset( $pos ) ) { |
|
956 | + if ( ! isset($pos)) { |
|
957 | 957 | return $array; |
958 | 958 | } |
959 | 959 | |
960 | 960 | $array = array_merge( |
961 | - array_slice( $array, 0, $pos ), |
|
961 | + array_slice($array, 0, $pos), |
|
962 | 962 | $insert, |
963 | - array_slice( $array, $pos ) |
|
963 | + array_slice($array, $pos) |
|
964 | 964 | ); |
965 | 965 | } |
966 | 966 | |
@@ -983,31 +983,31 @@ discard block |
||
983 | 983 | * |
984 | 984 | * @return void |
985 | 985 | */ |
986 | -function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
986 | +function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
987 | 987 | |
988 | 988 | $id = $field_type_object->field->args['id']; |
989 | 989 | $field_description = $field_type_object->field->args['desc']; |
990 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
990 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
991 | 991 | |
992 | 992 | echo '<ul class="cmb2-checkbox-list cmb2-list">'; |
993 | 993 | |
994 | - foreach ( $gateways as $key => $option ) : |
|
994 | + foreach ($gateways as $key => $option) : |
|
995 | 995 | |
996 | - if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) { |
|
996 | + if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) { |
|
997 | 997 | $enabled = '1'; |
998 | 998 | } else { |
999 | 999 | $enabled = null; |
1000 | 1000 | } |
1001 | 1001 | |
1002 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
1003 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
1002 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
1003 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
1004 | 1004 | |
1005 | 1005 | endforeach; |
1006 | 1006 | |
1007 | 1007 | echo '</ul>'; |
1008 | 1008 | |
1009 | - if ( $field_description ) { |
|
1010 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
1009 | + if ($field_description) { |
|
1010 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | } |
@@ -1023,31 +1023,31 @@ discard block |
||
1023 | 1023 | * |
1024 | 1024 | * @return void |
1025 | 1025 | */ |
1026 | -function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1026 | +function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1027 | 1027 | |
1028 | 1028 | $id = $field_type_object->field->args['id']; |
1029 | 1029 | $field_description = $field_type_object->field->args['desc']; |
1030 | 1030 | $gateways = give_get_enabled_payment_gateways(); |
1031 | 1031 | |
1032 | - echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">'; |
|
1032 | + echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">'; |
|
1033 | 1033 | |
1034 | 1034 | //Add a field to the Give Form admin single post view of this field |
1035 | - if ( $field_type_object->field->object_type === 'post' ) { |
|
1036 | - echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>'; |
|
1035 | + if ($field_type_object->field->object_type === 'post') { |
|
1036 | + echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>'; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | - foreach ( $gateways as $key => $option ) : |
|
1039 | + foreach ($gateways as $key => $option) : |
|
1040 | 1040 | |
1041 | - $selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : ''; |
|
1041 | + $selected = isset($escaped_value) ? selected($key, $escaped_value, false) : ''; |
|
1042 | 1042 | |
1043 | 1043 | |
1044 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
1044 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
1045 | 1045 | |
1046 | 1046 | endforeach; |
1047 | 1047 | |
1048 | 1048 | echo '</select>'; |
1049 | 1049 | |
1050 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
1050 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
1051 | 1051 | |
1052 | 1052 | } |
1053 | 1053 | |
@@ -1062,13 +1062,13 @@ discard block |
||
1062 | 1062 | * |
1063 | 1063 | * @return void |
1064 | 1064 | */ |
1065 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1065 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1066 | 1066 | |
1067 | 1067 | $id = $field_type_object->field->args['id']; |
1068 | 1068 | $title = $field_type_object->field->args['name']; |
1069 | 1069 | $field_description = $field_type_object->field->args['desc']; |
1070 | 1070 | |
1071 | - echo '<hr>' . $field_description; |
|
1071 | + echo '<hr>'.$field_description; |
|
1072 | 1072 | |
1073 | 1073 | } |
1074 | 1074 | |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | * |
1084 | 1084 | * @return void |
1085 | 1085 | */ |
1086 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1086 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1087 | 1087 | |
1088 | 1088 | $id = $field_type_object->field->args['id']; |
1089 | 1089 | $title = $field_type_object->field->args['name']; |
@@ -1103,25 +1103,25 @@ discard block |
||
1103 | 1103 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1104 | 1104 | * @return array An array of options that matches the CMB2 options array |
1105 | 1105 | */ |
1106 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1106 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1107 | 1107 | |
1108 | - $post_options = array( '' => '' ); // Blank option |
|
1108 | + $post_options = array('' => ''); // Blank option |
|
1109 | 1109 | |
1110 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1110 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1111 | 1111 | return $post_options; |
1112 | 1112 | } |
1113 | 1113 | |
1114 | - $args = wp_parse_args( $query_args, array( |
|
1114 | + $args = wp_parse_args($query_args, array( |
|
1115 | 1115 | 'post_type' => 'page', |
1116 | 1116 | 'numberposts' => 10, |
1117 | - ) ); |
|
1117 | + )); |
|
1118 | 1118 | |
1119 | - $posts = get_posts( $args ); |
|
1119 | + $posts = get_posts($args); |
|
1120 | 1120 | |
1121 | - if ( $posts ) { |
|
1122 | - foreach ( $posts as $post ) { |
|
1121 | + if ($posts) { |
|
1122 | + foreach ($posts as $post) { |
|
1123 | 1123 | |
1124 | - $post_options[ $post->ID ] = $post->post_title; |
|
1124 | + $post_options[$post->ID] = $post->post_title; |
|
1125 | 1125 | |
1126 | 1126 | } |
1127 | 1127 | } |
@@ -1143,21 +1143,21 @@ discard block |
||
1143 | 1143 | $get_sizes = get_intermediate_image_sizes(); |
1144 | 1144 | |
1145 | 1145 | // check whether intermediate image sizes exist first |
1146 | - if ( empty( $get_sizes ) ) { |
|
1147 | - $get_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' ); |
|
1146 | + if (empty($get_sizes)) { |
|
1147 | + $get_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | - foreach ( $get_sizes as $_size ) { |
|
1150 | + foreach ($get_sizes as $_size) { |
|
1151 | 1151 | |
1152 | - if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) { |
|
1153 | - $sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1154 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1155 | - $sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height']; |
|
1152 | + if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) { |
|
1153 | + $sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1154 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1155 | + $sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height']; |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | } |
1159 | 1159 | |
1160 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1160 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | |
@@ -1172,34 +1172,34 @@ discard block |
||
1172 | 1172 | * |
1173 | 1173 | * @return void |
1174 | 1174 | */ |
1175 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1175 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1176 | 1176 | |
1177 | 1177 | $id = $field_type_object->field->args['id']; |
1178 | 1178 | $field_description = $field_type_object->field->args['desc']; |
1179 | - $license_status = get_option( $field_type_object->field->args['options']['is_valid_license_option'] ); |
|
1179 | + $license_status = get_option($field_type_object->field->args['options']['is_valid_license_option']); |
|
1180 | 1180 | $field_classes = 'regular-text give-license-field'; |
1181 | - $type = empty( $escaped_value ) ? 'text' : 'password'; |
|
1181 | + $type = empty($escaped_value) ? 'text' : 'password'; |
|
1182 | 1182 | |
1183 | - if ( $license_status === 'valid' ) { |
|
1183 | + if ($license_status === 'valid') { |
|
1184 | 1184 | $field_classes .= ' give-license-active'; |
1185 | 1185 | } |
1186 | 1186 | |
1187 | - $html = $field_type_object->input( array( |
|
1187 | + $html = $field_type_object->input(array( |
|
1188 | 1188 | 'class' => $field_classes, |
1189 | 1189 | 'type' => $type |
1190 | - ) ); |
|
1190 | + )); |
|
1191 | 1191 | |
1192 | 1192 | //License is active so show deactivate button |
1193 | - if ( $license_status === 'valid' ) { |
|
1194 | - $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
|
1193 | + if ($license_status === 'valid') { |
|
1194 | + $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>'; |
|
1195 | 1195 | } else { |
1196 | 1196 | //This license is not valid so delete it |
1197 | - give_delete_option( $id ); |
|
1197 | + give_delete_option($id); |
|
1198 | 1198 | } |
1199 | 1199 | |
1200 | - $html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1200 | + $html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1201 | 1201 | |
1202 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1202 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1203 | 1203 | |
1204 | 1204 | echo $html; |
1205 | 1205 | } |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | */ |
1214 | 1214 | function give_api_callback() { |
1215 | 1215 | |
1216 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1216 | + if ( ! current_user_can('manage_give_settings')) { |
|
1217 | 1217 | return; |
1218 | 1218 | } |
1219 | 1219 | |
@@ -1222,9 +1222,9 @@ discard block |
||
1222 | 1222 | * |
1223 | 1223 | * @since 1.0 |
1224 | 1224 | */ |
1225 | - do_action( 'give_tools_api_keys_before' ); |
|
1225 | + do_action('give_tools_api_keys_before'); |
|
1226 | 1226 | |
1227 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1227 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1228 | 1228 | |
1229 | 1229 | $api_keys_table = new Give_API_Keys_Table(); |
1230 | 1230 | $api_keys_table->prepare_items(); |
@@ -1233,9 +1233,9 @@ discard block |
||
1233 | 1233 | <span class="cmb2-metabox-description api-description"> |
1234 | 1234 | <?php echo sprintf( |
1235 | 1235 | /* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */ |
1236 | - __( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ), |
|
1237 | - esc_url( 'https://givewp.com/documentation/give-api-reference/' ), |
|
1238 | - esc_url( 'https://givewp.com/addons/zapier/' ) |
|
1236 | + __('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'), |
|
1237 | + esc_url('https://givewp.com/documentation/give-api-reference/'), |
|
1238 | + esc_url('https://givewp.com/addons/zapier/') |
|
1239 | 1239 | ); ?> |
1240 | 1240 | </span> |
1241 | 1241 | <?php |
@@ -1245,10 +1245,10 @@ discard block |
||
1245 | 1245 | * |
1246 | 1246 | * @since 1.0 |
1247 | 1247 | */ |
1248 | - do_action( 'give_tools_api_keys_after' ); |
|
1248 | + do_action('give_tools_api_keys_after'); |
|
1249 | 1249 | } |
1250 | 1250 | |
1251 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1251 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1252 | 1252 | |
1253 | 1253 | /** |
1254 | 1254 | * Hook Callback |
@@ -1261,8 +1261,8 @@ discard block |
||
1261 | 1261 | * |
1262 | 1262 | * @return void |
1263 | 1263 | */ |
1264 | -function give_hook_callback( $args ) { |
|
1265 | - do_action( 'give_' . $args['id'] ); |
|
1264 | +function give_hook_callback($args) { |
|
1265 | + do_action('give_'.$args['id']); |
|
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 | /** |
@@ -1273,10 +1273,10 @@ discard block |
||
1273 | 1273 | * This prevents fatal error conflicts with other themes and users of the CMB2 WP.org plugin. |
1274 | 1274 | */ |
1275 | 1275 | |
1276 | -if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1277 | - require_once WP_PLUGIN_DIR . '/cmb2/init.php'; |
|
1278 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1279 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php'; |
|
1280 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1281 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php'; |
|
1276 | +if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1277 | + require_once WP_PLUGIN_DIR.'/cmb2/init.php'; |
|
1278 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1279 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php'; |
|
1280 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) { |
|
1281 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php'; |
|
1282 | 1282 | } |
1283 | 1283 | \ 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 | |
@@ -26,38 +26,38 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
34 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
35 | 35 | |
36 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
37 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
36 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
37 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
38 | 38 | |
39 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
39 | + $to_email = give_get_payment_user_email($payment_id); |
|
40 | 40 | |
41 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
42 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
43 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
41 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
42 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
43 | + $subject = give_do_email_tags($subject, $payment_id); |
|
44 | 44 | |
45 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
46 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
45 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
46 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
47 | 47 | |
48 | 48 | $emails = Give()->emails; |
49 | 49 | |
50 | - $emails->__set( 'from_name', $from_name ); |
|
51 | - $emails->__set( 'from_email', $from_email ); |
|
52 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
50 | + $emails->__set('from_name', $from_name); |
|
51 | + $emails->__set('from_email', $from_email); |
|
52 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
53 | 53 | |
54 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
55 | - $emails->__set( 'headers', $headers ); |
|
54 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
55 | + $emails->__set('headers', $headers); |
|
56 | 56 | |
57 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
57 | + $emails->send($to_email, $subject, $message, $attachments); |
|
58 | 58 | |
59 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
60 | - do_action( 'give_admin_sale_notice', $payment_id, $payment_data ); |
|
59 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
60 | + do_action('give_admin_sale_notice', $payment_id, $payment_data); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -70,29 +70,29 @@ discard block |
||
70 | 70 | */ |
71 | 71 | function give_email_test_donation_receipt() { |
72 | 72 | |
73 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
74 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() ); |
|
73 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
74 | + $from_name = apply_filters('give_purchase_from_name', $from_name, 0, array()); |
|
75 | 75 | |
76 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
77 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() ); |
|
76 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
77 | + $from_email = apply_filters('give_purchase_from_address', $from_email, 0, array()); |
|
78 | 78 | |
79 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
80 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
81 | - $subject = give_do_email_tags( $subject, 0 ); |
|
79 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
80 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
81 | + $subject = give_do_email_tags($subject, 0); |
|
82 | 82 | |
83 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
83 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
84 | 84 | |
85 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
85 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
86 | 86 | |
87 | 87 | $emails = Give()->emails; |
88 | - $emails->__set( 'from_name', $from_name ); |
|
89 | - $emails->__set( 'from_email', $from_email ); |
|
90 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
88 | + $emails->__set('from_name', $from_name); |
|
89 | + $emails->__set('from_email', $from_email); |
|
90 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
91 | 91 | |
92 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
93 | - $emails->__set( 'headers', $headers ); |
|
92 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
93 | + $emails->__set('headers', $headers); |
|
94 | 94 | |
95 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
95 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
@@ -106,50 +106,50 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return void |
108 | 108 | */ |
109 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
109 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
110 | 110 | |
111 | - $payment_id = absint( $payment_id ); |
|
111 | + $payment_id = absint($payment_id); |
|
112 | 112 | |
113 | - if ( empty( $payment_id ) ) { |
|
113 | + if (empty($payment_id)) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
117 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
118 | 118 | return; |
119 | 119 | } |
120 | 120 | |
121 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
122 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
121 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
122 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
123 | 123 | |
124 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
125 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
124 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
125 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
126 | 126 | |
127 | 127 | /* translators: %s: payment id */ |
128 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
129 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
130 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
128 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
129 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
130 | + $subject = give_do_email_tags($subject, $payment_id); |
|
131 | 131 | |
132 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
133 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
132 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
133 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
134 | 134 | //$headers .= "MIME-Version: 1.0\r\n"; |
135 | 135 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
136 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
136 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
137 | 137 | |
138 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
138 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
139 | 139 | |
140 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
140 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
141 | 141 | |
142 | 142 | $emails = Give()->emails; |
143 | - $emails->__set( 'from_name', $from_name ); |
|
144 | - $emails->__set( 'from_email', $from_email ); |
|
145 | - $emails->__set( 'headers', $headers ); |
|
146 | - $emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) ); |
|
143 | + $emails->__set('from_name', $from_name); |
|
144 | + $emails->__set('from_email', $from_email); |
|
145 | + $emails->__set('headers', $headers); |
|
146 | + $emails->__set('heading', esc_html__('New Donation!', 'give')); |
|
147 | 147 | |
148 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
148 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | |
152 | -add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 ); |
|
152 | +add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings). |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | |
162 | 162 | $email_option = give_get_option('admin_notice_emails'); |
163 | 163 | |
164 | - $emails = !empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' ); |
|
165 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
164 | + $emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email'); |
|
165 | + $emails = array_map('trim', explode("\n", $emails)); |
|
166 | 166 | |
167 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
167 | + return apply_filters('give_admin_notice_emails', $emails); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return mixed |
178 | 178 | */ |
179 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
179 | +function give_admin_notices_disabled($payment_id = 0) { |
|
180 | 180 | |
181 | - $retval = give_get_option( 'disable_admin_notices' ); |
|
181 | + $retval = give_get_option('disable_admin_notices'); |
|
182 | 182 | |
183 | - return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id ); |
|
183 | + return apply_filters('give_admin_notices_disabled', $retval, $payment_id); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -193,19 +193,19 @@ discard block |
||
193 | 193 | */ |
194 | 194 | function give_get_default_donation_notification_email() { |
195 | 195 | |
196 | - $default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n"; |
|
197 | - $default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
198 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
|
199 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
200 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
201 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n"; |
|
202 | - $default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n"; |
|
203 | - $default_email_body .= '{sitename}' . "\n"; |
|
196 | + $default_email_body = esc_html__('Hi there,', 'give')."\n\n"; |
|
197 | + $default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website: ', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
198 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n"; |
|
199 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
200 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
201 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n"; |
|
202 | + $default_email_body .= esc_html__('Thank you,', 'give')."\n\n"; |
|
203 | + $default_email_body .= '{sitename}'."\n"; |
|
204 | 204 | |
205 | - $custom_message = give_get_option( 'donation_notification' ); |
|
206 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
205 | + $custom_message = give_get_option('donation_notification'); |
|
206 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
207 | 207 | |
208 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
208 | + return apply_filters('give_default_donation_notification_email', $message); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -219,25 +219,25 @@ discard block |
||
219 | 219 | */ |
220 | 220 | function give_get_default_donation_receipt_email() { |
221 | 221 | |
222 | - $default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n"; |
|
223 | - $default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
224 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
225 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
226 | - $default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
|
227 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
228 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n"; |
|
229 | - $default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n"; |
|
230 | - $default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n"; |
|
231 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
222 | + $default_email_body = esc_html__('Dear', 'give')." {name},\n\n"; |
|
223 | + $default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
224 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
225 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
226 | + $default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n"; |
|
227 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
228 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n"; |
|
229 | + $default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n"; |
|
230 | + $default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n"; |
|
231 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
232 | 232 | $default_email_body .= "\n\n"; |
233 | - $default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n"; |
|
234 | - $default_email_body .= '{sitename}' . "\n"; |
|
233 | + $default_email_body .= esc_html__('Sincerely,', 'give')."\n"; |
|
234 | + $default_email_body .= '{sitename}'."\n"; |
|
235 | 235 | |
236 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
236 | + $custom_message = give_get_option('donation_receipt'); |
|
237 | 237 | |
238 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
238 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
239 | 239 | |
240 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
240 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -249,19 +249,19 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return array $email_names |
251 | 251 | */ |
252 | -function give_get_email_names( $user_info ) { |
|
252 | +function give_get_email_names($user_info) { |
|
253 | 253 | $email_names = array(); |
254 | - $user_info = maybe_unserialize( $user_info ); |
|
254 | + $user_info = maybe_unserialize($user_info); |
|
255 | 255 | |
256 | 256 | $email_names['fullname'] = ''; |
257 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
258 | - $user_data = get_userdata( $user_info['id'] ); |
|
257 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
258 | + $user_data = get_userdata($user_info['id']); |
|
259 | 259 | $email_names['name'] = $user_info['first_name']; |
260 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
260 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
261 | 261 | $email_names['username'] = $user_data->user_login; |
262 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
262 | + } elseif (isset($user_info['first_name'])) { |
|
263 | 263 | $email_names['name'] = $user_info['first_name']; |
264 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
264 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
265 | 265 | $email_names['username'] = $user_info['first_name']; |
266 | 266 | } else { |
267 | 267 | $email_names['name'] = $user_info['email']; |
@@ -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 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string $message Fully formatted message |
43 | 43 | */ |
44 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
45 | - return give_do_email_tags( $message, $payment_id ); |
|
44 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
45 | + return give_do_email_tags($message, $payment_id); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -56,38 +56,38 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return string $message Fully formatted message |
58 | 58 | */ |
59 | -function give_email_preview_template_tags( $message ) { |
|
59 | +function give_email_preview_template_tags($message) { |
|
60 | 60 | |
61 | - $price = give_currency_filter( give_format_amount( 10.50 ) ); |
|
61 | + $price = give_currency_filter(give_format_amount(10.50)); |
|
62 | 62 | |
63 | 63 | $gateway = 'PayPal'; |
64 | 64 | |
65 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
65 | + $receipt_id = strtolower(md5(uniqid())); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | 68 | |
69 | 69 | $receipt_link = sprintf( |
70 | 70 | '<a href="%1$s">%2$s</a>', |
71 | - esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ), |
|
72 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
71 | + esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())), |
|
72 | + esc_html__('View the receipt in your browser »', 'give') |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | $user = wp_get_current_user(); |
76 | 76 | |
77 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
78 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
79 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
80 | - $message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message ); |
|
81 | - $message = str_replace( '{amount}', $price, $message ); |
|
82 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
83 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
84 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
85 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
86 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
87 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
88 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
89 | - |
|
90 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
77 | + $message = str_replace('{name}', $user->display_name, $message); |
|
78 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
79 | + $message = str_replace('{username}', $user->user_login, $message); |
|
80 | + $message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message); |
|
81 | + $message = str_replace('{amount}', $price, $message); |
|
82 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
83 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
84 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
85 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
86 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
87 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
88 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
89 | + |
|
90 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -99,23 +99,23 @@ discard block |
||
99 | 99 | * @since 1.0 |
100 | 100 | * @return array|bool |
101 | 101 | */ |
102 | -function give_email_template_preview( $array ) { |
|
102 | +function give_email_template_preview($array) { |
|
103 | 103 | |
104 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
104 | + if ( ! current_user_can('manage_give_settings')) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | $custom_field = array( |
108 | - 'name' => esc_html__( 'Preview Email', 'give' ), |
|
109 | - 'desc' => esc_html__( 'Click the buttons to preview emails.', 'give' ), |
|
108 | + 'name' => esc_html__('Preview Email', 'give'), |
|
109 | + 'desc' => esc_html__('Click the buttons to preview emails.', 'give'), |
|
110 | 110 | 'id' => 'give_email_preview_buttons', |
111 | 111 | 'type' => 'email_preview_buttons' |
112 | 112 | ); |
113 | 113 | |
114 | - return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) ); |
|
114 | + return give_settings_array_insert($array, 'donation_subject', array($custom_field)); |
|
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
118 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Output Email Template Preview Buttons. |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | function give_email_preview_buttons_callback() { |
128 | 128 | ob_start(); |
129 | 129 | ?> |
130 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e( 'Donation Receipt Preview', 'give' ); ?> "><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
131 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
130 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e('Donation Receipt Preview', 'give'); ?> "><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
131 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
132 | 132 | 'give_action' => 'send_test_email', |
133 | 133 | 'give-message' => 'sent-test-email', |
134 | 134 | 'tag' => 'emails' |
135 | - ) ), 'give-test-email' ); ?>" title="<?php esc_attr_e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
135 | + )), 'give-test-email'); ?>" title="<?php esc_attr_e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
136 | 136 | <?php |
137 | 137 | echo ob_get_clean(); |
138 | 138 | } |
@@ -145,46 +145,46 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function give_display_email_template_preview() { |
147 | 147 | |
148 | - if ( empty( $_GET['give_action'] ) ) { |
|
148 | + if (empty($_GET['give_action'])) { |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
152 | + if ('preview_email' !== $_GET['give_action']) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
156 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
156 | + if ( ! current_user_can('manage_give_settings')) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | - Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' ); |
|
161 | + Give()->emails->heading = esc_html__('Donation Receipt', 'give'); |
|
162 | 162 | |
163 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
163 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
164 | 164 | |
165 | 165 | echo give_get_preview_email_header(); |
166 | 166 | |
167 | 167 | //Are we previewing an actual payment? |
168 | - if ( ! empty( $payment_id ) ) { |
|
168 | + if ( ! empty($payment_id)) { |
|
169 | 169 | |
170 | - $content = give_get_email_body_content( $payment_id ); |
|
170 | + $content = give_get_email_body_content($payment_id); |
|
171 | 171 | |
172 | - $preview_content = give_do_email_tags( $content, $payment_id ); |
|
172 | + $preview_content = give_do_email_tags($content, $payment_id); |
|
173 | 173 | |
174 | 174 | } else { |
175 | 175 | |
176 | 176 | //No payment ID, use sample preview content |
177 | - $preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
177 | + $preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
181 | - echo Give()->emails->build_email( $preview_content ); |
|
181 | + echo Give()->emails->build_email($preview_content); |
|
182 | 182 | |
183 | 183 | exit; |
184 | 184 | |
185 | 185 | } |
186 | 186 | |
187 | -add_action( 'init', 'give_display_email_template_preview' ); |
|
187 | +add_action('init', 'give_display_email_template_preview'); |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Email Template Body. |
@@ -196,18 +196,18 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return string $email_body Body of the email |
198 | 198 | */ |
199 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
199 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
200 | 200 | |
201 | 201 | $default_email_body = give_get_default_donation_receipt_email(); |
202 | 202 | |
203 | - $email_content = give_get_option( 'donation_receipt' ); |
|
204 | - $email_content = isset( $email_content ) ? stripslashes( $email_content ) : $default_email_body; |
|
203 | + $email_content = give_get_option('donation_receipt'); |
|
204 | + $email_content = isset($email_content) ? stripslashes($email_content) : $default_email_body; |
|
205 | 205 | |
206 | - $email_body = wpautop( $email_content ); |
|
206 | + $email_body = wpautop($email_content); |
|
207 | 207 | |
208 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
208 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
209 | 209 | |
210 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
210 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -220,37 +220,37 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string $email_body Body of the email |
222 | 222 | */ |
223 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
223 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
224 | 224 | |
225 | - $user_info = maybe_unserialize( $payment_data['user_info'] ); |
|
226 | - $email = give_get_payment_user_email( $payment_id ); |
|
225 | + $user_info = maybe_unserialize($payment_data['user_info']); |
|
226 | + $email = give_get_payment_user_email($payment_id); |
|
227 | 227 | |
228 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
229 | - $user_data = get_userdata( $user_info['id'] ); |
|
228 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
229 | + $user_data = get_userdata($user_info['id']); |
|
230 | 230 | $name = $user_data->display_name; |
231 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
232 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
231 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
232 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
233 | 233 | } else { |
234 | 234 | $name = $email; |
235 | 235 | } |
236 | 236 | |
237 | - $gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) ); |
|
237 | + $gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true)); |
|
238 | 238 | |
239 | - $default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n"; |
|
240 | - $default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n"; |
|
239 | + $default_email_body = esc_html__('Hello', 'give')."\n\n"; |
|
240 | + $default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n"; |
|
241 | 241 | /* translators: %s: form plural label */ |
242 | - $default_email_body .= sprintf( esc_html__( '%s sold:', 'give' ), give_get_forms_label_plural() ) . "\n\n"; |
|
243 | - $default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
244 | - $default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
245 | - $default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n"; |
|
246 | - $default_email_body .= esc_html__( 'Thank you', 'give' ); |
|
242 | + $default_email_body .= sprintf(esc_html__('%s sold:', 'give'), give_get_forms_label_plural())."\n\n"; |
|
243 | + $default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
244 | + $default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n"; |
|
245 | + $default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n"; |
|
246 | + $default_email_body .= esc_html__('Thank you', 'give'); |
|
247 | 247 | |
248 | - $email = give_get_option( 'donation_notification' ); |
|
249 | - $email = isset( $email ) ? stripslashes( $email ) : $default_email_body; |
|
248 | + $email = give_get_option('donation_notification'); |
|
249 | + $email = isset($email) ? stripslashes($email) : $default_email_body; |
|
250 | 250 | |
251 | - $email_body = give_do_email_tags( $email, $payment_id ); |
|
251 | + $email_body = give_do_email_tags($email, $payment_id); |
|
252 | 252 | |
253 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
253 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -263,34 +263,34 @@ discard block |
||
263 | 263 | * @since 1.0 |
264 | 264 | */ |
265 | 265 | function give_render_receipt_in_browser() { |
266 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
267 | - wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
266 | + if ( ! isset($_GET['payment_key'])) { |
|
267 | + wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
268 | 268 | } |
269 | 269 | |
270 | - $key = urlencode( $_GET['payment_key'] ); |
|
270 | + $key = urlencode($_GET['payment_key']); |
|
271 | 271 | |
272 | 272 | ob_start(); |
273 | 273 | //Disallows caching of the page |
274 | - header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); |
|
275 | - header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 |
|
276 | - header( "Cache-Control: post-check=0, pre-check=0", false ); |
|
277 | - header( "Pragma: no-cache" ); // HTTP/1.0 |
|
278 | - header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past |
|
274 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
275 | + header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
|
276 | + header("Cache-Control: post-check=0, pre-check=0", false); |
|
277 | + header("Pragma: no-cache"); // HTTP/1.0 |
|
278 | + header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past |
|
279 | 279 | ?> |
280 | 280 | <!DOCTYPE html> |
281 | 281 | <html lang="en"> |
282 | 282 | <head> |
283 | - <?php do_action( 'give_receipt_head' ); ?> |
|
283 | + <?php do_action('give_receipt_head'); ?> |
|
284 | 284 | </head> |
285 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
285 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
286 | 286 | |
287 | 287 | <div id="give_receipt_wrapper"> |
288 | - <?php do_action( 'give_render_receipt_in_browser_before' ); ?> |
|
289 | - <?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?> |
|
290 | - <?php do_action( 'give_render_receipt_in_browser_after' ); ?> |
|
288 | + <?php do_action('give_render_receipt_in_browser_before'); ?> |
|
289 | + <?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?> |
|
290 | + <?php do_action('give_render_receipt_in_browser_after'); ?> |
|
291 | 291 | </div> |
292 | 292 | |
293 | - <?php do_action( 'give_receipt_footer' ); ?> |
|
293 | + <?php do_action('give_receipt_footer'); ?> |
|
294 | 294 | </body> |
295 | 295 | </html> |
296 | 296 | <?php |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | die(); |
299 | 299 | } |
300 | 300 | |
301 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
301 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
|
302 | 302 | |
303 | 303 | |
304 | 304 | /** |
@@ -313,31 +313,31 @@ discard block |
||
313 | 313 | |
314 | 314 | //Payment receipt switcher |
315 | 315 | $payment_count = give_count_payments()->publish; |
316 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
316 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
317 | 317 | |
318 | - if ( $payment_count <= 0 ) { |
|
318 | + if ($payment_count <= 0) { |
|
319 | 319 | return false; |
320 | 320 | } |
321 | 321 | |
322 | 322 | //Get payments. |
323 | - $payments = new Give_Payments_Query( array( |
|
323 | + $payments = new Give_Payments_Query(array( |
|
324 | 324 | 'number' => 100 |
325 | - ) ); |
|
325 | + )); |
|
326 | 326 | $payments = $payments->get_payments(); |
327 | 327 | $options = array(); |
328 | 328 | |
329 | 329 | //Provide nice human readable options. |
330 | - if ( $payments ) { |
|
330 | + if ($payments) { |
|
331 | 331 | $options[0] = |
332 | 332 | /* translators: %s: transaction singular label */ |
333 | - esc_html__( '- Select a transaction -', 'give' ); |
|
334 | - foreach ( $payments as $payment ) { |
|
333 | + esc_html__('- Select a transaction -', 'give'); |
|
334 | + foreach ($payments as $payment) { |
|
335 | 335 | |
336 | - $options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
336 | + $options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
337 | 337 | |
338 | 338 | } |
339 | 339 | } else { |
340 | - $options[0] = esc_html__( 'No Transactions Found', 'give' ); |
|
340 | + $options[0] = esc_html__('No Transactions Found', 'give'); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | //Start constructing HTML output. |
@@ -350,16 +350,16 @@ discard block |
||
350 | 350 | var selected_trans = transactions.options[transactions.selectedIndex]; |
351 | 351 | console.log(selected_trans); |
352 | 352 | if (selected_trans){ |
353 | - var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value; |
|
353 | + var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value; |
|
354 | 354 | window.location = url_string; |
355 | 355 | } |
356 | 356 | } |
357 | 357 | </script>'; |
358 | 358 | |
359 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a transaction:', 'give' ) . '</label>'; |
|
359 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a transaction:', 'give').'</label>'; |
|
360 | 360 | |
361 | 361 | //The select field with 100 latest transactions |
362 | - $transaction_header .= Give()->html->select( array( |
|
362 | + $transaction_header .= Give()->html->select(array( |
|
363 | 363 | 'name' => 'preview_email_payment_id', |
364 | 364 | 'selected' => $payment_id, |
365 | 365 | 'id' => 'give_preview_email_payment_id', |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | 'select_atts' => 'onchange="change_preview()">', |
370 | 370 | 'show_option_all' => false, |
371 | 371 | 'show_option_none' => false |
372 | - ) ); |
|
372 | + )); |
|
373 | 373 | |
374 | 374 | //Closing tag |
375 | 375 | $transaction_header .= '</div>'; |
376 | 376 | |
377 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
377 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
378 | 378 | |
379 | 379 | } |
380 | 380 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | function give_receipt_head_content() { |
389 | 389 | |
390 | 390 | //Title. |
391 | - $output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>'; |
|
391 | + $output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>'; |
|
392 | 392 | |
393 | 393 | //Meta. |
394 | 394 | $output .= '<meta charset="utf-8"/> |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | <meta name="robots" content="noindex, nofollow"/>'; |
403 | 403 | |
404 | 404 | //CSS |
405 | - $output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">'; |
|
405 | + $output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">'; |
|
406 | 406 | |
407 | - echo apply_filters( 'give_receipt_head_content', $output ); |
|
407 | + echo apply_filters('give_receipt_head_content', $output); |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | |
411 | -add_action( 'give_receipt_head', 'give_receipt_head_content' ); |
|
412 | 411 | \ No newline at end of file |
412 | +add_action('give_receipt_head', 'give_receipt_head_content'); |
|
413 | 413 | \ 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 | |
@@ -26,94 +26,94 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function give_load_scripts() { |
28 | 28 | |
29 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
30 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
31 | - $scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false; |
|
29 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
30 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
31 | + $scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false; |
|
32 | 32 | |
33 | 33 | // Use minified libraries if SCRIPT_DEBUG is turned off |
34 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
34 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
35 | 35 | |
36 | 36 | //Localize / PHP to AJAX vars |
37 | - $localize_give_checkout = apply_filters( 'give_global_script_vars', array( |
|
37 | + $localize_give_checkout = apply_filters('give_global_script_vars', array( |
|
38 | 38 | 'ajaxurl' => give_get_ajax_url(), |
39 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
40 | - 'currency_sign' => give_currency_filter( '' ), |
|
39 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
40 | + 'currency_sign' => give_currency_filter(''), |
|
41 | 41 | 'currency_pos' => give_get_currency_position(), |
42 | 42 | 'thousands_separator' => give_get_price_thousand_separator(), |
43 | 43 | 'decimal_separator' => give_get_price_decimal_separator(), |
44 | - 'no_gateway' => esc_html__( 'Please select a payment method.', 'give' ), |
|
45 | - 'bad_minimum' => esc_html__( 'The minimum donation amount for this form is', 'give' ), |
|
46 | - 'general_loading' => esc_html__( 'Loading...', 'give' ), |
|
47 | - 'purchase_loading' => esc_html__( 'Please Wait...', 'give' ), |
|
44 | + 'no_gateway' => esc_html__('Please select a payment method.', 'give'), |
|
45 | + 'bad_minimum' => esc_html__('The minimum donation amount for this form is', 'give'), |
|
46 | + 'general_loading' => esc_html__('Loading...', 'give'), |
|
47 | + 'purchase_loading' => esc_html__('Please Wait...', 'give'), |
|
48 | 48 | 'number_decimals' => give_get_price_decimals(), |
49 | 49 | 'give_version' => GIVE_VERSION |
50 | - ) ); |
|
51 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
50 | + )); |
|
51 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
52 | 52 | 'ajaxurl' => give_get_ajax_url(), |
53 | - 'loading' => esc_html__( 'Loading', 'give' ), |
|
53 | + 'loading' => esc_html__('Loading', 'give'), |
|
54 | 54 | // General loading message |
55 | - 'select_option' => esc_html__( 'Please select an option', 'give' ), |
|
55 | + 'select_option' => esc_html__('Please select an option', 'give'), |
|
56 | 56 | // Variable pricing error with multi-purchase option enabled |
57 | - 'default_gateway' => give_get_default_gateway( null ), |
|
58 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
57 | + 'default_gateway' => give_get_default_gateway(null), |
|
58 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
59 | 59 | 'number_decimals' => give_get_price_decimals() |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | |
62 | 62 | //DEBUG is On |
63 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
63 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
64 | 64 | |
65 | - if ( give_is_cc_verify_enabled() ) { |
|
66 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
67 | - wp_enqueue_script( 'give-cc-validator' ); |
|
65 | + if (give_is_cc_verify_enabled()) { |
|
66 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
67 | + wp_enqueue_script('give-cc-validator'); |
|
68 | 68 | } |
69 | 69 | |
70 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
71 | - wp_enqueue_script( 'give-float-labels' ); |
|
70 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
71 | + wp_enqueue_script('give-float-labels'); |
|
72 | 72 | |
73 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
74 | - wp_enqueue_script( 'give-blockui' ); |
|
73 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
74 | + wp_enqueue_script('give-blockui'); |
|
75 | 75 | |
76 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
77 | - wp_enqueue_script( 'give-qtip' ); |
|
76 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
77 | + wp_enqueue_script('give-qtip'); |
|
78 | 78 | |
79 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
80 | - wp_enqueue_script( 'give-accounting' ); |
|
79 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
80 | + wp_enqueue_script('give-accounting'); |
|
81 | 81 | |
82 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
83 | - wp_enqueue_script( 'give-magnific' ); |
|
82 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
83 | + wp_enqueue_script('give-magnific'); |
|
84 | 84 | |
85 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
86 | - wp_enqueue_script( 'give-checkout-global' ); |
|
85 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
86 | + wp_enqueue_script('give-checkout-global'); |
|
87 | 87 | |
88 | 88 | //General scripts |
89 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
90 | - wp_enqueue_script( 'give-scripts' ); |
|
89 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
90 | + wp_enqueue_script('give-scripts'); |
|
91 | 91 | |
92 | 92 | // Load AJAX scripts, if enabled |
93 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
94 | - wp_enqueue_script( 'give-ajax' ); |
|
93 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
94 | + wp_enqueue_script('give-ajax'); |
|
95 | 95 | |
96 | 96 | //Localize / Pass AJAX vars from PHP |
97 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout ); |
|
98 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
97 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout); |
|
98 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
99 | 99 | |
100 | 100 | |
101 | 101 | } else { |
102 | 102 | |
103 | 103 | //DEBUG is OFF (one JS file to rule them all!) |
104 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
105 | - wp_enqueue_script( 'give' ); |
|
104 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
105 | + wp_enqueue_script('give'); |
|
106 | 106 | |
107 | 107 | //Localize / Pass AJAX vars from PHP |
108 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout ); |
|
109 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
108 | + wp_localize_script('give', 'give_global_vars', $localize_give_checkout); |
|
109 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
110 | 110 | |
111 | 111 | } |
112 | 112 | |
113 | 113 | |
114 | 114 | } |
115 | 115 | |
116 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
116 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Register styles. |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | */ |
126 | 126 | function give_register_styles() { |
127 | 127 | |
128 | - if ( give_get_option( 'disable_css', false ) ) { |
|
128 | + if (give_get_option('disable_css', false)) { |
|
129 | 129 | return; |
130 | 130 | } |
131 | 131 | |
132 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
133 | - wp_enqueue_style( 'give-styles' ); |
|
132 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
133 | + wp_enqueue_style('give-styles'); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
137 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | /** |
@@ -146,39 +146,39 @@ discard block |
||
146 | 146 | function give_get_stylesheet_uri() { |
147 | 147 | |
148 | 148 | // Use minified libraries if SCRIPT_DEBUG is turned off |
149 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
149 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
150 | 150 | |
151 | - $file = 'give' . $suffix . '.css'; |
|
151 | + $file = 'give'.$suffix.'.css'; |
|
152 | 152 | $templates_dir = give_get_theme_template_dir_name(); |
153 | 153 | |
154 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
155 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css'; |
|
156 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
157 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css'; |
|
158 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
154 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
155 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css'; |
|
156 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
157 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css'; |
|
158 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
159 | 159 | |
160 | 160 | $uri = false; |
161 | 161 | |
162 | 162 | // Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory |
163 | 163 | // Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
164 | 164 | // This allows users to copy just give.css to their theme |
165 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
166 | - if ( ! empty( $nonmin ) ) { |
|
167 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css'; |
|
165 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
166 | + if ( ! empty($nonmin)) { |
|
167 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css'; |
|
168 | 168 | } else { |
169 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
169 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
170 | 170 | } |
171 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
172 | - if ( ! empty( $nonmin ) ) { |
|
173 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css'; |
|
171 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
172 | + if ( ! empty($nonmin)) { |
|
173 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css'; |
|
174 | 174 | } else { |
175 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
175 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
176 | 176 | } |
177 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
178 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
177 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
178 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
179 | 179 | } |
180 | 180 | |
181 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
181 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
182 | 182 | |
183 | 183 | } |
184 | 184 | |
@@ -196,65 +196,65 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return void |
198 | 198 | */ |
199 | -function give_load_admin_scripts( $hook ) { |
|
199 | +function give_load_admin_scripts($hook) { |
|
200 | 200 | |
201 | 201 | global $wp_version, $post, $post_type, $give_options; |
202 | 202 | |
203 | 203 | //Directories of assets |
204 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
205 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
206 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
204 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
205 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
206 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
207 | 207 | |
208 | 208 | // Use minified libraries if SCRIPT_DEBUG is turned off |
209 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
209 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
210 | 210 | |
211 | 211 | //Global Admin: |
212 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
213 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
212 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
213 | + wp_enqueue_style('give-admin-bar-notification'); |
|
214 | 214 | |
215 | 215 | //Give Admin Only: |
216 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
216 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
217 | 217 | return; |
218 | 218 | } |
219 | 219 | |
220 | 220 | //CSS |
221 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
222 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
223 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION ); |
|
224 | - wp_enqueue_style( 'give-admin' ); |
|
225 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
226 | - wp_enqueue_style( 'jquery-chosen' ); |
|
227 | - wp_enqueue_style( 'thickbox' ); |
|
221 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
222 | + wp_enqueue_style('jquery-ui-css'); |
|
223 | + wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION); |
|
224 | + wp_enqueue_style('give-admin'); |
|
225 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
226 | + wp_enqueue_style('jquery-chosen'); |
|
227 | + wp_enqueue_style('thickbox'); |
|
228 | 228 | |
229 | 229 | //JS |
230 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
231 | - wp_enqueue_script( 'jquery-chosen' ); |
|
230 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
231 | + wp_enqueue_script('jquery-chosen'); |
|
232 | 232 | |
233 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
234 | - wp_enqueue_script( 'give-accounting' ); |
|
233 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
234 | + wp_enqueue_script('give-accounting'); |
|
235 | 235 | |
236 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
237 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
236 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
237 | + wp_enqueue_script('give-admin-scripts'); |
|
238 | 238 | |
239 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
240 | - wp_enqueue_script( 'jquery-flot' ); |
|
239 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
240 | + wp_enqueue_script('jquery-flot'); |
|
241 | 241 | |
242 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
243 | - wp_enqueue_script( 'give-qtip' ); |
|
242 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
243 | + wp_enqueue_script('give-qtip'); |
|
244 | 244 | |
245 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
246 | - wp_enqueue_script( 'thickbox' ); |
|
245 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
246 | + wp_enqueue_script('thickbox'); |
|
247 | 247 | |
248 | 248 | // Forms CPT Script. |
249 | - if ( $post_type === 'give_forms' ) { |
|
250 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
251 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
249 | + if ($post_type === 'give_forms') { |
|
250 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
251 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | //Settings Scripts |
255 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
256 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
257 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
255 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
256 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
257 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | // Price Separators. |
@@ -262,50 +262,50 @@ discard block |
||
262 | 262 | $decimal_separator = give_get_price_decimal_separator(); |
263 | 263 | |
264 | 264 | //Localize strings & variables for JS |
265 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
266 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
265 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
266 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
267 | 267 | 'give_version' => GIVE_VERSION, |
268 | 268 | 'thousands_separator' => $thousand_separator, |
269 | 269 | 'decimal_separator' => $decimal_separator, |
270 | - 'quick_edit_warning' => esc_html__( 'Sorry, not available for variable priced forms.', 'give' ), |
|
271 | - 'delete_payment' => esc_html__( 'Are you sure you wish to delete this payment?', 'give' ), |
|
272 | - 'delete_payment_note' => esc_html__( 'Are you sure you wish to delete this note?', 'give' ), |
|
273 | - 'revoke_api_key' => esc_html__( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
274 | - 'regenerate_api_key' => esc_html__( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
275 | - 'resend_receipt' => esc_html__( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
276 | - 'copy_download_link_text' => esc_html__( 'Copy these links to your clipboard and give them to your donor.', 'give' ), |
|
270 | + 'quick_edit_warning' => esc_html__('Sorry, not available for variable priced forms.', 'give'), |
|
271 | + 'delete_payment' => esc_html__('Are you sure you wish to delete this payment?', 'give'), |
|
272 | + 'delete_payment_note' => esc_html__('Are you sure you wish to delete this note?', 'give'), |
|
273 | + 'revoke_api_key' => esc_html__('Are you sure you wish to revoke this API key?', 'give'), |
|
274 | + 'regenerate_api_key' => esc_html__('Are you sure you wish to regenerate this API key?', 'give'), |
|
275 | + 'resend_receipt' => esc_html__('Are you sure you wish to resend the donation receipt?', 'give'), |
|
276 | + 'copy_download_link_text' => esc_html__('Copy these links to your clipboard and give them to your donor.', 'give'), |
|
277 | 277 | /* translators: %s: form singular label */ |
278 | - 'delete_payment_download' => sprintf( esc_html__( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ), |
|
279 | - 'one_price_min' => esc_html__( 'You must have at least one price.', 'give' ), |
|
280 | - 'one_file_min' => esc_html__( 'You must have at least one file.', 'give' ), |
|
281 | - 'one_field_min' => esc_html__( 'You must have at least one field.', 'give' ), |
|
278 | + 'delete_payment_download' => sprintf(esc_html__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()), |
|
279 | + 'one_price_min' => esc_html__('You must have at least one price.', 'give'), |
|
280 | + 'one_file_min' => esc_html__('You must have at least one file.', 'give'), |
|
281 | + 'one_field_min' => esc_html__('You must have at least one field.', 'give'), |
|
282 | 282 | /* translators: %s: form singular label */ |
283 | - 'one_option' => sprintf( esc_html__( 'Choose a %s', 'give' ), give_get_forms_label_singular() ), |
|
283 | + 'one_option' => sprintf(esc_html__('Choose a %s', 'give'), give_get_forms_label_singular()), |
|
284 | 284 | /* translators: %s: form plural label */ |
285 | - 'one_or_more_option' => sprintf( esc_html__( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ), |
|
286 | - 'numeric_item_price' => esc_html__( 'Item price must be numeric.', 'give' ), |
|
287 | - 'numeric_quantity' => esc_html__( 'Quantity must be numeric.', 'give' ), |
|
288 | - 'currency_sign' => give_currency_filter( '' ), |
|
289 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
290 | - 'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
291 | - 'new_media_ui' => apply_filters( 'give_use_35_media_ui', 1 ), |
|
292 | - 'remove_text' => esc_html__( 'Remove', 'give' ), |
|
285 | + 'one_or_more_option' => sprintf(esc_html__('Choose one or more %s', 'give'), give_get_forms_label_plural()), |
|
286 | + 'numeric_item_price' => esc_html__('Item price must be numeric.', 'give'), |
|
287 | + 'numeric_quantity' => esc_html__('Quantity must be numeric.', 'give'), |
|
288 | + 'currency_sign' => give_currency_filter(''), |
|
289 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
290 | + 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), |
|
291 | + 'new_media_ui' => apply_filters('give_use_35_media_ui', 1), |
|
292 | + 'remove_text' => esc_html__('Remove', 'give'), |
|
293 | 293 | /* translators: %s: form plural label */ |
294 | - 'type_to_search' => sprintf( esc_html__( 'Type to search %s', 'give' ), give_get_forms_label_plural() ), |
|
295 | - 'batch_export_no_class' => esc_html__( 'You must choose a method.', 'give' ), |
|
296 | - 'batch_export_no_reqs' => esc_html__( 'Required fields not completed.', 'give' ), |
|
297 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
298 | - 'price_format_guide' => sprintf( esc_html__( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ) |
|
299 | - ) ); |
|
300 | - |
|
301 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) { |
|
294 | + 'type_to_search' => sprintf(esc_html__('Type to search %s', 'give'), give_get_forms_label_plural()), |
|
295 | + 'batch_export_no_class' => esc_html__('You must choose a method.', 'give'), |
|
296 | + 'batch_export_no_reqs' => esc_html__('Required fields not completed.', 'give'), |
|
297 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
298 | + 'price_format_guide' => sprintf(esc_html__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator) |
|
299 | + )); |
|
300 | + |
|
301 | + if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) { |
|
302 | 302 | //call for new media manager |
303 | 303 | wp_enqueue_media(); |
304 | 304 | } |
305 | 305 | |
306 | 306 | } |
307 | 307 | |
308 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
308 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
309 | 309 | |
310 | 310 | /** |
311 | 311 | * Admin Give Icon |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | ?> |
323 | 323 | <style type="text/css" media="screen"> |
324 | 324 | |
325 | - <?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?> |
|
325 | + <?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?> |
|
326 | 326 | @font-face { |
327 | 327 | font-family: 'give-icomoon'; |
328 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
329 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
330 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
331 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
328 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
329 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
330 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
331 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
332 | 332 | font-weight: normal; |
333 | 333 | font-style: normal; |
334 | 334 | } |
@@ -347,4 +347,4 @@ discard block |
||
347 | 347 | <?php |
348 | 348 | } |
349 | 349 | |
350 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
350 | +add_action('admin_head', 'give_admin_icon'); |
@@ -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 | |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return object $payments Payments retrieved from the database |
45 | 45 | */ |
46 | -function give_get_payments( $args = array() ) { |
|
46 | +function give_get_payments($args = array()) { |
|
47 | 47 | |
48 | 48 | // Fallback to post objects to ensure backwards compatibility |
49 | - if ( ! isset( $args['output'] ) ) { |
|
49 | + if ( ! isset($args['output'])) { |
|
50 | 50 | $args['output'] = 'posts'; |
51 | 51 | } |
52 | 52 | |
53 | - $args = apply_filters( 'give_get_payments_args', $args ); |
|
54 | - $payments = new Give_Payments_Query( $args ); |
|
53 | + $args = apply_filters('give_get_payments_args', $args); |
|
54 | + $payments = new Give_Payments_Query($args); |
|
55 | 55 | |
56 | 56 | return $payments->get_payments(); |
57 | 57 | } |
@@ -66,48 +66,48 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return mixed |
68 | 68 | */ |
69 | -function give_get_payment_by( $field = '', $value = '' ) { |
|
69 | +function give_get_payment_by($field = '', $value = '') { |
|
70 | 70 | |
71 | - if ( empty( $field ) || empty( $value ) ) { |
|
71 | + if (empty($field) || empty($value)) { |
|
72 | 72 | return false; |
73 | 73 | } |
74 | 74 | |
75 | - switch ( strtolower( $field ) ) { |
|
75 | + switch (strtolower($field)) { |
|
76 | 76 | |
77 | 77 | case 'id': |
78 | - $payment = new Give_Payment( $value ); |
|
78 | + $payment = new Give_Payment($value); |
|
79 | 79 | $id = $payment->ID; |
80 | 80 | |
81 | - if ( empty( $id ) ) { |
|
81 | + if (empty($id)) { |
|
82 | 82 | return false; |
83 | 83 | } |
84 | 84 | |
85 | 85 | break; |
86 | 86 | |
87 | 87 | case 'key': |
88 | - $payment = give_get_payments( array( |
|
88 | + $payment = give_get_payments(array( |
|
89 | 89 | 'meta_key' => '_give_payment_purchase_key', |
90 | 90 | 'meta_value' => $value, |
91 | 91 | 'posts_per_page' => 1, |
92 | 92 | 'fields' => 'ids', |
93 | - ) ); |
|
93 | + )); |
|
94 | 94 | |
95 | - if ( $payment ) { |
|
96 | - $payment = new Give_Payment( $payment[0] ); |
|
95 | + if ($payment) { |
|
96 | + $payment = new Give_Payment($payment[0]); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | break; |
100 | 100 | |
101 | 101 | case 'payment_number': |
102 | - $payment = give_get_payments( array( |
|
102 | + $payment = give_get_payments(array( |
|
103 | 103 | 'meta_key' => '_give_payment_number', |
104 | 104 | 'meta_value' => $value, |
105 | 105 | 'posts_per_page' => 1, |
106 | 106 | 'fields' => 'ids', |
107 | - ) ); |
|
107 | + )); |
|
108 | 108 | |
109 | - if ( $payment ) { |
|
110 | - $payment = new Give_Payment( $payment[0] ); |
|
109 | + if ($payment) { |
|
110 | + $payment = new Give_Payment($payment[0]); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | break; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
119 | - if ( $payment ) { |
|
119 | + if ($payment) { |
|
120 | 120 | return $payment; |
121 | 121 | } |
122 | 122 | |
@@ -132,23 +132,23 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return int|bool Payment ID if payment is inserted, false otherwise |
134 | 134 | */ |
135 | -function give_insert_payment( $payment_data = array() ) { |
|
135 | +function give_insert_payment($payment_data = array()) { |
|
136 | 136 | |
137 | - if ( empty( $payment_data ) ) { |
|
137 | + if (empty($payment_data)) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $payment = new Give_Payment(); |
142 | - $gateway = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : ''; |
|
143 | - $gateway = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway; |
|
144 | - $form_id = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0; |
|
145 | - $price_id = isset( $payment_data['give_price_id'] ) ? $payment_data['give_price_id'] : give_get_price_id( $payment_data['give_form_id'], $payment_data['price'] ); |
|
146 | - $form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id ); |
|
142 | + $gateway = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : ''; |
|
143 | + $gateway = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway; |
|
144 | + $form_id = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0; |
|
145 | + $price_id = isset($payment_data['give_price_id']) ? $payment_data['give_price_id'] : give_get_price_id($payment_data['give_form_id'], $payment_data['price']); |
|
146 | + $form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id); |
|
147 | 147 | |
148 | 148 | //Set properties |
149 | 149 | $payment->total = $payment_data['price']; |
150 | - $payment->status = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending'; |
|
151 | - $payment->currency = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency(); |
|
150 | + $payment->status = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending'; |
|
151 | + $payment->currency = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency(); |
|
152 | 152 | $payment->user_info = $payment_data['user_info']; |
153 | 153 | $payment->gateway = $gateway; |
154 | 154 | $payment->form_title = $form_title; |
@@ -162,40 +162,40 @@ discard block |
||
162 | 162 | $payment->ip = give_get_ip(); |
163 | 163 | $payment->key = $payment_data['purchase_key']; |
164 | 164 | $payment->mode = give_is_test_mode() ? 'test' : 'live'; |
165 | - $payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : ''; |
|
165 | + $payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : ''; |
|
166 | 166 | |
167 | 167 | //Add the donation |
168 | 168 | $args = array( |
169 | 169 | 'price' => $payment->total, |
170 | 170 | 'price_id' => $payment->price_id, |
171 | - 'fees' => isset( $payment_data['fees'] ) ? $payment_data['fees'] : array() |
|
171 | + 'fees' => isset($payment_data['fees']) ? $payment_data['fees'] : array() |
|
172 | 172 | ); |
173 | 173 | |
174 | - $payment->add_donation( $payment->form_id, $args ); |
|
174 | + $payment->add_donation($payment->form_id, $args); |
|
175 | 175 | |
176 | 176 | //Set date if present |
177 | - if ( isset( $payment_data['post_date'] ) ) { |
|
177 | + if (isset($payment_data['post_date'])) { |
|
178 | 178 | $payment->date = $payment_data['post_date']; |
179 | 179 | } |
180 | 180 | |
181 | 181 | //Handle sequential payments |
182 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
182 | + if (give_get_option('enable_sequential')) { |
|
183 | 183 | $number = give_get_next_payment_number(); |
184 | - $payment->number = give_format_payment_number( $number ); |
|
185 | - update_option( 'give_last_payment_number', $number ); |
|
184 | + $payment->number = give_format_payment_number($number); |
|
185 | + update_option('give_last_payment_number', $number); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | // Clear the user's purchased cache |
189 | - delete_transient( 'give_user_' . $payment_data['user_info']['id'] . '_purchases' ); |
|
189 | + delete_transient('give_user_'.$payment_data['user_info']['id'].'_purchases'); |
|
190 | 190 | |
191 | 191 | //Save payment |
192 | 192 | $payment->save(); |
193 | 193 | |
194 | 194 | //Hook it |
195 | - do_action( 'give_insert_payment', $payment->ID, $payment_data ); |
|
195 | + do_action('give_insert_payment', $payment->ID, $payment_data); |
|
196 | 196 | |
197 | 197 | //Return payment ID upon success |
198 | - if ( ! empty( $payment->ID ) ) { |
|
198 | + if ( ! empty($payment->ID)) { |
|
199 | 199 | return $payment->ID; |
200 | 200 | } |
201 | 201 | |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @return bool |
216 | 216 | */ |
217 | -function give_update_payment_status( $payment_id, $new_status = 'publish' ) { |
|
217 | +function give_update_payment_status($payment_id, $new_status = 'publish') { |
|
218 | 218 | |
219 | - $payment = new Give_Payment( $payment_id ); |
|
219 | + $payment = new Give_Payment($payment_id); |
|
220 | 220 | $payment->status = $new_status; |
221 | 221 | $updated = $payment->save(); |
222 | 222 | |
@@ -235,52 +235,52 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return void |
237 | 237 | */ |
238 | -function give_delete_purchase( $payment_id = 0, $update_customer = true ) { |
|
238 | +function give_delete_purchase($payment_id = 0, $update_customer = true) { |
|
239 | 239 | global $give_logs; |
240 | 240 | |
241 | - $payment = new Give_Payment( $payment_id ); |
|
242 | - $amount = give_get_payment_amount( $payment_id ); |
|
241 | + $payment = new Give_Payment($payment_id); |
|
242 | + $amount = give_get_payment_amount($payment_id); |
|
243 | 243 | $status = $payment->post_status; |
244 | - $customer_id = give_get_payment_customer_id( $payment_id ); |
|
245 | - $customer = new Give_Customer( $customer_id ); |
|
244 | + $customer_id = give_get_payment_customer_id($payment_id); |
|
245 | + $customer = new Give_Customer($customer_id); |
|
246 | 246 | |
247 | 247 | //Only undo purchases that aren't these statuses |
248 | - $dont_undo_statuses = apply_filters( 'give_undo_purchase_statuses', array( |
|
248 | + $dont_undo_statuses = apply_filters('give_undo_purchase_statuses', array( |
|
249 | 249 | 'pending', |
250 | 250 | 'cancelled' |
251 | - ) ); |
|
251 | + )); |
|
252 | 252 | |
253 | - if ( ! in_array( $status, $dont_undo_statuses ) ) { |
|
254 | - give_undo_purchase( false, $payment_id ); |
|
253 | + if ( ! in_array($status, $dont_undo_statuses)) { |
|
254 | + give_undo_purchase(false, $payment_id); |
|
255 | 255 | } |
256 | 256 | |
257 | - if ( $status == 'publish' ) { |
|
257 | + if ($status == 'publish') { |
|
258 | 258 | |
259 | 259 | // Only decrease earnings if they haven't already been decreased (or were never increased for this payment) |
260 | - give_decrease_total_earnings( $amount ); |
|
260 | + give_decrease_total_earnings($amount); |
|
261 | 261 | // Clear the This Month earnings (this_monththis_month is NOT a typo) |
262 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
262 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
263 | 263 | |
264 | - if ( $customer->id && $update_customer ) { |
|
264 | + if ($customer->id && $update_customer) { |
|
265 | 265 | |
266 | 266 | // Decrement the stats for the customer |
267 | 267 | $customer->decrease_purchase_count(); |
268 | - $customer->decrease_value( $amount ); |
|
268 | + $customer->decrease_value($amount); |
|
269 | 269 | |
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | - do_action( 'give_payment_delete', $payment_id ); |
|
273 | + do_action('give_payment_delete', $payment_id); |
|
274 | 274 | |
275 | - if ( $customer->id && $update_customer ) { |
|
275 | + if ($customer->id && $update_customer) { |
|
276 | 276 | |
277 | 277 | // Remove the payment ID from the customer |
278 | - $customer->remove_payment( $payment_id ); |
|
278 | + $customer->remove_payment($payment_id); |
|
279 | 279 | |
280 | 280 | } |
281 | 281 | |
282 | 282 | // Remove the payment |
283 | - wp_delete_post( $payment_id, true ); |
|
283 | + wp_delete_post($payment_id, true); |
|
284 | 284 | |
285 | 285 | // Remove related sale log entries |
286 | 286 | $give_logs->delete_logs( |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | ) |
295 | 295 | ); |
296 | 296 | |
297 | - do_action( 'give_payment_deleted', $payment_id ); |
|
297 | + do_action('give_payment_deleted', $payment_id); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
@@ -310,25 +310,25 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @return void |
312 | 312 | */ |
313 | -function give_undo_purchase( $form_id = false, $payment_id ) { |
|
313 | +function give_undo_purchase($form_id = false, $payment_id) { |
|
314 | 314 | |
315 | - if ( ! empty( $form_id ) ) { |
|
315 | + if ( ! empty($form_id)) { |
|
316 | 316 | $form_id = false; |
317 | - _give_deprected_argument( 'form_id', 'give_undo_purchase', '1.5' ); |
|
317 | + _give_deprected_argument('form_id', 'give_undo_purchase', '1.5'); |
|
318 | 318 | } |
319 | 319 | |
320 | - $payment = new Give_Payment( $payment_id ); |
|
320 | + $payment = new Give_Payment($payment_id); |
|
321 | 321 | |
322 | - $maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id ); |
|
323 | - if ( true === $maybe_decrease_earnings ) { |
|
322 | + $maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id); |
|
323 | + if (true === $maybe_decrease_earnings) { |
|
324 | 324 | // decrease earnings |
325 | - give_decrease_earnings( $payment->form_id, $payment->total ); |
|
325 | + give_decrease_earnings($payment->form_id, $payment->total); |
|
326 | 326 | } |
327 | 327 | |
328 | - $maybe_decrease_sales = apply_filters( 'give_decrease_sales_on_undo', true, $payment, $payment->form_id ); |
|
329 | - if ( true === $maybe_decrease_sales ) { |
|
328 | + $maybe_decrease_sales = apply_filters('give_decrease_sales_on_undo', true, $payment, $payment->form_id); |
|
329 | + if (true === $maybe_decrease_sales) { |
|
330 | 330 | // decrease purchase count |
331 | - give_decrease_purchase_count( $payment->form_id ); |
|
331 | + give_decrease_purchase_count($payment->form_id); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * |
346 | 346 | * @return array $count Number of payments sorted by payment status |
347 | 347 | */ |
348 | -function give_count_payments( $args = array() ) { |
|
348 | +function give_count_payments($args = array()) { |
|
349 | 349 | |
350 | 350 | global $wpdb; |
351 | 351 | |
@@ -357,18 +357,18 @@ discard block |
||
357 | 357 | 'form_id' => null, |
358 | 358 | ); |
359 | 359 | |
360 | - $args = wp_parse_args( $args, $defaults ); |
|
360 | + $args = wp_parse_args($args, $defaults); |
|
361 | 361 | |
362 | 362 | $select = "SELECT p.post_status,count( * ) AS num_posts"; |
363 | 363 | $join = ''; |
364 | 364 | $where = "WHERE p.post_type = 'give_payment'"; |
365 | 365 | |
366 | 366 | // Count payments for a specific user |
367 | - if ( ! empty( $args['user'] ) ) { |
|
367 | + if ( ! empty($args['user'])) { |
|
368 | 368 | |
369 | - if ( is_email( $args['user'] ) ) { |
|
369 | + if (is_email($args['user'])) { |
|
370 | 370 | $field = 'email'; |
371 | - } elseif ( is_numeric( $args['user'] ) ) { |
|
371 | + } elseif (is_numeric($args['user'])) { |
|
372 | 372 | $field = 'id'; |
373 | 373 | } else { |
374 | 374 | $field = ''; |
@@ -376,108 +376,108 @@ discard block |
||
376 | 376 | |
377 | 377 | $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
378 | 378 | |
379 | - if ( ! empty( $field ) ) { |
|
379 | + if ( ! empty($field)) { |
|
380 | 380 | $where .= " |
381 | 381 | AND m.meta_key = '_give_payment_user_{$field}' |
382 | 382 | AND m.meta_value = '{$args['user']}'"; |
383 | 383 | } |
384 | 384 | |
385 | 385 | // Count payments for a search |
386 | - } elseif ( ! empty( $args['s'] ) ) { |
|
386 | + } elseif ( ! empty($args['s'])) { |
|
387 | 387 | |
388 | - if ( is_email( $args['s'] ) || strlen( $args['s'] ) == 32 ) { |
|
388 | + if (is_email($args['s']) || strlen($args['s']) == 32) { |
|
389 | 389 | |
390 | - if ( is_email( $args['s'] ) ) { |
|
390 | + if (is_email($args['s'])) { |
|
391 | 391 | $field = '_give_payment_user_email'; |
392 | 392 | } else { |
393 | 393 | $field = '_give_payment_purchase_key'; |
394 | 394 | } |
395 | 395 | |
396 | 396 | $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
397 | - $where .= $wpdb->prepare( " |
|
397 | + $where .= $wpdb->prepare(" |
|
398 | 398 | AND m.meta_key = %s |
399 | 399 | AND m.meta_value = %s", |
400 | 400 | $field, |
401 | 401 | $args['s'] |
402 | 402 | ); |
403 | 403 | |
404 | - } elseif ( '#' == substr( $args['s'], 0, 1 ) ) { |
|
404 | + } elseif ('#' == substr($args['s'], 0, 1)) { |
|
405 | 405 | |
406 | - $search = str_replace( '#:', '', $args['s'] ); |
|
407 | - $search = str_replace( '#', '', $search ); |
|
406 | + $search = str_replace('#:', '', $args['s']); |
|
407 | + $search = str_replace('#', '', $search); |
|
408 | 408 | |
409 | 409 | $select = "SELECT p2.post_status,count( * ) AS num_posts "; |
410 | 410 | $join = "LEFT JOIN $wpdb->postmeta m ON m.meta_key = '_give_log_payment_id' AND m.post_id = p.ID "; |
411 | 411 | $join .= "INNER JOIN $wpdb->posts p2 ON m.meta_value = p2.ID "; |
412 | 412 | $where = "WHERE p.post_type = 'give_log' "; |
413 | - $where .= $wpdb->prepare( "AND p.post_parent = %d} ", $search ); |
|
413 | + $where .= $wpdb->prepare("AND p.post_parent = %d} ", $search); |
|
414 | 414 | |
415 | - } elseif ( is_numeric( $args['s'] ) ) { |
|
415 | + } elseif (is_numeric($args['s'])) { |
|
416 | 416 | |
417 | 417 | $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
418 | - $where .= $wpdb->prepare( " |
|
418 | + $where .= $wpdb->prepare(" |
|
419 | 419 | AND m.meta_key = '_give_payment_user_id' |
420 | 420 | AND m.meta_value = %d", |
421 | 421 | $args['s'] |
422 | 422 | ); |
423 | 423 | |
424 | 424 | } else { |
425 | - $search = $wpdb->esc_like( $args['s'] ); |
|
426 | - $search = '%' . $search . '%'; |
|
425 | + $search = $wpdb->esc_like($args['s']); |
|
426 | + $search = '%'.$search.'%'; |
|
427 | 427 | |
428 | - $where .= $wpdb->prepare( "AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))", $search, $search ); |
|
428 | + $where .= $wpdb->prepare("AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))", $search, $search); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | } |
432 | 432 | |
433 | - if ( ! empty( $args['form_id'] ) && is_numeric( $args['form_id'] ) ) { |
|
433 | + if ( ! empty($args['form_id']) && is_numeric($args['form_id'])) { |
|
434 | 434 | |
435 | - $where .= $wpdb->prepare( " AND p.post_parent = %d", $args['form_id'] ); |
|
435 | + $where .= $wpdb->prepare(" AND p.post_parent = %d", $args['form_id']); |
|
436 | 436 | |
437 | 437 | } |
438 | 438 | // Limit payments count by date |
439 | - if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) { |
|
439 | + if ( ! empty($args['start-date']) && false !== strpos($args['start-date'], '/')) { |
|
440 | 440 | |
441 | - $date_parts = explode( '/', $args['start-date'] ); |
|
442 | - $month = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0; |
|
443 | - $day = ! empty( $date_parts[1] ) && is_numeric( $date_parts[1] ) ? $date_parts[1] : 0; |
|
444 | - $year = ! empty( $date_parts[2] ) && is_numeric( $date_parts[2] ) ? $date_parts[2] : 0; |
|
441 | + $date_parts = explode('/', $args['start-date']); |
|
442 | + $month = ! empty($date_parts[0]) && is_numeric($date_parts[0]) ? $date_parts[0] : 0; |
|
443 | + $day = ! empty($date_parts[1]) && is_numeric($date_parts[1]) ? $date_parts[1] : 0; |
|
444 | + $year = ! empty($date_parts[2]) && is_numeric($date_parts[2]) ? $date_parts[2] : 0; |
|
445 | 445 | |
446 | - $is_date = checkdate( $month, $day, $year ); |
|
447 | - if ( false !== $is_date ) { |
|
446 | + $is_date = checkdate($month, $day, $year); |
|
447 | + if (false !== $is_date) { |
|
448 | 448 | |
449 | - $date = new DateTime( $args['start-date'] ); |
|
450 | - $where .= $wpdb->prepare( " AND p.post_date >= '%s'", $date->format( 'Y-m-d' ) ); |
|
449 | + $date = new DateTime($args['start-date']); |
|
450 | + $where .= $wpdb->prepare(" AND p.post_date >= '%s'", $date->format('Y-m-d')); |
|
451 | 451 | |
452 | 452 | } |
453 | 453 | |
454 | 454 | // Fixes an issue with the payments list table counts when no end date is specified (partiy with stats class) |
455 | - if ( empty( $args['end-date'] ) ) { |
|
455 | + if (empty($args['end-date'])) { |
|
456 | 456 | $args['end-date'] = $args['start-date']; |
457 | 457 | } |
458 | 458 | |
459 | 459 | } |
460 | 460 | |
461 | - if ( ! empty ( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) { |
|
461 | + if ( ! empty ($args['end-date']) && false !== strpos($args['end-date'], '/')) { |
|
462 | 462 | |
463 | - $date_parts = explode( '/', $args['end-date'] ); |
|
463 | + $date_parts = explode('/', $args['end-date']); |
|
464 | 464 | |
465 | - $month = ! empty( $date_parts[0] ) ? $date_parts[0] : 0; |
|
466 | - $day = ! empty( $date_parts[1] ) ? $date_parts[1] : 0; |
|
467 | - $year = ! empty( $date_parts[2] ) ? $date_parts[2] : 0; |
|
465 | + $month = ! empty($date_parts[0]) ? $date_parts[0] : 0; |
|
466 | + $day = ! empty($date_parts[1]) ? $date_parts[1] : 0; |
|
467 | + $year = ! empty($date_parts[2]) ? $date_parts[2] : 0; |
|
468 | 468 | |
469 | - $is_date = checkdate( $month, $day, $year ); |
|
470 | - if ( false !== $is_date ) { |
|
469 | + $is_date = checkdate($month, $day, $year); |
|
470 | + if (false !== $is_date) { |
|
471 | 471 | |
472 | - $date = new DateTime( $args['end-date'] ); |
|
473 | - $where .= $wpdb->prepare( " AND p.post_date <= '%s'", $date->format( 'Y-m-d' ) ); |
|
472 | + $date = new DateTime($args['end-date']); |
|
473 | + $where .= $wpdb->prepare(" AND p.post_date <= '%s'", $date->format('Y-m-d')); |
|
474 | 474 | |
475 | 475 | } |
476 | 476 | |
477 | 477 | } |
478 | 478 | |
479 | - $where = apply_filters( 'give_count_payments_where', $where ); |
|
480 | - $join = apply_filters( 'give_count_payments_join', $join ); |
|
479 | + $where = apply_filters('give_count_payments_where', $where); |
|
480 | + $join = apply_filters('give_count_payments_join', $join); |
|
481 | 481 | |
482 | 482 | $query = "$select |
483 | 483 | FROM $wpdb->posts p |
@@ -486,36 +486,36 @@ discard block |
||
486 | 486 | GROUP BY p.post_status |
487 | 487 | "; |
488 | 488 | |
489 | - $cache_key = md5( $query ); |
|
489 | + $cache_key = md5($query); |
|
490 | 490 | |
491 | - $count = wp_cache_get( $cache_key, 'counts' ); |
|
492 | - if ( false !== $count ) { |
|
491 | + $count = wp_cache_get($cache_key, 'counts'); |
|
492 | + if (false !== $count) { |
|
493 | 493 | return $count; |
494 | 494 | } |
495 | 495 | |
496 | - $count = $wpdb->get_results( $query, ARRAY_A ); |
|
496 | + $count = $wpdb->get_results($query, ARRAY_A); |
|
497 | 497 | |
498 | 498 | $stats = array(); |
499 | 499 | $statuses = get_post_stati(); |
500 | - if ( isset( $statuses['private'] ) && empty( $args['s'] ) ) { |
|
501 | - unset( $statuses['private'] ); |
|
500 | + if (isset($statuses['private']) && empty($args['s'])) { |
|
501 | + unset($statuses['private']); |
|
502 | 502 | } |
503 | 503 | |
504 | - foreach ( $statuses as $state ) { |
|
505 | - $stats[ $state ] = 0; |
|
504 | + foreach ($statuses as $state) { |
|
505 | + $stats[$state] = 0; |
|
506 | 506 | } |
507 | 507 | |
508 | - foreach ( (array) $count as $row ) { |
|
508 | + foreach ((array) $count as $row) { |
|
509 | 509 | |
510 | - if ( 'private' == $row['post_status'] && empty( $args['s'] ) ) { |
|
510 | + if ('private' == $row['post_status'] && empty($args['s'])) { |
|
511 | 511 | continue; |
512 | 512 | } |
513 | 513 | |
514 | - $stats[ $row['post_status'] ] = $row['num_posts']; |
|
514 | + $stats[$row['post_status']] = $row['num_posts']; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | $stats = (object) $stats; |
518 | - wp_cache_set( $cache_key, $stats, 'counts' ); |
|
518 | + wp_cache_set($cache_key, $stats, 'counts'); |
|
519 | 519 | |
520 | 520 | return $stats; |
521 | 521 | } |
@@ -530,12 +530,12 @@ discard block |
||
530 | 530 | * |
531 | 531 | * @return bool True if payment exists, false otherwise |
532 | 532 | */ |
533 | -function give_check_for_existing_payment( $payment_id ) { |
|
533 | +function give_check_for_existing_payment($payment_id) { |
|
534 | 534 | $exists = false; |
535 | - $payment = new Give_Payment( $payment_id ); |
|
535 | + $payment = new Give_Payment($payment_id); |
|
536 | 536 | |
537 | 537 | |
538 | - if ( $payment_id === $payment->ID && 'publish' === $payment->status ) { |
|
538 | + if ($payment_id === $payment->ID && 'publish' === $payment->status) { |
|
539 | 539 | $exists = true; |
540 | 540 | } |
541 | 541 | |
@@ -552,29 +552,29 @@ discard block |
||
552 | 552 | * |
553 | 553 | * @return bool|mixed True if payment status exists, false otherwise |
554 | 554 | */ |
555 | -function give_get_payment_status( $payment, $return_label = false ) { |
|
555 | +function give_get_payment_status($payment, $return_label = false) { |
|
556 | 556 | |
557 | - if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) { |
|
557 | + if ( ! is_object($payment) || ! isset($payment->post_status)) { |
|
558 | 558 | return false; |
559 | 559 | } |
560 | 560 | |
561 | 561 | $statuses = give_get_payment_statuses(); |
562 | 562 | |
563 | - if ( ! is_array( $statuses ) || empty( $statuses ) ) { |
|
563 | + if ( ! is_array($statuses) || empty($statuses)) { |
|
564 | 564 | return false; |
565 | 565 | } |
566 | 566 | |
567 | - $payment = new Give_Payment( $payment->ID ); |
|
567 | + $payment = new Give_Payment($payment->ID); |
|
568 | 568 | |
569 | - if ( array_key_exists( $payment->status, $statuses ) ) { |
|
570 | - if ( true === $return_label ) { |
|
571 | - return $statuses[ $payment->status ]; |
|
569 | + if (array_key_exists($payment->status, $statuses)) { |
|
570 | + if (true === $return_label) { |
|
571 | + return $statuses[$payment->status]; |
|
572 | 572 | } else { |
573 | 573 | // Account that our 'publish' status is labeled 'Complete' |
574 | 574 | $post_status = 'publish' == $payment->status ? 'Complete' : $payment->post_status; |
575 | 575 | |
576 | 576 | // Make sure we're matching cases, since they matter |
577 | - return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) ); |
|
577 | + return array_search(strtolower($post_status), array_map('strtolower', $statuses)); |
|
578 | 578 | } |
579 | 579 | } |
580 | 580 | |
@@ -590,17 +590,17 @@ discard block |
||
590 | 590 | */ |
591 | 591 | function give_get_payment_statuses() { |
592 | 592 | $payment_statuses = array( |
593 | - 'pending' => esc_html__( 'Pending', 'give' ), |
|
594 | - 'publish' => esc_html__( 'Complete', 'give' ), |
|
595 | - 'refunded' => esc_html__( 'Refunded', 'give' ), |
|
596 | - 'failed' => esc_html__( 'Failed', 'give' ), |
|
597 | - 'cancelled' => esc_html__( 'Cancelled', 'give' ), |
|
598 | - 'abandoned' => esc_html__( 'Abandoned', 'give' ), |
|
599 | - 'preapproval' => esc_html__( 'Pre-Approved', 'give' ), |
|
600 | - 'revoked' => esc_html__( 'Revoked', 'give' ) |
|
593 | + 'pending' => esc_html__('Pending', 'give'), |
|
594 | + 'publish' => esc_html__('Complete', 'give'), |
|
595 | + 'refunded' => esc_html__('Refunded', 'give'), |
|
596 | + 'failed' => esc_html__('Failed', 'give'), |
|
597 | + 'cancelled' => esc_html__('Cancelled', 'give'), |
|
598 | + 'abandoned' => esc_html__('Abandoned', 'give'), |
|
599 | + 'preapproval' => esc_html__('Pre-Approved', 'give'), |
|
600 | + 'revoked' => esc_html__('Revoked', 'give') |
|
601 | 601 | ); |
602 | 602 | |
603 | - return apply_filters( 'give_payment_statuses', $payment_statuses ); |
|
603 | + return apply_filters('give_payment_statuses', $payment_statuses); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | /** |
@@ -613,10 +613,10 @@ discard block |
||
613 | 613 | * @return array $payment_status All the available payment statuses. |
614 | 614 | */ |
615 | 615 | function give_get_payment_status_keys() { |
616 | - $statuses = array_keys( give_get_payment_statuses() ); |
|
617 | - asort( $statuses ); |
|
616 | + $statuses = array_keys(give_get_payment_statuses()); |
|
617 | + asort($statuses); |
|
618 | 618 | |
619 | - return array_values( $statuses ); |
|
619 | + return array_values($statuses); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | /** |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * |
632 | 632 | * @return int $earnings Earnings |
633 | 633 | */ |
634 | -function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) { |
|
634 | +function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) { |
|
635 | 635 | |
636 | 636 | // This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead |
637 | 637 | |
@@ -642,41 +642,41 @@ discard block |
||
642 | 642 | 'nopaging' => true, |
643 | 643 | 'year' => $year, |
644 | 644 | 'monthnum' => $month_num, |
645 | - 'post_status' => array( 'publish' ), |
|
645 | + 'post_status' => array('publish'), |
|
646 | 646 | 'fields' => 'ids', |
647 | 647 | 'update_post_term_cache' => false |
648 | 648 | ); |
649 | - if ( ! empty( $day ) ) { |
|
649 | + if ( ! empty($day)) { |
|
650 | 650 | $args['day'] = $day; |
651 | 651 | } |
652 | 652 | |
653 | - if ( ! empty( $hour ) ) { |
|
653 | + if ( ! empty($hour)) { |
|
654 | 654 | $args['hour'] = $hour; |
655 | 655 | } |
656 | 656 | |
657 | - $args = apply_filters( 'give_get_earnings_by_date_args', $args ); |
|
658 | - $key = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 ); |
|
657 | + $args = apply_filters('give_get_earnings_by_date_args', $args); |
|
658 | + $key = 'give_stats_'.substr(md5(serialize($args)), 0, 15); |
|
659 | 659 | |
660 | - if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) { |
|
660 | + if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) { |
|
661 | 661 | $earnings = false; |
662 | 662 | } else { |
663 | - $earnings = get_transient( $key ); |
|
663 | + $earnings = get_transient($key); |
|
664 | 664 | } |
665 | 665 | |
666 | - if ( false === $earnings ) { |
|
667 | - $sales = get_posts( $args ); |
|
666 | + if (false === $earnings) { |
|
667 | + $sales = get_posts($args); |
|
668 | 668 | $earnings = 0; |
669 | - if ( $sales ) { |
|
670 | - $sales = implode( ',', $sales ); |
|
669 | + if ($sales) { |
|
670 | + $sales = implode(',', $sales); |
|
671 | 671 | |
672 | - $earnings = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})" ); |
|
672 | + $earnings = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})"); |
|
673 | 673 | |
674 | 674 | } |
675 | 675 | // Cache the results for one hour |
676 | - set_transient( $key, $earnings, HOUR_IN_SECONDS ); |
|
676 | + set_transient($key, $earnings, HOUR_IN_SECONDS); |
|
677 | 677 | } |
678 | 678 | |
679 | - return round( $earnings, 2 ); |
|
679 | + return round($earnings, 2); |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | * |
692 | 692 | * @return int $count Sales |
693 | 693 | */ |
694 | -function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) { |
|
694 | +function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) { |
|
695 | 695 | |
696 | 696 | // This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead |
697 | 697 | $args = array( |
@@ -699,14 +699,14 @@ discard block |
||
699 | 699 | 'nopaging' => true, |
700 | 700 | 'year' => $year, |
701 | 701 | 'fields' => 'ids', |
702 | - 'post_status' => array( 'publish' ), |
|
702 | + 'post_status' => array('publish'), |
|
703 | 703 | 'update_post_meta_cache' => false, |
704 | 704 | 'update_post_term_cache' => false |
705 | 705 | ); |
706 | 706 | |
707 | - $show_free = apply_filters( 'give_sales_by_date_show_free', true, $args ); |
|
707 | + $show_free = apply_filters('give_sales_by_date_show_free', true, $args); |
|
708 | 708 | |
709 | - if ( false === $show_free ) { |
|
709 | + if (false === $show_free) { |
|
710 | 710 | $args['meta_query'] = array( |
711 | 711 | array( |
712 | 712 | 'key' => '_give_payment_total', |
@@ -717,33 +717,33 @@ discard block |
||
717 | 717 | ); |
718 | 718 | } |
719 | 719 | |
720 | - if ( ! empty( $month_num ) ) { |
|
720 | + if ( ! empty($month_num)) { |
|
721 | 721 | $args['monthnum'] = $month_num; |
722 | 722 | } |
723 | 723 | |
724 | - if ( ! empty( $day ) ) { |
|
724 | + if ( ! empty($day)) { |
|
725 | 725 | $args['day'] = $day; |
726 | 726 | } |
727 | 727 | |
728 | - if ( ! empty( $hour ) ) { |
|
728 | + if ( ! empty($hour)) { |
|
729 | 729 | $args['hour'] = $hour; |
730 | 730 | } |
731 | 731 | |
732 | - $args = apply_filters( 'give_get_sales_by_date_args', $args ); |
|
732 | + $args = apply_filters('give_get_sales_by_date_args', $args); |
|
733 | 733 | |
734 | - $key = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 ); |
|
734 | + $key = 'give_stats_'.substr(md5(serialize($args)), 0, 15); |
|
735 | 735 | |
736 | - if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) { |
|
736 | + if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) { |
|
737 | 737 | $count = false; |
738 | 738 | } else { |
739 | - $count = get_transient( $key ); |
|
739 | + $count = get_transient($key); |
|
740 | 740 | } |
741 | 741 | |
742 | - if ( false === $count ) { |
|
743 | - $sales = new WP_Query( $args ); |
|
742 | + if (false === $count) { |
|
743 | + $sales = new WP_Query($args); |
|
744 | 744 | $count = (int) $sales->post_count; |
745 | 745 | // Cache the results for one hour |
746 | - set_transient( $key, $count, HOUR_IN_SECONDS ); |
|
746 | + set_transient($key, $count, HOUR_IN_SECONDS); |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | return $count; |
@@ -758,20 +758,20 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @return bool True if complete, false otherwise. |
760 | 760 | */ |
761 | -function give_is_payment_complete( $payment_id ) { |
|
762 | - $payment = new Give_Payment( $payment_id ); |
|
761 | +function give_is_payment_complete($payment_id) { |
|
762 | + $payment = new Give_Payment($payment_id); |
|
763 | 763 | |
764 | 764 | $ret = false; |
765 | 765 | |
766 | - if ( $payment->ID > 0 ) { |
|
766 | + if ($payment->ID > 0) { |
|
767 | 767 | |
768 | - if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) { |
|
768 | + if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) { |
|
769 | 769 | $ret = true; |
770 | 770 | } |
771 | 771 | |
772 | 772 | } |
773 | 773 | |
774 | - return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status ); |
|
774 | + return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | /** |
@@ -797,29 +797,29 @@ discard block |
||
797 | 797 | */ |
798 | 798 | function give_get_total_earnings() { |
799 | 799 | |
800 | - $total = get_option( 'give_earnings_total', false ); |
|
800 | + $total = get_option('give_earnings_total', false); |
|
801 | 801 | |
802 | 802 | // If no total stored in DB, use old method of calculating total earnings |
803 | - if ( false === $total ) { |
|
803 | + if (false === $total) { |
|
804 | 804 | |
805 | 805 | global $wpdb; |
806 | 806 | |
807 | - $total = get_transient( 'give_earnings_total' ); |
|
807 | + $total = get_transient('give_earnings_total'); |
|
808 | 808 | |
809 | - if ( false === $total ) { |
|
809 | + if (false === $total) { |
|
810 | 810 | |
811 | 811 | $total = (float) 0; |
812 | 812 | |
813 | - $args = apply_filters( 'give_get_total_earnings_args', array( |
|
813 | + $args = apply_filters('give_get_total_earnings_args', array( |
|
814 | 814 | 'offset' => 0, |
815 | - 'number' => - 1, |
|
816 | - 'status' => array( 'publish' ), |
|
815 | + 'number' => -1, |
|
816 | + 'status' => array('publish'), |
|
817 | 817 | 'fields' => 'ids' |
818 | - ) ); |
|
818 | + )); |
|
819 | 819 | |
820 | 820 | |
821 | - $payments = give_get_payments( $args ); |
|
822 | - if ( $payments ) { |
|
821 | + $payments = give_get_payments($args); |
|
822 | + if ($payments) { |
|
823 | 823 | |
824 | 824 | /* |
825 | 825 | * If performing a purchase, we need to skip the very last payment in the database, since it calls |
@@ -827,30 +827,30 @@ discard block |
||
827 | 827 | * first purchase |
828 | 828 | */ |
829 | 829 | |
830 | - if ( did_action( 'give_update_payment_status' ) ) { |
|
831 | - array_pop( $payments ); |
|
830 | + if (did_action('give_update_payment_status')) { |
|
831 | + array_pop($payments); |
|
832 | 832 | } |
833 | 833 | |
834 | - if ( ! empty( $payments ) ) { |
|
835 | - $payments = implode( ',', $payments ); |
|
836 | - $total += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" ); |
|
834 | + if ( ! empty($payments)) { |
|
835 | + $payments = implode(',', $payments); |
|
836 | + $total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})"); |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | } |
840 | 840 | |
841 | 841 | // Cache results for 1 day. This cache is cleared automatically when a payment is made |
842 | - set_transient( 'give_earnings_total', $total, 86400 ); |
|
842 | + set_transient('give_earnings_total', $total, 86400); |
|
843 | 843 | |
844 | 844 | // Store the total for the first time |
845 | - update_option( 'give_earnings_total', $total ); |
|
845 | + update_option('give_earnings_total', $total); |
|
846 | 846 | } |
847 | 847 | } |
848 | 848 | |
849 | - if ( $total < 0 ) { |
|
849 | + if ($total < 0) { |
|
850 | 850 | $total = 0; // Don't ever show negative earnings |
851 | 851 | } |
852 | 852 | |
853 | - return apply_filters( 'give_total_earnings', round( $total, give_currency_decimal_filter() ) ); |
|
853 | + return apply_filters('give_total_earnings', round($total, give_currency_decimal_filter())); |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | /** |
@@ -863,10 +863,10 @@ discard block |
||
863 | 863 | * |
864 | 864 | * @return float $total Total earnings. |
865 | 865 | */ |
866 | -function give_increase_total_earnings( $amount = 0 ) { |
|
866 | +function give_increase_total_earnings($amount = 0) { |
|
867 | 867 | $total = give_get_total_earnings(); |
868 | 868 | $total += $amount; |
869 | - update_option( 'give_earnings_total', $total ); |
|
869 | + update_option('give_earnings_total', $total); |
|
870 | 870 | |
871 | 871 | return $total; |
872 | 872 | } |
@@ -880,13 +880,13 @@ discard block |
||
880 | 880 | * |
881 | 881 | * @return float $total Total earnings |
882 | 882 | */ |
883 | -function give_decrease_total_earnings( $amount = 0 ) { |
|
883 | +function give_decrease_total_earnings($amount = 0) { |
|
884 | 884 | $total = give_get_total_earnings(); |
885 | 885 | $total -= $amount; |
886 | - if ( $total < 0 ) { |
|
886 | + if ($total < 0) { |
|
887 | 887 | $total = 0; |
888 | 888 | } |
889 | - update_option( 'give_earnings_total', $total ); |
|
889 | + update_option('give_earnings_total', $total); |
|
890 | 890 | |
891 | 891 | return $total; |
892 | 892 | } |
@@ -902,10 +902,10 @@ discard block |
||
902 | 902 | * |
903 | 903 | * @return mixed $meta Payment Meta |
904 | 904 | */ |
905 | -function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) { |
|
906 | - $payment = new Give_Payment( $payment_id ); |
|
905 | +function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) { |
|
906 | + $payment = new Give_Payment($payment_id); |
|
907 | 907 | |
908 | - return $payment->get_meta( $meta_key, $single ); |
|
908 | + return $payment->get_meta($meta_key, $single); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | /** |
@@ -918,10 +918,10 @@ discard block |
||
918 | 918 | * |
919 | 919 | * @return mixed Meta ID if successful, false if unsuccessful |
920 | 920 | */ |
921 | -function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) { |
|
922 | - $payment = new Give_Payment( $payment_id ); |
|
921 | +function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') { |
|
922 | + $payment = new Give_Payment($payment_id); |
|
923 | 923 | |
924 | - return $payment->update_meta( $meta_key, $meta_value, $prev_value ); |
|
924 | + return $payment->update_meta($meta_key, $meta_value, $prev_value); |
|
925 | 925 | } |
926 | 926 | |
927 | 927 | /** |
@@ -933,8 +933,8 @@ discard block |
||
933 | 933 | * |
934 | 934 | * @return array $user_info User Info Meta Values |
935 | 935 | */ |
936 | -function give_get_payment_meta_user_info( $payment_id ) { |
|
937 | - $payment = new Give_Payment( $payment_id ); |
|
936 | +function give_get_payment_meta_user_info($payment_id) { |
|
937 | + $payment = new Give_Payment($payment_id); |
|
938 | 938 | |
939 | 939 | return $payment->user_info; |
940 | 940 | } |
@@ -949,8 +949,8 @@ discard block |
||
949 | 949 | * |
950 | 950 | * @return int $form_id |
951 | 951 | */ |
952 | -function give_get_payment_form_id( $payment_id ) { |
|
953 | - $payment = new Give_Payment( $payment_id ); |
|
952 | +function give_get_payment_form_id($payment_id) { |
|
953 | + $payment = new Give_Payment($payment_id); |
|
954 | 954 | |
955 | 955 | return $payment->form_id; |
956 | 956 | } |
@@ -964,8 +964,8 @@ discard block |
||
964 | 964 | * |
965 | 965 | * @return string $email User Email |
966 | 966 | */ |
967 | -function give_get_payment_user_email( $payment_id ) { |
|
968 | - $payment = new Give_Payment( $payment_id ); |
|
967 | +function give_get_payment_user_email($payment_id) { |
|
968 | + $payment = new Give_Payment($payment_id); |
|
969 | 969 | |
970 | 970 | return $payment->email; |
971 | 971 | } |
@@ -979,11 +979,11 @@ discard block |
||
979 | 979 | * |
980 | 980 | * @return bool If the payment is associated with a user (false) or not (true) |
981 | 981 | */ |
982 | -function give_is_guest_payment( $payment_id ) { |
|
983 | - $payment_user_id = give_get_payment_user_id( $payment_id ); |
|
984 | - $is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true; |
|
982 | +function give_is_guest_payment($payment_id) { |
|
983 | + $payment_user_id = give_get_payment_user_id($payment_id); |
|
984 | + $is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true; |
|
985 | 985 | |
986 | - return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id ); |
|
986 | + return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id); |
|
987 | 987 | } |
988 | 988 | |
989 | 989 | /** |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | * |
996 | 996 | * @return string $user_id User ID |
997 | 997 | */ |
998 | -function give_get_payment_user_id( $payment_id ) { |
|
999 | - $payment = new Give_Payment( $payment_id ); |
|
998 | +function give_get_payment_user_id($payment_id) { |
|
999 | + $payment = new Give_Payment($payment_id); |
|
1000 | 1000 | |
1001 | 1001 | return $payment->user_id; |
1002 | 1002 | } |
@@ -1010,8 +1010,8 @@ discard block |
||
1010 | 1010 | * |
1011 | 1011 | * @return string $customer_id Customer ID |
1012 | 1012 | */ |
1013 | -function give_get_payment_customer_id( $payment_id ) { |
|
1014 | - $payment = new Give_Payment( $payment_id ); |
|
1013 | +function give_get_payment_customer_id($payment_id) { |
|
1014 | + $payment = new Give_Payment($payment_id); |
|
1015 | 1015 | |
1016 | 1016 | return $payment->customer_id; |
1017 | 1017 | } |
@@ -1025,8 +1025,8 @@ discard block |
||
1025 | 1025 | * |
1026 | 1026 | * @return string $ip User IP |
1027 | 1027 | */ |
1028 | -function give_get_payment_user_ip( $payment_id ) { |
|
1029 | - $payment = new Give_Payment( $payment_id ); |
|
1028 | +function give_get_payment_user_ip($payment_id) { |
|
1029 | + $payment = new Give_Payment($payment_id); |
|
1030 | 1030 | |
1031 | 1031 | return $payment->ip; |
1032 | 1032 | } |
@@ -1040,8 +1040,8 @@ discard block |
||
1040 | 1040 | * |
1041 | 1041 | * @return string $date The date the payment was completed |
1042 | 1042 | */ |
1043 | -function give_get_payment_completed_date( $payment_id = 0 ) { |
|
1044 | - $payment = new Give_Payment( $payment_id ); |
|
1043 | +function give_get_payment_completed_date($payment_id = 0) { |
|
1044 | + $payment = new Give_Payment($payment_id); |
|
1045 | 1045 | |
1046 | 1046 | return $payment->completed_date; |
1047 | 1047 | } |
@@ -1055,8 +1055,8 @@ discard block |
||
1055 | 1055 | * |
1056 | 1056 | * @return string $gateway Gateway |
1057 | 1057 | */ |
1058 | -function give_get_payment_gateway( $payment_id ) { |
|
1059 | - $payment = new Give_Payment( $payment_id ); |
|
1058 | +function give_get_payment_gateway($payment_id) { |
|
1059 | + $payment = new Give_Payment($payment_id); |
|
1060 | 1060 | |
1061 | 1061 | return $payment->gateway; |
1062 | 1062 | } |
@@ -1070,8 +1070,8 @@ discard block |
||
1070 | 1070 | * |
1071 | 1071 | * @return string $currency The currency code |
1072 | 1072 | */ |
1073 | -function give_get_payment_currency_code( $payment_id = 0 ) { |
|
1074 | - $payment = new Give_Payment( $payment_id ); |
|
1073 | +function give_get_payment_currency_code($payment_id = 0) { |
|
1074 | + $payment = new Give_Payment($payment_id); |
|
1075 | 1075 | |
1076 | 1076 | return $payment->currency; |
1077 | 1077 | } |
@@ -1085,10 +1085,10 @@ discard block |
||
1085 | 1085 | * |
1086 | 1086 | * @return string $currency The currency name |
1087 | 1087 | */ |
1088 | -function give_get_payment_currency( $payment_id = 0 ) { |
|
1089 | - $currency = give_get_payment_currency_code( $payment_id ); |
|
1088 | +function give_get_payment_currency($payment_id = 0) { |
|
1089 | + $currency = give_get_payment_currency_code($payment_id); |
|
1090 | 1090 | |
1091 | - return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id ); |
|
1091 | + return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id); |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | /** |
@@ -1100,8 +1100,8 @@ discard block |
||
1100 | 1100 | * |
1101 | 1101 | * @return string $key Purchase key |
1102 | 1102 | */ |
1103 | -function give_get_payment_key( $payment_id = 0 ) { |
|
1104 | - $payment = new Give_Payment( $payment_id ); |
|
1103 | +function give_get_payment_key($payment_id = 0) { |
|
1104 | + $payment = new Give_Payment($payment_id); |
|
1105 | 1105 | |
1106 | 1106 | return $payment->key; |
1107 | 1107 | } |
@@ -1117,8 +1117,8 @@ discard block |
||
1117 | 1117 | * |
1118 | 1118 | * @return string $number Payment order number |
1119 | 1119 | */ |
1120 | -function give_get_payment_number( $payment_id = 0 ) { |
|
1121 | - $payment = new Give_Payment( $payment_id ); |
|
1120 | +function give_get_payment_number($payment_id = 0) { |
|
1121 | + $payment = new Give_Payment($payment_id); |
|
1122 | 1122 | |
1123 | 1123 | return $payment->number; |
1124 | 1124 | } |
@@ -1132,23 +1132,23 @@ discard block |
||
1132 | 1132 | * |
1133 | 1133 | * @return string The formatted payment number |
1134 | 1134 | */ |
1135 | -function give_format_payment_number( $number ) { |
|
1135 | +function give_format_payment_number($number) { |
|
1136 | 1136 | |
1137 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
1137 | + if ( ! give_get_option('enable_sequential')) { |
|
1138 | 1138 | return $number; |
1139 | 1139 | } |
1140 | 1140 | |
1141 | - if ( ! is_numeric( $number ) ) { |
|
1141 | + if ( ! is_numeric($number)) { |
|
1142 | 1142 | return $number; |
1143 | 1143 | } |
1144 | 1144 | |
1145 | - $prefix = give_get_option( 'sequential_prefix' ); |
|
1146 | - $number = absint( $number ); |
|
1147 | - $postfix = give_get_option( 'sequential_postfix' ); |
|
1145 | + $prefix = give_get_option('sequential_prefix'); |
|
1146 | + $number = absint($number); |
|
1147 | + $postfix = give_get_option('sequential_postfix'); |
|
1148 | 1148 | |
1149 | - $formatted_number = $prefix . $number . $postfix; |
|
1149 | + $formatted_number = $prefix.$number.$postfix; |
|
1150 | 1150 | |
1151 | - return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix ); |
|
1151 | + return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix); |
|
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | /** |
@@ -1161,17 +1161,17 @@ discard block |
||
1161 | 1161 | */ |
1162 | 1162 | function give_get_next_payment_number() { |
1163 | 1163 | |
1164 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
1164 | + if ( ! give_get_option('enable_sequential')) { |
|
1165 | 1165 | return false; |
1166 | 1166 | } |
1167 | 1167 | |
1168 | - $number = get_option( 'give_last_payment_number' ); |
|
1169 | - $start = give_get_option( 'sequential_start', 1 ); |
|
1168 | + $number = get_option('give_last_payment_number'); |
|
1169 | + $start = give_get_option('sequential_start', 1); |
|
1170 | 1170 | $increment_number = true; |
1171 | 1171 | |
1172 | - if ( false !== $number ) { |
|
1172 | + if (false !== $number) { |
|
1173 | 1173 | |
1174 | - if ( empty( $number ) ) { |
|
1174 | + if (empty($number)) { |
|
1175 | 1175 | |
1176 | 1176 | $number = $start; |
1177 | 1177 | $increment_number = false; |
@@ -1181,24 +1181,24 @@ discard block |
||
1181 | 1181 | } else { |
1182 | 1182 | |
1183 | 1183 | // This case handles the first addition of the new option, as well as if it get's deleted for any reason |
1184 | - $payments = new Give_Payments_Query( array( |
|
1184 | + $payments = new Give_Payments_Query(array( |
|
1185 | 1185 | 'number' => 1, |
1186 | 1186 | 'order' => 'DESC', |
1187 | 1187 | 'orderby' => 'ID', |
1188 | 1188 | 'output' => 'posts', |
1189 | 1189 | 'fields' => 'ids' |
1190 | - ) ); |
|
1190 | + )); |
|
1191 | 1191 | $last_payment = $payments->get_payments(); |
1192 | 1192 | |
1193 | - if ( ! empty( $last_payment ) ) { |
|
1193 | + if ( ! empty($last_payment)) { |
|
1194 | 1194 | |
1195 | - $number = give_get_payment_number( $last_payment[0] ); |
|
1195 | + $number = give_get_payment_number($last_payment[0]); |
|
1196 | 1196 | |
1197 | 1197 | } |
1198 | 1198 | |
1199 | - if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) { |
|
1199 | + if ( ! empty($number) && $number !== (int) $last_payment[0]) { |
|
1200 | 1200 | |
1201 | - $number = give_remove_payment_prefix_postfix( $number ); |
|
1201 | + $number = give_remove_payment_prefix_postfix($number); |
|
1202 | 1202 | |
1203 | 1203 | } else { |
1204 | 1204 | |
@@ -1208,13 +1208,13 @@ discard block |
||
1208 | 1208 | |
1209 | 1209 | } |
1210 | 1210 | |
1211 | - $increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number ); |
|
1211 | + $increment_number = apply_filters('give_increment_payment_number', $increment_number, $number); |
|
1212 | 1212 | |
1213 | - if ( $increment_number ) { |
|
1214 | - $number ++; |
|
1213 | + if ($increment_number) { |
|
1214 | + $number++; |
|
1215 | 1215 | } |
1216 | 1216 | |
1217 | - return apply_filters( 'give_get_next_payment_number', $number ); |
|
1217 | + return apply_filters('give_get_next_payment_number', $number); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | /** |
@@ -1226,25 +1226,25 @@ discard block |
||
1226 | 1226 | * |
1227 | 1227 | * @return string The new Payment number without prefix and postfix |
1228 | 1228 | */ |
1229 | -function give_remove_payment_prefix_postfix( $number ) { |
|
1229 | +function give_remove_payment_prefix_postfix($number) { |
|
1230 | 1230 | |
1231 | - $prefix = give_get_option( 'sequential_prefix' ); |
|
1232 | - $postfix = give_get_option( 'sequential_postfix' ); |
|
1231 | + $prefix = give_get_option('sequential_prefix'); |
|
1232 | + $postfix = give_get_option('sequential_postfix'); |
|
1233 | 1233 | |
1234 | 1234 | // Remove prefix |
1235 | - $number = preg_replace( '/' . $prefix . '/', '', $number, 1 ); |
|
1235 | + $number = preg_replace('/'.$prefix.'/', '', $number, 1); |
|
1236 | 1236 | |
1237 | 1237 | // Remove the postfix |
1238 | - $length = strlen( $number ); |
|
1239 | - $postfix_pos = strrpos( $number, $postfix ); |
|
1240 | - if ( false !== $postfix_pos ) { |
|
1241 | - $number = substr_replace( $number, '', $postfix_pos, $length ); |
|
1238 | + $length = strlen($number); |
|
1239 | + $postfix_pos = strrpos($number, $postfix); |
|
1240 | + if (false !== $postfix_pos) { |
|
1241 | + $number = substr_replace($number, '', $postfix_pos, $length); |
|
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | // Ensure it's a whole number |
1245 | - $number = intval( $number ); |
|
1245 | + $number = intval($number); |
|
1246 | 1246 | |
1247 | - return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix ); |
|
1247 | + return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix); |
|
1248 | 1248 | |
1249 | 1249 | } |
1250 | 1250 | |
@@ -1260,10 +1260,10 @@ discard block |
||
1260 | 1260 | * |
1261 | 1261 | * @return string $amount Fully formatted payment amount |
1262 | 1262 | */ |
1263 | -function give_payment_amount( $payment_id = 0 ) { |
|
1264 | - $amount = give_get_payment_amount( $payment_id ); |
|
1263 | +function give_payment_amount($payment_id = 0) { |
|
1264 | + $amount = give_get_payment_amount($payment_id); |
|
1265 | 1265 | |
1266 | - return give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment_id ) ); |
|
1266 | + return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id)); |
|
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | /** |
@@ -1276,11 +1276,11 @@ discard block |
||
1276 | 1276 | * |
1277 | 1277 | * @return mixed|void |
1278 | 1278 | */ |
1279 | -function give_get_payment_amount( $payment_id ) { |
|
1279 | +function give_get_payment_amount($payment_id) { |
|
1280 | 1280 | |
1281 | - $payment = new Give_Payment( $payment_id ); |
|
1281 | + $payment = new Give_Payment($payment_id); |
|
1282 | 1282 | |
1283 | - return apply_filters( 'give_payment_amount', floatval( $payment->total ), $payment_id ); |
|
1283 | + return apply_filters('give_payment_amount', floatval($payment->total), $payment_id); |
|
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | /** |
@@ -1296,10 +1296,10 @@ discard block |
||
1296 | 1296 | * |
1297 | 1297 | * @return array Fully formatted payment subtotal |
1298 | 1298 | */ |
1299 | -function give_payment_subtotal( $payment_id = 0 ) { |
|
1300 | - $subtotal = give_get_payment_subtotal( $payment_id ); |
|
1299 | +function give_payment_subtotal($payment_id = 0) { |
|
1300 | + $subtotal = give_get_payment_subtotal($payment_id); |
|
1301 | 1301 | |
1302 | - return give_currency_filter( give_format_amount( $subtotal ), give_get_payment_currency_code( $payment_id ) ); |
|
1302 | + return give_currency_filter(give_format_amount($subtotal), give_get_payment_currency_code($payment_id)); |
|
1303 | 1303 | } |
1304 | 1304 | |
1305 | 1305 | /** |
@@ -1313,8 +1313,8 @@ discard block |
||
1313 | 1313 | * |
1314 | 1314 | * @return float $subtotal Subtotal for payment (non formatted) |
1315 | 1315 | */ |
1316 | -function give_get_payment_subtotal( $payment_id = 0 ) { |
|
1317 | - $payment = new G_Payment( $payment_id ); |
|
1316 | +function give_get_payment_subtotal($payment_id = 0) { |
|
1317 | + $payment = new G_Payment($payment_id); |
|
1318 | 1318 | |
1319 | 1319 | return $payment->subtotal; |
1320 | 1320 | } |
@@ -1329,10 +1329,10 @@ discard block |
||
1329 | 1329 | * |
1330 | 1330 | * @return mixed array if payment fees found, false otherwise |
1331 | 1331 | */ |
1332 | -function give_get_payment_fees( $payment_id = 0, $type = 'all' ) { |
|
1333 | - $payment = new Give_Payment( $payment_id ); |
|
1332 | +function give_get_payment_fees($payment_id = 0, $type = 'all') { |
|
1333 | + $payment = new Give_Payment($payment_id); |
|
1334 | 1334 | |
1335 | - return $payment->get_fees( $type ); |
|
1335 | + return $payment->get_fees($type); |
|
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | /** |
@@ -1344,8 +1344,8 @@ discard block |
||
1344 | 1344 | * |
1345 | 1345 | * @return string The Transaction ID |
1346 | 1346 | */ |
1347 | -function give_get_payment_transaction_id( $payment_id = 0 ) { |
|
1348 | - $payment = new Give_Payment( $payment_id ); |
|
1347 | +function give_get_payment_transaction_id($payment_id = 0) { |
|
1348 | + $payment = new Give_Payment($payment_id); |
|
1349 | 1349 | |
1350 | 1350 | return $payment->transaction_id; |
1351 | 1351 | } |
@@ -1360,15 +1360,15 @@ discard block |
||
1360 | 1360 | * |
1361 | 1361 | * @return bool|mixed |
1362 | 1362 | */ |
1363 | -function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) { |
|
1363 | +function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') { |
|
1364 | 1364 | |
1365 | - if ( empty( $payment_id ) || empty( $transaction_id ) ) { |
|
1365 | + if (empty($payment_id) || empty($transaction_id)) { |
|
1366 | 1366 | return false; |
1367 | 1367 | } |
1368 | 1368 | |
1369 | - $transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id ); |
|
1369 | + $transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id); |
|
1370 | 1370 | |
1371 | - return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id ); |
|
1371 | + return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id); |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | /** |
@@ -1382,12 +1382,12 @@ discard block |
||
1382 | 1382 | * |
1383 | 1383 | * @return int $purchase Purchase ID |
1384 | 1384 | */ |
1385 | -function give_get_purchase_id_by_key( $key ) { |
|
1385 | +function give_get_purchase_id_by_key($key) { |
|
1386 | 1386 | global $wpdb; |
1387 | 1387 | |
1388 | - $purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key ) ); |
|
1388 | + $purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key)); |
|
1389 | 1389 | |
1390 | - if ( $purchase != null ) { |
|
1390 | + if ($purchase != null) { |
|
1391 | 1391 | return $purchase; |
1392 | 1392 | } |
1393 | 1393 | |
@@ -1406,12 +1406,12 @@ discard block |
||
1406 | 1406 | * |
1407 | 1407 | * @return int $purchase Purchase ID |
1408 | 1408 | */ |
1409 | -function give_get_purchase_id_by_transaction_id( $key ) { |
|
1409 | +function give_get_purchase_id_by_transaction_id($key) { |
|
1410 | 1410 | global $wpdb; |
1411 | 1411 | |
1412 | - $purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) ); |
|
1412 | + $purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key)); |
|
1413 | 1413 | |
1414 | - if ( $purchase != null ) { |
|
1414 | + if ($purchase != null) { |
|
1415 | 1415 | return $purchase; |
1416 | 1416 | } |
1417 | 1417 | |
@@ -1428,19 +1428,19 @@ discard block |
||
1428 | 1428 | * |
1429 | 1429 | * @return array $notes Payment Notes |
1430 | 1430 | */ |
1431 | -function give_get_payment_notes( $payment_id = 0, $search = '' ) { |
|
1431 | +function give_get_payment_notes($payment_id = 0, $search = '') { |
|
1432 | 1432 | |
1433 | - if ( empty( $payment_id ) && empty( $search ) ) { |
|
1433 | + if (empty($payment_id) && empty($search)) { |
|
1434 | 1434 | return false; |
1435 | 1435 | } |
1436 | 1436 | |
1437 | - remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 ); |
|
1438 | - remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 ); |
|
1437 | + remove_action('pre_get_comments', 'give_hide_payment_notes', 10); |
|
1438 | + remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10); |
|
1439 | 1439 | |
1440 | - $notes = get_comments( array( 'post_id' => $payment_id, 'order' => 'ASC', 'search' => $search ) ); |
|
1440 | + $notes = get_comments(array('post_id' => $payment_id, 'order' => 'ASC', 'search' => $search)); |
|
1441 | 1441 | |
1442 | - add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 ); |
|
1443 | - add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 ); |
|
1442 | + add_action('pre_get_comments', 'give_hide_payment_notes', 10); |
|
1443 | + add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2); |
|
1444 | 1444 | |
1445 | 1445 | return $notes; |
1446 | 1446 | } |
@@ -1456,19 +1456,19 @@ discard block |
||
1456 | 1456 | * |
1457 | 1457 | * @return int The new note ID |
1458 | 1458 | */ |
1459 | -function give_insert_payment_note( $payment_id = 0, $note = '' ) { |
|
1460 | - if ( empty( $payment_id ) ) { |
|
1459 | +function give_insert_payment_note($payment_id = 0, $note = '') { |
|
1460 | + if (empty($payment_id)) { |
|
1461 | 1461 | return false; |
1462 | 1462 | } |
1463 | 1463 | |
1464 | - do_action( 'give_pre_insert_payment_note', $payment_id, $note ); |
|
1464 | + do_action('give_pre_insert_payment_note', $payment_id, $note); |
|
1465 | 1465 | |
1466 | - $note_id = wp_insert_comment( wp_filter_comment( array( |
|
1466 | + $note_id = wp_insert_comment(wp_filter_comment(array( |
|
1467 | 1467 | 'comment_post_ID' => $payment_id, |
1468 | 1468 | 'comment_content' => $note, |
1469 | 1469 | 'user_id' => is_admin() ? get_current_user_id() : 0, |
1470 | - 'comment_date' => current_time( 'mysql' ), |
|
1471 | - 'comment_date_gmt' => current_time( 'mysql', 1 ), |
|
1470 | + 'comment_date' => current_time('mysql'), |
|
1471 | + 'comment_date_gmt' => current_time('mysql', 1), |
|
1472 | 1472 | 'comment_approved' => 1, |
1473 | 1473 | 'comment_parent' => 0, |
1474 | 1474 | 'comment_author' => '', |
@@ -1477,9 +1477,9 @@ discard block |
||
1477 | 1477 | 'comment_author_email' => '', |
1478 | 1478 | 'comment_type' => 'give_payment_note' |
1479 | 1479 | |
1480 | - ) ) ); |
|
1480 | + ))); |
|
1481 | 1481 | |
1482 | - do_action( 'give_insert_payment_note', $note_id, $payment_id, $note ); |
|
1482 | + do_action('give_insert_payment_note', $note_id, $payment_id, $note); |
|
1483 | 1483 | |
1484 | 1484 | return $note_id; |
1485 | 1485 | } |
@@ -1494,14 +1494,14 @@ discard block |
||
1494 | 1494 | * |
1495 | 1495 | * @return bool True on success, false otherwise |
1496 | 1496 | */ |
1497 | -function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) { |
|
1498 | - if ( empty( $comment_id ) ) { |
|
1497 | +function give_delete_payment_note($comment_id = 0, $payment_id = 0) { |
|
1498 | + if (empty($comment_id)) { |
|
1499 | 1499 | return false; |
1500 | 1500 | } |
1501 | 1501 | |
1502 | - do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id ); |
|
1503 | - $ret = wp_delete_comment( $comment_id, true ); |
|
1504 | - do_action( 'give_post_delete_payment_note', $comment_id, $payment_id ); |
|
1502 | + do_action('give_pre_delete_payment_note', $comment_id, $payment_id); |
|
1503 | + $ret = wp_delete_comment($comment_id, true); |
|
1504 | + do_action('give_post_delete_payment_note', $comment_id, $payment_id); |
|
1505 | 1505 | |
1506 | 1506 | return $ret; |
1507 | 1507 | } |
@@ -1516,32 +1516,32 @@ discard block |
||
1516 | 1516 | * |
1517 | 1517 | * @return string |
1518 | 1518 | */ |
1519 | -function give_get_payment_note_html( $note, $payment_id = 0 ) { |
|
1519 | +function give_get_payment_note_html($note, $payment_id = 0) { |
|
1520 | 1520 | |
1521 | - if ( is_numeric( $note ) ) { |
|
1522 | - $note = get_comment( $note ); |
|
1521 | + if (is_numeric($note)) { |
|
1522 | + $note = get_comment($note); |
|
1523 | 1523 | } |
1524 | 1524 | |
1525 | - if ( ! empty( $note->user_id ) ) { |
|
1526 | - $user = get_userdata( $note->user_id ); |
|
1525 | + if ( ! empty($note->user_id)) { |
|
1526 | + $user = get_userdata($note->user_id); |
|
1527 | 1527 | $user = $user->display_name; |
1528 | 1528 | } else { |
1529 | - $user = esc_html__( 'System', 'give' ); |
|
1529 | + $user = esc_html__('System', 'give'); |
|
1530 | 1530 | } |
1531 | 1531 | |
1532 | - $date_format = get_option( 'date_format' ) . ', ' . get_option( 'time_format' ); |
|
1532 | + $date_format = get_option('date_format').', '.get_option('time_format'); |
|
1533 | 1533 | |
1534 | - $delete_note_url = wp_nonce_url( add_query_arg( array( |
|
1534 | + $delete_note_url = wp_nonce_url(add_query_arg(array( |
|
1535 | 1535 | 'give-action' => 'delete_payment_note', |
1536 | 1536 | 'note_id' => $note->comment_ID, |
1537 | 1537 | 'payment_id' => $payment_id |
1538 | - ) ), 'give_delete_payment_note_' . $note->comment_ID ); |
|
1538 | + )), 'give_delete_payment_note_'.$note->comment_ID); |
|
1539 | 1539 | |
1540 | - $note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">'; |
|
1540 | + $note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">'; |
|
1541 | 1541 | $note_html .= '<p>'; |
1542 | - $note_html .= '<strong>' . $user . '</strong> – <span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>'; |
|
1542 | + $note_html .= '<strong>'.$user.'</strong> – <span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>'; |
|
1543 | 1543 | $note_html .= $note->comment_content; |
1544 | - $note_html .= ' – <a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" title="' . esc_attr__( 'Delete this payment note', 'give' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>'; |
|
1544 | + $note_html .= ' – <a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" title="'.esc_attr__('Delete this payment note', 'give').'">'.esc_html__('Delete', 'give').'</a>'; |
|
1545 | 1545 | $note_html .= '</p>'; |
1546 | 1546 | $note_html .= '</div>'; |
1547 | 1547 | |
@@ -1559,20 +1559,20 @@ discard block |
||
1559 | 1559 | * |
1560 | 1560 | * @return void |
1561 | 1561 | */ |
1562 | -function give_hide_payment_notes( $query ) { |
|
1562 | +function give_hide_payment_notes($query) { |
|
1563 | 1563 | global $wp_version; |
1564 | 1564 | |
1565 | - if ( version_compare( floatval( $wp_version ), '4.1', '>=' ) ) { |
|
1566 | - $types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array(); |
|
1567 | - if ( ! is_array( $types ) ) { |
|
1568 | - $types = array( $types ); |
|
1565 | + if (version_compare(floatval($wp_version), '4.1', '>=')) { |
|
1566 | + $types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array(); |
|
1567 | + if ( ! is_array($types)) { |
|
1568 | + $types = array($types); |
|
1569 | 1569 | } |
1570 | 1570 | $types[] = 'give_payment_note'; |
1571 | 1571 | $query->query_vars['type__not_in'] = $types; |
1572 | 1572 | } |
1573 | 1573 | } |
1574 | 1574 | |
1575 | -add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 ); |
|
1575 | +add_action('pre_get_comments', 'give_hide_payment_notes', 10); |
|
1576 | 1576 | |
1577 | 1577 | /** |
1578 | 1578 | * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets |
@@ -1584,17 +1584,17 @@ discard block |
||
1584 | 1584 | * |
1585 | 1585 | * @return array $clauses Updated comment clauses |
1586 | 1586 | */ |
1587 | -function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) { |
|
1587 | +function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) { |
|
1588 | 1588 | global $wpdb, $wp_version; |
1589 | 1589 | |
1590 | - if ( version_compare( floatval( $wp_version ), '4.1', '<' ) ) { |
|
1590 | + if (version_compare(floatval($wp_version), '4.1', '<')) { |
|
1591 | 1591 | $clauses['where'] .= ' AND comment_type != "give_payment_note"'; |
1592 | 1592 | } |
1593 | 1593 | |
1594 | 1594 | return $clauses; |
1595 | 1595 | } |
1596 | 1596 | |
1597 | -add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 ); |
|
1597 | +add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2); |
|
1598 | 1598 | |
1599 | 1599 | |
1600 | 1600 | /** |
@@ -1607,15 +1607,15 @@ discard block |
||
1607 | 1607 | * |
1608 | 1608 | * @return array $where |
1609 | 1609 | */ |
1610 | -function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) { |
|
1610 | +function give_hide_payment_notes_from_feeds($where, $wp_comment_query) { |
|
1611 | 1611 | global $wpdb; |
1612 | 1612 | |
1613 | - $where .= $wpdb->prepare( " AND comment_type != %s", 'give_payment_note' ); |
|
1613 | + $where .= $wpdb->prepare(" AND comment_type != %s", 'give_payment_note'); |
|
1614 | 1614 | |
1615 | 1615 | return $where; |
1616 | 1616 | } |
1617 | 1617 | |
1618 | -add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 ); |
|
1618 | +add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2); |
|
1619 | 1619 | |
1620 | 1620 | |
1621 | 1621 | /** |
@@ -1629,32 +1629,32 @@ discard block |
||
1629 | 1629 | * |
1630 | 1630 | * @return array Array of comment counts |
1631 | 1631 | */ |
1632 | -function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) { |
|
1632 | +function give_remove_payment_notes_in_comment_counts($stats, $post_id) { |
|
1633 | 1633 | global $wpdb, $pagenow; |
1634 | 1634 | |
1635 | - if ( 'index.php' != $pagenow ) { |
|
1635 | + if ('index.php' != $pagenow) { |
|
1636 | 1636 | return $stats; |
1637 | 1637 | } |
1638 | 1638 | |
1639 | 1639 | $post_id = (int) $post_id; |
1640 | 1640 | |
1641 | - if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) { |
|
1641 | + if (apply_filters('give_count_payment_notes_in_comments', false)) { |
|
1642 | 1642 | return $stats; |
1643 | 1643 | } |
1644 | 1644 | |
1645 | - $stats = wp_cache_get( "comments-{$post_id}", 'counts' ); |
|
1645 | + $stats = wp_cache_get("comments-{$post_id}", 'counts'); |
|
1646 | 1646 | |
1647 | - if ( false !== $stats ) { |
|
1647 | + if (false !== $stats) { |
|
1648 | 1648 | return $stats; |
1649 | 1649 | } |
1650 | 1650 | |
1651 | 1651 | $where = 'WHERE comment_type != "give_payment_note"'; |
1652 | 1652 | |
1653 | - if ( $post_id > 0 ) { |
|
1654 | - $where .= $wpdb->prepare( " AND comment_post_ID = %d", $post_id ); |
|
1653 | + if ($post_id > 0) { |
|
1654 | + $where .= $wpdb->prepare(" AND comment_post_ID = %d", $post_id); |
|
1655 | 1655 | } |
1656 | 1656 | |
1657 | - $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A ); |
|
1657 | + $count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A); |
|
1658 | 1658 | |
1659 | 1659 | $total = 0; |
1660 | 1660 | $approved = array( |
@@ -1664,30 +1664,30 @@ discard block |
||
1664 | 1664 | 'trash' => 'trash', |
1665 | 1665 | 'post-trashed' => 'post-trashed' |
1666 | 1666 | ); |
1667 | - foreach ( (array) $count as $row ) { |
|
1667 | + foreach ((array) $count as $row) { |
|
1668 | 1668 | // Don't count post-trashed toward totals |
1669 | - if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) { |
|
1669 | + if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) { |
|
1670 | 1670 | $total += $row['num_comments']; |
1671 | 1671 | } |
1672 | - if ( isset( $approved[ $row['comment_approved'] ] ) ) { |
|
1673 | - $stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments']; |
|
1672 | + if (isset($approved[$row['comment_approved']])) { |
|
1673 | + $stats[$approved[$row['comment_approved']]] = $row['num_comments']; |
|
1674 | 1674 | } |
1675 | 1675 | } |
1676 | 1676 | |
1677 | 1677 | $stats['total_comments'] = $total; |
1678 | - foreach ( $approved as $key ) { |
|
1679 | - if ( empty( $stats[ $key ] ) ) { |
|
1680 | - $stats[ $key ] = 0; |
|
1678 | + foreach ($approved as $key) { |
|
1679 | + if (empty($stats[$key])) { |
|
1680 | + $stats[$key] = 0; |
|
1681 | 1681 | } |
1682 | 1682 | } |
1683 | 1683 | |
1684 | 1684 | $stats = (object) $stats; |
1685 | - wp_cache_set( "comments-{$post_id}", $stats, 'counts' ); |
|
1685 | + wp_cache_set("comments-{$post_id}", $stats, 'counts'); |
|
1686 | 1686 | |
1687 | 1687 | return $stats; |
1688 | 1688 | } |
1689 | 1689 | |
1690 | -add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 ); |
|
1690 | +add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2); |
|
1691 | 1691 | |
1692 | 1692 | |
1693 | 1693 | /** |
@@ -1700,9 +1700,9 @@ discard block |
||
1700 | 1700 | * |
1701 | 1701 | * @return string $where Modified where clause |
1702 | 1702 | */ |
1703 | -function give_filter_where_older_than_week( $where = '' ) { |
|
1703 | +function give_filter_where_older_than_week($where = '') { |
|
1704 | 1704 | // Payments older than one week |
1705 | - $start = date( 'Y-m-d', strtotime( '-7 days' ) ); |
|
1705 | + $start = date('Y-m-d', strtotime('-7 days')); |
|
1706 | 1706 | $where .= " AND post_date <= '{$start}'"; |
1707 | 1707 | |
1708 | 1708 | return $where; |
@@ -1722,35 +1722,35 @@ discard block |
||
1722 | 1722 | * |
1723 | 1723 | * @return string $form_title Returns the full title if $level_title false, otherwise returns the levels title |
1724 | 1724 | */ |
1725 | -function give_get_payment_form_title( $payment_meta, $level_title = false, $separator = '' ) { |
|
1725 | +function give_get_payment_form_title($payment_meta, $level_title = false, $separator = '') { |
|
1726 | 1726 | |
1727 | - $form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0; |
|
1728 | - $form_title = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : ''; |
|
1729 | - $price_id = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null; |
|
1727 | + $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0; |
|
1728 | + $form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : ''; |
|
1729 | + $price_id = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null; |
|
1730 | 1730 | |
1731 | - if ( $level_title == true ) { |
|
1731 | + if ($level_title == true) { |
|
1732 | 1732 | $form_title = ''; |
1733 | 1733 | } |
1734 | 1734 | |
1735 | - if ( give_has_variable_prices( $form_id ) ) { |
|
1735 | + if (give_has_variable_prices($form_id)) { |
|
1736 | 1736 | |
1737 | - if ( ! empty( $separator ) ) { |
|
1738 | - $form_title .= ' ' . $separator; |
|
1737 | + if ( ! empty($separator)) { |
|
1738 | + $form_title .= ' '.$separator; |
|
1739 | 1739 | } |
1740 | 1740 | $form_title .= ' <span class="donation-level-text-wrap">'; |
1741 | 1741 | |
1742 | - if ( $price_id == 'custom' ) { |
|
1743 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
1744 | - $form_title .= ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ); |
|
1742 | + if ($price_id == 'custom') { |
|
1743 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
1744 | + $form_title .= ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'); |
|
1745 | 1745 | } else { |
1746 | - $form_title .= give_get_price_option_name( $form_id, $price_id ); |
|
1746 | + $form_title .= give_get_price_option_name($form_id, $price_id); |
|
1747 | 1747 | } |
1748 | 1748 | |
1749 | 1749 | $form_title .= '</span>'; |
1750 | 1750 | |
1751 | 1751 | } |
1752 | 1752 | |
1753 | - return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta ); |
|
1753 | + return apply_filters('give_get_payment_form_title', $form_title, $payment_meta); |
|
1754 | 1754 | |
1755 | 1755 | } |
1756 | 1756 | |
@@ -1764,20 +1764,20 @@ discard block |
||
1764 | 1764 | * |
1765 | 1765 | * @return string $price_id |
1766 | 1766 | */ |
1767 | -function give_get_price_id( $form_id, $price ) { |
|
1767 | +function give_get_price_id($form_id, $price) { |
|
1768 | 1768 | |
1769 | 1769 | $price_id = 0; |
1770 | 1770 | |
1771 | - if ( give_has_variable_prices( $form_id ) ) { |
|
1771 | + if (give_has_variable_prices($form_id)) { |
|
1772 | 1772 | |
1773 | - $levels = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) ); |
|
1773 | + $levels = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true)); |
|
1774 | 1774 | |
1775 | - foreach ( $levels as $level ) { |
|
1775 | + foreach ($levels as $level) { |
|
1776 | 1776 | |
1777 | - $level_amount = (float) give_sanitize_amount( $level['_give_amount'] ); |
|
1777 | + $level_amount = (float) give_sanitize_amount($level['_give_amount']); |
|
1778 | 1778 | |
1779 | 1779 | //check that this indeed the recurring price |
1780 | - if ( $level_amount == $price ) { |
|
1780 | + if ($level_amount == $price) { |
|
1781 | 1781 | |
1782 | 1782 | $price_id = $level['_give_id']['level_id']; |
1783 | 1783 | |
@@ -1804,10 +1804,10 @@ discard block |
||
1804 | 1804 | * |
1805 | 1805 | * @return string/void |
1806 | 1806 | */ |
1807 | -function give_get_form_dropdown( $args = array(), $echo = false ) { |
|
1808 | - $form_dropdown_html = Give()->html->forms_dropdown( $args ); |
|
1807 | +function give_get_form_dropdown($args = array(), $echo = false) { |
|
1808 | + $form_dropdown_html = Give()->html->forms_dropdown($args); |
|
1809 | 1809 | |
1810 | - if ( ! $echo ) { |
|
1810 | + if ( ! $echo) { |
|
1811 | 1811 | return $form_dropdown_html; |
1812 | 1812 | } |
1813 | 1813 | |
@@ -1824,39 +1824,39 @@ discard block |
||
1824 | 1824 | * |
1825 | 1825 | * @return string/void |
1826 | 1826 | */ |
1827 | -function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) { |
|
1827 | +function give_get_form_variable_price_dropdown($args = array(), $echo = false) { |
|
1828 | 1828 | |
1829 | 1829 | // Check for give form id. |
1830 | - if ( empty( $args['id'] ) ) { |
|
1830 | + if (empty($args['id'])) { |
|
1831 | 1831 | return false; |
1832 | 1832 | } |
1833 | 1833 | |
1834 | 1834 | // Check if form has variable prices or not. |
1835 | - if ( ! ( $variable_prices = give_has_variable_prices( $args['id'] ) ) ) { |
|
1835 | + if ( ! ($variable_prices = give_has_variable_prices($args['id']))) { |
|
1836 | 1836 | return false; |
1837 | 1837 | } |
1838 | 1838 | |
1839 | - $variable_prices = give_get_variable_prices( absint( $args['id'] ) ); |
|
1839 | + $variable_prices = give_get_variable_prices(absint($args['id'])); |
|
1840 | 1840 | $variable_price_options = array(); |
1841 | 1841 | |
1842 | 1842 | // Check if multi donation form support custom donation or not. |
1843 | - if ( give_is_custom_price_mode( absint( $args['id'] ) ) ) { |
|
1844 | - $variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' ); |
|
1843 | + if (give_is_custom_price_mode(absint($args['id']))) { |
|
1844 | + $variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give'); |
|
1845 | 1845 | } |
1846 | 1846 | |
1847 | 1847 | // Get variable price and ID from variable price array. |
1848 | - foreach ( $variable_prices as $variable_price ) { |
|
1849 | - $variable_price_options[ $variable_price['_give_id']['level_id'] ] = $variable_price['_give_text']; |
|
1848 | + foreach ($variable_prices as $variable_price) { |
|
1849 | + $variable_price_options[$variable_price['_give_id']['level_id']] = $variable_price['_give_text']; |
|
1850 | 1850 | } |
1851 | 1851 | |
1852 | 1852 | |
1853 | 1853 | // Update options. |
1854 | - $args = array_merge( $args, array( 'options' => $variable_price_options ) ); |
|
1854 | + $args = array_merge($args, array('options' => $variable_price_options)); |
|
1855 | 1855 | |
1856 | 1856 | // Generate select html. |
1857 | - $form_dropdown_html = Give()->html->select( $args ); |
|
1857 | + $form_dropdown_html = Give()->html->select($args); |
|
1858 | 1858 | |
1859 | - if ( ! $echo ) { |
|
1859 | + if ( ! $echo) { |
|
1860 | 1860 | return $form_dropdown_html; |
1861 | 1861 | } |
1862 | 1862 |