@@ -277,7 +277,7 @@ |
||
277 | 277 | /** |
278 | 278 | * Rename query clauses for new meta table |
279 | 279 | * |
280 | - * @param $clause |
|
280 | + * @param string $clause |
|
281 | 281 | * @param $filter |
282 | 282 | * |
283 | 283 | * @return mixed |
@@ -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 | |
@@ -75,40 +75,40 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function __construct() { |
77 | 77 | // Bailout. |
78 | - if ( empty( $this->supports ) || ! $this->is_custom_meta_table_active() ) { |
|
78 | + if (empty($this->supports) || ! $this->is_custom_meta_table_active()) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - if ( in_array( 'add_post_metadata', $this->supports ) ) { |
|
83 | - add_filter( 'add_post_metadata', array( $this, '__add_meta' ), 0, 5 ); |
|
82 | + if (in_array('add_post_metadata', $this->supports)) { |
|
83 | + add_filter('add_post_metadata', array($this, '__add_meta'), 0, 5); |
|
84 | 84 | } |
85 | 85 | |
86 | - if ( in_array( 'get_post_metadata', $this->supports ) ) { |
|
87 | - add_filter( 'get_post_metadata', array( $this, '__get_meta' ), 0, 4 ); |
|
86 | + if (in_array('get_post_metadata', $this->supports)) { |
|
87 | + add_filter('get_post_metadata', array($this, '__get_meta'), 0, 4); |
|
88 | 88 | } |
89 | 89 | |
90 | - if ( in_array( 'update_post_metadata', $this->supports ) ) { |
|
91 | - add_filter( 'update_post_metadata', array( $this, '__update_meta' ), 0, 5 ); |
|
90 | + if (in_array('update_post_metadata', $this->supports)) { |
|
91 | + add_filter('update_post_metadata', array($this, '__update_meta'), 0, 5); |
|
92 | 92 | } |
93 | 93 | |
94 | - if ( in_array( 'delete_post_metadata', $this->supports ) ) { |
|
95 | - add_filter( 'delete_post_metadata', array( $this, '__delete_meta' ), 0, 5 ); |
|
94 | + if (in_array('delete_post_metadata', $this->supports)) { |
|
95 | + add_filter('delete_post_metadata', array($this, '__delete_meta'), 0, 5); |
|
96 | 96 | } |
97 | 97 | |
98 | - if ( in_array( 'posts_where', $this->supports ) ) { |
|
99 | - add_filter( 'posts_where', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
98 | + if (in_array('posts_where', $this->supports)) { |
|
99 | + add_filter('posts_where', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
100 | 100 | } |
101 | 101 | |
102 | - if ( in_array( 'posts_join', $this->supports ) ) { |
|
103 | - add_filter( 'posts_join', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
102 | + if (in_array('posts_join', $this->supports)) { |
|
103 | + add_filter('posts_join', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
104 | 104 | } |
105 | 105 | |
106 | - if ( in_array( 'posts_groupby', $this->supports ) ) { |
|
107 | - add_filter( 'posts_groupby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
106 | + if (in_array('posts_groupby', $this->supports)) { |
|
107 | + add_filter('posts_groupby', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
108 | 108 | } |
109 | 109 | |
110 | - if ( in_array( 'posts_orderby', $this->supports ) ) { |
|
111 | - add_filter( 'posts_orderby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
110 | + if (in_array('posts_orderby', $this->supports)) { |
|
111 | + add_filter('posts_orderby', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single |
127 | 127 | * is true. |
128 | 128 | */ |
129 | - public function get_meta( $id = 0, $meta_key = '', $single = false ) { |
|
130 | - $id = $this->sanitize_id( $id ); |
|
129 | + public function get_meta($id = 0, $meta_key = '', $single = false) { |
|
130 | + $id = $this->sanitize_id($id); |
|
131 | 131 | |
132 | 132 | // Bailout. |
133 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
133 | + if ( ! $this->is_valid_post_type($id)) { |
|
134 | 134 | return $this->check; |
135 | 135 | } |
136 | 136 | |
137 | - if ( $this->raw_result ) { |
|
138 | - if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) { |
|
137 | + if ($this->raw_result) { |
|
138 | + if ( ! ($value = get_metadata($this->meta_type, $id, $meta_key, false))) { |
|
139 | 139 | $value = ''; |
140 | 140 | } |
141 | 141 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $this->raw_result = false; |
144 | 144 | |
145 | 145 | } else { |
146 | - $value = get_metadata( $this->meta_type, $id, $meta_key, $single ); |
|
146 | + $value = get_metadata($this->meta_type, $id, $meta_key, $single); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | return $value; |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return int|bool False for failure. True for success. |
167 | 167 | */ |
168 | - public function add_meta( $id = 0, $meta_key = '', $meta_value, $unique = false ) { |
|
169 | - $id = $this->sanitize_id( $id ); |
|
168 | + public function add_meta($id = 0, $meta_key = '', $meta_value, $unique = false) { |
|
169 | + $id = $this->sanitize_id($id); |
|
170 | 170 | |
171 | 171 | // Bailout. |
172 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
172 | + if ( ! $this->is_valid_post_type($id)) { |
|
173 | 173 | return $this->check; |
174 | 174 | } |
175 | 175 | |
176 | - $meta_id = add_metadata( $this->meta_type, $id, $meta_key, $meta_value, $unique ); |
|
176 | + $meta_id = add_metadata($this->meta_type, $id, $meta_key, $meta_value, $unique); |
|
177 | 177 | |
178 | - if ( $meta_id ) { |
|
179 | - $this->delete_cache( $id ); |
|
178 | + if ($meta_id) { |
|
179 | + $this->delete_cache($id); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | return $meta_id; |
@@ -202,18 +202,18 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return int|bool False on failure, true if success. |
204 | 204 | */ |
205 | - public function update_meta( $id = 0, $meta_key = '', $meta_value, $prev_value = '' ) { |
|
206 | - $id = $this->sanitize_id( $id ); |
|
205 | + public function update_meta($id = 0, $meta_key = '', $meta_value, $prev_value = '') { |
|
206 | + $id = $this->sanitize_id($id); |
|
207 | 207 | |
208 | 208 | // Bailout. |
209 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
209 | + if ( ! $this->is_valid_post_type($id)) { |
|
210 | 210 | return $this->check; |
211 | 211 | } |
212 | 212 | |
213 | - $meta_id = update_metadata( $this->meta_type, $id, $meta_key, $meta_value, $prev_value ); |
|
213 | + $meta_id = update_metadata($this->meta_type, $id, $meta_key, $meta_value, $prev_value); |
|
214 | 214 | |
215 | - if ( $meta_id ) { |
|
216 | - $this->delete_cache( $id ); |
|
215 | + if ($meta_id) { |
|
216 | + $this->delete_cache($id); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | return $meta_id; |
@@ -236,18 +236,18 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return bool False for failure. True for success. |
238 | 238 | */ |
239 | - public function delete_meta( $id = 0, $meta_key = '', $meta_value = '', $delete_all = '' ) { |
|
240 | - $id = $this->sanitize_id( $id ); |
|
239 | + public function delete_meta($id = 0, $meta_key = '', $meta_value = '', $delete_all = '') { |
|
240 | + $id = $this->sanitize_id($id); |
|
241 | 241 | |
242 | 242 | // Bailout. |
243 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
243 | + if ( ! $this->is_valid_post_type($id)) { |
|
244 | 244 | return $this->check; |
245 | 245 | } |
246 | 246 | |
247 | - $is_meta_deleted = delete_metadata( $this->meta_type, $id, $meta_key, $meta_value, $delete_all ); |
|
247 | + $is_meta_deleted = delete_metadata($this->meta_type, $id, $meta_key, $meta_value, $delete_all); |
|
248 | 248 | |
249 | - if ( $is_meta_deleted ) { |
|
250 | - $this->delete_cache( $id ); |
|
249 | + if ($is_meta_deleted) { |
|
250 | + $this->delete_cache($id); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | return $is_meta_deleted; |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @return string |
266 | 266 | */ |
267 | - public function __rename_meta_table_name_in_query( $clause, $wp_query ) { |
|
267 | + public function __rename_meta_table_name_in_query($clause, $wp_query) { |
|
268 | 268 | // Add new table to sql query. |
269 | - if ( $this->is_post_type_query( $wp_query ) && ! empty( $wp_query->meta_query->queries ) ) { |
|
270 | - $clause = $this->__rename_meta_table_name( $clause, current_filter() ); |
|
269 | + if ($this->is_post_type_query($wp_query) && ! empty($wp_query->meta_query->queries)) { |
|
270 | + $clause = $this->__rename_meta_table_name($clause, current_filter()); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | return $clause; |
@@ -282,39 +282,39 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @return mixed |
284 | 284 | */ |
285 | - public function __rename_meta_table_name( $clause, $filter ){ |
|
285 | + public function __rename_meta_table_name($clause, $filter) { |
|
286 | 286 | global $wpdb; |
287 | 287 | |
288 | - $clause = str_replace( "{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause ); |
|
289 | - $clause = str_replace( $wpdb->postmeta, $this->table_name, $clause ); |
|
288 | + $clause = str_replace("{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause); |
|
289 | + $clause = str_replace($wpdb->postmeta, $this->table_name, $clause); |
|
290 | 290 | |
291 | - switch( $filter ) { |
|
291 | + switch ($filter) { |
|
292 | 292 | case 'posts_join': |
293 | - $joins = array( 'INNER JOIN', 'LEFT JOIN' ); |
|
293 | + $joins = array('INNER JOIN', 'LEFT JOIN'); |
|
294 | 294 | |
295 | - foreach ( $joins as $join ) { |
|
296 | - if( false !== strpos( $clause, $join ) ) { |
|
297 | - $clause = explode( $join, $clause ); |
|
295 | + foreach ($joins as $join) { |
|
296 | + if (false !== strpos($clause, $join)) { |
|
297 | + $clause = explode($join, $clause); |
|
298 | 298 | |
299 | - foreach ( $clause as $key => $clause_part ) { |
|
300 | - if( empty( $clause_part ) ) { |
|
299 | + foreach ($clause as $key => $clause_part) { |
|
300 | + if (empty($clause_part)) { |
|
301 | 301 | continue; |
302 | 302 | } |
303 | 303 | |
304 | - preg_match( '/' . $wpdb->prefix . 'give_' . $this->meta_type . 'meta AS (.*) ON/', $clause_part, $alias_table_name ); |
|
304 | + preg_match('/'.$wpdb->prefix.'give_'.$this->meta_type.'meta AS (.*) ON/', $clause_part, $alias_table_name); |
|
305 | 305 | |
306 | - if( isset( $alias_table_name[1] ) ) { |
|
307 | - $clause[$key] = str_replace( "{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part ); |
|
306 | + if (isset($alias_table_name[1])) { |
|
307 | + $clause[$key] = str_replace("{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part); |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | - $clause = implode( "{$join} ", $clause ); |
|
311 | + $clause = implode("{$join} ", $clause); |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | break; |
315 | 315 | |
316 | 316 | case 'posts_where': |
317 | - $clause = str_replace( array( 'mt2.post_id', 'mt1.post_id' ), array( "mt2.{$this->meta_type}_id", "mt1.{$this->meta_type}_id" ), $clause ); |
|
317 | + $clause = str_replace(array('mt2.post_id', 'mt1.post_id'), array("mt2.{$this->meta_type}_id", "mt1.{$this->meta_type}_id"), $clause); |
|
318 | 318 | break; |
319 | 319 | } |
320 | 320 | |
@@ -332,19 +332,19 @@ discard block |
||
332 | 332 | * |
333 | 333 | * @return bool |
334 | 334 | */ |
335 | - protected function is_post_type_query( $wp_query ) { |
|
335 | + protected function is_post_type_query($wp_query) { |
|
336 | 336 | $status = false; |
337 | 337 | |
338 | 338 | // Check if it is payment query. |
339 | - if ( ! empty( $wp_query->query['post_type'] ) ) { |
|
339 | + if ( ! empty($wp_query->query['post_type'])) { |
|
340 | 340 | if ( |
341 | - is_string( $wp_query->query['post_type'] ) && |
|
341 | + is_string($wp_query->query['post_type']) && |
|
342 | 342 | $this->post_type === $wp_query->query['post_type'] |
343 | 343 | ) { |
344 | 344 | $status = true; |
345 | 345 | } elseif ( |
346 | - is_array( $wp_query->query['post_type'] ) && |
|
347 | - in_array( $this->post_type, $wp_query->query['post_type'] ) |
|
346 | + is_array($wp_query->query['post_type']) && |
|
347 | + in_array($this->post_type, $wp_query->query['post_type']) |
|
348 | 348 | ) { |
349 | 349 | $status = true; |
350 | 350 | } |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | * |
364 | 364 | * @return bool |
365 | 365 | */ |
366 | - protected function is_valid_post_type( $ID ) { |
|
367 | - return $ID && ( $this->post_type === get_post_type( $ID ) ); |
|
366 | + protected function is_valid_post_type($ID) { |
|
367 | + return $ID && ($this->post_type === get_post_type($ID)); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @return void |
392 | 392 | */ |
393 | - private function delete_cache( $id, $meta_type = '' ) { |
|
394 | - $meta_type = empty( $meta_type ) ? $this->meta_type : $meta_type; |
|
393 | + private function delete_cache($id, $meta_type = '') { |
|
394 | + $meta_type = empty($meta_type) ? $this->meta_type : $meta_type; |
|
395 | 395 | |
396 | 396 | $group = array( |
397 | 397 | // 'form' => 'give-forms', |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | // 'log' => 'give-logs', |
402 | 402 | ); |
403 | 403 | |
404 | - if ( array_key_exists( $meta_type, $group ) ) { |
|
405 | - Give_Cache::delete_group( $id, $group[ $meta_type ] ); |
|
404 | + if (array_key_exists($meta_type, $group)) { |
|
405 | + Give_Cache::delete_group($id, $group[$meta_type]); |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | * |
418 | 418 | * @return mixed |
419 | 419 | */ |
420 | - public function __call( $name, $arguments ) { |
|
421 | - switch ( $name ) { |
|
420 | + public function __call($name, $arguments) { |
|
421 | + switch ($name) { |
|
422 | 422 | case '__add_meta': |
423 | 423 | $this->check = $arguments[0]; |
424 | 424 | $id = $arguments[1]; |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | $unique = $arguments[4]; |
428 | 428 | |
429 | 429 | // Bailout. |
430 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
430 | + if ( ! $this->is_valid_post_type($id)) { |
|
431 | 431 | return $this->check; |
432 | 432 | } |
433 | 433 | |
434 | - return $this->add_meta( $id, $meta_key, $meta_value, $unique ); |
|
434 | + return $this->add_meta($id, $meta_key, $meta_value, $unique); |
|
435 | 435 | |
436 | 436 | case '__get_meta': |
437 | 437 | $this->check = $arguments[0]; |
@@ -440,13 +440,13 @@ discard block |
||
440 | 440 | $single = $arguments[3]; |
441 | 441 | |
442 | 442 | // Bailout. |
443 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
443 | + if ( ! $this->is_valid_post_type($id)) { |
|
444 | 444 | return $this->check; |
445 | 445 | } |
446 | 446 | |
447 | 447 | $this->raw_result = true; |
448 | 448 | |
449 | - return $this->get_meta( $id, $meta_key, $single ); |
|
449 | + return $this->get_meta($id, $meta_key, $single); |
|
450 | 450 | |
451 | 451 | case '__update_meta': |
452 | 452 | $this->check = $arguments[0]; |
@@ -455,11 +455,11 @@ discard block |
||
455 | 455 | $meta_value = $arguments[3]; |
456 | 456 | |
457 | 457 | // Bailout. |
458 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
458 | + if ( ! $this->is_valid_post_type($id)) { |
|
459 | 459 | return $this->check; |
460 | 460 | } |
461 | 461 | |
462 | - return $this->update_meta( $id, $meta_key, $meta_value ); |
|
462 | + return $this->update_meta($id, $meta_key, $meta_value); |
|
463 | 463 | |
464 | 464 | case '__delete_meta': |
465 | 465 | $this->check = $arguments[0]; |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | $delete_all = $arguments[3]; |
470 | 470 | |
471 | 471 | // Bailout. |
472 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
472 | + if ( ! $this->is_valid_post_type($id)) { |
|
473 | 473 | return $this->check; |
474 | 474 | } |
475 | 475 | |
476 | - return $this->delete_meta( $id, $meta_key, $meta_value, $delete_all ); |
|
476 | + return $this->delete_meta($id, $meta_key, $meta_value, $delete_all); |
|
477 | 477 | } |
478 | 478 | } |
479 | 479 | } |
480 | 480 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -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 | } |
@@ -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 number */ |
255 | - esc_html__( 'Donor %s', 'give' ), |
|
255 | + esc_html__('Donor %s', 'give'), |
|
256 | 256 | $donor_id |
257 | 257 | ); |
258 | 258 | ?> |
@@ -260,26 +260,26 @@ discard block |
||
260 | 260 | |
261 | 261 | <hr class="wp-header-end"> |
262 | 262 | |
263 | - <?php if ( $donor && $render ) : ?> |
|
263 | + <?php if ($donor && $render) : ?> |
|
264 | 264 | |
265 | 265 | <h2 class="nav-tab-wrapper"> |
266 | 266 | <?php |
267 | - foreach ( $donor_tabs as $key => $tab ) : |
|
267 | + foreach ($donor_tabs as $key => $tab) : |
|
268 | 268 | $active = $key === $view ? true : false; |
269 | 269 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
270 | 270 | printf( |
271 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
272 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
273 | - esc_attr( $class ), |
|
274 | - sanitize_html_class( $tab['dashicon'] ), |
|
275 | - esc_html( $tab['title'] ) |
|
271 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
272 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
273 | + esc_attr($class), |
|
274 | + sanitize_html_class($tab['dashicon']), |
|
275 | + esc_html($tab['title']) |
|
276 | 276 | ); |
277 | 277 | endforeach; |
278 | 278 | ?> |
279 | 279 | </h2> |
280 | 280 | |
281 | 281 | <div id="give-donor-card-wrapper"> |
282 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
282 | + <?php $callbacks[$view]($donor) ?> |
|
283 | 283 | </div> |
284 | 284 | |
285 | 285 | <?php endif; ?> |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @return void |
301 | 301 | */ |
302 | -function give_donor_view( $donor ) { |
|
302 | +function give_donor_view($donor) { |
|
303 | 303 | |
304 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
304 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * Fires in donor profile screen, above the donor card. |
@@ -310,11 +310,11 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @param object $donor The donor object being displayed. |
312 | 312 | */ |
313 | - do_action( 'give_donor_card_top', $donor ); |
|
313 | + do_action('give_donor_card_top', $donor); |
|
314 | 314 | |
315 | 315 | // Set Read only to the fields which needs to be locked. |
316 | 316 | $read_only = ''; |
317 | - if ( $donor->user_id ) { |
|
317 | + if ($donor->user_id) { |
|
318 | 318 | $read_only = 'readonly="readonly"'; |
319 | 319 | } |
320 | 320 | ?> |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
323 | 323 | |
324 | 324 | <form id="edit-donor-info" method="post" |
325 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
325 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
326 | 326 | |
327 | 327 | <div class="donor-info"> |
328 | 328 | |
329 | 329 | <div class="donor-bio-header clearfix"> |
330 | 330 | |
331 | 331 | <div class="avatar-wrap left" id="donor-avatar"> |
332 | - <?php echo get_avatar( $donor->email ); ?> |
|
332 | + <?php echo get_avatar($donor->email); ?> |
|
333 | 333 | </div> |
334 | 334 | |
335 | 335 | <div id="donor-name-wrap" class="left"> |
@@ -337,18 +337,18 @@ discard block |
||
337 | 337 | <span class="donor-name info-item edit-item"> |
338 | 338 | <input <?php echo $read_only; ?> size="15" data-key="first_name" |
339 | 339 | name="customerinfo[first_name]" type="text" |
340 | - value="<?php esc_attr_e( $donor->get_first_name() ); ?>" |
|
341 | - placeholder="<?php _e( 'First Name', 'give' ); ?>"/> |
|
342 | - <?php if ( $donor->user_id ) : ?> |
|
340 | + value="<?php esc_attr_e($donor->get_first_name()); ?>" |
|
341 | + placeholder="<?php _e('First Name', 'give'); ?>"/> |
|
342 | + <?php if ($donor->user_id) : ?> |
|
343 | 343 | <a href="#" class="give-lock-block"> |
344 | 344 | <i class="give-icon give-icon-locked"></i> |
345 | 345 | </a> |
346 | 346 | <?php endif; ?> |
347 | 347 | <input <?php echo $read_only; ?> size="15" data-key="last_name" |
348 | 348 | name="customerinfo[last_name]" type="text" |
349 | - value="<?php esc_attr_e( $donor->get_last_name() ); ?>" |
|
350 | - placeholder="<?php _e( 'Last Name', 'give' ); ?>"/> |
|
351 | - <?php if ( $donor->user_id ) : ?> |
|
349 | + value="<?php esc_attr_e($donor->get_last_name()); ?>" |
|
350 | + placeholder="<?php _e('Last Name', 'give'); ?>"/> |
|
351 | + <?php if ($donor->user_id) : ?> |
|
352 | 352 | <a href="#" class="give-lock-block"> |
353 | 353 | <i class="give-icon give-icon-locked"></i> |
354 | 354 | </a> |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | data-key="name"><?php echo $donor->name; ?></span></span> |
359 | 359 | </div> |
360 | 360 | <p class="donor-since info-item"> |
361 | - <?php _e( 'Donor since', 'give' ); ?> |
|
362 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
361 | + <?php _e('Donor since', 'give'); ?> |
|
362 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
363 | 363 | </p> |
364 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
364 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
365 | 365 | <a href="#" id="edit-donor" |
366 | - class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
366 | + class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
367 | 367 | <?php endif; ?> |
368 | 368 | </div> |
369 | 369 | <!-- /donor-bio-header --> |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | <table class="widefat"> |
374 | 374 | <tbody> |
375 | 375 | <tr class="alternate"> |
376 | - <th scope="col"><label for="tablecell"><?php _e( 'User:', 'give' ); ?></label></th> |
|
376 | + <th scope="col"><label for="tablecell"><?php _e('User:', 'give'); ?></label></th> |
|
377 | 377 | <td> |
378 | 378 | <span class="donor-user-id info-item edit-item"> |
379 | 379 | <?php |
@@ -390,22 +390,22 @@ discard block |
||
390 | 390 | 'data' => $data_atts, |
391 | 391 | ); |
392 | 392 | |
393 | - if ( ! empty( $user_id ) ) { |
|
394 | - $userdata = get_userdata( $user_id ); |
|
393 | + if ( ! empty($user_id)) { |
|
394 | + $userdata = get_userdata($user_id); |
|
395 | 395 | $user_args['selected'] = $user_id; |
396 | 396 | } |
397 | 397 | |
398 | - echo Give()->html->ajax_user_search( $user_args ); |
|
398 | + echo Give()->html->ajax_user_search($user_args); |
|
399 | 399 | ?> |
400 | 400 | </span> |
401 | 401 | |
402 | 402 | <span class="donor-user-id info-item editable"> |
403 | - <?php if ( ! empty( $userdata ) ) : ?> |
|
404 | - <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
403 | + <?php if ( ! empty($userdata)) : ?> |
|
404 | + <span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
405 | 405 | <?php else: ?> |
406 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
406 | + <span data-key="user_id"><?php _e('None', 'give'); ?></span> |
|
407 | 407 | <?php endif; ?> |
408 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ): |
|
408 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0): |
|
409 | 409 | |
410 | 410 | echo sprintf( |
411 | 411 | '- <span class="disconnect-user"> |
@@ -414,11 +414,11 @@ discard block |
||
414 | 414 | | <span class="view-user-profile"> |
415 | 415 | <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a> |
416 | 416 | </span>', |
417 | - __( 'Disconnects the current user ID from this donor record.', 'give' ), |
|
418 | - __( 'Disconnect User', 'give' ), |
|
419 | - 'user-edit.php?user_id=' . $donor->user_id, |
|
420 | - __( 'View User Profile of current user ID.', 'give' ), |
|
421 | - __( 'View User Profile', 'give' ) |
|
417 | + __('Disconnects the current user ID from this donor record.', 'give'), |
|
418 | + __('Disconnect User', 'give'), |
|
419 | + 'user-edit.php?user_id='.$donor->user_id, |
|
420 | + __('View User Profile of current user ID.', 'give'), |
|
421 | + __('View User Profile', 'give') |
|
422 | 422 | ); |
423 | 423 | |
424 | 424 | endif; ?> |
@@ -434,11 +434,11 @@ discard block |
||
434 | 434 | |
435 | 435 | <span id="donor-edit-actions" class="edit-item"> |
436 | 436 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>"/> |
437 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
437 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
438 | 438 | <input type="hidden" name="give_action" value="edit-donor"/> |
439 | 439 | <input type="submit" id="give-edit-donor-save" class="button-secondary" |
440 | - value="<?php _e( 'Update Donor', 'give' ); ?>"/> |
|
441 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
440 | + value="<?php _e('Update Donor', 'give'); ?>"/> |
|
441 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
442 | 442 | </span> |
443 | 443 | |
444 | 444 | </form> |
@@ -453,24 +453,24 @@ discard block |
||
453 | 453 | * |
454 | 454 | * @param Give_Donor $donor The donor object being displayed. |
455 | 455 | */ |
456 | - do_action( 'give_donor_before_stats', $donor ); |
|
456 | + do_action('give_donor_before_stats', $donor); |
|
457 | 457 | ?> |
458 | 458 | |
459 | 459 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
460 | 460 | <ul> |
461 | 461 | <li> |
462 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&status=publish&donor=' . absint( $donor->id ) ); ?>"> |
|
462 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&status=publish&donor='.absint($donor->id)); ?>"> |
|
463 | 463 | <span class="dashicons dashicons-heart"></span> |
464 | 464 | <?php |
465 | 465 | // Completed Donations. |
466 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
467 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
466 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
467 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
468 | 468 | ?> |
469 | 469 | </a> |
470 | 470 | </li> |
471 | 471 | <li> |
472 | 472 | <span class="dashicons dashicons-chart-area"></span> |
473 | - <?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
473 | + <?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
474 | 474 | </li> |
475 | 475 | <?php |
476 | 476 | /** |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * |
483 | 483 | * @param object $donor The donor object being displayed. |
484 | 484 | */ |
485 | - do_action( 'give_donor_stats_list', $donor ); |
|
485 | + do_action('give_donor_stats_list', $donor); |
|
486 | 486 | ?> |
487 | 487 | </ul> |
488 | 488 | </div> |
@@ -495,11 +495,11 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @param Give_Donor $donor The donor object being displayed. |
497 | 497 | */ |
498 | - do_action( 'give_donor_before_address', $donor ); |
|
498 | + do_action('give_donor_before_address', $donor); |
|
499 | 499 | ?> |
500 | 500 | |
501 | 501 | <div id="donor-address-wrapper" class="donor-section clear"> |
502 | - <h3><?php _e( 'Addresses', 'give' ); ?></h3> |
|
502 | + <h3><?php _e('Addresses', 'give'); ?></h3> |
|
503 | 503 | |
504 | 504 | <div class="postbox"> |
505 | 505 | <div class="give-spinner-wrapper"> |
@@ -509,16 +509,16 @@ discard block |
||
509 | 509 | <div class="all-address"> |
510 | 510 | <div class="give-grid-row"> |
511 | 511 | <?php |
512 | - if ( ! empty( $donor->address ) ) : |
|
512 | + if ( ! empty($donor->address)) : |
|
513 | 513 | // Default address always will be at zero array index. |
514 | 514 | $is_set_as_default = null; |
515 | 515 | |
516 | - foreach ( $donor->address as $address_type => $addresses ) { |
|
516 | + foreach ($donor->address as $address_type => $addresses) { |
|
517 | 517 | |
518 | - switch ( true ) { |
|
519 | - case is_array( end( $addresses ) ): |
|
518 | + switch (true) { |
|
519 | + case is_array(end($addresses)): |
|
520 | 520 | $index = 1; |
521 | - foreach ( $addresses as $id => $address ) { |
|
521 | + foreach ($addresses as $id => $address) { |
|
522 | 522 | echo __give_get_format_address( |
523 | 523 | $address, |
524 | 524 | array( |
@@ -528,11 +528,11 @@ discard block |
||
528 | 528 | ) |
529 | 529 | ); |
530 | 530 | |
531 | - $index ++; |
|
531 | + $index++; |
|
532 | 532 | } |
533 | 533 | break; |
534 | 534 | |
535 | - case is_string( end( $addresses ) ): |
|
535 | + case is_string(end($addresses)): |
|
536 | 536 | echo __give_get_format_address( |
537 | 537 | $addresses, |
538 | 538 | array( |
@@ -545,13 +545,13 @@ discard block |
||
545 | 545 | endif; |
546 | 546 | ?> |
547 | 547 | </div> |
548 | - <span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) { |
|
548 | + <span class="give-no-address-message<?php if ( ! empty($donor->address)) { |
|
549 | 549 | echo ' give-hidden'; |
550 | 550 | } ?>"> |
551 | - <?php _e( 'This donor does not have any addresses saved.', 'give' ); ?> |
|
551 | + <?php _e('This donor does not have any addresses saved.', 'give'); ?> |
|
552 | 552 | </span> |
553 | 553 | <button class="button add-new-address"> |
554 | - <?php _e( 'Add Address', 'give' ); ?> |
|
554 | + <?php _e('Add Address', 'give'); ?> |
|
555 | 555 | </button> |
556 | 556 | </div> |
557 | 557 | |
@@ -561,26 +561,26 @@ discard block |
||
561 | 561 | <tbody> |
562 | 562 | <tr> |
563 | 563 | <th class="col"> |
564 | - <label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
564 | + <label class="country"><?php esc_html_e('Country:', 'give'); ?></label> |
|
565 | 565 | </th> |
566 | 566 | <td> |
567 | 567 | <?php |
568 | - echo Give()->html->select( array( |
|
568 | + echo Give()->html->select(array( |
|
569 | 569 | 'options' => give_get_country_list(), |
570 | 570 | 'name' => 'country', |
571 | - 'selected' => give_get_option( 'base_country' ), |
|
571 | + 'selected' => give_get_option('base_country'), |
|
572 | 572 | 'show_option_all' => false, |
573 | 573 | 'show_option_none' => false, |
574 | 574 | 'chosen' => true, |
575 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
576 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
577 | - ) ); |
|
575 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
576 | + 'data' => array('search-type' => 'no_ajax'), |
|
577 | + )); |
|
578 | 578 | ?> |
579 | 579 | </td> |
580 | 580 | </tr> |
581 | 581 | <tr> |
582 | 582 | <th class="col"> |
583 | - <label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
583 | + <label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
584 | 584 | </th> |
585 | 585 | <td> |
586 | 586 | <input id="line1" name="line1" type="text" class="medium-text"/> |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | </tr> |
589 | 589 | <tr> |
590 | 590 | <th class="col"> |
591 | - <label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
591 | + <label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
592 | 592 | </th> |
593 | 593 | <td> |
594 | 594 | <input id="line2" type="text" name="line2" value="" class="medium-text"/> |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | </tr> |
598 | 598 | <tr> |
599 | 599 | <th class="col"> |
600 | - <label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
600 | + <label for="city"><?php esc_html_e('City:', 'give'); ?></label> |
|
601 | 601 | </th> |
602 | 602 | <td> |
603 | 603 | <input id="city" type="text" name="city" value="" class="medium-text"/> |
@@ -605,41 +605,41 @@ discard block |
||
605 | 605 | </tr> |
606 | 606 | <?php |
607 | 607 | $no_states_country = give_no_states_country_list(); |
608 | - $base_country = give_get_option( 'base_country' ); |
|
609 | - if ( ! array_key_exists( $base_country, $no_states_country ) ) { |
|
608 | + $base_country = give_get_option('base_country'); |
|
609 | + if ( ! array_key_exists($base_country, $no_states_country)) { |
|
610 | 610 | ?> |
611 | 611 | <tr class="give-field-wrap"> |
612 | 612 | <th class="col"> |
613 | - <label for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
613 | + <label for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
614 | 614 | </th> |
615 | 615 | <td> |
616 | 616 | <?php |
617 | - $states = give_get_states( $base_country ); |
|
617 | + $states = give_get_states($base_country); |
|
618 | 618 | $state_args = array( |
619 | 619 | 'name' => 'state', |
620 | 620 | 'class' => 'regular-text', |
621 | 621 | ); |
622 | 622 | |
623 | - if ( empty( $states ) ) { |
|
623 | + if (empty($states)) { |
|
624 | 624 | |
625 | 625 | // Show Text field, if empty states. |
626 | - $state_args = wp_parse_args( $state_args, array( |
|
627 | - 'value' => give_get_option( 'base_state' ), |
|
628 | - ) ); |
|
629 | - echo Give()->html->text( $state_args ); |
|
626 | + $state_args = wp_parse_args($state_args, array( |
|
627 | + 'value' => give_get_option('base_state'), |
|
628 | + )); |
|
629 | + echo Give()->html->text($state_args); |
|
630 | 630 | } else { |
631 | 631 | |
632 | 632 | // Show Chosen DropDown, if states are not empty. |
633 | - $state_args = wp_parse_args( $state_args, array( |
|
633 | + $state_args = wp_parse_args($state_args, array( |
|
634 | 634 | 'options' => $states, |
635 | - 'selected' => give_get_option( 'base_state' ), |
|
635 | + 'selected' => give_get_option('base_state'), |
|
636 | 636 | 'show_option_all' => false, |
637 | 637 | 'show_option_none' => false, |
638 | 638 | 'chosen' => true, |
639 | - 'placeholder' => __( 'Select a state', 'give' ), |
|
640 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
641 | - ) ); |
|
642 | - echo Give()->html->select( $state_args ); |
|
639 | + 'placeholder' => __('Select a state', 'give'), |
|
640 | + 'data' => array('search-type' => 'no_ajax'), |
|
641 | + )); |
|
642 | + echo Give()->html->select($state_args); |
|
643 | 643 | } |
644 | 644 | ?> |
645 | 645 | </td> |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | ?> |
650 | 650 | <tr> |
651 | 651 | <th class="col"> |
652 | - <label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
652 | + <label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
653 | 653 | </th> |
654 | 654 | <td> |
655 | 655 | <input id="zip" type="text" name="zip" value="" class="medium-text"/> |
@@ -657,12 +657,12 @@ discard block |
||
657 | 657 | </tr> |
658 | 658 | <tr> |
659 | 659 | <td colspan="2"> |
660 | - <?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?> |
|
660 | + <?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?> |
|
661 | 661 | <input type="hidden" name="address-action" value="add"> |
662 | 662 | <input type="hidden" name="address-id" value=""> |
663 | 663 | <input type="submit" class="button button-primary js-save" |
664 | - value="<?php _e( 'Save', 'give' ); ?>"> <button |
|
665 | - class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button> |
|
664 | + value="<?php _e('Save', 'give'); ?>"> <button |
|
665 | + class="button js-cancel"><?php _e('Cancel', 'give'); ?></button> |
|
666 | 666 | </td> |
667 | 667 | </tr> |
668 | 668 | </tbody> |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * |
682 | 682 | * @param Give_Donor $donor The donor object being displayed. |
683 | 683 | */ |
684 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
684 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
685 | 685 | ?> |
686 | 686 | |
687 | 687 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -694,46 +694,46 @@ discard block |
||
694 | 694 | * |
695 | 695 | * @param object $donor The donor object being displayed. |
696 | 696 | */ |
697 | - do_action( 'give_donor_before_tables', $donor ); |
|
697 | + do_action('give_donor_before_tables', $donor); |
|
698 | 698 | ?> |
699 | 699 | |
700 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
700 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
701 | 701 | |
702 | 702 | <table class="wp-list-table widefat striped emails"> |
703 | 703 | <thead> |
704 | 704 | <tr> |
705 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
706 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
705 | + <th><?php _e('Email', 'give'); ?></th> |
|
706 | + <th><?php _e('Actions', 'give'); ?></th> |
|
707 | 707 | </tr> |
708 | 708 | </thead> |
709 | 709 | |
710 | 710 | <tbody> |
711 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
711 | + <?php if ( ! empty($donor->emails)) { ?> |
|
712 | 712 | |
713 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
713 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
714 | 714 | <tr data-key="<?php echo $key; ?>"> |
715 | 715 | <td> |
716 | 716 | <?php echo $email; ?> |
717 | - <?php if ( 'primary' === $key ) : ?> |
|
717 | + <?php if ('primary' === $key) : ?> |
|
718 | 718 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
719 | 719 | <?php endif; ?> |
720 | 720 | </td> |
721 | 721 | <td> |
722 | - <?php if ( 'primary' !== $key ) : ?> |
|
722 | + <?php if ('primary' !== $key) : ?> |
|
723 | 723 | <?php |
724 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
725 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
726 | - 'email' => rawurlencode( $email ), |
|
724 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
725 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
726 | + 'email' => rawurlencode($email), |
|
727 | 727 | 'give_action' => 'set_donor_primary_email', |
728 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
729 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
730 | - 'email' => rawurlencode( $email ), |
|
728 | + ), $base_url), 'give-set-donor-primary-email'); |
|
729 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
730 | + 'email' => rawurlencode($email), |
|
731 | 731 | 'give_action' => 'remove_donor_email', |
732 | - ), $base_url ), 'give-remove-donor-email' ); |
|
732 | + ), $base_url), 'give-remove-donor-email'); |
|
733 | 733 | ?> |
734 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
734 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
735 | 735 | | |
736 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
736 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
737 | 737 | <?php endif; ?> |
738 | 738 | </td> |
739 | 739 | </tr> |
@@ -743,14 +743,14 @@ discard block |
||
743 | 743 | <td colspan="2" class="add-donor-email-td"> |
744 | 744 | <div class="add-donor-email-wrapper"> |
745 | 745 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/> |
746 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
746 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
747 | 747 | <input type="email" name="additional-email" value="" |
748 | - placeholder="<?php _e( 'Email Address', 'give' ); ?>"/> |
|
748 | + placeholder="<?php _e('Email Address', 'give'); ?>"/> |
|
749 | 749 | <input type="checkbox" name="make-additional-primary" value="1" |
750 | 750 | id="make-additional-primary"/> <label |
751 | - for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
751 | + for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
752 | 752 | <button class="button-secondary give-add-donor-email" |
753 | - id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
753 | + id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
754 | 754 | <span class="spinner"></span> |
755 | 755 | </div> |
756 | 756 | <div class="notice-wrap"></div> |
@@ -758,50 +758,50 @@ discard block |
||
758 | 758 | </tr> |
759 | 759 | <?php } else { ?> |
760 | 760 | <tr> |
761 | - <td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td> |
|
761 | + <td colspan="2"><?php _e('No Emails Found', 'give'); ?></td> |
|
762 | 762 | </tr> |
763 | 763 | <?php }// End if(). |
764 | 764 | ?> |
765 | 765 | </tbody> |
766 | 766 | </table> |
767 | 767 | |
768 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
768 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
769 | 769 | <?php |
770 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
771 | - $payments = give_get_payments( array( |
|
770 | + $payment_ids = explode(',', $donor->payment_ids); |
|
771 | + $payments = give_get_payments(array( |
|
772 | 772 | 'post__in' => $payment_ids, |
773 | - ) ); |
|
774 | - $payments = array_slice( $payments, 0, 10 ); |
|
773 | + )); |
|
774 | + $payments = array_slice($payments, 0, 10); |
|
775 | 775 | ?> |
776 | 776 | <table class="wp-list-table widefat striped payments"> |
777 | 777 | <thead> |
778 | 778 | <tr> |
779 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
780 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
781 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
782 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
783 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
779 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
780 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
781 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
782 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
783 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
784 | 784 | </tr> |
785 | 785 | </thead> |
786 | 786 | <tbody> |
787 | - <?php if ( ! empty( $payments ) ) { ?> |
|
788 | - <?php foreach ( $payments as $payment ) : ?> |
|
787 | + <?php if ( ! empty($payments)) { ?> |
|
788 | + <?php foreach ($payments as $payment) : ?> |
|
789 | 789 | <tr> |
790 | 790 | <td><?php echo $payment->ID; ?></td> |
791 | - <td><?php echo give_donation_amount( $payment->ID, array( 'currency' => true, 'amount' => true, 'type' => 'donor' ) ); ?></td> |
|
792 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
793 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
791 | + <td><?php echo give_donation_amount($payment->ID, array('currency' => true, 'amount' => true, 'type' => 'donor')); ?></td> |
|
792 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
793 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
794 | 794 | <td> |
795 | 795 | <?php |
796 | 796 | printf( |
797 | 797 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
798 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
798 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
799 | 799 | sprintf( |
800 | 800 | /* translators: %s: Donation ID */ |
801 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
801 | + esc_attr__('View Donation %s.', 'give'), |
|
802 | 802 | $payment->ID |
803 | 803 | ), |
804 | - __( 'View Donation', 'give' ) |
|
804 | + __('View Donation', 'give') |
|
805 | 805 | ); |
806 | 806 | ?> |
807 | 807 | |
@@ -816,47 +816,47 @@ discard block |
||
816 | 816 | * @param object $donor The donor object being displayed. |
817 | 817 | * @param object $payment The payment object being displayed. |
818 | 818 | */ |
819 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
819 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
820 | 820 | ?> |
821 | 821 | </td> |
822 | 822 | </tr> |
823 | 823 | <?php endforeach; ?> |
824 | 824 | <?php } else { ?> |
825 | 825 | <tr> |
826 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
826 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
827 | 827 | </tr> |
828 | 828 | <?php }// End if(). |
829 | 829 | ?> |
830 | 830 | </tbody> |
831 | 831 | </table> |
832 | 832 | |
833 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
833 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
834 | 834 | <?php |
835 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
835 | + $donations = give_get_users_completed_donations($donor->email); |
|
836 | 836 | ?> |
837 | 837 | <table class="wp-list-table widefat striped donations"> |
838 | 838 | <thead> |
839 | 839 | <tr> |
840 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
841 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
840 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
841 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
842 | 842 | </tr> |
843 | 843 | </thead> |
844 | 844 | <tbody> |
845 | - <?php if ( ! empty( $donations ) ) { ?> |
|
846 | - <?php foreach ( $donations as $donation ) : ?> |
|
845 | + <?php if ( ! empty($donations)) { ?> |
|
846 | + <?php foreach ($donations as $donation) : ?> |
|
847 | 847 | <tr> |
848 | 848 | <td><?php echo $donation->post_title; ?></td> |
849 | 849 | <td> |
850 | 850 | <?php |
851 | 851 | printf( |
852 | 852 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
853 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
853 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
854 | 854 | sprintf( |
855 | 855 | /* translators: %s: form name */ |
856 | - esc_attr__( 'View Form %s.', 'give' ), |
|
856 | + esc_attr__('View Form %s.', 'give'), |
|
857 | 857 | $donation->post_title |
858 | 858 | ), |
859 | - __( 'View Form', 'give' ) |
|
859 | + __('View Form', 'give') |
|
860 | 860 | ); |
861 | 861 | ?> |
862 | 862 | </td> |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | <?php endforeach; ?> |
865 | 865 | <?php } else { ?> |
866 | 866 | <tr> |
867 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
867 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
868 | 868 | </tr> |
869 | 869 | <?php } ?> |
870 | 870 | </tbody> |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | * |
879 | 879 | * @param object $donor The donor object being displayed. |
880 | 880 | */ |
881 | - do_action( 'give_donor_after_tables', $donor ); |
|
881 | + do_action('give_donor_after_tables', $donor); |
|
882 | 882 | ?> |
883 | 883 | |
884 | 884 | </div> |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | * |
892 | 892 | * @param object $donor The donor object being displayed. |
893 | 893 | */ |
894 | - do_action( 'give_donor_card_bottom', $donor ); |
|
894 | + do_action('give_donor_card_bottom', $donor); |
|
895 | 895 | |
896 | 896 | } |
897 | 897 | |
@@ -904,31 +904,31 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @return void |
906 | 906 | */ |
907 | -function give_donor_notes_view( $donor ) { |
|
907 | +function give_donor_notes_view($donor) { |
|
908 | 908 | |
909 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
910 | - $paged = absint( $paged ); |
|
909 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
910 | + $paged = absint($paged); |
|
911 | 911 | $note_count = $donor->get_notes_count(); |
912 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
913 | - $total_pages = ceil( $note_count / $per_page ); |
|
914 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
912 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
913 | + $total_pages = ceil($note_count / $per_page); |
|
914 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
915 | 915 | ?> |
916 | 916 | |
917 | 917 | <div id="donor-notes-wrapper"> |
918 | 918 | <div class="donor-notes-header"> |
919 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
919 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
920 | 920 | </div> |
921 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
921 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
922 | 922 | |
923 | - <?php if ( 1 == $paged ) : ?> |
|
923 | + <?php if (1 == $paged) : ?> |
|
924 | 924 | <div style="display: block; margin-bottom: 55px;"> |
925 | 925 | <form id="give-add-donor-note" method="post" |
926 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
926 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
927 | 927 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
928 | 928 | <br/> |
929 | 929 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/> |
930 | 930 | <input type="hidden" name="give_action" value="add-donor-note"/> |
931 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
931 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
932 | 932 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/> |
933 | 933 | </form> |
934 | 934 | </div> |
@@ -943,26 +943,26 @@ discard block |
||
943 | 943 | 'show_all' => true, |
944 | 944 | ); |
945 | 945 | |
946 | - echo paginate_links( $pagination_args ); |
|
946 | + echo paginate_links($pagination_args); |
|
947 | 947 | ?> |
948 | 948 | |
949 | 949 | <div id="give-donor-notes" class="postbox"> |
950 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
951 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
950 | + <?php if (count($donor_notes) > 0) { ?> |
|
951 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
952 | 952 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
953 | 953 | <span class="note-content-wrap"> |
954 | - <?php echo stripslashes( $note ); ?> |
|
954 | + <?php echo stripslashes($note); ?> |
|
955 | 955 | </span> |
956 | 956 | </div> |
957 | 957 | <?php endforeach; ?> |
958 | 958 | <?php } else { ?> |
959 | 959 | <div class="give-no-donor-notes"> |
960 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
960 | + <?php _e('No donor notes found.', 'give'); ?> |
|
961 | 961 | </div> |
962 | 962 | <?php } ?> |
963 | 963 | </div> |
964 | 964 | |
965 | - <?php echo paginate_links( $pagination_args ); ?> |
|
965 | + <?php echo paginate_links($pagination_args); ?> |
|
966 | 966 | |
967 | 967 | </div> |
968 | 968 | |
@@ -978,9 +978,9 @@ discard block |
||
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
981 | -function give_donor_delete_view( $donor ) { |
|
981 | +function give_donor_delete_view($donor) { |
|
982 | 982 | |
983 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
983 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
984 | 984 | |
985 | 985 | /** |
986 | 986 | * Fires in donor delete screen, above the content. |
@@ -989,16 +989,16 @@ discard block |
||
989 | 989 | * |
990 | 990 | * @param object $donor The donor object being displayed. |
991 | 991 | */ |
992 | - do_action( 'give_donor_delete_top', $donor ); |
|
992 | + do_action('give_donor_delete_top', $donor); |
|
993 | 993 | ?> |
994 | 994 | |
995 | 995 | <div class="info-wrapper donor-section"> |
996 | 996 | |
997 | 997 | <form id="delete-donor" method="post" |
998 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
998 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
999 | 999 | |
1000 | 1000 | <div class="donor-notes-header"> |
1001 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
1001 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
1002 | 1002 | </div> |
1003 | 1003 | |
1004 | 1004 | |
@@ -1006,20 +1006,20 @@ discard block |
||
1006 | 1006 | |
1007 | 1007 | <span class="delete-donor-options"> |
1008 | 1008 | <p> |
1009 | - <?php echo Give()->html->checkbox( array( |
|
1009 | + <?php echo Give()->html->checkbox(array( |
|
1010 | 1010 | 'name' => 'give-donor-delete-confirm', |
1011 | - ) ); ?> |
|
1012 | - <label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
1011 | + )); ?> |
|
1012 | + <label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
1013 | 1013 | </p> |
1014 | 1014 | |
1015 | 1015 | <p> |
1016 | - <?php echo Give()->html->checkbox( array( |
|
1016 | + <?php echo Give()->html->checkbox(array( |
|
1017 | 1017 | 'name' => 'give-donor-delete-records', |
1018 | 1018 | 'options' => array( |
1019 | 1019 | 'disabled' => true, |
1020 | 1020 | ), |
1021 | - ) ); ?> |
|
1022 | - <label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
1021 | + )); ?> |
|
1022 | + <label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
1023 | 1023 | </p> |
1024 | 1024 | |
1025 | 1025 | <?php |
@@ -1032,19 +1032,19 @@ discard block |
||
1032 | 1032 | * |
1033 | 1033 | * @param object $donor The donor object being displayed. |
1034 | 1034 | */ |
1035 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
1035 | + do_action('give_donor_delete_inputs', $donor); |
|
1036 | 1036 | ?> |
1037 | 1037 | </span> |
1038 | 1038 | |
1039 | 1039 | <span id="donor-edit-actions"> |
1040 | 1040 | <input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>"/> |
1041 | - <?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?> |
|
1041 | + <?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?> |
|
1042 | 1042 | <input type="hidden" name="give_action" value="delete-donor"/> |
1043 | 1043 | <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" |
1044 | - value="<?php _e( 'Delete Donor', 'give' ); ?>"/> |
|
1044 | + value="<?php _e('Delete Donor', 'give'); ?>"/> |
|
1045 | 1045 | <a id="give-delete-donor-cancel" |
1046 | - href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" |
|
1047 | - class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
1046 | + href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" |
|
1047 | + class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
1048 | 1048 | </span> |
1049 | 1049 | |
1050 | 1050 | </div> |
@@ -1060,5 +1060,5 @@ discard block |
||
1060 | 1060 | * |
1061 | 1061 | * @param object $donor The donor object being displayed. |
1062 | 1062 | */ |
1063 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
1063 | + do_action('give_donor_delete_bottom', $donor); |
|
1064 | 1064 | } |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | 19 | // Load WP_List_Table if not loaded. |
20 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
21 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
20 | +if ( ! class_exists('WP_List_Table')) { |
|
21 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | public function __construct() { |
62 | 62 | |
63 | 63 | // Set parent defaults. |
64 | - parent::__construct( array( |
|
65 | - 'singular' => __( 'Donor', 'give' ), // Singular name of the listed records. |
|
66 | - 'plural' => __( 'Donors', 'give' ), // Plural name of the listed records. |
|
64 | + parent::__construct(array( |
|
65 | + 'singular' => __('Donor', 'give'), // Singular name of the listed records. |
|
66 | + 'plural' => __('Donors', 'give'), // Plural name of the listed records. |
|
67 | 67 | 'ajax' => false, // Does this table support ajax?. |
68 | - ) ); |
|
68 | + )); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -80,23 +80,23 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return void |
82 | 82 | */ |
83 | - public function search_box( $text, $input_id ) { |
|
84 | - $input_id = $input_id . '-search-input'; |
|
83 | + public function search_box($text, $input_id) { |
|
84 | + $input_id = $input_id.'-search-input'; |
|
85 | 85 | |
86 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
87 | - echo sprintf( '<input type="hidden" name="orderby" value="%1$s" />', esc_attr( $_REQUEST['orderby'] ) ); |
|
86 | + if ( ! empty($_REQUEST['orderby'])) { |
|
87 | + echo sprintf('<input type="hidden" name="orderby" value="%1$s" />', esc_attr($_REQUEST['orderby'])); |
|
88 | 88 | } |
89 | 89 | |
90 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
91 | - echo sprintf( '<input type="hidden" name="order" value="%1$s" />', esc_attr( $_REQUEST['order'] ) ); |
|
90 | + if ( ! empty($_REQUEST['order'])) { |
|
91 | + echo sprintf('<input type="hidden" name="order" value="%1$s" />', esc_attr($_REQUEST['order'])); |
|
92 | 92 | } |
93 | 93 | ?> |
94 | 94 | <p class="search-box" role="search"> |
95 | 95 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
96 | 96 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
97 | - <?php submit_button( $text, 'button', false, false, array( |
|
97 | + <?php submit_button($text, 'button', false, false, array( |
|
98 | 98 | 'ID' => 'search-submit', |
99 | - ) ); ?> |
|
99 | + )); ?> |
|
100 | 100 | </p> |
101 | 101 | <?php |
102 | 102 | } |
@@ -112,32 +112,32 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return string Column Name. |
114 | 114 | */ |
115 | - public function column_default( $donor, $column_name ) { |
|
115 | + public function column_default($donor, $column_name) { |
|
116 | 116 | |
117 | - switch ( $column_name ) { |
|
117 | + switch ($column_name) { |
|
118 | 118 | |
119 | 119 | case 'num_donations' : |
120 | 120 | $value = sprintf( |
121 | 121 | '<a href="%s">%s</a>', |
122 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&status=publish&donor=' . absint( $donor['id'] ) ), |
|
123 | - esc_html( $donor['num_donations'] ) |
|
122 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&status=publish&donor='.absint($donor['id'])), |
|
123 | + esc_html($donor['num_donations']) |
|
124 | 124 | ); |
125 | 125 | break; |
126 | 126 | |
127 | 127 | case 'amount_spent' : |
128 | - $value = give_currency_filter( give_format_amount( $donor[ $column_name ], array( 'sanitize' => false ) ) ); |
|
128 | + $value = give_currency_filter(give_format_amount($donor[$column_name], array('sanitize' => false))); |
|
129 | 129 | break; |
130 | 130 | |
131 | 131 | case 'date_created' : |
132 | - $value = date_i18n( give_date_format(), strtotime( $donor['date_created'] ) ); |
|
132 | + $value = date_i18n(give_date_format(), strtotime($donor['date_created'])); |
|
133 | 133 | break; |
134 | 134 | |
135 | 135 | default: |
136 | - $value = isset( $donor[ $column_name ] ) ? $donor[ $column_name ] : null; |
|
136 | + $value = isset($donor[$column_name]) ? $donor[$column_name] : null; |
|
137 | 137 | break; |
138 | 138 | } |
139 | 139 | |
140 | - return apply_filters( "give_donors_column_{$column_name}", $value, $donor['id'] ); |
|
140 | + return apply_filters("give_donors_column_{$column_name}", $value, $donor['id']); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return string |
153 | 153 | */ |
154 | - public function column_cb( $donor ){ |
|
154 | + public function column_cb($donor) { |
|
155 | 155 | return sprintf( |
156 | 156 | '<input class="donor-selector" type="checkbox" name="%1$s[]" value="%2$d" data-name="%3$s" />', |
157 | 157 | $this->_args['singular'], |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return string |
172 | 172 | */ |
173 | - public function column_name( $donor ) { |
|
174 | - $name = '#' . $donor['id'] . ' '; |
|
175 | - $name .= ! empty( $donor['name'] ) ? $donor['name'] : '<em>' . __( 'Unnamed Donor', 'give' ) . '</em>'; |
|
176 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ); |
|
177 | - $actions = $this->get_row_actions( $donor ); |
|
173 | + public function column_name($donor) { |
|
174 | + $name = '#'.$donor['id'].' '; |
|
175 | + $name .= ! empty($donor['name']) ? $donor['name'] : '<em>'.__('Unnamed Donor', 'give').'</em>'; |
|
176 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']); |
|
177 | + $actions = $this->get_row_actions($donor); |
|
178 | 178 | |
179 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
179 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | public function get_columns() { |
191 | 191 | $columns = array( |
192 | 192 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
193 | - 'name' => __( 'Name', 'give' ), |
|
194 | - 'email' => __( 'Email', 'give' ), |
|
195 | - 'num_donations' => __( 'Donations', 'give' ), |
|
196 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
197 | - 'date_created' => __( 'Date Created', 'give' ), |
|
193 | + 'name' => __('Name', 'give'), |
|
194 | + 'email' => __('Email', 'give'), |
|
195 | + 'num_donations' => __('Donations', 'give'), |
|
196 | + 'amount_spent' => __('Total Donated', 'give'), |
|
197 | + 'date_created' => __('Date Created', 'give'), |
|
198 | 198 | ); |
199 | 199 | |
200 | - return apply_filters( 'give_list_donors_columns', $columns ); |
|
200 | + return apply_filters('give_list_donors_columns', $columns); |
|
201 | 201 | |
202 | 202 | } |
203 | 203 | |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | public function get_sortable_columns() { |
212 | 212 | |
213 | 213 | $columns = array( |
214 | - 'date_created' => array( 'date_created', true ), |
|
215 | - 'name' => array( 'name', true ), |
|
216 | - 'num_donations' => array( 'purchase_count', false ), |
|
217 | - 'amount_spent' => array( 'purchase_value', false ), |
|
214 | + 'date_created' => array('date_created', true), |
|
215 | + 'name' => array('name', true), |
|
216 | + 'num_donations' => array('purchase_count', false), |
|
217 | + 'amount_spent' => array('purchase_value', false), |
|
218 | 218 | ); |
219 | 219 | |
220 | - return apply_filters( 'give_list_donors_sortable_columns', $columns ); |
|
220 | + return apply_filters('give_list_donors_sortable_columns', $columns); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -230,15 +230,15 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @return array An array of action links. |
232 | 232 | */ |
233 | - public function get_row_actions( $donor ) { |
|
233 | + public function get_row_actions($donor) { |
|
234 | 234 | |
235 | 235 | $actions = array( |
236 | - 'view' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ), sprintf( esc_attr__( 'View "%s"', 'give' ), $donor['name'] ), __( 'View Donor', 'give' ) ), |
|
237 | - 'notes' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor['id'] ), sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $donor['name'] ), __( 'Notes', 'give' ) ), |
|
238 | - 'delete' => sprintf( '<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'],sprintf( esc_attr__( 'Delete "%s"', 'give' ), $donor['name'] ), __( 'Delete', 'give' ) ), |
|
236 | + 'view' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']), sprintf(esc_attr__('View "%s"', 'give'), $donor['name']), __('View Donor', 'give')), |
|
237 | + 'notes' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor['id']), sprintf(esc_attr__('Notes for "%s"', 'give'), $donor['name']), __('Notes', 'give')), |
|
238 | + 'delete' => sprintf('<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'], sprintf(esc_attr__('Delete "%s"', 'give'), $donor['name']), __('Delete', 'give')), |
|
239 | 239 | ); |
240 | 240 | |
241 | - return apply_filters( 'give_donor_row_actions', $actions, $donor ); |
|
241 | + return apply_filters('give_donor_row_actions', $actions, $donor); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @return int Current page number. |
252 | 252 | */ |
253 | 253 | public function get_paged() { |
254 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
254 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @return mixed string If search is present, false otherwise. |
264 | 264 | */ |
265 | 265 | public function get_search() { |
266 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
266 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function get_bulk_actions() { |
278 | 278 | $actions = array( |
279 | - 'delete' => __( 'Delete', 'give' ), |
|
279 | + 'delete' => __('Delete', 'give'), |
|
280 | 280 | ); |
281 | 281 | return $actions; |
282 | 282 | } |
@@ -289,19 +289,19 @@ discard block |
||
289 | 289 | * @access protected |
290 | 290 | * @since 1.8.16 |
291 | 291 | */ |
292 | - protected function display_tablenav( $which ) { |
|
293 | - if ( 'top' === $which ) { |
|
294 | - wp_nonce_field( 'bulk-' . $this->_args['plural'], '_wpnonce', false ); |
|
292 | + protected function display_tablenav($which) { |
|
293 | + if ('top' === $which) { |
|
294 | + wp_nonce_field('bulk-'.$this->_args['plural'], '_wpnonce', false); |
|
295 | 295 | } |
296 | 296 | ?> |
297 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
298 | - <?php if ( $this->has_items() ): ?> |
|
297 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
298 | + <?php if ($this->has_items()): ?> |
|
299 | 299 | <div class="alignleft actions bulkactions"> |
300 | - <?php $this->bulk_actions( $which ); ?> |
|
300 | + <?php $this->bulk_actions($which); ?> |
|
301 | 301 | </div> |
302 | 302 | <?php endif; |
303 | - $this->extra_tablenav( $which ); |
|
304 | - $this->pagination( $which ); |
|
303 | + $this->extra_tablenav($which); |
|
304 | + $this->pagination($which); |
|
305 | 305 | ?> |
306 | 306 | <br class="clear" /> |
307 | 307 | </div> |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | |
323 | 323 | // Get donor query. |
324 | 324 | $args = $this->get_donor_query(); |
325 | - $donors = Give()->donors->get_donors( $args ); |
|
325 | + $donors = Give()->donors->get_donors($args); |
|
326 | 326 | |
327 | - if ( $donors ) { |
|
327 | + if ($donors) { |
|
328 | 328 | |
329 | - foreach ( $donors as $donor ) { |
|
329 | + foreach ($donors as $donor) { |
|
330 | 330 | |
331 | - $user_id = ! empty( $donor->user_id ) ? intval( $donor->user_id ) : 0; |
|
331 | + $user_id = ! empty($donor->user_id) ? intval($donor->user_id) : 0; |
|
332 | 332 | |
333 | 333 | $data[] = array( |
334 | 334 | 'id' => $donor->id, |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
345 | - return apply_filters( 'give_donors_column_query_data', $data ); |
|
345 | + return apply_filters('give_donors_column_query_data', $data); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | |
358 | 358 | $_donor_query['number'] = - 1; |
359 | 359 | $_donor_query['offset'] = 0; |
360 | - $donors = Give()->donors->get_donors( $_donor_query ); |
|
360 | + $donors = Give()->donors->get_donors($_donor_query); |
|
361 | 361 | |
362 | - return count( $donors ); |
|
362 | + return count($donors); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | /** |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function get_donor_query() { |
374 | 374 | $paged = $this->get_paged(); |
375 | - $offset = $this->per_page * ( $paged - 1 ); |
|
375 | + $offset = $this->per_page * ($paged - 1); |
|
376 | 376 | $search = $this->get_search(); |
377 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
378 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
377 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
378 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
379 | 379 | |
380 | 380 | $args = array( |
381 | 381 | 'number' => $this->per_page, |
@@ -384,10 +384,10 @@ discard block |
||
384 | 384 | 'orderby' => $orderby, |
385 | 385 | ); |
386 | 386 | |
387 | - if ( $search ) { |
|
388 | - if ( is_email( $search ) ) { |
|
387 | + if ($search) { |
|
388 | + if (is_email($search)) { |
|
389 | 389 | $args['email'] = $search; |
390 | - } elseif ( is_numeric( $search ) ) { |
|
390 | + } elseif (is_numeric($search)) { |
|
391 | 391 | $args['id'] = $search; |
392 | 392 | } else { |
393 | 393 | $args['name'] = $search; |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | * @since 1.8.17 |
406 | 406 | * @access public |
407 | 407 | */ |
408 | - public function single_row( $item ) { |
|
409 | - echo sprintf( '<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name'] ); |
|
410 | - $this->single_row_columns( $item ); |
|
408 | + public function single_row($item) { |
|
409 | + echo sprintf('<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name']); |
|
410 | + $this->single_row_columns($item); |
|
411 | 411 | echo '</tr>'; |
412 | 412 | } |
413 | 413 | |
@@ -420,11 +420,11 @@ discard block |
||
420 | 420 | public function display() { |
421 | 421 | $singular = $this->_args['singular']; |
422 | 422 | |
423 | - $this->display_tablenav( 'top' ); |
|
423 | + $this->display_tablenav('top'); |
|
424 | 424 | |
425 | - $this->screen->render_screen_reader_content( 'heading_list' ); |
|
425 | + $this->screen->render_screen_reader_content('heading_list'); |
|
426 | 426 | ?> |
427 | - <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>"> |
|
427 | + <table class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>"> |
|
428 | 428 | <thead> |
429 | 429 | <tr> |
430 | 430 | <?php $this->print_column_headers(); ?> |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | </thead> |
433 | 433 | |
434 | 434 | <tbody id="the-list"<?php |
435 | - if ( $singular ) { |
|
435 | + if ($singular) { |
|
436 | 436 | echo " data-wp-lists='list:$singular'"; |
437 | 437 | } ?>> |
438 | 438 | <tr class="hidden"></tr> |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | <td colspan="6" class="colspanchange"> |
441 | 441 | |
442 | 442 | <fieldset class="inline-edit-col-left"> |
443 | - <legend class="inline-edit-legend"><?php _e( 'BULK DELETE', 'give' ); ?></legend> |
|
443 | + <legend class="inline-edit-legend"><?php _e('BULK DELETE', 'give'); ?></legend> |
|
444 | 444 | <div class="inline-edit-col"> |
445 | 445 | <div id="bulk-titles"> |
446 | 446 | <div id="give-bulk-donors" class="give-bulk-donors"> |
@@ -453,22 +453,22 @@ discard block |
||
453 | 453 | <div class="inline-edit-col"> |
454 | 454 | <label> |
455 | 455 | <input id="give-delete-donor-confirm" type="checkbox" name="give-delete-donor-confirm"/> |
456 | - <?php _e( 'Are you sure you want to delete the selected donor(s)?', 'give' ); ?> |
|
456 | + <?php _e('Are you sure you want to delete the selected donor(s)?', 'give'); ?> |
|
457 | 457 | </label> |
458 | 458 | <label> |
459 | 459 | <input id="give-delete-donor-records" type="checkbox" name="give-delete-donor-records"/> |
460 | - <?php _e( 'Delete all associated donations and records?', 'give' ); ?> |
|
460 | + <?php _e('Delete all associated donations and records?', 'give'); ?> |
|
461 | 461 | </label> |
462 | 462 | </div> |
463 | 463 | </fieldset> |
464 | 464 | |
465 | 465 | <p class="submit inline-edit-save"> |
466 | 466 | <input type="hidden" name="give_action" value="delete_donor"/> |
467 | - <input type="hidden" name="s" value="<?php echo ( ! empty( $_GET['s'] ) ) ? $_GET['s'] : ''; ?>"/> |
|
468 | - <input type="hidden" name="orderby" value="<?php echo ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'id'; ?>"/> |
|
469 | - <input type="hidden" name="order" value="<?php echo ( ! empty( $_GET['order'] ) ) ? $_GET['order'] : 'desc'; ?>"/> |
|
470 | - <button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php _e( 'Cancel', 'give' ); ?></button> |
|
471 | - <input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php _e( 'Delete', 'give' ); ?>"> |
|
467 | + <input type="hidden" name="s" value="<?php echo ( ! empty($_GET['s'])) ? $_GET['s'] : ''; ?>"/> |
|
468 | + <input type="hidden" name="orderby" value="<?php echo ( ! empty($_GET['orderby'])) ? $_GET['orderby'] : 'id'; ?>"/> |
|
469 | + <input type="hidden" name="order" value="<?php echo ( ! empty($_GET['order'])) ? $_GET['order'] : 'desc'; ?>"/> |
|
470 | + <button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php _e('Cancel', 'give'); ?></button> |
|
471 | + <input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php _e('Delete', 'give'); ?>"> |
|
472 | 472 | <br class="clear"> |
473 | 473 | </p> |
474 | 474 | </td> |
@@ -478,13 +478,13 @@ discard block |
||
478 | 478 | |
479 | 479 | <tfoot> |
480 | 480 | <tr> |
481 | - <?php $this->print_column_headers( false ); ?> |
|
481 | + <?php $this->print_column_headers(false); ?> |
|
482 | 482 | </tr> |
483 | 483 | </tfoot> |
484 | 484 | |
485 | 485 | </table> |
486 | 486 | <?php |
487 | - $this->display_tablenav( 'bottom' ); |
|
487 | + $this->display_tablenav('bottom'); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | /** |
@@ -501,16 +501,16 @@ discard block |
||
501 | 501 | $hidden = array(); // No hidden columns. |
502 | 502 | $sortable = $this->get_sortable_columns(); |
503 | 503 | |
504 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
504 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
505 | 505 | |
506 | 506 | $this->items = $this->donor_data(); |
507 | 507 | |
508 | 508 | $this->total = $this->get_donor_count(); |
509 | 509 | |
510 | - $this->set_pagination_args( array( |
|
510 | + $this->set_pagination_args(array( |
|
511 | 511 | 'total_items' => $this->total, |
512 | 512 | 'per_page' => $this->per_page, |
513 | - 'total_pages' => ceil( $this->total / $this->per_page ), |
|
514 | - ) ); |
|
513 | + 'total_pages' => ceil($this->total / $this->per_page), |
|
514 | + )); |
|
515 | 515 | } |
516 | 516 | } |