@@ -463,7 +463,7 @@ |
||
463 | 463 | * @since 1.7 |
464 | 464 | * @access public |
465 | 465 | * |
466 | - * @return bool |
|
466 | + * @return false|null |
|
467 | 467 | */ |
468 | 468 | public function delete_cache() { |
469 | 469 | global $wpdb; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __setup_hooks() { |
45 | 45 | // Create the log post type |
46 | - add_action( 'init', array( $this, 'register_post_type' ), 1 ); |
|
46 | + add_action('init', array($this, 'register_post_type'), 1); |
|
47 | 47 | |
48 | 48 | // Create types taxonomy and default types |
49 | - add_action( 'init', array( $this, 'register_taxonomy' ), 1 ); |
|
49 | + add_action('init', array($this, 'register_taxonomy'), 1); |
|
50 | 50 | |
51 | - add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) ); |
|
52 | - add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) ); |
|
53 | - add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) ); |
|
54 | - add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) ); |
|
51 | + add_action('save_post_give_payment', array($this, 'background_process_delete_cache')); |
|
52 | + add_action('save_post_give_forms', array($this, 'background_process_delete_cache')); |
|
53 | + add_action('save_post_give_log', array($this, 'background_process_delete_cache')); |
|
54 | + add_action('give_delete_log_cache', array($this, 'delete_cache')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /* Logs post type */ |
69 | 69 | $log_args = array( |
70 | 70 | 'labels' => array( |
71 | - 'name' => esc_html__( 'Logs', 'give' ), |
|
71 | + 'name' => esc_html__('Logs', 'give'), |
|
72 | 72 | ), |
73 | 73 | 'public' => false, |
74 | 74 | 'exclude_from_search' => true, |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | 'query_var' => false, |
78 | 78 | 'rewrite' => false, |
79 | 79 | 'capability_type' => 'post', |
80 | - 'supports' => array( 'title', 'editor' ), |
|
80 | + 'supports' => array('title', 'editor'), |
|
81 | 81 | 'can_export' => true, |
82 | 82 | ); |
83 | 83 | |
84 | - register_post_type( 'give_log', $log_args ); |
|
84 | + register_post_type('give_log', $log_args); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | public function register_taxonomy() { |
98 | - register_taxonomy( 'give_log_type', 'give_log', array( |
|
98 | + register_taxonomy('give_log_type', 'give_log', array( |
|
99 | 99 | 'public' => false, |
100 | - ) ); |
|
100 | + )); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'api_request', |
118 | 118 | ); |
119 | 119 | |
120 | - return apply_filters( 'give_log_types', $terms ); |
|
120 | + return apply_filters('give_log_types', $terms); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return bool Whether log type is valid. |
134 | 134 | */ |
135 | - public function valid_type( $type ) { |
|
136 | - return in_array( $type, $this->log_types() ); |
|
135 | + public function valid_type($type) { |
|
136 | + return in_array($type, $this->log_types()); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return int Log ID. |
154 | 154 | */ |
155 | - public function add( $title = '', $message = '', $parent = 0, $type = null ) { |
|
155 | + public function add($title = '', $message = '', $parent = 0, $type = null) { |
|
156 | 156 | $log_data = array( |
157 | 157 | 'post_title' => $title, |
158 | 158 | 'post_content' => $message, |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 'log_type' => $type, |
161 | 161 | ); |
162 | 162 | |
163 | - return $this->insert_log( $log_data ); |
|
163 | + return $this->insert_log($log_data); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return array An array of the connected logs. |
179 | 179 | */ |
180 | - public function get_logs( $object_id = 0, $type = null, $paged = null ) { |
|
181 | - return $this->get_connected_logs( array( |
|
180 | + public function get_logs($object_id = 0, $type = null, $paged = null) { |
|
181 | + return $this->get_connected_logs(array( |
|
182 | 182 | 'post_parent' => $object_id, |
183 | 183 | 'paged' => $paged, |
184 | 184 | 'log_type' => $type, |
185 | - ) ); |
|
185 | + )); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return int The ID of the newly created log item. |
198 | 198 | */ |
199 | - public function insert_log( $log_data = array(), $log_meta = array() ) { |
|
199 | + public function insert_log($log_data = array(), $log_meta = array()) { |
|
200 | 200 | $defaults = array( |
201 | 201 | 'post_type' => 'give_log', |
202 | 202 | 'post_status' => 'publish', |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | 'log_type' => false, |
206 | 206 | ); |
207 | 207 | |
208 | - $args = wp_parse_args( $log_data, $defaults ); |
|
208 | + $args = wp_parse_args($log_data, $defaults); |
|
209 | 209 | |
210 | 210 | /** |
211 | 211 | * Fires before inserting log entry. |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | * @param array $log_data Log entry data. |
216 | 216 | * @param array $log_meta Log entry meta. |
217 | 217 | */ |
218 | - do_action( 'give_pre_insert_log', $log_data, $log_meta ); |
|
218 | + do_action('give_pre_insert_log', $log_data, $log_meta); |
|
219 | 219 | |
220 | 220 | // Store the log entry |
221 | - $log_id = wp_insert_post( $args ); |
|
221 | + $log_id = wp_insert_post($args); |
|
222 | 222 | |
223 | 223 | // Set the log type, if any |
224 | - if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) { |
|
225 | - wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false ); |
|
224 | + if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) { |
|
225 | + wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // Set log meta, if any |
229 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
230 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
231 | - update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
229 | + if ($log_id && ! empty($log_meta)) { |
|
230 | + foreach ((array) $log_meta as $key => $meta) { |
|
231 | + update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param array $log_data Log entry data. |
242 | 242 | * @param array $log_meta Log entry meta. |
243 | 243 | */ |
244 | - do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta ); |
|
244 | + do_action('give_post_insert_log', $log_id, $log_data, $log_meta); |
|
245 | 245 | |
246 | 246 | return $log_id; |
247 | 247 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return bool|null True if successful, false otherwise. |
259 | 259 | */ |
260 | - public function update_log( $log_data = array(), $log_meta = array() ) { |
|
260 | + public function update_log($log_data = array(), $log_meta = array()) { |
|
261 | 261 | |
262 | 262 | /** |
263 | 263 | * Fires before updating log entry. |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @param array $log_data Log entry data. |
268 | 268 | * @param array $log_meta Log entry meta. |
269 | 269 | */ |
270 | - do_action( 'give_pre_update_log', $log_data, $log_meta ); |
|
270 | + do_action('give_pre_update_log', $log_data, $log_meta); |
|
271 | 271 | |
272 | 272 | $defaults = array( |
273 | 273 | 'post_type' => 'give_log', |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | 'post_parent' => 0, |
276 | 276 | ); |
277 | 277 | |
278 | - $args = wp_parse_args( $log_data, $defaults ); |
|
278 | + $args = wp_parse_args($log_data, $defaults); |
|
279 | 279 | |
280 | 280 | // Store the log entry |
281 | - $log_id = wp_update_post( $args ); |
|
281 | + $log_id = wp_update_post($args); |
|
282 | 282 | |
283 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
284 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
285 | - if ( ! empty( $meta ) ) { |
|
286 | - update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
283 | + if ($log_id && ! empty($log_meta)) { |
|
284 | + foreach ((array) $log_meta as $key => $meta) { |
|
285 | + if ( ! empty($meta)) { |
|
286 | + update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param array $log_data Log entry data. |
298 | 298 | * @param array $log_meta Log entry meta. |
299 | 299 | */ |
300 | - do_action( 'give_post_update_log', $log_id, $log_data, $log_meta ); |
|
300 | + do_action('give_post_update_log', $log_id, $log_data, $log_meta); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -312,19 +312,19 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return array|false Array if logs were found, false otherwise. |
314 | 314 | */ |
315 | - public function get_connected_logs( $args = array() ) { |
|
315 | + public function get_connected_logs($args = array()) { |
|
316 | 316 | |
317 | 317 | $defaults = array( |
318 | 318 | 'post_type' => 'give_log', |
319 | 319 | 'posts_per_page' => 20, |
320 | 320 | 'post_status' => 'publish', |
321 | - 'paged' => get_query_var( 'paged' ), |
|
321 | + 'paged' => get_query_var('paged'), |
|
322 | 322 | 'log_type' => false, |
323 | 323 | ); |
324 | 324 | |
325 | - $query_args = wp_parse_args( $args, $defaults ); |
|
325 | + $query_args = wp_parse_args($args, $defaults); |
|
326 | 326 | |
327 | - if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) { |
|
327 | + if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) { |
|
328 | 328 | $query_args['tax_query'] = array( |
329 | 329 | array( |
330 | 330 | 'taxonomy' => 'give_log_type', |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | ); |
335 | 335 | } |
336 | 336 | |
337 | - $logs = get_posts( $query_args ); |
|
337 | + $logs = get_posts($query_args); |
|
338 | 338 | |
339 | - if ( $logs ) { |
|
339 | + if ($logs) { |
|
340 | 340 | return $logs; |
341 | 341 | } |
342 | 342 | |
@@ -359,20 +359,20 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @return int Log count. |
361 | 361 | */ |
362 | - public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) { |
|
362 | + public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) { |
|
363 | 363 | |
364 | 364 | $query_args = array( |
365 | 365 | 'post_type' => 'give_log', |
366 | - 'posts_per_page' => - 1, |
|
366 | + 'posts_per_page' => -1, |
|
367 | 367 | 'post_status' => 'publish', |
368 | 368 | 'fields' => 'ids', |
369 | 369 | ); |
370 | 370 | |
371 | - if ( $object_id ) { |
|
371 | + if ($object_id) { |
|
372 | 372 | $query_args['post_parent'] = $object_id; |
373 | 373 | } |
374 | 374 | |
375 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
375 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
376 | 376 | $query_args['tax_query'] = array( |
377 | 377 | array( |
378 | 378 | 'taxonomy' => 'give_log_type', |
@@ -382,24 +382,24 @@ discard block |
||
382 | 382 | ); |
383 | 383 | } |
384 | 384 | |
385 | - if ( ! empty( $meta_query ) ) { |
|
385 | + if ( ! empty($meta_query)) { |
|
386 | 386 | $query_args['meta_query'] = $meta_query; |
387 | 387 | } |
388 | 388 | |
389 | - if ( ! empty( $date_query ) ) { |
|
389 | + if ( ! empty($date_query)) { |
|
390 | 390 | $query_args['date_query'] = $date_query; |
391 | 391 | } |
392 | 392 | |
393 | 393 | // Get cache key for current query. |
394 | - $cache_key = Give_Cache::get_key( 'get_log_count', $query_args ); |
|
394 | + $cache_key = Give_Cache::get_key('get_log_count', $query_args); |
|
395 | 395 | |
396 | 396 | // check if cache already exist or not. |
397 | - if ( ! ( $logs_count = Give_Cache::get( $cache_key ) ) ) { |
|
398 | - $logs = new WP_Query( $query_args ); |
|
397 | + if ( ! ($logs_count = Give_Cache::get($cache_key))) { |
|
398 | + $logs = new WP_Query($query_args); |
|
399 | 399 | $logs_count = (int) $logs->post_count; |
400 | 400 | |
401 | 401 | // Cache results. |
402 | - Give_Cache::set( $cache_key, $logs_count ); |
|
402 | + Give_Cache::set($cache_key, $logs_count); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | return $logs_count; |
@@ -419,16 +419,16 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return void |
421 | 421 | */ |
422 | - public function delete_logs( $object_id = 0, $type = null, $meta_query = null ) { |
|
422 | + public function delete_logs($object_id = 0, $type = null, $meta_query = null) { |
|
423 | 423 | $query_args = array( |
424 | 424 | 'post_parent' => $object_id, |
425 | 425 | 'post_type' => 'give_log', |
426 | - 'posts_per_page' => - 1, |
|
426 | + 'posts_per_page' => -1, |
|
427 | 427 | 'post_status' => 'publish', |
428 | 428 | 'fields' => 'ids', |
429 | 429 | ); |
430 | 430 | |
431 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
431 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
432 | 432 | $query_args['tax_query'] = array( |
433 | 433 | array( |
434 | 434 | 'taxonomy' => 'give_log_type', |
@@ -438,15 +438,15 @@ discard block |
||
438 | 438 | ); |
439 | 439 | } |
440 | 440 | |
441 | - if ( ! empty( $meta_query ) ) { |
|
441 | + if ( ! empty($meta_query)) { |
|
442 | 442 | $query_args['meta_query'] = $meta_query; |
443 | 443 | } |
444 | 444 | |
445 | - $logs = get_posts( $query_args ); |
|
445 | + $logs = get_posts($query_args); |
|
446 | 446 | |
447 | - if ( $logs ) { |
|
448 | - foreach ( $logs as $log ) { |
|
449 | - wp_delete_post( $log, true ); |
|
447 | + if ($logs) { |
|
448 | + foreach ($logs as $log) { |
|
449 | + wp_delete_post($log, true); |
|
450 | 450 | } |
451 | 451 | } |
452 | 452 | } |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | * |
460 | 460 | * @param int $post_id |
461 | 461 | */ |
462 | - public function background_process_delete_cache( $post_id ) { |
|
462 | + public function background_process_delete_cache($post_id) { |
|
463 | 463 | // Delete log cache immediately |
464 | - wp_schedule_single_event( time() - 5, 'give_delete_log_cache' ); |
|
464 | + wp_schedule_single_event(time() - 5, 'give_delete_log_cache'); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -489,11 +489,11 @@ discard block |
||
489 | 489 | ); |
490 | 490 | |
491 | 491 | // Bailout. |
492 | - if ( empty( $cache_option_names ) ) { |
|
492 | + if (empty($cache_option_names)) { |
|
493 | 493 | return false; |
494 | 494 | } |
495 | 495 | |
496 | - Give_Cache::delete( $cache_option_names ); |
|
496 | + Give_Cache::delete($cache_option_names); |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
@@ -515,10 +515,10 @@ discard block |
||
515 | 515 | * |
516 | 516 | * @return int ID of the new log entry. |
517 | 517 | */ |
518 | -function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) { |
|
518 | +function give_record_log($title = '', $message = '', $parent = 0, $type = null) { |
|
519 | 519 | /* @var Give_Logging $give_logs */ |
520 | 520 | global $give_logs; |
521 | - $log = $give_logs->add( $title, $message, $parent, $type ); |
|
521 | + $log = $give_logs->add($title, $message, $parent, $type); |
|
522 | 522 | |
523 | 523 | return $log; |
524 | 524 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * Used to redirect a user back to the donation form if there are errors present. |
157 | 157 | * |
158 | - * @param array $args |
|
158 | + * @param string $args |
|
159 | 159 | * |
160 | 160 | * @access public |
161 | 161 | * @since 1.0 |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @param int $form_id Give Form ID |
439 | 439 | * |
440 | - * @return int $earnings Earnings for a certain form |
|
440 | + * @return double $earnings Earnings for a certain form |
|
441 | 441 | */ |
442 | 442 | function give_get_form_earnings_stats( $form_id = 0 ) { |
443 | 443 | $give_form = new Give_Donate_Form( $form_id ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | |
24 | 24 | global $typenow; |
25 | 25 | |
26 | - if ( $typenow != 'give_forms' ) { |
|
26 | + if ($typenow != 'give_forms') { |
|
27 | 27 | return true; |
28 | 28 | } |
29 | 29 | |
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | |
33 | -add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' ); |
|
33 | +add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition'); |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return int|false |
42 | 42 | */ |
43 | -function get_form_id_from_args( $args ) { |
|
43 | +function get_form_id_from_args($args) { |
|
44 | 44 | |
45 | - if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) { |
|
45 | + if (isset($args['form_id']) && $args['form_id'] != 0) { |
|
46 | 46 | |
47 | - return intval( $args['form_id'] ); |
|
47 | + return intval($args['form_id']); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return false; |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool |
61 | 61 | */ |
62 | -function give_is_float_labels_enabled( $args ) { |
|
62 | +function give_is_float_labels_enabled($args) { |
|
63 | 63 | |
64 | 64 | $float_labels = ''; |
65 | 65 | |
66 | - if ( ! empty( $args['float_labels'] ) ) { |
|
66 | + if ( ! empty($args['float_labels'])) { |
|
67 | 67 | $float_labels = $args['float_labels']; |
68 | 68 | } |
69 | 69 | |
70 | - if ( empty( $float_labels ) ) { |
|
71 | - $float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true ); |
|
70 | + if (empty($float_labels)) { |
|
71 | + $float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) { |
|
75 | - $float_labels = give_get_option( 'floatlabels', 'disabled' ); |
|
74 | + if (empty($float_labels) || ('global' === $float_labels)) { |
|
75 | + $float_labels = give_get_option('floatlabels', 'disabled'); |
|
76 | 76 | } |
77 | 77 | |
78 | - return give_is_setting_enabled( $float_labels ); |
|
78 | + return give_is_setting_enabled($float_labels); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $can_checkout = true; |
93 | 93 | |
94 | - return (bool) apply_filters( 'give_can_checkout', $can_checkout ); |
|
94 | + return (bool) apply_filters('give_can_checkout', $can_checkout); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | function give_get_success_page_uri() { |
106 | 106 | $give_options = give_get_settings(); |
107 | 107 | |
108 | - $success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' ); |
|
108 | + $success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url'); |
|
109 | 109 | |
110 | - return apply_filters( 'give_get_success_page_uri', $success_page ); |
|
110 | + return apply_filters('give_get_success_page_uri', $success_page); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function give_is_success_page() { |
121 | 121 | $give_options = give_get_settings(); |
122 | - $is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false; |
|
122 | + $is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false; |
|
123 | 123 | |
124 | - return apply_filters( 'give_is_success_page', $is_success_page ); |
|
124 | + return apply_filters('give_is_success_page', $is_success_page); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * @since 1.0 |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_send_to_success_page( $query_string = null ) { |
|
138 | +function give_send_to_success_page($query_string = null) { |
|
139 | 139 | |
140 | 140 | $redirect = give_get_success_page_uri(); |
141 | 141 | |
142 | - if ( $query_string ) { |
|
142 | + if ($query_string) { |
|
143 | 143 | $redirect .= $query_string; |
144 | 144 | } |
145 | 145 | |
146 | - $gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : ''; |
|
146 | + $gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : ''; |
|
147 | 147 | |
148 | - wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) ); |
|
148 | + wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string)); |
|
149 | 149 | give_die(); |
150 | 150 | } |
151 | 151 | |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | * @since 1.0 |
162 | 162 | * @return Void |
163 | 163 | */ |
164 | -function give_send_back_to_checkout( $args = array() ) { |
|
164 | +function give_send_back_to_checkout($args = array()) { |
|
165 | 165 | |
166 | - $url = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : ''; |
|
166 | + $url = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : ''; |
|
167 | 167 | $form_id = 0; |
168 | 168 | |
169 | 169 | // Set the form_id. |
170 | - if ( isset( $_POST['give-form-id'] ) ) { |
|
171 | - $form_id = sanitize_text_field( $_POST['give-form-id'] ); |
|
170 | + if (isset($_POST['give-form-id'])) { |
|
171 | + $form_id = sanitize_text_field($_POST['give-form-id']); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // Need a URL to continue. If none, redirect back to single form. |
175 | - if ( empty( $url ) ) { |
|
176 | - wp_safe_redirect( get_permalink( $form_id ) ); |
|
175 | + if (empty($url)) { |
|
176 | + wp_safe_redirect(get_permalink($form_id)); |
|
177 | 177 | give_die(); |
178 | 178 | } |
179 | 179 | |
@@ -182,41 +182,41 @@ discard block |
||
182 | 182 | ); |
183 | 183 | |
184 | 184 | // Set the $level_id. |
185 | - if ( isset( $_POST['give-price-id'] ) ) { |
|
186 | - $defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] ); |
|
185 | + if (isset($_POST['give-price-id'])) { |
|
186 | + $defaults['level-id'] = sanitize_text_field($_POST['give-price-id']); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | // Check for backward compatibility. |
190 | - if ( is_string( $args ) ) { |
|
191 | - $args = str_replace( '?', '', $args ); |
|
190 | + if (is_string($args)) { |
|
191 | + $args = str_replace('?', '', $args); |
|
192 | 192 | } |
193 | 193 | |
194 | - $args = wp_parse_args( $args, $defaults ); |
|
194 | + $args = wp_parse_args($args, $defaults); |
|
195 | 195 | |
196 | 196 | // Merge URL query with $args to maintain third-party URL parameters after redirect. |
197 | - $url_data = wp_parse_url( $url ); |
|
197 | + $url_data = wp_parse_url($url); |
|
198 | 198 | |
199 | 199 | // Check if an array to prevent notices before parsing. |
200 | - if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) { |
|
201 | - parse_str( $url_data['query'], $query ); |
|
200 | + if (isset($url_data['query']) && ! empty($url_data['query'])) { |
|
201 | + parse_str($url_data['query'], $query); |
|
202 | 202 | |
203 | 203 | // Precaution: don't allow any CC info. |
204 | - unset( $query['card_number'] ); |
|
205 | - unset( $query['card_cvc'] ); |
|
204 | + unset($query['card_number']); |
|
205 | + unset($query['card_cvc']); |
|
206 | 206 | |
207 | 207 | } else { |
208 | 208 | // No $url_data so pass empty array. |
209 | 209 | $query = array(); |
210 | 210 | } |
211 | 211 | |
212 | - $new_query = array_merge( $args, $query ); |
|
213 | - $new_query_string = http_build_query( $new_query ); |
|
212 | + $new_query = array_merge($args, $query); |
|
213 | + $new_query_string = http_build_query($new_query); |
|
214 | 214 | |
215 | 215 | // Assemble URL parts. |
216 | - $redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' ); |
|
216 | + $redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap'); |
|
217 | 217 | |
218 | 218 | // Redirect them. |
219 | - wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) ); |
|
219 | + wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args)); |
|
220 | 220 | give_die(); |
221 | 221 | |
222 | 222 | } |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | * @since 1.0 |
233 | 233 | * @return string |
234 | 234 | */ |
235 | -function give_get_success_page_url( $query_string = null ) { |
|
235 | +function give_get_success_page_url($query_string = null) { |
|
236 | 236 | |
237 | - $success_page = give_get_option( 'success_page', 0 ); |
|
238 | - $success_page = get_permalink( $success_page ); |
|
237 | + $success_page = give_get_option('success_page', 0); |
|
238 | + $success_page = get_permalink($success_page); |
|
239 | 239 | |
240 | - if ( $query_string ) { |
|
240 | + if ($query_string) { |
|
241 | 241 | $success_page .= $query_string; |
242 | 242 | } |
243 | 243 | |
244 | - return apply_filters( 'give_success_page_url', $success_page ); |
|
244 | + return apply_filters('give_success_page_url', $success_page); |
|
245 | 245 | |
246 | 246 | } |
247 | 247 | |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @return mixed|void Full URL to the Failed Donation Page, if present, home page if it doesn't exist |
256 | 256 | */ |
257 | -function give_get_failed_transaction_uri( $extras = false ) { |
|
257 | +function give_get_failed_transaction_uri($extras = false) { |
|
258 | 258 | $give_options = give_get_settings(); |
259 | 259 | |
260 | - $uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url(); |
|
261 | - if ( $extras ) { |
|
260 | + $uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url(); |
|
261 | + if ($extras) { |
|
262 | 262 | $uri .= $extras; |
263 | 263 | } |
264 | 264 | |
265 | - return apply_filters( 'give_get_failed_transaction_uri', $uri ); |
|
265 | + return apply_filters('give_get_failed_transaction_uri', $uri); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | */ |
274 | 274 | function give_is_failed_transaction_page() { |
275 | 275 | $give_options = give_get_settings(); |
276 | - $ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false; |
|
276 | + $ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false; |
|
277 | 277 | |
278 | - return apply_filters( 'give_is_failure_page', $ret ); |
|
278 | + return apply_filters('give_is_failure_page', $ret); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -287,18 +287,18 @@ discard block |
||
287 | 287 | */ |
288 | 288 | function give_listen_for_failed_payments() { |
289 | 289 | |
290 | - $failed_page = give_get_option( 'failure_page', 0 ); |
|
290 | + $failed_page = give_get_option('failure_page', 0); |
|
291 | 291 | |
292 | - if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) { |
|
292 | + if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) { |
|
293 | 293 | |
294 | - $payment_id = absint( $_GET['payment-id'] ); |
|
295 | - give_update_payment_status( $payment_id, 'failed' ); |
|
294 | + $payment_id = absint($_GET['payment-id']); |
|
295 | + give_update_payment_status($payment_id, 'failed'); |
|
296 | 296 | |
297 | 297 | } |
298 | 298 | |
299 | 299 | } |
300 | 300 | |
301 | -add_action( 'template_redirect', 'give_listen_for_failed_payments' ); |
|
301 | +add_action('template_redirect', 'give_listen_for_failed_payments'); |
|
302 | 302 | |
303 | 303 | /** |
304 | 304 | * Retrieve the Donation History page URI |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | function give_get_history_page_uri() { |
312 | 312 | $give_options = give_get_settings(); |
313 | 313 | |
314 | - $history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' ); |
|
314 | + $history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url'); |
|
315 | 315 | |
316 | - return apply_filters( 'give_get_history_page_uri', $history_page ); |
|
316 | + return apply_filters('give_get_history_page_uri', $history_page); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * @since 1.0 |
327 | 327 | * @return bool |
328 | 328 | */ |
329 | -function give_field_is_required( $field = '', $form_id ) { |
|
329 | +function give_field_is_required($field = '', $form_id) { |
|
330 | 330 | |
331 | - $required_fields = give_get_required_fields( $form_id ); |
|
331 | + $required_fields = give_get_required_fields($form_id); |
|
332 | 332 | |
333 | - return array_key_exists( $field, $required_fields ); |
|
333 | + return array_key_exists($field, $required_fields); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @return void |
350 | 350 | */ |
351 | -function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) { |
|
351 | +function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) { |
|
352 | 352 | global $give_logs; |
353 | 353 | |
354 | 354 | $log_data = array( |
355 | 355 | 'post_parent' => $give_form_id, |
356 | 356 | 'log_type' => 'sale', |
357 | - 'post_date' => isset( $sale_date ) ? $sale_date : null, |
|
358 | - 'post_date_gmt' => isset( $sale_date ) ? $sale_date : null, |
|
357 | + 'post_date' => isset($sale_date) ? $sale_date : null, |
|
358 | + 'post_date_gmt' => isset($sale_date) ? $sale_date : null, |
|
359 | 359 | ); |
360 | 360 | |
361 | 361 | $log_meta = array( |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | 'price_id' => (int) $price_id, |
364 | 364 | ); |
365 | 365 | |
366 | - $give_logs->insert_log( $log_data, $log_meta ); |
|
366 | + $give_logs->insert_log($log_data, $log_meta); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | * |
378 | 378 | * @return bool|int |
379 | 379 | */ |
380 | -function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) { |
|
380 | +function give_increase_purchase_count($form_id = 0, $quantity = 1) { |
|
381 | 381 | $quantity = (int) $quantity; |
382 | - $form = new Give_Donate_Form( $form_id ); |
|
382 | + $form = new Give_Donate_Form($form_id); |
|
383 | 383 | |
384 | - return $form->increase_sales( $quantity ); |
|
384 | + return $form->increase_sales($quantity); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | /** |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @return bool|int |
396 | 396 | */ |
397 | -function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) { |
|
397 | +function give_decrease_purchase_count($form_id = 0, $quantity = 1) { |
|
398 | 398 | $quantity = (int) $quantity; |
399 | - $form = new Give_Donate_Form( $form_id ); |
|
399 | + $form = new Give_Donate_Form($form_id); |
|
400 | 400 | |
401 | - return $form->decrease_sales( $quantity ); |
|
401 | + return $form->decrease_sales($quantity); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | /** |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | * |
412 | 412 | * @return bool|int |
413 | 413 | */ |
414 | -function give_increase_earnings( $give_form_id = 0, $amount ) { |
|
415 | - $form = new Give_Donate_Form( $give_form_id ); |
|
414 | +function give_increase_earnings($give_form_id = 0, $amount) { |
|
415 | + $form = new Give_Donate_Form($give_form_id); |
|
416 | 416 | |
417 | - return $form->increase_earnings( $amount ); |
|
417 | + return $form->increase_earnings($amount); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
@@ -427,10 +427,10 @@ discard block |
||
427 | 427 | * |
428 | 428 | * @return bool|int |
429 | 429 | */ |
430 | -function give_decrease_earnings( $form_id = 0, $amount ) { |
|
431 | - $form = new Give_Donate_Form( $form_id ); |
|
430 | +function give_decrease_earnings($form_id = 0, $amount) { |
|
431 | + $form = new Give_Donate_Form($form_id); |
|
432 | 432 | |
433 | - return $form->decrease_earnings( $amount ); |
|
433 | + return $form->decrease_earnings($amount); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | * |
444 | 444 | * @return int $earnings Earnings for a certain form |
445 | 445 | */ |
446 | -function give_get_form_earnings_stats( $form_id = 0 ) { |
|
447 | - $give_form = new Give_Donate_Form( $form_id ); |
|
446 | +function give_get_form_earnings_stats($form_id = 0) { |
|
447 | + $give_form = new Give_Donate_Form($form_id); |
|
448 | 448 | |
449 | 449 | return $give_form->earnings; |
450 | 450 | } |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | * |
460 | 460 | * @return int $sales Amount of sales for a certain form |
461 | 461 | */ |
462 | -function give_get_form_sales_stats( $give_form_id = 0 ) { |
|
463 | - $give_form = new Give_Donate_Form( $give_form_id ); |
|
462 | +function give_get_form_sales_stats($give_form_id = 0) { |
|
463 | + $give_form = new Give_Donate_Form($give_form_id); |
|
464 | 464 | |
465 | 465 | return $give_form->sales; |
466 | 466 | } |
@@ -475,16 +475,16 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @return float $sales Average monthly sales |
477 | 477 | */ |
478 | -function give_get_average_monthly_form_sales( $form_id = 0 ) { |
|
479 | - $sales = give_get_form_sales_stats( $form_id ); |
|
480 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
478 | +function give_get_average_monthly_form_sales($form_id = 0) { |
|
479 | + $sales = give_get_form_sales_stats($form_id); |
|
480 | + $release_date = get_post_field('post_date', $form_id); |
|
481 | 481 | |
482 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
482 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
483 | 483 | |
484 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
484 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
485 | 485 | |
486 | - if ( $months > 0 ) { |
|
487 | - $sales = ( $sales / $months ); |
|
486 | + if ($months > 0) { |
|
487 | + $sales = ($sales / $months); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | return $sales; |
@@ -500,16 +500,16 @@ discard block |
||
500 | 500 | * |
501 | 501 | * @return float $earnings Average monthly earnings |
502 | 502 | */ |
503 | -function give_get_average_monthly_form_earnings( $form_id = 0 ) { |
|
504 | - $earnings = give_get_form_earnings_stats( $form_id ); |
|
505 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
503 | +function give_get_average_monthly_form_earnings($form_id = 0) { |
|
504 | + $earnings = give_get_form_earnings_stats($form_id); |
|
505 | + $release_date = get_post_field('post_date', $form_id); |
|
506 | 506 | |
507 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
507 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
508 | 508 | |
509 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
509 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
510 | 510 | |
511 | - if ( $months > 0 ) { |
|
512 | - $earnings = ( $earnings / $months ); |
|
511 | + if ($months > 0) { |
|
512 | + $earnings = ($earnings / $months); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | return $earnings < 0 ? 0 : $earnings; |
@@ -529,23 +529,23 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @return string $price_name Name of the price option |
531 | 531 | */ |
532 | -function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) { |
|
532 | +function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) { |
|
533 | 533 | |
534 | - $prices = give_get_variable_prices( $form_id ); |
|
534 | + $prices = give_get_variable_prices($form_id); |
|
535 | 535 | $price_name = ''; |
536 | 536 | |
537 | - foreach ( $prices as $price ) { |
|
537 | + foreach ($prices as $price) { |
|
538 | 538 | |
539 | - if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) { |
|
539 | + if (intval($price['_give_id']['level_id']) == intval($price_id)) { |
|
540 | 540 | |
541 | - $price_text = isset( $price['_give_text'] ) ? $price['_give_text'] : ''; |
|
542 | - $price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) ); |
|
543 | - $price_name = ! empty( $price_text ) ? $price_text : $price_fallback; |
|
541 | + $price_text = isset($price['_give_text']) ? $price['_give_text'] : ''; |
|
542 | + $price_fallback = give_currency_filter(give_format_amount($price['_give_amount'])); |
|
543 | + $price_name = ! empty($price_text) ? $price_text : $price_fallback; |
|
544 | 544 | |
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
548 | - return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id ); |
|
548 | + return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -558,14 +558,14 @@ discard block |
||
558 | 558 | * |
559 | 559 | * @return string $range A fully formatted price range |
560 | 560 | */ |
561 | -function give_price_range( $form_id = 0 ) { |
|
562 | - $low = give_get_lowest_price_option( $form_id ); |
|
563 | - $high = give_get_highest_price_option( $form_id ); |
|
564 | - $range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>'; |
|
561 | +function give_price_range($form_id = 0) { |
|
562 | + $low = give_get_lowest_price_option($form_id); |
|
563 | + $high = give_get_highest_price_option($form_id); |
|
564 | + $range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>'; |
|
565 | 565 | $range .= '<span class="give_price_range_sep"> – </span>'; |
566 | - $range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>'; |
|
566 | + $range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>'; |
|
567 | 567 | |
568 | - return apply_filters( 'give_price_range', $range, $form_id, $low, $high ); |
|
568 | + return apply_filters('give_price_range', $range, $form_id, $low, $high); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | |
@@ -580,35 +580,35 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @return int ID of the lowest price |
582 | 582 | */ |
583 | -function give_get_lowest_price_id( $form_id = 0 ) { |
|
583 | +function give_get_lowest_price_id($form_id = 0) { |
|
584 | 584 | |
585 | - if ( empty( $form_id ) ) { |
|
585 | + if (empty($form_id)) { |
|
586 | 586 | $form_id = get_the_ID(); |
587 | 587 | } |
588 | 588 | |
589 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
590 | - return give_get_form_price( $form_id ); |
|
589 | + if ( ! give_has_variable_prices($form_id)) { |
|
590 | + return give_get_form_price($form_id); |
|
591 | 591 | } |
592 | 592 | |
593 | - $prices = give_get_variable_prices( $form_id ); |
|
593 | + $prices = give_get_variable_prices($form_id); |
|
594 | 594 | |
595 | 595 | $min = $min_id = 0; |
596 | 596 | |
597 | - if ( ! empty( $prices ) ) { |
|
597 | + if ( ! empty($prices)) { |
|
598 | 598 | |
599 | - foreach ( $prices as $key => $price ) { |
|
599 | + foreach ($prices as $key => $price) { |
|
600 | 600 | |
601 | - if ( empty( $price['_give_amount'] ) ) { |
|
601 | + if (empty($price['_give_amount'])) { |
|
602 | 602 | continue; |
603 | 603 | } |
604 | 604 | |
605 | - if ( ! isset( $min ) ) { |
|
605 | + if ( ! isset($min)) { |
|
606 | 606 | $min = $price['_give_amount']; |
607 | 607 | } else { |
608 | - $min = min( $min, $price['_give_amount'] ); |
|
608 | + $min = min($min, $price['_give_amount']); |
|
609 | 609 | } |
610 | 610 | |
611 | - if ( $price['_give_amount'] == $min ) { |
|
611 | + if ($price['_give_amount'] == $min) { |
|
612 | 612 | $min_id = $price['_give_id']['level_id']; |
613 | 613 | } |
614 | 614 | } |
@@ -626,45 +626,45 @@ discard block |
||
626 | 626 | * |
627 | 627 | * @return float Amount of the lowest price |
628 | 628 | */ |
629 | -function give_get_lowest_price_option( $form_id = 0 ) { |
|
630 | - if ( empty( $form_id ) ) { |
|
629 | +function give_get_lowest_price_option($form_id = 0) { |
|
630 | + if (empty($form_id)) { |
|
631 | 631 | $form_id = get_the_ID(); |
632 | 632 | } |
633 | 633 | |
634 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
635 | - return give_get_form_price( $form_id ); |
|
634 | + if ( ! give_has_variable_prices($form_id)) { |
|
635 | + return give_get_form_price($form_id); |
|
636 | 636 | } |
637 | 637 | |
638 | - $prices = give_get_variable_prices( $form_id ); |
|
638 | + $prices = give_get_variable_prices($form_id); |
|
639 | 639 | |
640 | 640 | $low = 0; |
641 | 641 | |
642 | - if ( ! empty( $prices ) ) { |
|
642 | + if ( ! empty($prices)) { |
|
643 | 643 | |
644 | 644 | $min = $min_id = 0; |
645 | 645 | |
646 | - foreach ( $prices as $key => $price ) { |
|
646 | + foreach ($prices as $key => $price) { |
|
647 | 647 | |
648 | - if ( empty( $price['_give_amount'] ) ) { |
|
648 | + if (empty($price['_give_amount'])) { |
|
649 | 649 | continue; |
650 | 650 | } |
651 | 651 | |
652 | - if ( ! isset( $min ) ) { |
|
652 | + if ( ! isset($min)) { |
|
653 | 653 | $min = $price['_give_amount']; |
654 | 654 | } else { |
655 | - $min = min( $min, give_sanitize_amount( $price['_give_amount'] ) ); |
|
655 | + $min = min($min, give_sanitize_amount($price['_give_amount'])); |
|
656 | 656 | } |
657 | 657 | |
658 | - if ( $price['_give_amount'] == $min ) { |
|
658 | + if ($price['_give_amount'] == $min) { |
|
659 | 659 | $min_id = $key; |
660 | 660 | } |
661 | 661 | } |
662 | 662 | |
663 | - $low = $prices[ $min_id ]['_give_amount']; |
|
663 | + $low = $prices[$min_id]['_give_amount']; |
|
664 | 664 | |
665 | 665 | } |
666 | 666 | |
667 | - return give_sanitize_amount( $low ); |
|
667 | + return give_sanitize_amount($low); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | /** |
@@ -676,41 +676,41 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @return float Amount of the highest price |
678 | 678 | */ |
679 | -function give_get_highest_price_option( $form_id = 0 ) { |
|
679 | +function give_get_highest_price_option($form_id = 0) { |
|
680 | 680 | |
681 | - if ( empty( $form_id ) ) { |
|
681 | + if (empty($form_id)) { |
|
682 | 682 | $form_id = get_the_ID(); |
683 | 683 | } |
684 | 684 | |
685 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
686 | - return give_get_form_price( $form_id ); |
|
685 | + if ( ! give_has_variable_prices($form_id)) { |
|
686 | + return give_get_form_price($form_id); |
|
687 | 687 | } |
688 | 688 | |
689 | - $prices = give_get_variable_prices( $form_id ); |
|
689 | + $prices = give_get_variable_prices($form_id); |
|
690 | 690 | |
691 | 691 | $high = 0.00; |
692 | 692 | |
693 | - if ( ! empty( $prices ) ) { |
|
693 | + if ( ! empty($prices)) { |
|
694 | 694 | |
695 | 695 | $max_id = $max = 0; |
696 | 696 | |
697 | - foreach ( $prices as $key => $price ) { |
|
698 | - if ( empty( $price['_give_amount'] ) ) { |
|
697 | + foreach ($prices as $key => $price) { |
|
698 | + if (empty($price['_give_amount'])) { |
|
699 | 699 | continue; |
700 | 700 | } |
701 | - $give_amount = give_sanitize_amount( $price['_give_amount'] ); |
|
701 | + $give_amount = give_sanitize_amount($price['_give_amount']); |
|
702 | 702 | |
703 | - $max = max( $max, $give_amount ); |
|
703 | + $max = max($max, $give_amount); |
|
704 | 704 | |
705 | - if ( $give_amount == $max ) { |
|
705 | + if ($give_amount == $max) { |
|
706 | 706 | $max_id = $key; |
707 | 707 | } |
708 | 708 | } |
709 | 709 | |
710 | - $high = $prices[ $max_id ]['_give_amount']; |
|
710 | + $high = $prices[$max_id]['_give_amount']; |
|
711 | 711 | } |
712 | 712 | |
713 | - return give_sanitize_amount( $high ); |
|
713 | + return give_sanitize_amount($high); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | /** |
@@ -722,15 +722,15 @@ discard block |
||
722 | 722 | * |
723 | 723 | * @return mixed string|int Price of the form |
724 | 724 | */ |
725 | -function give_get_form_price( $form_id = 0 ) { |
|
725 | +function give_get_form_price($form_id = 0) { |
|
726 | 726 | |
727 | - if ( empty( $form_id ) ) { |
|
727 | + if (empty($form_id)) { |
|
728 | 728 | return false; |
729 | 729 | } |
730 | 730 | |
731 | - $form = new Give_Donate_Form( $form_id ); |
|
731 | + $form = new Give_Donate_Form($form_id); |
|
732 | 732 | |
733 | - return $form->__get( 'price' ); |
|
733 | + return $form->__get('price'); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | /** |
@@ -742,15 +742,15 @@ discard block |
||
742 | 742 | * |
743 | 743 | * @return mixed string|int Minimum price of the form |
744 | 744 | */ |
745 | -function give_get_form_minimum_price( $form_id = 0 ) { |
|
745 | +function give_get_form_minimum_price($form_id = 0) { |
|
746 | 746 | |
747 | - if ( empty( $form_id ) ) { |
|
747 | + if (empty($form_id)) { |
|
748 | 748 | return false; |
749 | 749 | } |
750 | 750 | |
751 | - $form = new Give_Donate_Form( $form_id ); |
|
751 | + $form = new Give_Donate_Form($form_id); |
|
752 | 752 | |
753 | - return $form->__get( 'minimum_price' ); |
|
753 | + return $form->__get('minimum_price'); |
|
754 | 754 | |
755 | 755 | } |
756 | 756 | |
@@ -765,51 +765,51 @@ discard block |
||
765 | 765 | * |
766 | 766 | * @return int $formatted_price |
767 | 767 | */ |
768 | -function give_price( $form_id = 0, $echo = true, $price_id = false ) { |
|
768 | +function give_price($form_id = 0, $echo = true, $price_id = false) { |
|
769 | 769 | |
770 | - if ( empty( $form_id ) ) { |
|
770 | + if (empty($form_id)) { |
|
771 | 771 | $form_id = get_the_ID(); |
772 | 772 | } |
773 | 773 | |
774 | - if ( give_has_variable_prices( $form_id ) ) { |
|
774 | + if (give_has_variable_prices($form_id)) { |
|
775 | 775 | |
776 | - $prices = give_get_variable_prices( $form_id ); |
|
776 | + $prices = give_get_variable_prices($form_id); |
|
777 | 777 | |
778 | - if ( false !== $price_id ) { |
|
778 | + if (false !== $price_id) { |
|
779 | 779 | |
780 | 780 | // loop through multi-prices to see which is default |
781 | - foreach ( $prices as $price ) { |
|
781 | + foreach ($prices as $price) { |
|
782 | 782 | // this is the default price |
783 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
783 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
784 | 784 | $price = (float) $price['_give_amount']; |
785 | 785 | }; |
786 | 786 | } |
787 | 787 | } else { |
788 | 788 | |
789 | - $price = give_get_lowest_price_option( $form_id ); |
|
789 | + $price = give_get_lowest_price_option($form_id); |
|
790 | 790 | } |
791 | 791 | |
792 | - $price = give_sanitize_amount( $price ); |
|
792 | + $price = give_sanitize_amount($price); |
|
793 | 793 | |
794 | 794 | } else { |
795 | 795 | |
796 | - $price = give_get_form_price( $form_id ); |
|
796 | + $price = give_get_form_price($form_id); |
|
797 | 797 | |
798 | 798 | } |
799 | 799 | |
800 | - $price = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id ); |
|
801 | - $formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>'; |
|
802 | - $formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price ); |
|
800 | + $price = apply_filters('give_form_price', give_sanitize_amount($price), $form_id); |
|
801 | + $formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>'; |
|
802 | + $formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price); |
|
803 | 803 | |
804 | - if ( $echo ) { |
|
804 | + if ($echo) { |
|
805 | 805 | echo $formatted_price; |
806 | 806 | } else { |
807 | 807 | return $formatted_price; |
808 | 808 | } |
809 | 809 | } |
810 | 810 | |
811 | -add_filter( 'give_form_price', 'give_format_amount', 10 ); |
|
812 | -add_filter( 'give_form_price', 'give_currency_filter', 20 ); |
|
811 | +add_filter('give_form_price', 'give_format_amount', 10); |
|
812 | +add_filter('give_form_price', 'give_currency_filter', 20); |
|
813 | 813 | |
814 | 814 | |
815 | 815 | /** |
@@ -822,19 +822,19 @@ discard block |
||
822 | 822 | * |
823 | 823 | * @return float $amount Amount of the price option |
824 | 824 | */ |
825 | -function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) { |
|
826 | - $prices = give_get_variable_prices( $form_id ); |
|
825 | +function give_get_price_option_amount($form_id = 0, $price_id = 0) { |
|
826 | + $prices = give_get_variable_prices($form_id); |
|
827 | 827 | |
828 | 828 | $amount = 0.00; |
829 | 829 | |
830 | - foreach ( $prices as $price ) { |
|
831 | - if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) { |
|
832 | - $amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00; |
|
830 | + foreach ($prices as $price) { |
|
831 | + if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) { |
|
832 | + $amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00; |
|
833 | 833 | break; |
834 | 834 | }; |
835 | 835 | } |
836 | 836 | |
837 | - return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id ); |
|
837 | + return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | /** |
@@ -846,13 +846,13 @@ discard block |
||
846 | 846 | * |
847 | 847 | * @return mixed string|int Goal of the form |
848 | 848 | */ |
849 | -function give_get_form_goal( $form_id = 0 ) { |
|
849 | +function give_get_form_goal($form_id = 0) { |
|
850 | 850 | |
851 | - if ( empty( $form_id ) ) { |
|
851 | + if (empty($form_id)) { |
|
852 | 852 | return false; |
853 | 853 | } |
854 | 854 | |
855 | - $form = new Give_Donate_Form( $form_id ); |
|
855 | + $form = new Give_Donate_Form($form_id); |
|
856 | 856 | |
857 | 857 | return $form->goal; |
858 | 858 | |
@@ -868,27 +868,27 @@ discard block |
||
868 | 868 | * |
869 | 869 | * @return string $formatted_goal |
870 | 870 | */ |
871 | -function give_goal( $form_id = 0, $echo = true ) { |
|
871 | +function give_goal($form_id = 0, $echo = true) { |
|
872 | 872 | |
873 | - if ( empty( $form_id ) ) { |
|
873 | + if (empty($form_id)) { |
|
874 | 874 | $form_id = get_the_ID(); |
875 | 875 | } |
876 | 876 | |
877 | - $goal = give_get_form_goal( $form_id ); |
|
877 | + $goal = give_get_form_goal($form_id); |
|
878 | 878 | |
879 | - $goal = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id ); |
|
880 | - $formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>'; |
|
881 | - $formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal ); |
|
879 | + $goal = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id); |
|
880 | + $formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>'; |
|
881 | + $formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal); |
|
882 | 882 | |
883 | - if ( $echo ) { |
|
883 | + if ($echo) { |
|
884 | 884 | echo $formatted_goal; |
885 | 885 | } else { |
886 | 886 | return $formatted_goal; |
887 | 887 | } |
888 | 888 | } |
889 | 889 | |
890 | -add_filter( 'give_form_goal', 'give_format_amount', 10 ); |
|
891 | -add_filter( 'give_form_goal', 'give_currency_filter', 20 ); |
|
890 | +add_filter('give_form_goal', 'give_format_amount', 10); |
|
891 | +add_filter('give_form_goal', 'give_currency_filter', 20); |
|
892 | 892 | |
893 | 893 | |
894 | 894 | /** |
@@ -900,15 +900,15 @@ discard block |
||
900 | 900 | * |
901 | 901 | * @return bool $ret Whether or not the logged_in_only setting is set |
902 | 902 | */ |
903 | -function give_logged_in_only( $form_id ) { |
|
903 | +function give_logged_in_only($form_id) { |
|
904 | 904 | // If _give_logged_in_only is set to enable then guest can donate from that specific form. |
905 | 905 | // Otherwise it is member only donation form. |
906 | - $val = get_post_meta( $form_id, '_give_logged_in_only', true ); |
|
907 | - $val = ! empty( $val ) ? $val : 'enabled'; |
|
906 | + $val = get_post_meta($form_id, '_give_logged_in_only', true); |
|
907 | + $val = ! empty($val) ? $val : 'enabled'; |
|
908 | 908 | |
909 | - $ret = ! give_is_setting_enabled( $val ); |
|
909 | + $ret = ! give_is_setting_enabled($val); |
|
910 | 910 | |
911 | - return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id ); |
|
911 | + return (bool) apply_filters('give_logged_in_only', $ret, $form_id); |
|
912 | 912 | } |
913 | 913 | |
914 | 914 | |
@@ -921,11 +921,11 @@ discard block |
||
921 | 921 | * |
922 | 922 | * @return string |
923 | 923 | */ |
924 | -function give_show_login_register_option( $form_id ) { |
|
924 | +function give_show_login_register_option($form_id) { |
|
925 | 925 | |
926 | - $show_register_form = get_post_meta( $form_id, '_give_show_register_form', true ); |
|
926 | + $show_register_form = get_post_meta($form_id, '_give_show_register_form', true); |
|
927 | 927 | |
928 | - return apply_filters( 'give_show_register_form', $show_register_form, $form_id ); |
|
928 | + return apply_filters('give_show_register_form', $show_register_form, $form_id); |
|
929 | 929 | |
930 | 930 | } |
931 | 931 | |
@@ -941,12 +941,12 @@ discard block |
||
941 | 941 | * |
942 | 942 | * @return array |
943 | 943 | */ |
944 | -function _give_get_prefill_form_field_values( $form_id ) { |
|
944 | +function _give_get_prefill_form_field_values($form_id) { |
|
945 | 945 | $logged_in_donor_info = array(); |
946 | 946 | |
947 | - if ( is_user_logged_in() ) : |
|
948 | - $donor_data = get_userdata( get_current_user_id() ); |
|
949 | - $donor_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
947 | + if (is_user_logged_in()) : |
|
948 | + $donor_data = get_userdata(get_current_user_id()); |
|
949 | + $donor_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
950 | 950 | |
951 | 951 | $logged_in_donor_info = array( |
952 | 952 | // First name. |
@@ -959,42 +959,42 @@ discard block |
||
959 | 959 | 'give_email' => $donor_data->user_email, |
960 | 960 | |
961 | 961 | // Street address 1. |
962 | - 'card_address' => ( ! empty( $donor_address['line1'] ) ? $donor_address['line1'] : '' ), |
|
962 | + 'card_address' => ( ! empty($donor_address['line1']) ? $donor_address['line1'] : ''), |
|
963 | 963 | |
964 | 964 | // Street address 2. |
965 | - 'card_address_2' => ( ! empty( $donor_address['line2'] ) ? $donor_address['line2'] : '' ), |
|
965 | + 'card_address_2' => ( ! empty($donor_address['line2']) ? $donor_address['line2'] : ''), |
|
966 | 966 | |
967 | 967 | // Country. |
968 | - 'billing_country' => ( ! empty( $donor_address['country'] ) ? $donor_address['country'] : '' ), |
|
968 | + 'billing_country' => ( ! empty($donor_address['country']) ? $donor_address['country'] : ''), |
|
969 | 969 | |
970 | 970 | // State. |
971 | - 'card_state' => ( ! empty( $donor_address['state'] ) ? $donor_address['state'] : '' ), |
|
971 | + 'card_state' => ( ! empty($donor_address['state']) ? $donor_address['state'] : ''), |
|
972 | 972 | |
973 | 973 | // City. |
974 | - 'card_city' => ( ! empty( $donor_address['city'] ) ? $donor_address['city'] : '' ), |
|
974 | + 'card_city' => ( ! empty($donor_address['city']) ? $donor_address['city'] : ''), |
|
975 | 975 | |
976 | 976 | // Zipcode |
977 | - 'card_zip' => ( ! empty( $donor_address['zip'] ) ? $donor_address['zip'] : '' ), |
|
977 | + 'card_zip' => ( ! empty($donor_address['zip']) ? $donor_address['zip'] : ''), |
|
978 | 978 | ); |
979 | 979 | endif; |
980 | 980 | |
981 | 981 | // Bailout: Auto fill form field values only form form which donor is donating. |
982 | 982 | if ( |
983 | - empty( $_GET['form-id'] ) |
|
983 | + empty($_GET['form-id']) |
|
984 | 984 | || ! $form_id |
985 | - || ( $form_id !== absint( $_GET['form-id'] ) ) |
|
985 | + || ($form_id !== absint($_GET['form-id'])) |
|
986 | 986 | ) { |
987 | 987 | return $logged_in_donor_info; |
988 | 988 | } |
989 | 989 | |
990 | 990 | // Get purchase data. |
991 | - $give_purchase_data = Give()->session->get( 'give_purchase' ); |
|
991 | + $give_purchase_data = Give()->session->get('give_purchase'); |
|
992 | 992 | |
993 | 993 | // Get donor info from form data. |
994 | - $give_donor_info_in_session = empty( $give_purchase_data['post_data'] ) |
|
994 | + $give_donor_info_in_session = empty($give_purchase_data['post_data']) |
|
995 | 995 | ? array() |
996 | 996 | : $give_purchase_data['post_data']; |
997 | 997 | |
998 | 998 | // Output. |
999 | - return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info ); |
|
999 | + return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info); |
|
1000 | 1000 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * |
393 | 393 | * @param int|bool $payment_id A given payment |
394 | 394 | * |
395 | - * @return mixed void|false |
|
395 | + * @return false|null void|false |
|
396 | 396 | */ |
397 | 397 | public function __construct( $payment_id = false ) { |
398 | 398 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * |
464 | 464 | * @param string $name The attribute to get |
465 | 465 | * |
466 | - * @return boolean If the item is set or not |
|
466 | + * @return boolean|null If the item is set or not |
|
467 | 467 | */ |
468 | 468 | public function __isset( $name ) { |
469 | 469 | if ( property_exists( $this, $name ) ) { |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | * |
1303 | 1303 | * @param string $note The note to add |
1304 | 1304 | * |
1305 | - * @return void |
|
1305 | + * @return false|null |
|
1306 | 1306 | */ |
1307 | 1307 | public function add_note( $note = false ) { |
1308 | 1308 | // Bail if no note specified. |
@@ -1050,7 +1050,7 @@ |
||
1050 | 1050 | // Find a match between price_id and level_id. |
1051 | 1051 | // First verify array keys exists THEN make the match. |
1052 | 1052 | if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) ) |
1053 | - && $args['price_id'] == $price['_give_id']['level_id'] |
|
1053 | + && $args['price_id'] == $price['_give_id']['level_id'] |
|
1054 | 1054 | ) { |
1055 | 1055 | $item_price = $price['_give_amount']; |
1056 | 1056 | } |
@@ -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 | |
@@ -394,13 +394,13 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @return mixed void|false |
396 | 396 | */ |
397 | - public function __construct( $payment_id = false ) { |
|
397 | + public function __construct($payment_id = false) { |
|
398 | 398 | |
399 | - if ( empty( $payment_id ) ) { |
|
399 | + if (empty($payment_id)) { |
|
400 | 400 | return false; |
401 | 401 | } |
402 | 402 | |
403 | - $this->setup_payment( $payment_id ); |
|
403 | + $this->setup_payment($payment_id); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | * |
414 | 414 | * @return mixed The value. |
415 | 415 | */ |
416 | - public function __get( $key ) { |
|
416 | + public function __get($key) { |
|
417 | 417 | |
418 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
418 | + if (method_exists($this, 'get_'.$key)) { |
|
419 | 419 | |
420 | - $value = call_user_func( array( $this, 'get_' . $key ) ); |
|
420 | + $value = call_user_func(array($this, 'get_'.$key)); |
|
421 | 421 | |
422 | 422 | } else { |
423 | 423 | |
@@ -439,18 +439,18 @@ discard block |
||
439 | 439 | * @param string $key The property name |
440 | 440 | * @param mixed $value The value of the property |
441 | 441 | */ |
442 | - public function __set( $key, $value ) { |
|
443 | - $ignore = array( '_ID' ); |
|
442 | + public function __set($key, $value) { |
|
443 | + $ignore = array('_ID'); |
|
444 | 444 | |
445 | - if ( $key === 'status' ) { |
|
445 | + if ($key === 'status') { |
|
446 | 446 | $this->old_status = $this->status; |
447 | 447 | } |
448 | 448 | |
449 | - if ( ! in_array( $key, $ignore ) ) { |
|
450 | - $this->pending[ $key ] = $value; |
|
449 | + if ( ! in_array($key, $ignore)) { |
|
450 | + $this->pending[$key] = $value; |
|
451 | 451 | } |
452 | 452 | |
453 | - if ( '_ID' !== $key ) { |
|
453 | + if ('_ID' !== $key) { |
|
454 | 454 | $this->$key = $value; |
455 | 455 | } |
456 | 456 | } |
@@ -465,9 +465,9 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @return boolean If the item is set or not |
467 | 467 | */ |
468 | - public function __isset( $name ) { |
|
469 | - if ( property_exists( $this, $name ) ) { |
|
470 | - return false === empty( $this->$name ); |
|
468 | + public function __isset($name) { |
|
469 | + if (property_exists($this, $name)) { |
|
470 | + return false === empty($this->$name); |
|
471 | 471 | } else { |
472 | 472 | return null; |
473 | 473 | } |
@@ -483,20 +483,20 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @return bool If the setup was successful or not |
485 | 485 | */ |
486 | - private function setup_payment( $payment_id ) { |
|
486 | + private function setup_payment($payment_id) { |
|
487 | 487 | $this->pending = array(); |
488 | 488 | |
489 | - if ( empty( $payment_id ) ) { |
|
489 | + if (empty($payment_id)) { |
|
490 | 490 | return false; |
491 | 491 | } |
492 | 492 | |
493 | - $payment = get_post( $payment_id ); |
|
493 | + $payment = get_post($payment_id); |
|
494 | 494 | |
495 | - if ( ! $payment || is_wp_error( $payment ) ) { |
|
495 | + if ( ! $payment || is_wp_error($payment)) { |
|
496 | 496 | return false; |
497 | 497 | } |
498 | 498 | |
499 | - if ( 'give_payment' !== $payment->post_type ) { |
|
499 | + if ('give_payment' !== $payment->post_type) { |
|
500 | 500 | return false; |
501 | 501 | } |
502 | 502 | |
@@ -510,13 +510,13 @@ discard block |
||
510 | 510 | * @param Give_Payment $this Payment object. |
511 | 511 | * @param int $payment_id The ID of the payment. |
512 | 512 | */ |
513 | - do_action( 'give_pre_setup_payment', $this, $payment_id ); |
|
513 | + do_action('give_pre_setup_payment', $this, $payment_id); |
|
514 | 514 | |
515 | 515 | // Primary Identifier. |
516 | - $this->ID = absint( $payment_id ); |
|
516 | + $this->ID = absint($payment_id); |
|
517 | 517 | |
518 | 518 | // Protected ID that can never be changed. |
519 | - $this->_ID = absint( $payment_id ); |
|
519 | + $this->_ID = absint($payment_id); |
|
520 | 520 | |
521 | 521 | // We have a payment, get the generic payment_meta item to reduce calls to it. |
522 | 522 | $this->payment_meta = $this->get_meta(); |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $this->parent_payment = $payment->post_parent; |
532 | 532 | |
533 | 533 | $all_payment_statuses = give_get_payment_statuses(); |
534 | - $this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status ); |
|
534 | + $this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status); |
|
535 | 535 | |
536 | 536 | // Items. |
537 | 537 | $this->fees = $this->setup_fees(); |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | * @param Give_Payment $this Payment object. |
574 | 574 | * @param int $payment_id The ID of the payment. |
575 | 575 | */ |
576 | - do_action( 'give_setup_payment', $this, $payment_id ); |
|
576 | + do_action('give_setup_payment', $this, $payment_id); |
|
577 | 577 | |
578 | 578 | return true; |
579 | 579 | } |
@@ -591,8 +591,8 @@ discard block |
||
591 | 591 | * |
592 | 592 | * @return void |
593 | 593 | */ |
594 | - public function update_payment_setup( $payment_id ) { |
|
595 | - $this->setup_payment( $payment_id ); |
|
594 | + public function update_payment_setup($payment_id) { |
|
595 | + $this->setup_payment($payment_id); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | /** |
@@ -607,24 +607,24 @@ discard block |
||
607 | 607 | |
608 | 608 | // Construct the payment title. |
609 | 609 | $payment_title = ''; |
610 | - if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) { |
|
611 | - $payment_title = $this->first_name . ' ' . $this->last_name; |
|
612 | - } elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) { |
|
610 | + if ( ! empty($this->first_name) && ! empty($this->last_name)) { |
|
611 | + $payment_title = $this->first_name.' '.$this->last_name; |
|
612 | + } elseif ( ! empty($this->first_name) && empty($this->last_name)) { |
|
613 | 613 | $payment_title = $this->first_name; |
614 | - } elseif ( ! empty( $this->email ) && is_email( $this->email ) ) { |
|
614 | + } elseif ( ! empty($this->email) && is_email($this->email)) { |
|
615 | 615 | $payment_title = $this->email; |
616 | 616 | } |
617 | 617 | |
618 | 618 | // Set Key. |
619 | - if ( empty( $this->key ) ) { |
|
619 | + if (empty($this->key)) { |
|
620 | 620 | |
621 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
622 | - $this->key = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ); // Unique key |
|
621 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
622 | + $this->key = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key |
|
623 | 623 | $this->pending['key'] = $this->key; |
624 | 624 | } |
625 | 625 | |
626 | 626 | // Set IP. |
627 | - if ( empty( $this->ip ) ) { |
|
627 | + if (empty($this->ip)) { |
|
628 | 628 | |
629 | 629 | $this->ip = give_get_ip(); |
630 | 630 | $this->pending['ip'] = $this->ip; |
@@ -651,63 +651,63 @@ discard block |
||
651 | 651 | 'fees' => $this->fees, |
652 | 652 | ); |
653 | 653 | |
654 | - $args = apply_filters( 'give_insert_payment_args', array( |
|
654 | + $args = apply_filters('give_insert_payment_args', array( |
|
655 | 655 | 'post_title' => $payment_title, |
656 | 656 | 'post_status' => $this->status, |
657 | 657 | 'post_type' => 'give_payment', |
658 | - 'post_date' => ! empty( $this->date ) ? $this->date : null, |
|
659 | - 'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null, |
|
658 | + 'post_date' => ! empty($this->date) ? $this->date : null, |
|
659 | + 'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null, |
|
660 | 660 | 'post_parent' => $this->parent_payment, |
661 | - ), $payment_data ); |
|
661 | + ), $payment_data); |
|
662 | 662 | |
663 | 663 | // Create a blank payment |
664 | - $payment_id = wp_insert_post( $args ); |
|
664 | + $payment_id = wp_insert_post($args); |
|
665 | 665 | |
666 | - if ( ! empty( $payment_id ) ) { |
|
666 | + if ( ! empty($payment_id)) { |
|
667 | 667 | |
668 | 668 | $this->ID = $payment_id; |
669 | 669 | $this->_ID = $payment_id; |
670 | 670 | |
671 | 671 | $customer = new stdClass; |
672 | 672 | |
673 | - if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) { |
|
674 | - $customer = new Give_Customer( get_current_user_id(), true ); |
|
673 | + if (did_action('give_pre_process_donation') && is_user_logged_in()) { |
|
674 | + $customer = new Give_Customer(get_current_user_id(), true); |
|
675 | 675 | |
676 | 676 | // Customer is logged in but used a different email to purchase with so assign to their customer record |
677 | - if ( ! empty( $customer->id ) && $this->email != $customer->email ) { |
|
678 | - $customer->add_email( $this->email ); |
|
677 | + if ( ! empty($customer->id) && $this->email != $customer->email) { |
|
678 | + $customer->add_email($this->email); |
|
679 | 679 | } |
680 | 680 | } |
681 | 681 | |
682 | - if ( empty( $customer->id ) ) { |
|
683 | - $customer = new Give_Customer( $this->email ); |
|
682 | + if (empty($customer->id)) { |
|
683 | + $customer = new Give_Customer($this->email); |
|
684 | 684 | } |
685 | 685 | |
686 | - if ( empty( $customer->id ) ) { |
|
686 | + if (empty($customer->id)) { |
|
687 | 687 | |
688 | 688 | $customer_data = array( |
689 | - 'name' => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '', |
|
689 | + 'name' => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '', |
|
690 | 690 | 'email' => $this->email, |
691 | 691 | 'user_id' => $this->user_id, |
692 | 692 | ); |
693 | 693 | |
694 | - $customer->create( $customer_data ); |
|
694 | + $customer->create($customer_data); |
|
695 | 695 | |
696 | 696 | } |
697 | 697 | |
698 | 698 | $this->customer_id = $customer->id; |
699 | 699 | $this->pending['customer_id'] = $this->customer_id; |
700 | - $customer->attach_payment( $this->ID, false ); |
|
700 | + $customer->attach_payment($this->ID, false); |
|
701 | 701 | |
702 | - $this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data ); |
|
703 | - if ( ! empty( $this->payment_meta['fees'] ) ) { |
|
704 | - $this->fees = array_merge( $this->fees, $this->payment_meta['fees'] ); |
|
705 | - foreach ( $this->fees as $fee ) { |
|
706 | - $this->increase_fees( $fee['amount'] ); |
|
702 | + $this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data); |
|
703 | + if ( ! empty($this->payment_meta['fees'])) { |
|
704 | + $this->fees = array_merge($this->fees, $this->payment_meta['fees']); |
|
705 | + foreach ($this->fees as $fee) { |
|
706 | + $this->increase_fees($fee['amount']); |
|
707 | 707 | } |
708 | 708 | } |
709 | 709 | |
710 | - $this->update_meta( '_give_payment_meta', $this->payment_meta ); |
|
710 | + $this->update_meta('_give_payment_meta', $this->payment_meta); |
|
711 | 711 | $this->new = true; |
712 | 712 | } |
713 | 713 | |
@@ -729,11 +729,11 @@ discard block |
||
729 | 729 | $saved = false; |
730 | 730 | |
731 | 731 | // Must have an ID. |
732 | - if ( empty( $this->ID ) ) { |
|
732 | + if (empty($this->ID)) { |
|
733 | 733 | |
734 | 734 | $payment_id = $this->insert_payment(); |
735 | 735 | |
736 | - if ( false === $payment_id ) { |
|
736 | + if (false === $payment_id) { |
|
737 | 737 | $saved = false; |
738 | 738 | } else { |
739 | 739 | $this->ID = $payment_id; |
@@ -741,48 +741,48 @@ discard block |
||
741 | 741 | } |
742 | 742 | |
743 | 743 | // Set ID if not matching. |
744 | - if ( $this->ID !== $this->_ID ) { |
|
744 | + if ($this->ID !== $this->_ID) { |
|
745 | 745 | $this->ID = $this->_ID; |
746 | 746 | } |
747 | 747 | |
748 | 748 | // If we have something pending, let's save it. |
749 | - if ( ! empty( $this->pending ) ) { |
|
749 | + if ( ! empty($this->pending)) { |
|
750 | 750 | |
751 | 751 | $total_increase = 0; |
752 | 752 | $total_decrease = 0; |
753 | 753 | |
754 | - foreach ( $this->pending as $key => $value ) { |
|
754 | + foreach ($this->pending as $key => $value) { |
|
755 | 755 | |
756 | - switch ( $key ) { |
|
756 | + switch ($key) { |
|
757 | 757 | |
758 | 758 | case 'donations': |
759 | 759 | // Update totals for pending donations. |
760 | - foreach ( $this->pending[ $key ] as $item ) { |
|
760 | + foreach ($this->pending[$key] as $item) { |
|
761 | 761 | |
762 | - $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; |
|
763 | - $price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0; |
|
762 | + $quantity = isset($item['quantity']) ? $item['quantity'] : 1; |
|
763 | + $price_id = isset($item['price_id']) ? $item['price_id'] : 0; |
|
764 | 764 | |
765 | - switch ( $item['action'] ) { |
|
765 | + switch ($item['action']) { |
|
766 | 766 | |
767 | 767 | case 'add': |
768 | 768 | |
769 | 769 | $price = $item['price']; |
770 | 770 | |
771 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
771 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
772 | 772 | |
773 | 773 | // Add sales logs. |
774 | - $log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) ); |
|
774 | + $log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp')); |
|
775 | 775 | |
776 | 776 | $y = 0; |
777 | - while ( $y < $quantity ) { |
|
777 | + while ($y < $quantity) { |
|
778 | 778 | |
779 | - give_record_sale_in_log( $item['id'], $this->ID, $price_id, $log_date ); |
|
780 | - $y ++; |
|
779 | + give_record_sale_in_log($item['id'], $this->ID, $price_id, $log_date); |
|
780 | + $y++; |
|
781 | 781 | } |
782 | 782 | |
783 | - $form = new Give_Donate_Form( $item['id'] ); |
|
784 | - $form->increase_sales( $quantity ); |
|
785 | - $form->increase_earnings( $price ); |
|
783 | + $form = new Give_Donate_Form($item['id']); |
|
784 | + $form->increase_sales($quantity); |
|
785 | + $form->increase_earnings($price); |
|
786 | 786 | |
787 | 787 | $total_increase += $price; |
788 | 788 | } |
@@ -807,15 +807,15 @@ discard block |
||
807 | 807 | ), |
808 | 808 | ); |
809 | 809 | |
810 | - $found_logs = get_posts( $log_args ); |
|
811 | - foreach ( $found_logs as $log ) { |
|
812 | - wp_delete_post( $log->ID, true ); |
|
810 | + $found_logs = get_posts($log_args); |
|
811 | + foreach ($found_logs as $log) { |
|
812 | + wp_delete_post($log->ID, true); |
|
813 | 813 | } |
814 | 814 | |
815 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
816 | - $form = new Give_Donate_Form( $item['id'] ); |
|
817 | - $form->decrease_sales( $quantity ); |
|
818 | - $form->decrease_earnings( $item['amount'] ); |
|
815 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
816 | + $form = new Give_Donate_Form($item['id']); |
|
817 | + $form->decrease_sales($quantity); |
|
818 | + $form->decrease_earnings($item['amount']); |
|
819 | 819 | |
820 | 820 | $total_decrease += $item['amount']; |
821 | 821 | } |
@@ -827,17 +827,17 @@ discard block |
||
827 | 827 | |
828 | 828 | case 'fees': |
829 | 829 | |
830 | - if ( 'publish' !== $this->status && 'complete' !== $this->status ) { |
|
830 | + if ('publish' !== $this->status && 'complete' !== $this->status) { |
|
831 | 831 | break; |
832 | 832 | } |
833 | 833 | |
834 | - if ( empty( $this->pending[ $key ] ) ) { |
|
834 | + if (empty($this->pending[$key])) { |
|
835 | 835 | break; |
836 | 836 | } |
837 | 837 | |
838 | - foreach ( $this->pending[ $key ] as $fee ) { |
|
838 | + foreach ($this->pending[$key] as $fee) { |
|
839 | 839 | |
840 | - switch ( $fee['action'] ) { |
|
840 | + switch ($fee['action']) { |
|
841 | 841 | |
842 | 842 | case 'add': |
843 | 843 | $total_increase += $fee['amount']; |
@@ -853,43 +853,43 @@ discard block |
||
853 | 853 | break; |
854 | 854 | |
855 | 855 | case 'status': |
856 | - $this->update_status( $this->status ); |
|
856 | + $this->update_status($this->status); |
|
857 | 857 | break; |
858 | 858 | |
859 | 859 | case 'gateway': |
860 | - $this->update_meta( '_give_payment_gateway', $this->gateway ); |
|
860 | + $this->update_meta('_give_payment_gateway', $this->gateway); |
|
861 | 861 | break; |
862 | 862 | |
863 | 863 | case 'mode': |
864 | - $this->update_meta( '_give_payment_mode', $this->mode ); |
|
864 | + $this->update_meta('_give_payment_mode', $this->mode); |
|
865 | 865 | break; |
866 | 866 | |
867 | 867 | case 'transaction_id': |
868 | - $this->update_meta( '_give_payment_transaction_id', $this->transaction_id ); |
|
868 | + $this->update_meta('_give_payment_transaction_id', $this->transaction_id); |
|
869 | 869 | break; |
870 | 870 | |
871 | 871 | case 'ip': |
872 | - $this->update_meta( '_give_payment_user_ip', $this->ip ); |
|
872 | + $this->update_meta('_give_payment_user_ip', $this->ip); |
|
873 | 873 | break; |
874 | 874 | |
875 | 875 | case 'customer_id': |
876 | - $this->update_meta( '_give_payment_customer_id', $this->customer_id ); |
|
876 | + $this->update_meta('_give_payment_customer_id', $this->customer_id); |
|
877 | 877 | break; |
878 | 878 | |
879 | 879 | case 'user_id': |
880 | - $this->update_meta( '_give_payment_user_id', $this->user_id ); |
|
880 | + $this->update_meta('_give_payment_user_id', $this->user_id); |
|
881 | 881 | break; |
882 | 882 | |
883 | 883 | case 'form_title': |
884 | - $this->update_meta( '_give_payment_form_title', $this->form_title ); |
|
884 | + $this->update_meta('_give_payment_form_title', $this->form_title); |
|
885 | 885 | break; |
886 | 886 | |
887 | 887 | case 'form_id': |
888 | - $this->update_meta( '_give_payment_form_id', $this->form_id ); |
|
888 | + $this->update_meta('_give_payment_form_id', $this->form_id); |
|
889 | 889 | break; |
890 | 890 | |
891 | 891 | case 'price_id': |
892 | - $this->update_meta( '_give_payment_price_id', $this->price_id ); |
|
892 | + $this->update_meta('_give_payment_price_id', $this->price_id); |
|
893 | 893 | break; |
894 | 894 | |
895 | 895 | case 'first_name': |
@@ -905,15 +905,15 @@ discard block |
||
905 | 905 | break; |
906 | 906 | |
907 | 907 | case 'email': |
908 | - $this->update_meta( '_give_payment_user_email', $this->email ); |
|
908 | + $this->update_meta('_give_payment_user_email', $this->email); |
|
909 | 909 | break; |
910 | 910 | |
911 | 911 | case 'key': |
912 | - $this->update_meta( '_give_payment_purchase_key', $this->key ); |
|
912 | + $this->update_meta('_give_payment_purchase_key', $this->key); |
|
913 | 913 | break; |
914 | 914 | |
915 | 915 | case 'number': |
916 | - $this->update_meta( '_give_payment_number', $this->number ); |
|
916 | + $this->update_meta('_give_payment_number', $this->number); |
|
917 | 917 | break; |
918 | 918 | |
919 | 919 | case 'date': |
@@ -923,11 +923,11 @@ discard block |
||
923 | 923 | 'edit_date' => true, |
924 | 924 | ); |
925 | 925 | |
926 | - wp_update_post( $args ); |
|
926 | + wp_update_post($args); |
|
927 | 927 | break; |
928 | 928 | |
929 | 929 | case 'completed_date': |
930 | - $this->update_meta( '_give_completed_date', $this->completed_date ); |
|
930 | + $this->update_meta('_give_completed_date', $this->completed_date); |
|
931 | 931 | break; |
932 | 932 | |
933 | 933 | case 'parent_payment': |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | 'post_parent' => $this->parent_payment, |
937 | 937 | ); |
938 | 938 | |
939 | - wp_update_post( $args ); |
|
939 | + wp_update_post($args); |
|
940 | 940 | break; |
941 | 941 | |
942 | 942 | default: |
@@ -947,33 +947,33 @@ discard block |
||
947 | 947 | * |
948 | 948 | * @param Give_Payment $this Payment object. |
949 | 949 | */ |
950 | - do_action( 'give_payment_save', $this, $key ); |
|
950 | + do_action('give_payment_save', $this, $key); |
|
951 | 951 | break; |
952 | 952 | } |
953 | 953 | } |
954 | 954 | |
955 | - if ( 'pending' !== $this->status ) { |
|
955 | + if ('pending' !== $this->status) { |
|
956 | 956 | |
957 | - $customer = new Give_Customer( $this->customer_id ); |
|
957 | + $customer = new Give_Customer($this->customer_id); |
|
958 | 958 | |
959 | 959 | $total_change = $total_increase - $total_decrease; |
960 | - if ( $total_change < 0 ) { |
|
960 | + if ($total_change < 0) { |
|
961 | 961 | |
962 | - $total_change = - ( $total_change ); |
|
962 | + $total_change = - ($total_change); |
|
963 | 963 | // Decrease the customer's donation stats. |
964 | - $customer->decrease_value( $total_change ); |
|
965 | - give_decrease_total_earnings( $total_change ); |
|
964 | + $customer->decrease_value($total_change); |
|
965 | + give_decrease_total_earnings($total_change); |
|
966 | 966 | |
967 | - } elseif ( $total_change > 0 ) { |
|
967 | + } elseif ($total_change > 0) { |
|
968 | 968 | |
969 | 969 | // Increase the customer's donation stats. |
970 | - $customer->increase_value( $total_change ); |
|
971 | - give_increase_total_earnings( $total_change ); |
|
970 | + $customer->increase_value($total_change); |
|
971 | + give_increase_total_earnings($total_change); |
|
972 | 972 | |
973 | 973 | } |
974 | 974 | } |
975 | 975 | |
976 | - $this->update_meta( '_give_payment_total', $this->total ); |
|
976 | + $this->update_meta('_give_payment_total', $this->total); |
|
977 | 977 | |
978 | 978 | $new_meta = array( |
979 | 979 | 'form_title' => $this->form_title, |
@@ -985,12 +985,12 @@ discard block |
||
985 | 985 | ); |
986 | 986 | |
987 | 987 | $meta = $this->get_meta(); |
988 | - $merged_meta = array_merge( $meta, $new_meta ); |
|
988 | + $merged_meta = array_merge($meta, $new_meta); |
|
989 | 989 | |
990 | 990 | // Only save the payment meta if it's changed. |
991 | - if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) { |
|
992 | - $updated = $this->update_meta( '_give_payment_meta', $merged_meta ); |
|
993 | - if ( false !== $updated ) { |
|
991 | + if (md5(serialize($meta)) !== md5(serialize($merged_meta))) { |
|
992 | + $updated = $this->update_meta('_give_payment_meta', $merged_meta); |
|
993 | + if (false !== $updated) { |
|
994 | 994 | $saved = true; |
995 | 995 | } |
996 | 996 | } |
@@ -999,8 +999,8 @@ discard block |
||
999 | 999 | $saved = true; |
1000 | 1000 | } |
1001 | 1001 | |
1002 | - if ( true === $saved ) { |
|
1003 | - $this->setup_payment( $this->ID ); |
|
1002 | + if (true === $saved) { |
|
1003 | + $this->setup_payment($this->ID); |
|
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | return $saved; |
@@ -1018,12 +1018,12 @@ discard block |
||
1018 | 1018 | * |
1019 | 1019 | * @return bool True when successful, false otherwise |
1020 | 1020 | */ |
1021 | - public function add_donation( $form_id = 0, $args = array(), $options = array() ) { |
|
1021 | + public function add_donation($form_id = 0, $args = array(), $options = array()) { |
|
1022 | 1022 | |
1023 | - $donation = new Give_Donate_Form( $form_id ); |
|
1023 | + $donation = new Give_Donate_Form($form_id); |
|
1024 | 1024 | |
1025 | 1025 | // Bail if this post isn't a give donation form. |
1026 | - if ( ! $donation || $donation->post_type !== 'give_forms' ) { |
|
1026 | + if ( ! $donation || $donation->post_type !== 'give_forms') { |
|
1027 | 1027 | return false; |
1028 | 1028 | } |
1029 | 1029 | |
@@ -1034,59 +1034,59 @@ discard block |
||
1034 | 1034 | 'fees' => array(), |
1035 | 1035 | ); |
1036 | 1036 | |
1037 | - $args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults ); |
|
1037 | + $args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults); |
|
1038 | 1038 | |
1039 | 1039 | // Allow overriding the price. |
1040 | - if ( false !== $args['price'] ) { |
|
1040 | + if (false !== $args['price']) { |
|
1041 | 1041 | $item_price = $args['price']; |
1042 | 1042 | } else { |
1043 | 1043 | |
1044 | 1044 | // Deal with variable pricing. |
1045 | - if ( give_has_variable_prices( $donation->ID ) ) { |
|
1046 | - $prices = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) ); |
|
1045 | + if (give_has_variable_prices($donation->ID)) { |
|
1046 | + $prices = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true)); |
|
1047 | 1047 | $item_price = ''; |
1048 | 1048 | // Loop through prices. |
1049 | - foreach ( $prices as $price ) { |
|
1049 | + foreach ($prices as $price) { |
|
1050 | 1050 | // Find a match between price_id and level_id. |
1051 | 1051 | // First verify array keys exists THEN make the match. |
1052 | - if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) ) |
|
1052 | + if ((isset($args['price_id']) && isset($price['_give_id']['level_id'])) |
|
1053 | 1053 | && $args['price_id'] == $price['_give_id']['level_id'] |
1054 | 1054 | ) { |
1055 | 1055 | $item_price = $price['_give_amount']; |
1056 | 1056 | } |
1057 | 1057 | } |
1058 | 1058 | // Fallback to the lowest price point. |
1059 | - if ( $item_price == '' ) { |
|
1060 | - $item_price = give_get_lowest_price_option( $donation->ID ); |
|
1061 | - $args['price_id'] = give_get_lowest_price_id( $donation->ID ); |
|
1059 | + if ($item_price == '') { |
|
1060 | + $item_price = give_get_lowest_price_option($donation->ID); |
|
1061 | + $args['price_id'] = give_get_lowest_price_id($donation->ID); |
|
1062 | 1062 | } |
1063 | 1063 | } else { |
1064 | 1064 | // Simple form price. |
1065 | - $item_price = give_get_form_price( $donation->ID ); |
|
1065 | + $item_price = give_get_form_price($donation->ID); |
|
1066 | 1066 | } |
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | // Sanitizing the price here so we don't have a dozen calls later. |
1070 | - $item_price = give_sanitize_amount( $item_price ); |
|
1071 | - $total = round( $item_price, give_currency_decimal_filter() ); |
|
1070 | + $item_price = give_sanitize_amount($item_price); |
|
1071 | + $total = round($item_price, give_currency_decimal_filter()); |
|
1072 | 1072 | |
1073 | 1073 | // Add Options. |
1074 | 1074 | $default_options = array(); |
1075 | - if ( false !== $args['price_id'] ) { |
|
1075 | + if (false !== $args['price_id']) { |
|
1076 | 1076 | $default_options['price_id'] = (int) $args['price_id']; |
1077 | 1077 | } |
1078 | - $options = wp_parse_args( $options, $default_options ); |
|
1078 | + $options = wp_parse_args($options, $default_options); |
|
1079 | 1079 | |
1080 | 1080 | // Do not allow totals to go negative. |
1081 | - if ( $total < 0 ) { |
|
1081 | + if ($total < 0) { |
|
1082 | 1082 | $total = 0; |
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | $donation = array( |
1086 | 1086 | 'name' => $donation->post_title, |
1087 | 1087 | 'id' => $donation->ID, |
1088 | - 'price' => round( $total, give_currency_decimal_filter() ), |
|
1089 | - 'subtotal' => round( $total, give_currency_decimal_filter() ), |
|
1088 | + 'price' => round($total, give_currency_decimal_filter()), |
|
1089 | + 'subtotal' => round($total, give_currency_decimal_filter()), |
|
1090 | 1090 | 'fees' => $args['fees'], |
1091 | 1091 | 'price_id' => $args['price_id'], |
1092 | 1092 | 'action' => 'add', |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | $this->pending['donations'][] = $donation; |
1097 | 1097 | |
1098 | - $this->increase_subtotal( $total ); |
|
1098 | + $this->increase_subtotal($total); |
|
1099 | 1099 | |
1100 | 1100 | return true; |
1101 | 1101 | |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | * |
1113 | 1113 | * @return bool If the item was removed or not |
1114 | 1114 | */ |
1115 | - public function remove_donation( $form_id, $args = array() ) { |
|
1115 | + public function remove_donation($form_id, $args = array()) { |
|
1116 | 1116 | |
1117 | 1117 | // Set some defaults. |
1118 | 1118 | $defaults = array( |
@@ -1120,12 +1120,12 @@ discard block |
||
1120 | 1120 | 'price' => false, |
1121 | 1121 | 'price_id' => false, |
1122 | 1122 | ); |
1123 | - $args = wp_parse_args( $args, $defaults ); |
|
1123 | + $args = wp_parse_args($args, $defaults); |
|
1124 | 1124 | |
1125 | - $form = new Give_Donate_Form( $form_id ); |
|
1125 | + $form = new Give_Donate_Form($form_id); |
|
1126 | 1126 | |
1127 | 1127 | // Bail if this post isn't a valid give donation form. |
1128 | - if ( ! $form || $form->post_type !== 'give_forms' ) { |
|
1128 | + if ( ! $form || $form->post_type !== 'give_forms') { |
|
1129 | 1129 | return false; |
1130 | 1130 | } |
1131 | 1131 | |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | |
1139 | 1139 | $this->pending['donations'][] = $pending_args; |
1140 | 1140 | |
1141 | - $this->decrease_subtotal( $this->total ); |
|
1141 | + $this->decrease_subtotal($this->total); |
|
1142 | 1142 | |
1143 | 1143 | return true; |
1144 | 1144 | } |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | * |
1155 | 1155 | * @return bool If the fee was added |
1156 | 1156 | */ |
1157 | - public function add_fee( $args, $global = true ) { |
|
1157 | + public function add_fee($args, $global = true) { |
|
1158 | 1158 | |
1159 | 1159 | $default_args = array( |
1160 | 1160 | 'label' => '', |
@@ -1164,15 +1164,15 @@ discard block |
||
1164 | 1164 | 'price_id' => 0, |
1165 | 1165 | ); |
1166 | 1166 | |
1167 | - $fee = wp_parse_args( $args, $default_args ); |
|
1167 | + $fee = wp_parse_args($args, $default_args); |
|
1168 | 1168 | $this->fees[] = $fee; |
1169 | 1169 | |
1170 | 1170 | $added_fee = $fee; |
1171 | 1171 | $added_fee['action'] = 'add'; |
1172 | 1172 | $this->pending['fees'][] = $added_fee; |
1173 | - reset( $this->fees ); |
|
1173 | + reset($this->fees); |
|
1174 | 1174 | |
1175 | - $this->increase_fees( $fee['amount'] ); |
|
1175 | + $this->increase_fees($fee['amount']); |
|
1176 | 1176 | |
1177 | 1177 | return true; |
1178 | 1178 | } |
@@ -1187,11 +1187,11 @@ discard block |
||
1187 | 1187 | * |
1188 | 1188 | * @return bool If the fee was removed successfully |
1189 | 1189 | */ |
1190 | - public function remove_fee( $key ) { |
|
1190 | + public function remove_fee($key) { |
|
1191 | 1191 | $removed = false; |
1192 | 1192 | |
1193 | - if ( is_numeric( $key ) ) { |
|
1194 | - $removed = $this->remove_fee_by( 'index', $key ); |
|
1193 | + if (is_numeric($key)) { |
|
1194 | + $removed = $this->remove_fee_by('index', $key); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | return $removed; |
@@ -1210,55 +1210,55 @@ discard block |
||
1210 | 1210 | * |
1211 | 1211 | * @return boolean If the item is removed |
1212 | 1212 | */ |
1213 | - public function remove_fee_by( $key, $value, $global = false ) { |
|
1213 | + public function remove_fee_by($key, $value, $global = false) { |
|
1214 | 1214 | |
1215 | - $allowed_fee_keys = apply_filters( 'give_payment_fee_keys', array( |
|
1215 | + $allowed_fee_keys = apply_filters('give_payment_fee_keys', array( |
|
1216 | 1216 | 'index', |
1217 | 1217 | 'label', |
1218 | 1218 | 'amount', |
1219 | 1219 | 'type', |
1220 | - ) ); |
|
1220 | + )); |
|
1221 | 1221 | |
1222 | - if ( ! in_array( $key, $allowed_fee_keys ) ) { |
|
1222 | + if ( ! in_array($key, $allowed_fee_keys)) { |
|
1223 | 1223 | return false; |
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | $removed = false; |
1227 | - if ( 'index' === $key && array_key_exists( $value, $this->fees ) ) { |
|
1227 | + if ('index' === $key && array_key_exists($value, $this->fees)) { |
|
1228 | 1228 | |
1229 | - $removed_fee = $this->fees[ $value ]; |
|
1229 | + $removed_fee = $this->fees[$value]; |
|
1230 | 1230 | $removed_fee['action'] = 'remove'; |
1231 | 1231 | $this->pending['fees'][] = $removed_fee; |
1232 | 1232 | |
1233 | - $this->decrease_fees( $removed_fee['amount'] ); |
|
1233 | + $this->decrease_fees($removed_fee['amount']); |
|
1234 | 1234 | |
1235 | - unset( $this->fees[ $value ] ); |
|
1235 | + unset($this->fees[$value]); |
|
1236 | 1236 | $removed = true; |
1237 | 1237 | |
1238 | - } elseif ( 'index' !== $key ) { |
|
1238 | + } elseif ('index' !== $key) { |
|
1239 | 1239 | |
1240 | - foreach ( $this->fees as $index => $fee ) { |
|
1240 | + foreach ($this->fees as $index => $fee) { |
|
1241 | 1241 | |
1242 | - if ( isset( $fee[ $key ] ) && $fee[ $key ] == $value ) { |
|
1242 | + if (isset($fee[$key]) && $fee[$key] == $value) { |
|
1243 | 1243 | |
1244 | 1244 | $removed_fee = $fee; |
1245 | 1245 | $removed_fee['action'] = 'remove'; |
1246 | 1246 | $this->pending['fees'][] = $removed_fee; |
1247 | 1247 | |
1248 | - $this->decrease_fees( $removed_fee['amount'] ); |
|
1248 | + $this->decrease_fees($removed_fee['amount']); |
|
1249 | 1249 | |
1250 | - unset( $this->fees[ $index ] ); |
|
1250 | + unset($this->fees[$index]); |
|
1251 | 1251 | $removed = true; |
1252 | 1252 | |
1253 | - if ( false === $global ) { |
|
1253 | + if (false === $global) { |
|
1254 | 1254 | break; |
1255 | 1255 | } |
1256 | 1256 | } |
1257 | 1257 | } |
1258 | 1258 | } |
1259 | 1259 | |
1260 | - if ( true === $removed ) { |
|
1261 | - $this->fees = array_values( $this->fees ); |
|
1260 | + if (true === $removed) { |
|
1261 | + $this->fees = array_values($this->fees); |
|
1262 | 1262 | } |
1263 | 1263 | |
1264 | 1264 | return $removed; |
@@ -1274,14 +1274,14 @@ discard block |
||
1274 | 1274 | * |
1275 | 1275 | * @return array The Fees for the type specified |
1276 | 1276 | */ |
1277 | - public function get_fees( $type = 'all' ) { |
|
1277 | + public function get_fees($type = 'all') { |
|
1278 | 1278 | $fees = array(); |
1279 | 1279 | |
1280 | - if ( ! empty( $this->fees ) && is_array( $this->fees ) ) { |
|
1280 | + if ( ! empty($this->fees) && is_array($this->fees)) { |
|
1281 | 1281 | |
1282 | - foreach ( $this->fees as $fee_id => $fee ) { |
|
1282 | + foreach ($this->fees as $fee_id => $fee) { |
|
1283 | 1283 | |
1284 | - if ( 'all' != $type && ! empty( $fee['type'] ) && $type != $fee['type'] ) { |
|
1284 | + if ('all' != $type && ! empty($fee['type']) && $type != $fee['type']) { |
|
1285 | 1285 | continue; |
1286 | 1286 | } |
1287 | 1287 | |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | } |
1292 | 1292 | } |
1293 | 1293 | |
1294 | - return apply_filters( 'give_get_payment_fees', $fees, $this->ID, $this ); |
|
1294 | + return apply_filters('give_get_payment_fees', $fees, $this->ID, $this); |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | /** |
@@ -1304,13 +1304,13 @@ discard block |
||
1304 | 1304 | * |
1305 | 1305 | * @return void |
1306 | 1306 | */ |
1307 | - public function add_note( $note = false ) { |
|
1307 | + public function add_note($note = false) { |
|
1308 | 1308 | // Bail if no note specified. |
1309 | - if ( ! $note ) { |
|
1309 | + if ( ! $note) { |
|
1310 | 1310 | return false; |
1311 | 1311 | } |
1312 | 1312 | |
1313 | - give_insert_payment_note( $this->ID, $note ); |
|
1313 | + give_insert_payment_note($this->ID, $note); |
|
1314 | 1314 | } |
1315 | 1315 | |
1316 | 1316 | /** |
@@ -1323,7 +1323,7 @@ discard block |
||
1323 | 1323 | * |
1324 | 1324 | * @return void |
1325 | 1325 | */ |
1326 | - private function increase_subtotal( $amount = 0.00 ) { |
|
1326 | + private function increase_subtotal($amount = 0.00) { |
|
1327 | 1327 | $amount = (float) $amount; |
1328 | 1328 | $this->subtotal += $amount; |
1329 | 1329 | |
@@ -1340,11 +1340,11 @@ discard block |
||
1340 | 1340 | * |
1341 | 1341 | * @return void |
1342 | 1342 | */ |
1343 | - private function decrease_subtotal( $amount = 0.00 ) { |
|
1343 | + private function decrease_subtotal($amount = 0.00) { |
|
1344 | 1344 | $amount = (float) $amount; |
1345 | 1345 | $this->subtotal -= $amount; |
1346 | 1346 | |
1347 | - if ( $this->subtotal < 0 ) { |
|
1347 | + if ($this->subtotal < 0) { |
|
1348 | 1348 | $this->subtotal = 0; |
1349 | 1349 | } |
1350 | 1350 | |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | * |
1362 | 1362 | * @return void |
1363 | 1363 | */ |
1364 | - private function increase_fees( $amount = 0.00 ) { |
|
1364 | + private function increase_fees($amount = 0.00) { |
|
1365 | 1365 | $amount = (float) $amount; |
1366 | 1366 | $this->fees_total += $amount; |
1367 | 1367 | |
@@ -1378,11 +1378,11 @@ discard block |
||
1378 | 1378 | * |
1379 | 1379 | * @return void |
1380 | 1380 | */ |
1381 | - private function decrease_fees( $amount = 0.00 ) { |
|
1381 | + private function decrease_fees($amount = 0.00) { |
|
1382 | 1382 | $amount = (float) $amount; |
1383 | 1383 | $this->fees_total -= $amount; |
1384 | 1384 | |
1385 | - if ( $this->fees_total < 0 ) { |
|
1385 | + if ($this->fees_total < 0) { |
|
1386 | 1386 | $this->fees_total = 0; |
1387 | 1387 | } |
1388 | 1388 | |
@@ -1411,24 +1411,24 @@ discard block |
||
1411 | 1411 | * |
1412 | 1412 | * @return bool $updated Returns if the status was successfully updated. |
1413 | 1413 | */ |
1414 | - public function update_status( $status = false ) { |
|
1414 | + public function update_status($status = false) { |
|
1415 | 1415 | |
1416 | 1416 | // standardize the 'complete(d)' status. |
1417 | - if ( $status == 'completed' || $status == 'complete' ) { |
|
1417 | + if ($status == 'completed' || $status == 'complete') { |
|
1418 | 1418 | $status = 'publish'; |
1419 | 1419 | } |
1420 | 1420 | |
1421 | - $old_status = ! empty( $this->old_status ) ? $this->old_status : false; |
|
1421 | + $old_status = ! empty($this->old_status) ? $this->old_status : false; |
|
1422 | 1422 | |
1423 | - if ( $old_status === $status ) { |
|
1423 | + if ($old_status === $status) { |
|
1424 | 1424 | return false; // Don't permit status changes that aren't changes. |
1425 | 1425 | } |
1426 | 1426 | |
1427 | - $do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status ); |
|
1427 | + $do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status); |
|
1428 | 1428 | |
1429 | 1429 | $updated = false; |
1430 | 1430 | |
1431 | - if ( $do_change ) { |
|
1431 | + if ($do_change) { |
|
1432 | 1432 | |
1433 | 1433 | /** |
1434 | 1434 | * Fires before changing payment status. |
@@ -1439,21 +1439,21 @@ discard block |
||
1439 | 1439 | * @param string $status The new status. |
1440 | 1440 | * @param string $old_status The old status. |
1441 | 1441 | */ |
1442 | - do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status ); |
|
1442 | + do_action('give_before_payment_status_change', $this->ID, $status, $old_status); |
|
1443 | 1443 | |
1444 | 1444 | $update_fields = array( |
1445 | 1445 | 'ID' => $this->ID, |
1446 | 1446 | 'post_status' => $status, |
1447 | - 'edit_date' => current_time( 'mysql' ), |
|
1447 | + 'edit_date' => current_time('mysql'), |
|
1448 | 1448 | ); |
1449 | 1449 | |
1450 | - $updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) ); |
|
1450 | + $updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields)); |
|
1451 | 1451 | |
1452 | 1452 | $all_payment_statuses = give_get_payment_statuses(); |
1453 | - $this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status ); |
|
1453 | + $this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status); |
|
1454 | 1454 | |
1455 | 1455 | // Process any specific status functions. |
1456 | - switch ( $status ) { |
|
1456 | + switch ($status) { |
|
1457 | 1457 | case 'refunded': |
1458 | 1458 | $this->process_refund(); |
1459 | 1459 | break; |
@@ -1480,7 +1480,7 @@ discard block |
||
1480 | 1480 | * @param string $status The new status. |
1481 | 1481 | * @param string $old_status The old status. |
1482 | 1482 | */ |
1483 | - do_action( 'give_update_payment_status', $this->ID, $status, $old_status ); |
|
1483 | + do_action('give_update_payment_status', $this->ID, $status, $old_status); |
|
1484 | 1484 | |
1485 | 1485 | } |
1486 | 1486 | |
@@ -1515,33 +1515,33 @@ discard block |
||
1515 | 1515 | * |
1516 | 1516 | * @return mixed The value from the post meta |
1517 | 1517 | */ |
1518 | - public function get_meta( $meta_key = '_give_payment_meta', $single = true ) { |
|
1518 | + public function get_meta($meta_key = '_give_payment_meta', $single = true) { |
|
1519 | 1519 | |
1520 | - $meta = get_post_meta( $this->ID, $meta_key, $single ); |
|
1520 | + $meta = get_post_meta($this->ID, $meta_key, $single); |
|
1521 | 1521 | |
1522 | - if ( $meta_key === '_give_payment_meta' ) { |
|
1522 | + if ($meta_key === '_give_payment_meta') { |
|
1523 | 1523 | $meta = (array) $meta; |
1524 | 1524 | |
1525 | - if ( empty( $meta['key'] ) ) { |
|
1525 | + if (empty($meta['key'])) { |
|
1526 | 1526 | $meta['key'] = $this->setup_payment_key(); |
1527 | 1527 | } |
1528 | 1528 | |
1529 | - if ( empty( $meta['form_title'] ) ) { |
|
1529 | + if (empty($meta['form_title'])) { |
|
1530 | 1530 | $meta['form_title'] = $this->setup_form_title(); |
1531 | 1531 | } |
1532 | 1532 | |
1533 | - if ( empty( $meta['email'] ) ) { |
|
1533 | + if (empty($meta['email'])) { |
|
1534 | 1534 | $meta['email'] = $this->setup_email(); |
1535 | 1535 | } |
1536 | 1536 | |
1537 | - if ( empty( $meta['date'] ) ) { |
|
1538 | - $meta['date'] = get_post_field( 'post_date', $this->ID ); |
|
1537 | + if (empty($meta['date'])) { |
|
1538 | + $meta['date'] = get_post_field('post_date', $this->ID); |
|
1539 | 1539 | } |
1540 | 1540 | } |
1541 | 1541 | |
1542 | - $meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID ); |
|
1542 | + $meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID); |
|
1543 | 1543 | |
1544 | - return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key ); |
|
1544 | + return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key); |
|
1545 | 1545 | } |
1546 | 1546 | |
1547 | 1547 | /** |
@@ -1556,23 +1556,23 @@ discard block |
||
1556 | 1556 | * |
1557 | 1557 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure |
1558 | 1558 | */ |
1559 | - public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) { |
|
1560 | - if ( empty( $meta_key ) ) { |
|
1559 | + public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') { |
|
1560 | + if (empty($meta_key)) { |
|
1561 | 1561 | return false; |
1562 | 1562 | } |
1563 | 1563 | |
1564 | - if ( $meta_key == 'key' || $meta_key == 'date' ) { |
|
1564 | + if ($meta_key == 'key' || $meta_key == 'date') { |
|
1565 | 1565 | |
1566 | 1566 | $current_meta = $this->get_meta(); |
1567 | - $current_meta[ $meta_key ] = $meta_value; |
|
1567 | + $current_meta[$meta_key] = $meta_value; |
|
1568 | 1568 | |
1569 | 1569 | $meta_key = '_give_payment_meta'; |
1570 | 1570 | $meta_value = $current_meta; |
1571 | 1571 | |
1572 | - } elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) { |
|
1572 | + } elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') { |
|
1573 | 1573 | |
1574 | - $meta_value = apply_filters( "give_give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
1575 | - update_post_meta( $this->ID, '_give_payment_user_email', $meta_value ); |
|
1574 | + $meta_value = apply_filters("give_give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
1575 | + update_post_meta($this->ID, '_give_payment_user_email', $meta_value); |
|
1576 | 1576 | |
1577 | 1577 | $current_meta = $this->get_meta(); |
1578 | 1578 | $current_meta['user_info']['email'] = $meta_value; |
@@ -1582,9 +1582,9 @@ discard block |
||
1582 | 1582 | |
1583 | 1583 | } |
1584 | 1584 | |
1585 | - $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
1585 | + $meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
1586 | 1586 | |
1587 | - return update_post_meta( $this->ID, $meta_key, $meta_value, $prev_value ); |
|
1587 | + return update_post_meta($this->ID, $meta_key, $meta_value, $prev_value); |
|
1588 | 1588 | } |
1589 | 1589 | |
1590 | 1590 | /** |
@@ -1599,14 +1599,14 @@ discard block |
||
1599 | 1599 | $process_refund = true; |
1600 | 1600 | |
1601 | 1601 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1602 | - if ( 'publish' != $this->old_status || 'refunded' != $this->status ) { |
|
1602 | + if ('publish' != $this->old_status || 'refunded' != $this->status) { |
|
1603 | 1603 | $process_refund = false; |
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1607 | - $process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this ); |
|
1607 | + $process_refund = apply_filters('give_should_process_refund', $process_refund, $this); |
|
1608 | 1608 | |
1609 | - if ( false === $process_refund ) { |
|
1609 | + if (false === $process_refund) { |
|
1610 | 1610 | return; |
1611 | 1611 | } |
1612 | 1612 | |
@@ -1617,13 +1617,13 @@ discard block |
||
1617 | 1617 | * |
1618 | 1618 | * @param Give_Payment $this Payment object. |
1619 | 1619 | */ |
1620 | - do_action( 'give_pre_refund_payment', $this ); |
|
1620 | + do_action('give_pre_refund_payment', $this); |
|
1621 | 1621 | |
1622 | - $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this ); |
|
1623 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this ); |
|
1624 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this ); |
|
1622 | + $decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_refund', true, $this); |
|
1623 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this); |
|
1624 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this); |
|
1625 | 1625 | |
1626 | - $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
1626 | + $this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
1627 | 1627 | $this->delete_sales_logs(); |
1628 | 1628 | |
1629 | 1629 | // @todo: Refresh only range related stat cache |
@@ -1636,7 +1636,7 @@ discard block |
||
1636 | 1636 | * |
1637 | 1637 | * @param Give_Payment $this Payment object. |
1638 | 1638 | */ |
1639 | - do_action( 'give_post_refund_payment', $this ); |
|
1639 | + do_action('give_post_refund_payment', $this); |
|
1640 | 1640 | } |
1641 | 1641 | |
1642 | 1642 | /** |
@@ -1663,26 +1663,26 @@ discard block |
||
1663 | 1663 | $process_pending = true; |
1664 | 1664 | |
1665 | 1665 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1666 | - if ( 'publish' != $this->old_status || 'pending' != $this->status ) { |
|
1666 | + if ('publish' != $this->old_status || 'pending' != $this->status) { |
|
1667 | 1667 | $process_pending = false; |
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1671 | - $process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this ); |
|
1671 | + $process_pending = apply_filters('give_should_process_pending', $process_pending, $this); |
|
1672 | 1672 | |
1673 | - if ( false === $process_pending ) { |
|
1673 | + if (false === $process_pending) { |
|
1674 | 1674 | return; |
1675 | 1675 | } |
1676 | 1676 | |
1677 | - $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_pending', true, $this ); |
|
1678 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_pending', true, $this ); |
|
1679 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_pending', true, $this ); |
|
1677 | + $decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_pending', true, $this); |
|
1678 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_pending', true, $this); |
|
1679 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_pending', true, $this); |
|
1680 | 1680 | |
1681 | - $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
1681 | + $this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
1682 | 1682 | $this->delete_sales_logs(); |
1683 | 1683 | |
1684 | 1684 | $this->completed_date = false; |
1685 | - $this->update_meta( '_give_completed_date', '' ); |
|
1685 | + $this->update_meta('_give_completed_date', ''); |
|
1686 | 1686 | |
1687 | 1687 | // @todo: Refresh only range related stat cache |
1688 | 1688 | give_delete_donation_stats(); |
@@ -1700,26 +1700,26 @@ discard block |
||
1700 | 1700 | $process_cancelled = true; |
1701 | 1701 | |
1702 | 1702 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1703 | - if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) { |
|
1703 | + if ('publish' != $this->old_status || 'cancelled' != $this->status) { |
|
1704 | 1704 | $process_cancelled = false; |
1705 | 1705 | } |
1706 | 1706 | |
1707 | 1707 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1708 | - $process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this ); |
|
1708 | + $process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this); |
|
1709 | 1709 | |
1710 | - if ( false === $process_cancelled ) { |
|
1710 | + if (false === $process_cancelled) { |
|
1711 | 1711 | return; |
1712 | 1712 | } |
1713 | 1713 | |
1714 | - $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_cancelled', true, $this ); |
|
1715 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_cancelled', true, $this ); |
|
1716 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_cancelled', true, $this ); |
|
1714 | + $decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_cancelled', true, $this); |
|
1715 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_cancelled', true, $this); |
|
1716 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_cancelled', true, $this); |
|
1717 | 1717 | |
1718 | - $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
1718 | + $this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
1719 | 1719 | $this->delete_sales_logs(); |
1720 | 1720 | |
1721 | 1721 | $this->completed_date = false; |
1722 | - $this->update_meta( '_give_completed_date', '' ); |
|
1722 | + $this->update_meta('_give_completed_date', ''); |
|
1723 | 1723 | |
1724 | 1724 | // @todo: Refresh only range related stat cache |
1725 | 1725 | give_delete_donation_stats(); |
@@ -1735,26 +1735,26 @@ discard block |
||
1735 | 1735 | $process_revoked = true; |
1736 | 1736 | |
1737 | 1737 | // If the payment was not in publish, don't decrement stats as they were never incremented. |
1738 | - if ( 'publish' != $this->old_status || 'revoked' != $this->status ) { |
|
1738 | + if ('publish' != $this->old_status || 'revoked' != $this->status) { |
|
1739 | 1739 | $process_revoked = false; |
1740 | 1740 | } |
1741 | 1741 | |
1742 | 1742 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1743 | - $process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this ); |
|
1743 | + $process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this); |
|
1744 | 1744 | |
1745 | - if ( false === $process_revoked ) { |
|
1745 | + if (false === $process_revoked) { |
|
1746 | 1746 | return; |
1747 | 1747 | } |
1748 | 1748 | |
1749 | - $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_revoked', true, $this ); |
|
1750 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_revoked', true, $this ); |
|
1751 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_revoked', true, $this ); |
|
1749 | + $decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_revoked', true, $this); |
|
1750 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_revoked', true, $this); |
|
1751 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_revoked', true, $this); |
|
1752 | 1752 | |
1753 | - $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
1753 | + $this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
1754 | 1754 | $this->delete_sales_logs(); |
1755 | 1755 | |
1756 | 1756 | $this->completed_date = false; |
1757 | - $this->update_meta( '_give_completed_date', '' ); |
|
1757 | + $this->update_meta('_give_completed_date', ''); |
|
1758 | 1758 | |
1759 | 1759 | // @todo: Refresh only range related stat cache |
1760 | 1760 | give_delete_donation_stats(); |
@@ -1772,25 +1772,25 @@ discard block |
||
1772 | 1772 | * |
1773 | 1773 | * @return void |
1774 | 1774 | */ |
1775 | - private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) { |
|
1775 | + private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) { |
|
1776 | 1776 | |
1777 | - give_undo_purchase( false, $this->ID ); |
|
1777 | + give_undo_purchase(false, $this->ID); |
|
1778 | 1778 | |
1779 | 1779 | // Decrease store earnings. |
1780 | - if ( true === $alter_store_earnings ) { |
|
1781 | - give_decrease_total_earnings( $this->total ); |
|
1780 | + if (true === $alter_store_earnings) { |
|
1781 | + give_decrease_total_earnings($this->total); |
|
1782 | 1782 | } |
1783 | 1783 | |
1784 | 1784 | // Decrement the stats for the customer. |
1785 | - if ( ! empty( $this->customer_id ) ) { |
|
1785 | + if ( ! empty($this->customer_id)) { |
|
1786 | 1786 | |
1787 | - $customer = new Give_Customer( $this->customer_id ); |
|
1787 | + $customer = new Give_Customer($this->customer_id); |
|
1788 | 1788 | |
1789 | - if ( true === $alter_customer_value ) { |
|
1790 | - $customer->decrease_value( $this->total ); |
|
1789 | + if (true === $alter_customer_value) { |
|
1790 | + $customer->decrease_value($this->total); |
|
1791 | 1791 | } |
1792 | 1792 | |
1793 | - if ( true === $alter_customer_purchase_count ) { |
|
1793 | + if (true === $alter_customer_purchase_count) { |
|
1794 | 1794 | $customer->decrease_purchase_count(); |
1795 | 1795 | } |
1796 | 1796 | } |
@@ -1839,13 +1839,13 @@ discard block |
||
1839 | 1839 | * @return string The date the payment was completed |
1840 | 1840 | */ |
1841 | 1841 | private function setup_completed_date() { |
1842 | - $payment = get_post( $this->ID ); |
|
1842 | + $payment = get_post($this->ID); |
|
1843 | 1843 | |
1844 | - if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) { |
|
1844 | + if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) { |
|
1845 | 1845 | return false; // This payment was never completed. |
1846 | 1846 | } |
1847 | 1847 | |
1848 | - $date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date; |
|
1848 | + $date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date; |
|
1849 | 1849 | |
1850 | 1850 | return $date; |
1851 | 1851 | } |
@@ -1859,7 +1859,7 @@ discard block |
||
1859 | 1859 | * @return string The payment mode |
1860 | 1860 | */ |
1861 | 1861 | private function setup_mode() { |
1862 | - return $this->get_meta( '_give_payment_mode' ); |
|
1862 | + return $this->get_meta('_give_payment_mode'); |
|
1863 | 1863 | } |
1864 | 1864 | |
1865 | 1865 | /** |
@@ -1871,19 +1871,19 @@ discard block |
||
1871 | 1871 | * @return float The payment total |
1872 | 1872 | */ |
1873 | 1873 | private function setup_total() { |
1874 | - $amount = $this->get_meta( '_give_payment_total', true ); |
|
1874 | + $amount = $this->get_meta('_give_payment_total', true); |
|
1875 | 1875 | |
1876 | - if ( empty( $amount ) && '0.00' != $amount ) { |
|
1877 | - $meta = $this->get_meta( '_give_payment_meta', true ); |
|
1878 | - $meta = maybe_unserialize( $meta ); |
|
1876 | + if (empty($amount) && '0.00' != $amount) { |
|
1877 | + $meta = $this->get_meta('_give_payment_meta', true); |
|
1878 | + $meta = maybe_unserialize($meta); |
|
1879 | 1879 | |
1880 | - if ( isset( $meta['amount'] ) ) { |
|
1880 | + if (isset($meta['amount'])) { |
|
1881 | 1881 | $amount = $meta['amount']; |
1882 | 1882 | } |
1883 | 1883 | } |
1884 | 1884 | |
1885 | 1885 | |
1886 | - return round( floatval( $amount ), give_currency_decimal_filter() ); |
|
1886 | + return round(floatval($amount), give_currency_decimal_filter()); |
|
1887 | 1887 | } |
1888 | 1888 | |
1889 | 1889 | /** |
@@ -1911,9 +1911,9 @@ discard block |
||
1911 | 1911 | private function setup_fees_total() { |
1912 | 1912 | $fees_total = (float) 0.00; |
1913 | 1913 | |
1914 | - $payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array(); |
|
1915 | - if ( ! empty( $payment_fees ) ) { |
|
1916 | - foreach ( $payment_fees as $fee ) { |
|
1914 | + $payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array(); |
|
1915 | + if ( ! empty($payment_fees)) { |
|
1916 | + foreach ($payment_fees as $fee) { |
|
1917 | 1917 | $fees_total += (float) $fee['amount']; |
1918 | 1918 | } |
1919 | 1919 | } |
@@ -1931,7 +1931,7 @@ discard block |
||
1931 | 1931 | * @return string The currency for the payment |
1932 | 1932 | */ |
1933 | 1933 | private function setup_currency() { |
1934 | - $currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this ); |
|
1934 | + $currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this); |
|
1935 | 1935 | |
1936 | 1936 | return $currency; |
1937 | 1937 | } |
@@ -1945,7 +1945,7 @@ discard block |
||
1945 | 1945 | * @return array The Fees |
1946 | 1946 | */ |
1947 | 1947 | private function setup_fees() { |
1948 | - $payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array(); |
|
1948 | + $payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array(); |
|
1949 | 1949 | |
1950 | 1950 | return $payment_fees; |
1951 | 1951 | } |
@@ -1959,7 +1959,7 @@ discard block |
||
1959 | 1959 | * @return string The gateway |
1960 | 1960 | */ |
1961 | 1961 | private function setup_gateway() { |
1962 | - $gateway = $this->get_meta( '_give_payment_gateway', true ); |
|
1962 | + $gateway = $this->get_meta('_give_payment_gateway', true); |
|
1963 | 1963 | |
1964 | 1964 | return $gateway; |
1965 | 1965 | } |
@@ -1973,11 +1973,11 @@ discard block |
||
1973 | 1973 | * @return string The donation ID |
1974 | 1974 | */ |
1975 | 1975 | private function setup_transaction_id() { |
1976 | - $transaction_id = $this->get_meta( '_give_payment_transaction_id', true ); |
|
1976 | + $transaction_id = $this->get_meta('_give_payment_transaction_id', true); |
|
1977 | 1977 | |
1978 | - if ( empty( $transaction_id ) ) { |
|
1978 | + if (empty($transaction_id)) { |
|
1979 | 1979 | $gateway = $this->gateway; |
1980 | - $transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID ); |
|
1980 | + $transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID); |
|
1981 | 1981 | } |
1982 | 1982 | |
1983 | 1983 | return $transaction_id; |
@@ -1992,7 +1992,7 @@ discard block |
||
1992 | 1992 | * @return string The IP address for the payment |
1993 | 1993 | */ |
1994 | 1994 | private function setup_ip() { |
1995 | - $ip = $this->get_meta( '_give_payment_user_ip', true ); |
|
1995 | + $ip = $this->get_meta('_give_payment_user_ip', true); |
|
1996 | 1996 | |
1997 | 1997 | return $ip; |
1998 | 1998 | } |
@@ -2006,7 +2006,7 @@ discard block |
||
2006 | 2006 | * @return int The Customer ID |
2007 | 2007 | */ |
2008 | 2008 | private function setup_customer_id() { |
2009 | - $customer_id = $this->get_meta( '_give_payment_customer_id', true ); |
|
2009 | + $customer_id = $this->get_meta('_give_payment_customer_id', true); |
|
2010 | 2010 | |
2011 | 2011 | return $customer_id; |
2012 | 2012 | } |
@@ -2020,7 +2020,7 @@ discard block |
||
2020 | 2020 | * @return int The User ID |
2021 | 2021 | */ |
2022 | 2022 | private function setup_user_id() { |
2023 | - $user_id = $this->get_meta( '_give_payment_user_id', true ); |
|
2023 | + $user_id = $this->get_meta('_give_payment_user_id', true); |
|
2024 | 2024 | |
2025 | 2025 | return $user_id; |
2026 | 2026 | } |
@@ -2034,10 +2034,10 @@ discard block |
||
2034 | 2034 | * @return string The email address for the payment |
2035 | 2035 | */ |
2036 | 2036 | private function setup_email() { |
2037 | - $email = $this->get_meta( '_give_payment_user_email', true ); |
|
2037 | + $email = $this->get_meta('_give_payment_user_email', true); |
|
2038 | 2038 | |
2039 | - if ( empty( $email ) ) { |
|
2040 | - $email = Give()->customers->get_column( 'email', $this->customer_id ); |
|
2039 | + if (empty($email)) { |
|
2040 | + $email = Give()->customers->get_column('email', $this->customer_id); |
|
2041 | 2041 | } |
2042 | 2042 | |
2043 | 2043 | return $email; |
@@ -2057,15 +2057,15 @@ discard block |
||
2057 | 2057 | 'last_name' => $this->last_name, |
2058 | 2058 | ); |
2059 | 2059 | |
2060 | - $user_info = isset( $this->payment_meta['user_info'] ) ? maybe_unserialize( $this->payment_meta['user_info'] ) : array(); |
|
2061 | - $user_info = wp_parse_args( $user_info, $defaults ); |
|
2060 | + $user_info = isset($this->payment_meta['user_info']) ? maybe_unserialize($this->payment_meta['user_info']) : array(); |
|
2061 | + $user_info = wp_parse_args($user_info, $defaults); |
|
2062 | 2062 | |
2063 | - if ( empty( $user_info ) ) { |
|
2063 | + if (empty($user_info)) { |
|
2064 | 2064 | // Get the customer, but only if it's been created. |
2065 | - $customer = new Give_Customer( $this->customer_id ); |
|
2065 | + $customer = new Give_Customer($this->customer_id); |
|
2066 | 2066 | |
2067 | - if ( $customer->id > 0 ) { |
|
2068 | - $name = explode( ' ', $customer->name, 2 ); |
|
2067 | + if ($customer->id > 0) { |
|
2068 | + $name = explode(' ', $customer->name, 2); |
|
2069 | 2069 | $user_info = array( |
2070 | 2070 | 'first_name' => $name[0], |
2071 | 2071 | 'last_name' => $name[1], |
@@ -2075,29 +2075,29 @@ discard block |
||
2075 | 2075 | } |
2076 | 2076 | } else { |
2077 | 2077 | // Get the customer, but only if it's been created. |
2078 | - $customer = new Give_Customer( $this->customer_id ); |
|
2079 | - if ( $customer->id > 0 ) { |
|
2080 | - foreach ( $user_info as $key => $value ) { |
|
2081 | - if ( ! empty( $value ) ) { |
|
2078 | + $customer = new Give_Customer($this->customer_id); |
|
2079 | + if ($customer->id > 0) { |
|
2080 | + foreach ($user_info as $key => $value) { |
|
2081 | + if ( ! empty($value)) { |
|
2082 | 2082 | continue; |
2083 | 2083 | } |
2084 | 2084 | |
2085 | - switch ( $key ) { |
|
2085 | + switch ($key) { |
|
2086 | 2086 | case 'first_name': |
2087 | - $name = explode( ' ', $customer->name, 2 ); |
|
2087 | + $name = explode(' ', $customer->name, 2); |
|
2088 | 2088 | |
2089 | - $user_info[ $key ] = $name[0]; |
|
2089 | + $user_info[$key] = $name[0]; |
|
2090 | 2090 | break; |
2091 | 2091 | |
2092 | 2092 | case 'last_name': |
2093 | - $name = explode( ' ', $customer->name, 2 ); |
|
2094 | - $last_name = ! empty( $name[1] ) ? $name[1] : ''; |
|
2093 | + $name = explode(' ', $customer->name, 2); |
|
2094 | + $last_name = ! empty($name[1]) ? $name[1] : ''; |
|
2095 | 2095 | |
2096 | - $user_info[ $key ] = $last_name; |
|
2096 | + $user_info[$key] = $last_name; |
|
2097 | 2097 | break; |
2098 | 2098 | |
2099 | 2099 | case 'email': |
2100 | - $user_info[ $key ] = $customer->email; |
|
2100 | + $user_info[$key] = $customer->email; |
|
2101 | 2101 | break; |
2102 | 2102 | } |
2103 | 2103 | } |
@@ -2118,7 +2118,7 @@ discard block |
||
2118 | 2118 | */ |
2119 | 2119 | private function setup_address() { |
2120 | 2120 | |
2121 | - $address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array( |
|
2121 | + $address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array( |
|
2122 | 2122 | 'line1' => '', |
2123 | 2123 | 'line2' => '', |
2124 | 2124 | 'city' => '', |
@@ -2140,7 +2140,7 @@ discard block |
||
2140 | 2140 | */ |
2141 | 2141 | private function setup_form_title() { |
2142 | 2142 | |
2143 | - $form_id = $this->get_meta( '_give_payment_form_title', true ); |
|
2143 | + $form_id = $this->get_meta('_give_payment_form_title', true); |
|
2144 | 2144 | |
2145 | 2145 | return $form_id; |
2146 | 2146 | } |
@@ -2155,7 +2155,7 @@ discard block |
||
2155 | 2155 | */ |
2156 | 2156 | private function setup_form_id() { |
2157 | 2157 | |
2158 | - $form_id = $this->get_meta( '_give_payment_form_id', true ); |
|
2158 | + $form_id = $this->get_meta('_give_payment_form_id', true); |
|
2159 | 2159 | |
2160 | 2160 | return $form_id; |
2161 | 2161 | } |
@@ -2169,7 +2169,7 @@ discard block |
||
2169 | 2169 | * @return int The Form Price ID |
2170 | 2170 | */ |
2171 | 2171 | private function setup_price_id() { |
2172 | - $price_id = $this->get_meta( '_give_payment_price_id', true ); |
|
2172 | + $price_id = $this->get_meta('_give_payment_price_id', true); |
|
2173 | 2173 | |
2174 | 2174 | return $price_id; |
2175 | 2175 | } |
@@ -2183,7 +2183,7 @@ discard block |
||
2183 | 2183 | * @return string The Payment Key |
2184 | 2184 | */ |
2185 | 2185 | private function setup_payment_key() { |
2186 | - $key = $this->get_meta( '_give_payment_purchase_key', true ); |
|
2186 | + $key = $this->get_meta('_give_payment_purchase_key', true); |
|
2187 | 2187 | |
2188 | 2188 | return $key; |
2189 | 2189 | } |
@@ -2199,11 +2199,11 @@ discard block |
||
2199 | 2199 | private function setup_payment_number() { |
2200 | 2200 | $number = $this->ID; |
2201 | 2201 | |
2202 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
2202 | + if (give_get_option('enable_sequential')) { |
|
2203 | 2203 | |
2204 | - $number = $this->get_meta( '_give_payment_number', true ); |
|
2204 | + $number = $this->get_meta('_give_payment_number', true); |
|
2205 | 2205 | |
2206 | - if ( ! $number ) { |
|
2206 | + if ( ! $number) { |
|
2207 | 2207 | |
2208 | 2208 | $number = $this->ID; |
2209 | 2209 | |
@@ -2221,7 +2221,7 @@ discard block |
||
2221 | 2221 | * @return array The payment object as an array |
2222 | 2222 | */ |
2223 | 2223 | public function array_convert() { |
2224 | - return get_object_vars( $this ); |
|
2224 | + return get_object_vars($this); |
|
2225 | 2225 | } |
2226 | 2226 | |
2227 | 2227 | |
@@ -2234,7 +2234,7 @@ discard block |
||
2234 | 2234 | * @return bool |
2235 | 2235 | */ |
2236 | 2236 | public function is_completed() { |
2237 | - return ( 'publish' === $this->status && $this->completed_date ); |
|
2237 | + return ('publish' === $this->status && $this->completed_date); |
|
2238 | 2238 | } |
2239 | 2239 | |
2240 | 2240 | /** |
@@ -2246,7 +2246,7 @@ discard block |
||
2246 | 2246 | * @return string Date payment was completed |
2247 | 2247 | */ |
2248 | 2248 | private function get_completed_date() { |
2249 | - return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this ); |
|
2249 | + return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this); |
|
2250 | 2250 | } |
2251 | 2251 | |
2252 | 2252 | /** |
@@ -2258,7 +2258,7 @@ discard block |
||
2258 | 2258 | * @return float Payment subtotal |
2259 | 2259 | */ |
2260 | 2260 | private function get_subtotal() { |
2261 | - return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this ); |
|
2261 | + return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this); |
|
2262 | 2262 | } |
2263 | 2263 | |
2264 | 2264 | /** |
@@ -2270,7 +2270,7 @@ discard block |
||
2270 | 2270 | * @return string Payment currency code |
2271 | 2271 | */ |
2272 | 2272 | private function get_currency() { |
2273 | - return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this ); |
|
2273 | + return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this); |
|
2274 | 2274 | } |
2275 | 2275 | |
2276 | 2276 | /** |
@@ -2282,7 +2282,7 @@ discard block |
||
2282 | 2282 | * @return string Gateway used |
2283 | 2283 | */ |
2284 | 2284 | private function get_gateway() { |
2285 | - return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this ); |
|
2285 | + return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this); |
|
2286 | 2286 | } |
2287 | 2287 | |
2288 | 2288 | /** |
@@ -2294,7 +2294,7 @@ discard block |
||
2294 | 2294 | * @return string Donation ID from merchant processor |
2295 | 2295 | */ |
2296 | 2296 | private function get_transaction_id() { |
2297 | - return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this ); |
|
2297 | + return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this); |
|
2298 | 2298 | } |
2299 | 2299 | |
2300 | 2300 | /** |
@@ -2306,7 +2306,7 @@ discard block |
||
2306 | 2306 | * @return string Payment IP address |
2307 | 2307 | */ |
2308 | 2308 | private function get_ip() { |
2309 | - return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this ); |
|
2309 | + return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this); |
|
2310 | 2310 | } |
2311 | 2311 | |
2312 | 2312 | /** |
@@ -2318,7 +2318,7 @@ discard block |
||
2318 | 2318 | * @return int Payment customer ID |
2319 | 2319 | */ |
2320 | 2320 | private function get_customer_id() { |
2321 | - return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this ); |
|
2321 | + return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this); |
|
2322 | 2322 | } |
2323 | 2323 | |
2324 | 2324 | /** |
@@ -2330,7 +2330,7 @@ discard block |
||
2330 | 2330 | * @return int Payment user ID |
2331 | 2331 | */ |
2332 | 2332 | private function get_user_id() { |
2333 | - return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this ); |
|
2333 | + return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this); |
|
2334 | 2334 | } |
2335 | 2335 | |
2336 | 2336 | /** |
@@ -2342,7 +2342,7 @@ discard block |
||
2342 | 2342 | * @return string Payment customer email |
2343 | 2343 | */ |
2344 | 2344 | private function get_email() { |
2345 | - return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this ); |
|
2345 | + return apply_filters('give_payment_user_email', $this->email, $this->ID, $this); |
|
2346 | 2346 | } |
2347 | 2347 | |
2348 | 2348 | /** |
@@ -2354,7 +2354,7 @@ discard block |
||
2354 | 2354 | * @return array Payment user info |
2355 | 2355 | */ |
2356 | 2356 | private function get_user_info() { |
2357 | - return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this ); |
|
2357 | + return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this); |
|
2358 | 2358 | } |
2359 | 2359 | |
2360 | 2360 | /** |
@@ -2366,7 +2366,7 @@ discard block |
||
2366 | 2366 | * @return array Payment billing address |
2367 | 2367 | */ |
2368 | 2368 | private function get_address() { |
2369 | - return apply_filters( 'give_payment_address', $this->address, $this->ID, $this ); |
|
2369 | + return apply_filters('give_payment_address', $this->address, $this->ID, $this); |
|
2370 | 2370 | } |
2371 | 2371 | |
2372 | 2372 | /** |
@@ -2378,7 +2378,7 @@ discard block |
||
2378 | 2378 | * @return string Payment key |
2379 | 2379 | */ |
2380 | 2380 | private function get_key() { |
2381 | - return apply_filters( 'give_payment_key', $this->key, $this->ID, $this ); |
|
2381 | + return apply_filters('give_payment_key', $this->key, $this->ID, $this); |
|
2382 | 2382 | } |
2383 | 2383 | |
2384 | 2384 | /** |
@@ -2390,7 +2390,7 @@ discard block |
||
2390 | 2390 | * @return string Payment form id |
2391 | 2391 | */ |
2392 | 2392 | private function get_form_id() { |
2393 | - return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this ); |
|
2393 | + return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this); |
|
2394 | 2394 | } |
2395 | 2395 | |
2396 | 2396 | /** |
@@ -2402,7 +2402,7 @@ discard block |
||
2402 | 2402 | * @return int|string Payment number |
2403 | 2403 | */ |
2404 | 2404 | private function get_number() { |
2405 | - return apply_filters( 'give_payment_number', $this->number, $this->ID, $this ); |
|
2405 | + return apply_filters('give_payment_number', $this->number, $this->ID, $this); |
|
2406 | 2406 | } |
2407 | 2407 | |
2408 | 2408 | } |
@@ -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 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @see Give_Cron::weekly_events() |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
38 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
37 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
38 | + add_action('wp', array($this, 'schedule_Events')); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array An array of non-default cron schedules. |
50 | 50 | */ |
51 | - public function add_schedules( $schedules = array() ) { |
|
51 | + public function add_schedules($schedules = array()) { |
|
52 | 52 | // Adds once weekly to the existing schedules. |
53 | 53 | $schedules['weekly'] = array( |
54 | 54 | 'interval' => 604800, |
55 | - 'display' => esc_html__( 'Once Weekly', 'give' ) |
|
55 | + 'display' => esc_html__('Once Weekly', 'give') |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | return $schedules; |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | private function weekly_events() { |
83 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
84 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
83 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
84 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @return void |
95 | 95 | */ |
96 | 96 | private function daily_events() { |
97 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
98 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
97 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
98 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | 'disabled' => __( 'Disabled', 'give' ), |
88 | 88 | ) |
89 | 89 | ), |
90 | - array( |
|
91 | - 'name' => esc_html__( 'Display Settings Docs Link', 'give' ), |
|
92 | - 'id' => 'display_settings_docs_link', |
|
93 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
94 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
95 | - 'type' => 'give_docs_link', |
|
96 | - ), |
|
90 | + array( |
|
91 | + 'name' => esc_html__( 'Display Settings Docs Link', 'give' ), |
|
92 | + 'id' => 'display_settings_docs_link', |
|
93 | + 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
94 | + 'title' => __( 'Display Options Settings', 'give' ), |
|
95 | + 'type' => 'give_docs_link', |
|
96 | + ), |
|
97 | 97 | array( |
98 | 98 | 'id' => 'give_title_display_settings_1', |
99 | 99 | 'type' => 'sectionend' |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | 'disabled' => __( 'Disabled', 'give' ), |
171 | 171 | ) |
172 | 172 | ), |
173 | - array( |
|
174 | - 'name' => esc_html__( 'Post Types Docs Link', 'give' ), |
|
175 | - 'id' => 'post_types_settings_docs_link', |
|
176 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
177 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
178 | - 'type' => 'give_docs_link', |
|
179 | - ), |
|
173 | + array( |
|
174 | + 'name' => esc_html__( 'Post Types Docs Link', 'give' ), |
|
175 | + 'id' => 'post_types_settings_docs_link', |
|
176 | + 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
177 | + 'title' => __( 'Post Types Settings', 'give' ), |
|
178 | + 'type' => 'give_docs_link', |
|
179 | + ), |
|
180 | 180 | array( |
181 | 181 | 'id' => 'give_title_display_settings_2', |
182 | 182 | 'type' => 'sectionend' |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | 'disabled' => __( 'Disabled', 'give' ), |
213 | 213 | ) |
214 | 214 | ), |
215 | - array( |
|
216 | - 'name' => esc_html__( 'Taxonomies Docs Link', 'give' ), |
|
217 | - 'id' => 'taxonomies_settings_docs_link', |
|
218 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
219 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
220 | - 'type' => 'give_docs_link', |
|
221 | - ), |
|
215 | + array( |
|
216 | + 'name' => esc_html__( 'Taxonomies Docs Link', 'give' ), |
|
217 | + 'id' => 'taxonomies_settings_docs_link', |
|
218 | + 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
219 | + 'title' => __( 'Taxonomies Settings', 'give' ), |
|
220 | + 'type' => 'give_docs_link', |
|
221 | + ), |
|
222 | 222 | array( |
223 | 223 | 'id' => 'give_title_display_settings_3', |
224 | 224 | 'type' => 'sectionend' |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | 'id' => 'agreement_text', |
259 | 259 | 'type' => 'wysiwyg' |
260 | 260 | ), |
261 | - array( |
|
262 | - 'name' => esc_html__( 'Terms and Conditions Docs Link', 'give' ), |
|
263 | - 'id' => 'terms_settings_docs_link', |
|
264 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
265 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
266 | - 'type' => 'give_docs_link', |
|
267 | - ), |
|
261 | + array( |
|
262 | + 'name' => esc_html__( 'Terms and Conditions Docs Link', 'give' ), |
|
263 | + 'id' => 'terms_settings_docs_link', |
|
264 | + 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
265 | + 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
266 | + 'type' => 'give_docs_link', |
|
267 | + ), |
|
268 | 268 | array( |
269 | 269 | 'id' => 'give_title_display_settings_4', |
270 | 270 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Display' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Display')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Display. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'display'; |
30 | - $this->label = esc_html__( 'Display Options', 'give' ); |
|
30 | + $this->label = esc_html__('Display Options', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'display-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'display-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Display |
@@ -53,45 +53,45 @@ discard block |
||
53 | 53 | 'type' => 'title' |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => esc_html__( 'Default Give Styles', 'give' ), |
|
57 | - 'desc' => esc_html__( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ), |
|
56 | + 'name' => esc_html__('Default Give Styles', 'give'), |
|
57 | + 'desc' => esc_html__('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'), |
|
58 | 58 | 'id' => 'css', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'enabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Enabled', 'give' ), |
|
63 | - 'disabled' => __( 'Disabled', 'give' ), |
|
62 | + 'enabled' => __('Enabled', 'give'), |
|
63 | + 'disabled' => __('Disabled', 'give'), |
|
64 | 64 | ) |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
67 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
68 | 68 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
69 | - 'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your lables to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
69 | + 'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your lables to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
70 | 70 | 'id' => 'floatlabels', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'default' => 'disabled', |
73 | 73 | 'options' => array( |
74 | - 'enabled' => __( 'Enabled', 'give' ), |
|
75 | - 'disabled' => __( 'Disabled', 'give' ), |
|
74 | + 'enabled' => __('Enabled', 'give'), |
|
75 | + 'disabled' => __('Disabled', 'give'), |
|
76 | 76 | ) |
77 | 77 | ), |
78 | 78 | array( |
79 | - 'name' => esc_html__( 'Welcome Screen', 'give' ), |
|
79 | + 'name' => esc_html__('Welcome Screen', 'give'), |
|
80 | 80 | /* translators: %s: about page URL */ |
81 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
81 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))), |
|
82 | 82 | 'id' => 'welcome', |
83 | 83 | 'type' => 'radio_inline', |
84 | 84 | 'default' => 'enabled', |
85 | 85 | 'options' => array( |
86 | - 'enabled' => __( 'Enabled', 'give' ), |
|
87 | - 'disabled' => __( 'Disabled', 'give' ), |
|
86 | + 'enabled' => __('Enabled', 'give'), |
|
87 | + 'disabled' => __('Disabled', 'give'), |
|
88 | 88 | ) |
89 | 89 | ), |
90 | 90 | array( |
91 | - 'name' => esc_html__( 'Display Settings Docs Link', 'give' ), |
|
91 | + 'name' => esc_html__('Display Settings Docs Link', 'give'), |
|
92 | 92 | 'id' => 'display_settings_docs_link', |
93 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
94 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
93 | + 'url' => esc_url('http://docs.givewp.com/form-display-options'), |
|
94 | + 'title' => __('Display Options Settings', 'give'), |
|
95 | 95 | 'type' => 'give_docs_link', |
96 | 96 | ), |
97 | 97 | array( |
@@ -108,73 +108,73 @@ discard block |
||
108 | 108 | 'type' => 'title' |
109 | 109 | ), |
110 | 110 | array( |
111 | - 'name' => esc_html__( 'Form Single Views', 'give' ), |
|
112 | - 'desc' => esc_html__( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
111 | + 'name' => esc_html__('Form Single Views', 'give'), |
|
112 | + 'desc' => esc_html__('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
113 | 113 | 'id' => 'forms_singular', |
114 | 114 | 'type' => 'radio_inline', |
115 | 115 | 'default' => 'enabled', |
116 | 116 | 'options' => array( |
117 | - 'enabled' => __( 'Enabled', 'give' ), |
|
118 | - 'disabled' => __( 'Disabled', 'give' ), |
|
117 | + 'enabled' => __('Enabled', 'give'), |
|
118 | + 'disabled' => __('Disabled', 'give'), |
|
119 | 119 | ) |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => esc_html__( 'Form Archives', 'give' ), |
|
123 | - 'desc' => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'options-permalink.php' ) ) ), |
|
122 | + 'name' => esc_html__('Form Archives', 'give'), |
|
123 | + 'desc' => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('options-permalink.php'))), |
|
124 | 124 | 'id' => 'forms_archives', |
125 | 125 | 'type' => 'radio_inline', |
126 | 126 | 'default' => 'enabled', |
127 | 127 | 'options' => array( |
128 | - 'enabled' => __( 'Enabled', 'give' ), |
|
129 | - 'disabled' => __( 'Disabled', 'give' ), |
|
128 | + 'enabled' => __('Enabled', 'give'), |
|
129 | + 'disabled' => __('Disabled', 'give'), |
|
130 | 130 | ) |
131 | 131 | ), |
132 | 132 | array( |
133 | - 'name' => esc_html__( 'Form Excerpts', 'give' ), |
|
134 | - 'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
133 | + 'name' => esc_html__('Form Excerpts', 'give'), |
|
134 | + 'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
135 | 135 | 'id' => 'forms_excerpt', |
136 | 136 | 'type' => 'radio_inline', |
137 | 137 | 'default' => 'enabled', |
138 | 138 | 'options' => array( |
139 | - 'enabled' => __( 'Enabled', 'give' ), |
|
140 | - 'disabled' => __( 'Disabled', 'give' ), |
|
139 | + 'enabled' => __('Enabled', 'give'), |
|
140 | + 'disabled' => __('Disabled', 'give'), |
|
141 | 141 | ) |
142 | 142 | ), |
143 | 143 | array( |
144 | - 'name' => esc_html__( 'Form Featured Image', 'give' ), |
|
145 | - 'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
144 | + 'name' => esc_html__('Form Featured Image', 'give'), |
|
145 | + 'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
146 | 146 | 'id' => 'form_featured_img', |
147 | 147 | 'type' => 'radio_inline', |
148 | 148 | 'default' => 'enabled', |
149 | 149 | 'options' => array( |
150 | - 'enabled' => __( 'Enabled', 'give' ), |
|
151 | - 'disabled' => __( 'Disabled', 'give' ), |
|
150 | + 'enabled' => __('Enabled', 'give'), |
|
151 | + 'disabled' => __('Disabled', 'give'), |
|
152 | 152 | ) |
153 | 153 | ), |
154 | 154 | array( |
155 | - 'name' => esc_html__( 'Featured Image Size', 'give' ), |
|
156 | - 'desc' => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
155 | + 'name' => esc_html__('Featured Image Size', 'give'), |
|
156 | + 'desc' => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
157 | 157 | 'id' => 'featured_image_size', |
158 | 158 | 'type' => 'select', |
159 | 159 | 'default' => 'large', |
160 | 160 | 'options' => give_get_featured_image_sizes() |
161 | 161 | ), |
162 | 162 | array( |
163 | - 'name' => esc_html__( 'Single Form Sidebar', 'give' ), |
|
164 | - 'desc' => esc_html__( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
163 | + 'name' => esc_html__('Single Form Sidebar', 'give'), |
|
164 | + 'desc' => esc_html__('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
165 | 165 | 'id' => 'form_sidebar', |
166 | 166 | 'type' => 'radio_inline', |
167 | 167 | 'default' => 'enabled', |
168 | 168 | 'options' => array( |
169 | - 'enabled' => __( 'Enabled', 'give' ), |
|
170 | - 'disabled' => __( 'Disabled', 'give' ), |
|
169 | + 'enabled' => __('Enabled', 'give'), |
|
170 | + 'disabled' => __('Disabled', 'give'), |
|
171 | 171 | ) |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => esc_html__( 'Post Types Docs Link', 'give' ), |
|
174 | + 'name' => esc_html__('Post Types Docs Link', 'give'), |
|
175 | 175 | 'id' => 'post_types_settings_docs_link', |
176 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
177 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
176 | + 'url' => esc_url('http://docs.givewp.com/settings-post-types'), |
|
177 | + 'title' => __('Post Types Settings', 'give'), |
|
178 | 178 | 'type' => 'give_docs_link', |
179 | 179 | ), |
180 | 180 | array( |
@@ -191,32 +191,32 @@ discard block |
||
191 | 191 | 'type' => 'title' |
192 | 192 | ), |
193 | 193 | array( |
194 | - 'name' => esc_html__( 'Form Categories', 'give' ), |
|
195 | - 'desc' => esc_html__( 'Enable Categories for all Give forms.', 'give' ), |
|
194 | + 'name' => esc_html__('Form Categories', 'give'), |
|
195 | + 'desc' => esc_html__('Enable Categories for all Give forms.', 'give'), |
|
196 | 196 | 'id' => 'categories', |
197 | 197 | 'type' => 'radio_inline', |
198 | 198 | 'default' => 'disabled', |
199 | 199 | 'options' => array( |
200 | - 'enabled' => __( 'Enabled', 'give' ), |
|
201 | - 'disabled' => __( 'Disabled', 'give' ), |
|
200 | + 'enabled' => __('Enabled', 'give'), |
|
201 | + 'disabled' => __('Disabled', 'give'), |
|
202 | 202 | ) |
203 | 203 | ), |
204 | 204 | array( |
205 | - 'name' => esc_html__( 'Form Tags', 'give' ), |
|
206 | - 'desc' => esc_html__( 'Enable Tags for all Give forms.', 'give' ), |
|
205 | + 'name' => esc_html__('Form Tags', 'give'), |
|
206 | + 'desc' => esc_html__('Enable Tags for all Give forms.', 'give'), |
|
207 | 207 | 'id' => 'tags', |
208 | 208 | 'type' => 'radio_inline', |
209 | 209 | 'default' => 'disabled', |
210 | 210 | 'options' => array( |
211 | - 'enabled' => __( 'Enabled', 'give' ), |
|
212 | - 'disabled' => __( 'Disabled', 'give' ), |
|
211 | + 'enabled' => __('Enabled', 'give'), |
|
212 | + 'disabled' => __('Disabled', 'give'), |
|
213 | 213 | ) |
214 | 214 | ), |
215 | 215 | array( |
216 | - 'name' => esc_html__( 'Taxonomies Docs Link', 'give' ), |
|
216 | + 'name' => esc_html__('Taxonomies Docs Link', 'give'), |
|
217 | 217 | 'id' => 'taxonomies_settings_docs_link', |
218 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
219 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
218 | + 'url' => esc_url('http://docs.givewp.com/settings-taxonomies'), |
|
219 | + 'title' => __('Taxonomies Settings', 'give'), |
|
220 | 220 | 'type' => 'give_docs_link', |
221 | 221 | ), |
222 | 222 | array( |
@@ -233,36 +233,36 @@ discard block |
||
233 | 233 | 'type' => 'title' |
234 | 234 | ), |
235 | 235 | array( |
236 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
237 | - 'desc' => esc_html__( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ), |
|
236 | + 'name' => esc_html__('Terms and Conditions', 'give'), |
|
237 | + 'desc' => esc_html__('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'), |
|
238 | 238 | 'id' => 'terms', |
239 | 239 | 'type' => 'radio_inline', |
240 | 240 | 'default' => 'disabled', |
241 | 241 | 'options' => array( |
242 | - 'enabled' => __( 'Enabled', 'give' ), |
|
243 | - 'disabled' => __( 'Disabled', 'give' ), |
|
242 | + 'enabled' => __('Enabled', 'give'), |
|
243 | + 'disabled' => __('Disabled', 'give'), |
|
244 | 244 | ) |
245 | 245 | ), |
246 | 246 | array( |
247 | - 'name' => esc_html__( 'Agree to Terms Label', 'give' ), |
|
248 | - 'desc' => esc_html__( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ), |
|
247 | + 'name' => esc_html__('Agree to Terms Label', 'give'), |
|
248 | + 'desc' => esc_html__('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'), |
|
249 | 249 | 'id' => 'agree_to_terms_label', |
250 | 250 | 'attributes' => array( |
251 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
251 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
252 | 252 | ), |
253 | 253 | 'type' => 'text' |
254 | 254 | ), |
255 | 255 | array( |
256 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
257 | - 'desc' => esc_html__( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ), |
|
256 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
257 | + 'desc' => esc_html__('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'), |
|
258 | 258 | 'id' => 'agreement_text', |
259 | 259 | 'type' => 'wysiwyg' |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => esc_html__( 'Terms and Conditions Docs Link', 'give' ), |
|
262 | + 'name' => esc_html__('Terms and Conditions Docs Link', 'give'), |
|
263 | 263 | 'id' => 'terms_settings_docs_link', |
264 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
265 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
264 | + 'url' => esc_url('http://docs.givewp.com/settings-terms'), |
|
265 | + 'title' => __('Terms and Conditions Settings', 'give'), |
|
266 | 266 | 'type' => 'give_docs_link', |
267 | 267 | ), |
268 | 268 | array( |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * Filter the display options settings. |
278 | 278 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
279 | 279 | */ |
280 | - $settings = apply_filters( 'give_settings_display', $settings ); |
|
280 | + $settings = apply_filters('give_settings_display', $settings); |
|
281 | 281 | |
282 | 282 | /** |
283 | 283 | * Filter the settings. |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @since 1.8 |
286 | 286 | * @param array $settings |
287 | 287 | */ |
288 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
288 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
289 | 289 | |
290 | 290 | // Output. |
291 | 291 | return $settings; |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function get_sections() { |
301 | 301 | $sections = array( |
302 | - 'display-settings' => esc_html__( 'Display', 'give' ), |
|
303 | - 'post-types' => esc_html__( 'Post Types', 'give' ), |
|
304 | - 'taxonomies' => esc_html__( 'Taxonomies', 'give' ), |
|
305 | - 'term-and-conditions' => esc_html__( 'Terms and Conditions', 'give' ) |
|
302 | + 'display-settings' => esc_html__('Display', 'give'), |
|
303 | + 'post-types' => esc_html__('Post Types', 'give'), |
|
304 | + 'taxonomies' => esc_html__('Taxonomies', 'give'), |
|
305 | + 'term-and-conditions' => esc_html__('Terms and Conditions', 'give') |
|
306 | 306 | ); |
307 | 307 | |
308 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
308 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | 'default' => get_bloginfo( 'admin_email' ), |
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | - array( |
|
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | - 'id' => 'email_settings_docs_link', |
|
85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
87 | - 'type' => 'give_docs_link', |
|
88 | - ), |
|
82 | + array( |
|
83 | + 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | + 'id' => 'email_settings_docs_link', |
|
85 | + 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | + 'title' => __( 'Email Settings', 'give' ), |
|
87 | + 'type' => 'give_docs_link', |
|
88 | + ), |
|
89 | 89 | array( |
90 | 90 | 'id' => 'give_title_email_settings_1', |
91 | 91 | 'type' => 'sectionend' |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | - array( |
|
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | - 'id' => 'donation_receipt_settings_docs_link', |
|
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | - 'type' => 'give_docs_link', |
|
127 | - ), |
|
121 | + array( |
|
122 | + 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | + 'id' => 'donation_receipt_settings_docs_link', |
|
124 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | + 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | + 'type' => 'give_docs_link', |
|
127 | + ), |
|
128 | 128 | array( |
129 | 129 | 'id' => 'give_title_email_settings_2', |
130 | 130 | 'type' => 'sectionend' |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | 'type' => 'textarea', |
176 | 176 | 'default' => get_bloginfo( 'admin_email' ) |
177 | 177 | ), |
178 | - array( |
|
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | - 'id' => 'donation_notification_settings_docs_link', |
|
181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | - 'type' => 'give_docs_link', |
|
184 | - ), |
|
178 | + array( |
|
179 | + 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | + 'id' => 'donation_notification_settings_docs_link', |
|
181 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | + 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | + 'type' => 'give_docs_link', |
|
184 | + ), |
|
185 | 185 | array( |
186 | 186 | 'id' => 'give_title_email_settings_3', |
187 | 187 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Email' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Email. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'emails'; |
30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
30 | + $this->label = esc_html__('Emails', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'email-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'email-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Email |
@@ -54,36 +54,36 @@ discard block |
||
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'id' => 'email_template', |
57 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
58 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
57 | + 'name' => esc_html__('Email Template', 'give'), |
|
58 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
59 | 59 | 'type' => 'select', |
60 | 60 | 'options' => give_get_email_templates() |
61 | 61 | ), |
62 | 62 | array( |
63 | 63 | 'id' => 'email_logo', |
64 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
65 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
64 | + 'name' => esc_html__('Logo', 'give'), |
|
65 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
66 | 66 | 'type' => 'file' |
67 | 67 | ), |
68 | 68 | array( |
69 | 69 | 'id' => 'from_name', |
70 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
71 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
72 | - 'default' => get_bloginfo( 'name' ), |
|
70 | + 'name' => esc_html__('From Name', 'give'), |
|
71 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
72 | + 'default' => get_bloginfo('name'), |
|
73 | 73 | 'type' => 'text' |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'id' => 'from_email', |
77 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
78 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
79 | - 'default' => get_bloginfo( 'admin_email' ), |
|
77 | + 'name' => esc_html__('From Email', 'give'), |
|
78 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
79 | + 'default' => get_bloginfo('admin_email'), |
|
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | 82 | array( |
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
83 | + 'name' => esc_html__('Email Settings Docs Link', 'give'), |
|
84 | 84 | 'id' => 'email_settings_docs_link', |
85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
85 | + 'url' => esc_url('http://docs.givewp.com/settings-emails'), |
|
86 | + 'title' => __('Email Settings', 'give'), |
|
87 | 87 | 'type' => 'give_docs_link', |
88 | 88 | ), |
89 | 89 | array( |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | ), |
103 | 103 | array( |
104 | 104 | 'id' => 'donation_subject', |
105 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
106 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
107 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
105 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
106 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
107 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
108 | 108 | 'type' => 'text' |
109 | 109 | ), |
110 | 110 | array( |
111 | 111 | 'id' => 'donation_receipt', |
112 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
112 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
113 | 113 | 'desc' => sprintf( |
114 | 114 | /* translators: %s: emails tags list */ |
115 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give' ), |
|
115 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give'), |
|
116 | 116 | '<br/>'.give_get_emails_tags_list() |
117 | 117 | ), |
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
122 | + 'name' => esc_html__('Donation Receipt Settings Docs Link', 'give'), |
|
123 | 123 | 'id' => 'donation_receipt_settings_docs_link', |
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
124 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-receipt'), |
|
125 | + 'title' => __('Donation Receipt Settings', 'give'), |
|
126 | 126 | 'type' => 'give_docs_link', |
127 | 127 | ), |
128 | 128 | array( |
@@ -141,28 +141,28 @@ discard block |
||
141 | 141 | ), |
142 | 142 | array( |
143 | 143 | 'id' => 'admin_notices', |
144 | - 'name' => esc_html__( 'Admin Notifications', 'give' ), |
|
145 | - 'desc' => esc_html__( 'Enable/Disable all admin notifications from Give completely.', 'give' ), |
|
144 | + 'name' => esc_html__('Admin Notifications', 'give'), |
|
145 | + 'desc' => esc_html__('Enable/Disable all admin notifications from Give completely.', 'give'), |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'enabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ) |
152 | 152 | ), |
153 | 153 | array( |
154 | 154 | 'id' => 'donation_notification_subject', |
155 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
156 | - 'desc' => esc_html__( 'Enter the subject line for the admin donation notification email.', 'give' ), |
|
155 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
156 | + 'desc' => esc_html__('Enter the subject line for the admin donation notification email.', 'give'), |
|
157 | 157 | 'type' => 'text', |
158 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ) |
|
158 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give') |
|
159 | 159 | ), |
160 | 160 | array( |
161 | 161 | 'id' => 'donation_notification', |
162 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
162 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
163 | 163 | 'desc' => sprintf( |
164 | 164 | /* translators: %s: emails tags list */ |
165 | - __( 'Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give' ), |
|
165 | + __('Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give'), |
|
166 | 166 | '<br/>'.give_get_emails_tags_list() |
167 | 167 | ), |
168 | 168 | 'type' => 'wysiwyg', |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ), |
171 | 171 | array( |
172 | 172 | 'id' => 'admin_notice_emails', |
173 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
174 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
173 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
174 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
175 | 175 | 'type' => 'textarea', |
176 | - 'default' => get_bloginfo( 'admin_email' ) |
|
176 | + 'default' => get_bloginfo('admin_email') |
|
177 | 177 | ), |
178 | 178 | array( |
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
179 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
180 | 180 | 'id' => 'donation_notification_settings_docs_link', |
181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
181 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
182 | + 'title' => __('Donation Notification Settings', 'give'), |
|
183 | 183 | 'type' => 'give_docs_link', |
184 | 184 | ), |
185 | 185 | array( |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * Filter the emails settings. |
195 | 195 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
196 | 196 | */ |
197 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
197 | + $settings = apply_filters('give_settings_emails', $settings); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Filter the settings. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @since 1.8 |
203 | 203 | * @param array $settings |
204 | 204 | */ |
205 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
205 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
206 | 206 | |
207 | 207 | // Output. |
208 | 208 | return $settings; |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function get_sections() { |
218 | 218 | $sections = array( |
219 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
220 | - 'donation-receipt' => esc_html__( 'Donation Receipt', 'give' ), |
|
221 | - 'new-donation-notification' => esc_html__( 'New Donation Notification', 'give' ) |
|
219 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
220 | + 'donation-receipt' => esc_html__('Donation Receipt', 'give'), |
|
221 | + 'new-donation-notification' => esc_html__('New Donation Notification', 'give') |
|
222 | 222 | ); |
223 | 223 | |
224 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
224 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'give_profile_editor' ); |
|
26 | + parent::__construct('give_profile_editor'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -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 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_receipt' ); |
|
30 | + parent::__construct('give_receipt'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -40,60 +40,60 @@ discard block |
||
40 | 40 | return array( |
41 | 41 | array( |
42 | 42 | 'type' => 'container', |
43 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
43 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
44 | 44 | ), |
45 | 45 | array( |
46 | 46 | 'type' => 'listbox', |
47 | 47 | 'name' => 'price', |
48 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
48 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
49 | 49 | 'options' => array( |
50 | - 'true' => esc_html__( 'Show', 'give' ), |
|
51 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
50 | + 'true' => esc_html__('Show', 'give'), |
|
51 | + 'false' => esc_html__('Hide', 'give'), |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | array( |
55 | 55 | 'type' => 'listbox', |
56 | 56 | 'name' => 'donor', |
57 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
57 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
58 | 58 | 'options' => array( |
59 | - 'true' => esc_html__( 'Show', 'give' ), |
|
60 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
59 | + 'true' => esc_html__('Show', 'give'), |
|
60 | + 'false' => esc_html__('Hide', 'give'), |
|
61 | 61 | ), |
62 | 62 | ), |
63 | 63 | array( |
64 | 64 | 'type' => 'listbox', |
65 | 65 | 'name' => 'date', |
66 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
66 | + 'label' => esc_html__('Show Date:', 'give'), |
|
67 | 67 | 'options' => array( |
68 | - 'true' => esc_html__( 'Show', 'give' ), |
|
69 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
68 | + 'true' => esc_html__('Show', 'give'), |
|
69 | + 'false' => esc_html__('Hide', 'give'), |
|
70 | 70 | ), |
71 | 71 | ), |
72 | 72 | array( |
73 | 73 | 'type' => 'listbox', |
74 | 74 | 'name' => 'payment_key', |
75 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
75 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'payment_method', |
84 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
84 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
85 | 85 | 'options' => array( |
86 | - 'true' => esc_html__( 'Show', 'give' ), |
|
87 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
86 | + 'true' => esc_html__('Show', 'give'), |
|
87 | + 'false' => esc_html__('Hide', 'give'), |
|
88 | 88 | ), |
89 | 89 | ), |
90 | 90 | array( |
91 | 91 | 'type' => 'listbox', |
92 | 92 | 'name' => 'payment_id', |
93 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
93 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
94 | 94 | 'options' => array( |
95 | - 'true' => esc_html__( 'Show', 'give' ), |
|
96 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
95 | + 'true' => esc_html__('Show', 'give'), |
|
96 | + 'false' => esc_html__('Hide', 'give'), |
|
97 | 97 | ), |
98 | 98 | ), |
99 | 99 | ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_register' ); |
|
27 | + parent::__construct('give_register'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | return array( |
38 | 38 | array( |
39 | 39 | 'type' => 'container', |
40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
40 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
41 | 41 | ), |
42 | 42 | array( |
43 | 43 | 'type' => 'textbox', |
44 | 44 | 'name' => 'redirect', |
45 | 45 | 'minWidth' => 320, |
46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
46 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
47 | 47 | ), |
48 | 48 | ); |
49 | 49 | } |