@@ -512,7 +512,7 @@ |
||
512 | 512 | * @since 1.7 |
513 | 513 | * @access public |
514 | 514 | * |
515 | - * @return bool |
|
515 | + * @return false|null |
|
516 | 516 | */ |
517 | 517 | public function delete_cache() { |
518 | 518 | // Add log related keys to delete. |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * Setup properties |
54 | 54 | */ |
55 | 55 | |
56 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs.php'; |
|
57 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs-meta.php'; |
|
56 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs.php'; |
|
57 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs-meta.php'; |
|
58 | 58 | $this->log_db = new Give_DB_Logs(); |
59 | 59 | $this->logmeta_db = new Give_DB_Log_Meta(); |
60 | 60 | |
@@ -62,22 +62,22 @@ discard block |
||
62 | 62 | * Setup hooks. |
63 | 63 | */ |
64 | 64 | |
65 | - add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) ); |
|
66 | - add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) ); |
|
67 | - add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) ); |
|
68 | - add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) ); |
|
69 | - add_action( 'update_log_metadata', array( $this, 'bc_200_set_payment_as_log_parent' ), 10, 4 ); |
|
65 | + add_action('save_post_give_payment', array($this, 'background_process_delete_cache')); |
|
66 | + add_action('save_post_give_forms', array($this, 'background_process_delete_cache')); |
|
67 | + add_action('save_post_give_log', array($this, 'background_process_delete_cache')); |
|
68 | + add_action('give_delete_log_cache', array($this, 'delete_cache')); |
|
69 | + add_action('update_log_metadata', array($this, 'bc_200_set_payment_as_log_parent'), 10, 4); |
|
70 | 70 | |
71 | 71 | // Backward compatibility. |
72 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
72 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
73 | 73 | // Create the log post type |
74 | - add_action( 'init', array( $this, 'register_post_type' ), -2 ); |
|
74 | + add_action('init', array($this, 'register_post_type'), -2); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | // Create types taxonomy and default types |
78 | 78 | // @todo: remove this taxonomy, some addon use this taxonomy with there custom log post type for example: recurring |
79 | 79 | // Do not use this taxonomy with your log type because we will remove it in future releases. |
80 | - add_action( 'init', array( $this, 'register_taxonomy' ), -2 ); |
|
80 | + add_action('init', array($this, 'register_taxonomy'), -2); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | /* Logs post type */ |
96 | 96 | $log_args = array( |
97 | 97 | 'labels' => array( |
98 | - 'name' => esc_html__( 'Logs', 'give' ), |
|
98 | + 'name' => esc_html__('Logs', 'give'), |
|
99 | 99 | ), |
100 | 100 | 'public' => false, |
101 | 101 | 'exclude_from_search' => true, |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | 'query_var' => false, |
105 | 105 | 'rewrite' => false, |
106 | 106 | 'capability_type' => 'post', |
107 | - 'supports' => array( 'title', 'editor' ), |
|
107 | + 'supports' => array('title', 'editor'), |
|
108 | 108 | 'can_export' => true, |
109 | 109 | ); |
110 | 110 | |
111 | - register_post_type( 'give_log', $log_args ); |
|
111 | + register_post_type('give_log', $log_args); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | * @return void |
123 | 123 | */ |
124 | 124 | public function register_taxonomy() { |
125 | - register_taxonomy( 'give_log_type', 'give_log', array( |
|
125 | + register_taxonomy('give_log_type', 'give_log', array( |
|
126 | 126 | 'public' => false, |
127 | - ) ); |
|
127 | + )); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | 'update', |
146 | 146 | ); |
147 | 147 | |
148 | - return apply_filters( 'give_log_types', $terms ); |
|
148 | + return apply_filters('give_log_types', $terms); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @return bool Whether log type is valid. |
162 | 162 | */ |
163 | - public function valid_type( $type ) { |
|
164 | - return in_array( $type, $this->log_types() ); |
|
163 | + public function valid_type($type) { |
|
164 | + return in_array($type, $this->log_types()); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return int Log ID. |
182 | 182 | */ |
183 | - public function add( $title = '', $message = '', $parent = 0, $type = '' ) { |
|
183 | + public function add($title = '', $message = '', $parent = 0, $type = '') { |
|
184 | 184 | $log_data = array( |
185 | 185 | 'post_title' => $title, |
186 | 186 | 'post_content' => $message, |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | 'log_type' => $type, |
189 | 189 | ); |
190 | 190 | |
191 | - return $this->insert_log( $log_data ); |
|
191 | + return $this->insert_log($log_data); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return array An array of the connected logs. |
207 | 207 | */ |
208 | - public function get_logs( $object_id = 0, $type = '', $paged = null ) { |
|
209 | - return $this->get_connected_logs( array( |
|
208 | + public function get_logs($object_id = 0, $type = '', $paged = null) { |
|
209 | + return $this->get_connected_logs(array( |
|
210 | 210 | 'log_parent' => $object_id, |
211 | 211 | 'paged' => $paged, |
212 | 212 | 'log_type' => $type, |
213 | - ) ); |
|
213 | + )); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return int The ID of the newly created log item. |
226 | 226 | */ |
227 | - public function insert_log( $log_data = array(), $log_meta = array() ) { |
|
227 | + public function insert_log($log_data = array(), $log_meta = array()) { |
|
228 | 228 | $log_id = 0; |
229 | 229 | |
230 | 230 | $defaults = array( |
@@ -237,28 +237,28 @@ discard block |
||
237 | 237 | 'post_status' => 'publish', |
238 | 238 | ); |
239 | 239 | |
240 | - $args = wp_parse_args( $log_data, $defaults ); |
|
241 | - $this->bc_200_validate_params( $args, $log_meta ); |
|
240 | + $args = wp_parse_args($log_data, $defaults); |
|
241 | + $this->bc_200_validate_params($args, $log_meta); |
|
242 | 242 | |
243 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
243 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
244 | 244 | global $wpdb; |
245 | 245 | |
246 | 246 | // Backward Compatibility. |
247 | - if ( ! $wpdb->get_var( "SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1" ) ) { |
|
248 | - $latest_log_id = $wpdb->get_var( "SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1" ); |
|
249 | - $latest_log_id = empty( $latest_log_id ) ? 1 : ++ $latest_log_id; |
|
247 | + if ( ! $wpdb->get_var("SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1")) { |
|
248 | + $latest_log_id = $wpdb->get_var("SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1"); |
|
249 | + $latest_log_id = empty($latest_log_id) ? 1 : ++ $latest_log_id; |
|
250 | 250 | |
251 | 251 | $args['ID'] = $latest_log_id; |
252 | - $this->log_db->insert( $args ); |
|
252 | + $this->log_db->insert($args); |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - $log_id = $this->log_db->add( $args ); |
|
256 | + $log_id = $this->log_db->add($args); |
|
257 | 257 | |
258 | 258 | // Set log meta, if any |
259 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
260 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
261 | - $this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
259 | + if ($log_id && ! empty($log_meta)) { |
|
260 | + foreach ((array) $log_meta as $key => $meta) { |
|
261 | + $this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return bool|null True if successful, false otherwise. |
282 | 282 | */ |
283 | - public function update_log( $log_data = array(), $log_meta = array() ) { |
|
283 | + public function update_log($log_data = array(), $log_meta = array()) { |
|
284 | 284 | $log_id = 0; |
285 | 285 | |
286 | 286 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @param array $log_data Log entry data. |
292 | 292 | * @param array $log_meta Log entry meta. |
293 | 293 | */ |
294 | - do_action( 'give_pre_update_log', $log_data, $log_meta ); |
|
294 | + do_action('give_pre_update_log', $log_data, $log_meta); |
|
295 | 295 | |
296 | 296 | $defaults = array( |
297 | 297 | 'log_parent' => 0, |
@@ -301,28 +301,28 @@ discard block |
||
301 | 301 | 'post_status' => 'publish', |
302 | 302 | ); |
303 | 303 | |
304 | - $args = wp_parse_args( $log_data, $defaults ); |
|
305 | - $this->bc_200_validate_params( $args, $log_meta ); |
|
304 | + $args = wp_parse_args($log_data, $defaults); |
|
305 | + $this->bc_200_validate_params($args, $log_meta); |
|
306 | 306 | |
307 | 307 | // Store the log entry |
308 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
308 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
309 | 309 | // Backward compatibility. |
310 | - $log_id = wp_update_post( $args ); |
|
310 | + $log_id = wp_update_post($args); |
|
311 | 311 | |
312 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
313 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
314 | - if ( ! empty( $meta ) ) { |
|
315 | - give_update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
312 | + if ($log_id && ! empty($log_meta)) { |
|
313 | + foreach ((array) $log_meta as $key => $meta) { |
|
314 | + if ( ! empty($meta)) { |
|
315 | + give_update_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | } |
319 | 319 | } else { |
320 | - $log_id = $this->log_db->add( $args ); |
|
320 | + $log_id = $this->log_db->add($args); |
|
321 | 321 | |
322 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
323 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
324 | - if ( ! empty( $meta ) ) { |
|
325 | - $this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
322 | + if ($log_id && ! empty($log_meta)) { |
|
323 | + foreach ((array) $log_meta as $key => $meta) { |
|
324 | + if ( ! empty($meta)) { |
|
325 | + $this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @param array $log_data Log entry data. |
338 | 338 | * @param array $log_meta Log entry meta. |
339 | 339 | */ |
340 | - do_action( 'give_post_update_log', $log_id, $log_data, $log_meta ); |
|
340 | + do_action('give_post_update_log', $log_id, $log_data, $log_meta); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -354,30 +354,30 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return array|false Array if logs were found, false otherwise. |
356 | 356 | */ |
357 | - public function get_connected_logs( $args = array() ) { |
|
357 | + public function get_connected_logs($args = array()) { |
|
358 | 358 | $logs = array(); |
359 | 359 | |
360 | - $defaults = array( |
|
360 | + $defaults = array( |
|
361 | 361 | 'number' => 20, |
362 | - 'paged' => get_query_var( 'paged' ), |
|
362 | + 'paged' => get_query_var('paged'), |
|
363 | 363 | 'log_type' => false, |
364 | 364 | |
365 | 365 | // Backward compatibility. |
366 | 366 | 'post_type' => 'give_log', |
367 | 367 | 'post_status' => 'publish', |
368 | 368 | ); |
369 | - $query_args = wp_parse_args( $args, $defaults ); |
|
370 | - $this->bc_200_validate_params( $query_args ); |
|
369 | + $query_args = wp_parse_args($args, $defaults); |
|
370 | + $this->bc_200_validate_params($query_args); |
|
371 | 371 | |
372 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
372 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
373 | 373 | // Backward compatibility. |
374 | - $logs = get_posts( $query_args ); |
|
375 | - $this->bc_200_add_new_properties( $logs ); |
|
374 | + $logs = get_posts($query_args); |
|
375 | + $this->bc_200_add_new_properties($logs); |
|
376 | 376 | } else { |
377 | - $logs = $this->log_db->get_logs( $query_args ); |
|
377 | + $logs = $this->log_db->get_logs($query_args); |
|
378 | 378 | } |
379 | 379 | |
380 | - return ( ! empty( $logs ) ? $logs : false ); |
|
380 | + return ( ! empty($logs) ? $logs : false); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
@@ -395,41 +395,41 @@ discard block |
||
395 | 395 | * |
396 | 396 | * @return int Log count. |
397 | 397 | */ |
398 | - public function get_log_count( $object_id = 0, $type = '', $meta_query = null, $date_query = null ) { |
|
398 | + public function get_log_count($object_id = 0, $type = '', $meta_query = null, $date_query = null) { |
|
399 | 399 | $logs_count = 0; |
400 | 400 | |
401 | 401 | $query_args = array( |
402 | - 'number' => - 1, |
|
402 | + 'number' => -1, |
|
403 | 403 | |
404 | 404 | // Backward comatibility. |
405 | 405 | 'post_type' => 'give_log', |
406 | 406 | 'post_status' => 'publish', |
407 | 407 | ); |
408 | 408 | |
409 | - if ( $object_id ) { |
|
409 | + if ($object_id) { |
|
410 | 410 | $query_args['log_parent'] = $object_id; |
411 | 411 | } |
412 | 412 | |
413 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
413 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
414 | 414 | $query_args['log_type'] = $type; |
415 | 415 | } |
416 | 416 | |
417 | - if ( ! empty( $meta_query ) ) { |
|
417 | + if ( ! empty($meta_query)) { |
|
418 | 418 | $query_args['meta_query'] = $meta_query; |
419 | 419 | } |
420 | 420 | |
421 | - if ( ! empty( $date_query ) ) { |
|
421 | + if ( ! empty($date_query)) { |
|
422 | 422 | $query_args['date_query'] = $date_query; |
423 | 423 | } |
424 | 424 | |
425 | - $this->bc_200_validate_params( $query_args ); |
|
425 | + $this->bc_200_validate_params($query_args); |
|
426 | 426 | |
427 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
427 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
428 | 428 | // Backward compatibility. |
429 | - $logs = new WP_Query( $query_args ); |
|
429 | + $logs = new WP_Query($query_args); |
|
430 | 430 | $logs_count = (int) $logs->post_count; |
431 | 431 | } else { |
432 | - $logs_count = $this->log_db->count( $query_args ); |
|
432 | + $logs_count = $this->log_db->count($query_args); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | return $logs_count; |
@@ -449,10 +449,10 @@ discard block |
||
449 | 449 | * |
450 | 450 | * @return void |
451 | 451 | */ |
452 | - public function delete_logs( $object_id = 0, $type = '', $meta_query = null ) { |
|
452 | + public function delete_logs($object_id = 0, $type = '', $meta_query = null) { |
|
453 | 453 | $query_args = array( |
454 | 454 | 'log_parent' => $object_id, |
455 | - 'number' => - 1, |
|
455 | + 'number' => -1, |
|
456 | 456 | 'fields' => 'ID', |
457 | 457 | |
458 | 458 | // Backward compatibility. |
@@ -460,32 +460,32 @@ discard block |
||
460 | 460 | 'post_status' => 'publish', |
461 | 461 | ); |
462 | 462 | |
463 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
463 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
464 | 464 | $query_args['log_type'] = $type; |
465 | 465 | } |
466 | 466 | |
467 | - if ( ! empty( $meta_query ) ) { |
|
467 | + if ( ! empty($meta_query)) { |
|
468 | 468 | $query_args['meta_query'] = $meta_query; |
469 | 469 | } |
470 | 470 | |
471 | - $this->bc_200_validate_params( $query_args ); |
|
471 | + $this->bc_200_validate_params($query_args); |
|
472 | 472 | |
473 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
473 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
474 | 474 | // Backward compatibility. |
475 | - $logs = get_posts( $query_args ); |
|
475 | + $logs = get_posts($query_args); |
|
476 | 476 | |
477 | - if ( $logs ) { |
|
478 | - foreach ( $logs as $log ) { |
|
479 | - wp_delete_post( $log, true ); |
|
477 | + if ($logs) { |
|
478 | + foreach ($logs as $log) { |
|
479 | + wp_delete_post($log, true); |
|
480 | 480 | } |
481 | 481 | } |
482 | 482 | } else { |
483 | - $logs = $this->log_db->get_logs( $query_args ); |
|
483 | + $logs = $this->log_db->get_logs($query_args); |
|
484 | 484 | |
485 | - if ( $logs ) { |
|
486 | - foreach ( $logs as $log ) { |
|
487 | - if ( $this->log_db->delete( $log->ID ) ) { |
|
488 | - $this->logmeta_db->delete_row( $log->ID ); |
|
485 | + if ($logs) { |
|
486 | + foreach ($logs as $log) { |
|
487 | + if ($this->log_db->delete($log->ID)) { |
|
488 | + $this->logmeta_db->delete_row($log->ID); |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | } |
@@ -502,9 +502,9 @@ discard block |
||
502 | 502 | * |
503 | 503 | * @param int $post_id |
504 | 504 | */ |
505 | - public function background_process_delete_cache( $post_id ) { |
|
505 | + public function background_process_delete_cache($post_id) { |
|
506 | 506 | // Delete log cache immediately |
507 | - wp_schedule_single_event( time() - 5, 'give_delete_log_cache' ); |
|
507 | + wp_schedule_single_event(time() - 5, 'give_delete_log_cache'); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | /** |
@@ -517,17 +517,17 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function delete_cache() { |
519 | 519 | // Add log related keys to delete. |
520 | - $cache_give_logs = Give_Cache::get_options_like( 'give_logs' ); |
|
521 | - $cache_give_log_count = Give_Cache::get_options_like( 'log_count' ); |
|
520 | + $cache_give_logs = Give_Cache::get_options_like('give_logs'); |
|
521 | + $cache_give_log_count = Give_Cache::get_options_like('log_count'); |
|
522 | 522 | |
523 | - $cache_option_names = array_merge( $cache_give_logs, $cache_give_log_count ); |
|
523 | + $cache_option_names = array_merge($cache_give_logs, $cache_give_log_count); |
|
524 | 524 | |
525 | 525 | // Bailout. |
526 | - if ( empty( $cache_option_names ) ) { |
|
526 | + if (empty($cache_option_names)) { |
|
527 | 527 | return false; |
528 | 528 | } |
529 | 529 | |
530 | - Give_Cache::delete( $cache_option_names ); |
|
530 | + Give_Cache::delete($cache_option_names); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | * @param array $log_query |
540 | 540 | * @param array $log_meta |
541 | 541 | */ |
542 | - private function bc_200_validate_params( &$log_query, &$log_meta = array() ) { |
|
542 | + private function bc_200_validate_params(&$log_query, &$log_meta = array()) { |
|
543 | 543 | $query_params = array( |
544 | 544 | 'log_title' => 'post_title', |
545 | 545 | 'log_parent' => 'post_parent', |
@@ -551,41 +551,41 @@ discard block |
||
551 | 551 | 'meta_query' => 'meta_query', |
552 | 552 | ); |
553 | 553 | |
554 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
554 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
555 | 555 | // Set old params. |
556 | - foreach ( $query_params as $new_query_param => $old_query_param ) { |
|
556 | + foreach ($query_params as $new_query_param => $old_query_param) { |
|
557 | 557 | |
558 | - if ( isset( $log_query[ $old_query_param ] ) && empty( $log_query[ $new_query_param ] ) ) { |
|
559 | - $log_query[ $new_query_param ] = $log_query[ $old_query_param ]; |
|
558 | + if (isset($log_query[$old_query_param]) && empty($log_query[$new_query_param])) { |
|
559 | + $log_query[$new_query_param] = $log_query[$old_query_param]; |
|
560 | 560 | continue; |
561 | - } elseif ( ! isset( $log_query[ $new_query_param ] ) ) { |
|
561 | + } elseif ( ! isset($log_query[$new_query_param])) { |
|
562 | 562 | continue; |
563 | - } elseif( empty( $log_query[ $new_query_param ] ) ) { |
|
563 | + } elseif (empty($log_query[$new_query_param])) { |
|
564 | 564 | continue; |
565 | 565 | } |
566 | 566 | |
567 | - switch ( $new_query_param ) { |
|
567 | + switch ($new_query_param) { |
|
568 | 568 | case 'log_type': |
569 | 569 | $log_query['tax_query'] = array( |
570 | 570 | array( |
571 | 571 | 'taxonomy' => 'give_log_type', |
572 | 572 | 'field' => 'slug', |
573 | - 'terms' => $log_query[ $new_query_param ], |
|
573 | + 'terms' => $log_query[$new_query_param], |
|
574 | 574 | ), |
575 | 575 | ); |
576 | 576 | break; |
577 | 577 | |
578 | 578 | case 'meta_query': |
579 | - if( ! empty( $log_query['meta_query'] ) && empty( $log_query['post_parent'] ) ) { |
|
580 | - foreach ( $log_query['meta_query'] as $index => $meta_query ){ |
|
581 | - if( ! is_array( $meta_query ) || empty( $meta_query['key'] ) ) { |
|
579 | + if ( ! empty($log_query['meta_query']) && empty($log_query['post_parent'])) { |
|
580 | + foreach ($log_query['meta_query'] as $index => $meta_query) { |
|
581 | + if ( ! is_array($meta_query) || empty($meta_query['key'])) { |
|
582 | 582 | continue; |
583 | 583 | } |
584 | 584 | |
585 | - switch ( $meta_query['key'] ) { |
|
585 | + switch ($meta_query['key']) { |
|
586 | 586 | case '_give_log_form_id': |
587 | 587 | $log_query['post_parent'] = $meta_query['value']; |
588 | - unset( $log_query['meta_query'][$index] ); |
|
588 | + unset($log_query['meta_query'][$index]); |
|
589 | 589 | break; |
590 | 590 | } |
591 | 591 | } |
@@ -593,40 +593,40 @@ discard block |
||
593 | 593 | break; |
594 | 594 | |
595 | 595 | default: |
596 | - switch( $new_query_param ){ |
|
596 | + switch ($new_query_param) { |
|
597 | 597 | case 'log_parent': |
598 | 598 | $log_query['meta_query'][] = array( |
599 | 599 | 'key' => '_give_log_payment_id', |
600 | - 'value' => $log_query[ $new_query_param ] |
|
600 | + 'value' => $log_query[$new_query_param] |
|
601 | 601 | ); |
602 | 602 | |
603 | 603 | break; |
604 | 604 | |
605 | 605 | default: |
606 | - $log_query[ $old_query_param ] = $log_query[ $new_query_param ]; |
|
606 | + $log_query[$old_query_param] = $log_query[$new_query_param]; |
|
607 | 607 | } |
608 | 608 | } |
609 | 609 | } |
610 | 610 | } else { |
611 | 611 | // Set only old params. |
612 | - $query_params = array_flip( $query_params ); |
|
613 | - foreach ( $query_params as $old_query_param => $new_query_param ) { |
|
614 | - if ( isset( $log_query[ $new_query_param ] ) && empty( $log_query[ $old_query_param ] ) ) { |
|
615 | - $log_query[ $old_query_param ] = $log_query[ $new_query_param ]; |
|
612 | + $query_params = array_flip($query_params); |
|
613 | + foreach ($query_params as $old_query_param => $new_query_param) { |
|
614 | + if (isset($log_query[$new_query_param]) && empty($log_query[$old_query_param])) { |
|
615 | + $log_query[$old_query_param] = $log_query[$new_query_param]; |
|
616 | 616 | continue; |
617 | - } elseif ( ! isset( $log_query[ $old_query_param ] ) ) { |
|
617 | + } elseif ( ! isset($log_query[$old_query_param])) { |
|
618 | 618 | continue; |
619 | 619 | } |
620 | 620 | |
621 | - switch ( $old_query_param ) { |
|
621 | + switch ($old_query_param) { |
|
622 | 622 | case 'tax_query': |
623 | - if ( isset( $log_query[ $old_query_param ][0]['terms'] ) ) { |
|
624 | - $log_query[ $new_query_param ] = $log_query[ $old_query_param ][0]['terms']; |
|
623 | + if (isset($log_query[$old_query_param][0]['terms'])) { |
|
624 | + $log_query[$new_query_param] = $log_query[$old_query_param][0]['terms']; |
|
625 | 625 | } |
626 | 626 | break; |
627 | 627 | |
628 | 628 | default: |
629 | - $log_query[ $new_query_param ] = $log_query[ $old_query_param ]; |
|
629 | + $log_query[$new_query_param] = $log_query[$old_query_param]; |
|
630 | 630 | } |
631 | 631 | } |
632 | 632 | } |
@@ -640,8 +640,8 @@ discard block |
||
640 | 640 | * |
641 | 641 | * @param array $logs |
642 | 642 | */ |
643 | - private function bc_200_add_new_properties( &$logs ) { |
|
644 | - if ( empty( $logs ) ) { |
|
643 | + private function bc_200_add_new_properties(&$logs) { |
|
644 | + if (empty($logs)) { |
|
645 | 645 | return; |
646 | 646 | } |
647 | 647 | |
@@ -654,30 +654,30 @@ discard block |
||
654 | 654 | 'log_type' => 'give_log_type', |
655 | 655 | ); |
656 | 656 | |
657 | - if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) { |
|
658 | - foreach ( $logs as $index => $log ) { |
|
659 | - foreach ( $query_params as $new_query_param => $old_query_param ) { |
|
660 | - if ( ! property_exists( $log, $old_query_param ) ) { |
|
657 | + if ( ! give_has_upgrade_completed('v20_logs_upgrades')) { |
|
658 | + foreach ($logs as $index => $log) { |
|
659 | + foreach ($query_params as $new_query_param => $old_query_param) { |
|
660 | + if ( ! property_exists($log, $old_query_param)) { |
|
661 | 661 | /** |
662 | 662 | * Set unmatched properties. |
663 | 663 | */ |
664 | 664 | |
665 | 665 | // 1. log_type |
666 | - $term = get_the_terms( $log->ID, 'give_log_type' ); |
|
667 | - $term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array(); |
|
666 | + $term = get_the_terms($log->ID, 'give_log_type'); |
|
667 | + $term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array(); |
|
668 | 668 | |
669 | - $logs[ $index ]->{$new_query_param} = ! empty( $term ) ? $term->slug : ''; |
|
669 | + $logs[$index]->{$new_query_param} = ! empty($term) ? $term->slug : ''; |
|
670 | 670 | |
671 | 671 | continue; |
672 | 672 | } |
673 | 673 | |
674 | - switch ( $old_query_param ) { |
|
674 | + switch ($old_query_param) { |
|
675 | 675 | case 'post_parent': |
676 | - $logs[ $index ]->{$new_query_param} = give_get_meta( $log->ID, '_give_log_payment_id', true ); |
|
676 | + $logs[$index]->{$new_query_param} = give_get_meta($log->ID, '_give_log_payment_id', true); |
|
677 | 677 | break; |
678 | 678 | |
679 | 679 | default: |
680 | - $logs[ $index ]->{$new_query_param} = $log->{$old_query_param}; |
|
680 | + $logs[$index]->{$new_query_param} = $log->{$old_query_param}; |
|
681 | 681 | } |
682 | 682 | } |
683 | 683 | } |
@@ -697,10 +697,10 @@ discard block |
||
697 | 697 | * |
698 | 698 | * @return mixed |
699 | 699 | */ |
700 | - public function bc_200_set_payment_as_log_parent( $check, $log_id, $meta_key, $meta_value ) { |
|
700 | + public function bc_200_set_payment_as_log_parent($check, $log_id, $meta_key, $meta_value) { |
|
701 | 701 | global $wpdb; |
702 | 702 | $update_status = false; |
703 | - $post_type = get_post_type( $log_id ); |
|
703 | + $post_type = get_post_type($log_id); |
|
704 | 704 | |
705 | 705 | // Bailout. |
706 | 706 | if ( |
@@ -720,9 +720,9 @@ discard block |
||
720 | 720 | ) |
721 | 721 | ); |
722 | 722 | |
723 | - if ( $form_id ) { |
|
724 | - $this->logmeta_db->delete_meta( $log_id, '_give_log_payment_id' ); |
|
725 | - $this->logmeta_db->update_meta( $log_id, '_give_log_form_id', $form_id ); |
|
723 | + if ($form_id) { |
|
724 | + $this->logmeta_db->delete_meta($log_id, '_give_log_payment_id'); |
|
725 | + $this->logmeta_db->update_meta($log_id, '_give_log_form_id', $form_id); |
|
726 | 726 | |
727 | 727 | $update_status = $wpdb->update( |
728 | 728 | $this->log_db->table_name, |
@@ -397,7 +397,7 @@ |
||
397 | 397 | * |
398 | 398 | * @since 1.8.11 |
399 | 399 | * |
400 | - * @return void |
|
400 | + * @return false|null |
|
401 | 401 | */ |
402 | 402 | function give_create_pages() { |
403 | 403 |
@@ -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 | |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @global $wpdb |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_install( $network_wide = false ) { |
|
31 | +function give_install($network_wide = false) { |
|
32 | 32 | |
33 | 33 | global $wpdb; |
34 | 34 | |
35 | - if ( is_multisite() && $network_wide ) { |
|
35 | + if (is_multisite() && $network_wide) { |
|
36 | 36 | |
37 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
37 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
38 | 38 | |
39 | - switch_to_blog( $blog_id ); |
|
39 | + switch_to_blog($blog_id); |
|
40 | 40 | give_run_install(); |
41 | 41 | restore_current_blog(); |
42 | 42 | |
@@ -63,31 +63,31 @@ discard block |
||
63 | 63 | give_setup_post_types(); |
64 | 64 | |
65 | 65 | // Add Upgraded From Option. |
66 | - $current_version = get_option( 'give_version' ); |
|
67 | - if ( $current_version ) { |
|
68 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
66 | + $current_version = get_option('give_version'); |
|
67 | + if ($current_version) { |
|
68 | + update_option('give_version_upgraded_from', $current_version); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Setup some default options. |
72 | 72 | $options = array(); |
73 | 73 | |
74 | 74 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency. |
75 | - if ( empty( $current_version ) ) { |
|
76 | - $options = array_merge( $options, give_get_default_settings() ); |
|
75 | + if (empty($current_version)) { |
|
76 | + $options = array_merge($options, give_get_default_settings()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Populate the default values. |
80 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
80 | + update_option('give_settings', array_merge($give_options, $options)); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Run plugin upgrades. |
84 | 84 | * |
85 | 85 | * @since 1.8 |
86 | 86 | */ |
87 | - do_action( 'give_upgrades' ); |
|
87 | + do_action('give_upgrades'); |
|
88 | 88 | |
89 | - if ( GIVE_VERSION !== get_option( 'give_version' ) ) { |
|
90 | - update_option( 'give_version', GIVE_VERSION ); |
|
89 | + if (GIVE_VERSION !== get_option('give_version')) { |
|
90 | + update_option('give_version', GIVE_VERSION); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // Create Give roles. |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | // Set api version, end point and refresh permalink. |
99 | 99 | $api = new Give_API(); |
100 | 100 | $api->add_endpoint(); |
101 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
101 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
102 | 102 | |
103 | 103 | flush_rewrite_rules(); |
104 | 104 | |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | $give_sessions->use_php_sessions(); |
114 | 114 | |
115 | 115 | // Add a temporary option to note that Give pages have been created. |
116 | - Give_Cache::set( '_give_installed', $options, 30, true ); |
|
116 | + Give_Cache::set('_give_installed', $options, 30, true); |
|
117 | 117 | |
118 | - if ( ! $current_version ) { |
|
118 | + if ( ! $current_version) { |
|
119 | 119 | |
120 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
120 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
121 | 121 | |
122 | 122 | // When new upgrade routines are added, mark them as complete on fresh install. |
123 | 123 | $upgrade_routines = array( |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | 'v201_logs_upgrades' |
149 | 149 | ); |
150 | 150 | |
151 | - foreach ( $upgrade_routines as $upgrade ) { |
|
152 | - give_set_upgrade_complete( $upgrade ); |
|
151 | + foreach ($upgrade_routines as $upgrade) { |
|
152 | + give_set_upgrade_complete($upgrade); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | 156 | // Bail if activating from network, or bulk. |
157 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
157 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | 161 | // Add the transient to redirect. |
162 | - Give_Cache::set( '_give_activation_redirect', true, 30, true ); |
|
162 | + Give_Cache::set('_give_activation_redirect', true, 30, true); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * @param int $site_id The Site ID. |
178 | 178 | * @param array $meta Blog Meta. |
179 | 179 | */ |
180 | -function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
180 | +function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
181 | 181 | |
182 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
182 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
183 | 183 | |
184 | - switch_to_blog( $blog_id ); |
|
184 | + switch_to_blog($blog_id); |
|
185 | 185 | give_install(); |
186 | 186 | restore_current_blog(); |
187 | 187 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | } |
191 | 191 | |
192 | -add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 ); |
|
192 | +add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6); |
|
193 | 193 | |
194 | 194 | |
195 | 195 | /** |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return array The tables to drop. |
204 | 204 | */ |
205 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
205 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
206 | 206 | |
207 | - switch_to_blog( $blog_id ); |
|
207 | + switch_to_blog($blog_id); |
|
208 | 208 | $donors_db = new Give_DB_Donors(); |
209 | 209 | $donor_meta_db = new Give_DB_Donor_Meta(); |
210 | 210 | |
211 | - if ( $donors_db->installed() ) { |
|
211 | + if ($donors_db->installed()) { |
|
212 | 212 | $tables[] = $donors_db->table_name; |
213 | 213 | $tables[] = $donor_meta_db->table_name; |
214 | 214 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | } |
220 | 220 | |
221 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
221 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
222 | 222 | |
223 | 223 | /** |
224 | 224 | * Post-installation |
@@ -230,16 +230,16 @@ discard block |
||
230 | 230 | */ |
231 | 231 | function give_after_install() { |
232 | 232 | |
233 | - if ( ! is_admin() ) { |
|
233 | + if ( ! is_admin()) { |
|
234 | 234 | return; |
235 | 235 | } |
236 | 236 | |
237 | - $give_options = Give_Cache::get( '_give_installed', true ); |
|
238 | - $give_table_check = get_option( '_give_table_check', false ); |
|
237 | + $give_options = Give_Cache::get('_give_installed', true); |
|
238 | + $give_table_check = get_option('_give_table_check', false); |
|
239 | 239 | |
240 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
240 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
241 | 241 | |
242 | - if ( ! @Give()->donor_meta->installed() ) { |
|
242 | + if ( ! @Give()->donor_meta->installed()) { |
|
243 | 243 | |
244 | 244 | // Create the donor meta database. |
245 | 245 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | } |
249 | 249 | |
250 | - if ( ! @Give()->donors->installed() ) { |
|
250 | + if ( ! @Give()->donors->installed()) { |
|
251 | 251 | // Create the donor database. |
252 | 252 | // (this ensures it creates it on multisite instances where it is network activated). |
253 | 253 | @Give()->donors->create_table(); |
@@ -259,22 +259,22 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @param array $give_options Give plugin options. |
261 | 261 | */ |
262 | - do_action( 'give_after_install', $give_options ); |
|
262 | + do_action('give_after_install', $give_options); |
|
263 | 263 | } |
264 | 264 | |
265 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
265 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
266 | 266 | |
267 | 267 | } |
268 | 268 | |
269 | 269 | // Delete the transient |
270 | - if ( false !== $give_options ) { |
|
271 | - Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) ); |
|
270 | + if (false !== $give_options) { |
|
271 | + Give_Cache::delete(Give_Cache::get_key('_give_installed')); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
275 | 275 | } |
276 | 276 | |
277 | -add_action( 'admin_init', 'give_after_install' ); |
|
277 | +add_action('admin_init', 'give_after_install'); |
|
278 | 278 | |
279 | 279 | |
280 | 280 | /** |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | |
290 | 290 | global $wp_roles; |
291 | 291 | |
292 | - if ( ! is_object( $wp_roles ) ) { |
|
292 | + if ( ! is_object($wp_roles)) { |
|
293 | 293 | return; |
294 | 294 | } |
295 | 295 | |
296 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
296 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
297 | 297 | |
298 | 298 | // Create Give plugin roles |
299 | 299 | $roles = new Give_Roles(); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | } |
306 | 306 | |
307 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
307 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
308 | 308 | |
309 | 309 | /** |
310 | 310 | * Default core setting values. |
@@ -343,14 +343,14 @@ discard block |
||
343 | 343 | 'uninstall_on_delete' => 'disabled', |
344 | 344 | 'the_content_filter' => 'enabled', |
345 | 345 | 'scripts_footer' => 'disabled', |
346 | - 'agree_to_terms_label' => __( 'Agree to Terms?', 'give' ), |
|
346 | + 'agree_to_terms_label' => __('Agree to Terms?', 'give'), |
|
347 | 347 | 'agreement_text' => give_get_default_agreement_text(), |
348 | 348 | |
349 | 349 | // Paypal IPN verification. |
350 | 350 | 'paypal_verification' => 'enabled', |
351 | 351 | |
352 | 352 | // Default is manual gateway. |
353 | - 'gateways' => array( 'manual' => 1, 'offline' => 1 ), |
|
353 | + 'gateways' => array('manual' => 1, 'offline' => 1), |
|
354 | 354 | 'default_gateway' => 'manual', |
355 | 355 | |
356 | 356 | // Offline gateway setup. |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | */ |
379 | 379 | function give_get_default_agreement_text() { |
380 | 380 | |
381 | - $org_name = get_bloginfo( 'name' ); |
|
381 | + $org_name = get_bloginfo('name'); |
|
382 | 382 | |
383 | 383 | $agreement = sprintf( |
384 | 384 | '<p>Acceptance of any contribution, gift or grant is at the discretion of the %1$s. The %1$s will not accept any gift unless it can be used or expended consistently with the purpose and mission of the %1$s.</p> |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $org_name |
393 | 393 | ); |
394 | 394 | |
395 | - return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name ); |
|
395 | + return apply_filters('give_get_default_agreement_text', $agreement, $org_name); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -406,19 +406,19 @@ discard block |
||
406 | 406 | function give_create_pages() { |
407 | 407 | |
408 | 408 | // Bailout if pages already created. |
409 | - if ( get_option( 'give_install_pages_created' ) ) { |
|
409 | + if (get_option('give_install_pages_created')) { |
|
410 | 410 | return false; |
411 | 411 | } |
412 | 412 | |
413 | 413 | $options = array(); |
414 | 414 | |
415 | 415 | // Checks if the Success Page option exists AND that the page exists. |
416 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
416 | + if ( ! get_post(give_get_option('success_page'))) { |
|
417 | 417 | |
418 | 418 | // Donation Confirmation (Success) Page |
419 | 419 | $success = wp_insert_post( |
420 | 420 | array( |
421 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
421 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
422 | 422 | 'post_content' => '[give_receipt]', |
423 | 423 | 'post_status' => 'publish', |
424 | 424 | 'post_author' => 1, |
@@ -432,13 +432,13 @@ discard block |
||
432 | 432 | } |
433 | 433 | |
434 | 434 | // Checks if the Failure Page option exists AND that the page exists. |
435 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
435 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
436 | 436 | |
437 | 437 | // Failed Donation Page |
438 | 438 | $failed = wp_insert_post( |
439 | 439 | array( |
440 | - 'post_title' => esc_html__( 'Donation Failed', 'give' ), |
|
441 | - 'post_content' => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ), |
|
440 | + 'post_title' => esc_html__('Donation Failed', 'give'), |
|
441 | + 'post_content' => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'), |
|
442 | 442 | 'post_status' => 'publish', |
443 | 443 | 'post_author' => 1, |
444 | 444 | 'post_type' => 'page', |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | } |
451 | 451 | |
452 | 452 | // Checks if the History Page option exists AND that the page exists. |
453 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
453 | + if ( ! get_post(give_get_option('history_page'))) { |
|
454 | 454 | // Donation History Page |
455 | 455 | $history = wp_insert_post( |
456 | 456 | array( |
457 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
457 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
458 | 458 | 'post_content' => '[donation_history]', |
459 | 459 | 'post_status' => 'publish', |
460 | 460 | 'post_author' => 1, |
@@ -466,11 +466,11 @@ discard block |
||
466 | 466 | $options['history_page'] = $history; |
467 | 467 | } |
468 | 468 | |
469 | - if ( ! empty( $options ) ) { |
|
470 | - update_option( 'give_settings', array_merge( give_get_settings(), $options ) ); |
|
469 | + if ( ! empty($options)) { |
|
470 | + update_option('give_settings', array_merge(give_get_settings(), $options)); |
|
471 | 471 | } |
472 | 472 | |
473 | - add_option( 'give_install_pages_created', 1, '', 'no' ); |
|
473 | + add_option('give_install_pages_created', 1, '', 'no'); |
|
474 | 474 | } |
475 | 475 | |
476 | -add_action( 'admin_init', 'give_create_pages', - 1 ); |
|
476 | +add_action('admin_init', 'give_create_pages', - 1); |
@@ -207,7 +207,7 @@ |
||
207 | 207 | * metadata entries with the specified value. |
208 | 208 | * Otherwise, update all entries. |
209 | 209 | * |
210 | - * @return mixed |
|
210 | + * @return null|boolean |
|
211 | 211 | */ |
212 | 212 | function _give_20_bc_saving_old_payment_meta( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
213 | 213 | // Bailout. |
@@ -9,74 +9,74 @@ discard block |
||
9 | 9 | * |
10 | 10 | * @return void |
11 | 11 | */ |
12 | -function _give_20_bc_split_and_save_give_payment_meta( $object_id, $meta_value ) { |
|
12 | +function _give_20_bc_split_and_save_give_payment_meta($object_id, $meta_value) { |
|
13 | 13 | // Bailout |
14 | - if ( empty( $meta_value ) ) { |
|
14 | + if (empty($meta_value)) { |
|
15 | 15 | return; |
16 | - } elseif ( ! is_array( $meta_value ) ) { |
|
16 | + } elseif ( ! is_array($meta_value)) { |
|
17 | 17 | $meta_value = array(); |
18 | 18 | } |
19 | 19 | |
20 | - remove_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10 ); |
|
20 | + remove_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10); |
|
21 | 21 | |
22 | 22 | // Date payment meta. |
23 | - if ( ! empty( $meta_value['date'] ) ) { |
|
24 | - give_update_meta( $object_id, '_give_payment_date', $meta_value['date'] ); |
|
23 | + if ( ! empty($meta_value['date'])) { |
|
24 | + give_update_meta($object_id, '_give_payment_date', $meta_value['date']); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Currency payment meta. |
28 | - if ( ! empty( $meta_value['currency'] ) ) { |
|
29 | - give_update_meta( $object_id, '_give_payment_currency', $meta_value['currency'] ); |
|
28 | + if ( ! empty($meta_value['currency'])) { |
|
29 | + give_update_meta($object_id, '_give_payment_currency', $meta_value['currency']); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | // User information. |
33 | - if ( ! empty( $meta_value['user_info'] ) ) { |
|
33 | + if ( ! empty($meta_value['user_info'])) { |
|
34 | 34 | // Donor first name. |
35 | - if ( ! empty( $meta_value['user_info']['first_name'] ) ) { |
|
36 | - give_update_meta( $object_id, '_give_donor_billing_first_name', $meta_value['user_info']['first_name'] ); |
|
35 | + if ( ! empty($meta_value['user_info']['first_name'])) { |
|
36 | + give_update_meta($object_id, '_give_donor_billing_first_name', $meta_value['user_info']['first_name']); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Donor last name. |
40 | - if ( ! empty( $meta_value['user_info']['last_name'] ) ) { |
|
41 | - give_update_meta( $object_id, '_give_donor_billing_last_name', $meta_value['user_info']['last_name'] ); |
|
40 | + if ( ! empty($meta_value['user_info']['last_name'])) { |
|
41 | + give_update_meta($object_id, '_give_donor_billing_last_name', $meta_value['user_info']['last_name']); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // Donor address payment meta. |
45 | - if ( ! empty( $meta_value['user_info']['address'] ) ) { |
|
45 | + if ( ! empty($meta_value['user_info']['address'])) { |
|
46 | 46 | |
47 | 47 | // Address1. |
48 | - if ( ! empty( $meta_value['user_info']['address']['line1'] ) ) { |
|
49 | - give_update_meta( $object_id, '_give_donor_billing_address1', $meta_value['user_info']['address']['line1'] ); |
|
48 | + if ( ! empty($meta_value['user_info']['address']['line1'])) { |
|
49 | + give_update_meta($object_id, '_give_donor_billing_address1', $meta_value['user_info']['address']['line1']); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Address2. |
53 | - if ( ! empty( $meta_value['user_info']['address']['line2'] ) ) { |
|
54 | - give_update_meta( $object_id, '_give_donor_billing_address2', $meta_value['user_info']['address']['line2'] ); |
|
53 | + if ( ! empty($meta_value['user_info']['address']['line2'])) { |
|
54 | + give_update_meta($object_id, '_give_donor_billing_address2', $meta_value['user_info']['address']['line2']); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // City. |
58 | - if ( ! empty( $meta_value['user_info']['address']['city'] ) ) { |
|
59 | - give_update_meta( $object_id, '_give_donor_billing_city', $meta_value['user_info']['address']['city'] ); |
|
58 | + if ( ! empty($meta_value['user_info']['address']['city'])) { |
|
59 | + give_update_meta($object_id, '_give_donor_billing_city', $meta_value['user_info']['address']['city']); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Zip. |
63 | - if ( ! empty( $meta_value['user_info']['address']['zip'] ) ) { |
|
64 | - give_update_meta( $object_id, '_give_donor_billing_zip', $meta_value['user_info']['address']['zip'] ); |
|
63 | + if ( ! empty($meta_value['user_info']['address']['zip'])) { |
|
64 | + give_update_meta($object_id, '_give_donor_billing_zip', $meta_value['user_info']['address']['zip']); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // State. |
68 | - if ( ! empty( $meta_value['user_info']['address']['state'] ) ) { |
|
69 | - give_update_meta( $object_id, '_give_donor_billing_state', $meta_value['user_info']['address']['state'] ); |
|
68 | + if ( ! empty($meta_value['user_info']['address']['state'])) { |
|
69 | + give_update_meta($object_id, '_give_donor_billing_state', $meta_value['user_info']['address']['state']); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Country. |
73 | - if ( ! empty( $meta_value['user_info']['address']['country'] ) ) { |
|
74 | - give_update_meta( $object_id, '_give_donor_billing_country', $meta_value['user_info']['address']['country'] ); |
|
73 | + if ( ! empty($meta_value['user_info']['address']['country'])) { |
|
74 | + give_update_meta($object_id, '_give_donor_billing_country', $meta_value['user_info']['address']['country']); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | }// End if(). |
78 | 78 | |
79 | - add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 ); |
|
79 | + add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -89,103 +89,99 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return array |
91 | 91 | */ |
92 | -function _give_20_bc_give_payment_meta_value( $object_id, $meta_value ) { |
|
92 | +function _give_20_bc_give_payment_meta_value($object_id, $meta_value) { |
|
93 | 93 | $cache_key = "_give_payment_meta_{$object_id}"; |
94 | - $cache = Give_Cache::get_db_query( $cache_key ); |
|
94 | + $cache = Give_Cache::get_db_query($cache_key); |
|
95 | 95 | |
96 | - if ( ! is_null( $cache ) ) { |
|
96 | + if ( ! is_null($cache)) { |
|
97 | 97 | return $cache; |
98 | 98 | } |
99 | 99 | |
100 | 100 | // Set default value to array. |
101 | - if ( ! is_array( $meta_value ) ) { |
|
101 | + if ( ! is_array($meta_value)) { |
|
102 | 102 | $meta_value = array(); |
103 | 103 | } |
104 | 104 | |
105 | 105 | // Donation key. |
106 | - $meta_value['key'] = give_get_meta( $object_id, '_give_payment_purchase_key', true ); |
|
106 | + $meta_value['key'] = give_get_meta($object_id, '_give_payment_purchase_key', true); |
|
107 | 107 | |
108 | 108 | // Donation form. |
109 | - $meta_value['form_title'] = give_get_meta( $object_id, '_give_payment_form_title', true ); |
|
109 | + $meta_value['form_title'] = give_get_meta($object_id, '_give_payment_form_title', true); |
|
110 | 110 | |
111 | 111 | // Donor email. |
112 | - $meta_value['email'] = give_get_meta( $object_id, '_give_payment_donor_email', true ); |
|
113 | - $meta_value['email'] = ! empty( $meta_value['email'] ) ? |
|
114 | - $meta_value['email'] : |
|
115 | - Give()->donors->get_column( 'email', give_get_payment_donor_id( $object_id ) ); |
|
112 | + $meta_value['email'] = give_get_meta($object_id, '_give_payment_donor_email', true); |
|
113 | + $meta_value['email'] = ! empty($meta_value['email']) ? |
|
114 | + $meta_value['email'] : Give()->donors->get_column('email', give_get_payment_donor_id($object_id)); |
|
116 | 115 | |
117 | 116 | // Form id. |
118 | - $meta_value['form_id'] = give_get_meta( $object_id, '_give_payment_form_id', true ); |
|
117 | + $meta_value['form_id'] = give_get_meta($object_id, '_give_payment_form_id', true); |
|
119 | 118 | |
120 | 119 | // Price id. |
121 | - $meta_value['price_id'] = give_get_meta( $object_id, '_give_payment_price_id', true ); |
|
120 | + $meta_value['price_id'] = give_get_meta($object_id, '_give_payment_price_id', true); |
|
122 | 121 | |
123 | 122 | // Date. |
124 | - $meta_value['date'] = give_get_meta( $object_id, '_give_payment_date', true ); |
|
125 | - $meta_value['date'] = ! empty( $meta_value['date'] ) ? |
|
126 | - $meta_value['date'] : |
|
127 | - get_post_field( 'post_date', $object_id ); |
|
123 | + $meta_value['date'] = give_get_meta($object_id, '_give_payment_date', true); |
|
124 | + $meta_value['date'] = ! empty($meta_value['date']) ? |
|
125 | + $meta_value['date'] : get_post_field('post_date', $object_id); |
|
128 | 126 | |
129 | 127 | // Currency. |
130 | - $meta_value['currency'] = give_get_meta( $object_id, '_give_payment_currency', true ); |
|
128 | + $meta_value['currency'] = give_get_meta($object_id, '_give_payment_currency', true); |
|
131 | 129 | |
132 | 130 | // Decode donor data. |
133 | - $donor_names = give_get_donor_name_by( give_get_meta( $object_id, '_give_payment_donor_id', true ), 'donor' ); |
|
134 | - $donor_names = explode( ' ', $donor_names, 2 ); |
|
131 | + $donor_names = give_get_donor_name_by(give_get_meta($object_id, '_give_payment_donor_id', true), 'donor'); |
|
132 | + $donor_names = explode(' ', $donor_names, 2); |
|
135 | 133 | |
136 | 134 | // Donor first name. |
137 | - $donor_data['first_name'] = give_get_meta( $object_id, '_give_donor_billing_first_name', true ); |
|
138 | - $donor_data['first_name'] = ! empty( $donor_data['first_name'] ) ? |
|
139 | - $donor_data['first_name'] : |
|
140 | - $donor_names[0]; |
|
135 | + $donor_data['first_name'] = give_get_meta($object_id, '_give_donor_billing_first_name', true); |
|
136 | + $donor_data['first_name'] = ! empty($donor_data['first_name']) ? |
|
137 | + $donor_data['first_name'] : $donor_names[0]; |
|
141 | 138 | |
142 | 139 | // Donor last name. |
143 | - $donor_data['last_name'] = give_get_meta( $object_id, '_give_donor_billing_last_name', true ); |
|
144 | - $donor_data['last_name'] = ! empty( $donor_data['last_name'] ) ? |
|
145 | - $donor_data['last_name'] : |
|
146 | - ( isset( $donor_names[1] ) ? $donor_names[1] : '' ); |
|
140 | + $donor_data['last_name'] = give_get_meta($object_id, '_give_donor_billing_last_name', true); |
|
141 | + $donor_data['last_name'] = ! empty($donor_data['last_name']) ? |
|
142 | + $donor_data['last_name'] : (isset($donor_names[1]) ? $donor_names[1] : ''); |
|
147 | 143 | |
148 | 144 | // Donor email. |
149 | 145 | $donor_data['email'] = $meta_value['email']; |
150 | 146 | |
151 | 147 | // User ID. |
152 | - $donor_data['id'] = give_get_payment_user_id( $object_id ); |
|
148 | + $donor_data['id'] = give_get_payment_user_id($object_id); |
|
153 | 149 | |
154 | 150 | $donor_data['address'] = false; |
155 | 151 | |
156 | 152 | // Address1. |
157 | - if ( $address1 = give_get_meta( $object_id, '_give_donor_billing_address1', true ) ) { |
|
153 | + if ($address1 = give_get_meta($object_id, '_give_donor_billing_address1', true)) { |
|
158 | 154 | $donor_data['address']['line1'] = $address1; |
159 | 155 | } |
160 | 156 | |
161 | 157 | // Address2. |
162 | - if ( $address2 = give_get_meta( $object_id, '_give_donor_billing_address2', true ) ) { |
|
158 | + if ($address2 = give_get_meta($object_id, '_give_donor_billing_address2', true)) { |
|
163 | 159 | $donor_data['address']['line2'] = $address2; |
164 | 160 | } |
165 | 161 | |
166 | 162 | // City. |
167 | - if ( $city = give_get_meta( $object_id, '_give_donor_billing_city', true ) ) { |
|
163 | + if ($city = give_get_meta($object_id, '_give_donor_billing_city', true)) { |
|
168 | 164 | $donor_data['address']['city'] = $city; |
169 | 165 | } |
170 | 166 | |
171 | 167 | // Zip. |
172 | - if ( $zip = give_get_meta( $object_id, '_give_donor_billing_zip', true ) ) { |
|
168 | + if ($zip = give_get_meta($object_id, '_give_donor_billing_zip', true)) { |
|
173 | 169 | $donor_data['address']['zip'] = $zip; |
174 | 170 | } |
175 | 171 | |
176 | 172 | // State. |
177 | - if ( $state = give_get_meta( $object_id, '_give_donor_billing_state', true ) ) { |
|
173 | + if ($state = give_get_meta($object_id, '_give_donor_billing_state', true)) { |
|
178 | 174 | $donor_data['address']['state'] = $state; |
179 | 175 | } |
180 | 176 | |
181 | 177 | // Country. |
182 | - if ( $country = give_get_meta( $object_id, '_give_donor_billing_country', true ) ) { |
|
178 | + if ($country = give_get_meta($object_id, '_give_donor_billing_country', true)) { |
|
183 | 179 | $donor_data['address']['country'] = $country; |
184 | 180 | } |
185 | 181 | |
186 | - $meta_value['user_info'] = maybe_unserialize( $donor_data ); |
|
182 | + $meta_value['user_info'] = maybe_unserialize($donor_data); |
|
187 | 183 | |
188 | - Give_Cache::set_db_query( $cache_key, $meta_value ); |
|
184 | + Give_Cache::set_db_query($cache_key, $meta_value); |
|
189 | 185 | |
190 | 186 | return $meta_value; |
191 | 187 | } |
@@ -209,37 +205,37 @@ discard block |
||
209 | 205 | * |
210 | 206 | * @return mixed |
211 | 207 | */ |
212 | -function _give_20_bc_saving_old_payment_meta( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
|
208 | +function _give_20_bc_saving_old_payment_meta($check, $object_id, $meta_key, $meta_value, $prev_value) { |
|
213 | 209 | // Bailout. |
214 | 210 | if ( |
215 | - 'give_payment' !== get_post_type( $object_id ) || |
|
216 | - ! in_array( $meta_key, array( |
|
211 | + 'give_payment' !== get_post_type($object_id) || |
|
212 | + ! in_array($meta_key, array( |
|
217 | 213 | '_give_payment_meta', |
218 | 214 | '_give_payment_user_email', |
219 | 215 | '_give_payment_customer_id', |
220 | 216 | 'give_payment_user_ip', |
221 | - ) ) |
|
217 | + )) |
|
222 | 218 | ) { |
223 | 219 | return $check; |
224 | 220 | } |
225 | 221 | |
226 | - if ( '_give_payment_meta' === $meta_key ) { |
|
227 | - _give_20_bc_split_and_save_give_payment_meta( $object_id, $meta_value ); |
|
228 | - } elseif ( '_give_payment_user_email' === $meta_key ) { |
|
229 | - give_update_meta( $object_id, '_give_payment_donor_email', $meta_value ); |
|
222 | + if ('_give_payment_meta' === $meta_key) { |
|
223 | + _give_20_bc_split_and_save_give_payment_meta($object_id, $meta_value); |
|
224 | + } elseif ('_give_payment_user_email' === $meta_key) { |
|
225 | + give_update_meta($object_id, '_give_payment_donor_email', $meta_value); |
|
230 | 226 | $check = true; |
231 | - } elseif ( '_give_payment_customer_id' === $meta_key ) { |
|
232 | - give_update_meta( $object_id, '_give_payment_donor_id', $meta_value ); |
|
227 | + } elseif ('_give_payment_customer_id' === $meta_key) { |
|
228 | + give_update_meta($object_id, '_give_payment_donor_id', $meta_value); |
|
233 | 229 | $check = true; |
234 | - } elseif ( 'give_payment_user_ip' === $meta_key ) { |
|
235 | - give_update_meta( $object_id, '_give_payment_donor_ip', $meta_value ); |
|
230 | + } elseif ('give_payment_user_ip' === $meta_key) { |
|
231 | + give_update_meta($object_id, '_give_payment_donor_ip', $meta_value); |
|
236 | 232 | $check = true; |
237 | 233 | } |
238 | 234 | |
239 | 235 | return $check; |
240 | 236 | } |
241 | 237 | |
242 | -add_filter( 'update_post_metadata', '_give_20_bc_saving_old_payment_meta', 10, 5 ); |
|
238 | +add_filter('update_post_metadata', '_give_20_bc_saving_old_payment_meta', 10, 5); |
|
243 | 239 | |
244 | 240 | |
245 | 241 | /** |
@@ -254,7 +250,7 @@ discard block |
||
254 | 250 | * |
255 | 251 | * @return mixed |
256 | 252 | */ |
257 | -function _give_20_bc_get_old_payment_meta( $check, $object_id, $meta_key, $single ) { |
|
253 | +function _give_20_bc_get_old_payment_meta($check, $object_id, $meta_key, $single) { |
|
258 | 254 | global $wpdb; |
259 | 255 | |
260 | 256 | // Deprecated meta keys. |
@@ -265,32 +261,31 @@ discard block |
||
265 | 261 | ); |
266 | 262 | |
267 | 263 | // Add _give_payment_meta to backward compatibility |
268 | - if ( ! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) { |
|
264 | + if ( ! give_has_upgrade_completed('v20_upgrades_payment_metadata')) { |
|
269 | 265 | $old_meta_keys[] = '_give_payment_meta'; |
270 | 266 | } |
271 | 267 | |
272 | 268 | // Bailout. |
273 | 269 | if ( |
274 | - 'give_payment' !== get_post_type( $object_id ) || |
|
275 | - ! in_array( $meta_key, $old_meta_keys ) |
|
270 | + 'give_payment' !== get_post_type($object_id) || |
|
271 | + ! in_array($meta_key, $old_meta_keys) |
|
276 | 272 | ) { |
277 | 273 | return $check; |
278 | 274 | } |
279 | 275 | |
280 | 276 | $cache_key = "{$meta_key}_{$object_id}"; |
281 | - $check = Give_Cache::get_db_query( $cache_key ); |
|
277 | + $check = Give_Cache::get_db_query($cache_key); |
|
282 | 278 | |
283 | - if ( is_null( $check ) ) { |
|
284 | - switch ( $meta_key ) { |
|
279 | + if (is_null($check)) { |
|
280 | + switch ($meta_key) { |
|
285 | 281 | |
286 | 282 | // Handle old meta keys. |
287 | 283 | case '_give_payment_meta': |
288 | - remove_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta' ); |
|
284 | + remove_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta'); |
|
289 | 285 | |
290 | 286 | // if ( $meta_value = give_get_meta( $object_id, '_give_payment_meta' ) ) { |
291 | - $meta_value = ! empty( $meta_value ) ? |
|
292 | - current( $meta_value ) : |
|
293 | - (array) maybe_unserialize( |
|
287 | + $meta_value = ! empty($meta_value) ? |
|
288 | + current($meta_value) : (array) maybe_unserialize( |
|
294 | 289 | $wpdb->get_var( |
295 | 290 | $wpdb->prepare( |
296 | 291 | " |
@@ -304,44 +299,44 @@ discard block |
||
304 | 299 | ) |
305 | 300 | ) |
306 | 301 | ); |
307 | - $check = _give_20_bc_give_payment_meta_value( $object_id, $meta_value ); |
|
302 | + $check = _give_20_bc_give_payment_meta_value($object_id, $meta_value); |
|
308 | 303 | // } |
309 | 304 | |
310 | - add_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5 ); |
|
305 | + add_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5); |
|
311 | 306 | |
312 | 307 | break; |
313 | 308 | |
314 | 309 | case '_give_payment_customer_id': |
315 | - if ( $donor_id = give_get_meta( $object_id, '_give_payment_donor_id', $single ) ) { |
|
310 | + if ($donor_id = give_get_meta($object_id, '_give_payment_donor_id', $single)) { |
|
316 | 311 | $check = $donor_id; |
317 | 312 | } |
318 | 313 | break; |
319 | 314 | |
320 | 315 | case '_give_payment_user_email': |
321 | - if ( $donor_email = give_get_meta( $object_id, '_give_payment_donor_email', $single ) ) { |
|
316 | + if ($donor_email = give_get_meta($object_id, '_give_payment_donor_email', $single)) { |
|
322 | 317 | $check = $donor_email; |
323 | 318 | } |
324 | 319 | break; |
325 | 320 | |
326 | 321 | case '_give_payment_user_ip': |
327 | - if ( $donor_ip = give_get_meta( $object_id, '_give_payment_donor_ip', $single ) ) { |
|
322 | + if ($donor_ip = give_get_meta($object_id, '_give_payment_donor_ip', $single)) { |
|
328 | 323 | $check = $donor_ip; |
329 | 324 | } |
330 | 325 | break; |
331 | 326 | }// End switch(). |
332 | 327 | |
333 | - Give_Cache::set_db_query( $cache_key, $check ); |
|
328 | + Give_Cache::set_db_query($cache_key, $check); |
|
334 | 329 | } |
335 | 330 | |
336 | 331 | // Put result in an array on zero index. |
337 | - if ( ! is_null( $check ) ) { |
|
338 | - $check = array( $check ); |
|
332 | + if ( ! is_null($check)) { |
|
333 | + $check = array($check); |
|
339 | 334 | } |
340 | 335 | |
341 | 336 | return $check; |
342 | 337 | } |
343 | 338 | |
344 | -add_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5 ); |
|
339 | +add_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5); |
|
345 | 340 | |
346 | 341 | |
347 | 342 | /** |
@@ -356,9 +351,9 @@ discard block |
||
356 | 351 | * |
357 | 352 | * @return mixed |
358 | 353 | */ |
359 | -function _give_20_bc_get_new_payment_meta( $check, $object_id, $meta_key, $single ) { |
|
354 | +function _give_20_bc_get_new_payment_meta($check, $object_id, $meta_key, $single) { |
|
360 | 355 | // Bailout: do not apply backward compatibility if upgrade done. |
361 | - if ( give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) { |
|
356 | + if (give_has_upgrade_completed('v20_upgrades_payment_metadata')) { |
|
362 | 357 | return $check; |
363 | 358 | } |
364 | 359 | |
@@ -380,26 +375,26 @@ discard block |
||
380 | 375 | ); |
381 | 376 | |
382 | 377 | // metadata_exists fx will cause of firing get_post_metadata filter again so remove it to prevent infinite loop. |
383 | - remove_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta' ); |
|
378 | + remove_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta'); |
|
384 | 379 | |
385 | 380 | // Bailout. |
386 | 381 | if ( |
387 | - 'give_payment' !== get_post_type( $object_id ) || |
|
388 | - ! in_array( $meta_key, $new_meta_keys ) || |
|
389 | - metadata_exists( 'post', $object_id, $meta_key ) |
|
382 | + 'give_payment' !== get_post_type($object_id) || |
|
383 | + ! in_array($meta_key, $new_meta_keys) || |
|
384 | + metadata_exists('post', $object_id, $meta_key) |
|
390 | 385 | ) { |
391 | - add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 ); |
|
386 | + add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5); |
|
392 | 387 | |
393 | 388 | return $check; |
394 | 389 | } |
395 | 390 | |
396 | - add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 ); |
|
391 | + add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5); |
|
397 | 392 | |
398 | 393 | $cache_key = "{$meta_key}_{$object_id}"; |
399 | - $check = Give_Cache::get_db_query( $cache_key ); |
|
394 | + $check = Give_Cache::get_db_query($cache_key); |
|
400 | 395 | |
401 | - if ( is_null( $check ) ) { |
|
402 | - switch ( $meta_key ) { |
|
396 | + if (is_null($check)) { |
|
397 | + switch ($meta_key) { |
|
403 | 398 | |
404 | 399 | // Handle new meta keys. |
405 | 400 | case '_give_payment_donor_id': |
@@ -442,9 +437,9 @@ discard block |
||
442 | 437 | case '_give_donor_billing_country': |
443 | 438 | case '_give_payment_date': |
444 | 439 | case '_give_payment_currency': |
445 | - $donation_meta = Give_Cache::get_db_query( "_give_payment_meta_{$object_id}" ); |
|
440 | + $donation_meta = Give_Cache::get_db_query("_give_payment_meta_{$object_id}"); |
|
446 | 441 | |
447 | - if ( is_null( $donation_meta ) ) { |
|
442 | + if (is_null($donation_meta)) { |
|
448 | 443 | $donation_meta = $wpdb->get_var( |
449 | 444 | $wpdb->prepare( |
450 | 445 | "SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id=%d AND meta_key=%s", |
@@ -452,51 +447,51 @@ discard block |
||
452 | 447 | '_give_payment_meta' |
453 | 448 | ) |
454 | 449 | ); |
455 | - $donation_meta = maybe_unserialize( $donation_meta ); |
|
456 | - $donation_meta = ! is_array( $donation_meta ) ? array() : $donation_meta; |
|
457 | - Give_Cache::set_db_query( "_give_payment_meta_{$object_id}", $donation_meta ); |
|
450 | + $donation_meta = maybe_unserialize($donation_meta); |
|
451 | + $donation_meta = ! is_array($donation_meta) ? array() : $donation_meta; |
|
452 | + Give_Cache::set_db_query("_give_payment_meta_{$object_id}", $donation_meta); |
|
458 | 453 | } |
459 | 454 | |
460 | 455 | // Get results. |
461 | - if ( empty( $donation_meta ) ) { |
|
456 | + if (empty($donation_meta)) { |
|
462 | 457 | $check = ''; |
463 | - } elseif ( in_array( $meta_key, array( '_give_payment_date', '_give_payment_currency' ) ) ) { |
|
464 | - $payment_meta_key = str_replace( '_give_payment_', '', $meta_key ); |
|
458 | + } elseif (in_array($meta_key, array('_give_payment_date', '_give_payment_currency'))) { |
|
459 | + $payment_meta_key = str_replace('_give_payment_', '', $meta_key); |
|
465 | 460 | |
466 | - if ( isset( $donation_meta[ $payment_meta_key ] ) ) { |
|
467 | - $check = $donation_meta[ $payment_meta_key ]; |
|
461 | + if (isset($donation_meta[$payment_meta_key])) { |
|
462 | + $check = $donation_meta[$payment_meta_key]; |
|
468 | 463 | } |
469 | 464 | } else { |
470 | - $payment_meta_key = str_replace( '_give_donor_billing_', '', $meta_key ); |
|
465 | + $payment_meta_key = str_replace('_give_donor_billing_', '', $meta_key); |
|
471 | 466 | |
472 | - switch ( $payment_meta_key ) { |
|
467 | + switch ($payment_meta_key) { |
|
473 | 468 | case 'address1': |
474 | - if ( isset( $donation_meta['user_info']['address']['line1'] ) ) { |
|
469 | + if (isset($donation_meta['user_info']['address']['line1'])) { |
|
475 | 470 | $check = $donation_meta['user_info']['address']['line1']; |
476 | 471 | } |
477 | 472 | break; |
478 | 473 | |
479 | 474 | case 'address2': |
480 | - if ( isset( $donation_meta['user_info']['address']['line2'] ) ) { |
|
475 | + if (isset($donation_meta['user_info']['address']['line2'])) { |
|
481 | 476 | $check = $donation_meta['user_info']['address']['line2']; |
482 | 477 | } |
483 | 478 | break; |
484 | 479 | |
485 | 480 | case 'first_name': |
486 | - if ( isset( $donation_meta['user_info']['first_name'] ) ) { |
|
481 | + if (isset($donation_meta['user_info']['first_name'])) { |
|
487 | 482 | $check = $donation_meta['user_info']['first_name']; |
488 | 483 | } |
489 | 484 | break; |
490 | 485 | |
491 | 486 | case 'last_name': |
492 | - if ( isset( $donation_meta['user_info']['last_name'] ) ) { |
|
487 | + if (isset($donation_meta['user_info']['last_name'])) { |
|
493 | 488 | $check = $donation_meta['user_info']['last_name']; |
494 | 489 | } |
495 | 490 | break; |
496 | 491 | |
497 | 492 | default: |
498 | - if ( isset( $donation_meta['user_info']['address'][ $payment_meta_key ] ) ) { |
|
499 | - $check = $donation_meta['user_info']['address'][ $payment_meta_key ]; |
|
493 | + if (isset($donation_meta['user_info']['address'][$payment_meta_key])) { |
|
494 | + $check = $donation_meta['user_info']['address'][$payment_meta_key]; |
|
500 | 495 | } |
501 | 496 | } |
502 | 497 | } |
@@ -505,19 +500,19 @@ discard block |
||
505 | 500 | }// End switch(). |
506 | 501 | |
507 | 502 | // Set cache. |
508 | - Give_Cache::set_db_query( $cache_key, $check ); |
|
503 | + Give_Cache::set_db_query($cache_key, $check); |
|
509 | 504 | } |
510 | 505 | |
511 | 506 | // Put result in an array on zero index. |
512 | - if ( ! $single ) { |
|
513 | - $check = array( $check ); |
|
507 | + if ( ! $single) { |
|
508 | + $check = array($check); |
|
514 | 509 | } |
515 | 510 | |
516 | 511 | |
517 | 512 | return $check; |
518 | 513 | } |
519 | 514 | |
520 | -add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 ); |
|
515 | +add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5); |
|
521 | 516 | |
522 | 517 | |
523 | 518 | /** |
@@ -529,9 +524,9 @@ discard block |
||
529 | 524 | * |
530 | 525 | * @return void |
531 | 526 | */ |
532 | -function _give_20_bc_support_deprecated_meta_key_query( $query ) { |
|
527 | +function _give_20_bc_support_deprecated_meta_key_query($query) { |
|
533 | 528 | // Bailout. |
534 | - if ( give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) { |
|
529 | + if (give_has_upgrade_completed('v20_upgrades_payment_metadata')) { |
|
535 | 530 | return; |
536 | 531 | } |
537 | 532 | |
@@ -541,21 +536,21 @@ discard block |
||
541 | 536 | // '_give_payment_user_ip' => '_give_payment_donor_ip', |
542 | 537 | ); |
543 | 538 | |
544 | - $deprecated_meta_keys = array_flip( $new_meta_keys ); |
|
539 | + $deprecated_meta_keys = array_flip($new_meta_keys); |
|
545 | 540 | |
546 | 541 | // Set meta keys. |
547 | 542 | $meta_keys = array(); |
548 | 543 | |
549 | 544 | |
550 | 545 | // Bailout. |
551 | - if ( ! empty( $query->query_vars['meta_key'] ) ) { |
|
552 | - if ( in_array( $query->query_vars['meta_key'], $new_meta_keys ) ) { |
|
546 | + if ( ! empty($query->query_vars['meta_key'])) { |
|
547 | + if (in_array($query->query_vars['meta_key'], $new_meta_keys)) { |
|
553 | 548 | $meta_keys = $deprecated_meta_keys; |
554 | - } elseif ( in_array( $query->query_vars['meta_key'], $deprecated_meta_keys ) ) { |
|
549 | + } elseif (in_array($query->query_vars['meta_key'], $deprecated_meta_keys)) { |
|
555 | 550 | $meta_keys = $new_meta_keys; |
556 | 551 | } |
557 | 552 | |
558 | - if ( ! empty( $meta_keys ) ) { |
|
553 | + if ( ! empty($meta_keys)) { |
|
559 | 554 | // Set meta_query |
560 | 555 | $query->set( |
561 | 556 | 'meta_query', |
@@ -566,35 +561,35 @@ discard block |
||
566 | 561 | 'value' => $query->query_vars['meta_value'], |
567 | 562 | ), |
568 | 563 | array( |
569 | - 'key' => $meta_keys[ $query->query_vars['meta_key'] ], |
|
564 | + 'key' => $meta_keys[$query->query_vars['meta_key']], |
|
570 | 565 | 'value' => $query->query_vars['meta_value'], |
571 | 566 | ), |
572 | 567 | ) |
573 | 568 | ); |
574 | 569 | |
575 | 570 | // Unset single meta query. |
576 | - unset( $query->query_vars['meta_key'] ); |
|
577 | - unset( $query->query_vars['meta_value'] ); |
|
571 | + unset($query->query_vars['meta_key']); |
|
572 | + unset($query->query_vars['meta_value']); |
|
578 | 573 | } |
579 | 574 | } elseif ( |
580 | - ! empty( $query->query_vars['meta_query'] ) && |
|
581 | - ( 1 === count( $query->query_vars['meta_query'] ) ) |
|
575 | + ! empty($query->query_vars['meta_query']) && |
|
576 | + (1 === count($query->query_vars['meta_query'])) |
|
582 | 577 | ) { |
583 | - $meta_query = current( $query->query_vars['meta_query'] ); |
|
578 | + $meta_query = current($query->query_vars['meta_query']); |
|
584 | 579 | |
585 | - if ( empty( $meta_query[0]['key'] ) ) { |
|
580 | + if (empty($meta_query[0]['key'])) { |
|
586 | 581 | return; |
587 | 582 | } |
588 | 583 | |
589 | - if ( in_array( $meta_query[0]['key'], $new_meta_keys ) ) { |
|
584 | + if (in_array($meta_query[0]['key'], $new_meta_keys)) { |
|
590 | 585 | $meta_keys = $deprecated_meta_keys; |
591 | - } elseif ( in_array( $meta_query[0]['key'], $deprecated_meta_keys ) ) { |
|
586 | + } elseif (in_array($meta_query[0]['key'], $deprecated_meta_keys)) { |
|
592 | 587 | $meta_keys = $new_meta_keys; |
593 | 588 | } else { |
594 | 589 | return; |
595 | 590 | } |
596 | 591 | |
597 | - if ( ! empty( $meta_keys ) ) { |
|
592 | + if ( ! empty($meta_keys)) { |
|
598 | 593 | // Set meta_query |
599 | 594 | $query->set( |
600 | 595 | 'meta_query', |
@@ -605,7 +600,7 @@ discard block |
||
605 | 600 | 'value' => $query->query_vars['meta_query'][0]['value'], |
606 | 601 | ), |
607 | 602 | array( |
608 | - 'key' => $meta_keys[ $query->query_vars['meta_query'][0]['key'] ], |
|
603 | + 'key' => $meta_keys[$query->query_vars['meta_query'][0]['key']], |
|
609 | 604 | 'value' => $query->query_vars['meta_query'][0]['value'], |
610 | 605 | ), |
611 | 606 | ) |
@@ -614,7 +609,7 @@ discard block |
||
614 | 609 | } |
615 | 610 | } |
616 | 611 | |
617 | -add_action( 'pre_get_posts', '_give_20_bc_support_deprecated_meta_key_query' ); |
|
612 | +add_action('pre_get_posts', '_give_20_bc_support_deprecated_meta_key_query'); |
|
618 | 613 | |
619 | 614 | |
620 | 615 | /** |
@@ -627,49 +622,49 @@ discard block |
||
627 | 622 | * @param Give_Payment $payment |
628 | 623 | * @param string $key |
629 | 624 | */ |
630 | -function _give_20_bc_payment_save( $payment, $key ) { |
|
625 | +function _give_20_bc_payment_save($payment, $key) { |
|
631 | 626 | // Bailout. |
632 | - if ( ! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) { |
|
627 | + if ( ! give_has_upgrade_completed('v20_upgrades_payment_metadata')) { |
|
633 | 628 | return; |
634 | 629 | } |
635 | 630 | |
636 | - switch ( $key ) { |
|
631 | + switch ($key) { |
|
637 | 632 | case 'user_info': |
638 | - if ( empty( $payment->user_info ) ) { |
|
633 | + if (empty($payment->user_info)) { |
|
639 | 634 | // Bailout. |
640 | 635 | break; |
641 | - } elseif ( is_string( $payment->user_info ) ) { |
|
636 | + } elseif (is_string($payment->user_info)) { |
|
642 | 637 | // Check if value serialize. |
643 | - $payment->user_info = maybe_unserialize( $payment->user_info ); |
|
638 | + $payment->user_info = maybe_unserialize($payment->user_info); |
|
644 | 639 | } |
645 | 640 | |
646 | 641 | |
647 | 642 | // Save first name. |
648 | - if ( isset( $payment->user_info['first_name'] ) ) { |
|
649 | - $payment->update_meta( '_give_donor_billing_first_name', $payment->user_info['first_name'] ); |
|
643 | + if (isset($payment->user_info['first_name'])) { |
|
644 | + $payment->update_meta('_give_donor_billing_first_name', $payment->user_info['first_name']); |
|
650 | 645 | } |
651 | 646 | |
652 | 647 | |
653 | 648 | // Save last name. |
654 | - if ( isset( $payment->user_info['last_name'] ) ) { |
|
655 | - $payment->update_meta( '_give_donor_billing_last_name', $payment->user_info['last_name'] ); |
|
649 | + if (isset($payment->user_info['last_name'])) { |
|
650 | + $payment->update_meta('_give_donor_billing_last_name', $payment->user_info['last_name']); |
|
656 | 651 | } |
657 | 652 | |
658 | 653 | |
659 | 654 | // Save address. |
660 | - if ( ! empty( $payment->user_info['address'] ) ) { |
|
661 | - foreach ( $payment->user_info['address'] as $address_name => $address ) { |
|
662 | - switch ( $address_name ) { |
|
655 | + if ( ! empty($payment->user_info['address'])) { |
|
656 | + foreach ($payment->user_info['address'] as $address_name => $address) { |
|
657 | + switch ($address_name) { |
|
663 | 658 | case 'line1': |
664 | - $payment->update_meta( '_give_donor_billing_address1', $address ); |
|
659 | + $payment->update_meta('_give_donor_billing_address1', $address); |
|
665 | 660 | break; |
666 | 661 | |
667 | 662 | case 'line2': |
668 | - $payment->update_meta( '_give_donor_billing_address2', $address ); |
|
663 | + $payment->update_meta('_give_donor_billing_address2', $address); |
|
669 | 664 | break; |
670 | 665 | |
671 | 666 | default: |
672 | - $payment->update_meta( "_give_donor_billing_{$address_name}", $address ); |
|
667 | + $payment->update_meta("_give_donor_billing_{$address_name}", $address); |
|
673 | 668 | } |
674 | 669 | } |
675 | 670 | } |
@@ -678,7 +673,7 @@ discard block |
||
678 | 673 | } |
679 | 674 | } |
680 | 675 | |
681 | -add_action( 'give_payment_save', '_give_20_bc_payment_save', 10, 2 ); |
|
676 | +add_action('give_payment_save', '_give_20_bc_payment_save', 10, 2); |
|
682 | 677 | |
683 | 678 | |
684 | 679 | /** |
@@ -691,16 +686,16 @@ discard block |
||
691 | 686 | * |
692 | 687 | * @return mixed |
693 | 688 | */ |
694 | -function __give_20_bc_flush_cache( $check, $object_id ) { |
|
689 | +function __give_20_bc_flush_cache($check, $object_id) { |
|
695 | 690 | if ( |
696 | - ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) && |
|
697 | - 'give_payment' === get_post_type( $object_id ) |
|
691 | + ! give_has_upgrade_completed('v20_move_metadata_into_new_table') && |
|
692 | + 'give_payment' === get_post_type($object_id) |
|
698 | 693 | ) { |
699 | - Give_Cache::delete_group( $object_id, 'give-donations' ); |
|
694 | + Give_Cache::delete_group($object_id, 'give-donations'); |
|
700 | 695 | } |
701 | 696 | |
702 | 697 | return $check; |
703 | 698 | } |
704 | 699 | |
705 | -add_action( 'update_post_metadata', '__give_20_bc_flush_cache', 9999, 2 ); |
|
706 | -add_action( 'add_post_metadata', '__give_20_bc_flush_cache', 9999, 2 ); |
|
700 | +add_action('update_post_metadata', '__give_20_bc_flush_cache', 9999, 2); |
|
701 | +add_action('add_post_metadata', '__give_20_bc_flush_cache', 9999, 2); |
@@ -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 |