@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @since 1.0 |
108 | 108 | * @access public |
109 | 109 | * |
110 | - * @param $query_var |
|
110 | + * @param string $query_var |
|
111 | 111 | * @param $value |
112 | 112 | */ |
113 | 113 | public function __set( $query_var, $value ) { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @since 1.0 |
125 | 125 | * @access public |
126 | 126 | * |
127 | - * @param $query_var |
|
127 | + * @param string $query_var |
|
128 | 128 | */ |
129 | 129 | public function __unset( $query_var ) { |
130 | 130 | unset( $this->args[ $query_var ] ); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | * @param string $order |
469 | 469 | * @param WP_Query $query |
470 | 470 | * |
471 | - * @return mixed |
|
471 | + * @return string |
|
472 | 472 | */ |
473 | 473 | public function custom_orderby( $order, $query ) { |
474 | 474 |
@@ -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 | |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
68 | 68 | */ |
69 | - public function __construct( $args = array() ) { |
|
69 | + public function __construct($args = array()) { |
|
70 | 70 | $defaults = array( |
71 | 71 | 'output' => 'payments', |
72 | - 'post_type' => array( 'give_payment' ), |
|
72 | + 'post_type' => array('give_payment'), |
|
73 | 73 | 'start_date' => false, |
74 | 74 | 'end_date' => false, |
75 | 75 | 'number' => 20, |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'count' => false, |
97 | 97 | ); |
98 | 98 | |
99 | - $this->args = $this->_args = wp_parse_args( $args, $defaults ); |
|
99 | + $this->args = $this->_args = wp_parse_args($args, $defaults); |
|
100 | 100 | |
101 | 101 | $this->init(); |
102 | 102 | } |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | * @param $query_var |
111 | 111 | * @param $value |
112 | 112 | */ |
113 | - public function __set( $query_var, $value ) { |
|
114 | - if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) { |
|
115 | - $this->args[ $query_var ][] = $value; |
|
113 | + public function __set($query_var, $value) { |
|
114 | + if (in_array($query_var, array('meta_query', 'tax_query'))) { |
|
115 | + $this->args[$query_var][] = $value; |
|
116 | 116 | } else { |
117 | - $this->args[ $query_var ] = $value; |
|
117 | + $this->args[$query_var] = $value; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @param $query_var |
128 | 128 | */ |
129 | - public function __unset( $query_var ) { |
|
130 | - unset( $this->args[ $query_var ] ); |
|
129 | + public function __unset($query_var) { |
|
130 | + unset($this->args[$query_var]); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $this->give_forms(); |
168 | 168 | $this->gateway_filter(); |
169 | 169 | |
170 | - add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 ); |
|
170 | + add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2); |
|
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Fires after setup filters. |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param Give_Payments_Query $this Payments query object. |
178 | 178 | */ |
179 | - do_action( 'give_pre_get_payments', $this ); |
|
179 | + do_action('give_pre_get_payments', $this); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @access private |
187 | 187 | */ |
188 | 188 | private function unset_filters() { |
189 | - remove_filter( 'posts_orderby', array( $this, 'custom_orderby' ) ); |
|
189 | + remove_filter('posts_orderby', array($this, 'custom_orderby')); |
|
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Fires after retrieving payments. |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @param Give_Payments_Query $this Payments query object. |
197 | 197 | */ |
198 | - do_action( 'give_post_get_payments', $this ); |
|
198 | + do_action('give_post_get_payments', $this); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | * @return array |
213 | 213 | */ |
214 | 214 | public function get_payments() { |
215 | - $cache_key = Give_Cache::get_key( 'give_payment_query', $this->args, false ); |
|
216 | - $this->payments = Give_Cache::get_db_query( $cache_key ); |
|
215 | + $cache_key = Give_Cache::get_key('give_payment_query', $this->args, false); |
|
216 | + $this->payments = Give_Cache::get_db_query($cache_key); |
|
217 | 217 | |
218 | 218 | // Return cached result. |
219 | - if ( ! is_null( $this->payments ) ) { |
|
219 | + if ( ! is_null($this->payments)) { |
|
220 | 220 | return $this->payments; |
221 | 221 | } |
222 | 222 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | // Modify the query/query arguments before we retrieve payments. |
225 | 225 | $this->set_filters(); |
226 | 226 | |
227 | - $query = new WP_Query( $this->args ); |
|
227 | + $query = new WP_Query($this->args); |
|
228 | 228 | $this->payments = array(); |
229 | 229 | |
230 | 230 | $custom_output = array( |
@@ -232,24 +232,24 @@ discard block |
||
232 | 232 | 'give_payments', |
233 | 233 | ); |
234 | 234 | |
235 | - if ( ! in_array( $this->args['output'], $custom_output ) ) { |
|
235 | + if ( ! in_array($this->args['output'], $custom_output)) { |
|
236 | 236 | return $query->posts; |
237 | 237 | } |
238 | 238 | |
239 | - if ( $query->have_posts() ) { |
|
240 | - while ( $query->have_posts() ) { |
|
239 | + if ($query->have_posts()) { |
|
240 | + while ($query->have_posts()) { |
|
241 | 241 | $query->the_post(); |
242 | 242 | |
243 | 243 | $payment_id = get_post()->ID; |
244 | - $payment = new Give_Payment( $payment_id ); |
|
244 | + $payment = new Give_Payment($payment_id); |
|
245 | 245 | |
246 | - $this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this ); |
|
246 | + $this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | wp_reset_postdata(); |
250 | 250 | } |
251 | 251 | |
252 | - Give_Cache::set_db_query( $cache_key, $this->payments ); |
|
252 | + Give_Cache::set_db_query($cache_key, $this->payments); |
|
253 | 253 | |
254 | 254 | // Remove query filters after we retrieve payments. |
255 | 255 | $this->unset_filters(); |
@@ -268,31 +268,31 @@ discard block |
||
268 | 268 | public function get_payment_by_group() { |
269 | 269 | global $wpdb; |
270 | 270 | |
271 | - $allowed_groups = array( 'post_status' ); |
|
271 | + $allowed_groups = array('post_status'); |
|
272 | 272 | $result = array(); |
273 | 273 | |
274 | 274 | |
275 | - if ( in_array( $this->args['group_by'], $allowed_groups ) ) { |
|
275 | + if (in_array($this->args['group_by'], $allowed_groups)) { |
|
276 | 276 | // Set only count in result. |
277 | - if ( $this->args['count'] ) { |
|
277 | + if ($this->args['count']) { |
|
278 | 278 | |
279 | 279 | $this->set_filters(); |
280 | 280 | |
281 | - $new_results = $wpdb->get_results( $this->get_sql(), ARRAY_N ); |
|
281 | + $new_results = $wpdb->get_results($this->get_sql(), ARRAY_N); |
|
282 | 282 | |
283 | 283 | $this->unset_filters(); |
284 | 284 | |
285 | - foreach ( $new_results as $results ) { |
|
286 | - $result[ $results[0] ] = $results[1]; |
|
285 | + foreach ($new_results as $results) { |
|
286 | + $result[$results[0]] = $results[1]; |
|
287 | 287 | } |
288 | 288 | |
289 | - switch ( $this->args['group_by'] ) { |
|
289 | + switch ($this->args['group_by']) { |
|
290 | 290 | case 'post_status': |
291 | 291 | |
292 | 292 | /* @var Give_Payment $donation */ |
293 | - foreach ( give_get_payment_status_keys() as $status ) { |
|
294 | - if ( ! isset( $result[ $status ] ) ) { |
|
295 | - $result[ $status ] = 0; |
|
293 | + foreach (give_get_payment_status_keys() as $status) { |
|
294 | + if ( ! isset($result[$status])) { |
|
295 | + $result[$status] = 0; |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | $donations = $this->get_payments(); |
303 | 303 | |
304 | 304 | /* @var $donation Give_Payment */ |
305 | - foreach ( $donations as $donation ) { |
|
306 | - $result[ $donation->{$this->args['group_by']} ][] = $donation; |
|
305 | + foreach ($donations as $donation) { |
|
306 | + $result[$donation->{$this->args['group_by']}][] = $donation; |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @since 1.8.17 |
316 | 316 | */ |
317 | - return apply_filters( 'give_get_payment_by_group', $result, $this ); |
|
317 | + return apply_filters('give_get_payment_by_group', $result, $this); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
@@ -326,29 +326,29 @@ discard block |
||
326 | 326 | * @return void |
327 | 327 | */ |
328 | 328 | public function date_filter_pre() { |
329 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
329 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
330 | 330 | return; |
331 | 331 | } |
332 | 332 | |
333 | - $this->setup_dates( $this->args['start_date'], $this->args['end_date'] ); |
|
334 | - $is_start_date = property_exists( __CLASS__, 'start_date' ); |
|
335 | - $is_end_date = property_exists( __CLASS__, 'end_date' ); |
|
333 | + $this->setup_dates($this->args['start_date'], $this->args['end_date']); |
|
334 | + $is_start_date = property_exists(__CLASS__, 'start_date'); |
|
335 | + $is_end_date = property_exists(__CLASS__, 'end_date'); |
|
336 | 336 | |
337 | - if ( $is_start_date || $is_end_date ) { |
|
337 | + if ($is_start_date || $is_end_date) { |
|
338 | 338 | $date_query = array(); |
339 | 339 | |
340 | - if ( $is_start_date && ! is_wp_error( $this->start_date ) ) { |
|
341 | - $date_query['after'] = date( 'Y-m-d H:i:s', $this->start_date ); |
|
340 | + if ($is_start_date && ! is_wp_error($this->start_date)) { |
|
341 | + $date_query['after'] = date('Y-m-d H:i:s', $this->start_date); |
|
342 | 342 | } |
343 | 343 | |
344 | - if ( $is_end_date && ! is_wp_error( $this->end_date ) ) { |
|
345 | - $date_query['before'] = date( 'Y-m-d H:i:s', $this->end_date ); |
|
344 | + if ($is_end_date && ! is_wp_error($this->end_date)) { |
|
345 | + $date_query['before'] = date('Y-m-d H:i:s', $this->end_date); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | // Include Start Date and End Date while querying. |
349 | 349 | $date_query['inclusive'] = true; |
350 | 350 | |
351 | - $this->__set( 'date_query', $date_query ); |
|
351 | + $this->__set('date_query', $date_query); |
|
352 | 352 | |
353 | 353 | } |
354 | 354 | |
@@ -363,12 +363,12 @@ discard block |
||
363 | 363 | * @return void |
364 | 364 | */ |
365 | 365 | public function status() { |
366 | - if ( ! isset( $this->args['status'] ) ) { |
|
366 | + if ( ! isset($this->args['status'])) { |
|
367 | 367 | return; |
368 | 368 | } |
369 | 369 | |
370 | - $this->__set( 'post_status', $this->args['status'] ); |
|
371 | - $this->__unset( 'status' ); |
|
370 | + $this->__set('post_status', $this->args['status']); |
|
371 | + $this->__unset('status'); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
@@ -380,12 +380,12 @@ discard block |
||
380 | 380 | * @return void |
381 | 381 | */ |
382 | 382 | public function page() { |
383 | - if ( ! isset( $this->args['page'] ) ) { |
|
383 | + if ( ! isset($this->args['page'])) { |
|
384 | 384 | return; |
385 | 385 | } |
386 | 386 | |
387 | - $this->__set( 'paged', $this->args['page'] ); |
|
388 | - $this->__unset( 'page' ); |
|
387 | + $this->__set('paged', $this->args['page']); |
|
388 | + $this->__unset('page'); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
@@ -398,17 +398,17 @@ discard block |
||
398 | 398 | */ |
399 | 399 | public function per_page() { |
400 | 400 | |
401 | - if ( ! isset( $this->args['number'] ) ) { |
|
401 | + if ( ! isset($this->args['number'])) { |
|
402 | 402 | return; |
403 | 403 | } |
404 | 404 | |
405 | - if ( $this->args['number'] == - 1 ) { |
|
406 | - $this->__set( 'nopaging', true ); |
|
405 | + if ($this->args['number'] == - 1) { |
|
406 | + $this->__set('nopaging', true); |
|
407 | 407 | } else { |
408 | - $this->__set( 'posts_per_page', $this->args['number'] ); |
|
408 | + $this->__set('posts_per_page', $this->args['number']); |
|
409 | 409 | } |
410 | 410 | |
411 | - $this->__unset( 'number' ); |
|
411 | + $this->__unset('number'); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | /** |
@@ -420,12 +420,12 @@ discard block |
||
420 | 420 | * @return void |
421 | 421 | */ |
422 | 422 | public function month() { |
423 | - if ( ! isset( $this->args['month'] ) ) { |
|
423 | + if ( ! isset($this->args['month'])) { |
|
424 | 424 | return; |
425 | 425 | } |
426 | 426 | |
427 | - $this->__set( 'monthnum', $this->args['month'] ); |
|
428 | - $this->__unset( 'month' ); |
|
427 | + $this->__set('monthnum', $this->args['month']); |
|
428 | + $this->__unset('month'); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | /** |
@@ -437,23 +437,23 @@ discard block |
||
437 | 437 | * @return void |
438 | 438 | */ |
439 | 439 | public function orderby() { |
440 | - switch ( $this->args['orderby'] ) { |
|
440 | + switch ($this->args['orderby']) { |
|
441 | 441 | case 'amount': |
442 | - $this->__set( 'orderby', 'meta_value_num' ); |
|
443 | - $this->__set( 'meta_key', '_give_payment_total' ); |
|
442 | + $this->__set('orderby', 'meta_value_num'); |
|
443 | + $this->__set('meta_key', '_give_payment_total'); |
|
444 | 444 | break; |
445 | 445 | |
446 | 446 | case 'status': |
447 | - $this->__set( 'orderby', 'post_status' ); |
|
447 | + $this->__set('orderby', 'post_status'); |
|
448 | 448 | break; |
449 | 449 | |
450 | 450 | case 'donation_form': |
451 | - $this->__set( 'orderby', 'meta_value' ); |
|
452 | - $this->__set( 'meta_key', '_give_payment_form_title' ); |
|
451 | + $this->__set('orderby', 'meta_value'); |
|
452 | + $this->__set('meta_key', '_give_payment_form_title'); |
|
453 | 453 | break; |
454 | 454 | |
455 | 455 | default: |
456 | - $this->__set( 'orderby', $this->args['orderby'] ); |
|
456 | + $this->__set('orderby', $this->args['orderby']); |
|
457 | 457 | break; |
458 | 458 | } |
459 | 459 | } |
@@ -470,19 +470,19 @@ discard block |
||
470 | 470 | * |
471 | 471 | * @return mixed |
472 | 472 | */ |
473 | - public function custom_orderby( $order, $query ) { |
|
473 | + public function custom_orderby($order, $query) { |
|
474 | 474 | |
475 | - if ( ! empty( $query->query['post_type'] ) ) { |
|
476 | - $post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] ); |
|
475 | + if ( ! empty($query->query['post_type'])) { |
|
476 | + $post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']); |
|
477 | 477 | |
478 | - if ( ! in_array( 'give_payment', $post_types ) || is_array( $query->query['orderby'] ) ) { |
|
478 | + if ( ! in_array('give_payment', $post_types) || is_array($query->query['orderby'])) { |
|
479 | 479 | return $order; |
480 | 480 | } |
481 | 481 | |
482 | 482 | global $wpdb; |
483 | - switch ( $query->query['orderby'] ) { |
|
483 | + switch ($query->query['orderby']) { |
|
484 | 484 | case 'post_status': |
485 | - $order = $wpdb->posts . '.post_status ' . strtoupper( $query->query['order'] ); |
|
485 | + $order = $wpdb->posts.'.post_status '.strtoupper($query->query['order']); |
|
486 | 486 | break; |
487 | 487 | } |
488 | 488 | } |
@@ -499,11 +499,11 @@ discard block |
||
499 | 499 | * @return void |
500 | 500 | */ |
501 | 501 | public function user() { |
502 | - if ( is_null( $this->args['user'] ) ) { |
|
502 | + if (is_null($this->args['user'])) { |
|
503 | 503 | return; |
504 | 504 | } |
505 | 505 | |
506 | - if ( is_numeric( $this->args['user'] ) ) { |
|
506 | + if (is_numeric($this->args['user'])) { |
|
507 | 507 | $user_key = '_give_payment_donor_id'; |
508 | 508 | } else { |
509 | 509 | $user_key = '_give_payment_donor_email'; |
@@ -525,16 +525,16 @@ discard block |
||
525 | 525 | * @return void |
526 | 526 | */ |
527 | 527 | public function donor() { |
528 | - if ( is_null( $this->args['donor'] ) || ! is_numeric( $this->args['donor'] ) ) { |
|
528 | + if (is_null($this->args['donor']) || ! is_numeric($this->args['donor'])) { |
|
529 | 529 | return; |
530 | 530 | } |
531 | 531 | |
532 | 532 | $donor_meta_type = Give()->donor_meta->meta_type; |
533 | 533 | |
534 | - $this->__set( 'meta_query', array( |
|
534 | + $this->__set('meta_query', array( |
|
535 | 535 | 'key' => "_give_payment_{$donor_meta_type}_id", |
536 | 536 | 'value' => (int) $this->args['donor'], |
537 | - ) ); |
|
537 | + )); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | /** |
@@ -547,33 +547,33 @@ discard block |
||
547 | 547 | */ |
548 | 548 | public function search() { |
549 | 549 | |
550 | - if ( ! isset( $this->args['s'] ) ) { |
|
550 | + if ( ! isset($this->args['s'])) { |
|
551 | 551 | return; |
552 | 552 | } |
553 | 553 | |
554 | - $search = trim( $this->args['s'] ); |
|
554 | + $search = trim($this->args['s']); |
|
555 | 555 | |
556 | - if ( empty( $search ) ) { |
|
556 | + if (empty($search)) { |
|
557 | 557 | return; |
558 | 558 | } |
559 | 559 | |
560 | - $is_email = is_email( $search ) || strpos( $search, '@' ) !== false; |
|
561 | - $is_user = strpos( $search, strtolower( 'user:' ) ) !== false; |
|
560 | + $is_email = is_email($search) || strpos($search, '@') !== false; |
|
561 | + $is_user = strpos($search, strtolower('user:')) !== false; |
|
562 | 562 | |
563 | - if ( ! empty( $this->args['search_in_notes'] ) ) { |
|
563 | + if ( ! empty($this->args['search_in_notes'])) { |
|
564 | 564 | |
565 | - $notes = give_get_payment_notes( 0, $search ); |
|
565 | + $notes = give_get_payment_notes(0, $search); |
|
566 | 566 | |
567 | - if ( ! empty( $notes ) ) { |
|
567 | + if ( ! empty($notes)) { |
|
568 | 568 | |
569 | - $payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' ); |
|
569 | + $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); |
|
570 | 570 | |
571 | - $this->__set( 'post__in', $payment_ids ); |
|
571 | + $this->__set('post__in', $payment_ids); |
|
572 | 572 | } |
573 | 573 | |
574 | - $this->__unset( 's' ); |
|
574 | + $this->__unset('s'); |
|
575 | 575 | |
576 | - } elseif ( $is_email || strlen( $search ) == 32 ) { |
|
576 | + } elseif ($is_email || strlen($search) == 32) { |
|
577 | 577 | |
578 | 578 | $key = $is_email ? '_give_payment_donor_email' : '_give_payment_purchase_key'; |
579 | 579 | $search_meta = array( |
@@ -582,19 +582,19 @@ discard block |
||
582 | 582 | 'compare' => 'LIKE', |
583 | 583 | ); |
584 | 584 | |
585 | - $this->__set( 'meta_query', $search_meta ); |
|
586 | - $this->__unset( 's' ); |
|
585 | + $this->__set('meta_query', $search_meta); |
|
586 | + $this->__unset('s'); |
|
587 | 587 | |
588 | - } elseif ( $is_user ) { |
|
588 | + } elseif ($is_user) { |
|
589 | 589 | |
590 | 590 | $search_meta = array( |
591 | 591 | 'key' => '_give_payment_donor_id', |
592 | - 'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ), |
|
592 | + 'value' => trim(str_replace('user:', '', strtolower($search))), |
|
593 | 593 | ); |
594 | 594 | |
595 | - $this->__set( 'meta_query', $search_meta ); |
|
595 | + $this->__set('meta_query', $search_meta); |
|
596 | 596 | |
597 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
597 | + if (give_get_option('enable_sequential')) { |
|
598 | 598 | |
599 | 599 | $search_meta = array( |
600 | 600 | 'key' => '_give_payment_number', |
@@ -602,19 +602,19 @@ discard block |
||
602 | 602 | 'compare' => 'LIKE', |
603 | 603 | ); |
604 | 604 | |
605 | - $this->__set( 'meta_query', $search_meta ); |
|
605 | + $this->__set('meta_query', $search_meta); |
|
606 | 606 | |
607 | 607 | $this->args['meta_query']['relation'] = 'OR'; |
608 | 608 | |
609 | 609 | } |
610 | 610 | |
611 | - $this->__unset( 's' ); |
|
611 | + $this->__unset('s'); |
|
612 | 612 | |
613 | 613 | } elseif ( |
614 | - give_get_option( 'enable_sequential' ) && |
|
614 | + give_get_option('enable_sequential') && |
|
615 | 615 | ( |
616 | - false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) || |
|
617 | - false !== strpos( $search, give_get_option( 'sequential_postfix' ) ) |
|
616 | + false !== strpos($search, give_get_option('sequential_prefix')) || |
|
617 | + false !== strpos($search, give_get_option('sequential_postfix')) |
|
618 | 618 | ) |
619 | 619 | ) { |
620 | 620 | |
@@ -624,29 +624,29 @@ discard block |
||
624 | 624 | 'compare' => 'LIKE', |
625 | 625 | ); |
626 | 626 | |
627 | - $this->__set( 'meta_query', $search_meta ); |
|
628 | - $this->__unset( 's' ); |
|
627 | + $this->__set('meta_query', $search_meta); |
|
628 | + $this->__unset('s'); |
|
629 | 629 | |
630 | - } elseif ( is_numeric( $search ) ) { |
|
630 | + } elseif (is_numeric($search)) { |
|
631 | 631 | |
632 | - $post = get_post( $search ); |
|
632 | + $post = get_post($search); |
|
633 | 633 | |
634 | - if ( is_object( $post ) && $post->post_type == 'give_payment' ) { |
|
634 | + if (is_object($post) && $post->post_type == 'give_payment') { |
|
635 | 635 | |
636 | 636 | $arr = array(); |
637 | 637 | $arr[] = $search; |
638 | - $this->__set( 'post__in', $arr ); |
|
639 | - $this->__unset( 's' ); |
|
638 | + $this->__set('post__in', $arr); |
|
639 | + $this->__unset('s'); |
|
640 | 640 | } |
641 | - } elseif ( '#' == substr( $search, 0, 1 ) ) { |
|
641 | + } elseif ('#' == substr($search, 0, 1)) { |
|
642 | 642 | |
643 | - $search = str_replace( '#:', '', $search ); |
|
644 | - $search = str_replace( '#', '', $search ); |
|
645 | - $this->__set( 'give_forms', $search ); |
|
646 | - $this->__unset( 's' ); |
|
643 | + $search = str_replace('#:', '', $search); |
|
644 | + $search = str_replace('#', '', $search); |
|
645 | + $this->__set('give_forms', $search); |
|
646 | + $this->__unset('s'); |
|
647 | 647 | |
648 | 648 | } else { |
649 | - $this->__set( 's', $search ); |
|
649 | + $this->__set('s', $search); |
|
650 | 650 | |
651 | 651 | } |
652 | 652 | |
@@ -661,8 +661,8 @@ discard block |
||
661 | 661 | * @return void |
662 | 662 | */ |
663 | 663 | public function mode() { |
664 | - if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) { |
|
665 | - $this->__unset( 'mode' ); |
|
664 | + if (empty($this->args['mode']) || $this->args['mode'] == 'all') { |
|
665 | + $this->__unset('mode'); |
|
666 | 666 | |
667 | 667 | return; |
668 | 668 | } |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | * @return void |
685 | 685 | */ |
686 | 686 | public function children() { |
687 | - if ( empty( $this->args['children'] ) ) { |
|
688 | - $this->__set( 'post_parent', 0 ); |
|
687 | + if (empty($this->args['children'])) { |
|
688 | + $this->__set('post_parent', 0); |
|
689 | 689 | } |
690 | - $this->__unset( 'children' ); |
|
690 | + $this->__unset('children'); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | /** |
@@ -700,13 +700,13 @@ discard block |
||
700 | 700 | */ |
701 | 701 | public function give_forms() { |
702 | 702 | |
703 | - if ( empty( $this->args['give_forms'] ) ) { |
|
703 | + if (empty($this->args['give_forms'])) { |
|
704 | 704 | return; |
705 | 705 | } |
706 | 706 | |
707 | 707 | $compare = '='; |
708 | 708 | |
709 | - if ( is_array( $this->args['give_forms'] ) ) { |
|
709 | + if (is_array($this->args['give_forms'])) { |
|
710 | 710 | $compare = 'IN'; |
711 | 711 | } |
712 | 712 | |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | ) |
720 | 720 | ); |
721 | 721 | |
722 | - $this->__unset( 'give_forms' ); |
|
722 | + $this->__unset('give_forms'); |
|
723 | 723 | |
724 | 724 | } |
725 | 725 | |
@@ -733,13 +733,13 @@ discard block |
||
733 | 733 | */ |
734 | 734 | public function gateway_filter() { |
735 | 735 | |
736 | - if ( empty( $this->args['gateway'] ) ) { |
|
736 | + if (empty($this->args['gateway'])) { |
|
737 | 737 | return; |
738 | 738 | } |
739 | 739 | |
740 | 740 | $compare = '='; |
741 | 741 | |
742 | - if ( is_array( $this->args['gateway'] ) ) { |
|
742 | + if (is_array($this->args['gateway'])) { |
|
743 | 743 | $compare = 'IN'; |
744 | 744 | } |
745 | 745 | |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | ) |
754 | 754 | ); |
755 | 755 | |
756 | - $this->__unset( 'gateway' ); |
|
756 | + $this->__unset('gateway'); |
|
757 | 757 | |
758 | 758 | } |
759 | 759 | |
@@ -773,9 +773,9 @@ discard block |
||
773 | 773 | global $wpdb; |
774 | 774 | |
775 | 775 | $where = "WHERE {$wpdb->posts}.post_type = 'give_payment'"; |
776 | - $where .= " AND {$wpdb->posts}.post_status IN ('" . implode( "','", $this->args['post_status'] ) . "')"; |
|
776 | + $where .= " AND {$wpdb->posts}.post_status IN ('".implode("','", $this->args['post_status'])."')"; |
|
777 | 777 | |
778 | - if( is_numeric( $this->args['post_parent'] ) ) { |
|
778 | + if (is_numeric($this->args['post_parent'])) { |
|
779 | 779 | $where .= " AND {$wpdb->posts}.post_parent={$this->args['post_parent']}"; |
780 | 780 | } |
781 | 781 | |
@@ -784,42 +784,42 @@ discard block |
||
784 | 784 | $group_by = ''; |
785 | 785 | |
786 | 786 | // Set group by. |
787 | - if ( ! empty( $this->args['group_by'] ) ) { |
|
787 | + if ( ! empty($this->args['group_by'])) { |
|
788 | 788 | $group_by = "GROUP BY {$wpdb->posts}.{$this->args['group_by']}"; |
789 | 789 | } |
790 | 790 | |
791 | 791 | // Set offset. |
792 | 792 | if ( |
793 | - empty( $this->args['nopaging'] ) && |
|
794 | - empty( $this->args['offset'] ) && |
|
795 | - ( ! empty( $this->args['page'] ) && 0 < $this->args['page'] ) |
|
793 | + empty($this->args['nopaging']) && |
|
794 | + empty($this->args['offset']) && |
|
795 | + ( ! empty($this->args['page']) && 0 < $this->args['page']) |
|
796 | 796 | ) { |
797 | - $this->args['offset'] = $this->args['posts_per_page'] * ( $this->args['page'] - 1 ); |
|
797 | + $this->args['offset'] = $this->args['posts_per_page'] * ($this->args['page'] - 1); |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | // Set fields. |
801 | 801 | $fields = "{$wpdb->posts}.*"; |
802 | - if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) { |
|
803 | - if ( is_string( $this->args['fields'] ) ) { |
|
802 | + if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) { |
|
803 | + if (is_string($this->args['fields'])) { |
|
804 | 804 | $fields = "{$wpdb->posts}.{$this->args['fields']}"; |
805 | - } elseif ( is_array( $this->args['fields'] ) ) { |
|
806 | - $fields = "{$wpdb->posts}." . implode( " , {$wpdb->posts}.", $this->args['fields'] ); |
|
805 | + } elseif (is_array($this->args['fields'])) { |
|
806 | + $fields = "{$wpdb->posts}.".implode(" , {$wpdb->posts}.", $this->args['fields']); |
|
807 | 807 | } |
808 | 808 | } |
809 | 809 | |
810 | 810 | // Set count. |
811 | - if ( ! empty( $this->args['count'] ) ) { |
|
811 | + if ( ! empty($this->args['count'])) { |
|
812 | 812 | $fields = "COUNT({$wpdb->posts}.ID)"; |
813 | 813 | |
814 | - if ( ! empty( $this->args['group_by'] ) ) { |
|
814 | + if ( ! empty($this->args['group_by'])) { |
|
815 | 815 | $fields = "{$wpdb->posts}.{$this->args['group_by']}, {$fields}"; |
816 | 816 | } |
817 | 817 | } |
818 | 818 | |
819 | 819 | // Date query. |
820 | - if ( ! empty( $this->args['date_query'] ) ) { |
|
821 | - $date_query_obj = new WP_Date_Query( $this->args['date_query'] ); |
|
822 | - $where .= str_replace( |
|
820 | + if ( ! empty($this->args['date_query'])) { |
|
821 | + $date_query_obj = new WP_Date_Query($this->args['date_query']); |
|
822 | + $where .= str_replace( |
|
823 | 823 | array( |
824 | 824 | "\n", |
825 | 825 | '( (', |
@@ -835,22 +835,22 @@ discard block |
||
835 | 835 | } |
836 | 836 | |
837 | 837 | // Meta query. |
838 | - if ( ! empty( $this->args['meta_query'] ) ) { |
|
839 | - $meta_query_obj = new WP_Meta_Query( $this->args['meta_query'] ); |
|
840 | - $where = implode( ' ', $meta_query_obj->get_sql( 'post', $wpdb->posts, 'ID' ) ) . " {$where}"; |
|
841 | - $where = Give()->payment_meta->__rename_meta_table_name( $where, 'posts_where' ); |
|
838 | + if ( ! empty($this->args['meta_query'])) { |
|
839 | + $meta_query_obj = new WP_Meta_Query($this->args['meta_query']); |
|
840 | + $where = implode(' ', $meta_query_obj->get_sql('post', $wpdb->posts, 'ID'))." {$where}"; |
|
841 | + $where = Give()->payment_meta->__rename_meta_table_name($where, 'posts_where'); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | // Set sql query. |
845 | 845 | $sql = $wpdb->prepare( |
846 | 846 | "SELECT {$fields} FROM {$wpdb->posts} LIMIT %d,%d;", |
847 | - absint( $this->args['offset'] ), |
|
848 | - ( empty( $this->args['nopaging'] ) ? absint( $this->args['posts_per_page'] ) : 99999999999 ) |
|
847 | + absint($this->args['offset']), |
|
848 | + (empty($this->args['nopaging']) ? absint($this->args['posts_per_page']) : 99999999999) |
|
849 | 849 | ); |
850 | 850 | |
851 | 851 | // $where, $orderby and order already prepared query they can generate notice if you re prepare them in above. |
852 | 852 | // WordPress consider LIKE condition as placeholder if start with s,f, or d. |
853 | - $sql = str_replace( 'LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql ); |
|
853 | + $sql = str_replace('LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql); |
|
854 | 854 | |
855 | 855 | return $sql; |
856 | 856 | } |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Page' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Page')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Page. |
@@ -70,25 +70,25 @@ discard block |
||
70 | 70 | // Get current setting page. |
71 | 71 | $this->current_setting_page = give_get_current_setting_page(); |
72 | 72 | |
73 | - add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 ); |
|
74 | - add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 ); |
|
75 | - add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
73 | + add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10); |
|
74 | + add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20); |
|
75 | + add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output')); |
|
76 | 76 | |
77 | 77 | // Output section only if exist. |
78 | 78 | $sections = $this->get_sections(); |
79 | - if ( ! empty( $sections ) ) { |
|
80 | - add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( |
|
79 | + if ( ! empty($sections)) { |
|
80 | + add_action("{$this->current_setting_page}_sections_{$this->id}_page", array( |
|
81 | 81 | $this, |
82 | 82 | 'output_sections', |
83 | - ) ); |
|
83 | + )); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Save hide button by default. |
87 | 87 | $GLOBALS['give_hide_save_button'] = true; |
88 | 88 | |
89 | 89 | // Enable saving feature. |
90 | - if ( $this->enable_save ) { |
|
91 | - add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) ); |
|
90 | + if ($this->enable_save) { |
|
91 | + add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save')); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string |
115 | 115 | */ |
116 | - function set_default_setting_tab( $setting_tab ) { |
|
116 | + function set_default_setting_tab($setting_tab) { |
|
117 | 117 | return $this->default_tab; |
118 | 118 | } |
119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return array |
128 | 128 | */ |
129 | - public function add_settings_page( $pages ) { |
|
130 | - $pages[ $this->id ] = $this->label; |
|
129 | + public function add_settings_page($pages) { |
|
130 | + $pages[$this->id] = $this->label; |
|
131 | 131 | |
132 | 132 | return $pages; |
133 | 133 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param array $settings |
148 | 148 | */ |
149 | - $settings = apply_filters( 'give_get_settings_' . $this->id, array() ); |
|
149 | + $settings = apply_filters('give_get_settings_'.$this->id, array()); |
|
150 | 150 | |
151 | 151 | // Output. |
152 | 152 | return $settings; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @return array |
160 | 160 | */ |
161 | 161 | public function get_sections() { |
162 | - return apply_filters( 'give_get_sections_' . $this->id, array() ); |
|
162 | + return apply_filters('give_get_sections_'.$this->id, array()); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -176,39 +176,39 @@ discard block |
||
176 | 176 | $sections = $this->get_sections(); |
177 | 177 | |
178 | 178 | // Bailout. |
179 | - if ( empty( $sections ) ) { |
|
179 | + if (empty($sections)) { |
|
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | 183 | // Show section settings only if setting section exist. |
184 | - if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) { |
|
185 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
184 | + if ($current_section && ! in_array($current_section, array_keys($sections))) { |
|
185 | + echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; |
|
186 | 186 | $GLOBALS['give_hide_save_button'] = true; |
187 | 187 | |
188 | 188 | return; |
189 | 189 | } |
190 | 190 | |
191 | - if ( is_null( $this->current_setting_page ) ) { |
|
191 | + if (is_null($this->current_setting_page)) { |
|
192 | 192 | $this->current_setting_page = give_get_current_setting_page(); |
193 | 193 | } |
194 | 194 | |
195 | 195 | $section_list = array(); |
196 | - foreach ( $sections as $id => $label ) { |
|
196 | + foreach ($sections as $id => $label) { |
|
197 | 197 | /** |
198 | 198 | * Fire the filter to hide particular section on tab. |
199 | 199 | * |
200 | 200 | * @since 2.0 |
201 | 201 | */ |
202 | - if ( apply_filters( "give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id ) ) { |
|
202 | + if (apply_filters("give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id)) { |
|
203 | 203 | continue; |
204 | 204 | } |
205 | 205 | |
206 | - $section_list[] = '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a>'; |
|
206 | + $section_list[] = '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'§ion='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a>'; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | echo sprintf( |
210 | 210 | '<ul class="subsubsub">%s</ul><br class="clear" /><hr>', |
211 | - implode( ' | </li>', $section_list ) |
|
211 | + implode(' | </li>', $section_list) |
|
212 | 212 | ); |
213 | 213 | } |
214 | 214 | |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | * @return void |
222 | 222 | */ |
223 | 223 | public function output() { |
224 | - if ( $this->enable_save ) { |
|
224 | + if ($this->enable_save) { |
|
225 | 225 | $GLOBALS['give_hide_save_button'] = false; |
226 | 226 | } |
227 | 227 | |
228 | 228 | $settings = $this->get_settings(); |
229 | 229 | |
230 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
230 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | $settings = $this->get_settings(); |
241 | 241 | $current_section = give_get_current_setting_section(); |
242 | 242 | |
243 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
243 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Trigger Action |
247 | 247 | * |
248 | 248 | * @since 1.8 |
249 | 249 | */ |
250 | - do_action( 'give_update_options_' . $this->id . '_' . $current_section ); |
|
250 | + do_action('give_update_options_'.$this->id.'_'.$current_section); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -264,11 +264,11 @@ discard block |
||
264 | 264 | $section = $this->get_sections(); |
265 | 265 | $current_section = give_get_current_setting_section(); |
266 | 266 | |
267 | - if ( array_key_exists( $current_section, $section ) ) { |
|
268 | - $heading[] = $section[ $current_section ]; |
|
267 | + if (array_key_exists($current_section, $section)) { |
|
268 | + $heading[] = $section[$current_section]; |
|
269 | 269 | } |
270 | 270 | |
271 | - return array_unique( $heading ); |
|
271 | + return array_unique($heading); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | public function get_heading_html() { |
283 | 283 | return sprintf( |
284 | 284 | '<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">', |
285 | - implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() ) |
|
285 | + implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading()) |
|
286 | 286 | ); |
287 | 287 | } |
288 | 288 | } |
@@ -402,8 +402,11 @@ |
||
402 | 402 | <span class="donor-user-id info-item editable"> |
403 | 403 | <?php if ( ! empty( $userdata ) ) : ?> |
404 | 404 | <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
405 | - <?php else: ?> |
|
406 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
405 | + <?php else { |
|
406 | + : ?> |
|
407 | + <span data-key="user_id"><?php _e( 'None', 'give' ); |
|
408 | +} |
|
409 | +?></span> |
|
407 | 410 | <?php endif; ?> |
408 | 411 | <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ): |
409 | 412 |
@@ -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 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return string |
27 | 27 | */ |
28 | -function __give_get_format_address( $address, $address_args = array() ) { |
|
28 | +function __give_get_format_address($address, $address_args = array()) { |
|
29 | 29 | $address_html = ''; |
30 | 30 | $address_args = wp_parse_args( |
31 | 31 | $address_args, |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $address_id = $address_args['type']; |
41 | 41 | |
42 | 42 | // Bailout. |
43 | - if ( empty( $address ) || ! is_array( $address ) ) { |
|
43 | + if (empty($address) || ! is_array($address)) { |
|
44 | 44 | return $address_html; |
45 | 45 | } |
46 | 46 | |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | $address_html .= sprintf( |
50 | 50 | '<span data-address-type="line1">%1$s</span>%2$s', |
51 | 51 | $address['line1'], |
52 | - ( ! empty( $address['line2'] ) ? '<br>' : '' ) |
|
52 | + ( ! empty($address['line2']) ? '<br>' : '') |
|
53 | 53 | ); |
54 | 54 | $address_html .= sprintf( |
55 | 55 | '<span data-address-type="line2">%1$s</span>%2$s', |
56 | 56 | $address['line2'], |
57 | - ( ! empty( $address['city'] ) ? '<br>' : '' ) |
|
57 | + ( ! empty($address['city']) ? '<br>' : '') |
|
58 | 58 | ); |
59 | 59 | $address_html .= sprintf( |
60 | 60 | '<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s', |
61 | 61 | $address['city'], |
62 | - ( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ), |
|
63 | - ( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ), |
|
64 | - ( ! empty( $address['country'] ) ? '<br>' : '' ) |
|
62 | + ( ! empty($address['state']) ? ", {$address['state']}" : ''), |
|
63 | + ( ! empty($address['zip']) ? " {$address['zip']}" : ''), |
|
64 | + ( ! empty($address['country']) ? '<br>' : '') |
|
65 | 65 | ); |
66 | 66 | $address_html .= sprintf( |
67 | 67 | '<span data-address-type="country">%s</span><br>', |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | // Address action. |
72 | 72 | $address_html .= sprintf( |
73 | 73 | '<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>', |
74 | - __( 'Edit', 'give' ), |
|
75 | - __( 'Remove', 'give' ) |
|
74 | + __('Edit', 'give'), |
|
75 | + __('Remove', 'give') |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | /** |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 2.0 |
82 | 82 | */ |
83 | - $address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args ); |
|
83 | + $address_label = apply_filters("give_donor_{$address_args['type']}_address_label", ucfirst($address_args['type']), $address_args); |
|
84 | 84 | |
85 | 85 | // Set unique id and index for multi type address. |
86 | - if ( isset( $address_args['index'] ) ) { |
|
86 | + if (isset($address_args['index'])) { |
|
87 | 87 | $address_label = "{$address_label} #{$address_args['index']}"; |
88 | 88 | } |
89 | 89 | |
90 | - if ( isset( $address_args['id'] ) ) { |
|
90 | + if (isset($address_args['id'])) { |
|
91 | 91 | $address_id = "{$address_id}_{$address_args['id']}"; |
92 | 92 | } |
93 | 93 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | */ |
113 | 113 | function give_donors_page() { |
114 | 114 | $default_views = give_donor_views(); |
115 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
116 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
117 | - give_render_donor_view( $requested_view, $default_views ); |
|
115 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
116 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
117 | + give_render_donor_view($requested_view, $default_views); |
|
118 | 118 | } else { |
119 | 119 | give_donors_list(); |
120 | 120 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $views = array(); |
132 | 132 | |
133 | - return apply_filters( 'give_donor_views', $views ); |
|
133 | + return apply_filters('give_donor_views', $views); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $tabs = array(); |
146 | 146 | |
147 | - return apply_filters( 'give_donor_tabs', $tabs ); |
|
147 | + return apply_filters('give_donor_tabs', $tabs); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function give_donors_list() { |
158 | 158 | |
159 | - include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php'; |
|
159 | + include GIVE_PLUGIN_DIR.'includes/admin/donors/class-donor-table.php'; |
|
160 | 160 | |
161 | 161 | $donors_table = new Give_Donor_List_Table(); |
162 | 162 | $donors_table->prepare_items(); |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @since 1.0 |
171 | 171 | */ |
172 | - do_action( 'give_donors_table_top' ); |
|
172 | + do_action('give_donors_table_top'); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <hr class="wp-header-end"> |
176 | - <form id="give-donors-search-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
177 | - <?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?> |
|
176 | + <form id="give-donors-search-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
177 | + <?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?> |
|
178 | 178 | <input type="hidden" name="post_type" value="give_forms" /> |
179 | 179 | <input type="hidden" name="page" value="give-donors" /> |
180 | 180 | <input type="hidden" name="view" value="donors" /> |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @since 1.0 |
193 | 193 | */ |
194 | - do_action( 'give_donors_table_bottom' ); |
|
194 | + do_action('give_donors_table_bottom'); |
|
195 | 195 | ?> |
196 | 196 | </div> |
197 | 197 | <?php |
@@ -207,33 +207,33 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return void |
209 | 209 | */ |
210 | -function give_render_donor_view( $view, $callbacks ) { |
|
210 | +function give_render_donor_view($view, $callbacks) { |
|
211 | 211 | |
212 | 212 | $render = true; |
213 | 213 | |
214 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
214 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
215 | 215 | |
216 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
217 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
216 | + if ( ! current_user_can($donor_view_role)) { |
|
217 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
218 | 218 | $render = false; |
219 | 219 | } |
220 | 220 | |
221 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
222 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
221 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
222 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
223 | 223 | $render = false; |
224 | 224 | } |
225 | 225 | |
226 | 226 | $donor_id = (int) $_GET['id']; |
227 | - $reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : ''; |
|
228 | - $donor = new Give_Donor( $donor_id ); |
|
227 | + $reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : ''; |
|
228 | + $donor = new Give_Donor($donor_id); |
|
229 | 229 | |
230 | 230 | // Reconnect User with Donor profile. |
231 | - if ( $reconnect_user_id ) { |
|
232 | - give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() ); |
|
231 | + if ($reconnect_user_id) { |
|
232 | + give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array()); |
|
233 | 233 | } |
234 | 234 | |
235 | - if ( empty( $donor->id ) ) { |
|
236 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
235 | + if (empty($donor->id)) { |
|
236 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
237 | 237 | $render = false; |
238 | 238 | } |
239 | 239 | |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | |
243 | 243 | <div class='wrap'> |
244 | 244 | |
245 | - <?php if ( give_get_errors() ) : ?> |
|
245 | + <?php if (give_get_errors()) : ?> |
|
246 | 246 | <div class="error settings-error"> |
247 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
247 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
248 | 248 | </div> |
249 | 249 | <?php endif; ?> |
250 | 250 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | <?php |
253 | 253 | printf( |
254 | 254 | /* translators: %s: donor first name */ |
255 | - __( 'Edit Donor #%s: %s %s', 'give' ), |
|
255 | + __('Edit Donor #%s: %s %s', 'give'), |
|
256 | 256 | $donor->id, |
257 | 257 | $donor->get_first_name(), |
258 | 258 | $donor->get_last_name() |
@@ -262,26 +262,26 @@ discard block |
||
262 | 262 | |
263 | 263 | <hr class="wp-header-end"> |
264 | 264 | |
265 | - <?php if ( $donor && $render ) : ?> |
|
265 | + <?php if ($donor && $render) : ?> |
|
266 | 266 | |
267 | 267 | <h2 class="nav-tab-wrapper"> |
268 | 268 | <?php |
269 | - foreach ( $donor_tabs as $key => $tab ) : |
|
269 | + foreach ($donor_tabs as $key => $tab) : |
|
270 | 270 | $active = $key === $view ? true : false; |
271 | 271 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
272 | 272 | printf( |
273 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
274 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
275 | - esc_attr( $class ), |
|
276 | - sanitize_html_class( $tab['dashicon'] ), |
|
277 | - esc_html( $tab['title'] ) |
|
273 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
274 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
275 | + esc_attr($class), |
|
276 | + sanitize_html_class($tab['dashicon']), |
|
277 | + esc_html($tab['title']) |
|
278 | 278 | ); |
279 | 279 | endforeach; |
280 | 280 | ?> |
281 | 281 | </h2> |
282 | 282 | |
283 | 283 | <div id="give-donor-card-wrapper"> |
284 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
284 | + <?php $callbacks[$view]($donor) ?> |
|
285 | 285 | </div> |
286 | 286 | |
287 | 287 | <?php endif; ?> |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @return void |
303 | 303 | */ |
304 | -function give_donor_view( $donor ) { |
|
304 | +function give_donor_view($donor) { |
|
305 | 305 | |
306 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
306 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
307 | 307 | |
308 | 308 | /** |
309 | 309 | * Fires in donor profile screen, above the donor card. |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @param object $donor The donor object being displayed. |
314 | 314 | */ |
315 | - do_action( 'give_donor_card_top', $donor ); |
|
315 | + do_action('give_donor_card_top', $donor); |
|
316 | 316 | |
317 | 317 | // Set Read only to the fields which needs to be locked. |
318 | 318 | $read_only = ''; |
319 | - if ( $donor->user_id ) { |
|
319 | + if ($donor->user_id) { |
|
320 | 320 | $read_only = 'readonly="readonly"'; |
321 | 321 | } |
322 | 322 | ?> |
@@ -324,14 +324,14 @@ discard block |
||
324 | 324 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
325 | 325 | |
326 | 326 | <form id="edit-donor-info" method="post" |
327 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
327 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
328 | 328 | |
329 | 329 | <div class="donor-info"> |
330 | 330 | |
331 | 331 | <div class="donor-bio-header clearfix"> |
332 | 332 | |
333 | 333 | <div class="avatar-wrap left" id="donor-avatar"> |
334 | - <?php echo get_avatar( $donor->email ); ?> |
|
334 | + <?php echo get_avatar($donor->email); ?> |
|
335 | 335 | </div> |
336 | 336 | |
337 | 337 | <div id="donor-name-wrap" class="left"> |
@@ -339,18 +339,18 @@ discard block |
||
339 | 339 | <span class="donor-name info-item edit-item"> |
340 | 340 | <input <?php echo $read_only; ?> size="15" data-key="first_name" |
341 | 341 | name="customerinfo[first_name]" type="text" |
342 | - value="<?php esc_attr_e( $donor->get_first_name() ); ?>" |
|
343 | - placeholder="<?php _e( 'First Name', 'give' ); ?>"/> |
|
344 | - <?php if ( $donor->user_id ) : ?> |
|
342 | + value="<?php esc_attr_e($donor->get_first_name()); ?>" |
|
343 | + placeholder="<?php _e('First Name', 'give'); ?>"/> |
|
344 | + <?php if ($donor->user_id) : ?> |
|
345 | 345 | <a href="#" class="give-lock-block"> |
346 | 346 | <i class="give-icon give-icon-locked"></i> |
347 | 347 | </a> |
348 | 348 | <?php endif; ?> |
349 | 349 | <input <?php echo $read_only; ?> size="15" data-key="last_name" |
350 | 350 | name="customerinfo[last_name]" type="text" |
351 | - value="<?php esc_attr_e( $donor->get_last_name() ); ?>" |
|
352 | - placeholder="<?php _e( 'Last Name', 'give' ); ?>"/> |
|
353 | - <?php if ( $donor->user_id ) : ?> |
|
351 | + value="<?php esc_attr_e($donor->get_last_name()); ?>" |
|
352 | + placeholder="<?php _e('Last Name', 'give'); ?>"/> |
|
353 | + <?php if ($donor->user_id) : ?> |
|
354 | 354 | <a href="#" class="give-lock-block"> |
355 | 355 | <i class="give-icon give-icon-locked"></i> |
356 | 356 | </a> |
@@ -360,12 +360,12 @@ discard block |
||
360 | 360 | data-key="name"><?php echo $donor->name; ?></span></span> |
361 | 361 | </div> |
362 | 362 | <p class="donor-since info-item"> |
363 | - <?php _e( 'Donor since', 'give' ); ?> |
|
364 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
363 | + <?php _e('Donor since', 'give'); ?> |
|
364 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
365 | 365 | </p> |
366 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
366 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
367 | 367 | <a href="#" id="edit-donor" |
368 | - class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
368 | + class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
369 | 369 | <?php endif; ?> |
370 | 370 | </div> |
371 | 371 | <!-- /donor-bio-header --> |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | <table class="widefat"> |
376 | 376 | <tbody> |
377 | 377 | <tr class="alternate"> |
378 | - <th scope="col"><label for="tablecell"><?php _e( 'User:', 'give' ); ?></label></th> |
|
378 | + <th scope="col"><label for="tablecell"><?php _e('User:', 'give'); ?></label></th> |
|
379 | 379 | <td> |
380 | 380 | <span class="donor-user-id info-item edit-item"> |
381 | 381 | <?php |
@@ -392,22 +392,22 @@ discard block |
||
392 | 392 | 'data' => $data_atts, |
393 | 393 | ); |
394 | 394 | |
395 | - if ( ! empty( $user_id ) ) { |
|
396 | - $userdata = get_userdata( $user_id ); |
|
395 | + if ( ! empty($user_id)) { |
|
396 | + $userdata = get_userdata($user_id); |
|
397 | 397 | $user_args['selected'] = $user_id; |
398 | 398 | } |
399 | 399 | |
400 | - echo Give()->html->ajax_user_search( $user_args ); |
|
400 | + echo Give()->html->ajax_user_search($user_args); |
|
401 | 401 | ?> |
402 | 402 | </span> |
403 | 403 | |
404 | 404 | <span class="donor-user-id info-item editable"> |
405 | - <?php if ( ! empty( $userdata ) ) : ?> |
|
406 | - <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
405 | + <?php if ( ! empty($userdata)) : ?> |
|
406 | + <span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
407 | 407 | <?php else: ?> |
408 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
408 | + <span data-key="user_id"><?php _e('None', 'give'); ?></span> |
|
409 | 409 | <?php endif; ?> |
410 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ): |
|
410 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0): |
|
411 | 411 | |
412 | 412 | echo sprintf( |
413 | 413 | '- <span class="disconnect-user"> |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | | <span class="view-user-profile"> |
417 | 417 | <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a> |
418 | 418 | </span>', |
419 | - __( 'Disconnects the current user ID from this donor record.', 'give' ), |
|
420 | - __( 'Disconnect User', 'give' ), |
|
421 | - 'user-edit.php?user_id=' . $donor->user_id, |
|
422 | - __( 'View User Profile of current user ID.', 'give' ), |
|
423 | - __( 'View User Profile', 'give' ) |
|
419 | + __('Disconnects the current user ID from this donor record.', 'give'), |
|
420 | + __('Disconnect User', 'give'), |
|
421 | + 'user-edit.php?user_id='.$donor->user_id, |
|
422 | + __('View User Profile of current user ID.', 'give'), |
|
423 | + __('View User Profile', 'give') |
|
424 | 424 | ); |
425 | 425 | |
426 | 426 | endif; ?> |
@@ -436,11 +436,11 @@ discard block |
||
436 | 436 | |
437 | 437 | <span id="donor-edit-actions" class="edit-item"> |
438 | 438 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>"/> |
439 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
439 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
440 | 440 | <input type="hidden" name="give_action" value="edit-donor"/> |
441 | 441 | <input type="submit" id="give-edit-donor-save" class="button-secondary" |
442 | - value="<?php _e( 'Update Donor', 'give' ); ?>"/> |
|
443 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
442 | + value="<?php _e('Update Donor', 'give'); ?>"/> |
|
443 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
444 | 444 | </span> |
445 | 445 | |
446 | 446 | </form> |
@@ -455,24 +455,24 @@ discard block |
||
455 | 455 | * |
456 | 456 | * @param Give_Donor $donor The donor object being displayed. |
457 | 457 | */ |
458 | - do_action( 'give_donor_before_stats', $donor ); |
|
458 | + do_action('give_donor_before_stats', $donor); |
|
459 | 459 | ?> |
460 | 460 | |
461 | 461 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
462 | 462 | <ul> |
463 | 463 | <li> |
464 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
|
464 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>"> |
|
465 | 465 | <span class="dashicons dashicons-heart"></span> |
466 | 466 | <?php |
467 | 467 | // Completed Donations. |
468 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
469 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
468 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
469 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
470 | 470 | ?> |
471 | 471 | </a> |
472 | 472 | </li> |
473 | 473 | <li> |
474 | 474 | <span class="dashicons dashicons-chart-area"></span> |
475 | - <?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
475 | + <?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
476 | 476 | </li> |
477 | 477 | <?php |
478 | 478 | /** |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | * |
485 | 485 | * @param object $donor The donor object being displayed. |
486 | 486 | */ |
487 | - do_action( 'give_donor_stats_list', $donor ); |
|
487 | + do_action('give_donor_stats_list', $donor); |
|
488 | 488 | ?> |
489 | 489 | </ul> |
490 | 490 | </div> |
@@ -497,11 +497,11 @@ discard block |
||
497 | 497 | * |
498 | 498 | * @param Give_Donor $donor The donor object being displayed. |
499 | 499 | */ |
500 | - do_action( 'give_donor_before_address', $donor ); |
|
500 | + do_action('give_donor_before_address', $donor); |
|
501 | 501 | ?> |
502 | 502 | |
503 | 503 | <div id="donor-address-wrapper" class="donor-section clear"> |
504 | - <h3><?php _e( 'Addresses', 'give' ); ?></h3> |
|
504 | + <h3><?php _e('Addresses', 'give'); ?></h3> |
|
505 | 505 | |
506 | 506 | <div class="postbox"> |
507 | 507 | <div class="give-spinner-wrapper"> |
@@ -511,16 +511,16 @@ discard block |
||
511 | 511 | <div class="all-address"> |
512 | 512 | <div class="give-grid-row"> |
513 | 513 | <?php |
514 | - if ( ! empty( $donor->address ) ) : |
|
514 | + if ( ! empty($donor->address)) : |
|
515 | 515 | // Default address always will be at zero array index. |
516 | 516 | $is_set_as_default = null; |
517 | 517 | |
518 | - foreach ( $donor->address as $address_type => $addresses ) { |
|
518 | + foreach ($donor->address as $address_type => $addresses) { |
|
519 | 519 | |
520 | - switch ( true ) { |
|
521 | - case is_array( end( $addresses ) ): |
|
520 | + switch (true) { |
|
521 | + case is_array(end($addresses)): |
|
522 | 522 | $index = 1; |
523 | - foreach ( $addresses as $id => $address ) { |
|
523 | + foreach ($addresses as $id => $address) { |
|
524 | 524 | echo __give_get_format_address( |
525 | 525 | $address, |
526 | 526 | array( |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | ) |
531 | 531 | ); |
532 | 532 | |
533 | - $index ++; |
|
533 | + $index++; |
|
534 | 534 | } |
535 | 535 | break; |
536 | 536 | |
537 | - case is_string( end( $addresses ) ): |
|
537 | + case is_string(end($addresses)): |
|
538 | 538 | echo __give_get_format_address( |
539 | 539 | $addresses, |
540 | 540 | array( |
@@ -547,13 +547,13 @@ discard block |
||
547 | 547 | endif; |
548 | 548 | ?> |
549 | 549 | </div> |
550 | - <span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) { |
|
550 | + <span class="give-no-address-message<?php if ( ! empty($donor->address)) { |
|
551 | 551 | echo ' give-hidden'; |
552 | 552 | } ?>"> |
553 | - <?php _e( 'This donor does not have any addresses saved.', 'give' ); ?> |
|
553 | + <?php _e('This donor does not have any addresses saved.', 'give'); ?> |
|
554 | 554 | </span> |
555 | 555 | <button class="button add-new-address"> |
556 | - <?php _e( 'Add Address', 'give' ); ?> |
|
556 | + <?php _e('Add Address', 'give'); ?> |
|
557 | 557 | </button> |
558 | 558 | </div> |
559 | 559 | |
@@ -563,26 +563,26 @@ discard block |
||
563 | 563 | <tbody> |
564 | 564 | <tr> |
565 | 565 | <th class="col"> |
566 | - <label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
566 | + <label class="country"><?php esc_html_e('Country:', 'give'); ?></label> |
|
567 | 567 | </th> |
568 | 568 | <td> |
569 | 569 | <?php |
570 | - echo Give()->html->select( array( |
|
570 | + echo Give()->html->select(array( |
|
571 | 571 | 'options' => give_get_country_list(), |
572 | 572 | 'name' => 'country', |
573 | - 'selected' => give_get_option( 'base_country' ), |
|
573 | + 'selected' => give_get_option('base_country'), |
|
574 | 574 | 'show_option_all' => false, |
575 | 575 | 'show_option_none' => false, |
576 | 576 | 'chosen' => true, |
577 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
578 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
579 | - ) ); |
|
577 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
578 | + 'data' => array('search-type' => 'no_ajax'), |
|
579 | + )); |
|
580 | 580 | ?> |
581 | 581 | </td> |
582 | 582 | </tr> |
583 | 583 | <tr> |
584 | 584 | <th class="col"> |
585 | - <label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
585 | + <label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
586 | 586 | </th> |
587 | 587 | <td> |
588 | 588 | <input id="line1" name="line1" type="text" class="medium-text"/> |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | </tr> |
591 | 591 | <tr> |
592 | 592 | <th class="col"> |
593 | - <label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
593 | + <label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
594 | 594 | </th> |
595 | 595 | <td> |
596 | 596 | <input id="line2" type="text" name="line2" value="" class="medium-text"/> |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | </tr> |
600 | 600 | <tr> |
601 | 601 | <th class="col"> |
602 | - <label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
602 | + <label for="city"><?php esc_html_e('City:', 'give'); ?></label> |
|
603 | 603 | </th> |
604 | 604 | <td> |
605 | 605 | <input id="city" type="text" name="city" value="" class="medium-text"/> |
@@ -607,41 +607,41 @@ discard block |
||
607 | 607 | </tr> |
608 | 608 | <?php |
609 | 609 | $no_states_country = give_no_states_country_list(); |
610 | - $base_country = give_get_option( 'base_country' ); |
|
611 | - if ( ! array_key_exists( $base_country, $no_states_country ) ) { |
|
610 | + $base_country = give_get_option('base_country'); |
|
611 | + if ( ! array_key_exists($base_country, $no_states_country)) { |
|
612 | 612 | ?> |
613 | 613 | <tr class="give-field-wrap"> |
614 | 614 | <th class="col"> |
615 | - <label for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
615 | + <label for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
616 | 616 | </th> |
617 | 617 | <td> |
618 | 618 | <?php |
619 | - $states = give_get_states( $base_country ); |
|
619 | + $states = give_get_states($base_country); |
|
620 | 620 | $state_args = array( |
621 | 621 | 'name' => 'state', |
622 | 622 | 'class' => 'regular-text', |
623 | 623 | ); |
624 | 624 | |
625 | - if ( empty( $states ) ) { |
|
625 | + if (empty($states)) { |
|
626 | 626 | |
627 | 627 | // Show Text field, if empty states. |
628 | - $state_args = wp_parse_args( $state_args, array( |
|
629 | - 'value' => give_get_option( 'base_state' ), |
|
630 | - ) ); |
|
631 | - echo Give()->html->text( $state_args ); |
|
628 | + $state_args = wp_parse_args($state_args, array( |
|
629 | + 'value' => give_get_option('base_state'), |
|
630 | + )); |
|
631 | + echo Give()->html->text($state_args); |
|
632 | 632 | } else { |
633 | 633 | |
634 | 634 | // Show Chosen DropDown, if states are not empty. |
635 | - $state_args = wp_parse_args( $state_args, array( |
|
635 | + $state_args = wp_parse_args($state_args, array( |
|
636 | 636 | 'options' => $states, |
637 | - 'selected' => give_get_option( 'base_state' ), |
|
637 | + 'selected' => give_get_option('base_state'), |
|
638 | 638 | 'show_option_all' => false, |
639 | 639 | 'show_option_none' => false, |
640 | 640 | 'chosen' => true, |
641 | - 'placeholder' => __( 'Select a state', 'give' ), |
|
642 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
643 | - ) ); |
|
644 | - echo Give()->html->select( $state_args ); |
|
641 | + 'placeholder' => __('Select a state', 'give'), |
|
642 | + 'data' => array('search-type' => 'no_ajax'), |
|
643 | + )); |
|
644 | + echo Give()->html->select($state_args); |
|
645 | 645 | } |
646 | 646 | ?> |
647 | 647 | </td> |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | ?> |
652 | 652 | <tr> |
653 | 653 | <th class="col"> |
654 | - <label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
654 | + <label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
655 | 655 | </th> |
656 | 656 | <td> |
657 | 657 | <input id="zip" type="text" name="zip" value="" class="medium-text"/> |
@@ -659,12 +659,12 @@ discard block |
||
659 | 659 | </tr> |
660 | 660 | <tr> |
661 | 661 | <td colspan="2"> |
662 | - <?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?> |
|
662 | + <?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?> |
|
663 | 663 | <input type="hidden" name="address-action" value="add"> |
664 | 664 | <input type="hidden" name="address-id" value=""> |
665 | 665 | <input type="submit" class="button button-primary js-save" |
666 | - value="<?php _e( 'Save', 'give' ); ?>"> <button |
|
667 | - class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button> |
|
666 | + value="<?php _e('Save', 'give'); ?>"> <button |
|
667 | + class="button js-cancel"><?php _e('Cancel', 'give'); ?></button> |
|
668 | 668 | </td> |
669 | 669 | </tr> |
670 | 670 | </tbody> |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | * |
684 | 684 | * @param Give_Donor $donor The donor object being displayed. |
685 | 685 | */ |
686 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
686 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
687 | 687 | ?> |
688 | 688 | |
689 | 689 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -696,46 +696,46 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @param object $donor The donor object being displayed. |
698 | 698 | */ |
699 | - do_action( 'give_donor_before_tables', $donor ); |
|
699 | + do_action('give_donor_before_tables', $donor); |
|
700 | 700 | ?> |
701 | 701 | |
702 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
702 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
703 | 703 | |
704 | 704 | <table class="wp-list-table widefat striped emails"> |
705 | 705 | <thead> |
706 | 706 | <tr> |
707 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
708 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
707 | + <th><?php _e('Email', 'give'); ?></th> |
|
708 | + <th><?php _e('Actions', 'give'); ?></th> |
|
709 | 709 | </tr> |
710 | 710 | </thead> |
711 | 711 | |
712 | 712 | <tbody> |
713 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
713 | + <?php if ( ! empty($donor->emails)) { ?> |
|
714 | 714 | |
715 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
715 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
716 | 716 | <tr data-key="<?php echo $key; ?>"> |
717 | 717 | <td> |
718 | 718 | <?php echo $email; ?> |
719 | - <?php if ( 'primary' === $key ) : ?> |
|
719 | + <?php if ('primary' === $key) : ?> |
|
720 | 720 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
721 | 721 | <?php endif; ?> |
722 | 722 | </td> |
723 | 723 | <td> |
724 | - <?php if ( 'primary' !== $key ) : ?> |
|
724 | + <?php if ('primary' !== $key) : ?> |
|
725 | 725 | <?php |
726 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
727 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
728 | - 'email' => rawurlencode( $email ), |
|
726 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
727 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
728 | + 'email' => rawurlencode($email), |
|
729 | 729 | 'give_action' => 'set_donor_primary_email', |
730 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
731 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
732 | - 'email' => rawurlencode( $email ), |
|
730 | + ), $base_url), 'give-set-donor-primary-email'); |
|
731 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
732 | + 'email' => rawurlencode($email), |
|
733 | 733 | 'give_action' => 'remove_donor_email', |
734 | - ), $base_url ), 'give-remove-donor-email' ); |
|
734 | + ), $base_url), 'give-remove-donor-email'); |
|
735 | 735 | ?> |
736 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
736 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
737 | 737 | | |
738 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
738 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
739 | 739 | <?php endif; ?> |
740 | 740 | </td> |
741 | 741 | </tr> |
@@ -745,14 +745,14 @@ discard block |
||
745 | 745 | <td colspan="2" class="add-donor-email-td"> |
746 | 746 | <div class="add-donor-email-wrapper"> |
747 | 747 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/> |
748 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
748 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
749 | 749 | <input type="email" name="additional-email" value="" |
750 | - placeholder="<?php _e( 'Email Address', 'give' ); ?>"/> |
|
750 | + placeholder="<?php _e('Email Address', 'give'); ?>"/> |
|
751 | 751 | <input type="checkbox" name="make-additional-primary" value="1" |
752 | 752 | id="make-additional-primary"/> <label |
753 | - for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
753 | + for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
754 | 754 | <button class="button-secondary give-add-donor-email" |
755 | - id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
755 | + id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
756 | 756 | <span class="spinner"></span> |
757 | 757 | </div> |
758 | 758 | <div class="notice-wrap"></div> |
@@ -760,50 +760,50 @@ discard block |
||
760 | 760 | </tr> |
761 | 761 | <?php } else { ?> |
762 | 762 | <tr> |
763 | - <td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td> |
|
763 | + <td colspan="2"><?php _e('No Emails Found', 'give'); ?></td> |
|
764 | 764 | </tr> |
765 | 765 | <?php }// End if(). |
766 | 766 | ?> |
767 | 767 | </tbody> |
768 | 768 | </table> |
769 | 769 | |
770 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
770 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
771 | 771 | <?php |
772 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
773 | - $payments = give_get_payments( array( |
|
772 | + $payment_ids = explode(',', $donor->payment_ids); |
|
773 | + $payments = give_get_payments(array( |
|
774 | 774 | 'post__in' => $payment_ids, |
775 | - ) ); |
|
776 | - $payments = array_slice( $payments, 0, 10 ); |
|
775 | + )); |
|
776 | + $payments = array_slice($payments, 0, 10); |
|
777 | 777 | ?> |
778 | 778 | <table class="wp-list-table widefat striped payments"> |
779 | 779 | <thead> |
780 | 780 | <tr> |
781 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
782 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
783 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
784 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
785 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
781 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
782 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
783 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
784 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
785 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
786 | 786 | </tr> |
787 | 787 | </thead> |
788 | 788 | <tbody> |
789 | - <?php if ( ! empty( $payments ) ) { ?> |
|
790 | - <?php foreach ( $payments as $payment ) : ?> |
|
789 | + <?php if ( ! empty($payments)) { ?> |
|
790 | + <?php foreach ($payments as $payment) : ?> |
|
791 | 791 | <tr> |
792 | 792 | <td><?php echo $payment->ID; ?></td> |
793 | - <td><?php echo give_donation_amount( $payment->ID, array( 'currency' => true, 'amount' => true, 'type' => 'donor' ) ); ?></td> |
|
794 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
795 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
793 | + <td><?php echo give_donation_amount($payment->ID, array('currency' => true, 'amount' => true, 'type' => 'donor')); ?></td> |
|
794 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
795 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
796 | 796 | <td> |
797 | 797 | <?php |
798 | 798 | printf( |
799 | 799 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
800 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
800 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
801 | 801 | sprintf( |
802 | 802 | /* translators: %s: Donation ID */ |
803 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
803 | + esc_attr__('View Donation %s.', 'give'), |
|
804 | 804 | $payment->ID |
805 | 805 | ), |
806 | - __( 'View Donation', 'give' ) |
|
806 | + __('View Donation', 'give') |
|
807 | 807 | ); |
808 | 808 | ?> |
809 | 809 | |
@@ -818,47 +818,47 @@ discard block |
||
818 | 818 | * @param object $donor The donor object being displayed. |
819 | 819 | * @param object $payment The payment object being displayed. |
820 | 820 | */ |
821 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
821 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
822 | 822 | ?> |
823 | 823 | </td> |
824 | 824 | </tr> |
825 | 825 | <?php endforeach; ?> |
826 | 826 | <?php } else { ?> |
827 | 827 | <tr> |
828 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
828 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
829 | 829 | </tr> |
830 | 830 | <?php }// End if(). |
831 | 831 | ?> |
832 | 832 | </tbody> |
833 | 833 | </table> |
834 | 834 | |
835 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
835 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
836 | 836 | <?php |
837 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
837 | + $donations = give_get_users_completed_donations($donor->email); |
|
838 | 838 | ?> |
839 | 839 | <table class="wp-list-table widefat striped donations"> |
840 | 840 | <thead> |
841 | 841 | <tr> |
842 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
843 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
842 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
843 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
844 | 844 | </tr> |
845 | 845 | </thead> |
846 | 846 | <tbody> |
847 | - <?php if ( ! empty( $donations ) ) { ?> |
|
848 | - <?php foreach ( $donations as $donation ) : ?> |
|
847 | + <?php if ( ! empty($donations)) { ?> |
|
848 | + <?php foreach ($donations as $donation) : ?> |
|
849 | 849 | <tr> |
850 | 850 | <td><?php echo $donation->post_title; ?></td> |
851 | 851 | <td> |
852 | 852 | <?php |
853 | 853 | printf( |
854 | 854 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
855 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
855 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
856 | 856 | sprintf( |
857 | 857 | /* translators: %s: form name */ |
858 | - esc_attr__( 'View Form %s.', 'give' ), |
|
858 | + esc_attr__('View Form %s.', 'give'), |
|
859 | 859 | $donation->post_title |
860 | 860 | ), |
861 | - __( 'View Form', 'give' ) |
|
861 | + __('View Form', 'give') |
|
862 | 862 | ); |
863 | 863 | ?> |
864 | 864 | </td> |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | <?php endforeach; ?> |
867 | 867 | <?php } else { ?> |
868 | 868 | <tr> |
869 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
869 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
870 | 870 | </tr> |
871 | 871 | <?php } ?> |
872 | 872 | </tbody> |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | * |
881 | 881 | * @param object $donor The donor object being displayed. |
882 | 882 | */ |
883 | - do_action( 'give_donor_after_tables', $donor ); |
|
883 | + do_action('give_donor_after_tables', $donor); |
|
884 | 884 | ?> |
885 | 885 | |
886 | 886 | </div> |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | * |
894 | 894 | * @param object $donor The donor object being displayed. |
895 | 895 | */ |
896 | - do_action( 'give_donor_card_bottom', $donor ); |
|
896 | + do_action('give_donor_card_bottom', $donor); |
|
897 | 897 | |
898 | 898 | } |
899 | 899 | |
@@ -906,31 +906,31 @@ discard block |
||
906 | 906 | * |
907 | 907 | * @return void |
908 | 908 | */ |
909 | -function give_donor_notes_view( $donor ) { |
|
909 | +function give_donor_notes_view($donor) { |
|
910 | 910 | |
911 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
912 | - $paged = absint( $paged ); |
|
911 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
912 | + $paged = absint($paged); |
|
913 | 913 | $note_count = $donor->get_notes_count(); |
914 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
915 | - $total_pages = ceil( $note_count / $per_page ); |
|
916 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
914 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
915 | + $total_pages = ceil($note_count / $per_page); |
|
916 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
917 | 917 | ?> |
918 | 918 | |
919 | 919 | <div id="donor-notes-wrapper"> |
920 | 920 | <div class="donor-notes-header"> |
921 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
921 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
922 | 922 | </div> |
923 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
923 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
924 | 924 | |
925 | - <?php if ( 1 == $paged ) : ?> |
|
925 | + <?php if (1 == $paged) : ?> |
|
926 | 926 | <div style="display: block; margin-bottom: 55px;"> |
927 | 927 | <form id="give-add-donor-note" method="post" |
928 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
928 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
929 | 929 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
930 | 930 | <br/> |
931 | 931 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/> |
932 | 932 | <input type="hidden" name="give_action" value="add-donor-note"/> |
933 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
933 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
934 | 934 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/> |
935 | 935 | </form> |
936 | 936 | </div> |
@@ -945,26 +945,26 @@ discard block |
||
945 | 945 | 'show_all' => true, |
946 | 946 | ); |
947 | 947 | |
948 | - echo paginate_links( $pagination_args ); |
|
948 | + echo paginate_links($pagination_args); |
|
949 | 949 | ?> |
950 | 950 | |
951 | 951 | <div id="give-donor-notes" class="postbox"> |
952 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
953 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
952 | + <?php if (count($donor_notes) > 0) { ?> |
|
953 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
954 | 954 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
955 | 955 | <span class="note-content-wrap"> |
956 | - <?php echo stripslashes( $note ); ?> |
|
956 | + <?php echo stripslashes($note); ?> |
|
957 | 957 | </span> |
958 | 958 | </div> |
959 | 959 | <?php endforeach; ?> |
960 | 960 | <?php } else { ?> |
961 | 961 | <div class="give-no-donor-notes"> |
962 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
962 | + <?php _e('No donor notes found.', 'give'); ?> |
|
963 | 963 | </div> |
964 | 964 | <?php } ?> |
965 | 965 | </div> |
966 | 966 | |
967 | - <?php echo paginate_links( $pagination_args ); ?> |
|
967 | + <?php echo paginate_links($pagination_args); ?> |
|
968 | 968 | |
969 | 969 | </div> |
970 | 970 | |
@@ -980,9 +980,9 @@ discard block |
||
980 | 980 | * |
981 | 981 | * @return void |
982 | 982 | */ |
983 | -function give_donor_delete_view( $donor ) { |
|
983 | +function give_donor_delete_view($donor) { |
|
984 | 984 | |
985 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
985 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
986 | 986 | |
987 | 987 | /** |
988 | 988 | * Fires in donor delete screen, above the content. |
@@ -991,16 +991,16 @@ discard block |
||
991 | 991 | * |
992 | 992 | * @param object $donor The donor object being displayed. |
993 | 993 | */ |
994 | - do_action( 'give_donor_delete_top', $donor ); |
|
994 | + do_action('give_donor_delete_top', $donor); |
|
995 | 995 | ?> |
996 | 996 | |
997 | 997 | <div class="info-wrapper donor-section"> |
998 | 998 | |
999 | 999 | <form id="delete-donor" method="post" |
1000 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
1000 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
1001 | 1001 | |
1002 | 1002 | <div class="donor-notes-header"> |
1003 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
1003 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
1004 | 1004 | </div> |
1005 | 1005 | |
1006 | 1006 | |
@@ -1008,20 +1008,20 @@ discard block |
||
1008 | 1008 | |
1009 | 1009 | <span class="delete-donor-options"> |
1010 | 1010 | <p> |
1011 | - <?php echo Give()->html->checkbox( array( |
|
1011 | + <?php echo Give()->html->checkbox(array( |
|
1012 | 1012 | 'name' => 'give-donor-delete-confirm', |
1013 | - ) ); ?> |
|
1014 | - <label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
1013 | + )); ?> |
|
1014 | + <label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
1015 | 1015 | </p> |
1016 | 1016 | |
1017 | 1017 | <p> |
1018 | - <?php echo Give()->html->checkbox( array( |
|
1018 | + <?php echo Give()->html->checkbox(array( |
|
1019 | 1019 | 'name' => 'give-donor-delete-records', |
1020 | 1020 | 'options' => array( |
1021 | 1021 | 'disabled' => true, |
1022 | 1022 | ), |
1023 | - ) ); ?> |
|
1024 | - <label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
1023 | + )); ?> |
|
1024 | + <label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
1025 | 1025 | </p> |
1026 | 1026 | |
1027 | 1027 | <?php |
@@ -1034,19 +1034,19 @@ discard block |
||
1034 | 1034 | * |
1035 | 1035 | * @param object $donor The donor object being displayed. |
1036 | 1036 | */ |
1037 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
1037 | + do_action('give_donor_delete_inputs', $donor); |
|
1038 | 1038 | ?> |
1039 | 1039 | </span> |
1040 | 1040 | |
1041 | 1041 | <span id="donor-edit-actions"> |
1042 | 1042 | <input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>"/> |
1043 | - <?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?> |
|
1043 | + <?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?> |
|
1044 | 1044 | <input type="hidden" name="give_action" value="delete-donor"/> |
1045 | 1045 | <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" |
1046 | - value="<?php _e( 'Delete Donor', 'give' ); ?>"/> |
|
1046 | + value="<?php _e('Delete Donor', 'give'); ?>"/> |
|
1047 | 1047 | <a id="give-delete-donor-cancel" |
1048 | - href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" |
|
1049 | - class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
1048 | + href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" |
|
1049 | + class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
1050 | 1050 | </span> |
1051 | 1051 | |
1052 | 1052 | </div> |
@@ -1062,5 +1062,5 @@ discard block |
||
1062 | 1062 | * |
1063 | 1063 | * @param object $donor The donor object being displayed. |
1064 | 1064 | */ |
1065 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
1065 | + do_action('give_donor_delete_bottom', $donor); |
|
1066 | 1066 | } |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | 'disabled' => __( 'Disabled', 'give' ), |
98 | 98 | ) |
99 | 99 | ), |
100 | - array( |
|
101 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
102 | - 'id' => 'paypal_standard_gateway_settings_docs_link', |
|
103 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
104 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
105 | - 'type' => 'give_docs_link', |
|
106 | - ), |
|
100 | + array( |
|
101 | + 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
102 | + 'id' => 'paypal_standard_gateway_settings_docs_link', |
|
103 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
104 | + 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
105 | + 'type' => 'give_docs_link', |
|
106 | + ), |
|
107 | 107 | array( |
108 | 108 | 'type' => 'sectionend', |
109 | 109 | 'id' => 'give_title_gateway_settings_2', |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | 'id' => 'default_gateway', |
184 | 184 | 'type' => 'default_gateway' |
185 | 185 | ), |
186 | - array( |
|
187 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
188 | - 'id' => 'gateway_settings_docs_link', |
|
189 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
190 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
191 | - 'type' => 'give_docs_link', |
|
192 | - ), |
|
186 | + array( |
|
187 | + 'name' => __( 'Gateways Docs Link', 'give' ), |
|
188 | + 'id' => 'gateway_settings_docs_link', |
|
189 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
190 | + 'title' => __( 'Gateway Settings', 'give' ), |
|
191 | + 'type' => 'give_docs_link', |
|
192 | + ), |
|
193 | 193 | array( |
194 | 194 | 'id' => 'give_title_gateway_settings_1', |
195 | 195 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Gateways' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Gateways')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Gateways. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'gateways'; |
30 | - $this->label = esc_html__( 'Payment Gateways', 'give' ); |
|
30 | + $this->label = esc_html__('Payment Gateways', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'gateways-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'paypal-standard': |
49 | 49 | $settings = array( |
50 | 50 | // Section 2: PayPal Standard. |
@@ -53,55 +53,55 @@ discard block |
||
53 | 53 | 'id' => 'give_title_gateway_settings_2', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'PayPal Email', 'give' ), |
|
57 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
56 | + 'name' => __('PayPal Email', 'give'), |
|
57 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
58 | 58 | 'id' => 'paypal_email', |
59 | 59 | 'type' => 'email', |
60 | 60 | ), |
61 | 61 | array( |
62 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
63 | - 'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ), |
|
62 | + 'name' => __('PayPal Page Style', 'give'), |
|
63 | + 'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'), |
|
64 | 64 | 'id' => 'paypal_page_style', |
65 | 65 | 'type' => 'text', |
66 | 66 | ), |
67 | 67 | array( |
68 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
69 | - 'desc' => __( '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' ), |
|
68 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
69 | + 'desc' => __('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'), |
|
70 | 70 | 'id' => 'paypal_button_type', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'options' => array( |
73 | - 'donation' => __( 'Donation', 'give' ), |
|
74 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
73 | + 'donation' => __('Donation', 'give'), |
|
74 | + 'standard' => __('Standard Transaction', 'give') |
|
75 | 75 | ), |
76 | 76 | 'default' => 'donation', |
77 | 77 | ), |
78 | 78 | array( |
79 | - 'name' => __( 'Billing Details', 'give' ), |
|
80 | - 'desc' => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ), |
|
79 | + 'name' => __('Billing Details', 'give'), |
|
80 | + 'desc' => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'), |
|
81 | 81 | 'id' => 'paypal_standard_billing_details', |
82 | 82 | 'type' => 'radio_inline', |
83 | 83 | 'default' => 'disabled', |
84 | 84 | 'options' => array( |
85 | - 'enabled' => __( 'Enabled', 'give' ), |
|
86 | - 'disabled' => __( 'Disabled', 'give' ), |
|
85 | + 'enabled' => __('Enabled', 'give'), |
|
86 | + 'disabled' => __('Disabled', 'give'), |
|
87 | 87 | ) |
88 | 88 | ), |
89 | 89 | array( |
90 | - 'name' => __( 'PayPal IPN Verification', 'give' ), |
|
91 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
90 | + 'name' => __('PayPal IPN Verification', 'give'), |
|
91 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
92 | 92 | 'id' => 'paypal_verification', |
93 | 93 | 'type' => 'radio_inline', |
94 | 94 | 'default' => 'enabled', |
95 | 95 | 'options' => array( |
96 | - 'enabled' => __( 'Enabled', 'give' ), |
|
97 | - 'disabled' => __( 'Disabled', 'give' ), |
|
96 | + 'enabled' => __('Enabled', 'give'), |
|
97 | + 'disabled' => __('Disabled', 'give'), |
|
98 | 98 | ) |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
101 | + 'name' => __('PayPal Standard Gateway Settings Docs Link', 'give'), |
|
102 | 102 | 'id' => 'paypal_standard_gateway_settings_docs_link', |
103 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
104 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
103 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'), |
|
104 | + 'title' => __('PayPal Standard Gateway Settings', 'give'), |
|
105 | 105 | 'type' => 'give_docs_link', |
106 | 106 | ), |
107 | 107 | array( |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | 'id' => 'give_title_gateway_settings_3', |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
123 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
122 | + 'name' => __('Collect Billing Details', 'give'), |
|
123 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
124 | 124 | 'id' => 'give_offline_donation_enable_billing_fields', |
125 | 125 | 'type' => 'radio_inline', |
126 | 126 | 'default' => 'disabled', |
127 | 127 | 'options' => array( |
128 | - 'enabled' => __( 'Enabled', 'give' ), |
|
129 | - 'disabled' => __( 'Disabled', 'give' ) |
|
128 | + 'enabled' => __('Enabled', 'give'), |
|
129 | + 'disabled' => __('Disabled', 'give') |
|
130 | 130 | ) |
131 | 131 | ), |
132 | 132 | array( |
133 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
134 | - 'desc' => __( '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' ), |
|
133 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
134 | + 'desc' => __('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'), |
|
135 | 135 | 'id' => 'global_offline_donation_content', |
136 | 136 | 'default' => give_get_default_offline_donation_content(), |
137 | 137 | 'type' => 'wysiwyg', |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | ) |
141 | 141 | ), |
142 | 142 | array( |
143 | - 'name' => esc_html__( 'Offline Donations Settings Docs Link', 'give' ), |
|
143 | + 'name' => esc_html__('Offline Donations Settings Docs Link', 'give'), |
|
144 | 144 | 'id' => 'offline_gateway_settings_docs_link', |
145 | - 'url' => esc_url( 'http://docs.givewp.com/offlinegateway' ), |
|
146 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
145 | + 'url' => esc_url('http://docs.givewp.com/offlinegateway'), |
|
146 | + 'title' => __('Offline Gateway Settings', 'give'), |
|
147 | 147 | 'type' => 'give_docs_link', |
148 | 148 | ), |
149 | 149 | array( |
@@ -161,33 +161,33 @@ discard block |
||
161 | 161 | 'type' => 'title' |
162 | 162 | ), |
163 | 163 | array( |
164 | - 'name' => __( 'Test Mode', 'give' ), |
|
165 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
164 | + 'name' => __('Test Mode', 'give'), |
|
165 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
166 | 166 | 'id' => 'test_mode', |
167 | 167 | 'type' => 'radio_inline', |
168 | 168 | 'default' => 'disabled', |
169 | 169 | 'options' => array( |
170 | - 'enabled' => __( 'Enabled', 'give' ), |
|
171 | - 'disabled' => __( 'Disabled', 'give' ), |
|
170 | + 'enabled' => __('Enabled', 'give'), |
|
171 | + 'disabled' => __('Disabled', 'give'), |
|
172 | 172 | ) |
173 | 173 | ), |
174 | 174 | array( |
175 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
176 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
175 | + 'name' => __('Enabled Gateways', 'give'), |
|
176 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
177 | 177 | 'id' => 'gateways', |
178 | 178 | 'type' => 'enabled_gateways' |
179 | 179 | ), |
180 | 180 | array( |
181 | - 'name' => __( 'Default Gateway', 'give' ), |
|
182 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
181 | + 'name' => __('Default Gateway', 'give'), |
|
182 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
183 | 183 | 'id' => 'default_gateway', |
184 | 184 | 'type' => 'default_gateway' |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
187 | + 'name' => __('Gateways Docs Link', 'give'), |
|
188 | 188 | 'id' => 'gateway_settings_docs_link', |
189 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
190 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
189 | + 'url' => esc_url('http://docs.givewp.com/settings-gateways'), |
|
190 | + 'title' => __('Gateway Settings', 'give'), |
|
191 | 191 | 'type' => 'give_docs_link', |
192 | 192 | ), |
193 | 193 | array( |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * Filter the payment gateways settings. |
203 | 203 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
204 | 204 | */ |
205 | - $settings = apply_filters( 'give_settings_gateways', $settings ); |
|
205 | + $settings = apply_filters('give_settings_gateways', $settings); |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Filter the settings. |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * |
212 | 212 | * @param array $settings |
213 | 213 | */ |
214 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
214 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
215 | 215 | |
216 | 216 | // Output. |
217 | 217 | return $settings; |
@@ -225,12 +225,12 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function get_sections() { |
227 | 227 | $sections = array( |
228 | - 'gateways-settings' => __( 'Gateways', 'give' ), |
|
229 | - 'paypal-standard' => __( 'PayPal Standard', 'give' ), |
|
230 | - 'offline-donations' => __( 'Offline Donations', 'give' ) |
|
228 | + 'gateways-settings' => __('Gateways', 'give'), |
|
229 | + 'paypal-standard' => __('PayPal Standard', 'give'), |
|
230 | + 'offline-donations' => __('Offline Donations', 'give') |
|
231 | 231 | ); |
232 | 232 | |
233 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
233 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Email' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Email. |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'emails'; |
30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
30 | + $this->label = esc_html__('Emails', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'email-settings'; |
33 | 33 | |
34 | 34 | parent::__construct(); |
35 | 35 | |
36 | - add_action( 'give_admin_field_email_notification', array( $this, 'email_notification_setting' ) ); |
|
36 | + add_action('give_admin_field_email_notification', array($this, 'email_notification_setting')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | $settings = array(); |
47 | 47 | $current_section = give_get_current_setting_section(); |
48 | 48 | |
49 | - switch ( $current_section ) { |
|
49 | + switch ($current_section) { |
|
50 | 50 | case 'email-settings' : |
51 | 51 | $settings = array( |
52 | 52 | |
53 | 53 | // Section 1: Email Notification Listing. |
54 | 54 | array( |
55 | - 'desc' => __( 'Email notifications sent from Give are listed below. Click on an email to configure it.', 'give' ), |
|
55 | + 'desc' => __('Email notifications sent from Give are listed below. Click on an email to configure it.', 'give'), |
|
56 | 56 | 'type' => 'title', |
57 | 57 | 'id' => 'give_email_notification_settings', |
58 | 58 | 'table_html' => false, |
@@ -67,42 +67,42 @@ discard block |
||
67 | 67 | |
68 | 68 | // Section 2: Email Sender Setting |
69 | 69 | array( |
70 | - 'title' => __( 'Email Sender Options', 'give' ), |
|
70 | + 'title' => __('Email Sender Options', 'give'), |
|
71 | 71 | 'id' => 'give_title_email_settings_1', |
72 | 72 | 'type' => 'title', |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'id' => 'email_template', |
76 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
77 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
76 | + 'name' => esc_html__('Email Template', 'give'), |
|
77 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
78 | 78 | 'type' => 'select', |
79 | 79 | 'options' => give_get_email_templates(), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'id' => 'email_logo', |
83 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
84 | - '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' ), |
|
83 | + 'name' => esc_html__('Logo', 'give'), |
|
84 | + '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'), |
|
85 | 85 | 'type' => 'file', |
86 | 86 | ), |
87 | 87 | array( |
88 | 88 | 'id' => 'from_name', |
89 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
90 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
91 | - 'default' => get_bloginfo( 'name' ), |
|
89 | + 'name' => esc_html__('From Name', 'give'), |
|
90 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
91 | + 'default' => get_bloginfo('name'), |
|
92 | 92 | 'type' => 'text', |
93 | 93 | ), |
94 | 94 | array( |
95 | 95 | 'id' => 'from_email', |
96 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
97 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
98 | - 'default' => get_bloginfo( 'admin_email' ), |
|
96 | + 'name' => esc_html__('From Email', 'give'), |
|
97 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
98 | + 'default' => get_bloginfo('admin_email'), |
|
99 | 99 | 'type' => 'text', |
100 | 100 | ), |
101 | 101 | array( |
102 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
102 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
103 | 103 | 'id' => 'donation_notification_settings_docs_link', |
104 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
105 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
104 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
105 | + 'title' => __('Donation Notification Settings', 'give'), |
|
106 | 106 | 'type' => 'give_docs_link', |
107 | 107 | ), |
108 | 108 | array( |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * Filter the emails settings. |
118 | 118 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
119 | 119 | */ |
120 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
120 | + $settings = apply_filters('give_settings_emails', $settings); |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Filter the settings. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @param array $settings |
128 | 128 | */ |
129 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
129 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
130 | 130 | |
131 | 131 | // Output. |
132 | 132 | return $settings; |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function get_sections() { |
142 | 142 | $sections = array( |
143 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
143 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
144 | 144 | ); |
145 | 145 | |
146 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
146 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function email_notification_setting() { |
156 | 156 | // Load email notification table. |
157 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-table.php'; |
|
157 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-table.php'; |
|
158 | 158 | |
159 | 159 | // Init table. |
160 | 160 | $email_notifications_table = new Give_Email_Notification_Table(); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Advanced' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Advanced')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Advanced. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'advanced'; |
30 | - $this->label = __( 'Advanced', 'give' ); |
|
30 | + $this->label = __('Advanced', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'advanced-options'; |
33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $current_section = give_get_current_setting_section(); |
47 | 47 | |
48 | - switch ( $current_section ) { |
|
48 | + switch ($current_section) { |
|
49 | 49 | case 'advanced-options': |
50 | 50 | $settings = array( |
51 | 51 | array( |
@@ -53,19 +53,19 @@ discard block |
||
53 | 53 | 'type' => 'title', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'Remove Data on Uninstall', 'give' ), |
|
57 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ), |
|
56 | + 'name' => __('Remove Data on Uninstall', 'give'), |
|
57 | + 'desc' => __('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'), |
|
58 | 58 | 'id' => 'uninstall_on_delete', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'disabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
63 | - 'disabled' => __( 'No, keep my Give settings and donation data', 'give' ), |
|
62 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
63 | + 'disabled' => __('No, keep my Give settings and donation data', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'Default User Role', 'give' ), |
|
68 | - 'desc' => __( 'Assign default user roles for donors when donors opt to register as a WP User.', 'give' ), |
|
67 | + 'name' => __('Default User Role', 'give'), |
|
68 | + 'desc' => __('Assign default user roles for donors when donors opt to register as a WP User.', 'give'), |
|
69 | 69 | 'id' => 'donor_default_user_role', |
70 | 70 | 'type' => 'select', |
71 | 71 | 'default' => 'give_donor', |
@@ -73,44 +73,44 @@ discard block |
||
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | /* translators: %s: the_content */ |
76 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
76 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
77 | 77 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
78 | - '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>' ), |
|
78 | + '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>'), |
|
79 | 79 | 'id' => 'the_content_filter', |
80 | 80 | 'default' => 'enabled', |
81 | 81 | 'type' => 'radio_inline', |
82 | 82 | 'options' => array( |
83 | - 'enabled' => __( 'Enabled', 'give' ), |
|
84 | - 'disabled' => __( 'Disabled', 'give' ), |
|
83 | + 'enabled' => __('Enabled', 'give'), |
|
84 | + 'disabled' => __('Disabled', 'give'), |
|
85 | 85 | ), |
86 | 86 | ), |
87 | 87 | array( |
88 | - 'name' => __( 'Script Loading Location', 'give' ), |
|
89 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
88 | + 'name' => __('Script Loading Location', 'give'), |
|
89 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
90 | 90 | 'id' => 'scripts_footer', |
91 | 91 | 'type' => 'radio_inline', |
92 | 92 | 'default' => 'disabled', |
93 | 93 | 'options' => array( |
94 | - 'disabled' => __( 'Head', 'give' ), |
|
95 | - 'enabled' => __( 'Footer', 'give' ), |
|
94 | + 'disabled' => __('Head', 'give'), |
|
95 | + 'enabled' => __('Footer', 'give'), |
|
96 | 96 | ), |
97 | 97 | ), |
98 | 98 | array( |
99 | - 'name' => __( 'Akismet SPAM Protection', 'give' ), |
|
100 | - 'desc' => __( 'Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API if you have the plugin activated and configured.', 'give' ), |
|
99 | + 'name' => __('Akismet SPAM Protection', 'give'), |
|
100 | + 'desc' => __('Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API if you have the plugin activated and configured.', 'give'), |
|
101 | 101 | 'id' => 'akismet_spam_protection', |
102 | 102 | 'type' => 'radio_inline', |
103 | - 'default' => ( give_check_akismet_key() ) ? 'enabled' : 'disabled', |
|
103 | + 'default' => (give_check_akismet_key()) ? 'enabled' : 'disabled', |
|
104 | 104 | 'options' => array( |
105 | - 'enabled' => __( 'Enabled', 'give' ), |
|
106 | - 'disabled' => __( 'Disabled', 'give' ), |
|
105 | + 'enabled' => __('Enabled', 'give'), |
|
106 | + 'disabled' => __('Disabled', 'give'), |
|
107 | 107 | ), |
108 | 108 | ), |
109 | 109 | array( |
110 | - 'name' => __( 'Advanced Settings Docs Link', 'give' ), |
|
110 | + 'name' => __('Advanced Settings Docs Link', 'give'), |
|
111 | 111 | 'id' => 'advanced_settings_docs_link', |
112 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
113 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
112 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
113 | + 'title' => __('Advanced Settings', 'give'), |
|
114 | 114 | 'type' => 'give_docs_link', |
115 | 115 | ), |
116 | 116 | array( |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 2.0 |
128 | 128 | */ |
129 | - if( apply_filters( 'give_settings_advanced_show_cache_setting', false ) ) { |
|
130 | - array_splice( $settings, 1, 0, array( |
|
129 | + if (apply_filters('give_settings_advanced_show_cache_setting', false)) { |
|
130 | + array_splice($settings, 1, 0, array( |
|
131 | 131 | array( |
132 | - 'name' => __( 'Cache', 'give' ), |
|
133 | - 'desc' => __( 'If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give' ), |
|
132 | + 'name' => __('Cache', 'give'), |
|
133 | + 'desc' => __('If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give'), |
|
134 | 134 | 'id' => 'cache', |
135 | 135 | 'type' => 'radio_inline', |
136 | 136 | 'default' => 'enabled', |
137 | 137 | 'options' => array( |
138 | - 'enabled' => __( 'Enabled', 'give' ), |
|
139 | - 'disabled' => __( 'Disabled', 'give' ), |
|
138 | + 'enabled' => __('Enabled', 'give'), |
|
139 | + 'disabled' => __('Disabled', 'give'), |
|
140 | 140 | ), |
141 | 141 | ) |
142 | - ) ); |
|
142 | + )); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * Filter the advanced settings. |
148 | 148 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
149 | 149 | */ |
150 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
150 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
151 | 151 | |
152 | 152 | /** |
153 | 153 | * Filter the settings. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @param array $settings |
158 | 158 | */ |
159 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
159 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
160 | 160 | |
161 | 161 | // Output. |
162 | 162 | return $settings; |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function get_sections() { |
172 | 172 | $sections = array( |
173 | - 'advanced-options' => __( 'Advanced Options', 'give' ), |
|
173 | + 'advanced-options' => __('Advanced Options', 'give'), |
|
174 | 174 | ); |
175 | 175 | |
176 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
176 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 |
@@ -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 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page; |
33 | 33 | |
34 | 34 | //Payments |
35 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
35 | + $give_payment = get_post_type_object('give_payment'); |
|
36 | 36 | $give_payments_page = add_submenu_page( |
37 | 37 | 'edit.php?post_type=give_forms', |
38 | 38 | $give_payment->labels->name, |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | //Donors |
46 | 46 | $give_donors_page = add_submenu_page( |
47 | 47 | 'edit.php?post_type=give_forms', |
48 | - esc_html__( 'Donors', 'give' ), |
|
49 | - esc_html__( 'Donors', 'give' ), |
|
48 | + esc_html__('Donors', 'give'), |
|
49 | + esc_html__('Donors', 'give'), |
|
50 | 50 | 'view_give_reports', |
51 | 51 | 'give-donors', |
52 | 52 | 'give_donors_page' |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | //Reports` |
56 | 56 | $give_reports_page = add_submenu_page( |
57 | 57 | 'edit.php?post_type=give_forms', |
58 | - esc_html__( 'Donation Reports', 'give' ), |
|
59 | - esc_html__( 'Reports', 'give' ), |
|
58 | + esc_html__('Donation Reports', 'give'), |
|
59 | + esc_html__('Reports', 'give'), |
|
60 | 60 | 'view_give_reports', |
61 | 61 | 'give-reports', |
62 | 62 | array( |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | //Settings |
69 | 69 | $give_settings_page = add_submenu_page( |
70 | 70 | 'edit.php?post_type=give_forms', |
71 | - esc_html__( 'Give Settings', 'give' ), |
|
72 | - esc_html__( 'Settings', 'give' ), |
|
71 | + esc_html__('Give Settings', 'give'), |
|
72 | + esc_html__('Settings', 'give'), |
|
73 | 73 | 'manage_give_settings', |
74 | 74 | 'give-settings', |
75 | 75 | array( |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | //Tools. |
82 | 82 | $give_tools_page = add_submenu_page( |
83 | 83 | 'edit.php?post_type=give_forms', |
84 | - esc_html__( 'Give Tools', 'give' ), |
|
85 | - esc_html__( 'Tools', 'give' ), |
|
84 | + esc_html__('Give Tools', 'give'), |
|
85 | + esc_html__('Tools', 'give'), |
|
86 | 86 | 'manage_give_settings', |
87 | 87 | 'give-tools', |
88 | 88 | array( |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | //Add-ons |
95 | 95 | $give_add_ons_page = add_submenu_page( |
96 | 96 | 'edit.php?post_type=give_forms', |
97 | - esc_html__( 'Give Add-ons', 'give' ), |
|
98 | - esc_html__( 'Add-ons', 'give' ), |
|
97 | + esc_html__('Give Add-ons', 'give'), |
|
98 | + esc_html__('Add-ons', 'give'), |
|
99 | 99 | 'install_plugins', |
100 | 100 | 'give-addons', |
101 | 101 | 'give_add_ons_page' |
102 | 102 | ); |
103 | 103 | } |
104 | 104 | |
105 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
105 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Determines whether the current admin page is a Give admin page. |
@@ -117,224 +117,224 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return bool True if Give admin page. |
119 | 119 | */ |
120 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
120 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
121 | 121 | |
122 | 122 | global $pagenow, $typenow; |
123 | 123 | |
124 | 124 | $found = false; |
125 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
126 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
127 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
128 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
129 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
130 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
131 | - |
|
132 | - switch ( $passed_page ) { |
|
125 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
126 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
127 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
128 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
129 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
130 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
131 | + |
|
132 | + switch ($passed_page) { |
|
133 | 133 | case 'give_forms': |
134 | - switch ( $passed_view ) { |
|
134 | + switch ($passed_view) { |
|
135 | 135 | case 'list-table': |
136 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
136 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
137 | 137 | $found = true; |
138 | 138 | } |
139 | 139 | break; |
140 | 140 | case 'edit': |
141 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
141 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
142 | 142 | $found = true; |
143 | 143 | } |
144 | 144 | break; |
145 | 145 | case 'new': |
146 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
146 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
147 | 147 | $found = true; |
148 | 148 | } |
149 | 149 | break; |
150 | 150 | default: |
151 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
151 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
152 | 152 | $found = true; |
153 | 153 | } |
154 | 154 | break; |
155 | 155 | } |
156 | 156 | break; |
157 | 157 | case 'categories': |
158 | - switch ( $passed_view ) { |
|
158 | + switch ($passed_view) { |
|
159 | 159 | case 'list-table': |
160 | 160 | case 'new': |
161 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
161 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
162 | 162 | $found = true; |
163 | 163 | } |
164 | 164 | break; |
165 | 165 | case 'edit': |
166 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
166 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
167 | 167 | $found = true; |
168 | 168 | } |
169 | 169 | break; |
170 | 170 | default: |
171 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
171 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
172 | 172 | $found = true; |
173 | 173 | } |
174 | 174 | break; |
175 | 175 | } |
176 | 176 | break; |
177 | 177 | case 'tags': |
178 | - switch ( $passed_view ) { |
|
178 | + switch ($passed_view) { |
|
179 | 179 | case 'list-table': |
180 | 180 | case 'new': |
181 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
181 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
182 | 182 | $found = true; |
183 | 183 | } |
184 | 184 | break; |
185 | 185 | case 'edit': |
186 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
186 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
187 | 187 | $found = true; |
188 | 188 | } |
189 | 189 | break; |
190 | 190 | default: |
191 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
191 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
192 | 192 | $found = true; |
193 | 193 | } |
194 | 194 | break; |
195 | 195 | } |
196 | 196 | break; |
197 | 197 | case 'payments': |
198 | - switch ( $passed_view ) { |
|
198 | + switch ($passed_view) { |
|
199 | 199 | case 'list-table': |
200 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
200 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
201 | 201 | $found = true; |
202 | 202 | } |
203 | 203 | break; |
204 | 204 | case 'edit': |
205 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) { |
|
205 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view) { |
|
206 | 206 | $found = true; |
207 | 207 | } |
208 | 208 | break; |
209 | 209 | default: |
210 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
210 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
211 | 211 | $found = true; |
212 | 212 | } |
213 | 213 | break; |
214 | 214 | } |
215 | 215 | break; |
216 | 216 | case 'reports': |
217 | - switch ( $passed_view ) { |
|
217 | + switch ($passed_view) { |
|
218 | 218 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
219 | 219 | case 'earnings': |
220 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
220 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
221 | 221 | $found = true; |
222 | 222 | } |
223 | 223 | break; |
224 | 224 | case 'donors': |
225 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
225 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
226 | 226 | $found = true; |
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case 'gateways': |
230 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
230 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
231 | 231 | $found = true; |
232 | 232 | } |
233 | 233 | break; |
234 | 234 | case 'export': |
235 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
235 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
236 | 236 | $found = true; |
237 | 237 | } |
238 | 238 | break; |
239 | 239 | case 'logs': |
240 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
240 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
241 | 241 | $found = true; |
242 | 242 | } |
243 | 243 | break; |
244 | 244 | default: |
245 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
245 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
246 | 246 | $found = true; |
247 | 247 | } |
248 | 248 | break; |
249 | 249 | } |
250 | 250 | break; |
251 | 251 | case 'settings': |
252 | - switch ( $passed_view ) { |
|
252 | + switch ($passed_view) { |
|
253 | 253 | case 'general': |
254 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
254 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
255 | 255 | $found = true; |
256 | 256 | } |
257 | 257 | break; |
258 | 258 | case 'gateways': |
259 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
259 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
260 | 260 | $found = true; |
261 | 261 | } |
262 | 262 | break; |
263 | 263 | case 'emails': |
264 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
264 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
265 | 265 | $found = true; |
266 | 266 | } |
267 | 267 | break; |
268 | 268 | case 'display': |
269 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
269 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
270 | 270 | $found = true; |
271 | 271 | } |
272 | 272 | break; |
273 | 273 | case 'licenses': |
274 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
274 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
275 | 275 | $found = true; |
276 | 276 | } |
277 | 277 | break; |
278 | 278 | case 'api': |
279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
280 | 280 | $found = true; |
281 | 281 | } |
282 | 282 | break; |
283 | 283 | case 'advanced': |
284 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
284 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
285 | 285 | $found = true; |
286 | 286 | } |
287 | 287 | break; |
288 | 288 | case 'system_info': |
289 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
289 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
290 | 290 | $found = true; |
291 | 291 | } |
292 | 292 | break; |
293 | 293 | default: |
294 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
294 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
295 | 295 | $found = true; |
296 | 296 | } |
297 | 297 | break; |
298 | 298 | } |
299 | 299 | break; |
300 | 300 | case 'addons': |
301 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
301 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
302 | 302 | $found = true; |
303 | 303 | } |
304 | 304 | break; |
305 | 305 | case 'donors': |
306 | - switch ( $passed_view ) { |
|
306 | + switch ($passed_view) { |
|
307 | 307 | case 'list-table': |
308 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
308 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
309 | 309 | $found = true; |
310 | 310 | } |
311 | 311 | break; |
312 | 312 | case 'overview': |
313 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
313 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
314 | 314 | $found = true; |
315 | 315 | } |
316 | 316 | break; |
317 | 317 | case 'notes': |
318 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
318 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
319 | 319 | $found = true; |
320 | 320 | } |
321 | 321 | break; |
322 | 322 | default: |
323 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
323 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
324 | 324 | $found = true; |
325 | 325 | } |
326 | 326 | break; |
327 | 327 | } |
328 | 328 | break; |
329 | 329 | case 'reports': |
330 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
330 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
331 | 331 | $found = true; |
332 | 332 | } |
333 | 333 | break; |
334 | 334 | default: |
335 | 335 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page; |
336 | 336 | |
337 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
337 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
338 | 338 | $give_payments_page, |
339 | 339 | $give_settings_page, |
340 | 340 | $give_reports_page, |
@@ -344,16 +344,16 @@ discard block |
||
344 | 344 | $give_donors_page, |
345 | 345 | $give_tools_page, |
346 | 346 | 'widgets.php' |
347 | - ) ); |
|
348 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
347 | + )); |
|
348 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
349 | 349 | $found = true; |
350 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
350 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
351 | 351 | $found = true; |
352 | 352 | } |
353 | 353 | break; |
354 | 354 | } |
355 | 355 | |
356 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
356 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
357 | 357 | |
358 | 358 | } |
359 | 359 | |
@@ -365,37 +365,37 @@ discard block |
||
365 | 365 | * @param array $settings |
366 | 366 | * @return array |
367 | 367 | */ |
368 | -function give_settings_page_pages( $settings ) { |
|
369 | - include( 'abstract-admin-settings-page.php' ); |
|
370 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
368 | +function give_settings_page_pages($settings) { |
|
369 | + include('abstract-admin-settings-page.php'); |
|
370 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
371 | 371 | |
372 | 372 | $settings = array( |
373 | 373 | // General settings. |
374 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-general.php' ), |
|
374 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-general.php'), |
|
375 | 375 | |
376 | 376 | // Payment Gateways Settings. |
377 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-gateways.php' ), |
|
377 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-gateways.php'), |
|
378 | 378 | |
379 | 379 | // Display settings. |
380 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-display.php' ), |
|
380 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-display.php'), |
|
381 | 381 | |
382 | 382 | // Emails settings. |
383 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-email.php' ), |
|
383 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-email.php'), |
|
384 | 384 | |
385 | 385 | // Addons settings. |
386 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-addon.php' ), |
|
386 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-addon.php'), |
|
387 | 387 | |
388 | 388 | // License settings. |
389 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-license.php' ), |
|
389 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-license.php'), |
|
390 | 390 | |
391 | 391 | // Advanced settings. |
392 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-advanced.php' ) |
|
392 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-advanced.php') |
|
393 | 393 | ); |
394 | 394 | |
395 | 395 | // Output. |
396 | 396 | return $settings; |
397 | 397 | } |
398 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
398 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
399 | 399 | |
400 | 400 | |
401 | 401 | /** |
@@ -405,25 +405,25 @@ discard block |
||
405 | 405 | * @param array $settings |
406 | 406 | * @return array |
407 | 407 | */ |
408 | -function give_reports_page_pages( $settings ) { |
|
409 | - include( 'abstract-admin-settings-page.php' ); |
|
408 | +function give_reports_page_pages($settings) { |
|
409 | + include('abstract-admin-settings-page.php'); |
|
410 | 410 | |
411 | 411 | $settings = array( |
412 | 412 | // Earnings. |
413 | - include( 'reports/class-earnings-report.php' ), |
|
413 | + include('reports/class-earnings-report.php'), |
|
414 | 414 | |
415 | 415 | // Forms. |
416 | - include( 'reports/class-forms-report.php' ), |
|
416 | + include('reports/class-forms-report.php'), |
|
417 | 417 | |
418 | 418 | // Gateways. |
419 | - include( 'reports/class-gateways-report.php' ), |
|
419 | + include('reports/class-gateways-report.php'), |
|
420 | 420 | |
421 | 421 | ); |
422 | 422 | |
423 | 423 | // Output. |
424 | 424 | return $settings; |
425 | 425 | } |
426 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
426 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
427 | 427 | |
428 | 428 | /** |
429 | 429 | * Add setting tab to give-settings page |
@@ -432,33 +432,33 @@ discard block |
||
432 | 432 | * @param array $settings |
433 | 433 | * @return array |
434 | 434 | */ |
435 | -function give_tools_page_pages( $settings ) { |
|
436 | - include( 'abstract-admin-settings-page.php' ); |
|
435 | +function give_tools_page_pages($settings) { |
|
436 | + include('abstract-admin-settings-page.php'); |
|
437 | 437 | |
438 | 438 | $settings = array( |
439 | 439 | // System Info. |
440 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-system-info.php' ), |
|
440 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-system-info.php'), |
|
441 | 441 | |
442 | 442 | // Logs. |
443 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-logs.php' ), |
|
443 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-logs.php'), |
|
444 | 444 | |
445 | 445 | // API. |
446 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-api.php' ), |
|
446 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-api.php'), |
|
447 | 447 | |
448 | 448 | // Data. |
449 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-data.php' ), |
|
449 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-data.php'), |
|
450 | 450 | |
451 | 451 | // Export. |
452 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-export.php' ), |
|
452 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-export.php'), |
|
453 | 453 | |
454 | 454 | // Import |
455 | - include_once( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-import.php' ), |
|
455 | + include_once(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-import.php'), |
|
456 | 456 | ); |
457 | 457 | |
458 | 458 | // Output. |
459 | 459 | return $settings; |
460 | 460 | } |
461 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
461 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
462 | 462 | |
463 | 463 | /** |
464 | 464 | * Set default tools page tab. |
@@ -467,10 +467,10 @@ discard block |
||
467 | 467 | * @param string $default_tab Default tab name. |
468 | 468 | * @return string |
469 | 469 | */ |
470 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
470 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
471 | 471 | return 'system-info'; |
472 | 472 | } |
473 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
473 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
474 | 474 | |
475 | 475 | |
476 | 476 | /** |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | * @param string $default_tab Default tab name. |
481 | 481 | * @return string |
482 | 482 | */ |
483 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
483 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
484 | 484 | return 'earnings'; |
485 | 485 | } |
486 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
486 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
487 | 487 | |
488 | 488 | |
489 | 489 | /** |
@@ -496,19 +496,19 @@ discard block |
||
496 | 496 | * |
497 | 497 | * @return array |
498 | 498 | */ |
499 | -function give_add_display_page_states( $post_states, $post ) { |
|
499 | +function give_add_display_page_states($post_states, $post) { |
|
500 | 500 | |
501 | - switch( $post->ID ) { |
|
502 | - case give_get_option( 'success_page' ): |
|
503 | - $post_states['give_successfully_page'] = __( 'Donation Success Page', 'give' ); |
|
501 | + switch ($post->ID) { |
|
502 | + case give_get_option('success_page'): |
|
503 | + $post_states['give_successfully_page'] = __('Donation Success Page', 'give'); |
|
504 | 504 | break; |
505 | 505 | |
506 | - case give_get_option( 'failure_page' ): |
|
507 | - $post_states['give_failure_page'] = __( 'Donation Failed Page', 'give' ); |
|
506 | + case give_get_option('failure_page'): |
|
507 | + $post_states['give_failure_page'] = __('Donation Failed Page', 'give'); |
|
508 | 508 | break; |
509 | 509 | |
510 | - case give_get_option( 'history_page' ): |
|
511 | - $post_states['give_history_page'] = __( 'Donation History Page', 'give' ); |
|
510 | + case give_get_option('history_page'): |
|
511 | + $post_states['give_history_page'] = __('Donation History Page', 'give'); |
|
512 | 512 | break; |
513 | 513 | } |
514 | 514 | |
@@ -516,4 +516,4 @@ discard block |
||
516 | 516 | } |
517 | 517 | |
518 | 518 | // Add a post display state for special Give pages. |
519 | -add_filter( 'display_post_states', 'give_add_display_page_states', 10, 2 ); |
|
520 | 519 | \ No newline at end of file |
520 | +add_filter('display_post_states', 'give_add_display_page_states', 10, 2); |
|
521 | 521 | \ 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 | |
@@ -25,135 +25,135 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @uses give_pdf |
27 | 27 | */ |
28 | -function give_generate_pdf( $data ) { |
|
28 | +function give_generate_pdf($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
31 | - wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
36 | 36 | } |
37 | 37 | |
38 | - if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) { |
|
39 | - wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
38 | + if ( ! file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php')) { |
|
39 | + wp_die(__('Dependency missing.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
40 | 40 | } |
41 | 41 | |
42 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php'; |
|
42 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php'; |
|
43 | 43 | |
44 | 44 | $daterange = utf8_decode( |
45 | 45 | sprintf( |
46 | 46 | /* translators: 1: start date 2: end date */ |
47 | - __( '%1$s to %2$s', 'give' ), |
|
48 | - date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
49 | - date_i18n( give_date_format() ) |
|
47 | + __('%1$s to %2$s', 'give'), |
|
48 | + date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
49 | + date_i18n(give_date_format()) |
|
50 | 50 | ) |
51 | 51 | ); |
52 | 52 | |
53 | - $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
54 | - $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
53 | + $categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled')); |
|
54 | + $tags_enabled = give_is_setting_enabled(give_get_option('tags', 'disabled')); |
|
55 | 55 | |
56 | - $pdf = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false ); |
|
57 | - $default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' ); |
|
56 | + $pdf = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false); |
|
57 | + $default_font = apply_filters('give_pdf_default_font', 'Helvetica'); |
|
58 | 58 | $custom_font = 'dejavusans'; |
59 | 59 | $font_style = ''; |
60 | 60 | |
61 | 61 | if ( |
62 | - file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF' ) && |
|
62 | + file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF') && |
|
63 | 63 | |
64 | 64 | // RIAL exist for backward compatibility. |
65 | - in_array( give_get_currency(), array( 'RIAL', 'RUB', 'IRR' ) ) |
|
65 | + in_array(give_get_currency(), array('RIAL', 'RUB', 'IRR')) |
|
66 | 66 | ) { |
67 | - TCPDF_FONTS::addTTFfont( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF', '' ); |
|
67 | + TCPDF_FONTS::addTTFfont(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF', ''); |
|
68 | 68 | $custom_font = 'CODE2000'; |
69 | 69 | $font_style = 'B'; |
70 | 70 | } |
71 | 71 | |
72 | - $pdf->AddPage( 'L', 'A4' ); |
|
73 | - $pdf->setImageScale( 1.5 ); |
|
74 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
75 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
76 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
72 | + $pdf->AddPage('L', 'A4'); |
|
73 | + $pdf->setImageScale(1.5); |
|
74 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
75 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
76 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
77 | 77 | |
78 | 78 | // Image URL should have absolute path. @see https://tcpdf.org/examples/example_009/. |
79 | - $pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_DIR . 'assets/images/give-logo-small.png' ), 247, 8 ); |
|
79 | + $pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_DIR.'assets/images/give-logo-small.png'), 247, 8); |
|
80 | 80 | |
81 | - $pdf->SetMargins( 8, 8, 8 ); |
|
82 | - $pdf->SetX( 8 ); |
|
81 | + $pdf->SetMargins(8, 8, 8); |
|
82 | + $pdf->SetX(8); |
|
83 | 83 | |
84 | - $pdf->SetFont( $default_font, '', 16 ); |
|
85 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
86 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
84 | + $pdf->SetFont($default_font, '', 16); |
|
85 | + $pdf->SetTextColor(50, 50, 50); |
|
86 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
87 | 87 | |
88 | - $pdf->SetFont( $default_font, '', 13 ); |
|
89 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
90 | - $pdf->Ln( 1 ); |
|
91 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
88 | + $pdf->SetFont($default_font, '', 13); |
|
89 | + $pdf->SetTextColor(150, 150, 150); |
|
90 | + $pdf->Ln(1); |
|
91 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
92 | 92 | $pdf->Ln(); |
93 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
94 | - $pdf->SetFont( $default_font, '', 14 ); |
|
95 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
96 | - $pdf->SetFont( $default_font, '', 12 ); |
|
93 | + $pdf->SetTextColor(50, 50, 50); |
|
94 | + $pdf->SetFont($default_font, '', 14); |
|
95 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
96 | + $pdf->SetFont($default_font, '', 12); |
|
97 | 97 | |
98 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
99 | - $pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color. |
|
100 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
101 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
98 | + $pdf->SetFillColor(238, 238, 238); |
|
99 | + $pdf->SetTextColor(0, 0, 0, 100); // Set Black color. |
|
100 | + $pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
101 | + $pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
102 | 102 | |
103 | 103 | // Display Categories Heading only, if user has opted for it. |
104 | - if ( $categories_enabled ) { |
|
105 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
104 | + if ($categories_enabled) { |
|
105 | + $pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | // Display Tags Heading only, if user has opted for it. |
109 | - if ( $tags_enabled ) { |
|
110 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
109 | + if ($tags_enabled) { |
|
110 | + $pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
111 | 111 | } |
112 | 112 | |
113 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
114 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
113 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
114 | + $pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
115 | 115 | |
116 | 116 | // Set Custom Font to support various currencies. |
117 | - $pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 ); |
|
117 | + $pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12); |
|
118 | 118 | |
119 | - $year = date( 'Y' ); |
|
120 | - $give_forms = get_posts( array( |
|
119 | + $year = date('Y'); |
|
120 | + $give_forms = get_posts(array( |
|
121 | 121 | 'post_type' => 'give_forms', |
122 | 122 | 'year' => $year, |
123 | - 'posts_per_page' => - 1, |
|
123 | + 'posts_per_page' => -1, |
|
124 | 124 | 'supply_filter' => false, |
125 | - ) ); |
|
125 | + )); |
|
126 | 126 | |
127 | - if ( $give_forms ) { |
|
128 | - $pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) ); |
|
127 | + if ($give_forms) { |
|
128 | + $pdf->SetWidths(array(50, 50, 45, 45, 45, 45)); |
|
129 | 129 | |
130 | - foreach ( $give_forms as $form ): |
|
131 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
130 | + foreach ($give_forms as $form): |
|
131 | + $pdf->SetFillColor(255, 255, 255); |
|
132 | 132 | |
133 | 133 | $title = $form->post_title; |
134 | 134 | |
135 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
136 | - $price = html_entity_decode( give_price_range( $form->ID, false ), ENT_COMPAT, 'UTF-8' ); |
|
135 | + if (give_has_variable_prices($form->ID)) { |
|
136 | + $price = html_entity_decode(give_price_range($form->ID, false), ENT_COMPAT, 'UTF-8'); |
|
137 | 137 | } else { |
138 | - $price = give_currency_filter( give_get_form_price( $form->ID ), array( 'decode_currency' => true ) ); |
|
138 | + $price = give_currency_filter(give_get_form_price($form->ID), array('decode_currency' => true)); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | // Display Categories Data only, if user has opted for it. |
142 | 142 | $categories = array(); |
143 | - if ( $categories_enabled ) { |
|
144 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
145 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
143 | + if ($categories_enabled) { |
|
144 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
145 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | // Display Tags Data only, if user has opted for it. |
149 | 149 | $tags = array(); |
150 | - if ( $tags_enabled ) { |
|
151 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
152 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
150 | + if ($tags_enabled) { |
|
151 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
152 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
153 | 153 | } |
154 | 154 | |
155 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
156 | - $earnings = give_currency_filter( give_format_amount( give_get_form_earnings_stats( $form->ID ), array( 'sanitize' => false, ) ), array( 'decode_currency' => true ) ); |
|
155 | + $sales = give_get_form_sales_stats($form->ID); |
|
156 | + $earnings = give_currency_filter(give_format_amount(give_get_form_earnings_stats($form->ID), array('sanitize' => false,)), array('decode_currency' => true)); |
|
157 | 157 | |
158 | 158 | // This will help filter data before appending it to PDF Receipt. |
159 | 159 | $prepare_pdf_data = array(); |
@@ -161,54 +161,54 @@ discard block |
||
161 | 161 | $prepare_pdf_data[] = $price; |
162 | 162 | |
163 | 163 | // Append Categories Data only, if user has opted for it. |
164 | - if ( $categories_enabled ) { |
|
164 | + if ($categories_enabled) { |
|
165 | 165 | $prepare_pdf_data[] = $categories; |
166 | 166 | } |
167 | 167 | |
168 | 168 | // Append Tags Data only, if user has opted for it. |
169 | - if ( $tags_enabled ) { |
|
169 | + if ($tags_enabled) { |
|
170 | 170 | $prepare_pdf_data[] = $tags; |
171 | 171 | } |
172 | 172 | |
173 | 173 | $prepare_pdf_data[] = $sales; |
174 | 174 | $prepare_pdf_data[] = $earnings; |
175 | 175 | |
176 | - $pdf->Row( $prepare_pdf_data ); |
|
176 | + $pdf->Row($prepare_pdf_data); |
|
177 | 177 | |
178 | 178 | endforeach; |
179 | 179 | } else { |
180 | 180 | |
181 | 181 | // Fix: Minor Styling Alignment Issue for PDF. |
182 | - if ( $categories_enabled && $tags_enabled ) { |
|
182 | + if ($categories_enabled && $tags_enabled) { |
|
183 | 183 | $no_found_width = 280; |
184 | - } elseif ( $categories_enabled || $tags_enabled ) { |
|
184 | + } elseif ($categories_enabled || $tags_enabled) { |
|
185 | 185 | $no_found_width = 235; |
186 | 186 | } else { |
187 | 187 | $no_found_width = 190; |
188 | 188 | } |
189 | - $title = utf8_decode( __( 'No forms found.', 'give' ) ); |
|
190 | - $pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false ); |
|
189 | + $title = utf8_decode(__('No forms found.', 'give')); |
|
190 | + $pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false); |
|
191 | 191 | }// End if(). |
192 | 192 | $pdf->Ln(); |
193 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
194 | - $pdf->SetFont( $default_font, '', 14 ); |
|
193 | + $pdf->SetTextColor(50, 50, 50); |
|
194 | + $pdf->SetFont($default_font, '', 14); |
|
195 | 195 | |
196 | 196 | // Output Graph on a new page. |
197 | - $pdf->AddPage( 'L', 'A4' ); |
|
198 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
199 | - $pdf->SetFont( $default_font, '', 12 ); |
|
197 | + $pdf->AddPage('L', 'A4'); |
|
198 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
199 | + $pdf->SetFont($default_font, '', 12); |
|
200 | 200 | |
201 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
202 | - $image = str_replace( ' ', '%20', $image ); |
|
201 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
202 | + $image = str_replace(' ', '%20', $image); |
|
203 | 203 | |
204 | - $pdf->SetX( 25 ); |
|
205 | - $pdf->Image( $image . '&file=.png' ); |
|
206 | - $pdf->Ln( 7 ); |
|
207 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
204 | + $pdf->SetX(25); |
|
205 | + $pdf->Image($image.'&file=.png'); |
|
206 | + $pdf->Ln(7); |
|
207 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
208 | 208 | exit(); |
209 | 209 | } |
210 | 210 | |
211 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
211 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
212 | 212 | |
213 | 213 | /** |
214 | 214 | * Draws Chart for PDF Report. |
@@ -225,38 +225,38 @@ discard block |
||
225 | 225 | * @return string $chart->getUrl() URL for the Google Chart |
226 | 226 | */ |
227 | 227 | function give_draw_chart_image() { |
228 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
229 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
230 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
228 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
229 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
230 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
231 | 231 | |
232 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
232 | + $chart = new GoogleChart('lc', 900, 330); |
|
233 | 233 | |
234 | 234 | $i = 1; |
235 | 235 | $earnings = ""; |
236 | 236 | $sales = ""; |
237 | 237 | |
238 | - while ( $i <= 12 ) : |
|
239 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
240 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
241 | - $i ++; |
|
238 | + while ($i <= 12) : |
|
239 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
240 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
241 | + $i++; |
|
242 | 242 | endwhile; |
243 | 243 | |
244 | - $earnings_array = explode( ",", $earnings ); |
|
245 | - $sales_array = explode( ",", $sales ); |
|
244 | + $earnings_array = explode(",", $earnings); |
|
245 | + $sales_array = explode(",", $sales); |
|
246 | 246 | |
247 | 247 | $i = 0; |
248 | - while ( $i <= 11 ) { |
|
249 | - if ( empty( $sales_array[ $i ] ) ) { |
|
250 | - $sales_array[ $i ] = 0; |
|
248 | + while ($i <= 11) { |
|
249 | + if (empty($sales_array[$i])) { |
|
250 | + $sales_array[$i] = 0; |
|
251 | 251 | } |
252 | - $i ++; |
|
252 | + $i++; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | $min_earnings = 0; |
256 | - $max_earnings = max( $earnings_array ); |
|
257 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
256 | + $max_earnings = max($earnings_array); |
|
257 | + $earnings_scale = round($max_earnings, - 1); |
|
258 | 258 | |
259 | - $data = new GoogleChartData( array( |
|
259 | + $data = new GoogleChartData(array( |
|
260 | 260 | $earnings_array[0], |
261 | 261 | $earnings_array[1], |
262 | 262 | $earnings_array[2], |
@@ -269,25 +269,25 @@ discard block |
||
269 | 269 | $earnings_array[9], |
270 | 270 | $earnings_array[10], |
271 | 271 | $earnings_array[11], |
272 | - ) ); |
|
272 | + )); |
|
273 | 273 | |
274 | - $data->setLegend( __( 'Income', 'give' ) ); |
|
275 | - $data->setColor( '1b58a3' ); |
|
276 | - $chart->addData( $data ); |
|
274 | + $data->setLegend(__('Income', 'give')); |
|
275 | + $data->setColor('1b58a3'); |
|
276 | + $chart->addData($data); |
|
277 | 277 | |
278 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
279 | - $shape_marker->setColor( '000000' ); |
|
280 | - $shape_marker->setSize( 7 ); |
|
281 | - $shape_marker->setBorder( 2 ); |
|
282 | - $shape_marker->setData( $data ); |
|
283 | - $chart->addMarker( $shape_marker ); |
|
278 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
279 | + $shape_marker->setColor('000000'); |
|
280 | + $shape_marker->setSize(7); |
|
281 | + $shape_marker->setBorder(2); |
|
282 | + $shape_marker->setData($data); |
|
283 | + $chart->addMarker($shape_marker); |
|
284 | 284 | |
285 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
286 | - $value_marker->setColor( '000000' ); |
|
287 | - $value_marker->setData( $data ); |
|
288 | - $chart->addMarker( $value_marker ); |
|
285 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
286 | + $value_marker->setColor('000000'); |
|
287 | + $value_marker->setData($data); |
|
288 | + $chart->addMarker($value_marker); |
|
289 | 289 | |
290 | - $data = new GoogleChartData( array( |
|
290 | + $data = new GoogleChartData(array( |
|
291 | 291 | $sales_array[0], |
292 | 292 | $sales_array[1], |
293 | 293 | $sales_array[2], |
@@ -300,46 +300,46 @@ discard block |
||
300 | 300 | $sales_array[9], |
301 | 301 | $sales_array[10], |
302 | 302 | $sales_array[11], |
303 | - ) ); |
|
304 | - $data->setLegend( __( 'Donations', 'give' ) ); |
|
305 | - $data->setColor( 'ff6c1c' ); |
|
306 | - $chart->addData( $data ); |
|
307 | - |
|
308 | - $chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
309 | - |
|
310 | - $chart->setScale( 0, $max_earnings ); |
|
311 | - |
|
312 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
313 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
314 | - $chart->addAxis( $y_axis ); |
|
315 | - |
|
316 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
317 | - $x_axis->setTickMarks( 5 ); |
|
318 | - $x_axis->setLabels( array( |
|
319 | - __( 'Jan', 'give' ), |
|
320 | - __( 'Feb', 'give' ), |
|
321 | - __( 'Mar', 'give' ), |
|
322 | - __( 'Apr', 'give' ), |
|
323 | - __( 'May', 'give' ), |
|
324 | - __( 'June', 'give' ), |
|
325 | - __( 'July', 'give' ), |
|
326 | - __( 'Aug', 'give' ), |
|
327 | - __( 'Sept', 'give' ), |
|
328 | - __( 'Oct', 'give' ), |
|
329 | - __( 'Nov', 'give' ), |
|
330 | - __( 'Dec', 'give' ), |
|
331 | - ) ); |
|
332 | - $chart->addAxis( $x_axis ); |
|
333 | - |
|
334 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
335 | - $shape_marker->setSize( 6 ); |
|
336 | - $shape_marker->setBorder( 2 ); |
|
337 | - $shape_marker->setData( $data ); |
|
338 | - $chart->addMarker( $shape_marker ); |
|
339 | - |
|
340 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
341 | - $value_marker->setData( $data ); |
|
342 | - $chart->addMarker( $value_marker ); |
|
303 | + )); |
|
304 | + $data->setLegend(__('Donations', 'give')); |
|
305 | + $data->setColor('ff6c1c'); |
|
306 | + $chart->addData($data); |
|
307 | + |
|
308 | + $chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
309 | + |
|
310 | + $chart->setScale(0, $max_earnings); |
|
311 | + |
|
312 | + $y_axis = new GoogleChartAxis('y'); |
|
313 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
314 | + $chart->addAxis($y_axis); |
|
315 | + |
|
316 | + $x_axis = new GoogleChartAxis('x'); |
|
317 | + $x_axis->setTickMarks(5); |
|
318 | + $x_axis->setLabels(array( |
|
319 | + __('Jan', 'give'), |
|
320 | + __('Feb', 'give'), |
|
321 | + __('Mar', 'give'), |
|
322 | + __('Apr', 'give'), |
|
323 | + __('May', 'give'), |
|
324 | + __('June', 'give'), |
|
325 | + __('July', 'give'), |
|
326 | + __('Aug', 'give'), |
|
327 | + __('Sept', 'give'), |
|
328 | + __('Oct', 'give'), |
|
329 | + __('Nov', 'give'), |
|
330 | + __('Dec', 'give'), |
|
331 | + )); |
|
332 | + $chart->addAxis($x_axis); |
|
333 | + |
|
334 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
335 | + $shape_marker->setSize(6); |
|
336 | + $shape_marker->setBorder(2); |
|
337 | + $shape_marker->setData($data); |
|
338 | + $chart->addMarker($shape_marker); |
|
339 | + |
|
340 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
341 | + $value_marker->setData($data); |
|
342 | + $chart->addMarker($value_marker); |
|
343 | 343 | |
344 | 344 | return $chart->getUrl(); |
345 | 345 | } |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded. |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | // Set parent defaults. |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | - 'ajax' => false,// Does this table support ajax?. |
|
51 | - ) ); |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | + 'ajax' => false, // Does this table support ajax?. |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Column Name. |
64 | 64 | */ |
65 | - public function column_default( $item, $column_name ) { |
|
65 | + public function column_default($item, $column_name) { |
|
66 | 66 | |
67 | - switch ( $column_name ) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'payment_id' : |
71 | - return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) ); |
|
71 | + return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id'])); |
|
72 | 72 | case 'gateway' : |
73 | - return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway']; |
|
73 | + return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway']; |
|
74 | 74 | case 'error' : |
75 | - return esc_html( $item['log_title'] ); |
|
75 | + return esc_html($item['log_title']); |
|
76 | 76 | default: |
77 | - return $item[ $column_name ]; |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,35 +88,35 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function column_message( $item ) { |
|
91 | + public function column_message($item) { |
|
92 | 92 | ?> |
93 | 93 | <?php |
94 | - echo Give()->tooltips->render_link( array( |
|
95 | - 'label' => __( 'View Log Message', 'give' ), |
|
94 | + echo Give()->tooltips->render_link(array( |
|
95 | + 'label' => __('View Log Message', 'give'), |
|
96 | 96 | 'tag_content' => '<span class="dashicons dashicons-visibility"></span>', |
97 | 97 | 'link' => "#TB_inline?width=640&inlineId=log-message-{$item['ID']}", |
98 | 98 | 'attributes' => array( |
99 | 99 | 'class' => 'thickbox give-error-log-details-link button button-small', |
100 | 100 | ), |
101 | - ) ); |
|
101 | + )); |
|
102 | 102 | ?> |
103 | 103 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
104 | 104 | <?php |
105 | 105 | |
106 | - $serialized = strpos( $item['log_content'], '{"' ); |
|
106 | + $serialized = strpos($item['log_content'], '{"'); |
|
107 | 107 | |
108 | 108 | // Check to see if the log message contains serialized information |
109 | - if ( $serialized !== false ) { |
|
110 | - $length = strlen( $item['log_content'] ) - $serialized; |
|
111 | - $intro = substr( $item['log_content'], 0, - $length ); |
|
112 | - $data = substr( $item['log_content'], $serialized, strlen( $item['log_content'] ) - 1 ); |
|
109 | + if ($serialized !== false) { |
|
110 | + $length = strlen($item['log_content']) - $serialized; |
|
111 | + $intro = substr($item['log_content'], 0, - $length); |
|
112 | + $data = substr($item['log_content'], $serialized, strlen($item['log_content']) - 1); |
|
113 | 113 | |
114 | - echo wpautop( $intro ); |
|
115 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
116 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
114 | + echo wpautop($intro); |
|
115 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
116 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
117 | 117 | } else { |
118 | 118 | // No serialized data found |
119 | - echo wpautop( $item['log_content'] ); |
|
119 | + echo wpautop($item['log_content']); |
|
120 | 120 | } |
121 | 121 | ?> |
122 | 122 | </div> |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function get_columns() { |
134 | 134 | $columns = array( |
135 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
136 | - 'error' => esc_html__( 'Error', 'give' ), |
|
137 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
138 | - 'payment_id' => esc_html__( 'Donation ID', 'give' ), |
|
139 | - 'date' => esc_html__( 'Date', 'give' ), |
|
140 | - 'message' => esc_html__( 'Details', 'give' ), |
|
135 | + 'ID' => esc_html__('Log ID', 'give'), |
|
136 | + 'error' => esc_html__('Error', 'give'), |
|
137 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
138 | + 'payment_id' => esc_html__('Donation ID', 'give'), |
|
139 | + 'date' => esc_html__('Date', 'give'), |
|
140 | + 'message' => esc_html__('Details', 'give'), |
|
141 | 141 | ); |
142 | 142 | |
143 | 143 | return $columns; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return int Current page number |
152 | 152 | */ |
153 | 153 | public function get_paged() { |
154 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
154 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @since 1.0 |
162 | 162 | * @return void |
163 | 163 | */ |
164 | - public function bulk_actions( $which = '' ) { |
|
164 | + public function bulk_actions($which = '') { |
|
165 | 165 | give_log_views(); |
166 | 166 | } |
167 | 167 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | public function get_logs() { |
177 | 177 | // Prevent the queries from getting cached. |
178 | 178 | // Without this there are occasional memory issues for some installs. |
179 | - wp_suspend_cache_addition( true ); |
|
179 | + wp_suspend_cache_addition(true); |
|
180 | 180 | |
181 | 181 | $logs_data = array(); |
182 | 182 | $paged = $this->get_paged(); |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | 'posts_per_page' => $this->per_page, |
187 | 187 | ); |
188 | 188 | |
189 | - $logs = Give()->logs->get_connected_logs( $log_query ); |
|
189 | + $logs = Give()->logs->get_connected_logs($log_query); |
|
190 | 190 | |
191 | - if ( $logs ) { |
|
192 | - foreach ( $logs as $log ) { |
|
191 | + if ($logs) { |
|
192 | + foreach ($logs as $log) { |
|
193 | 193 | |
194 | 194 | $logs_data[] = array( |
195 | 195 | 'ID' => $log->ID, |
196 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
196 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
197 | 197 | 'payment_id' => $log->log_parent, |
198 | 198 | 'error' => 'error', |
199 | - 'gateway' => give_get_payment_gateway( $log->log_parent ), |
|
199 | + 'gateway' => give_get_payment_gateway($log->log_parent), |
|
200 | 200 | 'date' => $log->log_date, |
201 | 201 | 'log_content' => $log->log_content, |
202 | 202 | 'log_title' => $log->log_title, |
@@ -220,19 +220,19 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @param string $which |
222 | 222 | */ |
223 | - protected function display_tablenav( $which ) { |
|
224 | - if ( 'top' === $which ) { |
|
225 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
223 | + protected function display_tablenav($which) { |
|
224 | + if ('top' === $which) { |
|
225 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
226 | 226 | } |
227 | 227 | ?> |
228 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
228 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
229 | 229 | |
230 | 230 | <div class="alignleft actions bulkactions"> |
231 | - <?php $this->bulk_actions( $which ); ?> |
|
231 | + <?php $this->bulk_actions($which); ?> |
|
232 | 232 | </div> |
233 | 233 | <?php |
234 | - $this->extra_tablenav( $which ); |
|
235 | - $this->pagination( $which ); |
|
234 | + $this->extra_tablenav($which); |
|
235 | + $this->pagination($which); |
|
236 | 236 | ?> |
237 | 237 | |
238 | 238 | <br class="clear"/> |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | $columns = $this->get_columns(); |
259 | 259 | $hidden = array(); // No hidden columns |
260 | 260 | $sortable = $this->get_sortable_columns(); |
261 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
261 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
262 | 262 | $this->items = $this->get_logs(); |
263 | - $total_items = Give()->logs->get_log_count( 0, 'gateway_error' ); |
|
263 | + $total_items = Give()->logs->get_log_count(0, 'gateway_error'); |
|
264 | 264 | |
265 | - $this->set_pagination_args( array( |
|
265 | + $this->set_pagination_args(array( |
|
266 | 266 | 'total_items' => $total_items, |
267 | 267 | 'per_page' => $this->per_page, |
268 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
268 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
269 | 269 | ) |
270 | 270 | ); |
271 | 271 | } |